Thread: java.lang.ArrayIndexOutOfBoundsException: 12

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 java.lang.ArrayIndexOutOfBoundsException: 12 
    Banned
    Join Date
    Sep 2015
    Posts
    113
    Thanks given
    8
    Thanks received
    3
    Rep Power
    0
    Hello rune-server, i saw this error shows every bit in my console and i dont know why, maybe cause when someone teleports or something. anyways can someone tell me why is this showing, im using ruse based simplicity.

    Code:
    java.lang.ArrayIndexOutOfBoundsException: 12
    	at com.ruseps.world.content.teleportation.Teleporting.openTab(Teleporting.java:220)
    	at com.ruseps.net.packet.impl.ButtonClickPacketListener.handleMessage(ButtonClickPacketListener.java:389)
    	at com.ruseps.net.PlayerSession.handleInputMessage(PlayerSession.java:112)
    	at com.ruseps.net.PlayerSession.handlePrioritizedMessageQueue(PlayerSession.java:91)
    	at com.ruseps.net.PlayerSession.handleQueuedMessages(PlayerSession.java:81)
    	at com.ruseps.engine.GameEngine.subcycle(GameEngine.java:77)
    	at com.ruseps.engine.GameEngine.run(GameEngine.java:60)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Reply With Quote  
     

  2. #2  
    Registered Member Mr. Snow's Avatar
    Join Date
    Feb 2015
    Age
    25
    Posts
    222
    Thanks given
    42
    Thanks received
    33
    Rep Power
    61
    This error means youre calling an array index that doesnt exist.

    So if I have a String array thats filled with two strings the length of the array is 2. Call anything more than 0 or 1 & this error is thrown.


    “On two occasions I have been asked, ‘Pray, Mr. Babbage, if
    you put into the machine wrong figures, will the right answers
    come out?’ […] I am not able rightly to apprehend the kind of
    confusion of ideas that could provoke such a question.”
    —Charles Babbage, Passages from the Life of a Philosopher
    (1864)
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Banned
    Join Date
    Sep 2015
    Posts
    113
    Thanks given
    8
    Thanks received
    3
    Rep Power
    0
    Quote Originally Posted by mushroom tip View Post
    This error means youre calling an array index that doesnt exisit.

    So if I have a String array thats filled with two strings the length of the array is 2. Call anything more than 0 or 1 & this error is thrown.
    uhm any idea how i can fix this?
    Reply With Quote  
     

  5. #4  
    Registered Member Mr. Snow's Avatar
    Join Date
    Feb 2015
    Age
    25
    Posts
    222
    Thanks given
    42
    Thanks received
    33
    Rep Power
    61
    Post the opentab method in teleporting


    “On two occasions I have been asked, ‘Pray, Mr. Babbage, if
    you put into the machine wrong figures, will the right answers
    come out?’ […] I am not able rightly to apprehend the kind of
    confusion of ideas that could provoke such a question.”
    —Charles Babbage, Passages from the Life of a Philosopher
    (1864)
    Reply With Quote  
     

  6. #5  
    Banned
    Join Date
    Sep 2015
    Posts
    113
    Thanks given
    8
    Thanks received
    3
    Rep Power
    0
    Quote Originally Posted by mushroom tip View Post
    Post the opentab method in teleporting
    Code:
    	/**
    	 * Opening a tab in the teleports interface.
    	 * @param client
    	 * 			player.opening the tab.
    	 * @param button
    	 * 			Tab id being opened.
    	 */
    	public static void openTab(Player player, int button) {
    		if (button == 236201 && player.getRights() == PlayerRights.PLAYER) {
    			player.sendMessage("You need to be a donator to access this tab.");
    			return;
    		}
    		for (int i = 0; i < TAB_IDS.length; i++) {
    			if (button == TAB_IDS[i]) {
    				player.lastClickedTab = i+1;
    				player.getPacketSender().sendInterface(INTERFACE_IDS[i]);
    			}
    		}
    		switch(player.lastClickedTab) {
    		case 1:
    			for (TeleportTraining.Training t : TeleportTraining.Training.values()) {
    				player.getPacketSender().sendTeleString(t.getTeleportName()[0], LINE_IDS[t.ordinal()][0]);
    				player.getPacketSender().sendTeleString(t.getTeleportName()[1], LINE_IDS[t.ordinal()][1]);
    			}
    			break;
    		case 2:
    			for (final TeleportMinigames.Minigames m : TeleportMinigames.Minigames.values()) {
    				player.getPacketSender().sendTeleString(m.getTeleportName()[0], LINE_IDS[m.ordinal()][0]);
    				player.getPacketSender().sendTeleString(m.getTeleportName()[1], LINE_IDS[m.ordinal()][1]);
    			}
    			break;
    		case 3:
    			for (final TeleportBosses.Bosses b : TeleportBosses.Bosses.values()) {
    				player.getPacketSender().sendTeleString(b.getTeleportName()[0], LINE_IDS[b.ordinal()][0]);
    				player.getPacketSender().sendTeleString(b.getTeleportName()[1], LINE_IDS[b.ordinal()][1]);
    			}
    			break;
    		case 4:
    			for (final TeleportPlayerKilling.PlayerKilling p : TeleportPlayerKilling.PlayerKilling.values()) {
    				player.getPacketSender().sendTeleString(p.getTeleportName()[0], LINE_IDS[p.ordinal()][0]);
    				player.getPacketSender().sendTeleString(p.getTeleportName()[1], LINE_IDS[p.ordinal()][1]);
    			}
    			break;
    		case 5:
    			for (final TeleportSkilling.Skilling s : TeleportSkilling.Skilling.values()) {
    				player.getPacketSender().sendTeleString(s.getTeleportName()[0], LINE_IDS[s.ordinal()][0]);
    				player.getPacketSender().sendTeleString(s.getTeleportName()[1], LINE_IDS[s.ordinal()][1]);
    			}
    			break;
    		case 6:
    			for (final TeleportDonator.Donator d : TeleportDonator.Donator.values()) {
    				player.getPacketSender().sendTeleString(d.getTeleportName()[0], LINE_IDS[d.ordinal()][0]);
    				player.getPacketSender().sendTeleString(d.getTeleportName()[1], LINE_IDS[d.ordinal()][1]);
    			}
    			break;
    		}
    	}
    Reply With Quote  
     

  7. #6  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    AS mention before your array is not big enough.
    It start at your Teleporting.java at line 220 (What the error message told you).


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  8. #7  
    Registered Member Mr. Snow's Avatar
    Join Date
    Feb 2015
    Age
    25
    Posts
    222
    Thanks given
    42
    Thanks received
    33
    Rep Power
    61
    Code:
    for (int i = 0; i < TAB_IDS.length; i++) {
    			if (button == TAB_IDS[i]) {
    				player.lastClickedTab = i+1;
    				player.getPacketSender().sendInterface(INTERFACE_IDS[i]);
    			}
    		}
    This is where your problem is most likely. Check INTERFACE_IDS & TABS_IDS.


    “On two occasions I have been asked, ‘Pray, Mr. Babbage, if
    you put into the machine wrong figures, will the right answers
    come out?’ […] I am not able rightly to apprehend the kind of
    confusion of ideas that could provoke such a question.”
    —Charles Babbage, Passages from the Life of a Philosopher
    (1864)
    Reply With Quote  
     

  9. Thankful users:


  10. #8  
    Banned
    Join Date
    Sep 2015
    Posts
    113
    Thanks given
    8
    Thanks received
    3
    Rep Power
    0
    Quote Originally Posted by mushroom tip View Post
    Code:
    for (int i = 0; i < TAB_IDS.length; i++) {
    			if (button == TAB_IDS[i]) {
    				player.lastClickedTab = i+1;
    				player.getPacketSender().sendInterface(INTERFACE_IDS[i]);
    			}
    		}
    This is where your problem is most likely. Check INTERFACE_IDS & TABS_IDS.
    this is the line where it shows the error :

    line 220 : player.getPacketSender().sendTeleString(b.getTelep ortName()[0], LINE_IDS[b.ordinal()][0]);
    Reply With Quote  
     

  11. #9  
    Registered Member Mr. Snow's Avatar
    Join Date
    Feb 2015
    Age
    25
    Posts
    222
    Thanks given
    42
    Thanks received
    33
    Rep Power
    61
    Quote Originally Posted by Ali_iq_ View Post
    ill post the whole errors
    Uhh nah. Dont do that. Just give me line 220...


    “On two occasions I have been asked, ‘Pray, Mr. Babbage, if
    you put into the machine wrong figures, will the right answers
    come out?’ […] I am not able rightly to apprehend the kind of
    confusion of ideas that could provoke such a question.”
    —Charles Babbage, Passages from the Life of a Philosopher
    (1864)
    Reply With Quote  
     

  12. Thankful users:


  13. #10  
    Banned
    Join Date
    Sep 2015
    Posts
    113
    Thanks given
    8
    Thanks received
    3
    Rep Power
    0
    Quote Originally Posted by Ali_iq_ View Post
    this is the line where it shows the error :

    line 220 : player.getPacketSender().sendTeleString(b.getTelep ortName()[0], LINE_IDS[b.ordinal()][0]);
    Here
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 2
    Last Post: 03-25-2014, 12:30 AM
  2. Replies: 2
    Last Post: 10-20-2012, 05:43 PM
  3. java.lang.ArrayIndexOutOfBoundsException: 7390
    By zhstyle1990 in forum Help
    Replies: 0
    Last Post: 09-18-2011, 10:54 PM
  4. Replies: 1
    Last Post: 12-09-2009, 03:30 AM
  5. java.lang.ArrayIndexOutOfBoundsException: 0
    By Pilldom in forum Projects
    Replies: 0
    Last Post: 11-27-2008, 04:10 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •