da esse erro qndo tento usar essa classe
import java.io.IOException;
import java.util.ArrayList;
import SQLAda.SQLAdaJ;
public class Acesso_ao_gp {
public static void main (String[]args) throws Exception {
int conexao,retorno; // retorno de SAConnect
String comando; // recebe o comando a ser executado no GP
ArrayList <String> quebra1;
String s1; // String que será quebrado
SQLAdaJ sql = new SQLAdaJ();
conexao = sql.SAConnect("[telefone removido]","34839SALEXDATFLA2007","SALEX-D","10.3.10.1");
System.out.println(conexao);
comando = "SELECT A1 A2 FROM 001.062 WHERE SA =33683111" + "1";
retorno = sql.SACommand(conexao, comando);
System.out.println(retorno);
System.out.println(sql.strArea);
String areaTemp = sql.strArea;
areaTemp = areaTemp.substring(0,areaTemp.length()-1);
String index[] = areaTemp.split(",");
int indice[] = new int[(index.length/2)];
int j = 0;
for (int i = 1; i < index.length; i=i+2) {
indice[j++] = Integer.parseInt(index[i]);
}
retorno = sql.SAGetNext(conexao);
while(retorno >= 0) {
areaTemp = sql.strArea;
System.out.println(areaTemp);
quebralinha(areaTemp,indice);
retorno = sql.SAGetNext(conexao);
}
}
private static String[] quebralinha(String areaTemp, int[] indice) {
int aux=0;
String array[] = new String[indice.length];
for (int i = 0; i<indice.length;i++){
array[i] = areaTemp.substring(aux,indice[i]);
aux = aux+ indice[i];
}
return array;
}
}
erro que da :
Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: -95
at java.lang.String.substring(Unknown Source)
at SQLada.Acesso_ao_gp.quebralinha(Acesso_ao_gp.java:71)
at SQLada.Acesso_ao_gp.main(Acesso_ao_gp.java:53)
pq é ??? alguem ae pra da um help ?