hharrison / java3d-utils Goto Github PK
View Code? Open in Web Editor NEWFork of the java3d-utils package
License: Other
Fork of the java3d-utils package
License: Other
Hi!
In GeometryInfo.java we have the following code (lines 2014 to 2025)
// For stripped primitives, make sure we have strip counts
//
if ((prim == TRIANGLE_STRIP_ARRAY) ||
(prim == TRIANGLE_FAN_ARRAY) ||
(prim == POLYGON_ARRAY)) {
if (stripCounts == null) badData = true;
} else if (stripCounts != null) badData = true;
if (badData) {
throw new IllegalArgumentException(
J3dUtilsI18N.getString("GeometryInfo6"));
}
Please note that line 2020-2021 has a logic error, as it always set badData as true:
} else if (stripCounts != null) badData = true;
I guess second if should be the following:
} else if (stripCounts.length == 0) badData = true;
When writing an OrderedGroup that has its index array set to null, j3d throws:
java.lang.NullPointerException
at
com.sun.j3d.utils.scenegraph.io.state.javax.media.j3d.OrderedGroupState.writeObject(OrderedGroupState.java:63)
Not sure if this is a bug, as one can always set the array, but considering Null is a legit value regarding the official OrderedGroupState docs, it would be nice if OrderedGroupState could handle an empty index array.
psymagic commented 21 hours ago
After investigating a little further, it really seems like someone forgot to implement io for the case of OrderedGroup.getChildIndexOrder() == null.
Just did a working fix with these lines in com.sun.j3d.utils.scenegraph.io.state.javax.media.j3d.OrderedGroupState:
@OverRide
public void writeObject(DataOutput out) throws IOException {
super.writeObject(out);
int[] childIndexOrder = ((OrderedGroup) node).getChildIndexOrder();
if (childIndexOrder == null) {
out.writeInt(0);
} else {
out.writeInt(childIndexOrder.length);
for (int i = 0; i < childIndexOrder.length; i++) {
out.writeInt(childIndexOrder[i]);
}
}
}
@OverRide
public void readObject(DataInput in) throws IOException {
super.readObject(in);
int length = in.readInt();
int[] childIndexOrder;
if (length == 0) {
childIndexOrder = null;
} else {
childIndexOrder = new int[length];
for (int i = 0; i < childIndexOrder.length; i++) {
childIndexOrder[i] = in.readInt();
}
}
((OrderedGroup) node).setChildIndexOrder(childIndexOrder);
}
It might not be perfect thou.
Hi,
In our system we are using old version of library j3dutils(version 1.5) and we are reaching out to you to check Java 11 compatibility of yours library: java3d-utils.
Could you help us by answering the following questions:
If yes please give us information about your library: java3d-utils.
Appreciate your response by 06.09.2018.
Thanks,
Krzysztof Dragan,
PTC Inc. Contractor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.