pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1666668 - in /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight: ./ metadata/ parser/ process/ process/reflect/ utils/
Date Sat, 14 Mar 2015 12:23:03 GMT
Author: msahyoun
Date: Sat Mar 14 12:23:03 2015
New Revision: 1666668

URL: http://svn.apache.org/r1666668
Log:
PDFBOX-2576 fix source code formatting

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightConfiguration.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/Validator_A1b.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/RDFAboutAttributeConcordanceValidation.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/XmlResultParser.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/GraphicObjectPageValidationProcess.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ShaddingPatternValidationProcess.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/utils/ContextHelper.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightConfiguration.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightConfiguration.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightConfiguration.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightConfiguration.java
Sat Mar 14 12:23:03 2015
@@ -218,10 +218,12 @@ public class PreflightConfiguration
 
     public void replacePageProcess(String processName, Class<? extends ValidationProcess>
process)
     {
-        if (process == null) {
+        if (process == null)
+        {
             removePageProcess(processName);    
         }
-        else {
+        else
+        {
             this.innerProcesses.put(processName, process);
         }
     }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/ValidationResult.java
Sat Mar 14 12:23:03 2015
@@ -416,7 +416,8 @@ public class ValidationResult
         }
 
         @Override
-        public int hashCode() {
+        public int hashCode()
+        {
             return errorCode.hashCode();
         }
 

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/Validator_A1b.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/Validator_A1b.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/Validator_A1b.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/Validator_A1b.java Sat
Mar 14 12:23:03 2015
@@ -77,23 +77,28 @@ public class Validator_A1b
         boolean isBatch = "batch".equals(args[posFile]);
         posFile += isBatch?1:0;
 
-        if (isGroup||isBatch) {
+        if (isGroup||isBatch)
+        {
             // prepare the list
             List<File> ftp = listFiles(args[posFile]);
             int status = 0;
-            if (!outputXml) {
+            if (!outputXml)
+            {
                 // simple list of files
                 for (File file2 : ftp)
                 {
                     status |= runSimple(new FileDataSource(file2));
                 }
                 System.exit(status);
-            } else {
+            }
+            else
+            {
                 Transformer transformer = TransformerFactory.newInstance().newTransformer();
                 transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                 transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"2");
                 XmlResultParser xrp = new XmlResultParser();
-                if (isGroup) {
+                if (isGroup)
+                {
                     Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
                     Element root = document.createElement("preflights");
                     document.appendChild(root);
@@ -103,28 +108,37 @@ public class Validator_A1b
                         Element result = xrp.validate(document,new FileDataSource(file));
                         root.appendChild(result);
                     }
-                    transformer.transform(new DOMSource(document), new StreamResult(new File(args[posFile]+".preflight.xml")));
-                } else {
+                    transformer.transform(new DOMSource(document), 
+                            new StreamResult(new File(args[posFile]+".preflight.xml")));
+                }
+                else
+                {
                     // isBatch
                     for (File file : ftp)
                     {
                         Element result = xrp.validate(new FileDataSource(file));
                         Document document = result.getOwnerDocument();
                         document.appendChild(result);
-                        transformer.transform(new DOMSource(document), new StreamResult(new
File(file.getAbsolutePath()+".preflight.xml")));
+                        transformer.transform(new DOMSource(document), 
+                                new StreamResult(new File(file.getAbsolutePath()+".preflight.xml")));
                     }
                 }
             }
 
 
 
-        } else {
+        } 
+        else
+        {
             // only one file
             FileDataSource fd = new FileDataSource(args[posFile]);
-            if (!outputXml) {
+            if (!outputXml)
+            {
                 // simple validation 
                 System.exit(runSimple(fd));
-            } else {
+            }
+            else
+            {
                 // generate xml output
                 XmlResultParser xrp = new XmlResultParser();
                 Element result = xrp.validate(fd);
@@ -139,7 +153,8 @@ public class Validator_A1b
 
     }
 
-    private static void usage () throws IOException {
+    private static void usage() throws IOException 
+    {
         String version = Version.getVersion();
 
         System.out.println("Usage : java org.apache.pdfbox.preflight.Validator_A1b [xml]
[<mode>] <file path>");
@@ -151,7 +166,8 @@ public class Validator_A1b
         System.out.println("Version : " + version);
     }
 
-    private static int runSimple (DataSource fd) throws Exception {
+    private static int runSimple(DataSource fd) throws Exception
+    {
         ValidationResult result = null;
         PreflightParser parser = new PreflightParser(fd);
         try
@@ -195,20 +211,26 @@ public class Validator_A1b
     }
 
 
-    private static List<File> listFiles (String path) throws IOException {
+    private static List<File> listFiles(String path) throws IOException
+    {
         List<File> files = new ArrayList<File>();
         File f = new File(path);
-        if (f.isFile()) {
+        if (f.isFile())
+        {
             FileReader fr = new FileReader(f);
             BufferedReader buf = new BufferedReader(fr);
-            while (buf.ready()) {
+            while (buf.ready())
+            {
                 File fn = new File(buf.readLine());
-                if (fn.exists()) {
+                if (fn.exists())
+                {
                     files.add(fn);
                 } // else warn ?
             }
             IOUtils.closeQuietly(buf);
-        } else {
+        }
+        else
+        {
             files.addAll(Arrays.asList(f.listFiles()));
         }
         return files;

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/RDFAboutAttributeConcordanceValidation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/RDFAboutAttributeConcordanceValidation.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/RDFAboutAttributeConcordanceValidation.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/RDFAboutAttributeConcordanceValidation.java
Sat Mar 14 12:23:03 2015
@@ -63,7 +63,8 @@ public class RDFAboutAttributeConcordanc
                 throw new DifferentRDFAboutException();
             }
             
-            if ("".equals(about)) {
+            if ("".equals(about))
+            {
                 about = schemaAboutValue;
             }
         }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/XmlResultParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/XmlResultParser.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/XmlResultParser.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/XmlResultParser.java
Sat Mar 14 12:23:03 2015
@@ -43,21 +43,27 @@ public class XmlResultParser
 {
 
 
-    public Element validate (DataSource source) throws IOException {
-        try {
+    public Element validate(DataSource source) throws IOException
+    {
+        try
+        {
             Document rdocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
             return validate(rdocument,source);
-        } catch (ParserConfigurationException e) {
+        }
+        catch (ParserConfigurationException e)
+        {
             throw new IOException("Failed to init document builder", e);
         }
     }
 
 
-    public Element validate (Document rdocument, DataSource source) throws IOException {
+    public Element validate(Document rdocument, DataSource source) throws IOException
+    {
         String pdfType = null;
         ValidationResult result;
         long before = System.currentTimeMillis();
-        try {
+        try
+        {
             PreflightParser parser = new PreflightParser(source);
             try
             {
@@ -80,7 +86,8 @@ public class XmlResultParser
         }
 
         long after = System.currentTimeMillis();
-        if (result.isValid()) {
+        if (result.isValid())
+        {
             Element preflight = generateResponseSkeleton(rdocument, source.getName(), after-before);
             // valid ?
             Element valid = rdocument.createElement("isValid");
@@ -88,7 +95,9 @@ public class XmlResultParser
             valid.setTextContent("true");
             preflight.appendChild(valid);
             return preflight;
-        } else {
+        }
+        else
+        {
             Element preflight = generateResponseSkeleton(rdocument, source.getName(), after-before);
             // valid ?
             createResponseWithError(rdocument, pdfType, result, preflight);
@@ -97,7 +106,8 @@ public class XmlResultParser
 
     }
 
-    protected void createResponseWithError(Document rdocument, String pdfType, ValidationResult
result, Element preflight) {
+    protected void createResponseWithError(Document rdocument, String pdfType, ValidationResult
result, Element preflight)
+    {
         Element valid = rdocument.createElement("isValid");
         valid.setAttribute("type", pdfType);
         valid.setTextContent("false");
@@ -131,13 +141,18 @@ public class XmlResultParser
         errors.setAttribute("count", String.format("%d", totalCount));
     }
 
-    private Map<ValidationError,Integer> cleanErrorList (List<ValidationError>
errors) {
+    private Map<ValidationError,Integer> cleanErrorList(List<ValidationError>
errors)
+    {
         Map<ValidationError,Integer> cleaned = new HashMap<ValidationError, Integer>(errors.size());
-        for (ValidationError ve: errors) {
+        for (ValidationError ve: errors)
+        {
             Integer found = cleaned.get(ve);
-            if (found!=null) {
+            if (found!=null)
+            {
                 cleaned.put(ve,found+1);
-            } else {
+            }
+            else
+            {
                 cleaned.put(ve,1);
             }
 
@@ -145,7 +160,8 @@ public class XmlResultParser
          return cleaned;
     }
 
-    protected Element generateFailureResponse (Document rdocument, String name,long duration,
String pdfType, Exception e) {
+    protected Element generateFailureResponse(Document rdocument, String name,long duration,
String pdfType, Exception e)
+    {
         Element preflight = generateResponseSkeleton(rdocument, name, duration);
         // valid ?
         Element valid = rdocument.createElement("isValid");
@@ -168,7 +184,8 @@ public class XmlResultParser
         return preflight;
     }
 
-    protected Element generateResponseSkeleton (Document rdocument, String name, long duration)
{
+    protected Element generateResponseSkeleton (Document rdocument, String name, long duration)
+    {
         Element preflight = rdocument.createElement("preflight");
         preflight.setAttribute("name", name);
         // duration

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Sat Mar 14 12:23:03 2015
@@ -294,7 +294,8 @@ public class StreamValidationProcess ext
                     }
                     else
                     {
-                        if (!endStream.startsWith("endStream")) {
+                        if (!endStream.startsWith("endStream"))
+                        {
                              addStreamLengthValidationError(context, cObj, length, endStream);
                         }
                     }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/GraphicObjectPageValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/GraphicObjectPageValidationProcess.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/GraphicObjectPageValidationProcess.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/GraphicObjectPageValidationProcess.java
Sat Mar 14 12:23:03 2015
@@ -59,14 +59,17 @@ public class GraphicObjectPageValidation
         }
         else if (!vPath.isEmpty() && vPath.isExpectedType(COSStream.class))
         {
-            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_XOBJECT_INVALID_TYPE,
"Invalid XObject subtype"));
+            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_XOBJECT_INVALID_TYPE,
+                    "Invalid XObject subtype"));
         }
         else
         {
-            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT,
"Graphic validation process needs at least one PDXObject"));
+            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT,
+                    "Graphic validation process needs at least one PDXObject"));
         }
 
-        if (validator != null) {
+        if (validator != null)
+        {
             validator.validate();
         }
     }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ShaddingPatternValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ShaddingPatternValidationProcess.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ShaddingPatternValidationProcess.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ShaddingPatternValidationProcess.java
Sat Mar 14 12:23:03 2015
@@ -49,12 +49,14 @@ public class ShaddingPatternValidationPr
     public void validate(PreflightContext context) throws ValidationException
     {
         PreflightPath vPath = context.getValidationPath();
-        if (vPath.isEmpty()) {
+        if (vPath.isEmpty())
+        {
             return;
         }
         else if (!vPath.isExpectedType(PDShading.class))
         {
-            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT,
"ShadingPattern validation required at least a PDResources"));
+            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT,
+                    "ShadingPattern validation required at least a PDResources"));
         } 
         else 
         {

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/utils/ContextHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/utils/ContextHelper.java?rev=1666668&r1=1666667&r2=1666668&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/utils/ContextHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/utils/ContextHelper.java
Sat Mar 14 12:23:03 2015
@@ -79,7 +79,8 @@ public class ContextHelper
         PreflightConfiguration config = context.getConfig();
         ValidationProcess process = config.getInstanceOfProcess(processName);
         process.validate(context);
-        if (needPop) {
+        if (needPop)
+        {
             validationPath.pop();
         }
     }



Mime
View raw message