Java 8 (no really :)) bugs

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Java 8 (no really :)) bugs

Post by aliasmask »

Jagged wrote:ALL the third party suppliers I deal with who produce java apps do exactly what you suggest and bundle a jre.
THIS would be the best solution in my opinion.

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

I don't know where to get the launcher source, so I took the changed maptool jar, stuck it into wolph's b90 zip, and uploaded it here: https://dl.dropboxusercontent.com/u/236 ... 0-beta.zip

This was built from the current b90 source on SVN, with the one change that's in the patch file I linked on page 1 of this thread: Pull the deletion out of the loop that steps through the enumeration, thus avoiding a Java 8 stack trace.

@wolph, would you give this a whirl and see whether you feel comfortable putting this out as the go-to b90 build?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Java 8 (no really :)) bugs

Post by wolph42 »

Do I gather it correctly that you replaced the maptool-1.3b90.jar for a 'new' one in that zip. Is that the only change?

Could you additionally give a short description, what it is you exactly fixed. I've read the entire thread again, but my java knowledge is void and I cannot think any better description than 'better compatible with j8'.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Java 8 (no really :)) bugs

Post by RPTroll »

aliasmask wrote:
Jagged wrote:ALL the third party suppliers I deal with who produce java apps do exactly what you suggest and bundle a jre.
THIS would be the best solution in my opinion.
You know, that makes a lot of sense. It would sure cut down on testing and help with stability.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

@wolph, that is correct. I replaced the maptool jar file in the ZIP and left everything else as-is.

In plain English, I made a small change to avoid a Java 8 stack trace.

Previously, the code would step through a list of things (in Java lingo, an "enumeration"), then inside that loop, remove entries from that list of things. This is a no-no in any Java version, and Java 8 finally died on it.

Now, the code steps through a list of things, makes a note of the entries to be removed (all of them, incidentally :), then deletes the entries once the code execution is outside the initial loop.

It's replacing 1 line of code with 5 lines of code, plus another 3 lines to import the Java constructs needed to make this work. In "patch" form, it looks like this:

Code: Select all

--- src/net/rptools/maptool/client/ui/htmlframe/HTMLPane.java	(revision 5987)
+++ src/net/rptools/maptool/client/ui/htmlframe/HTMLPane.java	(working copy)
@@ -19,6 +19,9 @@
 import java.util.Enumeration;
 import java.util.Stack;
 import java.util.regex.Matcher;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
 
 import javax.swing.JEditorPane;
 import javax.swing.ToolTipManager;
@@ -161,8 +164,14 @@
 		try {
 			super.setText("");
 			Enumeration<?> snames = style.getStyleNames();
+			List<String> stylenames = new ArrayList<String>();
 			while (snames.hasMoreElements()) {
-				style.removeStyle(snames.nextElement().toString());
+				// The below bombs out in Java 8. 
+				// style.removeStyle(snames.nextElement().toString());
+				stylenames.add(snames.nextElement().toString());
+			}
+			for(Iterator<String> stylesIter = stylenames.iterator(); stylesIter.hasNext();) {
+				style.removeStyle(stylesIter.next());
 			}
 			style.addRule("body { font-family: sans-serif; font-size: " + AppPreferences.getFontSize() + "pt; background: #ECE9D8}");
 			style.addRule("div {margin-bottom: 5px}");

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

I just saw that there is already an available patch for the json.sort issue, which Lee wrote (http://forums.rptools.net/viewtopic.php ... 5&start=60). So, wolph, what do you think - hold off on calling my patch a b90-beta build, and look at what other patches are available but had not been applied to trunk yet, then call that a b90-beta?

RPTroll, good to see you popping in here. Do you know where the launcher repository is? I can build maptool, but it errors out after creating the maptool zip because I don't have the launcher source. That's why I just stuck the created jar into wolph's b90-beta ZIP.

wolph, other than json.sort, do you know whether any of the other issues tracked in that thread remain unresolved in the build you have? I see Lee submitted quite a few patches.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Java 8 (no really :)) bugs

Post by wolph42 »

yorick wrote:I just saw that there is already an available patch for the json.sort issue, which Lee wrote (http://forums.rptools.net/viewtopic.php ... 5&start=60). So, wolph, what do you think - hold off on calling my patch a b90-beta build, and look at what other patches are available but had not been applied to trunk yet, then call that a b90-beta?

RPTroll, good to see you popping in here. Do you know where the launcher repository is? I can build maptool, but it errors out after creating the maptool zip because I don't have the launcher source. That's why I just stuck the created jar into wolph's b90-beta ZIP.

wolph, other than json.sort, do you know whether any of the other issues tracked in that thread remain unresolved in the build you have? I see Lee submitted quite a few patches.
everything red in that thread is unresolved. Patches have not been committed as you said. It would be great if you could apply them. I'll add it to the current zip so user can choose which to use.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Java 8 (no really :)) bugs

Post by RPTroll »

yorick wrote:RPTroll, good to see you popping in here. Do you know where the launcher repository is? I can build maptool, but it errors out after creating the maptool zip because I don't have the launcher source. That's why I just stuck the created jar into wolph's b90-beta ZIP.
I do not. I'm not one of the devleopers. Hopefully one of them will read the post and let you know the location.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

@wolph, I've merged the patches that Lee had created but that weren't already on trunk. The file on dropbox has been updated with a new maptool jar that has those fixes.

This stuff needs testing before it's let loose on players! The cone light, the lib tokens, all of it.

Your bug tracking thread is great. To make it even greater, I'd love it if it were just a tracking thread, with each bug having its own discussion thread. It can be really hard to follow along after the fact to see whether and how a bug in that list was fixed.
On the other hand, Mote is coming along, so this may be moot. Applying what has been fixed already is good enough for now.

Issue 9 and 17 appear to be duplicates? Unless I'm missing something.

I didn't touch any of the red, open issues. I'm not trying to be Lee, I don't have the maptool / Java chops for that. Just aiming to make available the stuff Lee had already worked on.

Json.sort and array of objects, fix by Lee (issue 16): Had already been applied by devs to trunk
getStrProp and varsFromStrProp broken, fix by Lee (issue 5): Now applied to local copy that was used for this build
drawVBL failed if last polygon coordinates had an x or y of 0, fix by Lee (issue 7): Now applied to local copy that was used for this build
Cone light source lights up also 2 grid cells around the token, fix by Lee (official, not experimental fix, issue 9 and possibly also 17?, see http://forums.rptools.net/viewtopic.php ... 65#p235565): Now applied to local copy that was used for this build
By Lee: This patch makes it so library tokens that are invisible, owned by everyone, or have non-GM owners, do not execute their OCL macros. Testing needed. (issue 12): Now applied to local copy that was used for this build


yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

Did you have a chance to test the applied patches to make sure they work the way they're expected to?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Java 8 (no really :)) bugs

Post by wolph42 »

yorick wrote:Did you have a chance to test the applied patches to make sure they work the way they're expected to?
Nope.so I added it.to.the.existing and updated.the readme

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

Some more Java 8 testing may be in order. According to https://blogs.oracle.com/henrik/ , Java 8 will become the default on java.com before the end of 2014, and auto-migration of people will happen in the first half of 2015.

Given that there's only one more Oracle Critical Patch update scheduled for 2014, we may actually see Java 8 become default on or shortly after October 14th, when Java 8u40 is released.

I really want to avoid "last time" when MT didn't support Java 7 while Java 7 had already become the default version. I had hoped Mote would make the entire question moot, but that's been thrown into doubt, now ...

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Java 8 (no really :)) bugs

Post by wolph42 »

i know that mote (as it is) doesnt run in j8, but has anyone tested mt in j8. I did some small tests and didn't encounter anything then.

yorick
Cave Troll
Posts: 93
Joined: Tue Sep 25, 2012 8:05 am

Re: Java 8 (no really :)) bugs

Post by yorick »

I tested b91 against Java 8. Alas, the patch that's on the 1st page of this thread (July 4th post) didn't make it into b91. b91 will crash with Java 8 under the same conditions b89 did.

Oracle has just started replacing Java 7 on user's machines. The next Java CPU will be the last for Java 7. I'm not sure whether the devs are still around. A b91-HF1 may be in order, with just the small patch I created for Java 8 compatibility.

Post Reply

Return to “MapTool”