Skip to content
Open
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
14 changes: 6 additions & 8 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,13 @@
METHOD_CALL, METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA, RECORD_DEF"/>
</module>

<!-- deactivated: 76 findings -->
<!-- NOSONAR
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL,
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL,
PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
-->
</module>


<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
Expand Down
12 changes: 6 additions & 6 deletions openpdf-core/src/main/java/org/openpdf/text/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -2271,8 +2271,8 @@ public void setCompressionLevel(int compressionLevel) {
}

private static boolean isJBIG2(int[] array) {
return array[0] == 0x97 && array[1] == 'J' && array[2] == 'B' && array[3] == '2' &&
array[4] == '\r' && array[5] == '\n' && array[6] == 0x1a && array[7] == '\n';
return array[0] == 0x97 && array[1] == 'J' && array[2] == 'B' && array[3] == '2'
&& array[4] == '\r' && array[5] == '\n' && array[6] == 0x1a && array[7] == '\n';
}

private static boolean isGif(int[] array) {
Expand All @@ -2292,13 +2292,13 @@ private static boolean isJpeg(int[] array) {
}

private static boolean isJpeg2000(int[] array) {
return (array[0] == 0x00 && array[1] == 0x00 && array[2] == 0x00 && array[3] == 0x0c) ||
(array[0] == 0xff && array[1] == 0x4f && array[2] == 0xff && array[3] == 0x51);
return (array[0] == 0x00 && array[1] == 0x00 && array[2] == 0x00 && array[3] == 0x0c)
|| (array[0] == 0xff && array[1] == 0x4f && array[2] == 0xff && array[3] == 0x51);
}

private static boolean isTiff(int[] array) {
return (array[0] == 'M' && array[1] == 'M' && array[2] == 0 && array[3] == 42) ||
(array[0] == 'I' && array[1] == 'I' && array[2] == 42 && array[3] == 0);
return (array[0] == 'M' && array[1] == 'M' && array[2] == 0 && array[3] == 42)
|| (array[0] == 'I' && array[1] == 'I' && array[2] == 42 && array[3] == 0);
}

private static boolean isWMF(int[] array) {
Expand Down
3 changes: 1 addition & 2 deletions openpdf-core/src/main/java/org/openpdf/text/Paragraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ public void setMultipliedLeading(float multipliedLeading) {
* @return the total leading (fixed and multiplied)
*/
public float getTotalLeading() {
float m = font == null ?
Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading);
float m = font == null ? Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading);
if (m > 0 && !hasLeading()) {
return m;
}
Expand Down
12 changes: 6 additions & 6 deletions openpdf-core/src/main/java/org/openpdf/text/Phrase.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,12 @@ public void add(int index, Element element) {
chunk.setHyphenation(hyphenation);
}
super.add(index, chunk);
} else if (element.type() == Element.PHRASE ||
element.type() == Element.ANCHOR ||
element.type() == Element.ANNOTATION ||
element.type() == Element.TABLE || // line added by David Freels
element.type() == Element.YMARK ||
element.type() == Element.MARKED) {
} else if (element.type() == Element.PHRASE
|| element.type() == Element.ANCHOR
|| element.type() == Element.ANNOTATION
|| element.type() == Element.TABLE // line added by David Freels
|| element.type() == Element.YMARK
|| element.type() == Element.MARKED) {
super.add(index, element);
} else {
throw new ClassCastException(String.valueOf(element.type()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ public void startElement(String tag, Map<String, String> style) {
}
if (addLeadingBreak) { // Not a new paragraph
int numChunks = currentParagraph.getChunks().size();
if (numChunks == 0 ||
((Chunk) (currentParagraph.getChunks().get(numChunks - 1))).getContent().endsWith("\n")) {
if (numChunks == 0
|| ((Chunk) (currentParagraph.getChunks().get(numChunks - 1))).getContent()
.endsWith("\n")) {
addLeadingBreak = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3113,8 +3113,7 @@ public int read() throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
} else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
Expand Down
16 changes: 8 additions & 8 deletions openpdf-core/src/main/java/org/openpdf/text/pdf/Barcode39.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ public class Barcode39 extends Barcode {
/**
* The character combinations to make the code 39 extended.
*/
private static final String EXTENDED = "%U" +
"$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$W$X$Y$Z" +
"%A%B%C%D%E /A/B/C/D/E/F/G/H/I/J/K/L - ./O" +
" 0 1 2 3 4 5 6 7 8 9/Z%F%G%H%I%J%V" +
" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" +
"%K%L%M%N%O%W" +
"+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z" +
"%P%Q%R%S%T";
private static final String EXTENDED = "%U"
+ "$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$W$X$Y$Z"
+ "%A%B%C%D%E /A/B/C/D/E/F/G/H/I/J/K/L - ./O"
+ " 0 1 2 3 4 5 6 7 8 9/Z%F%G%H%I%J%V"
+ " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
+ "%K%L%M%N%O%W"
+ "+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z"
+ "%P%Q%R%S%T";

/**
* Creates a new Barcode39.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ public ByteBuffer append_i(int b) {
* @return a reference to this <CODE>ByteBuffer</CODE> object
*/
public ByteBuffer append(byte[] b, int off, int len) {
if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0) || len == 0) {
if ((off < 0) || (off > b.length) || (len < 0)
|| ((off + len) > b.length) || ((off + len) < 0) || len == 0) {
return this;
}
int newcount = count + len;
Expand Down
25 changes: 17 additions & 8 deletions openpdf-core/src/main/java/org/openpdf/text/pdf/CFFFontSubset.java
Original file line number Diff line number Diff line change
Expand Up @@ -743,16 +743,25 @@ protected int StackOpp() {
if (Objects.equals(key, "roll") || Objects.equals(key, "put")) {
return -2;
}
if (Objects.equals(key, "callsubr") || Objects.equals(key, "callgsubr") || Objects.equals(key, "add")
|| Objects.equals(key, "sub") ||
Objects.equals(key, "div") || Objects.equals(key, "mul") || Objects.equals(key, "drop")
|| Objects.equals(key, "and") ||
Objects.equals(key, "or") || Objects.equals(key, "eq")) {
if (Objects.equals(key, "callsubr")
|| Objects.equals(key, "callgsubr")
|| Objects.equals(key, "add")
|| Objects.equals(key, "sub")
|| Objects.equals(key, "div")
|| Objects.equals(key, "mul")
|| Objects.equals(key, "drop")
|| Objects.equals(key, "and")
|| Objects.equals(key, "or")
|| Objects.equals(key, "eq")) {
return -1;
}
if (Objects.equals(key, "abs") || Objects.equals(key, "neg") || Objects.equals(key, "sqrt") || Objects.equals(
key, "exch") ||
Objects.equals(key, "index") || Objects.equals(key, "get") || Objects.equals(key, "not")
if (Objects.equals(key, "abs")
|| Objects.equals(key, "neg")
|| Objects.equals(key, "sqrt")
|| Objects.equals(key, "exch")
|| Objects.equals(key, "index")
|| Objects.equals(key, "get")
|| Objects.equals(key, "not")
|| Objects.equals(key, "return")) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void findNames() throws DocumentException, IOException {
rf.seek(directoryOffset);
int sfntVersion = rf.readInt();
boolean trueTypeFont = sfntVersion == TRUE_TYPE_SFNT_VERSION;
boolean cffDataFont = sfntVersion == CFF_DATA_SFNT_VERSION &&
(majorVersion == 1 || majorVersion == 2);
boolean cffDataFont = sfntVersion == CFF_DATA_SFNT_VERSION
&& (majorVersion == 1 || majorVersion == 2);
if (!trueTypeFont && !cffDataFont) {
throw new DocumentException(
MessageLocalization.getComposedMessage("1.is.not.a.valid.ttf.file", fileName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ private IVSResult tryProcessIVS(String text, int vsStartIndex, int baseCp) {
}

private static boolean isVariationSelector(int codePoint) {
return (codePoint >= 0xFE00 && codePoint <= 0xFE0F) ||
(codePoint >= 0xE0100 && codePoint <= 0xE01EF);
return (codePoint >= 0xFE00 && codePoint <= 0xFE0F) || (codePoint >= 0xE0100 && codePoint <= 0xE01EF);
}

private byte[] getCJKEncodingBytes(int[] glyph, int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ public void showText(PdfContentByte cb, BaseFont baseFont, float fontSize, Strin
* @return Font.LAYOUT_LEFT_TO_RIGHT or Font.LAYOUT_RIGHT_TO_LEFT
*/
protected int computeBidiFlags(String text) {
int bidiFlags = (defaultBidiDirection == Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT ?
Font.LAYOUT_LEFT_TO_RIGHT : Font.LAYOUT_RIGHT_TO_LEFT);
int bidiFlags = (defaultBidiDirection == Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT
? Font.LAYOUT_LEFT_TO_RIGHT : Font.LAYOUT_RIGHT_TO_LEFT);
if (Bidi.requiresBidi(text.toCharArray(), 0, text.length())) {
Bidi bidi = new Bidi(text, defaultBidiDirection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ private float[] resolvePositions(float[] positions) {
}
if (top == AUTOMATIC) {
// this is bad - must be programmer error
throw new RuntimeException("resolvePositions called with top=AUTOMATIC (-1). " +
"Top position must be set befure lines can be resolved");
throw new RuntimeException("resolvePositions called with top=AUTOMATIC (-1). "
+ "Top position must be set befure lines can be resolved");
}
positions[1] = top;
positions[3] = getColumnBottom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ protected PdfDictionary mergeAttrib(PdfDictionary parent, PdfDictionary child) {
}

for (PdfName key : child.getKeys()) {
if (key.equals(PdfName.DR) || key.equals(PdfName.DA) ||
key.equals(PdfName.Q) || key.equals(PdfName.FF) ||
key.equals(PdfName.DV) || key.equals(PdfName.V)
if (key.equals(PdfName.DR) || key.equals(PdfName.DA)
|| key.equals(PdfName.Q) || key.equals(PdfName.FF)
|| key.equals(PdfName.DV) || key.equals(PdfName.V)
|| key.equals(PdfName.FT)
|| key.equals(PdfName.F)) {
targ.put(key, child.get(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,7 @@ public float getVerticalPosition(boolean ensureNewLine) {
*/
protected void ensureNewLine() {
try {
if ((lastElementType == Element.PHRASE) ||
(lastElementType == Element.CHUNK)) {
if ((lastElementType == Element.PHRASE) || (lastElementType == Element.CHUNK)) {
newLine();
flushLines();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ private double drawString(String s, BaseFont baseFont, double x, double y) {
String fontFaceName = font.getFontName();
String fontLogicalName = font.getName();
if ((font.isBold() || (weight >= TextAttribute.WEIGHT_SEMIBOLD))
&& (fontFaceName.equals(fontLogicalName) ||
&& (fontFaceName.equals(fontLogicalName)
// bold logical font face name has suffix ".bold" / ".bolditalic"
(LOGICAL_FONT_NAMES.contains(fontLogicalName) &&
(fontFaceName.equals(fontLogicalName + BOLD_FONT_FACE_NAME_SUFFIX) ||
fontFaceName.equals(fontLogicalName + BOLD_ITALIC_FONT_FACE_NAME_SUFFIX))))) {
|| (LOGICAL_FONT_NAMES.contains(fontLogicalName)
&& (fontFaceName.equals(fontLogicalName + BOLD_FONT_FACE_NAME_SUFFIX)
|| fontFaceName.equals(fontLogicalName + BOLD_ITALIC_FONT_FACE_NAME_SUFFIX))))) {
// Simulate a bold font.
float strokeWidth = font.getSize2D() * (weight - TextAttribute.WEIGHT_REGULAR) / 30f;
if (strokeWidth != 1) {
Expand Down Expand Up @@ -1854,9 +1854,9 @@ private static class CompositeFontDrawer {
GET_FONT_NAME_METHOD = null;
}

SUPPORTED = FONT_UTILITIES_CLASS != null && COMPOSITE_FONT_CLASS != null &&
FONT2D_CLASS != null && GET_FONT2D_METHOD != null && GET_NUM_SLOTS_METHOD != null &&
GET_SLOT_FONT_METHOD != null && CAN_DYSPLAY_METHOD != null && GET_FONT_NAME_METHOD != null;
SUPPORTED = FONT_UTILITIES_CLASS != null && COMPOSITE_FONT_CLASS != null
&& FONT2D_CLASS != null && GET_FONT2D_METHOD != null && GET_NUM_SLOTS_METHOD != null
&& GET_SLOT_FONT_METHOD != null && CAN_DYSPLAY_METHOD != null && GET_FONT_NAME_METHOD != null;
}

private final transient StringBuilder sb = new StringBuilder();
Expand Down
3 changes: 1 addition & 2 deletions openpdf-core/src/main/java/org/openpdf/text/pdf/PdfName.java
Original file line number Diff line number Diff line change
Expand Up @@ -3234,8 +3234,7 @@ public class PdfName extends PdfObject implements Comparable<PdfName> {
final int flags = Modifier.STATIC | Modifier.PUBLIC | Modifier.FINAL;
try {
for (Field curFld : fields) {
if ((curFld.getModifiers() & flags) == flags &&
curFld.getType().equals(PdfName.class)) {
if ((curFld.getModifiers() & flags) == flags && curFld.getType().equals(PdfName.class)) {
PdfName name = (PdfName) curFld.get(null);
staticNames.put(decodeName(name.toString()), name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ public PdfPageLabelFormat(int physicalPage,

@Override
public String toString() {
return "PdfPageLabelFormat{" +
"physicalPage=" + physicalPage +
", numberStyle=" + numberStyle +
", prefix='" + prefix + '\'' +
", logicalPage=" + logicalPage +
'}';
return "PdfPageLabelFormat{"
+ "physicalPage=" + physicalPage
+ ", numberStyle=" + numberStyle
+ ", prefix='" + prefix + '\''
+ ", logicalPage=" + logicalPage
+ '}';
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@
encryption = encryptionObject.getIndirectReference();
}
if (includeFileID) {
byte[] fileIDPartTwo = overrideFileId != null ?
PdfEncryption.getFileIdChangingPart(overrideFileId) : PdfEncryption.createDocumentId();
byte[] fileIDPartTwo = overrideFileId != null
? PdfEncryption.getFileIdChangingPart(overrideFileId) : PdfEncryption.createDocumentId();
fileID = PdfEncryption.createInfoId(crypto.documentID, fileIDPartTwo);
}
} else if (includeFileID) {
Expand Down Expand Up @@ -480,7 +480,7 @@
return;
}
Rectangle page = reader.getPageSizeWithRotation(pageN);
int rotation = page.getRotation();

Check failure on line 483 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPO&open=AZ_CvVo3zWnqaO5dBfPO&pullRequest=1609
switch (rotation) {
case 90:
out.append(PdfContents.ROTATE90);
Expand Down Expand Up @@ -1232,8 +1232,8 @@
if (obj1 == null) {
continue;
}
PdfDictionary appDic = (obj1 instanceof PdfIndirectReference) ?
(PdfDictionary) PdfReader.getPdfObject(obj1) : (PdfDictionary) obj1;
PdfDictionary appDic = (obj1 instanceof PdfIndirectReference)
? (PdfDictionary) PdfReader.getPdfObject(obj1) : (PdfDictionary) obj1;
PdfObject obj = appDic.get(PdfName.N);
PdfAppearance app = null;
PdfObject objReal = PdfReader.getPdfObject(obj);
Expand Down Expand Up @@ -1741,7 +1741,7 @@
actionType.toString()));
}
PdfDictionary pg = reader.getPageN(page);
PdfDictionary aa = (PdfDictionary) PdfReader.getPdfObject(pg.get(PdfName.AA), pg);

Check failure on line 1744 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPP&open=AZ_CvVo3zWnqaO5dBfPP&pullRequest=1609
if (aa == null) {
aa = new PdfDictionary();
pg.put(PdfName.AA, aa);
Expand Down Expand Up @@ -1780,9 +1780,9 @@
void setDuration(int seconds, int page) {
PdfDictionary pg = reader.getPageN(page);
if (seconds < 0) {
pg.remove(PdfName.DUR);

Check failure on line 1783 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPR&open=AZ_CvVo3zWnqaO5dBfPR&pullRequest=1609
} else {
pg.put(PdfName.DUR, new PdfNumber(seconds));

Check failure on line 1785 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPQ&open=AZ_CvVo3zWnqaO5dBfPQ&pullRequest=1609
}
markUsed(pg);
}
Expand All @@ -1796,9 +1796,9 @@
void setTransition(PdfTransition transition, int page) {
PdfDictionary pg = reader.getPageN(page);
if (transition == null) {
pg.remove(PdfName.TRANS);

Check failure on line 1799 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPT&open=AZ_CvVo3zWnqaO5dBfPT&pullRequest=1609
} else {
pg.put(PdfName.TRANS, transition.getTransitionDictionary());

Check failure on line 1801 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPS&open=AZ_CvVo3zWnqaO5dBfPS&pullRequest=1609
}
markUsed(pg);
}
Expand Down Expand Up @@ -1843,11 +1843,11 @@
* @throws PdfException on invalid action type
*/
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException {
if (!(actionType.equals(DOCUMENT_CLOSE) ||
actionType.equals(WILL_SAVE) ||
actionType.equals(DID_SAVE) ||
actionType.equals(WILL_PRINT) ||
actionType.equals(DID_PRINT))) {
if (!(actionType.equals(DOCUMENT_CLOSE)
|| actionType.equals(WILL_SAVE)
|| actionType.equals(DID_SAVE)
|| actionType.equals(WILL_PRINT)
|| actionType.equals(DID_PRINT))) {
throw new PdfException(
MessageLocalization.getComposedMessage("invalid.additional.action.type.1", actionType.toString()));
}
Expand Down Expand Up @@ -1893,7 +1893,7 @@
PdfIndirectReference thumb = getImageReference(addDirectImageSimple(image));
reader.resetReleasePage();
PdfDictionary dic = reader.getPageN(page);
dic.put(PdfName.THUMB, thumb);

Check failure on line 1896 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfStamperImp.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=LibrePDF_OpenPDF&issues=AZ_CvVo3zWnqaO5dBfPU&open=AZ_CvVo3zWnqaO5dBfPU&pullRequest=1609
reader.resetReleasePage();
}

Expand Down
14 changes: 7 additions & 7 deletions openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +1306,8 @@
// ITextRenderer is not thread safe. So if you get this problem here, create a new
// instance, rather than re-using it.
// See: https://github.com/LibrePDF/OpenPDF/issues/164
throw new RuntimeException("The page " + pageReferences.size() +
" was requested but the document has only " + (currentPageNumber - 1) + " pages.");
throw new RuntimeException("The page " + pageReferences.size()
+ " was requested but the document has only " + (currentPageNumber - 1) + " pages.");
}

try {
Expand Down Expand Up @@ -1461,7 +1461,7 @@
}
PdfDictionary top = new PdfDictionary();
PdfIndirectReference topRef = getPdfIndirectReference();
Object[] kids = SimpleBookmark.iterateOutlines(this, topRef, newBookmarks, namedAsNames);

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 27-ea on ubuntu-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 27-ea on ubuntu-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 21 on ubuntu-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 21 on ubuntu-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 25 on ubuntu-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 25 on ubuntu-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 27-ea on macos-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 27-ea on macos-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 25 on macos-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 25 on macos-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 21 on macos-latest

unchecked conversion

Check warning on line 1464 in openpdf-core/src/main/java/org/openpdf/text/pdf/PdfWriter.java

View workflow job for this annotation

GitHub Actions / Build with Java 21 on macos-latest

unchecked method invocation: method iterateOutlines in class org.openpdf.text.pdf.SimpleBookmark is applied to given types
top.put(PdfName.FIRST, (PdfIndirectReference) kids[0]);
top.put(PdfName.LAST, (PdfIndirectReference) kids[1]);
top.put(PdfName.COUNT, new PdfNumber((Integer) kids[2]));
Expand Down Expand Up @@ -1696,11 +1696,11 @@
* org.openpdf.text.pdf.PdfAction)
*/
public void setAdditionalAction(PdfName actionType, PdfAction action) throws DocumentException {
if (!(actionType.equals(DOCUMENT_CLOSE) ||
actionType.equals(WILL_SAVE) ||
actionType.equals(DID_SAVE) ||
actionType.equals(WILL_PRINT) ||
actionType.equals(DID_PRINT))) {
if (!(actionType.equals(DOCUMENT_CLOSE)
|| actionType.equals(WILL_SAVE)
|| actionType.equals(DID_SAVE)
|| actionType.equals(WILL_PRINT)
|| actionType.equals(DID_PRINT))) {
throw new DocumentException(
MessageLocalization.getComposedMessage("invalid.additional.action.type.1", actionType.toString()));
}
Expand Down
4 changes: 2 additions & 2 deletions openpdf-core/src/main/java/org/openpdf/text/pdf/Pfm2afm.java
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ private void putheader() throws IOException {
* table of font widths, not if they are all the same.
*/
out.print("\nIsFixedPitch ");
if ((kind & 1) == 0 || /* Flag for mono */
avgwidth == maxwidth) { /* Avg width = max width */
if ((kind & 1) == 0 /* Flag for mono */
|| avgwidth == maxwidth) { /* Avg width = max width */
out.print("true");
isMono = true;
} else {
Expand Down
Loading
Loading