Opened 16 years ago

Closed 16 years ago

#245 closed defect (worksforme)

java crash, index out of bounds

Reported by: dmn Owned by: ak19
Priority: moderate Milestone: 3.04 Release
Component: Greenstone3 Runtime Severity:
Keywords: Cc:


I got this crash, admittedly when puka wasn't behaving, but it looks like some arraylist accessing might be occurring without full index checking:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

java.util.ArrayList.RangeCheck( java.util.ArrayList.get( org.greenstone.gsdl3.service.AbstractGS2FieldSearch.createParameter( org.greenstone.gsdl3.service.AbstractGS2FieldSearch.getServiceDescription( org.greenstone.gsdl3.service.ServiceRack.processDescribe( org.greenstone.gsdl3.service.ServiceRack.process( org.greenstone.gsdl3.collection.ServiceCluster.process( org.greenstone.gsdl3.core.MessageRouter.process( org.greenstone.gsdl3.action.PageAction.sendMultipleRequests( org.greenstone.gsdl3.action.PageAction.aboutPage( org.greenstone.gsdl3.action.PageAction.process( org.greenstone.gsdl3.core.Receptionist.process( org.greenstone.gsdl3.LibraryServlet.doGet( javax.servlet.http.HttpServlet.service( javax.servlet.http.HttpServlet.service(

Change History (3)

comment:1 by ak19, 16 years ago

Owner: changed from nobody to ak19

comment:2 by ak19, 16 years ago

Status: newassigned

comment:3 by ak19, 16 years ago

Resolution: worksforme
Status: assignedclosed

Fix is not yet tested as I could not reproduce the error. From the exception reported it seemed that the logical fix for this was (and as now adjusted) in the /service/ class:

363 Fix for "java crash, index out of bounds" 364 org.greenstone.gsdl3.service.AbstractGS2FieldSearch.createParameter( 365 Changed from: 366 param = GSXML.createParameterDescription2(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, (String)fields.get(0), fields, field_names ); 367 String default_value = (fields.size() > 0) ? (String)fields.get(0) : null; 368 don't want to access element 0 if fields.size()==0, and 369 GSXML.createParameterDescription2 checks for default_value==null condition 370 param = GSXML.createParameterDescription2(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, default_value, fields, field_names );

Note: See TracTickets for help on using tickets.