Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/cos/COSArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public ASInputStream getData(final COSStream.FilterFlags flags) {
try {
stream.close();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Error in closing stream", e);
LOGGER.log(Level.SEVERE, "Error in closing stream");
}
}
throw any;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/verapdf/cos/COSDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public List<COSObject> getObjects() {
result.add(newObj);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error while parsing object : " + key.getNumber() +
' ' + key.getGeneration(), e);
' ' + key.getGeneration());
} catch (StackOverflowError e) {
// TODO: double check this StackOverflow catching
throw new LoopedException("Loop in getting object from reader", e);
Expand All @@ -174,7 +174,7 @@ public List<COSObject> getObjectsByType(ASAtom type) {
addObjectWithTypeKeyCheck(result, obj, type);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error while parsing object : " + key.getNumber() +
' ' + key.getGeneration(), e);
' ' + key.getGeneration());
}
}
}
Expand Down Expand Up @@ -205,7 +205,7 @@ public Map<COSKey, COSObject> getObjectsMap() {
result.put(key, newObj);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error while parsing object : " + key.getNumber() +
' ' + key.getGeneration(), e);
' ' + key.getGeneration());
}
}
}
Expand Down Expand Up @@ -357,7 +357,7 @@ public void saveTo(final OutputStream stream) {
writeInputIntoOutput(pdf, stream);
pdf.close();
} catch (IOException e) {
LOGGER.log(Level.FINE, "Can't write COSDocument to stream", e);
LOGGER.log(Level.FINE, "Can't write COSDocument to stream");
} finally {
if (temp != null && !temp.delete()) {
temp.deleteOnExit();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/verapdf/cos/COSStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public ASInputStream getData(final FilterFlags filterFlags) {
result.reset();
return result;
} catch (IOException e) {
LOGGER.log(Level.FINE, "Can't get stream data", e);
LOGGER.log(Level.FINE, "Can't get stream data");
return new ASInFilter(this.stream) {
@Override
public int read() {
Expand All @@ -188,7 +188,7 @@ public boolean setData(final ASInputStream stream) {
File encodedDataFile = fileWithData.getFile();
return setData(new InternalInputStream(encodedDataFile, true), FilterFlags.RAW_DATA);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Can not set data", e);
LOGGER.log(Level.FINE, "Can not set data");
return false;
}
}
Expand Down Expand Up @@ -419,7 +419,7 @@ boolean equals(Object obj, List<COSBasePair> checkedObjects) {
return false;
}
} catch (IOException e) {
LOGGER.log(Level.FINE, "Exception during comparing streams", e);
LOGGER.log(Level.FINE, "Exception during comparing streams");
return false;
}
return flags == that.flags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class COSFilterRegistry {
registerFactory(ASAtom.LZW_DECODE, new ASFilterFactory(ASAtom.LZW_DECODE));
registerFactory(ASAtom.RUN_LENGTH_DECODE, new ASFilterFactory(ASAtom.RUN_LENGTH_DECODE));
} catch (VeraPDFParserException e) {
LOGGER.log(Level.FINE, "Trying to register factory twice", e);
LOGGER.log(Level.FINE, "Trying to register factory twice");
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/verapdf/cos/visitor/COSCopier.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@
import org.verapdf.cos.*;

import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* @author Timur Kamalov
*/
public class COSCopier implements IVisitor {

private static final Logger LOGGER = Logger.getLogger(COSCopier.class.getCanonicalName());

private final COSObject copy;

public COSCopier(COSObject copy) {
Expand Down Expand Up @@ -103,7 +107,7 @@ public void visitFromIndirect(COSIndirect obj) {
this.copy.set(obj);
} catch (Exception e) {
//TODO : throw
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to copy from Indirect object");
}
}
}
29 changes: 14 additions & 15 deletions src/main/java/org/verapdf/cos/visitor/Writer.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void visitFromBoolean(COSBoolean obj) {
try {
this.write(String.valueOf(obj.get()));
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write boolean");
}
}

Expand All @@ -135,7 +135,7 @@ public void visitFromInteger(COSInteger obj) {
try {
this.write(obj.toString());
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write integer");
}
}

Expand All @@ -144,7 +144,7 @@ public void visitFromReal(COSReal obj) {
try {
this.write(obj.toString());
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write real");
}
}

Expand All @@ -153,7 +153,7 @@ public void visitFromString(COSString obj) {
try {
this.write(obj.getPrintableString());
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write string");
}
}

Expand All @@ -162,7 +162,7 @@ public void visitFromName(COSName obj) {
try {
this.write(obj.toString());
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write name");
}
}

Expand All @@ -176,7 +176,7 @@ public void visitFromArray(COSArray obj) {
}
this.write("]");
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write array");
}
}

Expand All @@ -192,7 +192,7 @@ public void visitFromDictionary(COSDictionary obj) {
}
this.write(">>");
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write dictionary");
}
}

Expand All @@ -208,7 +208,7 @@ public void visitFromStream(COSStream obj) {
try {
obj.setIntegerKey(ASAtom.LENGTH, getASInputStreamLength(in));
} catch (IOException e) {
LOGGER.log(Level.FINE, "Can't calculate length of ASInputStream", e);
LOGGER.log(Level.FINE, "Can't calculate length of ASInputStream");
}

visitFromDictionary(obj);
Expand Down Expand Up @@ -265,7 +265,7 @@ public void visitFromNull(COSNull obj) {
try {
this.write("null");
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write null");
}
}

Expand Down Expand Up @@ -297,7 +297,7 @@ public void writeHeader(final String header) {
this.write(comment);
this.write(EOL);
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write header");
}
}

Expand Down Expand Up @@ -360,7 +360,7 @@ public void writeXRefInfo() {
this.write("startxref"); this.write(EOL); this.write(this.info.getStartXRef()); this.write(EOL);
this.write("%%EOF"); this.write(EOL);
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to write XRefInfo");
}
}

Expand All @@ -375,23 +375,22 @@ public void clear() {
this.toWrite.clear();
this.written.clear();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to clear XRefInfo");
}
}

public void close() {
try {
this.os.close();
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to close stream");
}
}

protected long getOffset() {
try {
return this.os.getOffset();
} catch (IOException e) {
e.printStackTrace();
return 0;
}
}
Expand All @@ -417,7 +416,7 @@ protected void generateID() {
//TODO : convert to COSArray
this.info.getTrailer().setID(idString);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "Failed to generate id");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/verapdf/external/ICCProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void initializeProfileHeader() {
parseTags(data);
} catch (IOException e) {
this.isLooksValid = false;
LOGGER.log(Level.FINE, "Exception during obtaining ICCProfile header", e);
LOGGER.log(Level.FINE, "Exception during obtaining ICCProfile header");
}
}

Expand All @@ -142,7 +142,7 @@ public String getMD5() {
md5.update(buffer);
md5ByteValue = md5.digest();
} catch (NoSuchAlgorithmException | IOException e) {
LOGGER.log(Level.FINE, "Exception during calculating ICCProfile md5 value", e);
LOGGER.log(Level.FINE, "Exception during calculating ICCProfile md5 value");
md5ByteValue = new byte[0];
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/external/JPEG2000.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static JPEG2000 fromStream(ASInputStream stream) {
}

} catch (IOException e) {
LOGGER.log(Level.FINE, "IO Exception reading JP2K stream", e);
LOGGER.log(Level.FINE, "IO Exception reading JP2K stream");
}
return builder.build();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/io/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private boolean docCanBeDecrypted() {
}
return res;
} catch (IOException e) {
LOGGER.log(Level.FINE, "Cannot read object " + this.parser.getEncryption().getObjectKey(), e);
LOGGER.log(Level.FINE, "Cannot read object " + this.parser.getEncryption().getObjectKey());
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/verapdf/parser/PDFParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private COSHeader parseHeader() throws IOException {
headerVersion = Float.parseFloat(headerParts[1]);
}
} catch (NumberFormatException e) {
LOGGER.log(Level.FINE, getErrorMessage("Can't parse the document header"), e);
LOGGER.log(Level.FINE, getErrorMessage("Can't parse the document header"));
}

result.setVersion(headerVersion);
Expand All @@ -173,7 +173,7 @@ public boolean isLinearized() {
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "IO error while trying to find first document dictionary", e);
LOGGER.log(Level.WARNING, "IO error while trying to find first document dictionary");
}

return false;
Expand All @@ -186,7 +186,7 @@ public COSObject getLinearizationDictionary() {
return linDict;
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "IO error while trying to find linearization dictionary", e);
LOGGER.log(Level.WARNING, "IO error while trying to find linearization dictionary");
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/PDDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void close() {
}
document.getResourceHandler().close();
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error in closing stream", e);
LOGGER.log(Level.FINE, "Error in closing stream");
}
document = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/colors/PDIndexed.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public double[] toRGB(double[] value) {
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Error reading color table for PDIndexed", e);
LOGGER.log(Level.WARNING, "Error reading color table for PDIndexed");
}

return getBaseColorSpace().toRGB(colorTable[index]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean authenticatePassword(String password) {
this.isPasswordCorrect = this.encryptionKey != null;
return this.isPasswordCorrect;
} catch (GeneralSecurityException e) {
LOGGER.log(Level.FINE, "Caught Security Exception while document decryption", e);
LOGGER.log(Level.FINE, "Caught Security Exception while document decryption");
this.isPasswordCorrect = false;
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/verapdf/pd/font/PDCIDFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public FontProgram getFontProgram() {
this.fontProgram = new CIDFontType2Program(fontData, this.cMap, cidToGIDMap, key);
StaticResources.cacheFontProgram(fontProgramID, this.fontProgram);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Can't read TrueType font program.", e);
LOGGER.log(Level.FINE, "Can't read TrueType font program.");
}
}
} else if (fontDescriptor.canParseFontFile(ASAtom.FONT_FILE3)) {
Expand Down Expand Up @@ -256,7 +256,7 @@ public FontProgram getFontProgram() {
LOGGER.warning("Invalid subtype of the embedded font stream");
}
} catch (Exception e) {
LOGGER.log(Level.FINE, "Can't read font program.", e);
LOGGER.log(Level.FINE, "Can't read font program.");
}
} else {
this.fontProgram = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/font/PDFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public boolean parseFontProgram() {
setSuccessfullyParsed(fontProgram.isSuccessfulParsing());
return fontProgram.isSuccessfulParsing();
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Can't parse font program of font " + getName(), e);
LOGGER.log(Level.WARNING, "Can't parse font program of font " + getName());
setSuccessfullyParsed(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/font/cmap/CMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public int getCodeFromStream(InputStream stream) throws IOException {
}
}
} catch (VeraPDFParserException e) {
LOGGER.log(Level.WARNING, "CMap " + this.name + " has invalid codespace range.", e);
LOGGER.log(Level.WARNING, "CMap " + this.name + " has invalid codespace range.");
}
if (shortestMatchingCodeSpaceLength == Integer.MAX_VALUE && !codeSpaces.isEmpty()) {
byte[] tmp = new byte[previousShortestMatchingCodeSpaceLength - i - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/font/cmap/CMapFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static CMap getCMap(String name, ASInputStream cMapStream) {
parser.parse();
res = parser.getCMap();
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Can't parse CMap " + name + ", using default", e);
LOGGER.log(Level.WARNING, "Can't parse CMap " + name + ", using default");
res = new CMap();
} catch (PostScriptException e) {
LOGGER.log(Level.WARNING, "PostScript exception while parsing CMap " + name);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/verapdf/pd/font/cmap/CMapFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void parseCMapFile() {
try (ASInputStream data = this.parentStream.getData(COSStream.FilterFlags.DECODE)) {
cMap = CMapFactory.getCMap(PDCMap.getCMapID(parentStream), data);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Exception while parsing cmap file", e);
LOGGER.log(Level.WARNING, "Exception while parsing cmap file");
}
}
}
Loading
Loading