How can I fix the following exception java.lang.ArrayIndexOutOfoundsExcpetion. Exception and the source code are given below.
Exception:
java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 1 at String s[] = data.split(",");
Source code:
for (String data : temp) {
String s[] = data.split(",");
if (data.startsWith("AppM")) {
application.addAppModule(s[1], Integer.parseInt(s[2]), Integer.parseInt(s[3]));
} else if (data.startsWith("TUPLE")) {
application.addTupleMapping(s[1], s[2], s[3], new FractionalSelectivity(1.0));
AppLoop loop = new AppLoop(new ArrayList<String>(){{add(s[2]);add(s[1]);add(s[3]);}});
loops.add(loop);
} else {
String[] ss = s[3].split("\\*");
application.addAppEdge(s[0], s[1], Double.parseDouble(s[2]),
(Double.parseDouble(ss[0])*(Double.parseDouble(ss[1]))), s[4],
checkTupleDirection(s[5]), checkAppEdgeDirection(s[6]));
}
}
How can I fix this error?