Ticket #245 (closed defect: worksforme)

Opened 11 years ago

Last modified 11 years ago

java crash, index out of bounds

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

Description

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?(ArrayList?.java:547) java.util.ArrayList?.get(ArrayList?.java:322) org.greenstone.gsdl3.service.AbstractGS2FieldSearch.createParameter(AbstractGS2FieldSearch.java:362) org.greenstone.gsdl3.service.AbstractGS2FieldSearch.getServiceDescription(AbstractGS2FieldSearch.java:276) org.greenstone.gsdl3.service.ServiceRack?.processDescribe(ServiceRack?.java:290) org.greenstone.gsdl3.service.ServiceRack?.process(ServiceRack?.java:200) org.greenstone.gsdl3.collection.ServiceCluster?.process(ServiceCluster?.java:430) org.greenstone.gsdl3.core.MessageRouter?.process(MessageRouter?.java:318) org.greenstone.gsdl3.action.PageAction?.sendMultipleRequests(PageAction?.java:224) org.greenstone.gsdl3.action.PageAction?.aboutPage(PageAction?.java:164) org.greenstone.gsdl3.action.PageAction?.process(PageAction?.java:39) org.greenstone.gsdl3.core.Receptionist.process(Receptionist.java:197) org.greenstone.gsdl3.LibraryServlet?.doGet(LibraryServlet?.java:499) javax.servlet.http.HttpServlet?.service(HttpServlet?.java:690) javax.servlet.http.HttpServlet?.service(HttpServlet?.java:803)

Change History

Changed 11 years ago by ak19

  • owner changed from nobody to ak19

Changed 11 years ago by ak19

  • status changed from new to assigned

Changed 11 years ago by ak19

  • status changed from assigned to closed
  • resolution set to worksforme

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/AbstractGS2FieldSearch.java class:

363 // Fix for http://trac.greenstone.org/ticket/245 "java crash, index out of bounds" 364 // org.greenstone.gsdl3.service.AbstractGS2FieldSearch.createParameter(AbstractGS2FieldSearch.java:362) 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.