|
Pages: [1]
|
 |
|
Author
|
Topic: Bug report: level that does not load (Read 3398 times)
|
|
Rene
|
I have accidentally created a level that does not load: culixis. It is a normal level in the Warehouse (a solution to Glass Floor Vengeance - nubusix). I accidentally hit "return" too fast when I stored the level in the Warehouse, which caused it to be stored with "Anonymous" as designer. This may have something to do with it. I checked on http://kevan.org/rubicon/userlevels/warehouse/ and it is in the Warehouse (with no name for the designer). When trying to load it by clicking on the link, the Rubicon applet starts with a white screen, and does not do anything else. When loading it after starting Rubicon, the pop-up window is stuck on "Loading...". I am using Firefox 1.5.0.9 on Windows 2000. Java version is 1.5.0_02-b09
|
|
|
|
|
Logged
|
|
|
|
|
jnz
|
The applet assumes that all titles and designers are of non-zero length. When it tries to parse the file and it sees "* Designer:" with nothing following, it tries to parse this as an old-style level by splitting the string into two pieces using a second asterisk as a separator. Then, since there is no second asterisk on that line, it throws an ArrayIndexOutOfBounds exception when trying to access the second (and non-existant) element of the returned array. This exception then effectively halts the applet.
The warehouse.php should probably not allow a blank designer name. And the applet should either handle blank designers (just remove the length() > 11 check) or put in a sanity check to make sure that the array elements exist before accessing them. Hopefully Kevan can find a bit of time for this.
|
|
|
|
|
Logged
|
|
|
|
|
lienne
|
The applet assumes that all titles and designers are of non-zero length. When it tries to parse the file and it sees "* Designer:" with nothing following, it tries to parse this as an old-style level by splitting the string into two pieces using a second asterisk as a separator. Then, since there is no second asterisk on that line, it throws an ArrayIndexOutOfBounds exception when trying to access the second (and non-existant) element of the returned array. This exception then effectively halts the applet.
The warehouse.php should probably not allow a blank designer name. And the applet should either handle blank designers (just remove the length() > 11 check) or put in a sanity check to make sure that the array elements exist before accessing them. Hopefully Kevan can find a bit of time for this.
The easiest fix I can see is having the warehouse storage form automatically put "Anonymous" as the designer name unless the user changes it. We'll see.
|
|
|
|
|
Logged
|
|
|
|
|
Kevan
|
Fixed, and your level's accessible again.
|
|
|
|
|
Logged
|
|
|
|
|
Rene
|
Fixed, and your level's accessible again.
Thanks, Kevan! However, I have already stored a new version with correct designer name, so this level could be removed. Actually, there are a number of other levels in the warehouse that I would like to remove.
|
|
|
|
|
Logged
|
|
|
|
|
jnz
|
And the applet should either handle blank designers (just remove the length() > 11 check)
Turns out this was some bad advice on my part. I assumed that "".substring(0, 11) would return the empty string, but in fact it throws an exception. This means that we have more crashing levels when Follows is blank (see cyserut). Specifically, where the code looks like: if (load[i].length() > 8 && load[i].substring(0, 8).equals("* Title:")) sTitle = load[i].substring(8); else if (load[i].length() > 11 && load[i].substring(0, 11).equals("* Designer:")) sDesigner = load[i].substring(11); else if (load[i].substring(0, 11).equals("* Designer:")) sDesigner = "Anonymous"; else if (load[i].substring(0, 10).equals("* Follows:")) sFollows = load[i].substring(10); ... else if (load[i].length() > 7 && load[i].substring(0, 7).equals("* Type:")) sType = load[i].substring(7); else if (load[i].substring(0, 7).equals("* Type:")) sType = "Unknown"; else ...
it needs to be more like (untested): if (load[i].length() >= 8 && load[i].substring(0, 8).equals("* Title:")) sTitle = load[i].substring(8); else if (load[i].length() >= 11 && load[i].substring(0, 11).equals("* Designer:")) { sDesigner = load[i].substring(11); if (sDesigner.length() == 0) sDesigner = "Anonymous"; } else if (load[i].length() >= 10 && load[i].substring(0, 10).equals("* Follows:")) sFollows = load[i].substring(10); ... else if (load[i].length() >= 7 && load[i].substring(0, 7).equals("* Type:")) { sType = load[i].substring(7); if (sType.length() == 0) sType = "Unknown"; } else ...
Since this is a crashing bug I hope Kevan can fix it soon.
|
|
|
|
|
Logged
|
|
|
|
|
Kevan
|
My fault for not testing it, as well. It's fixed as of v1.26. Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |