Skip to content

Commit

Permalink
Merge pull request #1382 from veraPDF/debug_option
Browse files Browse the repository at this point in the history
Update debug option in cli
  • Loading branch information
MaximPlusov authored Oct 26, 2023
2 parents 87ec3c4 + 7ed8d95 commit 2d080e4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,20 @@ public List<? extends Object> getLinkedObjects(String link) {

private List<AXLPDFUAIdentification> getUAIdentification() {
VeraPDFMeta xmpMetadata = this.getXmpMetadata();
if (xmpMetadata != null) {
for (VeraPDFXMPNode node : xmpMetadata.getProperties()) {
if (XMPConst.NS_PDFUA_ID.equals(node.getNamespaceURI())) {
List<AXLPDFUAIdentification> res = new ArrayList<>(1);
res.add(new AXLPDFUAIdentification(xmpMetadata));
return Collections.unmodifiableList(res);
}
}
if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFUA_ID)) {
List<AXLPDFUAIdentification> res = new ArrayList<>(1);
res.add(new AXLPDFUAIdentification(xmpMetadata));
return Collections.unmodifiableList(res);
}
return Collections.emptyList();
}

private List<AXLPDFAIdentification> getIdentification() {
VeraPDFMeta xmpMetadata = this.getXmpMetadata();
if (xmpMetadata != null) {
for (VeraPDFXMPNode node : xmpMetadata.getProperties()) {
if (XMPConst.NS_PDFA_ID.equals(node.getNamespaceURI())) {
List<AXLPDFAIdentification> res = new ArrayList<>(1);
res.add(new AXLPDFAIdentification(xmpMetadata));
return Collections.unmodifiableList(res);
}
}
if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFA_ID)) {
List<AXLPDFAIdentification> res = new ArrayList<>(1);
res.add(new AXLPDFAIdentification(xmpMetadata));
return Collections.unmodifiableList(res);
}
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class AXLPDFUAIdentification extends AXLXMPObject implements PDFUAIdentif

public static final String PDFUA_IDENTIFICATION = "PDFUAIdentification";

private static final Logger LOGGER = Logger
.getLogger(AXLPDFUAIdentification.class.getName());
private static final Logger LOGGER = Logger.getLogger(AXLPDFUAIdentification.class.getName());

private final VeraPDFMeta metadata;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ private void configLogs() {

private void debugAndLog(String fileName) {
if (this.processor.getConfig().getValidatorConfig().isDebug()) {
logger.log(Level.WARNING, fileName);
Level level = this.processor.getConfig().getValidatorConfig().getLoggingLevel();
if (level.intValue() > Level.INFO.intValue()) {
LogsFileHandler.setLoggingLevel(Level.INFO);
}
logger.log(Level.INFO, fileName);
if (level.intValue() > Level.INFO.intValue()) {
LogsFileHandler.setLoggingLevel(level);
}
}
if (this.processor.getConfig().getValidatorConfig().isLogsEnabled()) {
try {
Expand Down
9 changes: 9 additions & 0 deletions xmp-core/src/main/java/org/verapdf/xmp/impl/VeraPDFMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ private boolean deleteSchema(String schemaNS) {
return isDeleted;
}

public boolean containsPropertiesFromNamespace(String nameSpaceURI) {
for (VeraPDFXMPNode node : getProperties()) {
if (nameSpaceURI.equals(node.getNamespaceURI())) {
return true;
}
}
return false;
}

private VeraPDFMeta setSimpleTextProperty(String namespaceURI, String propertyName, String value) throws XMPException {
if (value == null) {
this.meta.deleteProperty(namespaceURI, propertyName);
Expand Down

0 comments on commit 2d080e4

Please sign in to comment.