Friday, 15 May 2015

A weird : java.lang.ArrayIndexOutOfBoundsException: 0 -



A weird : java.lang.ArrayIndexOutOfBoundsException: 0 -

i've got problem dynamic table. here code :

public static object[][] extractsctabledata(hashtable<integer,colis> lcolis) { object[][] tabledata = {{}}; int i=0; set<integer>keyset = lcolis.keyset(); (integer currkey:keyset) { tabledata[i][0]=lcolis.get(currkey).expediteur; tabledata[i][1]=lcolis.get(currkey).nocolis; tabledata[i][2]=currkey; i++; } homecoming tabledata; }

i've got exception , don't know why ... error :

java.lang.arrayindexoutofboundsexception: 0

apperently don't know how declared tab ! weird thing it's have same kind of method ( in other class ) without error. other method :

public static object[][] extractsctabledata(course[] lcourse) throws exceptioncolisinconnu { int nbcourse = lcourse.length; object[][] tabledata = { {} }; (int = 0; < nbcourse; i++) { short nocolis = lcourse[i].nocolis; string etat; org.omg.corba.orb orb; string[] str = {}; orb = org.omg.corba.orb.init(str, null); g_colis g_colis = (g_colis) orb .string_to_object(lcourse[i].iorg_colis); switch (g_colis.demandeetat(nocolis).value()) { case etatcolis._entransport: etat = "en cours"; break; case etatcolis._adestination: etat = "livré"; break; case etatcolis._audepart: case etatcolis._enattentedetransport: etat = "enregistrée"; break; default: etat = "non défini"; break; } tabledata[i][0] = short.tostring(nocolis); tabledata[i][1] = etat; } homecoming tabledata; }

if sombebody see ... guys

there no tabledata[0][1] , tabledata[0][2] because object[][] tabledata = {{}}; defines array dimensions [1][0]

java

No comments:

Post a Comment