You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2011/07/24 16:02:33 UTC
svn commit: r1150373 [1/12] - in /pdfbox/trunk/preflight: ./ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/padaf/ src/main/java/org/apache/padaf/preflight/
src/main/java/org/apache/padaf/preflight/a...
Author: lehmi
Date: Sun Jul 24 14:02:12 2011
New Revision: 1150373
URL: http://svn.apache.org/viewvc?rev=1150373&view=rev
Log:
PDFBOX-1056: added preflight source code
Added:
pdfbox/trunk/preflight/
pdfbox/trunk/preflight/pom.xml (with props)
pdfbox/trunk/preflight/src/
pdfbox/trunk/preflight/src/main/
pdfbox/trunk/preflight/src/main/java/
pdfbox/trunk/preflight/src/main/java/org/
pdfbox/trunk/preflight/src/main/java/org/apache/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/ValidationConstants.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/ValidationException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/ValidationResult.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/ValidatorConfig.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/Validator_A1b.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/AbstractActionManager.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/ActionManagerFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/GoToAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/GoToRemoteAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/HideAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/InvalidAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/NamedAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/SubmitAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/ThreadAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/UndefAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/actions/UriAction.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/AnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/AnnotationValidatorFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/FreeTextAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/InkAnnotationValdiator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/LineAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/LinkAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/MarkupAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/PDFAbAnnotationFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/PopupAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/PrintMarkAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/RubberStampAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/SquareCircleAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/TextAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/TrapNetAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/annotation/WidgetAnnotationValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/contentstream/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/contentstream/ContentStreamException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/contentstream/ContentStreamWrapper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/contentstream/StubOperator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/AbstractFontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/AbstractFontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/CFFType0FontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/CFFType2FontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/CompositeFontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/CompositeFontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/FontMetaDataValidation.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/FontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/FontValidatorFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/GlyphDetail.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/GlyphException.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/PDFAType3StreamParser.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/SimpleFontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/TrueTypeFontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/TrueTypeFontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type1FontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type1FontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type1MetricHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/UndefFontContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/type1/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/type1/GlyphDescription.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/type1/PeekInputStream.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/type1/Type1.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/type1/Type1Parser.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/AbstractXObjValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/ExtGStateContainer.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/ICCProfileWrapper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/ShadingPattern.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/TilingPattern.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/XObjFormValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/XObjImageValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/XObjPostscriptValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/XObjectValidator.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/ColorSpaceHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/ColorSpaceHelperFactory.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/ColorSpaces.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/DeviceColorSpaceHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/NoPatternColorSpaceHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/graphics/color/StandardColorSpaceHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/AbstractValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/AcroFormValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/BookmarkValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/CatalogValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/FileSpecificationValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/FontValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/GraphicsValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/MetadataValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/PagesValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/XRefValidationHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/COSUtils.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/ContentStreamEngine.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/FilterHelper.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/PdfElementParser.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/utils/RenderingIntents.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/xmp/
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/xmp/PDFAIdentificationValidation.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/xmp/RDFAboutAttributeConcordanceValidation.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/xmp/SynchronizedMetaDataValidation.java (with props)
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/xmp/XpacketParsingException.java (with props)
pdfbox/trunk/preflight/src/main/javacc/
pdfbox/trunk/preflight/src/main/javacc/pdf_extractor.jj
pdfbox/trunk/preflight/src/main/javacc/pdf_full_grammar.jj
pdfbox/trunk/preflight/src/main/resources/
pdfbox/trunk/preflight/src/main/resources/project.version
pdfbox/trunk/preflight/src/test/
pdfbox/trunk/preflight/src/test/java/
pdfbox/trunk/preflight/src/test/java/org/
pdfbox/trunk/preflight/src/test/java/org/apache/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/Benchmark.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/ExtractStream.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/IsartorTargetFileInformation.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/RetrieveMissingStream.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestInvalidDirectory.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestIsartorValidationFromClasspath.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestPDFA1bValidator.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestPdfaValidationFactory.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestValidDirectory.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/TestVersionning.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/annotations/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/annotations/MyAnnotationFactory.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/font/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/font/TestType1MetricHelper.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/helpers/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/helpers/MyFontValidationHelper.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/helpers/TestAbstractHelper.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/helpers/TestBookmarkValidationHelper.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/helpers/TestPageValidationHelper.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/util/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/util/ByteArrayDataSource.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/util/DocumentHandlerStub.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/util/IsartorPdfProvider.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/util/NOCatalogDocument.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java (with props)
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java (with props)
pdfbox/trunk/preflight/src/test/resources/
pdfbox/trunk/preflight/src/test/resources/expected_errors.txt (with props)
pdfbox/trunk/preflight/src/test/resources/log4j.xml (with props)
pdfbox/trunk/preflight/src/test/resources/org/
pdfbox/trunk/preflight/src/test/resources/org/apache/
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/preflight/
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/preflight/font/
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/preflight/font/subset_type1.font (with props)
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/preflight/font/subset_type1_valid.font (with props)
pdfbox/trunk/preflight/src/test/resources/org/apache/padaf/preflight/font/true_type.ttf (with props)
Added: pdfbox/trunk/preflight/pom.xml
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/pom.xml?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/pom.xml (added)
+++ pdfbox/trunk/preflight/pom.xml Sun Jul 24 14:02:12 2011
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>preflight</artifactId>
+
+ <name>PDF/A Validation</name>
+
+ <description>
+ pdfa-validation is a API used to ensure a declared PDF/A-1b document
+ respect all points of the ISO-19005 specification.
+ </description>
+
+ <parent>
+ <groupId>org.apache.pdfbox</groupId>
+ <artifactId>padaf-parent</artifactId>
+ <version>0.6.2-SNAPSHOT</version>
+ <relativePath>../padaf-parent</relativePath>
+ </parent>
+
+ <properties>
+ <compileSource>1.6</compileSource>
+ <javacPath>${user.javac6}</javacPath>
+ <pdfa.valid>${user.pdfa.valid}</pdfa.valid>
+ <pdfa.invalid>${user.pdfa.invalid}</pdfa.invalid>
+ <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>project.version</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-5</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.padaf.preflight.Validator_A1b</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>javacc</id>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ <configuration />
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <instrumentation>
+ <ignores>
+ <ignore>org.apache.padaf.preflight.javacc.*</ignore>
+ <ignore>org.apache..padaf.preflight.javacc.extractor.*</ignore>
+ </ignores>
+ <excludes>
+ <exclude>org/apache/padaf/preflight/javacc/**/*.class</exclude>
+ </excludes>
+ </instrumentation>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <configLocation>edoc-checkstyle.xml</configLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pdfbox</groupId>
+ <artifactId>xmpbox</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- TODO add or automatic ? -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>2.1.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pdfa</groupId>
+ <artifactId>isartor</artifactId>
+ <version>1.0-20080813</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <sourceFileLocale>en</sourceFileLocale>
+ <emptyComments>false</emptyComments>
+ <tagListOptions>
+ <tagClasses>
+ <tagClass>
+ <displayName>TODO List</displayName>
+ <tags>
+ <tag>
+ <matchString>TODO</matchString>
+ <matchType>exact</matchType>
+ </tag>
+ <tag>
+ <matchString>FIXME</matchString>
+ <matchType>exact</matchType>
+ </tag>
+ </tags>
+ </tagClass>
+ </tagClasses>
+ </tagListOptions>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <configLocation>edoc-checkstyle.xml</configLocation>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <showSuccess>true</showSuccess>
+ <aggregate>true</aggregate>
+ <outputDirectory>${project.reporting.outputDirectory}/surefire-report</outputDirectory>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <id />
+ </reportSet>
+ </reportSets>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.0.1</version>
+ <configuration>
+ <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Propchange: pdfbox/trunk/preflight/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,198 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.activation.DataSource;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.padaf.preflight.ValidationResult.ValidationError;
+import org.apache.padaf.preflight.helpers.AbstractValidationHelper;
+
+import org.apache.padaf.preflight.javacc.ParseException;
+
+public abstract class AbstractValidator implements PdfAValidator {
+
+ static {
+ try {
+ InputStream is = AbstractValidator.class.getClassLoader().getResourceAsStream("project.version");
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(is, bos);
+ IOUtils.closeQuietly(is);
+ IOUtils.closeQuietly(bos);
+ fullName = "PADAF - " + new String(bos.toByteArray(),"us-ascii");
+ } catch (Exception e) {
+ e.printStackTrace();
+ fullName = "PADAF - Unknown version";
+ }
+ }
+
+ protected ValidatorConfig config = null;
+
+ protected static String fullName;
+
+
+ protected Collection<AbstractValidationHelper> priorHelpers = new ArrayList<AbstractValidationHelper>();
+ protected Collection<AbstractValidationHelper> standHelpers = new ArrayList<AbstractValidationHelper>();
+
+ /**
+ *
+ * @param cfg
+ * @throws ValidationException
+ */
+ public AbstractValidator ( ValidatorConfig cfg ) throws ValidationException {
+ config = cfg;
+
+ Collection<Class<? extends AbstractValidationHelper>> ph = cfg.getPriorHelpers();
+ for (Class<? extends AbstractValidationHelper> priorHlpCls : ph) {
+ this.priorHelpers.add(instantiateHelper(priorHlpCls, cfg));
+ }
+
+ Collection<Class<? extends AbstractValidationHelper>> sh = cfg.getStandHelpers();
+ for (Class<? extends AbstractValidationHelper> standHlpCls : sh) {
+ this.priorHelpers.add(instantiateHelper(standHlpCls, cfg));
+ }
+
+ }
+
+ /**
+ * Instantiate a ValidationHelper using the given class.
+ *
+ * @param avhCls
+ * @param cfg
+ * @return
+ * @throws ValidationException
+ */
+ private AbstractValidationHelper instantiateHelper(Class<? extends AbstractValidationHelper> avhCls, ValidatorConfig cfg)
+ throws ValidationException {
+ try {
+ Constructor<? extends AbstractValidationHelper> construct = avhCls.getConstructor(ValidatorConfig.class);
+ return construct.newInstance(cfg);
+ } catch (NoSuchMethodException e) {
+ throw new ValidationException("Unable to create an instance of ValidationHelper : " + e.getMessage(), e);
+ } catch (InvocationTargetException e) {
+ throw new ValidationException("Unable to create an instance of ValidationHelper : " + e.getMessage(), e);
+ } catch (IllegalAccessException e) {
+ throw new ValidationException("Unable to create an instance of ValidationHelper : " + e.getMessage(), e);
+ } catch (InstantiationException e) {
+ throw new ValidationException("Unable to create an instance of ValidationHelper : " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Create an instance of Document Handler.
+ * This method can be override if a inherited class of DocumentHandler
+ * must be used.
+ *
+ * @param source
+ * @return
+ */
+ protected DocumentHandler createDocumentHandler(DataSource source) {
+ return new DocumentHandler(source);
+ }
+
+ /**
+ * This method calls the validate method of the given ValidationHelper. A
+ * validation exception will be thrown if the Helper throws a validation
+ * exception and if the list of errors is empty.
+ *
+ * @param handler
+ * the document handler which contains elements for the validation
+ * @param helper
+ * An inherited class of AbstractValidationHelper.
+ * @param errors
+ * A list of validation errors
+ * @throws ValidationException
+ */
+ protected void runValidation(DocumentHandler handler,
+ AbstractValidationHelper helper, List<ValidationError> errors)
+ throws ValidationException {
+ try {
+ errors.addAll(helper.validate(handler));
+ } catch (ValidationException e) {
+ if (errors.size() == 0) {
+ // If there are no error, the Exception is thrown because of we can't
+ // know if the
+ // exception is due to a validation error or to a unexpected cause.
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Create an instance of ValidationResult. This object contains an instance of
+ * ValidationError. If the ParseException is an instance of PdfParseException,
+ * the embedded validation error is initialized with the error code of the
+ * exception, otherwise it is an UnknownError.
+ *
+ * @param e
+ * @return
+ */
+ protected ValidationResult createErrorResult(ParseException e) {
+ if (e instanceof PdfParseException) {
+ if (e.getCause()==null) {
+ return new ValidationResult(new ValidationError(((PdfParseException) e)
+ .getErrorCode()));
+
+ } else if (e.getCause().getMessage()==null) {
+ return new ValidationResult(new ValidationError(((PdfParseException) e)
+ .getErrorCode()));
+ } else {
+ return new ValidationResult(new ValidationError(((PdfParseException) e)
+ .getErrorCode(),e.getCause().getMessage()));
+
+ }
+ }
+ return createUnknownErrorResult();
+ }
+
+ /**
+ * Create an instance of ValidationResult with a
+ * ValidationError(UNKNOWN_ERROR)
+ *
+ * @return
+ */
+ protected ValidationResult createUnknownErrorResult() {
+ ValidationError error = new ValidationError(
+ ValidationConstants.ERROR_UNKOWN_ERROR);
+ ValidationResult result = new ValidationResult(error);
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see net.padaf.preflight.PdfAValidator#getFullName()
+ */
+ public String getFullName() {
+ return fullName;
+ }
+
+
+
+
+}
\ No newline at end of file
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/AbstractValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import org.apache.padaf.preflight.javacc.PDFParserConstants;
+import org.apache.padaf.preflight.javacc.ParseException;
+
+/**
+ * This Exception is thrown if an validation error occurs during the javacc
+ * validation in the PDF Body.
+ *
+ * Error codes provided by this exception should start by 1.2 or 1.0.
+ */
+public class BodyParseException extends PdfParseException {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+ * .edoc.pdfa.validation.ParseException)
+ */
+ public BodyParseException(ParseException e) {
+ super(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String,java.lang.String)
+ */
+ public BodyParseException(String message, String code) {
+ super(message, code);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String)
+ */
+ public BodyParseException(String message) {
+ super(message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+ */
+ @Override
+ public String getErrorCode() {
+ if (this.errorCode != null) {
+ return this.errorCode;
+ }
+
+ // default error code
+ this.errorCode = ValidationConstants.ERROR_SYNTAX_BODY;
+
+ if (!isTokenMgrError) {
+ // it is a parse error, according to the ExpectedTokens data
+ // some error code can be returned
+ if (this.expectedTokenSequences != null) {
+ // check object delimiters error
+ for (int i = 0; i < this.expectedTokenSequences.length; ++i) {
+ // Check only the first Expected token on each array.
+ // Others can be check if some choice can start by the same token
+ // in this case, a factorization is possible
+ switch (this.expectedTokenSequences[i][0]) {
+ case PDFParserConstants.START_OBJECT:
+ case PDFParserConstants.END_OBJECT:
+ this.errorCode = ValidationConstants.ERROR_SYNTAX_OBJ_DELIMITER;
+ break;
+ }
+ }
+ // add here other error code
+ }
+ }
+
+ return errorCode;
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/BodyParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import org.apache.padaf.preflight.javacc.ParseException;
+
+/**
+ * This Exception is thrown if an validation error occurs during the javacc
+ * validation in the PDF Cross Ref table.
+ *
+ * Error codes provided by this exception should start by 1.3 or 1.0.
+ */
+public class CrossRefParseException extends PdfParseException {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+ * .edoc.pdfa.validation.ParseException)
+ */
+ public CrossRefParseException(ParseException e) {
+ super(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String,java.lang.String)
+ */
+ public CrossRefParseException(String message, String code) {
+ super(message, code);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String)
+ */
+ public CrossRefParseException(String message) {
+ super(message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+ */
+ @Override
+ public String getErrorCode() {
+ // if (!isTokenMgrError) {
+ // // use token information to know the cause
+ // }
+ // else Token Management Error or Unknown Error during the CrossRefTable
+ // Validation
+ return ValidationConstants.ERROR_SYNTAX_CROSS_REF;
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/CrossRefParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,207 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.activation.DataSource;
+
+import org.apache.padaf.preflight.javacc.PDFParser;
+import org.apache.padaf.preflight.javacc.extractor.ExtractorTokenManager;
+
+import org.apache.padaf.preflight.font.AbstractFontContainer;
+import org.apache.padaf.preflight.graphics.ICCProfileWrapper;
+import org.apache.padaf.preflight.utils.COSUtils;
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.pdmodel.PDDocument;
+
+/**
+ * The DocumentHandler is used to store useful information or Objects during the
+ * validation of the PDF file.
+ */
+public class DocumentHandler {
+ /**
+ * Contains the list of font name embedded in the PDF document.
+ */
+ protected Map<COSBase, AbstractFontContainer> embeddedFonts = new HashMap<COSBase, AbstractFontContainer>();
+
+ /**
+ * The javacc parser used to parse the document
+ */
+ protected PDFParser parser = null;
+
+ /**
+ * The PDFbox object representation of the PDF source.
+ */
+ protected PDDocument document = null;
+
+ /**
+ * The datasource to load the document from
+ */
+ protected DataSource source = null;
+
+ /**
+ * JavaCC Token Manager used to get some content of the PDF file as string (ex
+ * : Trailers)
+ */
+ protected ExtractorTokenManager pdfExtractor = null;
+
+ /**
+ * This wrapper contains the ICCProfile used by the PDF file.
+ */
+ protected ICCProfileWrapper iccProfileWrapper = null;
+ /**
+ * MetaData of the current pdf file.
+ */
+ protected XMPMetadata metadata = null;
+
+ /**
+ * Create the DocumentHandler using the DataSource which represent the PDF
+ * file to check.
+ *
+ * @param source
+ */
+ protected DocumentHandler(DataSource source) {
+ this.source = source;
+ }
+
+ /**
+ * @return the metadata
+ */
+ public XMPMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * @param metadata the metadata to set
+ */
+ public void setMetadata(XMPMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * @return the PDFParser used to parse the document
+ */
+ public PDFParser getParser() {
+ return parser;
+ }
+
+ /**
+ * Initialize the JavaCC parser which checks the syntax of the PDF.
+ *
+ * @param parser
+ */
+ protected void setParser(PDFParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @return the value of the pdfExtractor attribute.
+ */
+ public ExtractorTokenManager getPdfExtractor() {
+ return pdfExtractor;
+ }
+
+ /**
+ * Initialize the pdfExtractor attribute.
+ *
+ * @param pdfExtractor
+ */
+ protected void setPdfExtractor(ExtractorTokenManager pdfExtractor) {
+ this.pdfExtractor = pdfExtractor;
+ }
+
+ /**
+ * @return the PDFBox object representation of the document
+ */
+ public PDDocument getDocument() {
+ return document;
+ }
+
+ /**
+ * Initialize the PDFBox object which present the PDF File.
+ *
+ * @param document
+ */
+ protected void setDocument(PDDocument document) {
+ this.document = document;
+ }
+
+ /**
+ *
+ * @return The datasource of the pdf document
+ */
+ public DataSource getSource() {
+ return source;
+ }
+
+ public boolean isComplete() {
+ return (document != null) && (source != null) && (parser != null);
+ }
+
+ /**
+ * Add a FontContainer to allow TextObject validation.
+ *
+ * @param fKey
+ * @param fc
+ */
+ public void addFont(COSBase fKey, AbstractFontContainer fc) {
+ this.embeddedFonts.put(fKey, fc);
+ }
+
+
+
+ /**
+ * Return the FontContainer identified by the COSBase. If the given object
+ * is missing from the emmbeddedFont map, the null value is returned.
+ *
+ * @param fKey
+ * @return
+ */
+ public AbstractFontContainer getFont(COSBase fKey) {
+ return this.embeddedFonts.get(fKey);
+ }
+
+ /**
+ * @return the iccProfileWrapper
+ */
+ public ICCProfileWrapper getIccProfileWrapper() {
+ return iccProfileWrapper;
+ }
+
+ /**
+ * @param iccProfileWrapper
+ * the iccProfileWrapper to set
+ */
+ public void setIccProfileWrapper(ICCProfileWrapper iccProfileWrapper) {
+ this.iccProfileWrapper = iccProfileWrapper;
+ }
+
+ /**
+ * Close all opened resources
+ */
+ public void close() {
+ COSUtils.closeDocumentQuietly(document);
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/DocumentHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import org.apache.padaf.preflight.javacc.ParseException;
+
+/**
+ * This Exception is thrown if an validation error occurs during the javacc
+ * validation in the PDF Header.
+ *
+ * Error codes provided by this exception should start by 1.1.
+ */
+public class HeaderParseException extends PdfParseException {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+ * .edoc.pdfa.validation.ParseException)
+ */
+ public HeaderParseException(ParseException e) {
+ super(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String,java.lang.String)
+ */
+ public HeaderParseException(String message, String code) {
+ super(message, code);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String)
+ */
+ public HeaderParseException(String message) {
+ super(message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+ */
+ @Override
+ public String getErrorCode() {
+ if (!isTokenMgrError) {
+ System.out.println("## Header ParseError");
+ }
+
+ // else Token Management Error or Unknown Error during the Header Validation
+ return ValidationConstants.ERROR_SYNTAX_HEADER;
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/HeaderParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.activation.DataSource;
+
+import org.apache.padaf.preflight.javacc.PDFParser;
+import org.apache.padaf.preflight.javacc.ParseException;
+import org.apache.padaf.preflight.javacc.extractor.ExtractorTokenManager;
+import org.apache.padaf.preflight.javacc.extractor.SimpleCharStream;
+
+import org.apache.padaf.preflight.ValidationResult.ValidationError;
+import org.apache.padaf.preflight.helpers.AbstractValidationHelper;
+import org.apache.pdfbox.pdmodel.PDDocument;
+
+public class PdfA1bValidator extends AbstractValidator {
+
+ public PdfA1bValidator(ValidatorConfig cfg) throws ValidationException {
+ super(cfg);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfAValidator#validate(javax.activation.DataSource
+ * )
+ */
+ public synchronized ValidationResult validate(DataSource source)
+ throws ValidationException {
+ DocumentHandler handler = createDocumentHandler(source);
+ try {
+ // syntax (javacc) validation
+ try {
+ PDFParser parser = new PDFParser(source.getInputStream());
+ parser.PDF();
+ handler.setParser(parser);
+ } catch (IOException e) {
+ throw new ValidationException("Failed to parse datasource due to : "
+ + e.getMessage(), e);
+ } catch (ParseException e) {
+ return createErrorResult(e);
+ }
+
+ // if here is reached, validate with helpers
+ // init PDF Box document
+ PDDocument document = null;
+ try {
+ document = PDDocument.load(handler.getSource().getInputStream());
+ handler.setDocument(document);
+ } catch (IOException e) {
+ throw new ValidationException("PDFBox failed to parse datasource", e);
+ }
+
+ // init PDF Extractor
+ try {
+ SimpleCharStream scs = new SimpleCharStream(source.getInputStream());
+ ExtractorTokenManager extractor = new ExtractorTokenManager(scs);
+ extractor.parse();
+ handler.setPdfExtractor(extractor);
+ } catch (IOException e) {
+ throw new ValidationException(
+ "PDF ExtractorTokenMng failed to parse datasource", e);
+ }
+
+ // call all helpers
+ ArrayList<ValidationError> allErrors = new ArrayList<ValidationError>();
+
+ // Execute priority helpers.
+ for ( AbstractValidationHelper helper : priorHelpers ) {
+ runValidation(handler, helper, allErrors);
+ }
+
+ // Execute other helpers.
+ for ( AbstractValidationHelper helper : standHelpers ) {
+ runValidation(handler, helper, allErrors);
+ }
+
+ // check result
+ ValidationResult valRes = null;
+ if (allErrors.size() == 0) {
+ valRes = new ValidationResult(true);
+ } else {
+ // there are some errors
+ valRes = new ValidationResult(allErrors);
+ }
+
+ // addition of the some objects to avoid a second file parsing
+ valRes.setPdf(document);
+ valRes.setXmpMetaData(handler.getMetadata());
+ return valRes;
+ } catch ( ValidationException e ) {
+ // ---- Close all open resources if an error occurs.
+ handler.close();
+ throw e;
+ }
+ }
+
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfA1bValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import javax.activation.DataSource;
+
+public interface PdfAValidator {
+
+ /**
+ * Compute the validation of the given PDF file. If the PDF is valid,
+ * ValidationResult contains no error and the method isValid return true.
+ * Otherwise, the ValidationResult contains at least one ValidationError and
+ * the method isValid return false.
+ *
+ * @param source
+ * DataSource which represents the PDF file.
+ * @return an instance of ValidationResult
+ * @throws ValidationException
+ */
+ ValidationResult validate(DataSource source) throws ValidationException;
+
+
+ /**
+ * Return the version qualified name of the product
+ */
+ String getFullName ();
+
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+
+import static org.apache.padaf.preflight.ValidatorConfig.ACRO_FORM_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.BOOKMARK_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.CATALOG_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.FILE_SPECIF_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.FONT_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.GRAPHIC_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.META_DATA_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.PAGE_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.STREAM_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.TRAILER_FILTER;
+import static org.apache.padaf.preflight.ValidatorConfig.XREF_FILTER;
+
+import org.apache.padaf.preflight.actions.ActionManagerFactory;
+import org.apache.padaf.preflight.annotation.PDFAbAnnotationFactory;
+import org.apache.padaf.preflight.helpers.AcroFormValidationHelper;
+import org.apache.padaf.preflight.helpers.BookmarkValidationHelper;
+import org.apache.padaf.preflight.helpers.CatalogValidationHelper;
+import org.apache.padaf.preflight.helpers.FileSpecificationValidationHelper;
+import org.apache.padaf.preflight.helpers.FontValidationHelper;
+import org.apache.padaf.preflight.helpers.GraphicsValidationHelper;
+import org.apache.padaf.preflight.helpers.MetadataValidationHelper;
+import org.apache.padaf.preflight.helpers.PagesValidationHelper;
+import org.apache.padaf.preflight.helpers.StreamValidationHelper;
+import org.apache.padaf.preflight.helpers.TrailerValidationHelper;
+import org.apache.padaf.preflight.helpers.XRefValidationHelper;
+
+/**
+ * This Factory Provide an instance of PdfAValidator.<BR />
+ * If you call the <I>createValidatorInstance</I> without ValidationConfig, the instance will
+ * be created using the right default configuration. (static attributes in this factory)<BR />
+ * If you call the <I>createValidatorInstance</I> with your own ValidationConfig, be careful setting
+ * helpers with the right priority. For a PDF/A here is the 3 first helpers to call :
+ * <UL>
+ * <li>CatalogValidationHelper to initialize the OCCProfileWrapper in the DocumentHandler
+ * <li>StreamValidationHelper to check the length of stream before parse them.
+ * <li>FontValidationHelper to store FontContainers in the DocumentHandler before validate Text operator
+ * </UL>
+ * In addition you can set a custom AnnotationValidatorFactory and a custom ActionManagerFactory. By default
+ * the configuration object defines the PDFAbAnnotationFactory and the ActionManagerFactory.
+ */
+public class PdfAValidatorFactory {
+
+ public static final String PDF_A_1_b = "PDF/A-1b";
+
+ /**
+ * Create the Generic Configuration For the PDF/A-1B file
+ * @return
+ */
+ public static ValidatorConfig getStandardPDFA1BConfiguration () {
+ ValidatorConfig pdfa1bStandardConfig = new ValidatorConfig();
+ pdfa1bStandardConfig.addPriorHelpers(STREAM_FILTER, StreamValidationHelper.class);
+ pdfa1bStandardConfig.addPriorHelpers(CATALOG_FILTER, CatalogValidationHelper.class);
+ pdfa1bStandardConfig.addPriorHelpers(FONT_FILTER, FontValidationHelper.class);
+ pdfa1bStandardConfig.addPriorHelpers(GRAPHIC_FILTER, GraphicsValidationHelper.class);
+
+ pdfa1bStandardConfig.addStandHelpers(TRAILER_FILTER, TrailerValidationHelper.class);
+ pdfa1bStandardConfig.addStandHelpers(XREF_FILTER, XRefValidationHelper.class);
+ pdfa1bStandardConfig.addStandHelpers(BOOKMARK_FILTER, BookmarkValidationHelper.class);
+ pdfa1bStandardConfig.addStandHelpers(ACRO_FORM_FILTER, AcroFormValidationHelper.class);
+ pdfa1bStandardConfig.addStandHelpers(FILE_SPECIF_FILTER, FileSpecificationValidationHelper.class);
+ // Page Helper must be called after the FontHelper to check
+ // if Fonts used by the page content are embedded in the PDF file.
+ pdfa1bStandardConfig.addStandHelpers(PAGE_FILTER, PagesValidationHelper.class);
+ pdfa1bStandardConfig.addStandHelpers(META_DATA_FILTER, MetadataValidationHelper.class);
+
+ pdfa1bStandardConfig.setActionFactory(ActionManagerFactory.class);
+ pdfa1bStandardConfig.setAnnotationFactory(PDFAbAnnotationFactory.class);
+ return pdfa1bStandardConfig;
+ }
+
+ /**
+ * Return an implementation of PdfAValidator according to the given format using the
+ * default configuration linked to the format.
+ *
+ * @param format
+ * "PDF/A-1b" for a PDF/A-1b validator.
+ * @return
+ * @throws ValidationException
+ */
+ public PdfAValidator createValidatorInstance(String format)
+ throws ValidationException {
+ if (PDF_A_1_b.equals(format)) {
+ return new PdfA1bValidator(getStandardPDFA1BConfiguration());
+ } else {
+ throw new ValidationException("Unknown pdf format : " + format);
+ }
+ }
+
+
+ /**
+ * Return an implementation of PdfAValidator according to the given format.
+ *
+ * @param format "PDF/A-1b" for a PDF/A-1b validator.
+ * @param conf Instance of ValidatorConfig to use customized Helper
+ * @return
+ * @throws ValidationException
+ */
+ public PdfAValidator createValidatorInstance(String format, ValidatorConfig conf)
+ throws ValidationException {
+
+ if (conf == null) {
+ return createValidatorInstance(format);
+ }
+
+ if (PDF_A_1_b.equals(format)) {
+ return new PdfA1bValidator(conf);
+ } else {
+ throw new ValidationException("Unknown pdf format : " + format);
+ }
+ }
+}
\ No newline at end of file
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfAValidatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import org.apache.padaf.preflight.javacc.ParseException;
+
+/**
+ * A PdfParseException is thrown when the JavaCC Parser can't validate the pdf
+ * file. In this case a PdfParseException (or an inherited class) is thrown.
+ *
+ * A PdfParseException inherits from ParseException to avoid compilation errors
+ * in the classes generated by JavaCC.
+ */
+public class PdfParseException extends ParseException {
+ protected boolean isTokenMgrError = false;
+ protected String errorCode = null;
+ protected int line = 0;
+
+ /**
+ * This constructor clones the given ParseException and initialize the
+ * errorCode if it is possible. (e is an instance of PdfParseException)
+ *
+ * @param e
+ */
+ public PdfParseException(ParseException e) {
+ super();
+ this.currentToken = e.currentToken;
+ this.expectedTokenSequences = e.expectedTokenSequences;
+ this.tokenImage = e.tokenImage;
+ this.initCause(e);
+ if (e instanceof PdfParseException) {
+ this.errorCode = ((PdfParseException) e).errorCode;
+ }
+ }
+
+ /**
+ * This constructor calls the PdfParseException(String message, String code)
+ * constructor with a code set to null.
+ *
+ * @param message
+ * the explanation message (The message of TokenMngError). This field
+ * is mandatory.
+ */
+ public PdfParseException(String message) {
+ this(message, null);
+ }
+
+ /**
+ * This constructor is generally used when the PDF validation fails due to a
+ * TokenMngError. In this case, the message should be the message of the
+ * TokenMngError.
+ *
+ * @param message
+ * the explanation message (The message of TokenMngError). This field
+ * is mandatory.
+ * @param code
+ * the error code if it can be determined by the creator of this
+ * exception (Can be null)
+ */
+ public PdfParseException(String message, String code) {
+ super(message);
+ this.isTokenMgrError = true;
+ int lineIndex = message.indexOf("Lexical error at line ");
+ if (lineIndex > -1) {
+ String truncMsg = message.replace("Lexical error at line ", "");
+ String nbLine = truncMsg.substring(0, truncMsg.indexOf(","));
+ line = Integer.parseInt(nbLine);
+ }
+ this.errorCode = code;
+ }
+
+ /**
+ * Get the validation error code
+ *
+ * @return
+ */
+ public String getErrorCode() {
+ return this.errorCode;
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/PdfParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java?rev=1150373&view=auto
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java (added)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java Sun Jul 24 14:02:12 2011
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.preflight;
+
+import org.apache.padaf.preflight.javacc.ParseException;
+
+/**
+ * This Exception is thrown if an validation error occurs during the javacc
+ * validation in the PDF Trailer.
+ *
+ * Error codes provided by this exception should start by 1.4 or 1.0.
+ */
+public class TrailerParseException extends PdfParseException {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(net.awl
+ * .edoc.pdfa.validation.ParseException)
+ */
+ public TrailerParseException(ParseException e) {
+ super(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String,java.lang.String)
+ */
+ public TrailerParseException(String message, String code) {
+ super(message, code);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.awl.edoc.pdfa.validation.PdfParseException#PdfParseException(java.lang
+ * .String)
+ */
+ public TrailerParseException(String message) {
+ super(message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.awl.edoc.pdfa.validation.PdfParseException#getErrorCode()
+ */
+ @Override
+ public String getErrorCode() {
+ if (!isTokenMgrError) {
+ // use token information to know the cause
+ System.out.println("## Trailer ParseError");
+ }
+ // else Token Management Error or Unknown Error during the Trailer
+ // Validation
+ return ValidationConstants.ERROR_SYNTAX_TRAILER;
+ }
+}
Propchange: pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/TrailerParseException.java
------------------------------------------------------------------------------
svn:eol-style = native