[FOray-commit] SF.net SVN: foray: [10483] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-03-22 17:58:09
|
Revision: 10483
http://foray.svn.sourceforge.net/foray/?rev=10483&view=rev
Author: victormote
Date: 2008-03-22 10:58:08 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
1. Add checkstyle check for System.exit().
2. Clean up some System.exit() uses.
3. Suppress the check in main(String[]) and WindowAdapter.windowClosed() methods.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
trunk/foray/foray-app/src/java/org/foray/app/FOray.java
trunk/foray/foray-app/src/java/org/foray/app/Options.java
trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java
trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java
trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java
trunk/foray/foray-font/src/java/org/foray/font/SerializeStandardFonts.java
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-graphic/src/java/org/foray/graphic/output/SvgPdf.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/SerializeHyphPattern.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java
trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java
trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java
trunk/foray/scripts/checkstyle-config.xml
Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -169,7 +169,10 @@
frame.validate();
frame.addWindowListener(new WindowAdapter() {
public void windowClosed(final WindowEvent we) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
+ /* TODO: Is there a better way to handle this? */
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
});
Modified: trunk/foray/foray-app/src/java/org/foray/app/FOray.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -53,6 +53,7 @@
* for details on these arguments.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
CommandLineOptions options = null;
final Log logger = Logging.makeDefaultLogger();
@@ -85,6 +86,7 @@
}
System.exit(1);
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -112,7 +112,6 @@
// show configuration settings
if (this.sessionConfig.optionDumpConfiguration()) {
this.sessionConfig.dumpConfiguration();
- System.exit(0);
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -85,7 +85,6 @@
pj.setJobName("FOray Document");
session.process();
- System.exit(0);
}
/**
Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -117,6 +117,7 @@
* -pdf to output the result as pdf
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final Log log = Logging.makeDefaultLogger();
final TestConverter tc = new TestConverter();
@@ -152,6 +153,7 @@
System.exit(1);
}
tc.runTests(testFile, output);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -79,7 +79,10 @@
frame.validate();
frame.addWindowListener(new WindowAdapter() {
public void windowClosed(final WindowEvent we) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
+ /* TODO: Is there a better way to do this. */
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
});
@@ -166,6 +169,7 @@
* @param args Command-line arguments. This method currently uses none.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoAWTViewer app = new DemoAWTViewer();
app.getLogger().info(Application.getApplicationNameShort() +
" ExampleAWTViewer\n");
@@ -194,6 +198,7 @@
app.getLogger().error("Demo AWT Viewer Error", e);
System.exit(-1);
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -88,6 +88,7 @@
* @param args The command-line arguments. None are currently supported.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoFO2PDF app = new DemoFO2PDF();
app.getLogger().info(Application.getApplicationNameShort()
+ " ExampleFO2PDF\n");
@@ -117,6 +118,7 @@
System.exit(-1);
}
app.getLogger().info("Success!");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -111,6 +111,7 @@
* @param args The command-line arguments. None are currently supported.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoObj2PDF app = new DemoObj2PDF();
app.getLogger().info(Application.getApplicationNameShort()
+ " ExampleObj2PDF\n");
@@ -139,6 +140,7 @@
System.exit(-1);
}
app.getLogger().info("Success!");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -99,6 +99,7 @@
* @param args The command-line arguments. None are currently supported.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoObj2XML app = new DemoObj2XML();
app.getLogger().info(Application.getApplicationNameShort() +
" ExampleObj2XML\n");
@@ -127,6 +128,7 @@
System.exit(-1);
}
app.getLogger().info("Success!");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -86,6 +86,7 @@
* @param args The command-line arguments. None are currently supported.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoXML2FO app = new DemoXML2FO();
app.getLogger().info(Application.getApplicationNameShort() +
@@ -118,6 +119,7 @@
System.exit(-1);
}
app.getLogger().info("Success!");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -112,6 +112,7 @@
* @param args The command-line arguments. None are currently supported.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final DemoXML2PDF app = new DemoXML2PDF();
app.getLogger().info(Application.getApplicationNameShort() +
@@ -141,6 +142,7 @@
System.exit(-1);
}
app.getLogger().info("Success!");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -407,6 +407,7 @@
* for fonts to configure.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null) {
System.err.println("At least one directory is required.");
System.exit(1);
@@ -430,6 +431,7 @@
}
System.out.println("Files processed: " + config.getSuccessCount());
System.out.println("Not processed: " + config.getFailureCount());
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-font/src/java/org/foray/font/SerializeStandardFonts.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/SerializeStandardFonts.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-font/src/java/org/foray/font/SerializeStandardFonts.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -34,6 +34,8 @@
import org.foray.font.format.MetricsFile;
import org.foray.font.format.MetricsFileReader;
+import org.axsl.font.FontException;
+
import org.apache.commons.logging.Log;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -76,13 +78,13 @@
/**
* Sets the source directory.
* @param sourceDir The new source directory.
+ * @throws FontException If <code>sourceDir</code> does not exist.
*/
- public void setSourceDir(final String sourceDir) {
+ public void setSourceDir(final String sourceDir) throws FontException {
final File dir = new File(sourceDir);
- if (!dir.exists()) {
- getLogger().error("Fatal Error: source directory " + sourceDir
- + " for font files does not exist.");
- System.exit(1);
+ if (! dir.exists()) {
+ throw new FontException("Fatal Error: source directory " + sourceDir
+ + " for font files does not exist.");
}
this.sourceDir = dir;
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -258,6 +258,7 @@
* written.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final Log logger = Logging.makeDefaultLogger();
final String usage = "Usage: CharSetParser <input-file> "
+ "<output-file>\n";
@@ -304,6 +305,7 @@
System.exit(1);
}
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -49,6 +49,7 @@
import org.axsl.font.FontConsumer;
import org.axsl.font.FontException;
import org.axsl.font.FontUtility;
+import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutputContext;
import org.apache.commons.logging.Log;
@@ -165,12 +166,13 @@
* @param pdfContext The PDF context in which this content is being written.
* @param outputStream The output stream to which this processor writes its
* PDF output.
+ * @throws GraphicException If there is no graphical environment available.
*/
public PDFGraphics2D(final boolean textAsShapes,
final SVGDocument svgDocument,
final FontConsumer fontConsumer, final Log logger,
final GraphicOutputContext pdfContext,
- final OutputStream outputStream) {
+ final OutputStream outputStream) throws GraphicException {
super(textAsShapes);
/* TODO: Only write the comments if running in debug mode?? */
this.currentStream = new CharacterOutputStream(outputStream, true);
@@ -917,17 +919,16 @@
/**
* Initializes the graphics environment, specifically by ensuring that one
* exists.
+ * @throws GraphicException If there is no graphical environment available.
*/
- private void initGraphicalEnvironment() {
+ private void initGraphicalEnvironment() throws GraphicException {
try {
final BufferedImage bi = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
this.fmg = bi.createGraphics();
} catch (final LinkageError e) {
- this.logger.error("Unable to create graphical "
+ throw new GraphicException("Unable to create graphical "
+ "environment required to process SVG. Aborting.");
- e.printStackTrace();
- System.exit(2);
}
}
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/output/SvgPdf.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/output/SvgPdf.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/output/SvgPdf.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -143,8 +143,15 @@
ctx = null;
builder = null;
- final PDFGraphics2D graphics = new PDFGraphics2D(true, svgDocument,
- fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
+ PDFGraphics2D graphics;
+ try {
+ graphics = new PDFGraphics2D(true, svgDocument,
+ fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
+ } catch (final GraphicException e) {
+ /* This exception is caused when no graphical environment exists. We check for that at
+ * the beginning of this method, so this should never happen. */
+ return null;
+ }
graphics.setGraphicContext(
new org.apache.batik.ext.awt.g2d.GraphicContext());
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/SerializeHyphPattern.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/SerializeHyphPattern.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/SerializeHyphPattern.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -75,13 +75,13 @@
/**
* Sets the source directory.
* @param sourceDir The source directory to set.
+ * @throws HyphenationException If <code>sourceDir</code> does not exist.
*/
- public void setSourceDir(final String sourceDir) {
+ public void setSourceDir(final String sourceDir) throws HyphenationException {
final File dir = new File(sourceDir);
- if (!dir.exists()) {
- getLogger().error("Fatal Error: source directory " + sourceDir
- + " for hyphenation files doesn't exist.");
- System.exit(1);
+ if (! dir.exists()) {
+ throw new HyphenationException("Fatal Error: source directory " + sourceDir
+ + " for hyphenation files doesn't exist.");
}
this.sourceDir = dir;
}
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -350,6 +350,7 @@
* that can be used to locate local DTDs.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null
|| args.length < ValidateChars.MIN_CL_ARGUMENTS
|| args.length > ValidateChars.MAX_CL_ARGUMENTS) {
@@ -428,6 +429,7 @@
System.exit(ValidateChars.STATUS_PARSING_ERROR);
}
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -354,6 +354,7 @@
* encoding.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null
|| args.length != WordList.QTY_CL_ARGUMENTS) {
System.err.println("Requires exactly " + WordList.QTY_CL_ARGUMENTS
@@ -424,6 +425,7 @@
}
}
System.out.println("Word List successfully written.");
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java
===================================================================
--- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -1169,6 +1169,7 @@
* that can be used to locate local DTDs.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null
|| args.length < FOrayPretty.MIN_CL_ARGUMENTS
|| args.length > FOrayPretty.MAX_CL_ARGUMENTS) {
@@ -1216,6 +1217,7 @@
e.printStackTrace();
System.exit(FOrayPretty.STATUS_PARSING_ERROR);
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java
===================================================================
--- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -586,6 +586,7 @@
* @param args Two or more URLs that should be compared.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final InputStream[] streamsToCompare = new InputStream[args.length];
for (int i = 0; i < args.length; i++) {
InputStream stream = null;
@@ -617,6 +618,7 @@
System.out.println(e.getMessage());
System.exit(FOrayXDiff.STATUS_PARSING_ERROR);
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -577,6 +577,7 @@
* listed here.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final Log logger = Logging.makeDefaultLogger();
final String usage = "Usage: GlyphListParser <input-file> "
+ "<column-number> <output-file> <glyph-lists>?\n";
@@ -657,6 +658,7 @@
System.exit(1);
}
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -385,6 +385,7 @@
* written.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
final Log logger = Logging.makeDefaultLogger();
final String usage = "Usage: GlyphListParser <input-file> "
+ "<output-file>\n";
@@ -431,6 +432,7 @@
System.exit(1);
}
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -285,6 +285,7 @@
* </ol>
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null
|| args.length < PSFilter.CL_MIN_ARGS) {
System.err.println("Must be at least three arguments.");
@@ -380,6 +381,7 @@
}
}
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -83,7 +83,10 @@
* {@inheritDoc}
*/
public void windowClosing(final WindowEvent we) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
+ /* TODO: Is there a better way to exit the application? */
System.exit(0);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java 2008-03-22 17:58:08 UTC (rev 10483)
@@ -50,6 +50,7 @@
* the name of a file containing PostScript content to be interpreted.
*/
public static void main(final String[] args) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
if (args == null
|| args.length != 1) {
System.out.print("Wrong number of arguments.");
@@ -58,6 +59,7 @@
final String fileName = args[0];
final DemoFrame mainframe = new DemoFrame(fileName);
mainframe.setVisible(true);
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/scripts/checkstyle-config.xml
===================================================================
--- trunk/foray/scripts/checkstyle-config.xml 2008-03-22 15:59:39 UTC (rev 10482)
+++ trunk/foray/scripts/checkstyle-config.xml 2008-03-22 17:58:08 UTC (rev 10483)
@@ -23,6 +23,15 @@
<property name="checkFormat" value="IllegalType"/>
</module>
+ <!-- Allow "main" methods to suppress the checks for System.exit(), etc. -->
+ <!-- TODO: Write a custom checkstyle plugin that does the suppression in "main" automatically.
+ -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="Checkstyle-GenericIllegalRegexp-Off"/>
+ <property name="onCommentFormat" value="Checkstyle-GenericIllegalRegexp-On"/>
+ <property name="checkFormat" value="GenericIllegalRegexp"/>
+ </module>
+
<module name="TreeWalker">
<!-- Activate FileContentsHolder so that comments are visible to Checkstyle
@@ -205,6 +214,12 @@
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="true"/>
+ <!-- . matches any character, so we need to escape it and use \. to match dots. -->
+ <property name="format" value="System\.exit"/>
+ <property name="message" value="Never exit the jvm except in void main(String[])."/>
+ </module>
</module>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|