diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-08-14 17:17:00 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-08-14 17:17:00 +0000 |
commit | 29e8badcec8bd40eca2ef4940133f08eeefdda11 (patch) | |
tree | 7b44a2d058ae8a60ff278f5d26f243eb674e54c6 /src/codegen | |
parent | c81729764a0692e9f5e31ec28722403b603ee5aa (diff) | |
download | xmlgraphics-fop-29e8badcec8bd40eca2ef4940133f08eeefdda11.tar.gz xmlgraphics-fop-29e8badcec8bd40eca2ef4940133f08eeefdda11.zip |
Bugzilla #49733:
Resolved compilation (safe one), Checkstyle and many Javadoc warnings.
Submitted by: Glenn Adams <glenn.at.skynav.com>
Changes to patch:
- Restored the deprecated Graphics2DAdapter method (to be removed after Barcode4J 2.1 is released).
- Restored Renderer.startPageSequence(LineArea) pending discussion about removal.
- build.xml: set max VM to 1024MB instead of 2048MB to allow for 32-bit JVMs.
- build.xml: restored longer taskdef names.
- Restored Checkstyle 4 file for people running older IDEs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@985537 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/codegen')
5 files changed, 101 insertions, 78 deletions
diff --git a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java index c2262b7b7..6786e43f0 100644 --- a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java +++ b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java @@ -117,6 +117,7 @@ public class EventProducerCollectorTask extends Task { /** * Updates the translation file with new entries for newly found event producer methods. + * @param modelFile the model file to use * @throws IOException if an I/O error occurs */ protected void updateTranslationFile(File modelFile) throws IOException { diff --git a/src/codegen/unicode/data/LineBreakPairTable.txt b/src/codegen/unicode/data/LineBreakPairTable.txt index 948877d9f..8e2c0c6ce 100644 --- a/src/codegen/unicode/data/LineBreakPairTable.txt +++ b/src/codegen/unicode/data/LineBreakPairTable.txt @@ -1,28 +1,29 @@ - OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT -OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^ -CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % % -PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _ -AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ -ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ -IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ -HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ #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_ % % _ _ ^ # ^ % % % % % +PO % ^ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ +NU % ^ ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _ +AL % ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ +ID _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ +IN _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ +HY _ ^ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +BA _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +BB % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +B2 _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _ +ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _ +CM _ ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ +WJ % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +H2 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % +H3 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % +JL _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _ +JV _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % +JT _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % diff --git a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java index 4b3b9f734..9ea35581d 100644 --- a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java +++ b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java @@ -51,7 +51,8 @@ import org.apache.fop.util.License; */ public final class UnicodeClasses { - public static String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/"; + /** directory containing unicode properties files */ + public static final String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/"; /** * Disallow constructor for this utility class @@ -77,7 +78,7 @@ public final class UnicodeClasses { * Generate classes.xml from Java's compiled-in Unicode Character Database * @param hexcode whether to prefix each class with the hexcode (only for debugging purposes) * @param outfilePath output file - * @throws IOException + * @throws IOException if an I/O exception occurs */ public static void fromJava(boolean hexcode, String outfilePath) throws IOException { File f = new File(outfilePath); @@ -160,7 +161,6 @@ public final class UnicodeClasses { * @param outfilePath output file * @throws IOException if the input files are not found * @throws URISyntaxException - * @throws FOPException */ public static void fromUCD(boolean hexcode, String unidataPath, String outfilePath) throws IOException, URISyntaxException { @@ -286,7 +286,7 @@ public final class UnicodeClasses { * @param hexcode whether to prefix each class with the hexcode (only for debugging purposes) * @param lettersPath path to XeTeX's Unicode letters file unicode-letters-XeTeX.tex * @param outfilePath output file - * @throws IOException + * @throws IOException in case of an I/O exception */ public static void fromTeX(boolean hexcode, String lettersPath, String outfilePath) throws IOException { diff --git a/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java b/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java index f96b7484f..f4af3d915 100644 --- a/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java +++ b/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java @@ -33,6 +33,8 @@ import java.util.Map; import org.apache.fop.util.License; +// CSOFF: LineLengthCheck + /** * <p>Utility for generating a Java class representing line break properties * from the Unicode property files.</p> @@ -46,7 +48,10 @@ import org.apache.fop.util.License; * </ul> * */ -public class GenerateLineBreakUtils { +public final class GenerateLineBreakUtils { + + private GenerateLineBreakUtils() { + } private static final int MAX_LINE_LENGTH = 110; @@ -57,12 +62,14 @@ public class GenerateLineBreakUtils { private static final byte PROHIBITED_BREAK = 4; // ^ in table private static final byte EXPLICIT_BREAK = 5; // ! in rules private static final String BREAK_CLASS_TOKENS = "_%#@^!"; - private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" }; + private static final String[] NOT_IN_PAIR_TABLE = { + "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" + }; - private static final byte lineBreakProperties[] = new byte[0x10000]; - private static final Map lineBreakPropertyValues = new HashMap(); - private static final List lineBreakPropertyShortNames = new ArrayList(); - private static final List lineBreakPropertyLongNames = new ArrayList(); + private static byte[] lineBreakProperties = new byte[0x10000]; + private static Map lineBreakPropertyValues = new HashMap(); + private static List lineBreakPropertyShortNames = new ArrayList(); + private static List lineBreakPropertyLongNames = new ArrayList(); /** * Generate a class managing line break properties for Unicode characters and a sample @@ -76,7 +83,7 @@ public class GenerateLineBreakUtils { * @param outFileName Name of the output file. * @throws Exception in case anything goes wrong. */ - private static void convertLineBreakProperties( + private static void convertLineBreakProperties( // CSOK: MethodLength String lineBreakFileName, String propertyValueFileName, String breakPairFileName, @@ -86,21 +93,21 @@ public class GenerateLineBreakUtils { readLineBreakProperties(lineBreakFileName, propertyValueFileName); // read break pair table int lineBreakPropertyValueCount = lineBreakPropertyValues.size(); - int tableSize = lineBreakPropertyValueCount - notInPairTable.length; - Map notInPairTableMap = new HashMap(notInPairTable.length); - for (int i = 0; i < notInPairTable.length; i++) { - Object v = lineBreakPropertyValues.get(notInPairTable[i]); + int tableSize = lineBreakPropertyValueCount - NOT_IN_PAIR_TABLE.length; + Map notInPairTableMap = new HashMap(NOT_IN_PAIR_TABLE.length); + for (int i = 0; i < NOT_IN_PAIR_TABLE.length; i++) { + Object v = lineBreakPropertyValues.get(NOT_IN_PAIR_TABLE[i]); if (v == null) { - throw new Exception("'not in pair table' property not found: " + notInPairTable[i]); + throw new Exception("'not in pair table' property not found: " + NOT_IN_PAIR_TABLE[i]); } - notInPairTableMap.put(notInPairTable[i], v); + notInPairTableMap.put(NOT_IN_PAIR_TABLE[i], v); } - byte pairTable[][] = new byte[tableSize][]; - byte columnHeader[] = new byte[tableSize]; - byte rowHeader[] = new byte[tableSize]; - byte columnMap[] = new byte[lineBreakPropertyValueCount + 1]; + byte[][] pairTable = new byte[tableSize][]; + byte[] columnHeader = new byte[tableSize]; + byte[] rowHeader = new byte[tableSize]; + byte[] columnMap = new byte[lineBreakPropertyValueCount + 1]; Arrays.fill(columnMap, (byte)255); - byte rowMap[] = new byte[lineBreakPropertyValueCount + 1]; + byte[] rowMap = new byte[lineBreakPropertyValueCount + 1]; Arrays.fill(rowMap, (byte)255); BufferedReader b = new BufferedReader(new FileReader(breakPairFileName)); String line = b.readLine(); @@ -224,7 +231,7 @@ public class GenerateLineBreakUtils { // generate class int rowsize = 512; int blocksize = lineBreakProperties.length / rowsize; - byte row[][] = new byte[rowsize][]; + byte[][] row = new byte[rowsize][]; int idx = 0; StringBuffer doStaticLinkCode = new StringBuffer(); PrintWriter out = new PrintWriter(new FileWriter(outFileName)); @@ -242,8 +249,15 @@ public class GenerateLineBreakUtils { out.println(" * - commit BOTH changed files"); out.println(" */"); out.println(); + out.println("// CSOFF: WhitespaceAfterCheck"); + out.println("// CSOFF: LineLengthCheck"); + out.println(); + out.println("/** Line breaking utilities. */"); out.println("public final class LineBreakUtils {"); out.println(); + out.println(" private LineBreakUtils() {"); + out.println(" }"); + out.println(); out.println(" /** Break class constant */"); out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';'); out.println(" /** Break class constant */"); @@ -257,7 +271,7 @@ public class GenerateLineBreakUtils { out.println(" /** Break class constant */"); out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';'); out.println(); - out.println(" private static final byte PAIR_TABLE[][] = {"); + out.println(" private static final byte[][] PAIR_TABLE = {"); boolean printComma = false; for (int i = 1; i <= lineBreakPropertyValueCount; i++) { if (printComma) { @@ -283,9 +297,9 @@ public class GenerateLineBreakUtils { } out.println("};"); out.println(); - out.println(" private static byte lineBreakProperties[][] = new byte[" + rowsize + "][];"); + out.println(" private static byte[][] lineBreakProperties = new byte[" + rowsize + "][];"); out.println(); - out.println(" private static void init_0() {"); + out.println(" private static void init0() {"); int rowsPrinted = 0; int initSections = 0; for (int i = 0; i < rowsize; i++) { @@ -315,7 +329,7 @@ public class GenerateLineBreakUtils { out.println(" }"); out.println(); initSections++; - out.println(" private static void init_" + initSections + "() {"); + out.println(" private static void init" + initSections + "() {"); rowsPrinted = 0; } row[i] = new byte[blocksize]; @@ -339,7 +353,7 @@ public class GenerateLineBreakUtils { out.println(); out.println(" static {"); for (int i = 0; i <= initSections; i++) { - out.println(" init_" + i + "();"); + out.println(" init" + i + "();"); } out.print(doStaticLinkCode); out.println(" }"); @@ -354,7 +368,7 @@ public class GenerateLineBreakUtils { out.println(';'); } out.println(); - final String shortNamePrefix = " private static String lineBreakPropertyShortNames[] = {"; + final String shortNamePrefix = " private static String[] lineBreakPropertyShortNames = {"; out.print(shortNamePrefix); int lineLength = shortNamePrefix.length(); printComma = false; @@ -383,7 +397,7 @@ public class GenerateLineBreakUtils { } out.println("};"); out.println(); - final String longNamePrefix = " private static String lineBreakPropertyLongNames[] = {"; + final String longNamePrefix = " private static String[] lineBreakPropertyLongNames = {"; out.print(longNamePrefix); lineLength = longNamePrefix.length(); printComma = false; @@ -600,11 +614,11 @@ public class GenerateLineBreakUtils { for (int i = 0; i < 16; i++) { int rowsize = 1 << i; int blocksize = lineBreakProperties.length / (rowsize); - byte row[][] = new byte[rowsize][]; + byte[][] row = new byte[rowsize][]; int idx = 0; int nrOfDistinctBlocks = 0; for (int j = 0; j < rowsize; j++) { - byte block[] = new byte[blocksize]; + byte[] block = new byte[blocksize]; for (int k = 0; k < blocksize; k++) { block[k] = lineBreakProperties[idx]; idx++; @@ -638,6 +652,10 @@ public class GenerateLineBreakUtils { } } + /** + * Main entry point for running GenerateLineBreakUtils + * @param args array of command line arg + */ public static void main(String[] args) { String lineBreakFileName = "http://www.unicode.org/Public/UNIDATA/LineBreak.txt"; String propertyValueFileName = "http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt"; @@ -650,13 +668,13 @@ public class GenerateLineBreakUtils { } else { String opt = args[i]; if ("-l".equals(opt)) { - lineBreakFileName = args[i+1]; + lineBreakFileName = args[i + 1]; } else if ("-p".equals(opt)) { - propertyValueFileName = args[i+1]; + propertyValueFileName = args[i + 1]; } else if ("-b".equals(opt)) { - breakPairFileName = args[i+1]; - } else if("-o".equals(opt)) { - outFileName = args[i+1]; + breakPairFileName = args[i + 1]; + } else if ("-o".equals(opt)) { + outFileName = args[i + 1]; } else { ok = false; } diff --git a/src/codegen/unicode/java/org/apache/fop/util/License.java b/src/codegen/unicode/java/org/apache/fop/util/License.java index b6e3db8a4..ea28f6f09 100644 --- a/src/codegen/unicode/java/org/apache/fop/util/License.java +++ b/src/codegen/unicode/java/org/apache/fop/util/License.java @@ -29,10 +29,13 @@ import java.io.Writer; */ public final class License { + private License() { + } + /** * The Apache license text as a string array */ - public static final String[] license + public static final String[] LICENSE = {"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.", @@ -52,21 +55,21 @@ public final class License { /** * The subversion Id keyword line */ - public static final String id = "$Id$"; + public static final String ID = "$Id$"; /** * Calculate the maximum line length in the Apache license text * for use in formatting */ - private static int MAX_LENGTH; + private static int maxLength; static { int j = 0; - for (int i = 0; i < license.length; ++i) { - if (j < license[i].length()) { - j = license[i].length(); + for (int i = 0; i < LICENSE.length; ++i) { + if (j < LICENSE[i].length()) { + j = LICENSE[i].length(); } } - MAX_LENGTH = j; + maxLength = j; } /** @@ -76,16 +79,16 @@ public final class License { */ public static void writeJavaLicenseId(Writer w) throws IOException { w.write("/*\n"); - for (int i = 0; i < license.length; ++i) { - if (license[i].equals("")) { + for (int i = 0; i < LICENSE.length; ++i) { + if (LICENSE[i].equals("")) { w.write(" *\n"); } else { - w.write(" * " + license[i] + "\n"); + w.write(" * " + LICENSE[i] + "\n"); } } w.write(" */\n"); w.write("\n"); - w.write("/* " + id + " */\n"); + w.write("/* " + ID + " */\n"); } /** @@ -94,11 +97,11 @@ public final class License { * @throws IOException if the write operation fails */ public static void writeXMLLicenseId(Writer w) throws IOException { - for (int i = 0; i < license.length; ++i) { - w.write(String.format("<!-- %-" + MAX_LENGTH + "s -->\n", new Object[] {license[i]})); + for (int i = 0; i < LICENSE.length; ++i) { + w.write(String.format("<!-- %-" + maxLength + "s -->\n", new Object[] {LICENSE[i]})); } w.write("\n"); - w.write("<!-- " + id + " -->\n"); + w.write("<!-- " + ID + " -->\n"); } /** |