Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException why is this thrown? #317

Open
BrutalCSkakan opened this issue Dec 25, 2017 · 8 comments
Open

StringIndexOutOfBoundsException why is this thrown? #317

BrutalCSkakan opened this issue Dec 25, 2017 · 8 comments

Comments

@BrutalCSkakan
Copy link

BrutalCSkakan commented Dec 25, 2017

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1967)
	at com.github.koraktor.steamcondenser.steam.servers.GameServer.splitPlayerStatus(GameServer.java:115)
	at com.github.koraktor.steamcondenser.steam.servers.GameServer.updatePlayers(GameServer.java:547)
	at com.github.koraktor.steamcondenser.steam.servers.GameServer.getPlayers(GameServer.java:205)
	at Objects.GameMe.getAllServers(GameMe.java:181)
	at Helpers.OnlinePlayers.cachePlayers(OnlinePlayers.java:219)
	at Helpers.OnlinePlayers.run(OnlinePlayers.java:261)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)
@koraktor
Copy link
Owner

Please provide some context. How does your code look like? And probably more important, which servers are you trying to query?

@BrutalCSkakan
Copy link
Author

The issue is thrown when doing:
players = sourceServer.getPlayers(CONSTANTS.rcon);

CONSTANTS.rcon is a static string that's populated at start.

I'm trying to query all of my CSGO servers here: https://www.gametracker.com/search/?query=brutalcs&searchipp=50#search

Is the Java api more stable as a "socket application" rather than an application that connects, auths, fetches players, disconnects every 15 seconds? It feels like I'm always getting strange errors that shouldn't exist, so I'm probably doing something bad.

@koraktor
Copy link
Owner

CS:GO has a setting which limits the output of the players list. This setting is incompatible with getting the extended player info (i.e. getPlayers(rconPassword)).
Either you have to change this setting server-side (sorry I don’t know the CVAR name) or you call getPlayers() without the RCON password.

@Ejz85
Copy link

Ejz85 commented Jan 14, 2018

Are you talking about:

host_name_store 1
host_info_show 2
host_players_show 2

They are correct set if so.

@koraktor
Copy link
Owner

@BrutalCSEjziponken @BrutalCSkakan Sorry, for late response. What’s the output of status when issued on the server directly?

@Ejz85
Copy link

Ejz85 commented Jan 31, 2018

     10:12:23 hostname: BrutalCS.nu CSDM FFA #02 | D2 | Powered by ASUS
     version : 1.36.2.4/13624 649/6974 secure  [G:1:10764] 
     udp/ip  : 178.236.67.7:27015  (public ip: 178.236.67.7)
     os      :  Linux
     type    :  community dedicated
     map     : de_dust2
     players : 16 humans, 0 bots (16/0 max) (not hibernating)
     
     # userid name uniqueid connected ping loss state rate adr
     # 185 1 "ToL" STEAM_1:1:68552240 21:51 53 0 active 196608 84.249.1.195:27005
     # 219 2 "Specializer_tv" STEAM_1:0:10767588 01:18 31 0 active 196608 217.215.36.228:60790
     # 212 3 "Player" STEAM_1:0:138478307 06:09 33 0 active 196608 217.195.48.208:27005
     # 202 4 "bacon" STEAM_1:0:88103218 09:32 37 0 active 196608 178.75.163.174:27005
     # 192 5 "LDLD" STEAM_1:1:20883083 14:14 42 0 active 196608 84.249.227.168:27005
     # 205 6 "Mete?" STEAM_1:0:51571895 07:44 44 0 active 196608 91.158.44.172:27005
     # 214 8 "hesus" STEAM_1:0:19881865 04:12 44 0 active 307200 80.222.41.206:27005
     # 186 9 "shangrelama" STEAM_1:0:313672 21:41 34 0 active 786432 84.50.49.168:27005
     # 204 10 "adr" STEAM_1:0:104608696 08:30 71 0 active 786432 31.8.142.85:27005
     # 191 11 "JPSHA88" STEAM_1:0:119137579 15:14 54 0 active 196608 87.93.135.40:27005
     # 189 12 "Kiltz" STEAM_1:0:86212652 19:30 69 0 active 786432 89.250.174.197:2460
     # 184 13 "furi0z" STEAM_1:1:33683014 22:24 95 0 active 196608 193.77.58.64:27005
     # 209 15 "the boat" STEAM_1:0:22798961 07:23 86 0 active 700000 109.127.52.74:27005
     # 195 16 "wd4" STEAM_1:1:208291424 13:43 42 0 active 196608 79.132.165.140:27005
     # 196 17 "rysered" STEAM_1:1:127498064 13:32 113 0 active 196608 77.136.16.208:27005
     # 218 18 "D?yz '" STEAM_1:0:419706971 02:09 112 0 active 196608 86.95.154.101:27005
     #end

@koraktor
Copy link
Owner

koraktor commented Feb 1, 2018

@BrutalCSEjziponken Is the error always occuring or is it intermittently failing?

The output you’ve given is correctly parsed by GameServer#updatePlayers. 😕

@koraktor
Copy link
Owner

@BrutalCSEjziponken Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants