Thread: [FOray-commit] SF.net SVN: foray: [10482] trunk/foray (Page 24)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-03-22 15:59:37
|
Revision: 10482
http://foray.svn.sourceforge.net/foray/?rev=10482&view=rev
Author: victormote
Date: 2008-03-22 08:59:39 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
1. Add checkstyle check for trailing spaces.
2. Remove existing trailing spaces.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java
trunk/foray/foray-font/src/java/org/foray/font/format/Panose.java
trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestJpegGraphic.java
trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java
trunk/foray/scripts/checkstyle-config.xml
Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2008-03-22 15:56:54 UTC (rev 10481)
+++ trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2008-03-22 15:59:39 UTC (rev 10482)
@@ -61,7 +61,7 @@
void seek(long pos) throws IOException;
/**
- * <p>Returns the current offset in this input.</p>
+ * <p>Returns the current offset in this input.</p>
* <p>This method is based on {@link RandomAccessFile#getFilePointer()}.</p>
* @return The offset from the beginning of the input, in bytes, at which
* the next read occurs.
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:56:54 UTC (rev 10481)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2008-03-22 15:59:39 UTC (rev 10482)
@@ -307,7 +307,7 @@
}
/**
- * Returns the parsed Unicode code points in this character set.
+ * Returns the parsed Unicode code points in this character set.
* @return The Unicode code points in this character set.
*/
public char[] getCharacterSet() {
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Panose.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Panose.java 2008-03-22 15:56:54 UTC (rev 10481)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Panose.java 2008-03-22 15:59:39 UTC (rev 10482)
@@ -316,7 +316,7 @@
* {@inheritDoc}
*/
public String toString() {
- return toString(this.panoseArray);
+ return toString(this.panoseArray);
}
/**
@@ -332,7 +332,7 @@
sb.append(theByte + " ");
}
sb.append("]");
- return sb.toString();
+ return sb.toString();
}
/**
Modified: trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestJpegGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestJpegGraphic.java 2008-03-22 15:56:54 UTC (rev 10481)
+++ trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestJpegGraphic.java 2008-03-22 15:59:39 UTC (rev 10482)
@@ -56,7 +56,7 @@
assertNull(jpeg.getTransparentColor());
final byte[] rawContent = jpeg.getRawSamples();
assertNotNull(rawContent);
-
+
/* JPEG doesn't currently support returning the standard getContent(),
* but returns its (compressed) data instead.
* The following computations are for uncompressed data, and are for
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2008-03-22 15:56:54 UTC (rev 10481)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2008-03-22 15:59:39 UTC (rev 10482)
@@ -327,7 +327,7 @@
* Compute the width of a given word.
* @param lineText The object providing font and font size information.
* @param word The word whose size is needed.
- * @return The width, in millipoints, of <code>word</code>.
+ * @return The width, in millipoints, of <code>word</code>.
*/
public int getWordWidth(final LineText lineText, final CharSequence word) {
final FontUse fontUse = lineText.inlinePrimaryFont();
Modified: trunk/foray/scripts/checkstyle-config.xml
===================================================================
--- trunk/foray/scripts/checkstyle-config.xml 2008-03-22 15:56:54 UTC (rev 10481)
+++ trunk/foray/scripts/checkstyle-config.xml 2008-03-22 15:59:39 UTC (rev 10482)
@@ -201,6 +201,11 @@
<property name="severity" value="ignore"/>
</module>
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+
</module>
<!-- Make sure each package has javadoc package.html -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <vic...@us...> - 2008-03-22 19:09:28
|
Revision: 10485
http://foray.svn.sourceforge.net/foray/?rev=10485&view=rev
Author: victormote
Date: 2008-03-22 12:09:30 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
1. Add checkstyle restrictions on use of System.out, System.err, and dumping of stack traces.
2. Fix occurrences of same, some by using loggers, others by throwing exceptions, others by suppressing the check.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/FOrayLogger.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java
trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java
trunk/foray/foray-pretty/.classpath
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/java2d/demo/DemoPanel.java
trunk/foray/scripts/checkstyle-config.xml
Modified: trunk/foray/foray-common/src/java/org/foray/common/FOrayLogger.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/FOrayLogger.java 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-common/src/java/org/foray/common/FOrayLogger.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -53,7 +53,9 @@
* System.err.
*/
protected void write(final StringBuffer buffer) {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
System.out.println(buffer.toString());
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
}
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -190,6 +190,7 @@
* {@inheritDoc}
*/
public void printStackTrace() {
+ /* Checkstyle-GenericIllegalRegexp-Off. */
synchronized (System.err) {
super.printStackTrace();
if (this.exception != null) {
@@ -201,6 +202,7 @@
getRootException().printStackTrace();
}
}
+ /* 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 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigGenerator.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -165,9 +165,8 @@
serializer.setOutputByteStream(tempOut);
try {
serializer.serialize(document);
- } catch (final IOException e1) {
- System.err.println("Error serializing DOM:\n "
- + e1.getMessage());
+ } catch (final IOException e) {
+ throw new FontException("Error serializing DOM: " + e.getMessage());
}
final byte[] serializedDOM = tempOut.toByteArray();
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -54,11 +54,14 @@
package org.foray.hyphen;
+import org.foray.common.FOrayLogger;
import org.foray.common.NumberUtil;
import org.foray.common.WKConstants;
import org.axsl.hyphen.HyphenationException;
+import org.apache.commons.logging.Log;
+
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -320,6 +323,9 @@
/** The output stream. */
private PrintStream output;
+ /** The logger (lazily created). Use {#getLogger()} to get the instance. */
+ private Log logger;
+
/**
* Constructor.
* @param input The input stream to be read.
@@ -336,12 +342,12 @@
* @throws HyphenationException For errors during processing.
*/
public void process() throws HyphenationException {
- System.out.println(this.banner);
+ getLogger().info(this.banner);
if (this.input == null) {
- System.out.println("Error: Input cannot be null.");
+ getLogger().error("Error: Input cannot be null.");
}
if (this.output == null) {
- System.out.println("Error: Output cannot be null.");
+ getLogger().error("Error: Output cannot be null.");
}
patgen();
}
@@ -828,7 +834,7 @@
throw new HyphenationException("PATGEN capacity exceeded, sorry ["
+ PatternGenerator.TRIEC_SIZE + " count trie nodes].");
}
- System.out.printf("%ld%s", (long) this.trieckmax / 1024 , "K ");
+ getLogger().info(this.trieckmax / 1024 + "K ");
if (this.trieckmax > PatternGenerator.TRIEC_SIZE - 4096) {
this.trieckmax = PatternGenerator.TRIEC_SIZE;
} else {
@@ -979,7 +985,7 @@
n1String = readInput(System.in);
n2String = readInput(System.in);
} catch (final IOException e) {
- System.err.println("Error reading from stdin.");
+ getLogger().error("Error reading from stdin.");
}
this.n1 = Integer.parseInt(n1String);
this.n2 = Integer.parseInt(n2String);
@@ -992,7 +998,7 @@
try {
n3String = readInput(System.in);
} catch (final IOException e) {
- System.err.println("Error reading from stdin.");
+ getLogger().error("Error reading from stdin.");
}
this.n3 = Integer.parseInt(n3String);
}
@@ -1101,7 +1107,7 @@
if (bad) {
bad = false;
do {
- System.out.print("left_hyphen_min, right_hyphen_min: ");
+ getLogger().info("left_hyphen_min, right_hyphen_min: ");
input2ints();
if ((this.n1 >= 1)
&& (this.n1 < PatternGenerator.MAX_DOT)
@@ -2178,4 +2184,15 @@
/* Checkstyle-GenericIllegalRegexp-On. */
}
+ /**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ if (this.logger == null) {
+ this.logger = new FOrayLogger("FOray PatternGenerator");
+ }
+ return this.logger;
+ }
+
}
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 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -28,11 +28,13 @@
package org.foray.hyphen.util;
+import org.foray.common.FOrayLogger;
import org.foray.common.url.URLFactory;
import org.foray.hyphen.HyphenationServer4a;
import org.axsl.common.value.Iso639;
+import org.apache.commons.logging.Log;
import org.apache.xerces.util.XMLCatalogResolver;
import org.xml.sax.Attributes;
@@ -110,6 +112,9 @@
/** The server used to find natural language resources. */
private HyphenationServer4a server;
+ /** The logger (lazily created). Use {#getLogger()} to get the instance. */
+ private Log logger;
+
/**
* Constructor.
* @param server The server used to find natural language resources.
@@ -140,8 +145,7 @@
public void start() throws IOException, SAXException,
ParserConfigurationException {
if (this.iso639 == null) {
- System.err.println("Not a valid ISO-639 code: "
- + this.languageCode);
+ logError("Not a valid ISO-639 code: " + this.languageCode);
return;
}
final XMLReader parser = createParser();
@@ -302,16 +306,27 @@
}
/**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ if (this.logger == null) {
+ this.logger = new FOrayLogger("FOray ValidateChars");
+ }
+ return this.logger;
+ }
+
+ /**
* Convenience method to log an error.
* @param message The message to be logged.
*/
private void logError(final String message) {
if (this.locator != null) {
- System.out.print(this.locator.getSystemId() + ":"
+ getLogger().error(this.locator.getSystemId() + ":"
+ this.locator.getLineNumber() + ":"
+ this.locator.getColumnNumber() + "\n ");
}
- System.out.print(message + "\n");
+ getLogger().error(message + "\n");
}
/**
@@ -326,7 +341,7 @@
final NaturalLanguage nl = this.server.getNaturalLanguage(
this.iso639);
if (nl == null) {
- System.err.println("Cannot get NaturalLanguage instance for: "
+ logError("Cannot get NaturalLanguage instance for: "
+ this.iso639.getEnglishName());
return;
}
Modified: trunk/foray/foray-pretty/.classpath
===================================================================
--- trunk/foray/foray-pretty/.classpath 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-pretty/.classpath 2008-03-22 19:09:30 UTC (rev 10485)
@@ -7,5 +7,6 @@
<classpathentry kind="lib" path="/FOray Lib/stax-api-1.0.1.jar" sourcepath="/FOray Lib-Build/stax/stax-src-1.2.0.zip"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar" sourcepath="/FOray Lib-Build/xerces/Xerces-J-src.2.7.1.zip"/>
<classpathentry kind="lib" path="/FOray Lib/stax-1.2.0.jar" sourcepath="/FOray Lib-Build/stax/stax-src-1.2.0.zip"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
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 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -28,11 +28,13 @@
package org.foray.pretty;
+import org.foray.common.FOrayLogger;
import org.foray.common.XMLUtil;
import org.foray.pretty.dtd.DTD;
import org.foray.pretty.dtd.DTDElement;
import org.foray.pretty.dtd.ElementStack;
+import org.apache.commons.logging.Log;
import org.apache.xerces.util.XMLCatalogResolver;
import org.xml.sax.Attributes;
@@ -117,6 +119,9 @@
/** A queue of unprocessed elements. */
private Queue queue = new Queue();
+ /** The logger (lazily created). Use {#getLogger()} to get the instance. */
+ private Log logger;
+
/* Begin state variables. */
/** State variable tracking whether we are currently inside the DTD or
@@ -738,16 +743,27 @@
}
/**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ if (this.logger == null) {
+ this.logger = new FOrayLogger("FOray Pretty Print");
+ }
+ return this.logger;
+ }
+
+ /**
* Convenience method to log an error.
* @param message The message to be logged.
*/
private void logError(final String message) {
if (this.locator != null) {
- System.out.print(this.locator.getSystemId() + ":"
+ this.getLogger().error(this.locator.getSystemId() + ":"
+ this.locator.getLineNumber() + ":"
+ this.locator.getColumnNumber());
}
- System.out.print(message);
+ this.getLogger().error(message);
}
/**
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 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -28,9 +28,12 @@
package org.foray.pretty;
+import org.foray.common.FOrayLogger;
import org.foray.common.StringUtil;
import org.foray.common.XMLUtil;
+import org.apache.commons.logging.Log;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -77,6 +80,9 @@
*/
private String[] readerIDs;
+ /** The logger (lazily created). Use {#getLogger()} to get the instance. */
+ private Log logger;
+
/* Begin configurable parameters. */
/** Ignores character items that are all whitespace. */
private boolean ignoreCharacterWhitespace = true;
@@ -388,16 +394,27 @@
* @param message The raw message to send to the user.
*/
private void message(final String message) {
- System.out.println(message);
+ this.getLogger().info(message);
for (int i = 0; i < this.readers.length; i++) {
final String sourceDescription = getSourceDescription(i);
final String sourceLocation = getSourceLocation(i);
- System.out.println(" Document " + (i + 1) + ": "
+ this.getLogger().info(" Document " + (i + 1) + ": "
+ sourceDescription + ":" + sourceLocation);
}
}
/**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ if (this.logger == null) {
+ this.logger = new FOrayLogger("FOrayXDiff");
+ }
+ return this.logger;
+ }
+
+ /**
* Provides a description of the document.
* @param inputIndex The index to the input items.
* @return The description of the input document.
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java 2008-03-22 19:09:30 UTC (rev 10485)
@@ -47,6 +47,7 @@
import java.io.File;
import java.io.IOException;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
/**
@@ -123,7 +124,8 @@
j2dSystemDict);
interpreter.process();
} catch (final PSException e) {
- System.out.print(e.getMessage());
+ JOptionPane.showMessageDialog(this, e.getMessage(), "PSInterpreter Error",
+ JOptionPane.ERROR_MESSAGE);
}
g2d.setTransform(baktrans);
Modified: trunk/foray/scripts/checkstyle-config.xml
===================================================================
--- trunk/foray/scripts/checkstyle-config.xml 2008-03-22 18:24:10 UTC (rev 10484)
+++ trunk/foray/scripts/checkstyle-config.xml 2008-03-22 19:09:30 UTC (rev 10485)
@@ -211,6 +211,7 @@
</module>
<module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="false"/>
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
@@ -220,6 +221,21 @@
<property name="format" value="System\.exit"/>
<property name="message" value="Never exit the jvm except in void main(String[])."/>
</module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="true"/>
+ <property name="format" value="printStacktrace"/>
+ <property name="message" value="Do not dump a stacktrace."/>
+ </module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="true"/>
+ <property name="format" value=" System.out.print"/>
+ <property name="message" value="Do not dump a stacktrace."/>
+ </module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="true"/>
+ <property name="format" value=" System.err.print"/>
+ <property name="message" value="Do not dump a stacktrace."/>
+ </module>
</module>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-03-22 19:26:01
|
Revision: 10486
http://foray.svn.sourceforge.net/foray/?rev=10486&view=rev
Author: victormote
Date: 2008-03-22 12:26:07 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
Fix build for recent dependency changes.
Modified Paths:
--------------
trunk/foray/foray-font/scripts/build.xml
trunk/foray/foray-pretty/scripts/build.xml
Modified: trunk/foray/foray-font/scripts/build.xml
===================================================================
--- trunk/foray/foray-font/scripts/build.xml 2008-03-22 19:09:30 UTC (rev 10485)
+++ trunk/foray/foray-font/scripts/build.xml 2008-03-22 19:26:07 UTC (rev 10486)
@@ -36,6 +36,7 @@
<fileset dir="${lib.dir}">
<include name="xercesImpl*.jar"/>
<include name="axsl*.jar"/>
+ <include name="commons-io-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="xml-apis*.jar"/>
</fileset>
Modified: trunk/foray/foray-pretty/scripts/build.xml
===================================================================
--- trunk/foray/foray-pretty/scripts/build.xml 2008-03-22 19:09:30 UTC (rev 10485)
+++ trunk/foray/foray-pretty/scripts/build.xml 2008-03-22 19:26:07 UTC (rev 10486)
@@ -26,6 +26,7 @@
<include name="stax*.jar"/>
<include name="resolver*.jar"/>
<include name="xercesImpl*.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-03-24 15:36:35
|
Revision: 10496
http://foray.svn.sourceforge.net/foray/?rev=10496&view=rev
Author: victormote
Date: 2008-03-24 08:36:30 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Remove all logging from the PSInterpreter.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -141,8 +141,7 @@
}
parseBasics();
try {
- this.interpreter = new PSInterpreter(this.getLogger(), this,
- null);
+ this.interpreter = new PSInterpreter(this, null);
} catch (final PSException e) {
e.printStackTrace();
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -77,7 +77,7 @@
final PDFSystemDict systemDict = new PDFSystemDict();
PSInterpreter interpreter = null;
try {
- interpreter = new PSInterpreter(getLogger(), psInput, systemDict);
+ interpreter = new PSInterpreter(psInput, systemDict);
interpreter.process();
} catch (final PSException e1) {
getLogger().error(e1.getMessage());
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -32,8 +32,6 @@
import org.foray.ps.encode.EncodingVector;
import org.foray.ps.readonly.ReadOnlySystemDict;
-import org.apache.commons.logging.Log;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -142,9 +140,6 @@
/** The maximum PostScript array size. */
public static final int MAX_ARRAY_SIZE = 65535;
- /** The logger for this interpreter. */
- private Log logger;
-
/** The PostScript operand stack. operandStack.size() - 1 is the "top" of
* the stack. */
private PSStackObject operandStack = new PSStackObject(this,
@@ -237,19 +232,15 @@
/**
* Constructor for a PostScript interpreter.
- * @param logger The logger that should be used.
* @param input The PSInput instance that should be used as standard input
* to the interpreter.
* @param systemDict The dictionary that should be used.
* @throws PSException For invalid parameters.
*/
- public PSInterpreter(final Log logger, final PSInput input,
- final PSSystemDict systemDict) throws PSException {
+ public PSInterpreter(final PSInput input, final PSSystemDict systemDict) throws PSException {
if (input == null) {
- logger.error("PostScript Error: No standard input.");
- return;
+ throw new NullPointerException("PostScript Error: No standard input.");
}
- this.logger = logger;
// Create the standard input file.
this.standardInput = new PSFileReal(this, input);
// Place it on the execution stack.
@@ -349,16 +340,14 @@
this.executionStack.pop();
final boolean completed = operator.execute();
if (! completed) {
- this.logger.error("Internal PostScript error: "
- + "Unsupported operator: "
+ throw new PSException(this, -1, -1, "Unsupported operator: "
+ PSOperator.mapEnumToName(operator.getOperatorEnum()));
}
return;
}
- // If anything else, log an error & pop the item
- this.logger.error("Internal PostScript error: invalid item on "
- + "execution stack.");
- this.executionStack.pop();
+ /* Anything else is illegal. */
+ throw new PSException(this, -1, -1, "Invalid item on execution stack: "
+ + currentExecution.toString());
}
/**
@@ -739,7 +728,7 @@
doneExecuting = currentDict.execute(nameObject);
}
if (! doneExecuting) {
- this.logger.error("PostScript name '" + nameObject.getValue()
+ throw new PSException(this, -1, -1, "PostScript name '" + nameObject.getValue()
+ "' not found.");
}
}
@@ -885,12 +874,4 @@
return this.currentColumn;
}
- /**
- * Returns the logger.
- * @return The logger.
- */
- public Log getLogger() {
- return this.logger;
- }
-
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -28,8 +28,6 @@
package org.foray.ps;
-import org.apache.commons.logging.Log;
-
import java.util.Arrays;
/**
@@ -1552,14 +1550,6 @@
}
/**
- * Return the logger.
- * @return The logger.
- */
- public Log getLogger() {
- return this.getInterpreter().getLogger();
- }
-
- /**
* Returns the operator enumeration.
* @return The operatorEnum.
*/
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -31,8 +31,6 @@
import org.foray.common.WKConstants;
import org.foray.ps.filter.EexecDecodeFilter;
-import org.apache.commons.logging.Log;
-
import java.awt.Color;
import java.awt.Dimension;
import java.awt.color.ColorSpace;
@@ -824,14 +822,6 @@
}
/**
- * Returns the logger.
- * @return The logger.
- */
- public Log getLogger() {
- return this.getInterpreter().getLogger();
- }
-
- /**
* Pops the operand stack, casting the popped item as a generic object.
* @param operation The current operation, needed for user messages.
* @return The popped item.
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java 2008-03-24 15:07:20 UTC (rev 10495)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java 2008-03-24 15:36:30 UTC (rev 10496)
@@ -29,14 +29,11 @@
package org.foray.ps.java2d.demo;
-import org.foray.common.Logging;
import org.foray.ps.PSException;
import org.foray.ps.PSInputFile;
import org.foray.ps.PSInterpreter;
import org.foray.ps.java2d.Java2DSystemDict;
-import org.apache.commons.logging.Log;
-
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -110,7 +107,6 @@
g2d.translate(0, -dim.getHeight());
g2d.scale(2, 2);
- final Log logger = Logging.makeDebugLogger();
final File file = new File(this.fileName);
PSInputFile eps = null;
try {
@@ -120,8 +116,7 @@
}
final Java2DSystemDict j2dSystemDict = new Java2DSystemDict(g2d);
try {
- final PSInterpreter interpreter = new PSInterpreter(logger, eps,
- j2dSystemDict);
+ final PSInterpreter interpreter = new PSInterpreter(eps, j2dSystemDict);
interpreter.process();
} catch (final PSException e) {
JOptionPane.showMessageDialog(this, e.getMessage(), "PSInterpreter Error",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-03-24 17:07:30
|
Revision: 10502
http://foray.svn.sourceforge.net/foray/?rev=10502&view=rev
Author: victormote
Date: 2008-03-24 10:07:35 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Add ant source code zip file to repository, for debugging.
Modified Paths:
--------------
trunk/foray/foray-app/.classpath
Added Paths:
-----------
trunk/foray/lib-build/ant/ant-src.zip
Modified: trunk/foray/foray-app/.classpath
===================================================================
--- trunk/foray/foray-app/.classpath 2008-03-24 16:31:39 UTC (rev 10501)
+++ trunk/foray/foray-app/.classpath 2008-03-24 17:07:35 UTC (rev 10502)
@@ -35,7 +35,7 @@
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslSpeech"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOraySpeech"/>
- <classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar" sourcepath="/FOray Lib-Build/ant/ant-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/foray-hyphen-0.4-rsrc.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
Added: trunk/foray/lib-build/ant/ant-src.zip
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib-build/ant/ant-src.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-03-24 21:47:07
|
Revision: 10504
http://foray.svn.sourceforge.net/foray/?rev=10504&view=rev
Author: victormote
Date: 2008-03-24 14:46:12 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
1. Conform to axsl changes regarding throwing of Exceptions in more places.
2. Simultaneously clean up some stack trace dumps.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/BidiOverrideArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/IndexPageCitationListArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationLastArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
trunk/foray/foray-areatree/src/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java
trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTPrintRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialog.java
trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -28,13 +28,14 @@
package org.foray.area;
+import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockContentFactory;
-import org.axsl.area.AreaTreeException;
import org.axsl.fo.fo.Block;
import org.axsl.fo.fo.BlockContainer;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.Table;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -67,7 +68,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -40,6 +40,7 @@
import org.axsl.fo.fo.Root;
import org.axsl.font.FontConsumer;
import org.axsl.galley.Galley;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.text.TextServer;
@@ -359,7 +360,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -32,6 +32,7 @@
import org.axsl.common.value.BorderStyle;
import org.axsl.fo.fo.BasicLink;
import org.axsl.fo.fo.GraftingPoint;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -117,7 +118,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
import org.axsl.fo.Fo;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -147,7 +148,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BidiOverrideArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BidiOverrideArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BidiOverrideArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.fo.fo.BidiOverride;
import org.axsl.fo.fo.GraftingPoint;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -116,7 +117,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -41,6 +41,7 @@
import org.axsl.fo.fo.Table;
import org.axsl.fo.fo.prop.CommonPositionPa;
import org.axsl.galley.BlockContainerArea;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -138,7 +139,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.fo.fo.ExternalGraphic;
import org.axsl.fo.fo.GraftingPoint;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -176,7 +177,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
import org.axsl.fo.Fo;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -158,7 +159,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -35,6 +35,7 @@
import org.axsl.fo.foreign.MathElement;
import org.axsl.fo.foreign.SvgElement;
import org.axsl.galley.ForeignContent;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -190,7 +191,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/IndexPageCitationListArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/IndexPageCitationListArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/IndexPageCitationListArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.IndexPageCitationList;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -120,7 +121,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -33,6 +33,7 @@
import org.axsl.common.value.BorderStyle;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.Inline;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -119,7 +120,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -36,6 +36,7 @@
import org.axsl.fo.fo.InlineContainer;
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.Table;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -129,7 +130,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -41,6 +41,7 @@
import org.axsl.fo.fo.prop.LeaderPatternWidthPa;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -415,7 +416,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -56,6 +56,7 @@
import org.axsl.fo.fo.ScalingValueCitation;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -1293,7 +1294,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -33,6 +33,7 @@
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.ListItem;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -114,7 +115,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -35,6 +35,7 @@
import org.axsl.fo.fo.ListItem;
import org.axsl.fo.fo.ListItemBody;
import org.axsl.fo.fo.ListItemLabel;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -99,7 +100,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -35,6 +35,7 @@
import org.axsl.fo.fo.Block;
import org.axsl.fo.fo.BlockContainer;
import org.axsl.fo.fo.RegionBody;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.MainReferenceArea;
import org.axsl.galley.RenderVisitor;
@@ -332,7 +333,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -39,6 +39,7 @@
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.Table;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -192,7 +193,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -36,6 +36,7 @@
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.Table;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -171,7 +172,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -41,6 +41,7 @@
import org.axsl.fo.fo.PageMasterResolver;
import org.axsl.fo.fo.PageSequence;
import org.axsl.fo.fo.SimplePageMaster;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -400,7 +401,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -34,6 +34,7 @@
import org.axsl.fo.fo.PageNumber;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -141,7 +142,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -34,6 +34,7 @@
import org.axsl.fo.fo.PageNumberCitation;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -162,7 +163,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationLastArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationLastArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationLastArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -34,6 +34,7 @@
import org.axsl.fo.fo.PageNumberCitationLast;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -163,7 +164,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -47,6 +47,7 @@
import org.axsl.fo.fo.RegionStart;
import org.axsl.fo.fo.RetrieveMarker;
import org.axsl.fo.fo.SimplePageMaster;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.Page;
import org.axsl.galley.RenderVisitor;
@@ -676,7 +677,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -41,6 +41,7 @@
import org.axsl.fo.fo.RegionEnd;
import org.axsl.fo.fo.RegionStart;
import org.axsl.fo.fo.Table;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RegionArea;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -180,7 +181,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -34,6 +34,7 @@
import org.axsl.common.value.RelativeAxis;
import org.axsl.fo.fo.RegionBody;
import org.axsl.fo.fo.SimplePageMaster;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RegionArea;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -327,7 +328,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ScalingValueCitationArea.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ScalingValueCitationArea.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -34,6 +34,7 @@
import org.axsl.fo.fo.ScalingValueCitation;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.awt.Color;
@@ -149,7 +150,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -33,6 +33,7 @@
import org.axsl.common.value.Span;
import org.axsl.fo.fo.RegionBody;
import org.axsl.fo.fo.prop.SpanPa;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import java.util.ArrayList;
@@ -332,7 +333,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -32,6 +32,7 @@
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.TableBody;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
@@ -89,7 +90,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2008-03-24 17:20:43 UTC (rev 10503)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2008-03-24 21:46:12 UTC (rev 10504)
@@ -40,6 +40,7 @@
import org.axsl.fo.fo.ListBlock;
import org.axsl.fo.fo.Table;
import org.axsl.fo.fo.TableCell;
+import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.galley.TableCellArea;
import org.axsl.graphic.Graphic;
@@ -259,7 +260,7 @@
/**
* {@inheritDoc}
*/
- public void render(final RenderVisitor visitor) {
+ public void render(final RenderVisitor visitor) throws GalleyVisitorException {
visitor.render(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
===============================...
[truncated message content] |
|
From: <vic...@us...> - 2008-03-24 22:41:37
|
Revision: 10507
http://foray.svn.sourceforge.net/foray/?rev=10507&view=rev
Author: victormote
Date: 2008-03-24 15:41:42 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
General cleanup of Exceptions and dumping of stack traces.
Modified Paths:
--------------
trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2008-03-24 22:28:52 UTC (rev 10506)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2008-03-24 22:41:42 UTC (rev 10507)
@@ -329,7 +329,6 @@
.getMessage());
}
} else if (exception instanceof FOrayException) {
- exception.printStackTrace();
if (((FOrayException) exception).getException() != null) {
log.error(((FOrayException) exception).getException()
.getMessage());
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2008-03-24 22:28:52 UTC (rev 10506)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2008-03-24 22:41:42 UTC (rev 10507)
@@ -186,11 +186,11 @@
return super.getMessage();
}
+ /* Checkstyle-GenericIllegalRegexp-Off. */
/**
* {@inheritDoc}
*/
public void printStackTrace() {
- /* Checkstyle-GenericIllegalRegexp-Off. */
synchronized (System.err) {
super.printStackTrace();
if (this.exception != null) {
@@ -202,7 +202,6 @@
getRootException().printStackTrace();
}
}
- /* Checkstyle-GenericIllegalRegexp-On. */
}
/**
@@ -238,5 +237,6 @@
}
}
}
+ /* Checkstyle-GenericIllegalRegexp-On. */
}
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2008-03-24 22:28:52 UTC (rev 10506)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2008-03-24 22:41:42 UTC (rev 10507)
@@ -35,6 +35,7 @@
import org.axsl.area.AreaTreeFactory;
import org.axsl.area.AreaTreeListener;
import org.axsl.fo.FoTreeEvent;
+import org.axsl.fo.FoTreeException;
import org.axsl.fo.FoTreeListener;
import org.axsl.fo.fo.PageSequence;
import org.axsl.font.FontConsumer;
@@ -321,42 +322,34 @@
}
/**
- * Required by the FOTreeListener interface. It handles an
- * FOTreeEvent that is fired when an FObj object has been completed. We
- * do not need to do anything with it, so we ignore it.
- * @param event The FOTreeEvent that was fired.
+ * {@inheritDoc}
*/
public void foComplete(final FoTreeEvent event) {
}
/**
- * Required by the FOTreeListener interface. It handles an
- * FOTreeEvent that is fired when a PageSequence object has been completed.
- * @param event the FOTreeEvent that was fired
+ * {@inheritDoc}
*/
- public void foPageSequenceComplete(final FoTreeEvent event) {
+ public void foPageSequenceComplete(final FoTreeEvent event) throws FoTreeException {
try {
final boolean shouldRender = this.getSessionConfig().isModeRender();
if (shouldRender) {
render(event.getPageSequence());
}
} catch (final FOrayException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new FoTreeException(e);
}
}
/**
- * Required by the FOTreeListener interface. It handles an FOTreeEvent that
- * is fired when the Document has been completely parsed.
- * @param event the FOTreeEvent that was fired
+ * {@inheritDoc}
*/
- public void foDocumentComplete(final FoTreeEvent event) {
+ public void foDocumentComplete(final FoTreeEvent event) throws FoTreeException {
getCreatedAreaTree().contentComplete();
try {
stopRenderer();
} catch (final SAXException e) {
- e.printStackTrace();
+ throw new FoTreeException(e);
}
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2008-03-24 22:28:52 UTC (rev 10506)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2008-03-24 22:41:42 UTC (rev 10507)
@@ -166,11 +166,15 @@
} catch (final FoTreeException e) {
throw new SAXException(e);
}
- notifyFObjComplete(this.currentFObj);
+ try {
+ notifyFObjComplete(this.currentFObj);
- if (this.currentFObj instanceof PageSequence) {
- // Notify the listeners that this page-sequence is complete.
- notifyPageSequenceComplete((PageSequence) this.currentFObj);
+ if (this.currentFObj instanceof PageSequence) {
+ // Notify the listeners that this page-sequence is complete.
+ notifyPageSequenceComplete((PageSequence) this.currentFObj);
+ }
+ } catch (final FoTreeException e) {
+ throw new SAXException(e);
}
this.currentFObj = this.currentFObj.getParsedParent();
}
@@ -191,7 +195,11 @@
@Override
public void endDocument() throws SAXException {
getLogger().info("End parsing the Formatting Object (FO) input.");
- notifyDocumentComplete();
+ try {
+ notifyDocumentComplete();
+ } catch (final FoTreeException e) {
+ throw new SAXException(e);
+ }
}
/**
@@ -374,7 +382,7 @@
* FOTreeEvent has been fired.
* @param fobj The FObj instance that was just completed.
*/
- private void notifyFObjComplete(final FObj fobj) {
+ private void notifyFObjComplete(final FObj fobj) throws FoTreeException {
/* If nobody wants these events, don't waste resources creating
* them. */
if (this.qtyFObjListeners < 1) {
@@ -392,7 +400,8 @@
* FOTreeEvent has been fired.
* @param pageSequence The PageSequence instance that was just completed.
*/
- private void notifyPageSequenceComplete(final PageSequence pageSequence) {
+ private void notifyPageSequenceComplete(final PageSequence pageSequence)
+ throws FoTreeException {
final FoTreeEvent event = new FoTreeEvent(this, pageSequence);
for (int i = 0; i < this.foTreeListeners.size(); i++) {
final FoTreeListener listener = this.foTreeListeners.get(i);
@@ -404,7 +413,7 @@
* Notify all objects in the foTreeListeners that a "Document Complete"
* FOTreeEvent has been fired.
*/
- private void notifyDocumentComplete() {
+ private void notifyDocumentComplete() throws FoTreeException {
final FoTreeEvent event = new FoTreeEvent(this);
for (int i = 0; i < this.foTreeListeners.size(); i++) {
final FoTreeListener listener = this.foTreeListeners.get(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-03-25 02:12:14
|
Revision: 10512
http://foray.svn.sourceforge.net/foray/?rev=10512&view=rev
Author: victormote
Date: 2008-03-24 19:12:18 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Use checkstyle to restrict references to FOP in the code.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java
trunk/foray/scripts/checkstyle-config.xml
Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2008-03-25 01:33:26 UTC (rev 10511)
+++ trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2008-03-25 02:12:18 UTC (rev 10512)
@@ -28,14 +28,18 @@
package org.foray.app.ant;
+import org.foray.app.test.TestConverter;
+import org.foray.common.Environment;
import org.foray.common.Logging;
import org.foray.common.url.URLFactory;
+import org.foray.core.Application;
import org.apache.commons.logging.Log;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@@ -44,6 +48,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Properties;
/**
* Ant task to run the FOray test suite.
@@ -115,19 +120,20 @@
/**
* Test the current build.
- * This uses the current jar file (in build/fop.jar) to run the
- * tests with.
+ * This uses the current jar file to run the tests.
* The output is then compared with the reference output.
*/
protected void testNewBuild() {
final Log logger = Logging.makeDefaultLogger();
ClassLoader loader = null;
try {
- loader = new URLClassLoader(new URL[] {
- URLFactory.createURL("file:build/fop.jar")
- });
- } catch (final MalformedURLException mue) {
- throw new BuildException(mue);
+ final Properties buildProperties = Environment.getBuildProperties();
+ final String foraySandbox = buildProperties.getProperty("foray.sandbox");
+ final URL buildUrl = URLFactory.createURL("file", null,
+ foraySandbox + "/build/foray-" + Application.getVersion() + "-all.jar");
+ loader = new URLClassLoader(new URL[] {buildUrl});
+ } catch (final IOException e) {
+ throw new BuildException(e);
}
final Map<?, ?> diff = runConverter(loader, "areatree", "reference/output/");
if (diff != null && ! diff.isEmpty()) {
@@ -177,25 +183,13 @@
boolean failed = false;
try {
- Class<?> cla = Class.forName("org.apache.fop.apps.Options",
- true, loader);
- cla = Class.forName("org.apache.fop.apps.Version", true,
- loader);
- final Method get = cla.getMethod("getVersion", new Class[]{});
- if (!get.invoke(null, new Object[]{}).equals(this.refVersion)) {
+ final String version = Application.getVersion();
+ if (! version.equals(this.refVersion)) {
throw new BuildException("Reference jar is not correct "
+ "version it must be: " + this.refVersion);
}
- } catch (final IllegalAccessException iae) {
- failed = true;
} catch (final IllegalArgumentException are) {
failed = true;
- } catch (final InvocationTargetException are) {
- failed = true;
- } catch (final ClassNotFoundException are) {
- failed = true;
- } catch (final NoSuchMethodException are) {
- failed = true;
}
if (failed) {
throw new BuildException("Reference jar could not be found in: "
@@ -218,7 +212,7 @@
*/
protected Map<?, ?> runConverter(final ClassLoader loader,
final String dest, final String compDir) {
- final String converter = "org.apache.fop.tools.TestConverter";
+ final String converter = TestConverter.class.getCanonicalName();
Map<?, ?> diff = null;
try {
Modified: trunk/foray/scripts/checkstyle-config.xml
===================================================================
--- trunk/foray/scripts/checkstyle-config.xml 2008-03-25 01:33:26 UTC (rev 10511)
+++ trunk/foray/scripts/checkstyle-config.xml 2008-03-25 02:12:18 UTC (rev 10512)
@@ -238,6 +238,11 @@
<property name="message" value="Use logging instead of System.err, except in void
main(String[])."/>
</module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="true"/>
+ <property name="format" value="(FOP|fop|Fop)"/>
+ <property name="message" value="Avoid legacy references to FOP."/>
+ </module>
</module>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-05-09 04:24:42
|
Revision: 10541
http://foray.svn.sourceforge.net/foray/?rev=10541&view=rev
Author: victormote
Date: 2008-05-08 21:24:49 -0700 (Thu, 08 May 2008)
Log Message:
-----------
Protect the encapsulated data in PSArray.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -176,13 +176,12 @@
return null;
}
final PSArray psarray = (PSArray) object;
- final Object[] insideArray = psarray.getInsideArray();
- if (insideArray.length != BoundingBox.BBOX_ENTRIES) {
+ if (psarray.size() != BoundingBox.BBOX_ENTRIES) {
return null;
}
this.fontBBox = new int[BoundingBox.BBOX_ENTRIES];
- for (int i = 0; i < insideArray.length; i++) {
- final Object arrayItem = insideArray[i];
+ for (int i = 0; i < psarray.size(); i++) {
+ final Object arrayItem = psarray.get(i);
if (arrayItem instanceof PSInteger) {
final PSInteger psInteger = (PSInteger) arrayItem;
final int itemValue = psInteger.getValue();
@@ -207,8 +206,8 @@
if (object == null || ! (object instanceof PSArray)) {
return 0;
}
- final Object[] insideArray = ((PSArray) object).getInsideArray();
- final Object item = insideArray[0];
+ final PSArray psArray = (PSArray) object;
+ final Object item = psArray.get(0);
if (! (item instanceof PSInteger)) {
return 0;
}
Modified: trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
===================================================================
--- trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -51,10 +51,10 @@
final URL fontFile = TestFontServer4a.getTestFont("source-ams/computer-modern/cmps-pc/"
+ "cmpsfont/fonts/cmr10.pfb");
assertNotNull(fontFile);
- final FontFileReader reader = new FontFileReader(null, fontFile);
- assertNotNull(reader);
- final Type1PFBFile pfbFile = new Type1PFBFile(reader);
- assertNotNull(pfbFile);
+// final FontFileReader reader = new FontFileReader(null, fontFile);
+// assertNotNull(reader);
+// final Type1PFBFile pfbFile = new Type1PFBFile(reader);
+// assertNotNull(pfbFile);
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -103,7 +103,7 @@
* Return the encapsulated array.
* @return The encapsulated array.
*/
- public Object[] getInsideArray() {
+ Object[] getInsideArray() {
return this.value;
}
@@ -118,16 +118,22 @@
/**
* Return one item from the array.
* @param index The index to the array item.
- * @return The requested array item, or null if the index is out-of-bounds.
+ * @return The requested array item.
*/
public PSObject get(final int index) {
- if (index < 0 || index > this.value.length - 1) {
- return null;
- }
return (PSObject) this.value[index];
}
/**
+ * Sets the value of one item in the array.
+ * @param index The index to the array item.
+ * @param object The object which should be set at the array location for <code>index</code>.
+ */
+ public void set(final int index, final Object object) {
+ this.value[index] = object;
+ }
+
+ /**
* Attempts to convert this into a PSMatrix instance.
* @return A new PSMatrix instance made from this, or null if not possible.
*/
@@ -153,18 +159,10 @@
}
/**
- * Returns the array contents.
- * @return The array contents.
- */
- public Object[] getValue() {
- return this.value;
- }
-
- /**
* Sets the array contents.
* @param newValue The new array contents.
*/
- protected void setValue(final Object[] newValue) {
+ void setValue(final Object[] newValue) {
this.value = newValue;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -50,19 +50,11 @@
}
/**
- * Return the matrix value as an array of {@link PSNumber} instances.
- * @return The matrix value.
- */
- public PSNumber[] getMatrixValue() {
- return (PSNumber[]) this.getValue();
- }
-
- /**
* Sets the matrix value.
* @param newMatrixValue The new matrix value.
*/
- public void setMatrixValue(final PSNumber[] newMatrixValue) {
- this.setValue(newMatrixValue);
+ public void setMatrixValue(final PSMatrix newMatrixValue) {
+ this.setValue(newMatrixValue.getInsideArray());
}
/**
@@ -143,10 +135,10 @@
* @throws PSException If either matrix1 or matrix2 are not exactly 6
* elements long.
*/
- public static PSNumber[] concatMatrices(final PSInterpreter interpreter,
- final PSNumber[] matrix1, final PSNumber[] matrix2)
+ public static PSMatrix concatMatrices(final PSInterpreter interpreter,
+ final PSMatrix matrix1, final PSMatrix matrix2)
throws PSException {
- if (matrix1.length != PsUtil.MATRIX_QTY_ELEMENTS) {
+ if (matrix1.size() != PsUtil.MATRIX_QTY_ELEMENTS) {
throw new PSException(interpreter, PsError.RANGECHECK);
}
// double[] productArray = new double[6];
@@ -162,8 +154,7 @@
* @param y The y value.
* @return The new array.
*/
- public static PSNumber[] makeTranslateMatrix(
- final PSInterpreter interpreter, final PSNumber x,
+ public static PSMatrix makeTranslateMatrix(final PSInterpreter interpreter, final PSNumber x,
final PSNumber y) {
final PSNumber[] returnArray =
new PSNumber[PsUtil.MATRIX_QTY_ELEMENTS];
@@ -179,7 +170,8 @@
returnArray[index] = x;
index ++;
returnArray[index] = y;
- return returnArray;
+ final PSMatrix translateMatrix = new PSMatrix(interpreter, returnArray, false);
+ return translateMatrix;
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -1571,11 +1571,10 @@
}
final PSInteger psinteger = (PSInteger) where;
final int index = psinteger.getValue();
- if (index < 0 || index > array.getValue().length - 1) {
+ if (index < 0 || index > array.size() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PSOperator.OPER_PUT);
}
- final Object[] arrayValue = array.getValue();
- arrayValue[index] = what;
+ array.set(index, what);
}
/**
@@ -1707,10 +1706,10 @@
throw new PsOperatorException(PsError.TYPECHECK, PSOperator.OPER_GET);
}
final int index = ((PSInteger) where).getValue();
- if (index < 0 || index > array.getValue().length - 1) {
+ if (index < 0 || index > array.size() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PSOperator.OPER_GET);
}
- pushOperand((PSObject) array.getValue()[index]);
+ pushOperand(array.get(index));
}
/**
@@ -1998,14 +1997,13 @@
final PSArray currentProc = stack.get(currentStackDepth);
Integer procedureIndexInteger = stackCounter.get(currentStackDepth);
int procedureIndex = procedureIndexInteger.intValue();
- if (procedureIndex > currentProc.getValue().length - 1) {
+ if (procedureIndex > currentProc.size() - 1) {
currentProc.setAccess(PsAccess.READ_ONLY);
stackCounter.remove(currentStackDepth);
stack.remove(currentStackDepth);
continue;
}
- final PSObject currentItem =
- (PSObject) currentProc.getValue()[procedureIndex];
+ final PSObject currentItem = currentProc.get(procedureIndex);
// If it is an executable array, place it on the stack & continue.
if (currentItem instanceof PSArray && currentItem.isExecutable()) {
final PSArray currentArray = (PSArray) currentItem;
@@ -2020,7 +2018,7 @@
final PSObject targetObject = getInterpreter().find(
currentItem);
if (targetObject instanceof PSOperator) {
- currentProc.getValue()[procedureIndex] = targetObject;
+ currentProc.set(procedureIndex, targetObject);
}
}
// Increment the counter within the current procedure
@@ -2455,10 +2453,8 @@
private void concat() throws PsOperatorException, PSException {
final PSMatrix stackMatrix = popPSMatrix(PSOperator.OPER_CONCAT);
final PSMatrix ctm = this.currentGS().getCTM();
- final PSNumber[] newMatrix = PSMatrix.concatMatrices(
- this.getInterpreter(),
- stackMatrix.getMatrixValue(), ctm.getMatrixValue());
- ctm.setMatrixValue(newMatrix);
+ final PSMatrix newMatrix = PSMatrix.concatMatrices(this.getInterpreter(), stackMatrix, ctm);
+ this.currentGS().setCTM(newMatrix);
}
/**
@@ -2470,9 +2466,8 @@
final PSMatrix matrix3 = popPSMatrix(PSOperator.OPER_CONCATMATRIX);
final PSMatrix matrix2 = popPSMatrix(PSOperator.OPER_CONCATMATRIX);
final PSMatrix matrix1 = popPSMatrix(PSOperator.OPER_CONCATMATRIX);
- final PSNumber[] newMatrix = PSMatrix.concatMatrices(
- this.getInterpreter(),
- matrix1.getMatrixValue(), matrix2.getMatrixValue());
+ final PSMatrix newMatrix = PSMatrix.concatMatrices(this.getInterpreter(), matrix1,
+ matrix2);
matrix3.setMatrixValue(newMatrix);
}
@@ -2631,12 +2626,9 @@
if (array2.size() < array1.size()) {
throw new PsOperatorException(PsError.RANGECHECK, PSOperator.OPER_COPY);
}
- final Object[] array2Contents = new Object[array1.size()];
- final Object[] array1Contents = array1.getValue();
- for (int i = 0; i < array1Contents.length; i++) {
- array2Contents[i] = array1Contents[i];
+ for (int i = 0; i < array1.size(); i++) {
+ array2.set(i, array1.get(i));
}
- array2.setValue(array2Contents);
pushOperand(array2);
}
@@ -2694,10 +2686,9 @@
}
final PSNumber ty = popPSNumber(PSOperator.OPER_TRANSLATE);
final PSNumber tx = popPSNumber(PSOperator.OPER_TRANSLATE);
- final PSNumber[] translateMatrix = PSMatrix.makeTranslateMatrix(
- this.getInterpreter(), tx, ty);
- final PSNumber[] translatedMatrix = PSMatrix.concatMatrices(
- this.getInterpreter(), matrix.getMatrixValue(),
+ final PSMatrix translateMatrix = PSMatrix.makeTranslateMatrix(this.getInterpreter(), tx,
+ ty);
+ final PSMatrix translatedMatrix = PSMatrix.concatMatrices(this.getInterpreter(), matrix,
translateMatrix);
matrix.setMatrixValue(translatedMatrix);
if (matrixOnStack) {
@@ -2749,7 +2740,7 @@
if (stackObject instanceof PSArray) {
final PSArray array = (PSArray) stackObject;
for (int i = 0; i < array.size(); i++) {
- final PSObject object = (PSObject) array.getValue()[i];
+ final PSObject object = array.get(i);
pushOperand(object);
this.getInterpreter().getExecutionStack().push(proc);
this.getInterpreter().process();
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java 2008-03-28 19:47:12 UTC (rev 10540)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java 2008-05-09 04:24:49 UTC (rev 10541)
@@ -60,11 +60,10 @@
* @return The next item in this procedure.
*/
public PSObject getNextProcedureItem() {
- if (this.executionStackIteratorIndex > this.wrappedArray.getInsideArray().length - 1) {
+ if (this.executionStackIteratorIndex > this.wrappedArray.size() - 1) {
return null;
}
- final PSObject nextElement =
- (PSObject) this.wrappedArray.getInsideArray()[this.executionStackIteratorIndex];
+ final PSObject nextElement = this.wrappedArray.get(this.executionStackIteratorIndex);
this.executionStackIteratorIndex ++;
return nextElement;
}
@@ -74,7 +73,7 @@
* @return The count of unexecuted items.
*/
public int qtyUnexecutedItems() {
- return this.wrappedArray.getInsideArray().length - this.executionStackIteratorIndex;
+ return this.wrappedArray.size() - this.executionStackIteratorIndex;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-05-15 06:10:24
|
Revision: 10580
http://foray.svn.sourceforge.net/foray/?rev=10580&view=rev
Author: victormote
Date: 2008-05-14 23:10:31 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Change class names to correspond to remote file name changes.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsArray.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsBoolean.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsColorSpace.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsExecutionStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFileFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFileReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFontId.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsState.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsStateStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInput.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsMark.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsName.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsNull.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsNumber.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsObject.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectSimple.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsOperator.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPath.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPathClose.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPathCurve.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPathElement.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPathLine.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsPathMove.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsString.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsStringInput.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
trunk/foray/foray-ps/src/java/org/foray/ps/pdf/PDFSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -29,13 +29,13 @@
package org.foray.font.format;
import org.foray.common.WKConstants;
-import org.foray.ps.PSArray;
-import org.foray.ps.PSDictionary;
-import org.foray.ps.PSException;
-import org.foray.ps.PSInput;
-import org.foray.ps.PSInteger;
-import org.foray.ps.PSInterpreter;
-import org.foray.ps.PSObject;
+import org.foray.ps.PsArray;
+import org.foray.ps.PsDictionary;
+import org.foray.ps.PsException;
+import org.foray.ps.PsInput;
+import org.foray.ps.PsInteger;
+import org.foray.ps.PsInterpreter;
+import org.foray.ps.PsObject;
import org.foray.ps.filter.PSFilter;
import org.axsl.ps.BoundingBox;
@@ -56,7 +56,7 @@
* If the segment contents actually need to be parsed, a PostScript interpreter
* is invoked.</p>
*/
-public abstract class Type1File extends FontFile implements PSInput {
+public abstract class Type1File extends FontFile implements PsInput {
/** The number of segments in each Type 1 font file. */
protected static final int QTY_SEGMENTS = 3;
@@ -90,7 +90,7 @@
private long chunkEndOffset;
/** The PostScipt font dictionary parsed from this file. */
- private PSDictionary fontDictionary = null;
+ private PsDictionary fontDictionary = null;
/** The font bounding box parsed from this file. */
private int[] fontBBox = null;
@@ -99,7 +99,7 @@
private int stemV = 0;
/** The PostScript interpreter used to parse this file. */
- private PSInterpreter interpreter;
+ private PsInterpreter interpreter;
/**
* Constructor.
@@ -141,14 +141,14 @@
}
parseBasics();
try {
- this.interpreter = new PSInterpreter(this, null);
- } catch (final PSException e) {
+ this.interpreter = new PsInterpreter(this, null);
+ } catch (final PsException e) {
getLogger().error(e.getMessage());
}
startNewSegment();
try {
this.interpreter.process();
- } catch (final PSException e1) {
+ } catch (final PsException e1) {
this.getLogger().error(e1.getMessage()
+ "\n " + this.getReader().getDescription().toString());
}
@@ -172,18 +172,18 @@
*/
private int[] parseFontBBox() {
final Object object = getFontDictionary().getItem("FontBBox");
- if (! (object instanceof PSArray)) {
+ if (! (object instanceof PsArray)) {
return null;
}
- final PSArray psarray = (PSArray) object;
+ final PsArray psarray = (PsArray) object;
if (psarray.size() != BoundingBox.BBOX_ENTRIES) {
return null;
}
this.fontBBox = new int[BoundingBox.BBOX_ENTRIES];
for (int i = 0; i < psarray.size(); i++) {
final Object arrayItem = psarray.get(i);
- if (arrayItem instanceof PSInteger) {
- final PSInteger psInteger = (PSInteger) arrayItem;
+ if (arrayItem instanceof PsInteger) {
+ final PsInteger psInteger = (PsInteger) arrayItem;
final int itemValue = psInteger.getValue();
this.fontBBox[i] = itemValue;
} else {
@@ -198,36 +198,36 @@
* @return The StemV value.
*/
private int parseStemV() {
- final PSDictionary privateDict = getPrivateDictionary();
+ final PsDictionary privateDict = getPrivateDictionary();
if (privateDict == null) {
return 0;
}
- final PSObject object = privateDict.getItem("StdVW");
- if (object == null || ! (object instanceof PSArray)) {
+ final PsObject object = privateDict.getItem("StdVW");
+ if (object == null || ! (object instanceof PsArray)) {
return 0;
}
- final PSArray psArray = (PSArray) object;
+ final PsArray psArray = (PsArray) object;
final Object item = psArray.get(0);
- if (! (item instanceof PSInteger)) {
+ if (! (item instanceof PsInteger)) {
return 0;
}
- return ((PSInteger) item).getValue();
+ return ((PsInteger) item).getValue();
}
/**
* Caches the FontDictionary in an instance variable for easier access.
* @return The font dictionary for the font file.
*/
- PSDictionary getFontDictionary() {
+ PsDictionary getFontDictionary() {
parseDetail();
if (this.fontDictionary == null) {
- final PSDictionary fontDirectory
+ final PsDictionary fontDirectory
= this.interpreter.getFontDirectory();
- final Map<PSObject, PSObject> fontMap = fontDirectory.getMap();
- final Iterator<PSObject> iter = fontMap.keySet().iterator();
+ final Map<PsObject, PsObject> fontMap = fontDirectory.getMap();
+ final Iterator<PsObject> iter = fontMap.keySet().iterator();
// There should only be one font in the font directory
- final PSObject psObject = fontMap.get(iter.next());
- this.fontDictionary = (PSDictionary) psObject;
+ final PsObject psObject = fontMap.get(iter.next());
+ this.fontDictionary = (PsDictionary) psObject;
}
return this.fontDictionary;
}
@@ -236,45 +236,45 @@
* Returns the FontInfo dictionary.
* @return The FontInfo dictionary, or null if it does not exist.
*/
- private PSDictionary getFontInfoDictionary() {
- final PSDictionary fontDictionary = this.getFontDictionary();
+ private PsDictionary getFontInfoDictionary() {
+ final PsDictionary fontDictionary = this.getFontDictionary();
if (fontDictionary == null) {
return null;
}
- final PSObject psObject = fontDictionary.getItem("FontInfo");
+ final PsObject psObject = fontDictionary.getItem("FontInfo");
if (psObject == null) {
return null;
}
- if (psObject instanceof PSDictionary) {
- return (PSDictionary) psObject;
+ if (psObject instanceof PsDictionary) {
+ return (PsDictionary) psObject;
}
- throw new IllegalStateException("FontInfo expected to be a PSDictionary");
+ throw new IllegalStateException("FontInfo expected to be a PsDictionary");
}
/**
* Returns the private dictionary portion of the font file.
* @return The private dictionary portion of the font file.
*/
- private PSDictionary getPrivateDictionary() {
- final PSObject privateDict = getFontDictionary().getItem("Private");
+ private PsDictionary getPrivateDictionary() {
+ final PsObject privateDict = getFontDictionary().getItem("Private");
if (privateDict == null
- || ! (privateDict instanceof PSDictionary)) {
+ || ! (privateDict instanceof PsDictionary)) {
return null;
}
- return (PSDictionary) privateDict;
+ return (PsDictionary) privateDict;
}
/**
* Returns the metrics dictionary portion of the font file.
* @return The metrics dictionary portion of the font file.
*/
- PSDictionary getMetricsDictionary() {
- final PSObject metricsDict = getFontDictionary().getItem("Metrics");
+ PsDictionary getMetricsDictionary() {
+ final PsObject metricsDict = getFontDictionary().getItem("Metrics");
if (metricsDict == null
- || ! (metricsDict instanceof PSDictionary)) {
+ || ! (metricsDict instanceof PsDictionary)) {
return null;
}
- return (PSDictionary) metricsDict;
+ return (PsDictionary) metricsDict;
}
/**
@@ -428,9 +428,9 @@
/**
* Provides the encrypted portion of the font contents.
* @param outputFormat One of the following values:
- * Use {@link PSFilter#PSDATA_UNKNOWN} if the contents should be returned
+ * Use {@link PsFilter#PSDATA_UNKNOWN} if the contents should be returned
* with no filtering.
- * Use {@link PSFilter#PSDATA_ASCII_HEX} if the contents should be
+ * Use {@link PsFilter#PSDATA_ASCII_HEX} if the contents should be
* converted to ASCII Hex format.
* @return A byte array with the font contents in the format requested.
* @throws IOException For errors reading font file.
@@ -461,7 +461,7 @@
if (this.fontDictionary == null) {
return null;
}
- final PSObject psObject = this.fontDictionary.getItem("FontName");
+ final PsObject psObject = this.fontDictionary.getItem("FontName");
return psObject.toString();
}
@@ -470,11 +470,11 @@
* @return The PostScript name of this font.
*/
public String getFamilyName() {
- final PSDictionary fontInfo = this.getFontInfoDictionary();
+ final PsDictionary fontInfo = this.getFontInfoDictionary();
if (fontInfo == null) {
return null;
}
- final PSObject psObject = this.fontDictionary.getItem("FamilyName");
+ final PsObject psObject = this.fontDictionary.getItem("FamilyName");
return psObject.toString();
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -29,9 +29,9 @@
package org.foray.pdf.object;
import org.foray.ps.BoundingBox4a;
-import org.foray.ps.PSException;
-import org.foray.ps.PSInputFile;
-import org.foray.ps.PSInterpreter;
+import org.foray.ps.PsException;
+import org.foray.ps.PsInputFile;
+import org.foray.ps.PsInterpreter;
import org.foray.ps.pdf.PDFSystemDict;
import org.axsl.graphic.EpsGraphic;
@@ -68,18 +68,18 @@
*/
protected byte[] getPdfContent() throws GraphicException {
final File file = new File(getGraphic().getUrl().getFile());
- PSInputFile psInput = null;
+ PsInputFile psInput = null;
try {
- psInput = new PSInputFile(file);
+ psInput = new PsInputFile(file);
} catch (final IOException e) {
throw new GraphicException("Cannot open EPS file.");
}
final PDFSystemDict systemDict = new PDFSystemDict();
- PSInterpreter interpreter = null;
+ PsInterpreter interpreter = null;
try {
- interpreter = new PSInterpreter(psInput, systemDict);
+ interpreter = new PsInterpreter(psInput, systemDict);
interpreter.process();
- } catch (final PSException e1) {
+ } catch (final PsException e1) {
getLogger().error(e1.getMessage());
throw new GraphicException("Cannot parse EPS file.");
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsArray.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsArray.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsArray.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -33,7 +33,7 @@
/**
* A PostScript array.
*/
-public class PSArray extends PsObjectComposite {
+public class PsArray extends PsObjectComposite {
/** The value for this object. */
private Object[] value;
@@ -46,7 +46,7 @@
* @param value The value to encapsulate.
* @param executable Set to true if this object is executable.
*/
- public PSArray(final Object[] value, final boolean executable) {
+ public PsArray(final Object[] value, final boolean executable) {
super();
this.value = value;
this.executable = executable;
@@ -55,7 +55,7 @@
/**
* {@inheritDoc}
*/
- public PSObject duplicate() {
+ public PsObject duplicate() {
return this;
}
@@ -76,8 +76,8 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PSObject object) {
- if (object instanceof PSArray) {
+ public boolean isComparable(final PsObject object) {
+ if (object instanceof PsArray) {
return true;
}
return false;
@@ -86,8 +86,8 @@
/**
* {@inheritDoc}
*/
- public PSName getTypeName() {
- return new PSName("arraytype", true, false);
+ public PsName getTypeName() {
+ return new PsName("arraytype", true, false);
}
/**
@@ -111,8 +111,8 @@
* @param index The index to the array item.
* @return The requested array item.
*/
- public PSObject get(final int index) {
- return (PSObject) this.value[index];
+ public PsObject get(final int index) {
+ return (PsObject) this.value[index];
}
/**
@@ -125,19 +125,19 @@
}
/**
- * Attempts to convert this into a PSMatrix instance.
- * @return A new PSMatrix instance made from this, or null if not possible.
+ * Attempts to convert this into a PsMatrix instance.
+ * @return A new PsMatrix instance made from this, or null if not possible.
*/
- public PSMatrix convertToMatrix() {
+ public PsMatrix convertToMatrix() {
if (this.value.length != PsUtil.MATRIX_QTY_ELEMENTS) {
return null;
}
boolean allNumbers = true;
- final PSNumber[] newArray =
- new PSNumber[PsUtil.MATRIX_QTY_ELEMENTS];
+ final PsNumber[] newArray =
+ new PsNumber[PsUtil.MATRIX_QTY_ELEMENTS];
for (int i = 0; i < this.value.length; i++) {
- if (this.value[i] instanceof PSNumber) {
- newArray[i] = (PSNumber) this.value[i];
+ if (this.value[i] instanceof PsNumber) {
+ newArray[i] = (PsNumber) this.value[i];
} else {
allNumbers = false;
break;
@@ -146,7 +146,7 @@
if (! allNumbers) {
return null;
}
- return new PSMatrix(newArray, this.executable);
+ return new PsMatrix(newArray, this.executable);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsArrayExecuting.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -29,12 +29,12 @@
package org.foray.ps;
/**
- * A wrapper around an instance of {@link PSArray}, acting as an iterator over its content.
+ * A wrapper around an instance of {@link PsArray}, acting as an iterator over its content.
*/
public class PsArrayExecuting extends PsObjectSimple implements PsExecutable {
/** The array whose contents are iterated. */
- private PSArray wrappedArray;
+ private PsArray wrappedArray;
/**
* Index into value that indicates array element should be processed next
@@ -46,7 +46,7 @@
* Constructor.
* @param wrappedArray The array whose contents are iterated. This array must be executable.
*/
- public PsArrayExecuting(final PSArray wrappedArray) {
+ public PsArrayExecuting(final PsArray wrappedArray) {
super();
if (! wrappedArray.isExecutable()) {
throw new IllegalArgumentException("Cannot execute an unexecutable array.");
@@ -58,11 +58,11 @@
* Returns the next item in this procedure.
* @return The next item in this procedure.
*/
- public PSObject getNextProcedureItem() {
+ public PsObject getNextProcedureItem() {
if (this.executionStackIteratorIndex > this.wrappedArray.size() - 1) {
return null;
}
- final PSObject nextElement = this.wrappedArray.get(this.executionStackIteratorIndex);
+ final PsObject nextElement = this.wrappedArray.get(this.executionStackIteratorIndex);
this.executionStackIteratorIndex ++;
return nextElement;
}
@@ -78,14 +78,14 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PSObject object) {
+ public boolean isComparable(final PsObject object) {
return this.wrappedArray.isComparable(object);
}
/**
* {@inheritDoc}
*/
- public PSName getTypeName() {
+ public PsName getTypeName() {
return this.wrappedArray.getTypeName();
}
@@ -99,7 +99,7 @@
/**
* {@inheritDoc}
*/
- public PSObject duplicate() {
+ public PsObject duplicate() {
return new PsArrayExecuting(this.wrappedArray);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsBoolean.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsBoolean.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsBoolean.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -31,7 +31,7 @@
/**
* Class representing a boolean PostScript object.
*/
-public class PSBoolean extends PsObjectSimple {
+public class PsBoolean extends PsObjectSimple {
/** The encapsulated value for this object. */
private boolean value;
@@ -40,7 +40,7 @@
* Constructor.
* @param value The boolean value to be wrapped.
*/
- public PSBoolean(final boolean value) {
+ public PsBoolean(final boolean value) {
super();
this.value = value;
}
@@ -48,8 +48,8 @@
/**
* {@inheritDoc}
*/
- public PSObject duplicate() {
- return new PSBoolean(this.value);
+ public PsObject duplicate() {
+ return new PsBoolean(this.value);
}
/**
@@ -62,8 +62,8 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PSObject object) {
- if (object instanceof PSBoolean) {
+ public boolean isComparable(final PsObject object) {
+ if (object instanceof PsBoolean) {
return true;
}
return false;
@@ -72,8 +72,8 @@
/**
* {@inheritDoc}
*/
- public PSName getTypeName() {
- return new PSName("booleantype", true, false);
+ public PsName getTypeName() {
+ return new PsName("booleantype", true, false);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsColorSpace.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsColorSpace.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsColorSpace.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -32,7 +32,7 @@
* A PostScript Color Space.
* Color Spaces are described at PSLRM 2nd Edition, Section 4.8.
*/
-public class PSColorSpace extends PSArray {
+public class PsColorSpace extends PsArray {
/* TODO: It looks like this whole class should be static. */
/** Constant indicating a Device Gray colorspace. */
@@ -63,7 +63,7 @@
* Standard constructor.
* @param value The colorspace value.
*/
- public PSColorSpace(final Object[] value) {
+ public PsColorSpace(final Object[] value) {
super(value, false);
}
@@ -80,20 +80,20 @@
* {@link #SEPARATION}.
* @return The appropriate colorspace instance.
*/
- public static PSColorSpace makeColorSpace(final int type) {
- PSName csName = null;
+ public static PsColorSpace makeColorSpace(final int type) {
+ PsName csName = null;
switch (type) {
- case PSColorSpace.DEVICE_GRAY: {
- csName = new PSName("DeviceGray", false, false);
- return new PSColorSpace(new Object[] {csName});
+ case PsColorSpace.DEVICE_GRAY: {
+ csName = new PsName("DeviceGray", false, false);
+ return new PsColorSpace(new Object[] {csName});
}
- case PSColorSpace.DEVICE_RGB: {
- csName = new PSName("DeviceRGB", false, false);
- return new PSColorSpace(new Object[] {csName});
+ case PsColorSpace.DEVICE_RGB: {
+ csName = new PsName("DeviceRGB", false, false);
+ return new PsColorSpace(new Object[] {csName});
}
- case PSColorSpace.DEVICE_CMYK: {
- csName = new PSName("DeviceCMYK", false, false);
- return new PSColorSpace(new Object[] {csName});
+ case PsColorSpace.DEVICE_CMYK: {
+ csName = new PsName("DeviceCMYK", false, false);
+ return new PsColorSpace(new Object[] {csName});
}
default: {
return null;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-05-15 04:52:44 UTC (rev 10579)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-05-15 06:10:31 UTC (rev 10580)
@@ -34,35 +34,35 @@
/**
* A PostScript dictionary.
*/
-public class PSDictionary extends PsObjectComposite {
+public class PsDictionary extends PsObjectComposite {
/** Constant indicating the default size of a new dictionary. */
public static final byte DEFAULT_FONT_DICTIONARY_SIZE = 10;
/** The encapsulated map. */
- private Map<PSObject, PSObject> dictionary = null;
+ private Map<PsObject, PsObject> dictionary = null;
/**
* Constructor.
* @param initialSize The number of elements that this dictionary should be
* sized for as it is created.
*/
- public PSDictionary(final int initialSize) {
+ public PsDictionary(final int initialSize) {
super();
- this.dictionary = new HashMap<PSObject, PSObject>(initialSize);
+ this.dictionary = new HashMap<PsObject, PsObject>(initialSize);
}
/**
* Tries to process a name object.
* @param interpreter The parent interpreter.
- * @param nameObject The PSName instance that should be executed.
+ * @param nameObject The PsName instance that should be executed.
* @return True if the operation was found and executed, otherwise, false.
* @throws PsOperatorException For errors executing operators.
- * @throws PSException For any PostScript error.
+ * @throws PsException For any PostScript error.
*/
- protected boolean execute(final PSInterpreter interpreter, final PSName nameObject)
- throws PsOperatorException, PSException {
- final PSObject value = getItem(nameObject);
+ protected boolean execute(final PsInterpreter interpreter, final PsName nameObject)
+ throws PsOperatorException, PsException {
+ final PsObject value = getItem(nameObject);
// If the item is not in this dictionary, exit
if (value == null) {
return false;
@@ -83,17 +83,17 @@
* be executed
* @return True if the operator is found and executed, otherwise, false.
* @throws PsOperatorException For errors executing operators.
- * @throws PSException For any PostScript error.
+ * @throws PsException For any PostScript error.
*/
protected boolean executeOperator(final short operatorEnum) throws PsOperatorException,
- PSException {
+ PsException {
return false;
}
/**
* {@inheritDoc}
*/
- public PSObject duplicate() {
+ public PsObject duplicate() {
return this;
}
@@ -109,17 +109,17 @@
* @param interpreter The parent interpreter.
* @param key The key to the dictionary entry.
* @param value The value of the dictionary entry.
- * @throws PSException A typecheck error if the object is null.
+ * @throws PsException A typecheck error if the object is null.
*/
- public void addItem(final PSInterpreter interpreter, final PSObject key, final PSObject value)
- throws PSException {
+ public void addItem(final PsInterpreter interpreter, final PsObject key, final PsObject value)
+ throws PsException {
// Per PLRM2, Sec 3.3.9, a key can be any PS object except null.
if (key instanceof PsNull) {
- throw new PSException(interpreter, PsError.TYPECHECK, -1);
+ throw new PsException(interpreter, PsError.TYPECHECK, -1);
}
/*
* We are relying here on proper equals() methods, primarily in the
- * PSName and PSString classes.
+ * PsName and PsString classes.
*/
this.dictionary.put(key, value);
}
@@ -129,8 +129,8 @@
* @param key The key whose value should be retrieved.
* @return The value.
*/
- public PSObject getItem(final PSObject key) {
- for (PSObject currentKey : this.dictionary.keySet()) {
+ public PsObject getItem(final PsObject key) {
+ for (PsObject currentKey : this.dictionary.keySet()) {
if (currentKey.equals(key)) {
return this.dictionary.get(currentKey);
}
@@ -143,8 +143,8 @@
* @param key The key whose value should be retrieved.
* @return The value.
*/
- public PSObject getItem(final String key) {
- for (PSObject currentKey : this.dictionary.keySet()) {
+ public PsObject getItem(final String key) {
+ for (PsObject currentKey : this.dictionary.keySet()) {
if (currentKey.equals(key)) {
return this.dictionary.get(currentKey);
}
@@ -165,7 +165,7 @@
* @return True if this is a valid font dictionary, false otherwise.
*/
public boolean isValidFontDictionary() {
- final PSInteger fontType = (PSInteger) getItem("FontType");
+ final PsInteger fontType = (PsInteger) getItem("FontType");
if (fontType == null) {
return false;
}
@@ -197,8 +197,8 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PSObject object) {
- if (object instanceof PSDictionary) {
+ public boolean isComparable(final PsObject object) {
+ if (object instanceof PsDictionary) {
return true;
}
return false;
@@ -207,15 +207,15 @@
/**
* {@inheritDoc}
*/
- public PSName getTypeName() {
- return new PSName("dicttype", true, false);
+ public PsName getTypeName() {
+ return new PsName("dicttype", true, false);
}
/**
* Return the encapsulated Map.
* @return The encapsulated Map.
*/
- public Map<PSObject, PSObject> getMap() {
+ public Map<PsObject, PsObject> getMap() {
...
[truncated message content] |
|
From: <vic...@us...> - 2008-05-30 04:43:22
|
Revision: 10599
http://foray.svn.sourceforge.net/foray/?rev=10599&view=rev
Author: victormote
Date: 2008-05-29 21:43:29 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Change PsInteger to wrap a BigDecimal instead of int.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsNumber.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -184,7 +184,7 @@
final Object arrayItem = psarray.get(i);
if (arrayItem instanceof PsInteger) {
final PsInteger psInteger = (PsInteger) arrayItem;
- final int itemValue = psInteger.getValue();
+ final int itemValue = psInteger.intValue();
this.fontBBox[i] = itemValue;
} else {
return null;
@@ -211,7 +211,7 @@
if (! (item instanceof PsInteger)) {
return 0;
}
- return ((PsInteger) item).getValue();
+ return ((PsInteger) item).intValue();
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -180,7 +180,7 @@
if (getItem("FontMatrix") == null) {
return false;
}
- if (fontType.getValue() != 0) {
+ if (fontType.intValue() != 0) {
if (getItem("Encoding") == null) {
return false;
}
@@ -188,7 +188,7 @@
return false;
}
}
- if (fontType.getValue() == 1) {
+ if (fontType.intValue() == 1) {
if (getItem("PaintType") == null) {
return false;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -30,10 +30,12 @@
import org.foray.common.WKConstants;
+import java.math.BigDecimal;
+
/**
* Class representing a numeric PostScript object.
*/
-public class PsInteger extends PsNumber implements Comparable<Object> {
+public class PsInteger extends PsNumber {
/** Constant indicating the smallest PostScript integer value. */
public static final int PS_SMALLEST_INTEGER = -2147483648;
@@ -49,19 +51,27 @@
* an integer in the PostScript language (base-36). */
private static final int MAXIMUM_RADIX = 36;
- /** The encapsulated value for this object. */
- private int value;
-
/**
- * Constructor.
+ * Constructor for an int parameter.
* @param value The value to encapsulate.
*/
public PsInteger(final int value) {
- super();
- this.value = value;
+ super(new BigDecimal(value));
}
/**
+ * Constructor for a BigDecimal parameter.
+ * @param value The value to encapsulate. This must be a BigDecimal that has no fractional
+ * part, that is, it must be an integer.
+ */
+ public PsInteger(final BigDecimal value) {
+ super(value);
+ /* Extract the value. The only purpose in doing this is to get the ArithmeticException
+ * thrown if the value is not an integer. */
+ value.intValueExact();
+ }
+
+ /**
* Creates a PSInteger if value is within the PostScript architectural
* limits for an integer.
* @param value The value to be encapsulated.
@@ -71,7 +81,7 @@
public static PsNumber makePSNumber(final long value) {
if (value > PsInteger.PS_LARGEST_INTEGER
|| value < PsInteger.PS_SMALLEST_INTEGER) {
- return new PsReal(value);
+ return new PsReal(new BigDecimal(value));
}
return new PsInteger((int) value);
}
@@ -80,7 +90,7 @@
* {@inheritDoc}
*/
public PsInteger clone() {
- final PsInteger clone = new PsInteger(this.value);
+ final PsInteger clone = new PsInteger(this.getValue());
return clone;
}
@@ -241,7 +251,7 @@
* {@inheritDoc}
*/
public PsInteger duplicate() {
- return new PsInteger(this.value);
+ return new PsInteger(this.getValue());
}
/**
@@ -254,114 +264,30 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PsObject object) {
- if (object instanceof PsInteger || object instanceof PsReal) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(final Object object) {
- PsObject psobject = null;
- if (object instanceof PsObject) {
- psobject = (PsObject) object;
- } else {
- return Byte.MIN_VALUE;
- }
- if (! isComparable(psobject)) {
- return Byte.MIN_VALUE;
- }
- if (psobject instanceof PsInteger) {
- final PsInteger psinteger = (PsInteger) psobject;
- if (this.value == psinteger.value) {
- return 0;
- } else if (this.value < psinteger.value) {
- return -1;
- } else {
- return 1;
- }
- }
- if (psobject instanceof PsReal) {
- final PsReal psreal = (PsReal) psobject;
- if (this.value == psreal.getDoubleValue()) {
- return 0;
- } else if (this.value < psreal.getDoubleValue()) {
- return -1;
- } else {
- return 1;
- }
- }
- return Byte.MIN_VALUE;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(final Object object) {
- if (this.compareTo(object) == 0) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
public PsName getTypeName() {
return new PsName("integertype", true, false);
}
/**
- * Return the encapsulated value.
- * @return The encapsulated value.
- */
- public int getValue() {
- return this.value;
- }
-
- /**
* {@inheritDoc}
*/
- public double getDoubleValue() {
- return this.value;
- }
-
- /**
- * {@inheritDoc}
- */
- public void round() {
- /* Do nothing. This is already an integer. */
- return;
- }
-
- /**
- * {@inheritDoc}
- */
public String toString() {
- return "Integer: " + Integer.toString(this.value);
+ return "Integer: " + this.getValue().toString();
}
/**
* {@inheritDoc}
*/
- public PsNumber add(final PsNumber amount) {
- if (amount instanceof PsInteger) {
- final PsInteger psInteger = (PsInteger) amount;
- this.value += psInteger.value;
- return this;
- }
- final double newValue = this.value + amount.getDoubleValue();
- return new PsReal(newValue);
+ public boolean isComposite() {
+ return false;
}
/**
- * {@inheritDoc}
+ * Returns the integer value of this instance.
+ * @return The integer value.
*/
- public boolean isComposite() {
- return false;
+ public int intValue() {
+ return this.getValue().intValueExact();
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsNumber.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsNumber.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsNumber.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -28,18 +28,25 @@
package org.foray.ps;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
/**
* Superclass for numeric Postscript data types.
* @see PsInteger
* @see PsReal
*/
-public abstract class PsNumber implements PsObjectSimple, Cloneable {
+public abstract class PsNumber implements PsObjectSimple, Cloneable, Comparable<PsNumber> {
+ /** The encapsulated value for this object. */
+ private BigDecimal value;
+
/**
* Constructor.
+ * @param value The encapsulated value for this object.
*/
- public PsNumber() {
- super();
+ public PsNumber(final BigDecimal value) {
+ this.value = value;
}
/**
@@ -51,21 +58,21 @@
* Return the value of this numeric item cast as a double.
* @return The value of this number as a double.
*/
- public abstract double getDoubleValue();
+ public double getDoubleValue() {
+ return this.getValue().doubleValue();
+ }
/**
* Rounds the value.
*/
- public abstract void round();
+ public void round() {
+ if (this instanceof PsInteger) {
+ /* Do nothing. The value is already an integer. */
+ return;
+ }
+ this.value = this.value.setScale(0, RoundingMode.HALF_UP);
+ }
- /**
- * Adds a given amount to the value of this object, returning either this object with its value
- * adjusted, or, if this object is unable to represent the value properly, a new object which
- * can.
- * @param amount The amount which should be added to the value of this number.
- * @return A PSNumber that contains the new value.
- */
- public abstract PsNumber add(PsNumber amount);
/**
* Tests whether the input byte is a numeral.
@@ -114,4 +121,63 @@
return false;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isComparable(final PsObject object) {
+ if (object instanceof PsNumber) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(final Object object) {
+ if (object instanceof PsNumber) {
+ final PsNumber psNumber = (PsNumber) object;
+ return this.compareTo(psNumber) == 0;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int compareTo(final PsNumber object) {
+ return this.getValue().compareTo(object.getValue());
+ }
+
+ /**
+ * Adds a given amount to the value of this object, returning either this object with its value
+ * adjusted, or, if this object is unable to represent the value properly, a new object which
+ * can.
+ * @param amount The amount which should be added to the value of this number.
+ * @return A PSNumber that contains the new value.
+ */
+ public PsNumber add(final PsNumber amount) {
+ /* Avoid unnecessary creation of objects if possible. */
+ if (this.getValue().compareTo(BigDecimal.ZERO) == 0) {
+ return amount;
+ }
+ if (amount.getValue().compareTo(BigDecimal.ZERO) == 0) {
+ return this;
+ }
+ final BigDecimal sum = this.getValue().add(amount.getValue());
+ if (this instanceof PsInteger
+ && amount instanceof PsInteger) {
+ return new PsInteger(sum);
+ }
+ return new PsReal(sum);
+ }
+
+ /**
+ * Return the encapsulated value.
+ * @return The encapsulated value.
+ */
+ public BigDecimal getValue() {
+ return this.value;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -29,23 +29,18 @@
package org.foray.ps;
import java.math.BigDecimal;
-import java.math.RoundingMode;
/**
* Class representing PostScript object that is a real number.
*/
-public class PsReal extends PsNumber implements Comparable<Object> {
+public class PsReal extends PsNumber {
- /** The encapsulated value for this object. */
- private BigDecimal value;
-
/**
* Constructor for a double value.
* @param value The value to encapsulate.
*/
public PsReal(final double value) {
- super();
- this.value = new BigDecimal(value);
+ super(new BigDecimal(value));
}
/**
@@ -53,15 +48,14 @@
* @param value The value to encapsulate.
*/
public PsReal(final BigDecimal value) {
- super();
- this.value = value;
+ super(value);
}
/**
* {@inheritDoc}
*/
public PsReal clone() {
- final PsReal clone = new PsReal(this.value);
+ final PsReal clone = new PsReal(this.getValue());
return clone;
}
@@ -80,22 +74,23 @@
if (!isNumeral(input[i])
&& !isMember(PsInterpreter.SIGN_INDICATOR, input[i])
&& input[i] != '.'
- && input[i] != 'E' // E (for exponent)
- && input[i] != 'e' // e (for exponent)
- ) {
+ /* E (for exponent). */
+ && input[i] != 'E'
+ /* e (for exponent). */
+ && input[i] != 'e') {
return null;
}
}
- // An e or E by itself won't be a number.
- if (input.length == 1 && (input[0] == 'e' || input[0] == 'E')) {
+ /* An e or E by itself won't be a number. */
+ if (input.length == 1
+ && (input[0] == 'e'
+ || input[0] == 'E')) {
return null;
}
- // It looks like the java methods might be sufficient here
- final StringBuilder sb = new StringBuilder();
- for (int i = 0; i < input.length; i++) {
- sb.append((char) input[i]);
- }
- final double value = Double.valueOf(sb.toString()).doubleValue();
+ final String sb = new String(input);
+ /* Use the String constructor to get better precision than can be had with a float or
+ * double. */
+ final BigDecimal value = new BigDecimal(sb);
return new PsReal(value);
}
@@ -103,7 +98,7 @@
* {@inheritDoc}
*/
public PsReal duplicate() {
- return new PsReal(this.value);
+ return new PsReal(this.getValue());
}
/**
@@ -116,106 +111,20 @@
/**
* {@inheritDoc}
*/
- public boolean isComparable(final PsObject object) {
- if (object instanceof PsInteger || object instanceof PsReal) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(final Object object) {
- PsObject psobject = null;
- if (object instanceof PsObject) {
- psobject = (PsObject) object;
- } else {
- return Byte.MIN_VALUE;
- }
- if (! isComparable(psobject)) {
- return Byte.MIN_VALUE;
- }
- if (psobject instanceof PsInteger) {
- final PsInteger psinteger = (PsInteger) psobject;
- if (this.value.doubleValue() == psinteger.getValue()) {
- return 0;
- } else if (this.value.doubleValue() < psinteger.getValue()) {
- return -1;
- } else {
- return 1;
- }
- }
- if (psobject instanceof PsReal) {
- final PsReal psreal = (PsReal) psobject;
- if (this.value == psreal.value) {
- return 0;
- } else if (this.value.doubleValue() < psreal.value.doubleValue()) {
- return -1;
- } else {
- return 1;
- }
- }
- return Byte.MIN_VALUE;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(final Object object) {
- if (this.compareTo(object) == 0) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
public PsName getTypeName() {
return new PsName("realtype", true, false);
}
/**
- * Return the encapsulated value.
- * @return The encapsulated value.
- */
- public BigDecimal getValue() {
- return this.value;
- }
-
- /**
* {@inheritDoc}
*/
- public double getDoubleValue() {
- return this.value.doubleValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public void round() {
- this.value = this.value.setScale(0, RoundingMode.HALF_UP);
- }
-
- /**
- * {@inheritDoc}
- */
public String toString() {
- return "Real: " + this.value.toString();
+ return "Real: " + this.getValue().toString();
}
/**
* {@inheritDoc}
*/
- public PsNumber add(final PsNumber amount) {
- final double doubleValue = this.getDoubleValue() + amount.getDoubleValue();
- return new PsReal(doubleValue);
- }
-
- /**
- * {@inheritDoc}
- */
public boolean isComposite() {
return false;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -872,12 +872,7 @@
*/
private double popDouble(final PsOperator operation) throws PsOperatorException {
final PsNumber psn = popPSNumber(operation);
- if (psn instanceof PsInteger) {
- return ((PsInteger) psn).getValue();
- } else if (psn instanceof PsReal) {
- return ((PsReal) psn).getDoubleValue();
- }
- return 0;
+ return psn.getDoubleValue();
}
/**
@@ -898,7 +893,7 @@
*/
private int popInt(final PsOperator operation) throws PsOperatorException {
final PsInteger psi = popPSInteger(operation);
- return psi.getValue();
+ return psi.intValue();
}
/**
@@ -1097,7 +1092,7 @@
if (! (object instanceof PsInteger)) {
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.DICT);
}
- int initialSize = ((PsInteger) object).getValue();
+ int initialSize = ((PsInteger) object).intValue();
if (initialSize < -1) {
initialSize = 1;
}
@@ -1170,7 +1165,7 @@
*/
private void addAsIntegers(final PsInteger num1, final PsInteger num2)
throws PsOperatorException {
- final long sum = num1.getValue() + num2.getValue();
+ final long sum = num1.intValue() + num2.intValue();
final PsNumber number = PsInteger.makePSNumber(sum);
pushOperand(number);
}
@@ -1186,7 +1181,7 @@
&& num2 instanceof PsInteger) {
final PsInteger integer1 = (PsInteger) num1;
final PsInteger integer2 = (PsInteger) num2;
- final long difference = integer1.getValue() - integer2.getValue();
+ final long difference = integer1.intValue() - integer2.intValue();
final PsNumber number = PsInteger.makePSNumber(difference);
pushOperand(number);
} else {
@@ -1206,7 +1201,7 @@
&& num2 instanceof PsInteger) {
final PsInteger integer1 = (PsInteger) num1;
final PsInteger integer2 = (PsInteger) num2;
- final long product = integer1.getValue() * integer2.getValue();
+ final long product = integer1.intValue() * integer2.intValue();
final PsNumber number = PsInteger.makePSNumber(product);
pushOperand(number);
} else {
@@ -1395,7 +1390,7 @@
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.STRING);
}
final PsInteger psinteger = (PsInteger) object;
- final int size = psinteger.getValue();
+ final int size = psinteger.intValue();
final StringBuilder sb = new StringBuilder(size);
for (int i = 1; i <= size; i++) {
sb.append('0');
@@ -1455,10 +1450,8 @@
*/
private void roll() throws PsOperatorException, PsException {
try {
- final int j = ((PsInteger) popOperand(PsOperator.ROLL))
- .getValue();
- final int n = ((PsInteger) popOperand(PsOperator.ROLL))
- .getValue();
+ final int j = ((PsInteger) popOperand(PsOperator.ROLL)).intValue();
+ final int n = ((PsInteger) popOperand(PsOperator.ROLL)).intValue();
if (n <= 0) {
throw new PsOperatorException(PsError.RANGECHECK,
PsOperator.ROLL, "n must be non-negative");
@@ -1558,7 +1551,7 @@
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.PUT);
}
final PsInteger psinteger = (PsInteger) where;
- final int index = psinteger.getValue();
+ final int index = psinteger.intValue();
if (index < 0 || index > array.size() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.PUT);
}
@@ -1593,7 +1586,7 @@
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.PUT);
}
PsInteger psinteger = (PsInteger) where;
- final int index = psinteger.getValue();
+ final int index = psinteger.intValue();
if (index < 0 || index > string.getValue().length() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.PUT);
}
@@ -1601,7 +1594,7 @@
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.PUT);
}
psinteger = (PsInteger) what;
- final char replacementChar = (char) psinteger.getValue();
+ final char replacementChar = (char) psinteger.intValue();
final char[] charArray = new char[string.getValue().length()];
string.getValue().getChars(0, string.getValue().length(), charArray, 0);
charArray[index] = replacementChar;
@@ -1617,7 +1610,7 @@
if (! (object instanceof PsInteger)) {
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.ARRAY);
}
- final int size = ((PsInteger) object).getValue();
+ final int size = ((PsInteger) object).intValue();
if (size < 0 || size > PsInterpreter.MAX_ARRAY_SIZE) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.ARRAY);
}
@@ -1648,7 +1641,7 @@
if (! (object instanceof PsInteger)) {
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.INDEX);
}
- final int index = ((PsInteger) object).getValue();
+ final int index = ((PsInteger) object).intValue();
if (index < 0) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.INDEX);
}
@@ -1693,7 +1686,7 @@
if (! (where instanceof PsInteger)) {
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.GET);
}
- final int index = ((PsInteger) where).getValue();
+ final int index = ((PsInteger) where).intValue();
if (index < 0 || index > array.size() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.GET);
}
@@ -1725,7 +1718,7 @@
if (! (where instanceof PsInteger)) {
throw new PsOperatorException(PsError.TYPECHECK, PsOperator.GET);
}
- final int index = ((PsInteger) where).getValue();
+ final int index = ((PsInteger) where).intValue();
if (index < 0 || index > string.getValue().length() - 1) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.GET);
}
@@ -1795,7 +1788,7 @@
final PsObject object = popOperand(PsOperator.NEG);
if (object instanceof PsInteger) {
final PsInteger psint = (PsInteger) object;
- final int value = psint.getValue();
+ final int value = psint.intValue();
pushOperand(new PsInteger(-1 * value));
return;
}
@@ -1825,7 +1818,7 @@
}
if (object instanceof PsInteger) {
PsInteger psinteger = (PsInteger) object;
- final int value = psinteger.getValue();
+ final int value = psinteger.intValue();
psinteger = new PsInteger(~value);
pushOperand(psinteger);
return;
@@ -1847,7 +1840,7 @@
return;
}
if (item2 instanceof PsInteger) {
- final int int2 = ((PsInteger) item2).getValue();
+ final int int2 = ((PsInteger) item2).intValue();
final int int1 = popInt(PsOperator.OR);
final PsInteger int3 = new PsInteger(int1 | int2);
pushOperand(int3);
@@ -1870,7 +1863,7 @@
return;
}
if (item2 instanceof PsInteger) {
- final int int2 = ((PsInteger) item2).getValue();
+ final int int2 = ((PsInteger) item2).intValue();
final int int1 = popInt(PsOperator.OR);
final PsInteger int3 = new PsInteger(int1 ^ int2);
pushOperand(int3);
@@ -1893,7 +1886,7 @@
return;
}
if (item2 instanceof PsInteger) {
- final int int2 = ((PsInteger) item2).getValue();
+ final int int2 = ((PsInteger) item2).intValue();
final int int1 = popInt(PsOperator.OR);
final PsInteger int3 = new PsInteger(int1 & int2);
pushOperand(int3);
@@ -2558,7 +2551,7 @@
*/
private void copyStack() throws PsOperatorException {
final PsInteger integer = popPSInteger(PsOperator.COPY);
- final int count = integer.getValue();
+ final int count = integer.intValue();
if (count < 0) {
throw new PsOperatorException(PsError.RANGECHECK, PsOperator.COPY);
}
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java 2008-05-30 03:06:17 UTC (rev 10598)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java 2008-05-30 04:43:29 UTC (rev 10599)
@@ -66,12 +66,12 @@
PsObject object = interpreter.getOperandStack().peek(0);
assertTrue(object instanceof PsInteger);
PsInteger integer = (PsInteger) object;
- assertEquals(2, integer.getValue());
+ assertEquals(2, integer.intValue());
/* The next-to-top item should be the integer 1. */
object = interpreter.getOperandStack().peek(1);
assertTrue(object instanceof PsInteger);
integer = (PsInteger) object;
- assertEquals(1, integer.getValue());
+ assertEquals(1, integer.intValue());
/* Second example from the PSLRM, 2nd ed. */
input = new PsStringInput("1 2 3 pop pop");
@@ -83,7 +83,7 @@
object = interpreter.getOperandStack().peek(0);
assertTrue(object instanceof PsInteger);
integer = (PsInteger) object;
- assertEquals(1, integer.getValue());
+ assertEquals(1, integer.intValue());
}
/**
@@ -141,7 +141,7 @@
PsObject object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
PsInteger integer = (PsInteger) object;
- assertEquals(1, integer.getValue());
+ assertEquals(1, integer.intValue());
/* Second example from the PSLRM, 2nd ed. */
input = new PsStringInput("4 2 idiv");
@@ -151,7 +151,7 @@
object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
integer = (PsInteger) object;
- assertEquals(2, integer.getValue());
+ assertEquals(2, integer.intValue());
/* Third example from the PSLRM, 2nd ed. */
input = new PsStringInput("-5 2 idiv");
@@ -161,7 +161,7 @@
object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
integer = (PsInteger) object;
- assertEquals(-2, integer.getValue());
+ assertEquals(-2, integer.intValue());
}
/**
@@ -177,7 +177,7 @@
PsObject object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
final PsInteger integer = (PsInteger) object;
- assertEquals(7, integer.getValue());
+ assertEquals(7, integer.intValue());
/* Second example from the PSLRM, 2nd ed. */
input = new PsStringInput("9.9 1.1 add");
@@ -202,7 +202,7 @@
PsObject object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
final PsInteger integer = (PsInteger) object;
- assertEquals(4, integer.getValue());
+ assertEquals(4, integer.intValue());
/* Inverse of the second example for "add" from the PSLRM, 2nd ed. */
input = new PsStringInput("11.0 9.9 sub");
@@ -228,7 +228,7 @@
PsObject object = interpreter.getOperandStack().pop();
assertTrue(object instanceof PsInteger);
final PsInteger integer = (PsInteger) object;
- assertEquals(12, integer.getValue());
+ assertEquals(12, integer.intValue());
/* Second example from ...
[truncated message content] |