You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/07/19 17:58:59 UTC

svn commit: r1891658 - /pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java

Author: tilman
Date: Mon Jul 19 17:58:59 2021
New Revision: 1891658

URL: http://svn.apache.org/viewvc?rev=1891658&view=rev
Log:
PDFBOX-4892: simplify code, as suggested by valerybokov

Modified:
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java?rev=1891658&r1=1891657&r2=1891658&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java (original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/font/util/FontMetaDataValidation.java Mon Jul 19 17:58:59 2021
@@ -82,10 +82,9 @@ public class FontMetaDataValidation
             {
                 if (!defaultTitle.equals(fontName) && (noSubSetName != null && !defaultTitle.equals(noSubSetName)))
                 {
-                    StringBuilder sb = new StringBuilder(80);
-                    sb.append("FontName")
-                            .append(" present in the FontDescriptor dictionary doesn't match with XMP information dc:title of the Font File Stream.");
-                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MISMATCH, sb.toString()));
+                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MISMATCH,
+                            "FontName present in the FontDescriptor dictionary doesn't match with "
+                                    + "XMP information dc:title of the Font File Stream."));
                     return false;
                 }
 
@@ -112,17 +111,17 @@ public class FontMetaDataValidation
                 }
 
                 // title doesn't match, it is an error.
-                StringBuilder sb = new StringBuilder(80);
-                sb.append("FontName");
                 if (empty)
                 {
-                    sb.append(" present in the FontDescriptor dictionary can't be found in XMP information the Font File Stream.");
-                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_PROPERTY_MISSING, sb.toString()));
+                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_PROPERTY_MISSING,
+                            "FontName present in the FontDescriptor dictionary can't be found in "
+                            + "XMP information the Font File Stream."));
                 }
                 else
                 {
-                    sb.append(" present in the FontDescriptor dictionary doesn't match with XMP information dc:title of the Font File Stream.");
-                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MISMATCH, sb.toString()));
+                    ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MISMATCH,
+                            "FontName present in the FontDescriptor dictionary doesn't match with XMP "
+                            + "information dc:title of the Font File Stream."));
                 }
                 return false;
             }