You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Charles Duffy <ch...@dyfis.net> on 2019/11/18 00:20:09 UTC

ExceptionInInitializerError from LCMS / ICC Profile

Howdy --

I'm unable to initialize the PDDocument class in PDFBox 2.0.17, as it
throws an ExceptionInInitializerError from inside ICC_Profile code on first
reference.

I'm using AdoptOpenJDK 11.0.4, but also (to my great surprise!) reproduced
the problem using OpenJDK 1.8.0_222-ga (albeit still using LCMS).

To reproduce the issue, one can pull the code out of
the org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB initializer and
run it externally, as done below:

(import '[java.awt.color ColorSpace])
(let [cs (ColorSpace/getInstance ColorSpace/CS_sRGB),
      black (float-array [0 0 0 0])]
  (.toRGB cs black))

...which yields:

#error {
:cause nil
:via
[{:type java.lang.NullPointerException
  :message nil
  :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
1782]}]
:trace
[[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
 [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
 [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
 [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
 [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
 [user$eval2013 invokeStatic "NO_SOURCE_FILE" 1]
 [user$eval2013 invoke "NO_SOURCE_FILE" 1]

...matching the relevant subset of the full stack trace, as seen below:

user=> org.apache.pdfbox.pdmodel.PDDocument
CompilerException java.lang.ExceptionInInitializerError,
compiling:(/tmp/form-init3209311122715787650.clj:1:1418)

user=> *e
#error {
 :cause nil
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message "java.lang.ExceptionInInitializerError,
compiling:(/tmp/form-init3209311122715787650.clj:1:1418)"
   :at [clojure.lang.Compiler analyze "Compiler.java" 6792]}
  {:type java.lang.ExceptionInInitializerError
   :message nil
   :at [java.lang.Class forName0 "Class.java" -2]}
  {:type java.lang.NullPointerException
   :message nil
   :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
1782]}]
 :trace
 [[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
  [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
  [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
  [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
  [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
  [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB init
"PDDeviceRGB.java" 68]
  [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB toRGBImage
"PDDeviceRGB.java" 108]
  [org.apache.pdfbox.pdmodel.PDDocument <clinit> "PDDocument.java" 107]
  [java.lang.Class forName0 "Class.java" -2]
  [java.lang.Class forName "Class.java" 348]
  ;; ...snipped below here; generic Clojure REPL trace.



Any pointers?

Re: ExceptionInInitializerError from LCMS / ICC Profile

Posted by Charles Duffy <ch...@dyfis.net>.
To get a resolution on the record -- the issue is fixed in AdoptOpenJDK
11.0.5+10, if not before.

Thank you all for the time and support.

On Sun, Nov 17, 2019 at 6:20 PM Charles Duffy <ch...@dyfis.net> wrote:

> Howdy --
>
> I'm unable to initialize the PDDocument class in PDFBox 2.0.17, as it
> throws an ExceptionInInitializerError from inside ICC_Profile code on first
> reference.
>
> I'm using AdoptOpenJDK 11.0.4, but also (to my great surprise!) reproduced
> the problem using OpenJDK 1.8.0_222-ga (albeit still using LCMS).
>
> To reproduce the issue, one can pull the code out of
> the org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB initializer and
> run it externally, as done below:
>
> (import '[java.awt.color ColorSpace])
> (let [cs (ColorSpace/getInstance ColorSpace/CS_sRGB),
>       black (float-array [0 0 0 0])]
>   (.toRGB cs black))
>
> ...which yields:
>
> #error {
> :cause nil
> :via
> [{:type java.lang.NullPointerException
>   :message nil
>   :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
> 1782]}]
> :trace
> [[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
>  [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
>  [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
>  [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
>  [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
>  [user$eval2013 invokeStatic "NO_SOURCE_FILE" 1]
>  [user$eval2013 invoke "NO_SOURCE_FILE" 1]
>
> ...matching the relevant subset of the full stack trace, as seen below:
>
> user=> org.apache.pdfbox.pdmodel.PDDocument
> CompilerException java.lang.ExceptionInInitializerError,
> compiling:(/tmp/form-init3209311122715787650.clj:1:1418)
>
> user=> *e
> #error {
>  :cause nil
>  :via
>  [{:type clojure.lang.Compiler$CompilerException
>    :message "java.lang.ExceptionInInitializerError,
> compiling:(/tmp/form-init3209311122715787650.clj:1:1418)"
>    :at [clojure.lang.Compiler analyze "Compiler.java" 6792]}
>   {:type java.lang.ExceptionInInitializerError
>    :message nil
>    :at [java.lang.Class forName0 "Class.java" -2]}
>   {:type java.lang.NullPointerException
>    :message nil
>    :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
> 1782]}]
>  :trace
>  [[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
>   [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
>   [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
>   [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
>   [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
>   [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB init
> "PDDeviceRGB.java" 68]
>   [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB toRGBImage
> "PDDeviceRGB.java" 108]
>   [org.apache.pdfbox.pdmodel.PDDocument <clinit> "PDDocument.java" 107]
>   [java.lang.Class forName0 "Class.java" -2]
>   [java.lang.Class forName "Class.java" 348]
>   ;; ...snipped below here; generic Clojure REPL trace.
>
>
>
> Any pointers?
>

Re: ExceptionInInitializerError from LCMS / ICC Profile

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 18.11.2019 um 01:20 schrieb Charles Duffy:
> Howdy --
>
> I'm unable to initialize the PDDocument class in PDFBox 2.0.17, as it
> throws an ExceptionInInitializerError from inside ICC_Profile code on first
> reference.
>
> I'm using AdoptOpenJDK 11.0.4, but also (to my great surprise!) reproduced
> the problem using OpenJDK 1.8.0_222-ga (albeit still using LCMS).
>
> To reproduce the issue, one can pull the code out of
> the org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB initializer and
> run it externally, as done below:
>
> (import '[java.awt.color ColorSpace])
> (let [cs (ColorSpace/getInstance ColorSpace/CS_sRGB),
>        black (float-array [0 0 0 0])]
>    (.toRGB cs black))
>
> ...which yields:
>
> #error {
> :cause nil
> :via
> [{:type java.lang.NullPointerException


Does it also happen with Amazon Corretto? They are at 232 now.

Is my understanding correct that it happens without PDFBox now?

Maybe try some other operations on that colorspace before doing 
".toRGB()" so see if this avoids the error.

Tilman



>    :message nil
>    :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
> 1782]}]
> :trace
> [[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
>   [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
>   [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
>   [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
>   [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
>   [user$eval2013 invokeStatic "NO_SOURCE_FILE" 1]
>   [user$eval2013 invoke "NO_SOURCE_FILE" 1]
>
> ...matching the relevant subset of the full stack trace, as seen below:
>
> user=> org.apache.pdfbox.pdmodel.PDDocument
> CompilerException java.lang.ExceptionInInitializerError,
> compiling:(/tmp/form-init3209311122715787650.clj:1:1418)
>
> user=> *e
> #error {
>   :cause nil
>   :via
>   [{:type clojure.lang.Compiler$CompilerException
>     :message "java.lang.ExceptionInInitializerError,
> compiling:(/tmp/form-init3209311122715787650.clj:1:1418)"
>     :at [clojure.lang.Compiler analyze "Compiler.java" 6792]}
>    {:type java.lang.ExceptionInInitializerError
>     :message nil
>     :at [java.lang.Class forName0 "Class.java" -2]}
>    {:type java.lang.NullPointerException
>     :message nil
>     :at [java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java"
> 1782]}]
>   :trace
>   [[java.awt.color.ICC_Profile intFromBigEndian "ICC_Profile.java" 1782]
>    [java.awt.color.ICC_Profile getNumComponents "ICC_Profile.java" 1474]
>    [sun.java2d.cmm.lcms.LCMSTransform <init> "LCMSTransform.java" 98]
>    [sun.java2d.cmm.lcms.LCMS createTransform "LCMS.java" 173]
>    [java.awt.color.ICC_ColorSpace toRGB "ICC_ColorSpace.java" 178]
>    [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB init
> "PDDeviceRGB.java" 68]
>    [org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB toRGBImage
> "PDDeviceRGB.java" 108]
>    [org.apache.pdfbox.pdmodel.PDDocument <clinit> "PDDocument.java" 107]
>    [java.lang.Class forName0 "Class.java" -2]
>    [java.lang.Class forName "Class.java" 348]
>    ;; ...snipped below here; generic Clojure REPL trace.
>
>
>
> Any pointers?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org