Skip to content

Commit

Permalink
Runtime initialization of classes holding java.awt.color.ICC_ColorSpa…
Browse files Browse the repository at this point in the history
…ce instances
  • Loading branch information
zakkak committed Nov 18, 2020
1 parent a13443c commit cf3f394
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceDirectoryBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.tika.TikaParseException;
import io.quarkus.tika.runtime.TikaConfiguration;
Expand Down Expand Up @@ -68,10 +69,17 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(Feature.TIKA);
}

@BuildStep
public void registerRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> resource) {
//org.apache.tika.parser.pdf.PDFParser (https://issues.apache.org/jira/browse/PDFBOX-4548)
resource.produce(new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.font.PDType1Font"));
@BuildStep(onlyIf = NativeBuild.class)
List<RuntimeInitializedClassBuildItem> runtimeInitImageIOClasses() {
return Arrays.asList(
//org.apache.tika.parser.pdf.PDFParser (https://issues.apache.org/jira/browse/PDFBOX-4548)
new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.font.PDType1Font"),
// The following classes hold instances of java.awt.color.ICC_ColorSpace that are not allowed in the image
// heap as this class should be initialized at image runtime
new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.PDDocument"),
new RuntimeInitializedClassBuildItem("org.apache.pdfbox.rendering.SoftMask"),
new RuntimeInitializedClassBuildItem(
"org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace"));
}

@BuildStep
Expand Down

0 comments on commit cf3f394

Please sign in to comment.