Results 1 to 4 of 4
  1. #1
    RebellionX is offline Member
    Join Date
    May 2012
    Posts
    4
    Rep Power
    0

    Default Error Compiling "Orphaned Case"

    Heres the cmd:

    Java Code:
    src\server\model\players\PlayerSave.java:271: error: orphaned case
                                    case 20:
                                    ^
    src\server\model\players\PlayerSave.java:284: error: 'else' without 'if'
                                    }else if (line.equals("[ACCOUNT]")) {
    ReadMode = 1;
                                     ^
    src\server\model\players\PlayerSave.java:299: error: 'else' without 'if'
                                    } else {
                                      ^
    Next is the code this is bouncing off of:

    Java Code:
    case 20:
    					if (token.equals("stored")) {
    						p.storeditems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
    					}
    					break;
    
    				case 21:
    					 if (token.equals("occupy")) {
    						p.occupied[Integer.parseInt(token3[0])] = Boolean.parseBoolean(token3[1]);
    					} 
    					break;
    
    			} else {
    				} else if (line.equals("[ACCOUNT]")) {		ReadMode = 1;
    				} else if (line.equals("[CHARACTER]")) {	ReadMode = 2;
    				} else if (line.equals("[EQUIPMENT]")) {	ReadMode = 3;
    				} else if (line.equals("[LOOK]")) {		ReadMode = 4;
    				} else if (line.equals("[SKILLS]")) {		ReadMode = 5;
    				} else if (line.equals("[ITEMS]")) {		ReadMode = 6;
    				} else if (line.equals("[BANK]")) {		ReadMode = 7;
    				} else if (line.equals("[FRIENDS]")) {		ReadMode = 8;
    				} else if (line.equals("[SHOP]")) {		ReadMode = 10;
    				} else if (line.equals("[IGNORES]")) {		ReadMode = 9;
    				} else if (line.equals("[STORED]")) {		ReadMode = 20;
    				} else if (line.equals("[OCCUPY]")) {		ReadMode = 21;
    				} else if (line.equals("[SHOP]")) {		ReadMode = 10;
    				} else if (line.equals("[EOF]")) {		try { characterfile.close(); } catch(IOException ioexception) { } return 1;
    				}
    				} else {
    			
    		} try {
    				line = characterfile.readLine();
    
    			} catch(IOException ioexception1) { EndOfFile = true;
    		}
    		try { characterfile.close(); } catch(IOException ioexception) { }
    		return 13;
    	}
    Thanks for the help!

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,432
    Blog Entries
    7
    Rep Power
    20

    Default Re: Error Compiling "Orphaned Case"

    The logical structure of your program isn't correct; that case label is not part of a switch() statement although it migh look like it ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    RebellionX is offline Member
    Join Date
    May 2012
    Posts
    4
    Rep Power
    0

    Default Re: Error Compiling "Orphaned Case"

    What do you suggest I change than? I've fixed all of my other problems but this one is just bugging the heck out of my.
    Re: Error Compiling "Orphaned Case"
    The logical structure of your program isn't correct; that case label is not part of a switch() statement although it migh look like it ...

    kind regards,

    Jos

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,432
    Blog Entries
    7
    Rep Power
    20

    Default Re: Error Compiling "Orphaned Case"

    Quote Originally Posted by RebellionX View Post
    What do you suggest I change than? I've fixed all of my other problems but this one is just bugging the heck out of my.
    If you can't see what you've done in your own code anymore, the control flow structure of it is too complicated and too convoluted; again: check all your curly brackets.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Compiling probem "cannot find symbol"
    By thegluups in forum New To Java
    Replies: 27
    Last Post: 01-18-2010, 08:53 PM
  2. Replies: 1
    Last Post: 11-20-2009, 07:58 PM
  3. Simple "if" statement problem....compiling error.
    By CYANiDE in forum New To Java
    Replies: 4
    Last Post: 10-14-2009, 09:56 PM
  4. Replies: 1
    Last Post: 06-30-2009, 02:32 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •