Skip to content

Commit

Permalink
[maven-release-plugin] copy for tag 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeltour committed May 27, 2013
2 parents 376a72e + 1ed8b65 commit 8239173
Show file tree
Hide file tree
Showing 128 changed files with 3,564 additions and 697 deletions.
57 changes: 50 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.idpf</groupId>
<artifactId>epubcheck</artifactId>
<version>3.0.1-SNAPSHOT</version>
<version>3.0.1</version>

<packaging>jar</packaging>

Expand Down Expand Up @@ -105,9 +105,9 @@
</mailingList>
</mailingLists>
<scm>
<connection>scm:svn:http://epubcheck.googlecode.com/svn/branches/epub3-maven/com.adobe.epubcheck</connection>
<developerConnection>scm:svn:https://epubcheck.googlecode.com/svn/branches/epub3-maven/com.adobe.epubcheck</developerConnection>
<url>http://code.google.com/p/epubcheck/source/browse/#svn%2Fbranches%2Fepub3-maven%2Fcom.adobe.epubcheck</url>
<connection>scm:svn:http://epubcheck.googlecode.com/svn/tags/3.0.1</connection>
<developerConnection>scm:svn:https://epubcheck.googlecode.com/svn/tags/3.0.1</developerConnection>
<url>http://code.google.com/p/epubcheck/source/browse/#svn%2Ftrunk/tags/3.0.1</url>
</scm>
<issueManagement>
<system>Google Code</system>
Expand All @@ -119,13 +119,15 @@
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<tool.build.date>${maven.build.timestamp}</tool.build.date>
</properties>

<dependencies>
<dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon</artifactId>
<version>9.1.0.8</version>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.4.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -193,6 +195,27 @@
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<_removeheaders>Include-Resource,Private-Package</_removeheaders>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -204,6 +227,7 @@
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.adobe.epubcheck.tool.Checker</mainClass>
</manifest>
<manifestFile>${project.build.directory}/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
Expand Down Expand Up @@ -338,6 +362,25 @@
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.felix
</groupId>
<artifactId>
maven-bundle-plugin
</artifactId>
<versionRange>
[2.3.7,)
</versionRange>
<goals>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion src/main/assembly/src.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<includes>
<include>*.txt</include>
<include>pom.xml</include>
<include>src/**/*.*</include>
<include>src/**/*</include>
</includes>
</fileSet>
</fileSets>
Expand Down
23 changes: 12 additions & 11 deletions src/main/java/com/adobe/epubcheck/api/EpubCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,32 @@
*/
public class EpubCheck implements DocumentValidator {

private static String VERSION =null;
private static String VERSION = null;
private static String BUILD_DATE = null;
public static String version() {
if (VERSION==null) {
if (VERSION == null) {
Properties prop = new Properties();
InputStream in = EpubCheck.class.getResourceAsStream("project.properties");
try {
prop.load(in);
} catch (Exception e) {
System.out.println("Couldn't read project properties");
System.err.println("Couldn't read project properties: " + e.getMessage());
} finally {
if (in!=null){
if (in != null){
try {
in.close();
} catch (IOException e) {}
}
}
VERSION = prop.getProperty("version");
BUILD_DATE = prop.getProperty("buildDate");
}
return VERSION;
}

public static String buildDate() {
return BUILD_DATE;
}

private File epubFile;
private Report report;
private EPUBVersion version;
Expand Down Expand Up @@ -176,19 +181,15 @@ public boolean validate() {
if (readCount != header.length) {
report.error(null, 0, 0, Messages.CANNOT_READ_HEADER);
} else {
int fnsize = getIntFromBytes(header, 26);
int extsize = getIntFromBytes(header, 28);

if (header[0] != 'P' && header[1] != 'K') {
report.error(null, 0, 0, Messages.CORRUPTED_ZIP_HEADER);
} else if (fnsize != 8) {
report.error(null, 0, 0, String.format(
Messages.LENGTH_FIRST_FILENAME, fnsize));
} else if (!CheckUtil.checkString(header, 30, "mimetype")) {
report.error(null, 0, 0, Messages.MIMETYPE_ENTRY_MISSING);
} else if (extsize != 0) {
report.error(null, 0, 0,
String.format(Messages.EXTRA_FIELD_LENGTH, extsize));
} else if (!CheckUtil.checkString(header, 30, "mimetype")) {
report.error(null, 0, 0, Messages.MIMETYPE_ENTRY_MISSING);
} else if (!CheckUtil.checkString(header, 38,
"application/epub+zip")) {
report.error(null, 0, 0, String.format(
Expand Down
43 changes: 32 additions & 11 deletions src/main/java/com/adobe/epubcheck/api/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public interface Report {

/**
* Called when a violation of the standard is found in epub.
* Called when a violation of the standard is found in the epub.
*
* @param resource
* name of the resource in the epub zip container that caused
Expand All @@ -45,7 +45,7 @@ public interface Report {
public void error(String resource, int line, int column, String message);

/**
* Called when some notable issue is found in epub.
* Called when some notable issue is found in the epub.
*
* @param resource
* name of the resource in the epub zip container that caused
Expand All @@ -66,17 +66,38 @@ public interface Report {
public int getWarningCount();

public int getExceptionCount();

/**
* Called when when a feature is found in epub.
*
* @param resource
* name of the resource in the epub zip container that has this feature
* or null if the feature is on the container level.
* @param feature
* a keyword to know what kind of feature has been found
* @param value
* value found
*
* @param resource
* name of the resource in the epub zip container that has this
* feature or null if the feature is on the container level.
* @param feature
* a keyword to know what kind of feature has been found
* @param value
* value found
*/
public void info(String resource, FeatureEnum feature, String value);

/**
* Called when a construct is detected that neither constitutes an error or
* a warning state, but for which information is issued anyway, as there
* may be reasons in certain contexts to check and/or adjust the construct.
* <p>
* Like {@link #info(String, FeatureEnum, String)}, an invocation of this
* method shall not be interpreted as a content anomaly.</p>
*
* @param resource
* name of the resource in the epub zip container in which the
* construct occurs.
* @param line
* line number in the resource on which the construct occurs
* @param column
* column number in the resource on which the construct occurs
* @param message
* message describing the detected construct
*/
public void hint(String resource, int line, int column, String message);

}
5 changes: 3 additions & 2 deletions src/main/java/com/adobe/epubcheck/css/CSSHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public void endDocument() {
}

@Override
public void startAtRule(CssAtRule atRule) {

public void startAtRule(CssAtRule atRule) {
if(atRule.getName().get() == "@import") {
CssConstruct uriOrString = atRule.getComponents().get(0);
if(uriOrString != null) {
Expand All @@ -79,6 +78,8 @@ public void startAtRule(CssAtRule atRule) {
//syntax error, url must be first parameter
}
}
} else if(atRule.getName().get() == "@namespace") {
//do not register namespace URIs as resources...
} else {
//check generically for urls in other atrules
registerURIs(atRule.getComponents(),
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/com/adobe/epubcheck/ncx/NCXChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.adobe.epubcheck.opf.ContentChecker;
import com.adobe.epubcheck.opf.XRefChecker;
import com.adobe.epubcheck.util.EPUBVersion;
import com.adobe.epubcheck.util.Messages;
import com.adobe.epubcheck.xml.XMLParser;
import com.adobe.epubcheck.xml.XMLValidator;

Expand Down Expand Up @@ -60,12 +61,12 @@ public NCXChecker(OCFPackage ocf, Report report, String path,
}

public void runChecks() {
if (!ocf.hasEntry(path))
if (!ocf.hasEntry(path)) {
report.error(null, 0, 0, "NCX file " + path + " is missing");
else if (!ocf.canDecrypt(path))
} else if (!ocf.canDecrypt(path)) {
report.error(null, 0, 0, "NCX file " + path
+ " cannot be decrypted");
else {
} else {
// relaxng
XMLParser ncxParser = null;
InputStream in = null;
Expand All @@ -78,12 +79,18 @@ else if (!ocf.canDecrypt(path))
ncxHandler = new NCXHandler(ncxParser, path, xrefChecker);
ncxParser.addXMLHandler(ncxHandler);
ncxParser.process();

if (ocf.getUniqueIdentifier() != null && !ocf.getUniqueIdentifier().equals(ncxHandler.getUid())) {
report.warning(path, 0, 0,
String.format(Messages.NCX_BAD_UID, ncxHandler.getUid(), ocf.getUniqueIdentifier()));
}

} catch (IOException e) {
throw new RuntimeException(e);
}finally{
try{
} finally {
try {
in.close();
}catch (Exception e) {
} catch (Exception e) {

}
}
Expand All @@ -96,7 +103,7 @@ else if (!ocf.canDecrypt(path))
ncxParser = new XMLParser(ocf.getInputStream(path), path,
"application/x-dtbncx+xml", report, version);
ncxParser.addValidator(ncxSchematronValidator);
ncxHandler = new NCXHandler(ncxParser, path, xrefChecker);
// ncxHandler = new NCXHandler(ncxParser, path, xrefChecker);
ncxParser.process();
} catch (Throwable t) {
report.error(
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/adobe/epubcheck/ncx/NCXHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class NCXHandler implements XMLHandler {

XRefChecker xrefChecker;

String uid;

NCXHandler(XMLParser parser, String path, XRefChecker xrefChecker) {
this.parser = parser;
this.path = path;
Expand Down Expand Up @@ -66,6 +68,15 @@ public void startElement() {
XRefChecker.RT_HYPERLINK);
}

} else if ("meta".equals(name)) {
String metaName = e.getAttribute("name");
if ("dtb:uid".equals(metaName)) {
String metaContent = e.getAttribute("content");
if (metaContent != null) {
uid = metaContent;
}
}

}
}
}
Expand All @@ -75,4 +86,11 @@ public void endElement() {

public void processingInstruction(String arg0, String arg1) {
}

/**
* @return the uid
*/
public String getUid() {
return this.uid;
}
}
Loading

0 comments on commit 8239173

Please sign in to comment.