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: [EMAIL PROTECTED]


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.

Reply via email to