Feature/fop 2x compatibility#145
Open
sepe81 wants to merge 5 commits into
Open
Conversation
- Replace fop:1.1 with fop-core:2.11 in all poms - Remove Avalon framework dependencies (gone in FOP 2.x) - Rewrite AbstractFoMojo: replace loadFOPConfig() (Avalon-based) with createFopFactory() using FopConfParser / FopFactory.newInstance(URI, InputStream) - Remove FOUserAgent.setBaseURL() call (removed in FOP 2.x); use StreamSource.setSystemId() for base URI resolution instead - Delete AvalonMavenBridgeLogger (no longer needed) - Update DocbkxPdfMojoTest to test new createFopFactory() API - Upgrade maven-compiler-plugin 2.0.2->3.11.0 with source/target=8 (Java 11 rejects source/target=1.4) - Upgrade maven-plugin-plugin 3.2->3.9.0 (3.2 crashes with ArrayIndexOutOfBoundsException on Java 11)
Route both inline and external FOP configurations through FopConfParser with an explicit base URI, so that baseUrl (derived from the source DocBook XML's parent directory in adjustTransformer) is applied as the factory's base URI in both branches. Previously the external-config branch silently dropped baseUrl, causing FOP to resolve relative <fo:external-graphic src="..."/> URIs against the xconf's directory instead of the source XML directory — a regression vs the pre-2.x behaviour where FOUserAgent.setBaseURL(baseUrl) was set unconditionally. Specify StandardCharsets.UTF_8 when bridging the generated config XML through IOUtils.toInputStream(String) and InputStreamReader, instead of relying on Charset.defaultCharset(). On non-UTF-8 platforms (Windows CP1252) the deprecated no-charset overload mis-encodes any non-ASCII content in font family names or font file paths, breaking FOP's XML parser with MalformedByteSequenceException. Extract the StringTemplate config rendering into a package-private buildInlineConfig() so unit tests can assert that targetResolution and sourceResolution actually flow into the generated XML. The previous test suite only checked that createFopFactory() returned non-null, which would silently pass even if template.setAttribute() calls were removed entirely. Add: - testBuildInlineConfigDefaultsOmitResolutions: no stray <target-resolution> / <source-resolution> elements when unset. - testBuildInlineConfigPropagatesResolutions: configured resolutions appear in the generated XML. - testCreateFopFactoryAppliesBaseUrl: FOUserAgent.resolveURI() anchors relative URIs under the configured baseUrl, guarding against the regression described above. Loosen baseUrl visibility from private to package-private to allow the new behavioural test. Also guard against a NullPointerException when the fonts.stg classpath resource is missing.
…escriptor in descriptors element
…r.release property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates the PDF rendering pipeline from Apache FOP 1.1 (with its Avalon Framework dependency) to FOP 2.11.
Changes
fopartifact withfop-coreand removeavalon-framework-impldependencyFopFactory.newInstance()andDefaultConfigurationBuilder(Avalon) withFopConfParser/FopFactoryBuilder(FOP 2.x API)buildInlineConfig()(package-private) to isolate template rendering from factory creation and enable unit testingbaseUrlresolution behaviour: base URI is now passed directly toFopConfParserfor both inline and external config pathsStreamSource.systemIdon the FO input so FOP can resolve relative URIs within the documentAvalonMavenBridgeLogger(Avalon logging bridge no longer needed; FOP 2.x routes through Commons Logging → SLF4J)maven-compiler-pluginto 3.11.0 and bump source/target from 1.4 to 8Tests
Replaces Avalon-
Configuration-based assertions with direct tests against the new API surface:createFopFactory()andbuildInlineConfig(), including a regression test that verifies relative URI resolution against the configuredbaseUrl.