When creating 3D cylinders via the three-parameter constructor, the last value defines a custom mesh granularity.
int meshdiv = Integer.MAX_VALUE / div ;
Cylinder cylinder = new Cylinder(10,10,meshdiv);
During the subsequent mesh creation is no further check whether this value can cause overflows or oversized allocations.
Hence we can observe:
a) div = 1
Exception in thread "JavaFX Application Thread" java.lang.NegativeArraySizeException: -24
at javafx.graphics@25-metal/javafx.scene.shape.Cylinder.createMesh(Cylinder.java:416)
...
or
b) div = 64
Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3591)
at javafx.base@25-metal/com.sun.javafx.collections.ObservableIntegerArrayImpl.ensureCapacity(ObservableIntegerArrayImpl.java:254)
...
int meshdiv = Integer.MAX_VALUE / div ;
Cylinder cylinder = new Cylinder(10,10,meshdiv);
During the subsequent mesh creation is no further check whether this value can cause overflows or oversized allocations.
Hence we can observe:
a) div = 1
Exception in thread "JavaFX Application Thread" java.lang.NegativeArraySizeException: -24
at javafx.graphics@25-metal/javafx.scene.shape.Cylinder.createMesh(Cylinder.java:416)
...
or
b) div = 64
Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3591)
at javafx.base@25-metal/com.sun.javafx.collections.ObservableIntegerArrayImpl.ensureCapacity(ObservableIntegerArrayImpl.java:254)
...