-2

I am getting output in string format then I split it and want to do further processing, here is my code snippet,

if(str != null && !str.isEmpty()){

String[] splitLine = str.split("~");

String splitData[];
    int i=0;
    for( i=0;i<splitLine.length;i++){

        splitData = splitLine[i].split("#");

        if(Long.parseLong(splitData[0]) == oid)
            isParent = true;
            break;
    }
}

But, the problem is that I am unable to get length of splitLine String array and also eclipse shows a warning as a dead code for i++ inside for loop, I am cant able to understand why this happen does anybody have idea about it.

davidxxx
  • 115,998
  • 20
  • 192
  • 199
Abhijeet Kale
  • 321
  • 3
  • 13

1 Answers1

3

The break is the problem. It belongs to the preceeding if but that has no curly braces. Change it to this:

if(Long.parseLong(splitData[0]) == oid) {
    isParent = true;
    break;
}
Quagaar
  • 1,237
  • 9
  • 19