You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2008/01/11 06:17:04 UTC
DO NOT REPLY [Bug 44203] New: - Hyphenation file not found when HyphenationBaseURL is set on FopFactory
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44203>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44203
Summary: Hyphenation file not found when HyphenationBaseURL is
set on FopFactory
Product: Fop
Version: 0.94
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: general
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: dwhitlock@tripwire.com
I configured my FopFactory to locate Hyphenation files in a directory on my
local disk by invoking setHyphenationBaseURL() on my FopFactory with the
ExternalForm of a "file:" URL. However, the "Couldn't find hyphenation pattern
en" ERROR message is still being logged.
I did some debugging and I believe that there is a logic error in the
two-argument getUserHyphenationTree() method in Hyphenator.java. The
UnsupportedOperationException on line 261 is thrown even when the Source has a
valid InputStream (that is, when the value of "in" assigned on line 256 is not
null). The exception percolates up the call stack and the ERROR message is issued.
250 String name = key + ".hyp";
251 Source source = resolver.resolve(name);
252 if (source != null) {
253 try {
254 InputStream in = null;
255 if (source instanceof StreamSource) {
256 in = ((StreamSource) source).getInputStream();
257 }
258 if (in == null && source.getSystemId() != null) {
259 in = new
java.net.URL(source.getSystemId()).openStream();
260 } else {
261 throw new UnsupportedOperationException("Cannot load
hyphenation pattern file"
262 + " with the supplied Source object: " +
source);
263 }
264 in = new BufferedInputStream(in);
265 try {
266 hTree = readHyphenationTree(in);
267 } finally {
268 IOUtils.closeQuietly(in);
269 }
270 return hTree;
I can work around this behavior by registering my own HyphenationTreeResolver
which returns a Source with a null stream and a non-null system id.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
DO NOT REPLY [Bug 44203] - Hyphenation file not found when HyphenationBaseURL is set on FopFactory
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44203>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44203
adelmelle@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
------- Additional Comments From adelmelle@apache.org 2008-02-03 04:46 -------
Sorry for the late reply. There does indeed seem to be a slight error in there.
This would more correctly reflect the intention, I believe:
---
if (in == null) {
if (source.getSystemId() != null) {
in = new java.net.URL(source.getSystemId()).openStream();
} else {
throw new UnsupportedOperationException("Cannot load hyphenation pattern file"
+ " with the supplied Source object: " + source);
}
}
---
Can you confirm that this works without having to register a custom resolver? If so, I'll apply it to the trunk.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.