Rubicon Forum
Welcome, Guest. Please login or register.
October 25, 2014, 06:17:00 AM

Login with username, password and session length
Search:     Advanced search
Forum users can use the crate icon (or [level] and [/level] tags) when writing a post, to make a direct link to a level.
5463 Posts in 238 Topics by 2430 Members
Latest Member: Shreyas
* Home Help Search Login Register
+  Rubicon Forum
|-+  General
| |-+  Support (Moderator: Bucky)
| | |-+  Bug report: level that does not load
« previous next »
Pages: [1] Print
Author Topic: Bug report: level that does not load  (Read 6132 times)
Rene
Director
*****
Posts: 715


View Profile Email
Bug report: level that does not load
« on: January 04, 2007, 04:42:00 PM »


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
Director
*****
Posts: 493


View Profile
Re: Bug report: level that does not load
« Reply #1 on: January 04, 2007, 06:28:32 PM »

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
Designer
***
Posts: 34


View Profile
Re: Bug report: level that does not load
« Reply #2 on: January 04, 2007, 07:19:10 PM »

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
Administrator
Designer
*****
Posts: 86


View Profile WWW Email
Re: Bug report: level that does not load
« Reply #3 on: January 09, 2007, 12:32:51 PM »

Fixed, and your level's accessible again.
Logged
Rene
Director
*****
Posts: 715


View Profile Email
Re: Bug report: level that does not load
« Reply #4 on: January 12, 2007, 06:38:01 PM »

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
Director
*****
Posts: 493


View Profile
Re: Bug report: level that does not load
« Reply #5 on: January 16, 2007, 03:29:39 PM »

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:

Code:
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):

Code:
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
Administrator
Designer
*****
Posts: 86


View Profile WWW Email
Re: Bug report: level that does not load
« Reply #6 on: January 16, 2007, 03:55:57 PM »

My fault for not testing it, as well. It's fixed as of v1.26. Thanks.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.0.22 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!