mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
code formatting
This commit is contained in:
@@ -21,7 +21,7 @@ public class FeedEntryContent extends AbstractModel {
|
|||||||
|
|
||||||
@Column(length = 2048)
|
@Column(length = 2048)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Column(length = 40)
|
@Column(length = 40)
|
||||||
private String titleHash;
|
private String titleHash;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.sun.syndication.feed.synd.impl.ConverterForRSS090;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Support description tag for RSS09
|
* Support description tag for RSS09
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RSS090DescriptionConverter extends ConverterForRSS090 {
|
public class RSS090DescriptionConverter extends ConverterForRSS090 {
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.sun.syndication.io.impl.RSS090Parser;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Support description tag for RSS09
|
* Support description tag for RSS09
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RSS090DescriptionParser extends RSS090Parser {
|
public class RSS090DescriptionParser extends RSS090Parser {
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ public class FeedEntryContentService {
|
|||||||
* this is NOT thread-safe
|
* this is NOT thread-safe
|
||||||
*/
|
*/
|
||||||
public FeedEntryContent findOrCreate(FeedEntryContent content, String baseUrl) {
|
public FeedEntryContent findOrCreate(FeedEntryContent content, String baseUrl) {
|
||||||
|
|
||||||
String contentHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getContent()));
|
String contentHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getContent()));
|
||||||
String titleHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getTitle()));
|
String titleHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getTitle()));
|
||||||
Long existingId = feedEntryContentDAO.findExisting(contentHash, titleHash);
|
Long existingId = feedEntryContentDAO.findExisting(contentHash, titleHash);
|
||||||
|
|
||||||
FeedEntryContent result = null;
|
FeedEntryContent result = null;
|
||||||
if (existingId == null) {
|
if (existingId == null) {
|
||||||
content.setContentHash(contentHash);
|
content.setContentHash(contentHash);
|
||||||
|
|||||||
@@ -21,14 +21,12 @@ public class PasswordEncryptionService implements Serializable {
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(UserDAO.class);
|
private static final Logger log = LoggerFactory.getLogger(UserDAO.class);
|
||||||
|
|
||||||
public boolean authenticate(String attemptedPassword,
|
public boolean authenticate(String attemptedPassword, byte[] encryptedPassword, byte[] salt) {
|
||||||
byte[] encryptedPassword, byte[] salt) {
|
|
||||||
// Encrypt the clear-text password using the same salt that was used to
|
// Encrypt the clear-text password using the same salt that was used to
|
||||||
// encrypt the original password
|
// encrypt the original password
|
||||||
byte[] encryptedAttemptedPassword = null;
|
byte[] encryptedAttemptedPassword = null;
|
||||||
try {
|
try {
|
||||||
encryptedAttemptedPassword = getEncryptedPassword(
|
encryptedAttemptedPassword = getEncryptedPassword(attemptedPassword, salt);
|
||||||
attemptedPassword, salt);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// should never happen
|
// should never happen
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|||||||
@@ -88,18 +88,18 @@ public class PubSubHubbubCallbackREST {
|
|||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, "application/rss+xml" })
|
@Consumes({ MediaType.APPLICATION_ATOM_XML, "application/rss+xml" })
|
||||||
public Response callback() {
|
public Response callback() {
|
||||||
|
|
||||||
if (!applicationSettingsService.get().isPubsubhubbub()) {
|
if (!applicationSettingsService.get().isPubsubhubbub()) {
|
||||||
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
|
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
byte[] bytes = IOUtils.toByteArray(request.getInputStream());
|
byte[] bytes = IOUtils.toByteArray(request.getInputStream());
|
||||||
|
|
||||||
if (ArrayUtils.isEmpty(bytes)) {
|
if (ArrayUtils.isEmpty(bytes)) {
|
||||||
return Response.status(Status.BAD_REQUEST).entity("empty body received").build();
|
return Response.status(Status.BAD_REQUEST).entity("empty body received").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchedFeed fetchedFeed = parser.parse(null, bytes);
|
FetchedFeed fetchedFeed = parser.parse(null, bytes);
|
||||||
String topic = fetchedFeed.getFeed().getPushTopic();
|
String topic = fetchedFeed.getFeed().getPushTopic();
|
||||||
if (StringUtils.isBlank(topic)) {
|
if (StringUtils.isBlank(topic)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user