This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This is from Windows XP so far. Have not tried on other platforms yet but there's a known issue 82394 on exporting to jpg on linux and solaris already. This one might be different than issue 82394 since it seems to happen on big uml project. - reverse engineered the UML core sources (2600+ classes) - created class diagram from a selection of around 50 classes (consist of classes, interfaces, derivation classifiers, packages) - export the diagram to jpg format Result: the jpg file has file size of zero - if exporting a smaller class diagram containing only a few classes (just to experiment) works fine Another experiment: I tried creating a new UML project. created a class diagram and manually creating 60 classes, 20 interfaces, 20 datatypes, a few derivation classifiers, a few packages, and different kind of links between every elements in the class diagram. So, the class diagram contains about 110 elements. Exporting to both jpg and svg works fine. Exporting to png file works fine too but it took about an hour to complete while it took just seconds to export to jpg and svg format.
Created attachment 37101 [details] experiment class diagram
Created attachment 37102 [details] experiment class diagram - png format
Created attachment 37103 [details] experiment class diagram - svg format
Attached are the diagrams in jpg, png, svg format exported for the experiment with the diagram containing 110 elements.
Png encoder performance was taken care of by fix to 91260. The remaining part of the bug is when generated image file size is 0 (for the reasons different from java.lang.ClassCastException: sun.awt.image.DataBufferNative mentioned in 82934) This failure to generated an image happens when size of the original image to be encoded causes request for the amount of memory that exceeds memory availaible inside the VM instance. It happens because the 3d party graph library used inside the UML module atempts to render whole image in memory before encoding it. In particular it means that 7000 pixels x 7000 pixels image would cause a request for an int[50M] buffer, ie. 200M piece of heap memory. The maximum possible image is more than 50Mpixels, yet even with Xmx1280 i wasn't always able to save 100Mpixels image. Thus, in order to fix this bug, as we can't change the behaviour of the library, i plan to implement an error dialog for this situation explicitly informing the user that the operation failed.
Fixed in release55 branch. Now when user tries to save as png/jpg/... a diagram with such resolution that JVM can't provide TS with an array to render the image into [ because of not sufficient heap memory available or because the requested array is beyond the Java array size limit - that happens pretty easy - 50Kpxls X 50Kpxls = 2.5Gpxs, where is Java array limit is (2^31 - 1) and even 0.5Gpxls would be a problem for 32bit JVM as each pixels requires an "int" ] the error dialog is shown informing the user about the error.
verified in build 070213_1. Now the error dialog pops up. The dialog has title "Cannot create image" and the message is "Java Heap space". The message should have been more informative.
The message comes from the exception that was caught. This minimalistic approach was modeled after similar error dialog that pops up when, for example, the file that image should be saved into isn't writtable. I suppose the documentation may be the place where the error messages and possible remedies/workarounds can be explained.
issue 96194 was opened to track the need to improve the message in the dialog box as a result of the fix to this issue.