Re: CleanerThread never terminates, causes leaks in webapp

2011-04-13 Thread tiwaris
I also have encountered this issue. This happens rarely. When I quit my java
app, it sill has not released the shell (the process is still running). I
then used jvisualvm to monitor all the running threads in my application and
noticed that Batik CleanerThread was still running.

I incorporated the patch. Will have to see if the issue reappears.


--
View this message in context: 
http://batik.2283329.n4.nabble.com/CleanerThread-never-terminates-causes-leaks-in-webapp-tp2978944p3445621.html
Sent from the Batik - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: SVGGraphics2D cannot reproduce gradients (Bug 42387)

2010-10-11 Thread tiwaris

Hello,

Thanks for your response.

I downloaded the 1.8pre build (dated October 6th, 2010).

http://people.apache.org/builds/xml-batik/batik-src-10-10-06.zip

I created a test case to demonstrate my problem.

Here is the source code.


public class TestSvg {


public static org.apache.batik.gvt.GraphicsNode getSvgIcon(java.net.URL
url) {
org.apache.batik.gvt.GraphicsNode svgIcon = null;
try {
String xmlParser =
org.apache.batik.util.XMLResourceDescriptor.getXMLParserClassName();
org.apache.batik.dom.svg.SAXSVGDocumentFactory df = new
org.apache.batik.dom.svg.SAXSVGDocumentFactory(
xmlParser);
org.w3c.dom.svg.SVGDocument doc = 
df.createSVGDocument(url.toString());
org.apache.batik.bridge.UserAgent userAgent = new
org.apache.batik.bridge.UserAgentAdapter();
org.apache.batik.bridge.DocumentLoader loader = new
org.apache.batik.bridge.DocumentLoader(userAgent);
org.apache.batik.bridge.BridgeContext ctx = new
org.apache.batik.bridge.BridgeContext(userAgent, loader);

ctx.setDynamicState(org.apache.batik.bridge.BridgeContext.DYNAMIC);
org.apache.batik.bridge.GVTBuilder builder = new
org.apache.batik.bridge.GVTBuilder();
svgIcon = builder.build(ctx, doc);
} catch (Exception excp) {
svgIcon = null;
excp.printStackTrace();
}
return svgIcon;
}


public static void paintSvgIcon(java.awt.Graphics2D g,
org.apache.batik.gvt.GraphicsNode svgIcon, int x, int y,
double scaleX, double scaleY) {
java.awt.geom.AffineTransform transform = new
java.awt.geom.AffineTransform(scaleX, 0.0, 0.0, scaleY, x, y);
svgIcon.setTransform(transform);
svgIcon.paint(g);
}


public static org.apache.batik.svggen.SVGGraphics2D getSvgPainter() {
org.w3c.dom.DOMImplementation impl =
org.apache.batik.dom.GenericDOMImplementation.getDOMImplementation();
String svgNS = http://www.w3.org/2000/svg;;
org.w3c.dom.Document document = impl.createDocument(svgNS, 
svg, null);
org.apache.batik.svggen.SVGGeneratorContext ctx =
org.apache.batik.svggen.SVGGeneratorContext.createDefault(
document);
ctx.setComment(SVG Test);
ctx.setEmbeddedFontsOn(true);

org.apache.batik.svggen.SVGGraphics2D g2D = new
org.apache.batik.svggen.SVGGraphics2D(ctx, true);
g2D.addRenderingHints(new
java.awt.RenderingHints(java.awt.RenderingHints.KEY_ANTIALIASING,
java.awt.RenderingHints.VALUE_ANTIALIAS_ON));

g2D.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
return g2D;
}


public static String
getSvgFileAsString(org.apache.batik.svggen.SVGGraphics2D svgPainter) {
boolean useCSS = true;
java.io.StringWriter writer = new java.io.StringWriter(10);
try {
svgPainter.stream(writer, useCSS);
} catch (org.apache.batik.svggen.SVGGraphics2DIOException excp) 
{
System.err.println(Could not write SVG);
System.err.println(excp);
return null;
}
return writer.toString();
}


public static void main(String[] args) {
java.net.URL url = 
TestSvg.class.getResource(Process-stop.svg);
final org.apache.batik.gvt.GraphicsNode icon = getSvgIcon(url);

//Show the graphics on screen
javax.swing.JFrame frame = new javax.swing.JFrame(SVG);

frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
javax.swing.JPanel panel = new javax.swing.JPanel() {


public void paintComponent(java.awt.Graphics g) {
java.awt.Graphics2D g2D = 
(java.awt.Graphics2D)g;
paintSvgIcon(g2D, icon, 50, 50, 1.0, 1.0);
}


};
frame.getContentPane().add(panel);
frame.setSize(150,150);
frame.setVisible(true);

//Save the graphics to a file
org.apache.batik.svggen.SVGGraphics2D painter = getSvgPainter();
painter.setSVGCanvasSize(new 
java.awt.Dimension(frame.getWidth(),
frame.getHeight()));
frame.paint(painter);
String fileContents = getSvgFileAsString(painter);
try {
 

SVGGraphics2D cannot reproduce gradients (Bug 42387)

2010-10-08 Thread tiwaris

I am facing the exact same problem as described in Bug 42387.

https://issues.apache.org/bugzilla/show_bug.cgi?id=42387


This is what I am doing in my application.

I am drawing my model which contains SVG icons. Now I want to add the
functionality to store a snapshot of my model as SVG file. This amounts to
Rendering a GraphicsNode object onto SVGGraphics2D. Th gradients are
painted black in my model.

This bug is marked resolved as of 2007. I am using Batik 1.7, but am still
seeing this bug. 

Any ideas/helpful suggestions?

-- 
View this message in context: 
http://old.nabble.com/SVGGraphics2D-cannot-reproduce-gradients-%28Bug-42387%29-tp29919162p29919162.html
Sent from the Batik - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org