From e1630f5f0874b620552e50328a4b3ee242bd607a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 18 Nov 2005 19:52:10 +0000 Subject: [PATCH] Merge from Trunk, revision 345551: JDK 1.3 compatibility. Style fixes. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_90@345553 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutengine/LayoutEngineTestSuite.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java index cad2d4c18..f09b84971 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -76,52 +76,55 @@ public class LayoutEngineTestSuite { public static String[] readDisabledTestcases(File f) throws IOException { List lines = new java.util.ArrayList(); - Source stylesheet = new StreamSource(new File("test/layoutengine/disabled-testcase2filename.xsl")); + Source stylesheet = new StreamSource( + new File("test/layoutengine/disabled-testcase2filename.xsl")); Source source = new StreamSource(f); Result result = new SAXResult(new FilenameHandler(lines)); try { - Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesheet); + Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesheet); transformer.transform(source, result); - } - catch( TransformerConfigurationException tce ) { - throw new RuntimeException(tce); - } - catch( TransformerException te ) { - throw new RuntimeException(te); + } catch (TransformerConfigurationException tce) { + throw new RuntimeException(tce.getMessage()); + } catch (TransformerException te) { + throw new RuntimeException(te.getMessage()); } return (String[])lines.toArray(new String[lines.size()]); } private static class FilenameHandler extends DefaultHandler { private StringBuffer buffer = new StringBuffer(128); - private boolean readingFilename =false; + private boolean readingFilename = false; private List filenames; public FilenameHandler(List filenames) { this.filenames = filenames; } - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (qName!=null && qName.equals("file")) { + public void startElement(String namespaceURI, String localName, String qName, + Attributes atts) throws SAXException { + if (qName != null && qName.equals("file")) { buffer.setLength(0); readingFilename = true; } else { - throw new RuntimeException("Unexpected element while reading disabled testcase file names: "+qName); + throw new RuntimeException( + "Unexpected element while reading disabled testcase file names: " + qName); } } - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (qName!=null && qName.equals("file")) { + public void endElement(String namespaceURI, String localName, String qName) + throws SAXException { + if (qName != null && qName.equals("file")) { readingFilename = false; filenames.add(buffer.toString()); } else { - throw new RuntimeException("Unexpected element while reading disabled testcase file names: "+qName); + throw new RuntimeException( + "Unexpected element while reading disabled testcase file names: " + qName); } } public void characters(char[] ch, int start, int length) throws SAXException { if (readingFilename) { - buffer.append(ch,start,length); + buffer.append(ch, start, length); } } } @@ -188,7 +191,8 @@ public class LayoutEngineTestSuite { final LayoutEngineTester tester, final File f) { suite.addTest(new LayoutEngineTestCase(f.getName()) { public void runTest() throws Exception { - org.apache.commons.logging.LogFactory.getLog(this.getClass()).info("Starting " + f.getName()); + org.apache.commons.logging.LogFactory.getLog( + this.getClass()).info("Starting " + f.getName()); prepare(tester, f); testMain(); } -- 2.39.5