Yes but its jumping out from the line 
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

So if I am stepping through the code, I hit that line, press F8 for step
over , and its on the finally 
So the code is jumping from that line all the way out missing all the other
lines and not getting caught even though I am trying to catch every
exception  (to try and debug this - not as a normal thing btw) 
With catch (Exception ex)


Kindest regards


Theresa Forster
Senior Software Developer

-----Original Message-----
From: Rob Sargent [mailto:rsarg...@xmission.com] 
Sent: 03 June 2011 18:07
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

That print statement will always be called since it's in the finally block.

On 06/03/2011 09:27 AM, Theresa Jayne Forster wrote:
> This makes no sense its crashing out with no error on this line
> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
> And it jumps straight to
>            System.out.print("*");
>
> The code I am using is as follows
>
> public File generatePDFFromXml(File xslFile,File xmlFile) {
>          FopFactory fopFactory = FopFactory.newInstance();
>          BufferedOutputStream out = null;
>          File tempFile = null;
>          try {
>              fopFactory.setStrictValidation(false);
>              DefaultConfigurationBuilder cfgBuilder = new
> DefaultConfigurationBuilder();
>              Configuration cfg = cfgBuilder.buildFromFile(new
> File("fopconfig.xml"));
>              fopFactory.setUserConfig(cfg);
>
>              tempFile = File.createTempFile("W2P", ".pdf");
>              out = new BufferedOutputStream(new
FileOutputStream(tempFile));
>              FOUserAgent useragent= fopFactory.newFOUserAgent();
>              useragent.setOutputFile(tempFile);
>              useragent.setTargetResolution(300);
>              Fop fop =
> fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
>              TransformerFactory factory =
TransformerFactory.newInstance();
>              Source xslt = new StreamSource(xslFile);
>              Transformer transformer = factory.newTransformer(xslt);
>              Source src = new StreamSource(xmlFile);
>              Result res = new SAXResult(fop.getDefaultHandler());
>              transformer.transform(src, res);
>             out.flush();
>             out.close();
>              System.out.println("Output File =
"+tempFile.getAbsolutePath());
>          }  catch (TransformerConfigurationException ex) {
>              ex.printStackTrace();
>          } catch (TransformerException ex) {
>              ex.printStackTrace();
>          } catch (FOPException ex) {
>              ex.printStackTrace();
>          } catch (FileNotFoundException ex) {
>              ex.printStackTrace();
>         } catch (IOException ex) {
>              ex.printStackTrace();
>          } catch (Exception ex) {
>              ex.printStackTrace();
>          } finally {
>              try {
>            System.out.print("*");
>                  out.close();
>             } catch (IOException ex) {
>              }
>          }
>          return tempFile;
>      }
>
> Kindest regards
>
>
> Theresa Forster
> Senior Software Developer
>
> ther...@inbrand.co.uk
> www.inbrand.co.uk
>
> Tel: 01483 266500
>
>
>
> IMPORTANT NOTE: This transmission has been sent by or on behalf of In
Brand
> Software Ltd. The information in this transmission is for the intended
> addressee only and is confidential to that intended addressee. If either
you
> know or you ought reasonably to conclude that you are not, or may not be,
> the intended addressee, you are hereby given notice that any unauthorised
> dissemination or copying of this transmission and any disclosure or use of
> the information
> transmitted is strictly prohibited and may be illegal. In such
circumstances
> we ask for your assistance in notifying us immediately by e-mail,
telephone
> or letter.
>
> InBrand Software Ltd Registered in England No. 5131004 Registered Office:
> The Old Barn, Ewhurst Road, Cranleigh GU6 7EF
>
>
> -----Original Message-----
> From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk]
> Sent: 03 June 2011 15:42
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: Hair ripping time
>
> Tried that same result, it jumps immediately out of the try catch into the
> finally....
>
> Kindest regards
>
>
> Theresa Forster
> Senior Software Developer
>
> Seems like you need:
>
> Transformer transformer = factory.newTransformer();
> transformer.transform(new StreamSource(inputFO));
>
>
> HTH!
>
> Regards
>
> Andreas
> ---
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
> Internal Virus Database is out of date.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
> Internal Virus Database is out of date.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>

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

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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

Reply via email to