Gephi does not build on JDK 7

Bug #823543 reported by Luiz Ribeiro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gephi
Fix Released
Critical
Mathieu Bastian

Bug Description

Like the summary says, Gephi can't be built with JDK 7.

The problem is that PDF Exporter depends on the sun.font.FontManager class, which is an "internal proprietary API", according to the build log:

Compiling 3 source files to /home/luiz/projects/bzr/gephi/PreviewExport/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
Note: org.gephi.io.exporter.preview.ExporterBuilderPDF to be registered as a org.gephi.io.exporter.spi.VectorFileExporterBuilder
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:467: warning: FontManager is internal proprietary API and may be removed in a future release
                String fontName = FontManager.getFileNameForFontName(font.getFontName());
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:467: error: cannot find symbol
                String fontName = FontManager.getFileNameForFontName(font.getFontName());
  symbol: method getFileNameForFontName(String)
  location: interface FontManager
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:469: warning: FontManager is internal proprietary API and may be removed in a future release
                    String fontFilePath = FontManager.getFontPath(false);
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:469: error: cannot find symbol
                    String fontFilePath = FontManager.getFontPath(false);
  symbol: method getFontPath(boolean)
  location: interface FontManager
2 errors
6 warnings
/usr/share/netbeans/harness/common.xml:206: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)

If I comment the lines 467 to 472 from PDFExporter.java, everything builds just fine, so we just need to find an alternative to calling FontManager's getFileNameForFontName and getFontPath methods.

Revision history for this message
Mathieu Bastian (mathieu.bastian) wrote :

Is this the Oracle's JDK?

If yes they decided to remove that class so I will have to find another way to make fonts work in PDF export...

Revision history for this message
Luiz Ribeiro (luizribeiro) wrote :

Yes, this is Oracle's JDK.

I noticed that too. After searching for FontManager alternatives on the web, I couldn't find anything but the source code of FontManager.. The code for that API is released under the GPL, perhaps a [somewhat bloated] solution is to merge the necessary parts of it into the PDF Exporter.

Changed in gephi:
status: New → In Progress
importance: Undecided → Critical
Revision history for this message
Mathieu Bastian (mathieu.bastian) wrote :

Fixed in rev 2302.

Dependency to FontManager has been removed. Please test if the build succeed.

I also improved the font system using some of the iText features, doing the same as FontManager but better. The font used in preview is now embedded in the PDF correctly. If the font is Unicode, export Unicode tet should be working now. Please test on your system.

Changed in gephi:
status: In Progress → Fix Committed
assignee: nobody → Mathieu Bastian (mathieu.bastian)
Changed in gephi:
milestone: none → 0.8alpha
Revision history for this message
Luiz Ribeiro (luizribeiro) wrote :

Perfect! The build is working just fine once again. Thank you very much, Mathieu!

Changed in gephi:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.