From 4bd18660926dd29d61c2efbb1768ea301a7351db Mon Sep 17 00:00:00 2001 From: Simon Pepping Date: Wed, 26 Aug 2009 20:00:24 +0000 Subject: [PATCH] Fixed Checkstyle warnings and replaced a java 1.5 class git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@808166 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/hyphenation/PatternParser.java | 16 ++++++++-------- .../fop/hyphenation/SerializeHyphPattern.java | 16 +++++++++++----- .../apache/fop/hyphenation/UnicodeClasses.java | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/fop/hyphenation/PatternParser.java b/src/java/org/apache/fop/hyphenation/PatternParser.java index a067d4c36..b34ab7ec8 100644 --- a/src/java/org/apache/fop/hyphenation/PatternParser.java +++ b/src/java/org/apache/fop/hyphenation/PatternParser.java @@ -47,14 +47,14 @@ import javax.xml.parsers.SAXParserFactory; */ public class PatternParser extends DefaultHandler implements PatternConsumer { - XMLReader parser; - int currElement; - PatternConsumer consumer; - StringBuffer token; - ArrayList exception; - char hyphenChar; - String errMsg; - boolean hasClasses = false; + private XMLReader parser; + private int currElement; + private PatternConsumer consumer; + private StringBuffer token; + private ArrayList exception; + private char hyphenChar; + private String errMsg; + private boolean hasClasses = false; static final int ELEM_CLASSES = 1; static final int ELEM_EXCEPTIONS = 2; diff --git a/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java b/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java index 2ae2c93b9..d2a259db0 100644 --- a/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java +++ b/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java @@ -42,19 +42,21 @@ public class SerializeHyphPattern { } /** - * {@inheritDoc} + * Compile all xml files in sourceDir, and write output hyp files in targetDir + * @param sourceDir Directory with pattern xml files + * @param targetDir Directory to which compiled pattern hyp files should be written */ public void serializeDir(File sourceDir, File targetDir) { final String extension = ".xml"; String[] sourceFiles = sourceDir.list(new FilenameFilter() { public boolean accept(File dir, String name) { - return(name.endsWith(extension)); + return name.endsWith(extension); } }); for (int j = 0; j < sourceFiles.length; j++) { File infile = new File(sourceDir, sourceFiles[j]); - String outfilename = - sourceFiles[j].substring(0, sourceFiles[j].length() - extension.length()) + ".hyp"; + String outfilename = sourceFiles[j].substring(0, sourceFiles[j].length() + - extension.length()) + ".hyp"; File outfile = new File(targetDir, outfilename); serializeFile(infile, outfile); } @@ -124,7 +126,11 @@ public class SerializeHyphPattern { } // end rebuild - public static void main (String args[]) { + /** + * Entry point for ant java task + * @param args sourceDir, targetDir + */ + public static void main (String[] args) { SerializeHyphPattern ser = new SerializeHyphPattern(); ser.serializeDir(new File(args[0]), new File(args[1])); } diff --git a/src/java/org/apache/fop/hyphenation/UnicodeClasses.java b/src/java/org/apache/fop/hyphenation/UnicodeClasses.java index df6d4069d..328ba8e7a 100644 --- a/src/java/org/apache/fop/hyphenation/UnicodeClasses.java +++ b/src/java/org/apache/fop/hyphenation/UnicodeClasses.java @@ -211,7 +211,7 @@ public final class UnicodeClasses { if (!"".equals(fields[SIMPLE_TITLECASE_MAPPING])) { titlecode = Integer.parseInt(fields[SIMPLE_TITLECASE_MAPPING], 16); } - StringBuilder s = new StringBuilder(); + StringBuffer s = new StringBuffer(); if (hexcode) { s.append("0x" + fields[UNICODE].replaceFirst("^0+", "").toLowerCase() + " "); } -- 2.39.5