RED-7075: Watermark Removal PMD errors fixed and logs
This commit is contained in:
parent
51b6307f91
commit
7a9c00e6cf
@ -179,8 +179,8 @@ public class ElementFeatures {
|
||||
int distance = 0;
|
||||
int maxLength = Math.max(this.hashOfImage.length(), hash2.length());
|
||||
for (int i = 0; i < maxLength; i++) {
|
||||
char char1 = (i < this.hashOfImage.length()) ? this.hashOfImage.charAt(i) : '0';
|
||||
char char2 = (i < hash2.length()) ? hash2.charAt(i) : '0';
|
||||
char char1 = i < this.hashOfImage.length() ? this.hashOfImage.charAt(i) : '0';
|
||||
char char2 = i < hash2.length() ? hash2.charAt(i) : '0';
|
||||
if (char1 != char2) {
|
||||
distance++;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class ImageHashFactory {
|
||||
int leftPixel = resizedImage.getRGB(x, y);
|
||||
int rightPixel = resizedImage.getRGB(x + 1, y);
|
||||
hash <<= 1;
|
||||
hash |= (leftPixel < rightPixel) ? 1 : 0;
|
||||
hash |= leftPixel < rightPixel ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,12 @@ public class WatermarkRemovalService {
|
||||
|
||||
List<ElementFeatures> watermarkElementFeatures = filterSameFormObjectsOccuringOnMostPages(formObjectsForPages);
|
||||
|
||||
if(watermarkElementFeatures.size() > 0){
|
||||
log.info("Watermark found and will be removed!");
|
||||
} else {
|
||||
log.info("No watermark found!");
|
||||
}
|
||||
|
||||
removeAllWatermarks(pdfDoc, watermarkElementFeatures);
|
||||
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user