[ https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616452#comment-14616452 ]
MH edited comment on FOP-2495 at 7/7/15 10:05 AM: -------------------------------------------------- The missing foUserAgent.setBaseURL() (or setBaseURI()) is a major problem! Even calling it on the factory builder: fopFactoryBuilder.setBaseURI(uriBase); //since FOP 2.0 is not enough: "IllegalStateException: The final FOP Factory configuration has already been built" I have to setup complete FOP for each single document just to change the base URI to get things working: ----------------------- /** * Set current base directory. * * @param defaultBase URI to default base directory (e.g. ".", "file:/K:/reports/xml/fonts/") * @param currentBase URI to current working directory (e.g. "file:///C:/Temp/"). * @param resolver Optional custom resolver. * @throws Exception on error. */ public final void setupFOP(final URI defaultBase, final URI currentBase, final ResourceResolver resolver) throws Exception { if (fopConfig != null) { if (resolver != null) { fopFactoryBuilder = new FopFactoryBuilder(defaultBase, resolver); } else { fopFactoryBuilder = new FopFactoryBuilder(defaultBase); } fopFactoryBuilder.setConfiguration(fopConfig); fopFactoryBuilder.setBaseURI(currentBase); //since FOP 2.0 //builder.setStrictFOValidation(false); fopFactory = fopFactoryBuilder.build(); } else { fopFactory = FopFactory.newInstance(currentBase); } foUserAgent = fopFactory.newFOUserAgent(); }//setupFOP() ------------------------------ ... only to replace FOP 1.0 foUserAgent.setBaseURL() ... just because someone thought that this is not really required ... :-( was (Author: mhilpert): The missing foUserAgent.setBaseURL() (or setBaseURI()) is a major problem! Even calling it on the factory builder: fopFactoryBuilder.setBaseURI(uriBase); //since FOP 2.0 is not enough: "IllegalStateException: The final FOP Factory configuration has already been built" I have to setup complete FOP for each single document to get things working: ----------------------- /** * Set current base directory. * * @param defaultBase URI to default base directory (e.g. ".", "file:/K:/reports/xml/fonts/") * @param currentBase URI to current working directory (e.g. "file:///C:/Temp/"). * @param resolver Optional custom resolver. * @throws Exception on error. */ public final void setupFOP(final URI defaultBase, final URI currentBase, final ResourceResolver resolver) throws Exception { if (fopConfig != null) { if (resolver != null) { fopFactoryBuilder = new FopFactoryBuilder(defaultBase, resolver); } else { fopFactoryBuilder = new FopFactoryBuilder(defaultBase); } fopFactoryBuilder.setConfiguration(fopConfig); fopFactoryBuilder.setBaseURI(currentBase); //since FOP 2.0 //builder.setStrictFOValidation(false); fopFactory = fopFactoryBuilder.build(); } else { fopFactory = FopFactory.newInstance(currentBase); } foUserAgent = fopFactory.newFOUserAgent(); }//setupFOP() ------------------------------ ... only to replace FOP 1.0 foUserAgent.setBaseURL() ... just because someone thought that this is not really required ... :-( > Embedding: missing migration documentation from FOP 1.x > ------------------------------------------------------- > > Key: FOP-2495 > URL: https://issues.apache.org/jira/browse/FOP-2495 > Project: FOP > Issue Type: Bug > Components: documentation > Affects Versions: 2.0 > Environment: WIndows, Java 8, FOP 1.0 > Reporter: MH > Priority: Blocker > Labels: documentation > > Because of bug FOP-2177 we couldn't upgrade form FOP 1.0 to FOP 1.1. FOP 2.0 > has solved this bug (tested with standalone FOP scripts). > Now we would like to upgrade our Java code from FOP 1.0 to FOP 2.0. The > Upgrading page (https://xmlgraphics.apache.org/fop/2.0/upgrading.html) says > "You should encounter very few issues in upgrading from FOP 1.0, except as > noted in the following: ...". The truth is completely different: starting by > replacing fop.jar, our code gets dozens of compiler errors! Many methods are > simply gone: > FopFactory.newInstance() > FoUserAgent.setBaseURL(String); > FopFactory.getFontManager().setFontBaseURL(String) > FopFactory.setURIResolver(URIResolver); > etc. > The javadocs from 1.1 to 2.0 simple changed - no deprecated methods, no hints > how to replace old methods. > The FOP 2.0 embedding page > (https://xmlgraphics.apache.org/fop/2.0/embedding.html) just shows simple > examples to start from the ground. I can't find any migration help how to > replace old code. > E.g. how can I set the font base? > FopFactory.getFontManager().setFontBaseURL(String) is gone and I can't find > any equivalent code for FOP 2.0! > This is a major bug in FOP 2.0 as API changes are not documented to upgrade > from FOP 1.x Java API to FOP 2.0! > Now I just can search and try and experiment if I get our old code somehow > running with all those undocumented API changes. Can you please state a > migration documentation for all methods (method signatures) that don't exist > anymore? We can't start coding all over again from scratch. Thank you very > much! -- This message was sent by Atlassian JIRA (v6.3.4#6332)