Skip to content

Commit

Permalink
Merge pull request #639 from veraPDF/remove_methods
Browse files Browse the repository at this point in the history
Remove unnecessary methods
  • Loading branch information
MaximPlusov authored and Git User committed Feb 2, 2024
1 parent b0ea57d commit d671404
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public class StaticContainers {
private static final ThreadLocal<Map<COSKey, Set<COSKey>>> destinationToStructParentsMap = new ThreadLocal<>();

private static final ThreadLocal<Stack<COSKey>> transparencyVisitedContentStreams = new ThreadLocal<>();
private static final ThreadLocal<Boolean> validPDF = new ThreadLocal<>();

private static final ThreadLocal<Map<String, Map<String, Glyph>>> cachedGlyphs = new ThreadLocal<>();

Expand All @@ -79,7 +78,6 @@ public static void clearAllContainers() {
transparencyVisitedContentStreams.set(new Stack<>());
cachedGlyphs.set(new HashMap<>());
noteIDSet.set(new HashSet<>());
validPDF.set(true);
lastHeadingNestingLevel.set(0);
currentTransparencyColorSpace.set(null);
xFormKeysSet.set(new HashSet<>());
Expand Down Expand Up @@ -203,14 +201,6 @@ public static void setTransparencyVisitedContentStreams(Stack<COSKey> transparen
StaticContainers.transparencyVisitedContentStreams.set(transparencyVisitedContentStreams);
}

public static boolean getValidPDF() {
return validPDF.get();
}

public static void setValidPDF(boolean validPDF) {
StaticContainers.validPDF.set(validPDF);
}

public static Integer getLastHeadingNestingLevel() {
return lastHeadingNestingLevel.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,6 @@ public Boolean getisLinearized() {
return this.isLinearised;
}

/**
* @return true if XMP content matches Info dictionary content
*/
@Override
public Boolean getdoesInfoMatchXMP() {
return XMPChecker.doesInfoMatchXMP(cosDocument);
}

@Override
public Boolean getMarked() {
if (this.catalog != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static boolean isValidPdfaStream(final InputStream toValidate, final PDF
}
}

// We need to save data from StaticContainers before validating embedded
// We need to save data from StaticContainers, StaticResources and StaticXmpCoreContainers before validating embedded
// documents
private PDDocument document;
private PDFAFlavour flavour;
Expand All @@ -146,7 +146,6 @@ private static boolean isValidPdfaStream(final InputStream toValidate, final PDF
private Stack<COSKey> transparencyVisitedContentStreams;
private Map<String, PDFont> cachedPDFonts;
private Map<String, Map<String, Glyph>> cachedGlyphs;
private boolean validPDF;
private Integer lastHeadingNestingLevel;
private org.verapdf.pd.colors.PDColorSpace currentTransparencyColorSpace;

Expand All @@ -172,7 +171,6 @@ private void saveStaticContainersState() {
this.noteIDSet = StaticContainers.getNoteIDSet();
this.xFormKeysSet = StaticContainers.getXFormKeysSet();
this.transparencyVisitedContentStreams = StaticContainers.getTransparencyVisitedContentStreams();
this.validPDF = StaticContainers.getValidPDF();
this.lastHeadingNestingLevel = StaticContainers.getLastHeadingNestingLevel();
this.cachedGlyphs = StaticContainers.getCachedGlyphs();
this.currentTransparencyColorSpace = StaticContainers.getCurrentTransparencyColorSpace();
Expand Down Expand Up @@ -202,7 +200,6 @@ private void restoreSavedSCState() {
StaticContainers.setNoteIDSet(this.noteIDSet);
StaticContainers.setXFormKeysSet(this.xFormKeysSet);
StaticContainers.setTransparencyVisitedContentStreams(this.transparencyVisitedContentStreams);
StaticContainers.setValidPDF(this.validPDF);
StaticContainers.setLastHeadingNestingLevel(this.lastHeadingNestingLevel);
StaticContainers.setCachedGlyphs(this.cachedGlyphs);
StaticContainers.setCurrentTransparencyColorSpace(this.currentTransparencyColorSpace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ private void initForNotType3(boolean fontProgramIsInvalid, FontProgram fontProgr
}
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error in parsing font program", e);
StaticContainers.setValidPDF(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ private List<Glyph> getUsedGlyphs() {
}
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error processing text show operator's string argument : " + new String(string), e);
StaticContainers.setValidPDF(false);
}
}
return Collections.unmodifiableList(res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ protected void parseOperators() {
if (key != null) {
if (StaticContainers.getTransparencyVisitedContentStreams().contains(key)) {
LOGGER.log(Level.FINE, "Parsing content stream loop");
StaticContainers.setValidPDF(false);
this.containsTransparency = false;
this.operators = Collections.emptyList();
return;
Expand Down Expand Up @@ -171,7 +170,6 @@ protected void parseOperators() {
}
} catch (IOException e) {
LOGGER.log(Level.FINE, "Error while parsing content stream. " + e.getMessage(), e);
StaticContainers.setValidPDF(false);
this.operators = Collections.emptyList();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ public Boolean getcontainsAlternatePresentations() {
return Boolean.FALSE;
}

@Override
public Boolean getvalidPDF() {
return StaticContainers.getValidPDF();
}

@Override
public Boolean getcontainsAA() {
return this.catalog != null && this.catalog.getObject().getType().isDictionaryBased() && this.catalog.knownKey(ASAtom.AA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ public GFPDStructElem(org.verapdf.pd.structure.PDStructElem structElemDictionary
this(structElemDictionary, null, STRUCTURE_ELEMENT_TYPE);
}

/**
* @return Type entry of current structure element
*/
@Override
public String getType() {
ASAtom type = ((org.verapdf.pd.structure.PDStructElem) simplePDObject).getType();
return type == null ? null : type.getValue();
}

@Override
public String getparentStandardType() {
org.verapdf.pd.structure.PDStructElem parent = ((org.verapdf.pd.structure.PDStructElem) simplePDObject).getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ private List<CosUnicodeName> getRoleMapNames() {
return Collections.emptyList();
}

@Override
public String gettopLevelFirstElementStandardType() {
List<GFPDStructElem> children = getStructuralSignificanceChildren();
if (!children.isEmpty()) {
return children.get(0).getstandardType();
}
return null;
}

@Override
public String getfirstChildStandardTypeNamespaceURL() {
List<GFPDStructElem> children = getStructuralSignificanceChildren();
Expand Down

0 comments on commit d671404

Please sign in to comment.