Skip to content

Commit 9b9a11b

Browse files
committed
Mark constructors of abstract classes as protected
1 parent db08fac commit 9b9a11b

File tree

23 files changed

+54
-80
lines changed

23 files changed

+54
-80
lines changed

barcodes/src/main/java/com/itextpdf/barcodes/Barcode1D.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public abstract class Barcode1D {
145145
*/
146146
protected String altText;
147147

148-
public Barcode1D(PdfDocument document) {
148+
protected Barcode1D(PdfDocument document) {
149149
this.document = document;
150150
}
151151

barcodes/src/main/java/com/itextpdf/barcodes/Barcode2D.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ public abstract class Barcode2D {
5454

5555
protected static final float DEFAULT_MODULE_SIZE = 1;
5656

57-
public Barcode2D() {
58-
}
59-
6057
/**
6158
* Gets the maximum area that the barcode and the text, if
6259
* any, will occupy. The lower left corner is always (0, 0).

io/src/main/java/com/itextpdf/io/font/otf/ContextualSubTable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ This file is part of the iText (R) project.
4747
import java.util.List;
4848

4949
public abstract class ContextualSubTable {
50+
5051
protected OpenTypeFontTableReader openReader;
5152
protected int lookupFlag;
5253

io/src/main/java/com/itextpdf/io/font/otf/OpenTypeFontTableReader.java

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public abstract class OpenTypeFontTableReader {
7070

7171
private final int unitsPerEm;
7272

73-
public OpenTypeFontTableReader(RandomAccessFileOrArray rf, int tableLocation, OpenTypeGdefTableReader gdef,
73+
protected OpenTypeFontTableReader(RandomAccessFileOrArray rf, int tableLocation, OpenTypeGdefTableReader gdef,
7474
Map<Integer, Glyph> indexGlyphMap, int unitsPerEm) throws java.io.IOException {
7575
this.rf = rf;
7676
this.tableLocation = tableLocation;
@@ -79,52 +79,10 @@ public OpenTypeFontTableReader(RandomAccessFileOrArray rf, int tableLocation, Op
7979
this.unitsPerEm = unitsPerEm;
8080
}
8181

82-
protected int getGlyphWidth(int index) {
83-
Glyph glyph = indexGlyphMap.get(index);
84-
if (glyph == null) {
85-
return 0;
86-
} else {
87-
return glyph.getWidth();
88-
}
89-
}
90-
91-
public int getGlyphToCharacter(int index) {
92-
Glyph glyph = indexGlyphMap.get(index);
93-
if (glyph == null) {
94-
return -1;
95-
} else {
96-
return glyph.getUnicode();
97-
}
98-
}
99-
10082
public Glyph getGlyph(int index) {
10183
return indexGlyphMap.get(index);
10284
}
10385

104-
/**
105-
* This is the starting point of the class. A sub-class must call this
106-
* method to start getting call backs to the {@link #readLookupTable(int, int, int[])}
107-
* method.
108-
* @throws FontReadingException
109-
*/
110-
protected final void startReadingTable() throws FontReadingException {
111-
try {
112-
rf.seek(tableLocation);
113-
/*int version =*/ rf.readInt(); //version not used
114-
int scriptListOffset = rf.readUnsignedShort();
115-
int featureListOffset = rf.readUnsignedShort();
116-
int lookupListOffset = rf.readUnsignedShort();
117-
// read the Script tables
118-
scriptsType = new OpenTypeScript(this, tableLocation + scriptListOffset);
119-
// read Feature table
120-
featuresType = new OpenTypeFeature(this, tableLocation + featureListOffset);
121-
// read LookUpList table
122-
readLookupListTable(tableLocation + lookupListOffset);
123-
} catch (java.io.IOException e) {
124-
throw new FontReadingException("Error reading font file", e);
125-
}
126-
}
127-
12886
public OpenTableLookup getLookupTable(int idx) {
12987
if (idx < 0 || idx >= lookupList.size()) {
13088
return null;
@@ -261,6 +219,30 @@ protected TagAndLocation[] readTagAndLocations(int baseLocation) throws java.io.
261219
return tagslLocs;
262220
}
263221

222+
/**
223+
* This is the starting point of the class. A sub-class must call this
224+
* method to start getting call backs to the {@link #readLookupTable(int, int, int[])}
225+
* method.
226+
* @throws FontReadingException
227+
*/
228+
final void startReadingTable() throws FontReadingException {
229+
try {
230+
rf.seek(tableLocation);
231+
/*int version =*/ rf.readInt(); //version not used
232+
int scriptListOffset = rf.readUnsignedShort();
233+
int featureListOffset = rf.readUnsignedShort();
234+
int lookupListOffset = rf.readUnsignedShort();
235+
// read the Script tables
236+
scriptsType = new OpenTypeScript(this, tableLocation + scriptListOffset);
237+
// read Feature table
238+
featuresType = new OpenTypeFeature(this, tableLocation + featureListOffset);
239+
// read LookUpList table
240+
readLookupListTable(tableLocation + lookupListOffset);
241+
} catch (java.io.IOException e) {
242+
throw new FontReadingException("Error reading font file", e);
243+
}
244+
}
245+
264246
private void readLookupListTable(int lookupListTableLocation) throws java.io.IOException {
265247
lookupList = new ArrayList<>();
266248
rf.seek(lookupListTableLocation);

io/src/main/java/com/itextpdf/io/font/otf/lookuptype6/SubTableLookup6.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This file is part of the iText (R) project.
5454
import java.util.List;
5555

5656
public abstract class SubTableLookup6 extends ContextualSubTable {
57+
5758
protected SubTableLookup6(OpenTypeFontTableReader openReader, int lookupFlag) {
5859
super(openReader, lookupFlag);
5960
}

kernel/src/main/java/com/itextpdf/kernel/crypto/OutputStreamEncryption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public abstract class OutputStreamEncryption extends java.io.OutputStream {
5454
/**
5555
* Creates a new instance of OutputStreamCounter
5656
*/
57-
public OutputStreamEncryption(java.io.OutputStream out) {
57+
protected OutputStreamEncryption(java.io.OutputStream out) {
5858
this.out = out;
5959
}
6060

kernel/src/main/java/com/itextpdf/kernel/crypto/securityhandler/PubKeySecurityHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public abstract class PubKeySecurityHandler extends SecurityHandler {
105105

106106
private byte[] seed = new byte[SEED_LENGTH];
107107

108-
public PubKeySecurityHandler() {
108+
protected PubKeySecurityHandler() {
109109
KeyGenerator key;
110110
try {
111111
key = KeyGenerator.getInstance("AES");
@@ -238,7 +238,9 @@ protected PdfArray createRecipientsArray() {
238238
}
239239

240240
protected abstract void setPubSecSpecificHandlerDicEntries(PdfDictionary encryptionDictionary, boolean encryptMetadata, boolean embeddedFilesOnly);
241+
241242
protected abstract String getDigestAlgorithm();
243+
242244
protected abstract void initKey(byte[] globalKey, int keyLength);
243245

244246
protected void initKeyAndFillDictionary(PdfDictionary encryptionDictionary, Certificate[] certs, int[] permissions,

kernel/src/main/java/com/itextpdf/kernel/crypto/securityhandler/SecurityHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public abstract class SecurityHandler {
7474
*/
7575
protected byte[] extra = new byte[5];
7676

77-
public SecurityHandler() {
77+
protected SecurityHandler() {
7878
try {
7979
md5 = MessageDigest.getInstance("MD5");
8080
} catch (Exception e) {
@@ -105,5 +105,6 @@ public void setHashKeyForNextObject(int objNumber, int objGeneration) {
105105
}
106106

107107
public abstract OutputStreamEncryption getEncryptionStream(java.io.OutputStream os);
108+
108109
public abstract IDecryptor getDecryptor();
109110
}

kernel/src/main/java/com/itextpdf/kernel/pdf/PdfDocument.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ public void createXmpMetadata() throws XMPException {
309309
if (v.trim().length() > 0)
310310
xmpMeta.appendArrayItem(XMPConst.NS_DC, PdfConst.Subject, new PropertyOptions(PropertyOptions.ARRAY), v.trim(), null);
311311
xmpMeta.setProperty(XMPConst.NS_PDF, PdfConst.Keywords, value);
312-
} else if (PdfName.Producer.equals(key)) {
313-
xmpMeta.setProperty(XMPConst.NS_PDF, PdfConst.Producer, value);
314312
} else if (PdfName.Creator.equals(key)) {
315313
xmpMeta.setProperty(XMPConst.NS_XMP, PdfConst.CreatorTool, value);
314+
} else if (PdfName.Producer.equals(key)) {
315+
xmpMeta.setProperty(XMPConst.NS_PDF, PdfConst.Producer, value);
316316
} else if (PdfName.CreationDate.equals(key)) {
317317
xmpMeta.setProperty(XMPConst.NS_XMP, PdfConst.CreateDate, PdfDate.getW3CDate(value));
318318
} else if (PdfName.ModDate.equals(key)) {

kernel/src/main/java/com/itextpdf/kernel/pdf/PdfObject.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ public abstract class PdfObject implements Serializable {
108108
*/
109109
private short state;
110110

111-
public PdfObject() {
112-
113-
}
114-
115111
/**
116112
* Gets object type.
117113
*

0 commit comments

Comments
 (0)