[jira] [Commented] (FOP-2168) The ANT task "org.apache.fop.tools.anttasks.Fop" never throws a build exception

2019-12-16 Thread Dan Caprioara (Jira)


[ 
https://issues.apache.org/jira/browse/FOP-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16997083#comment-16997083
 ] 

Dan Caprioara commented on FOP-2168:


Any progress on this?

> The ANT task "org.apache.fop.tools.anttasks.Fop" never throws a build 
> exception
> ---
>
> Key: FOP-2168
> URL: https://issues.apache.org/jira/browse/FOP-2168
> Project: FOP
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: 
> Platform: PC
>Reporter: Radu Coravu
> Attachments: c1000-031-Exam-Dumps-NewYear-2019.pdf
>
>
> A concrete example, the DITA OT project uses a series of ANT build files to 
> publish DITA to PDF.
> The Apache FOP task "org.apache.fop.tools.anttasks.Fop" is used for this.
> If the task fails (for example the PDF is opened in another application or 
> the XSL-FO file has severe validation problems) it should throw an ANT 
> BuildException because there is no need to continue the entire ANT build as 
> if nothing happened.
> Instead, the method 
> "org.apache.fop.tools.anttasks.FOPTaskStarter.render(File, File, String)" 
> catches all exceptions and just logs them in the console.
> This means that it is possible that ANT finishes with a "Build succesfull" 
> message and in fact the PDF was not produced at all.
> Maybe you should add a "failonerror" attribute to the task and have it fail 
> by default when an error is encountered.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (FOP-2897) Out of memory when loading fonts on Mac - instead it should report font too large and continue

2019-12-16 Thread Dan Caprioara (Jira)


 [ 
https://issues.apache.org/jira/browse/FOP-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Caprioara updated FOP-2897:
---
Description: 
The FontInfoFinder class collects all the fonts from the system. On Mac there 
are huge font files containing icons. This makes FOP break with 
OutOfMemoryError.

Probably it should show an warning and throw an IOException instead of OOM 
(IOException does not break the entire processing, just skips the current font 
loading, in this way next fonts can be loaded).

There are two places in the FontInfoFinder class where the OOM should be 
catched:
{code:java}
 try {
   TTFFile ttf = new TTFFile(false, false);
   FontFileReader reader = new FontFileReader(in);
   ttcNames = ttf.getTTCnames(reader);
 } catch (OutOfMemoryError oom) {  
   handleOOM(fontURI);
 }
{code}
{code:java}
try {
   OFFontLoader ttfLoader = new OFFontLoader(fontURI, fontName, true,
EmbeddingMode.AUTO, 
EncodingMode.AUTO, useKerning, useAdvanced,
resourceResolver, false, false);
   customFont = ttfLoader.getFont();
   if (this.eventListener != null) {
  customFont.setEventListener(this.eventListener);
   }
} catch(OutOfMemoryError e) {
   handleOOM(fontURI);
}
{code}
And the handling:
{code:java}
private void handleOOM(URI fontURI) throws IOException {
String sizeMsg = "";
  if ("file".equals(fontURI.getScheme())) {
sizeMsg = "The font file size was: " + new 
File(fontURI).length() + " bytes";
  }
  throw new IOException(
"Font is too large. " + sizeMsg);
}
{code}

  was:
The FontInfoFinder class collects all the fonts from the system. On Mac there 
are huge font files containing icons. This makes FOP break with 
OutOfMemoryError.

Probably it should show an warning and throw an IOException instead of OOM. In 
this way next fonts can be loaded.

There are two places in the FontInfoFinder class where the OOM should be 
catched:
{code:java}
 try {
   TTFFile ttf = new TTFFile(false, false);
   FontFileReader reader = new FontFileReader(in);
   ttcNames = ttf.getTTCnames(reader);
 } catch (OutOfMemoryError oom) {  
   handleOOM(fontURI);
 }
{code}
{code:java}
try {
   OFFontLoader ttfLoader = new OFFontLoader(fontURI, fontName, true,
EmbeddingMode.AUTO, 
EncodingMode.AUTO, useKerning, useAdvanced,
resourceResolver, false, false);
   customFont = ttfLoader.getFont();
   if (this.eventListener != null) {
  customFont.setEventListener(this.eventListener);
   }
} catch(OutOfMemoryError e) {
   handleOOM(fontURI);
}
{code}
And the handling:
{code:java}
private void handleOOM(URI fontURI) throws IOException {
String sizeMsg = "";
  if ("file".equals(fontURI.getScheme())) {
sizeMsg = "The font file size was: " + new 
File(fontURI).length() + " bytes";
  }
  throw new IOException(
"Font is too large. " + sizeMsg);
}
{code}


> Out of memory when loading fonts on Mac - instead it should report font too 
> large and continue
> --
>
> Key: FOP-2897
> URL: https://issues.apache.org/jira/browse/FOP-2897
> Project: FOP
>  Issue Type: Bug
>Reporter: Dan Caprioara
>Priority: Major
> Fix For: 2.4
>
>
> The FontInfoFinder class collects all the fonts from the system. On Mac there 
> are huge font files containing icons. This makes FOP break with 
> OutOfMemoryError.
> Probably it should show an warning and throw an IOException instead of OOM 
> (IOException does not break the entire processing, just skips the current 
> font loading, in this way next fonts can be loaded).
> There are two places in the FontInfoFinder class where the OOM should be 
> catched:
> {code:java}
>  try {
>TTFFile ttf = new TTFFile(false, false);
>FontFileReader reader = new FontFileReader(in);
>ttcNames = ttf.getTTCnames(reader);
>  } catch (OutOfMemoryError oom) {  
>handleOOM(fontURI);
>  }
> {code}
> {code:java}
> try {
>OFFontLoader ttfLoader = new OFFontLoader(fontURI, fontName, true,
>   EmbeddingMode.AUTO, 
> EncodingMode.AUTO, useKerning, useAdvanced,
>   resourceResolver, false, false);
>customFont = ttfLoader.getFont();
>if (this.eventListener != null) {
>   customFont.setEventListener(this.eventListener);
>}
> } catch(OutOfMemoryError 

[jira] [Created] (FOP-2897) Out of memory when loading fonts on Mac - instead it should report font too large and continue

2019-12-16 Thread Dan Caprioara (Jira)
Dan Caprioara created FOP-2897:
--

 Summary: Out of memory when loading fonts on Mac - instead it 
should report font too large and continue
 Key: FOP-2897
 URL: https://issues.apache.org/jira/browse/FOP-2897
 Project: FOP
  Issue Type: Bug
Reporter: Dan Caprioara
 Fix For: 2.4


The FontInfoFinder class collects all the fonts from the system. On Mac there 
are huge font files containing icons. This makes FOP break with 
OutOfMemoryError.

Probably it should show an warning and throw an IOException instead of OOM. In 
this way next fonts can be loaded.

There are two places in the FontInfoFinder class where the OOM should be 
catched:
{code:java}
 try {
   TTFFile ttf = new TTFFile(false, false);
   FontFileReader reader = new FontFileReader(in);
   ttcNames = ttf.getTTCnames(reader);
 } catch (OutOfMemoryError oom) {  
   handleOOM(fontURI);
 }
{code}
{code:java}
try {
   OFFontLoader ttfLoader = new OFFontLoader(fontURI, fontName, true,
EmbeddingMode.AUTO, 
EncodingMode.AUTO, useKerning, useAdvanced,
resourceResolver, false, false);
   customFont = ttfLoader.getFont();
   if (this.eventListener != null) {
  customFont.setEventListener(this.eventListener);
   }
} catch(OutOfMemoryError e) {
   handleOOM(fontURI);
}
{code}
And the handling:
{code:java}
private void handleOOM(URI fontURI) throws IOException {
String sizeMsg = "";
  if ("file".equals(fontURI.getScheme())) {
sizeMsg = "The font file size was: " + new 
File(fontURI).length() + " bytes";
  }
  throw new IOException(
"Font is too large. " + sizeMsg);
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)