I don't get any generated crash files nor a stack trace.

With your provided code it fails at the same spot 


           String parser = XMLResourceDescriptor.getXMLParserClassName();

            SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);  
//Fails here, Drops into a FINALLY statement in the application.

            String uri = image.getFilename();
            System.out.println(uri);
            File file = new File("myFile.svg");
            FileUtils.copyInputStreamToFile(image.getStream(), file);
            System.out.println("File saved");

            InputStream is = new BufferedInputStream(new FileInputStream(file));
            Document doc = f.createDocument(uri, is);
            is.close();

The code that calls it looks like

     try {
            setProgress(1);
            ship.mash();
        } catch (Exception ex) {
            StatusDisplayer.getDefault().setStatusText("Project verify 
failed!");
            LOGGER.log(Level.SEVERE, "\nVerify failed!\n");
            Exceptions.printStackTrace(ex);
        } finally {
        }
        return ship;

ship.mash() starts a long process of verifying the users information which in 
turn calls the SVG code. When the SVG code 'Fails' it falls into the finally 
statement.

Thanks
Mark

-----Original Message-----
From: Robert Marcano [mailto:[email protected]] 
Sent: Thursday, August 22, 2013 6:03 AM
To: [email protected]
Subject: Re: Problems loading an SVG file to Document

On 08/21/2013 06:17 PM, Mark Riley wrote:
> I can't seem to get it to generate a stack trace. It's being run in a thread 
> and the thread just dies.
>
> I put a break point at SAXSVGDocumentFactory and when I try to step 
> into it the thread dies. This code is surrounded by a try-catch so I'm 
> not too sure what's going on. Sorry, I know that info is not too 
> helpful. I just seem to lose the paper trail right at 
> SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
>
> Thanks,
> Mark


Ummm a crash instead of stack trace!

If it is a JVM crash check the directory where the application is running, you 
should find a crash dump file there. You can force a location with the JVM 
option  -XX:ErrorFile=path_to_file/java_error.log
or any file name you want, do not run it under a debugger and check for the 
generated file

try something like (this is a test no pretty code), lets see if you get printed 
if the contents if read and saved to a file, probably the crash happens reading 
the stream and not parsing it:

=========================
String parser = XMLResourceDescriptor.getXMLParserClassName();

SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);

String uri = image.getFilename();
System.out.println(uri);
File file = new File("myFile.svg");
FileUtils.copyTofile(image.getStream(), file); System.out.println("File saved");

InputStream is = new BufferedInputStream(new FileInputStream(file)); Document 
doc = f.createDocument(uri, is); is.close(); =========================


>
> -----Original Message-----
> From: Robert Marcano [mailto:[email protected]]
> Sent: Wednesday, August 21, 2013 3:35 PM
> To: [email protected]
> Subject: Re: Problems loading an SVG file to Document
>
> On 08/21/2013 12:27 PM, Mark Riley wrote:
>> Im using the code:
>>
>> String parser = XMLResourceDescriptor.getXMLParserClassName();
>>
>> SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
>>
>> Document doc = f.createDocument(image.getFilename(),
>> image.getStream());
>>
>> It seems parser returns null and my application crashes out.
>
> Can you copy the stacktrace, because it is normal for
> getXMLParserClassName() to returns null, the default parser is the JRE 
> included parser.
>
> See:
>
> http://svn.apache.org/viewvc/xmlgraphics/batik/tags/batik-1_7/sources/
> org/apache/batik/dom/util/SAXDocumentFactory.java?revision=608260&view
> =markup
>
> Line 404
>
>
>>
>> Thanks,
>>
>> Mark
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: 
> [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: 
> [email protected]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to