jfree / jfreesvg

A fast, lightweight Java library for creating Scalable Vector Graphics (SVG) output.
http://www.jfree.org/jfreesvg
GNU General Public License v3.0
319 stars 58 forks source link

Compiling with JDK11 #21

Closed qwert2003 closed 4 years ago

qwert2003 commented 5 years ago

When compiling the library jfreesvg with JDK11 I get the following error:

/[....]/org/jfree/graphics2d/svg/SVGGraphics2D.java:90: error: package javax.xml.bind is not visible
import javax.xml.bind.DatatypeConverter;
  (package javax.xml.bind is declared in module java.xml.bind, which is not in the module graph)

Others seem to have similar issues, e.g. https://github.com/tomdesair/tus-java-server/issues/14 (just found by searching). They say:

In JDK11 the javax.xml.bind package was removed. You use the javax.xml.bind.DatatypeConverter for Base64 encoding. Maybe you can replace this with java.util.Base64 from Java 8 or other implementation?

Not sure it is the same issue though. Any ideas?

jfree commented 4 years ago

Not sure why I never replied, but your suggestion was applied:

https://github.com/jfree/jfreesvg/commit/2e6cd5f8dde71e37704e4d786e3b64235326adaf

Will be included in the next release.

petebankhead commented 4 years ago

Hi, This is a great library, and great to see the update for JDK 11. For this commit, it looks to me that

this.sb.append(Base64.getEncoder().encode(getPNGBytes(img)));

should rather be

this.sb.append(Base64.getEncoder().encodeToString(getPNGBytes(img)));

Otherwise, I find the default String representation of the byte array is written within the image, i.e. something like [B@210dfa10 rather than the actual String.

jfree commented 4 years ago

You are correct. Fixing this now.