You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2003/09/16 03:12:53 UTC
cvs commit: xml-batik/sources/org/apache/batik/util CleanerThread.java EventDispatcher.java ParsedURLData.java RunnableQueue.java
deweese 2003/09/15 18:12:53
Modified: sources/org/apache/batik/apps/slideshow Main.java
sources/org/apache/batik/apps/svgbrowser
JSVGViewerFrame.java
sources/org/apache/batik/bridge FontFace.java
SVGBrokenLinkProvider.java UpdateManager.java
sources/org/apache/batik/dom/events EventSupport.java
sources/org/apache/batik/ext/awt/image/spi
PNGRegistryEntry.java TIFFRegistryEntry.java
sources/org/apache/batik/script InterpreterPool.java
sources/org/apache/batik/svggen
AbstractImageHandlerEncoder.java
sources/org/apache/batik/swing/gvt GVTTreeRenderer.java
JGVTComponent.java
sources/org/apache/batik/swing/svg GVTTreeBuilder.java
SVGDocumentLoader.java SVGLoadEventDispatcher.java
sources/org/apache/batik/transcoder/image PNGTranscoder.java
sources/org/apache/batik/util CleanerThread.java
EventDispatcher.java ParsedURLData.java
RunnableQueue.java
Log:
1) PNGTranscoder now omits Gamma chunk of GAMMA_KEY is 0.
It will also suspend srGB intent generation if KEY_GAMMA is provided.
2) All catches of Throwable now catches ThreadDeath as a special case.
Revision Changes Path
1.7 +4 -5 xml-batik/sources/org/apache/batik/apps/slideshow/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/slideshow/Main.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Main.java 9 Aug 2003 16:58:45 -0000 1.6
+++ Main.java 16 Sep 2003 01:12:52 -0000 1.7
@@ -172,10 +172,9 @@
System.out.println("Painting: " + files[i]);
image = renderer.getOffScreen();
setTransition(image);
- } catch (Throwable t) {
- t.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
-
}
if (transitionThread != null) {
try {
@@ -441,8 +440,8 @@
for (int i=0; i<fileVec.size(); i++) {
try {
files[i] = new File((String)fileVec.get(i));
- } catch (Throwable t) {
- t.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
}
1.101 +11 -4 xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
Index: JSVGViewerFrame.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- JSVGViewerFrame.java 14 Aug 2003 00:53:51 -0000 1.100
+++ JSVGViewerFrame.java 16 Sep 2003 01:12:52 -0000 1.101
@@ -228,6 +228,12 @@
("go", null);
setExitAction = debuggerClass.getMethod
("setExitAction", new Class[] {Runnable.class});
+ } catch (ThreadDeath td) {
+ debuggerClass = null;
+ clearAllBreakpoints = null;
+ scriptGo = null;
+ setExitAction = null;
+ throw td;
} catch (Throwable t) {
debuggerClass = null;
clearAllBreakpoints = null;
@@ -267,8 +273,8 @@
hideDebugger();
}}});
debuggerFrame.addWindowListener(wa);
- } catch (Throwable t) {
- t.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
return;
}
}
@@ -286,7 +292,8 @@
try {
clearAllBreakpoints.invoke(debuggerFrame, null);
scriptGo.invoke(debuggerFrame, null);
- } catch (Throwable t) {
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
}
1.5 +3 -3 xml-batik/sources/org/apache/batik/bridge/FontFace.java
Index: FontFace.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/FontFace.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FontFace.java 27 Aug 2003 23:33:22 -0000 1.4
+++ FontFace.java 16 Sep 2003 01:12:52 -0000 1.5
@@ -162,7 +162,7 @@
// the user but keep going.
if (ERR_URI_UNSECURE.equals(ex.getCode()))
ctx.getUserAgent().displayError(ex);
- } catch (Throwable t) {
+ } catch (Exception ex) {
// Do nothing couldn't get Referenced URL.
}
}
@@ -251,7 +251,7 @@
Font font = Font.createFont(Font.TRUETYPE_FONT,
purl.openStream());
return new AWTFontFamily(this, font);
- } catch (Throwable t) {
+ } catch (Exception ex) {
}
return null;
}
1.11 +1 -1 xml-batik/sources/org/apache/batik/bridge/SVGBrokenLinkProvider.java
Index: SVGBrokenLinkProvider.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGBrokenLinkProvider.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SVGBrokenLinkProvider.java 8 Aug 2003 11:38:51 -0000 1.10
+++ SVGBrokenLinkProvider.java 16 Sep 2003 01:12:52 -0000 1.11
@@ -94,7 +94,7 @@
try {
svgDoc = (SVGDocument)loader.loadDocument(blURL.toString());
gvtRoot = builder.build(ctx, svgDoc);
- } catch (Throwable t) {
+ } catch (Exception ex) {
// t.printStackTrace();
}
}
1.25 +5 -1 xml-batik/sources/org/apache/batik/bridge/UpdateManager.java
Index: UpdateManager.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UpdateManager.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- UpdateManager.java 9 Aug 2003 16:58:37 -0000 1.24
+++ UpdateManager.java 16 Sep 2003 01:12:52 -0000 1.25
@@ -391,6 +391,10 @@
fireEvent(updateCompletedDispatcher,new UpdateManagerEvent
(this, repaintManager.getOffScreen(), l));
+ } catch (ThreadDeath td) {
+ fireEvent(updateFailedDispatcher,
+ new UpdateManagerEvent(this, null, null));
+ throw td;
} catch (Throwable t) {
fireEvent(updateFailedDispatcher,
new UpdateManagerEvent(this, null, null));
1.12 +4 -3 xml-batik/sources/org/apache/batik/dom/events/EventSupport.java
Index: EventSupport.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/events/EventSupport.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- EventSupport.java 9 Aug 2003 16:58:44 -0000 1.11
+++ EventSupport.java 16 Sep 2003 01:12:52 -0000 1.12
@@ -266,9 +266,10 @@
for (int i=0; i < listeners.length; ++i) {
try {
listeners[i].handleEvent(evt);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable th) {
- System.err.println("In Event");
- th.printStackTrace(System.err);
+ th.printStackTrace();
}
}
}
1.11 +2 -0 xml-batik/sources/org/apache/batik/ext/awt/image/spi/PNGRegistryEntry.java
Index: PNGRegistryEntry.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/spi/PNGRegistryEntry.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PNGRegistryEntry.java 8 Aug 2003 11:39:09 -0000 1.10
+++ PNGRegistryEntry.java 16 Sep 2003 01:12:52 -0000 1.11
@@ -133,6 +133,8 @@
} catch (IOException ioe) {
filt = ImageTagRegistry.getBrokenLinkImage
(this, errCode, errParam);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
filt = ImageTagRegistry.getBrokenLinkImage
(this, errCode, errParam);
1.7 +2 -0 xml-batik/sources/org/apache/batik/ext/awt/image/spi/TIFFRegistryEntry.java
Index: TIFFRegistryEntry.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/spi/TIFFRegistryEntry.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TIFFRegistryEntry.java 9 Aug 2003 16:58:43 -0000 1.6
+++ TIFFRegistryEntry.java 16 Sep 2003 01:12:52 -0000 1.7
@@ -118,6 +118,8 @@
} catch (IOException ioe) {
filt = ImageTagRegistry.getBrokenLinkImage
(this, errCode, errParam);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
filt = ImageTagRegistry.getBrokenLinkImage
(this, errCode, errParam);
1.16 +7 -1 xml-batik/sources/org/apache/batik/script/InterpreterPool.java
Index: InterpreterPool.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/InterpreterPool.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- InterpreterPool.java 8 Aug 2003 11:39:19 -0000 1.15
+++ InterpreterPool.java 16 Sep 2003 01:12:52 -0000 1.16
@@ -104,6 +104,8 @@
factory =
(InterpreterFactory)Class.forName(RHINO).newInstance();
defaultFactories.put("text/ecmascript", factory);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t1) {
// may append if the class is not in the CLASSPATH
}
@@ -111,6 +113,8 @@
factory =
(InterpreterFactory)Class.forName(JPYTHON).newInstance();
defaultFactories.put("text/python", factory);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t2) {
// may append if the class is not in the CLASSPATH
}
@@ -118,6 +122,8 @@
factory =
(InterpreterFactory)Class.forName(JACL).newInstance();
defaultFactories.put("text/tcl", factory);
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t3) {
// may append if the class is not in the CLASSPATH
}
1.15 +3 -1 xml-batik/sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
Index: AbstractImageHandlerEncoder.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AbstractImageHandlerEncoder.java 8 Aug 2003 11:39:20 -0000 1.14
+++ AbstractImageHandlerEncoder.java 16 Sep 2003 01:12:52 -0000 1.15
@@ -108,6 +108,8 @@
Class clazz = Class.forName("org.apache.batik.ext.awt.image.GraphicsUtil");
createGraphics = clazz.getMethod("createGraphics", paramc);
paramo = new Object[1];
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
// happen only if Batik extensions are not their
} finally {
1.12 +4 -1 xml-batik/sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
Index: GVTTreeRenderer.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- GVTTreeRenderer.java 9 Aug 2003 16:58:38 -0000 1.11
+++ GVTTreeRenderer.java 16 Sep 2003 01:12:52 -0000 1.12
@@ -176,6 +176,9 @@
// this sometimes happens with SVG Fonts since the glyphs are
// not built till the rendering stage
fireEvent(cancelledDispatcher, ev);
+ } catch (ThreadDeath td) {
+ fireEvent(failedDispatcher, ev);
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
fireEvent(failedDispatcher, ev);
1.42 +3 -1 xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java
Index: JGVTComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- JGVTComponent.java 31 Aug 2003 17:27:12 -0000 1.41
+++ JGVTComponent.java 16 Sep 2003 01:12:52 -0000 1.42
@@ -818,6 +818,8 @@
sleep(200);
}
} catch (InterruptedException ie) {
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
}
1.12 +5 -1 xml-batik/sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
Index: GVTTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/GVTTreeBuilder.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- GVTTreeBuilder.java 8 Aug 2003 11:39:24 -0000 1.11
+++ GVTTreeBuilder.java 16 Sep 2003 01:12:52 -0000 1.12
@@ -151,6 +151,10 @@
} catch (Exception e) {
exception = e;
fireEvent(failedDispatcher, ev);
+ } catch (ThreadDeath td) {
+ exception = new Exception(td.getMessage());
+ fireEvent(failedDispatcher, ev);
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
exception = new Exception(t.getMessage());
1.9 +5 -1 xml-batik/sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
Index: SVGDocumentLoader.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/SVGDocumentLoader.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGDocumentLoader.java 8 Aug 2003 11:39:24 -0000 1.8
+++ SVGDocumentLoader.java 16 Sep 2003 01:12:52 -0000 1.9
@@ -135,6 +135,10 @@
} catch (Exception e) {
exception = e;
fireEvent(failedDispatcher, evt);
+ } catch (ThreadDeath td) {
+ exception = new Exception(td.getMessage());
+ fireEvent(failedDispatcher, evt);
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
exception = new Exception(t.getMessage());
1.8 +5 -1 xml-batik/sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
Index: SVGLoadEventDispatcher.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SVGLoadEventDispatcher.java 8 Aug 2003 11:39:24 -0000 1.7
+++ SVGLoadEventDispatcher.java 16 Sep 2003 01:12:52 -0000 1.8
@@ -152,6 +152,10 @@
} catch (Exception e) {
exception = e;
fireEvent(failedDispatcher, ev);
+ } catch (ThreadDeath td) {
+ exception = new Exception(td.getMessage());
+ fireEvent(failedDispatcher, ev);
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
exception = new Exception(t.getMessage());
1.19 +27 -9 xml-batik/sources/org/apache/batik/transcoder/image/PNGTranscoder.java
Index: PNGTranscoder.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/transcoder/image/PNGTranscoder.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- PNGTranscoder.java 8 Aug 2003 11:39:25 -0000 1.18
+++ PNGTranscoder.java 16 Sep 2003 01:12:53 -0000 1.19
@@ -161,15 +161,22 @@
(new int [] { 255, 255, 255 });
}
- // If they specify GAMMA key then use it otherwise don't
- // write a gAMA chunk, (default Gamma=2.2).
+ // If they specify GAMMA key with a value of '0' then omit
+ // gamma chunk. If they do not provide a GAMMA then just
+ // generate an sRGB chunk. Otherwise supress the sRGB chunk
+ // and just generate gamma and chroma chunks.
if (hints.containsKey(KEY_GAMMA)) {
- params.setGamma(((Float)hints.get(KEY_GAMMA)).floatValue());
- }
+ float gamma = ((Float)hints.get(KEY_GAMMA)).floatValue();
+ if (gamma > 0) {
+ params.setGamma(gamma);
+ }
+ params.setChromaticity(DEFAULT_CHROMA);
+ } else {
+ // We generally want an sRGB chunk and our encoding intent
+ // is perceptual
+ params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL);
+ }
- // We always want an sRGB chunk and Our encoding intent is
- // perceptual
- params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL);
float PixSzMM = userAgent.getPixelUnitToMillimeter();
// num Pixs in 1 Meter
@@ -207,12 +214,23 @@
* <TD VALIGN="TOP">No</TD></TR>
* <TR>
* <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
- * <TD VALIGN="TOP">Controls the gamma correction of the png image.</TD>
+ * <TD VALIGN="TOP">Controls the gamma correction of the png image.
+ * A value of zero for gamma disables the generation
+ * of a gamma chunk. No value or a value of 2.2
+ * also causes an sRGB chunk to be generated.</TD>
* </TR>
* </TABLE>
*/
public static final TranscodingHints.Key KEY_GAMMA
= new FloatKey();
+
+ /**
+ * The default Primary Chromaticities for sRGB imagery.
+ */
+ public static final float[] DEFAULT_CHROMA = {
+ 0.31270F, 0.329F, 0.64F, 0.33F, 0.3F, 0.6F, 0.15F, 0.06F
+ };
+
/**
* The color indexed image key to specify number of colors used in
1.5 +3 -1 xml-batik/sources/org/apache/batik/util/CleanerThread.java
Index: CleanerThread.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/CleanerThread.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CleanerThread.java 9 Aug 2003 16:58:41 -0000 1.4
+++ CleanerThread.java 16 Sep 2003 01:12:53 -0000 1.5
@@ -142,6 +142,8 @@
ReferenceCleared rc = (ReferenceCleared)ref;
rc.cleared();
}
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
}
1.3 +11 -1 xml-batik/sources/org/apache/batik/util/EventDispatcher.java
Index: EventDispatcher.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/EventDispatcher.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EventDispatcher.java 8 Aug 2003 11:39:26 -0000 1.2
+++ EventDispatcher.java 16 Sep 2003 01:12:53 -0000 1.3
@@ -85,6 +85,8 @@
} catch (InterruptedException e) {
// Assume they will get delivered????
// be nice to wait on List but how???
+ } catch (ThreadDeath td) {
+ throw td;
} catch (Throwable t) {
t.printStackTrace();
}
@@ -120,6 +122,7 @@
protected static void dispatchEvent(final Dispatcher dispatcher,
final Object [] ll,
final Object evt) {
+ ThreadDeath td = null;
try {
for (int i = 0; i < ll.length; i++) {
try {
@@ -130,14 +133,21 @@
ll[i] = null;
}
dispatcher.dispatch(l, evt);
+ } catch (ThreadDeath t) {
+ // Keep delivering messages but remember to throw later.
+ td = t;
} catch (Throwable t) {
t.printStackTrace();
}
}
+ } catch (ThreadDeath t) {
+ // Remember to throw later.
+ td = t;
} catch (Throwable t) {
if (ll[ll.length-1] != null)
dispatchEvent(dispatcher, ll, evt);
t.printStackTrace();
}
+ if (td != null) throw td;
}
}
1.13 +2 -2 xml-batik/sources/org/apache/batik/util/ParsedURLData.java
Index: ParsedURLData.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/ParsedURLData.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ParsedURLData.java 9 Aug 2003 16:58:41 -0000 1.12
+++ ParsedURLData.java 16 Sep 2003 01:12:53 -0000 1.13
@@ -104,7 +104,7 @@
is.mark(2);
is.read(data);
is.reset();
- } catch (Throwable t) {
+ } catch (Exception ex) {
is.reset();
return is;
}
1.14 +4 -1 xml-batik/sources/org/apache/batik/util/RunnableQueue.java
Index: RunnableQueue.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/RunnableQueue.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- RunnableQueue.java 8 Aug 2003 11:39:26 -0000 1.13
+++ RunnableQueue.java 16 Sep 2003 01:12:53 -0000 1.14
@@ -202,6 +202,9 @@
try {
rable.run();
+ } catch (ThreadDeath td) {
+ // Let it kill us...
+ throw td;
} catch (Throwable t) {
// Might be nice to notify someone directly.
// But this is more or less what Swing does.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org