[jira] [Commented] (FOP-2893) hyph resources in jar should have unique names and should be in Maven central

2019-12-14 Thread Olivier Cailloux (Jira)


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

Olivier Cailloux commented on FOP-2893:
---

Partial workaround. I currently create a FopFactory in the following way.

final URL configUrl = 
DocBookUtils.class.getResource("fop-config.xml");
try (InputStream configStream = configUrl.openStream()) {
final FopFactory fopFactory;
try {
fopFactory = 
FopFactory.newInstance(Hyphenator.class.getResource(".").toURI(), configStream);
} catch (URISyntaxException | SAXException e) {
throw new IllegalStateException(e);
}
}

(Sorry, didn’t find how to format code properly.)

This allows me to put the hyphenation files in the org/apache/fop/hyphenation 
resource folder.

Not sure this is a best practice though.

> hyph resources in jar should have unique names and should be in Maven central
> -
>
> Key: FOP-2893
> URL: https://issues.apache.org/jira/browse/FOP-2893
> Project: FOP
>  Issue Type: Bug
>Reporter: Olivier Cailloux
>Priority: Minor
>
> Please consider adding the jar containing the hyphenation resources 
> ({{fop-hyph.jar}}) to Maven central, so that it can be easily added to a 
> third-party application using fop to build PDFs.
> Please also consider giving those resources [unique 
> names|https://github.com/oliviercailloux/java-course/blob/master/Best%20practices/Resources.adoc#use-unique-names]
>  to avoid conflicts and easily identify them. (This means the loader of those 
> resources should also be changed to make it look at the right places.)



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


[jira] [Commented] (FOP-2893) hyph resources in jar should have unique names and should be in Maven central

2019-12-13 Thread Olivier Cailloux (Jira)


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

Olivier Cailloux commented on FOP-2893:
---

Then this bug report is only about this request: the loader of the hyphenation 
resources should be changed to make it look at (something like) 
{{org.apache.fop.hyphenation}} and only then, if not found, {{hyph}}.

Benefits:
- when incorporating the hyph files to one’s own project (as I do, as the jar 
is not to be found in Maven central), they can be put in their proper folder, 
for clean sorting of files and for [unique 
naming|https://github.com/oliviercailloux/java-course/blob/master/Best%20practices/Resources.adoc#use-unique-names]
- if one day the hyph jar gets updated, the manager will be able to change the 
folder without anyone needing to change FOP source code to keep compatibility.

Means: 
>From a cursory look at the source code, it seems it should be sufficient to 
>change 
>[getResourceStream|https://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/hyphenation/Hyphenator.java?revision=1862365=markup#l110]
> and add {{Hyphenator.class.getResourceAsStream(key + ".hyp");}} at the right 
>place in order to also search into the {{org.apache.fop.hyphenation}} (that 
>is, the package name of {{Hyphenator}}) resource folder.

While we’re there, I suggest to change the reflection call in that same method, 
because I can’t find a reason for such a complex call. The code would be more 
readable if it would simply do: {{ClassLoader contextClassLoader = 
Thread.currentThread().getContextClassLoader();}}. Unless I missed some 
subtelty.

> hyph resources in jar should have unique names and should be in Maven central
> -
>
> Key: FOP-2893
> URL: https://issues.apache.org/jira/browse/FOP-2893
> Project: FOP
>  Issue Type: Bug
>Reporter: Olivier Cailloux
>Priority: Minor
>
> Please consider adding the jar containing the hyphenation resources 
> ({{fop-hyph.jar}}) to Maven central, so that it can be easily added to a 
> third-party application using fop to build PDFs.
> Please also consider giving those resources [unique 
> names|https://github.com/oliviercailloux/java-course/blob/master/Best%20practices/Resources.adoc#use-unique-names]
>  to avoid conflicts and easily identify them. (This means the loader of those 
> resources should also be changed to make it look at the right places.)



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


[jira] [Commented] (FOP-2893) hyph resources in jar should have unique names and should be in Maven central

2019-12-12 Thread Olivier Cailloux (Jira)


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

Olivier Cailloux commented on FOP-2893:
---

You are right. Thank you.

The [request|https://sourceforge.net/p/offo/bugs/] has been done three years 
ago (without the unique names request part), but unfortunately, nobody is alive 
there any more, it seems.

> hyph resources in jar should have unique names and should be in Maven central
> -
>
> Key: FOP-2893
> URL: https://issues.apache.org/jira/browse/FOP-2893
> Project: FOP
>  Issue Type: Bug
>Reporter: Olivier Cailloux
>Priority: Minor
>
> Please consider adding the jar containing the hyphenation resources 
> ({{fop-hyph.jar}}) to Maven central, so that it can be easily added to a 
> third-party application using fop to build PDFs.
> Please also consider giving those resources [unique 
> names|https://github.com/oliviercailloux/java-course/blob/master/Best%20practices/Resources.adoc#use-unique-names]
>  to avoid conflicts and easily identify them. (This means the loader of those 
> resources should also be changed to make it look at the right places.)



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


[jira] [Commented] (FOP-2893) hyph resources in jar should have unique names and should be in Maven central

2019-12-11 Thread Simon Steiner (Jira)


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

Simon Steiner commented on FOP-2893:


hyph jar is not owned by fop, its at http://offo.sourceforge.net/

> hyph resources in jar should have unique names and should be in Maven central
> -
>
> Key: FOP-2893
> URL: https://issues.apache.org/jira/browse/FOP-2893
> Project: FOP
>  Issue Type: Bug
>Reporter: Olivier Cailloux
>Priority: Minor
>
> Please consider adding the jar containing the hyphenation resources 
> ({{fop-hyph.jar}}) to Maven central, so that it can be easily added to a 
> third-party application using fop to build PDFs.
> Please also consider giving those resources [unique 
> names|https://github.com/oliviercailloux/java-course/blob/master/Best%20practices/Resources.adoc#use-unique-names]
>  to avoid conflicts and easily identify them. (This means the loader of those 
> resources should also be changed to make it look at the right places.)



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