Skip to Content
0
Former Member
Sep 12, 2007 at 09:56 AM

regarding Exceptionjava.lang.IndexOutOfBoundsException: Index: 0, Size: 0

61 Views

hi everyone

I am getting the following error:Exceptionjava.lang.IndexOutOfBoundsException: Index: 0, Size: 0

in the following code can someone pls advice me the reason for this error

for(int index=0; index<=wdContext.currentSerachMaterialListElement().nodeCompoItems().size(); index++)

{

wdThis.wdGetAPI().getMessageManager().reportSuccess("index"+index);

double partWeights = Math.floor(wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).getKwmeng().multiply(wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).getBrgew()).doubleValue());

wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).currentVnBOM_DetailsElement().setVaWeight(partWeights);

grossWeightParts +=partWeights;

double noOfPallets = wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).getKwmeng().divide(new BigDecimal(wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).getMaxqty()),0).doubleValue();

wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).currentVnBOM_DetailsElement().setVaNoOfPallets(noOfPallets);

totalPalletsRequired += noOfPallets;

palletsGrossWeight += Math.floor(new BigDecimal(String.valueOf(noOfPallets)).multiply(wdContext.currentSerachMaterialListElement().nodeCompoItems().getCompoItemsElementAt(index).getBrgew_P()).doubleValue());

}

wdThis.wdGetAPI().getMessageManager().reportSuccess("aftr 2nd for loop");

totalGrossWeight = grossWeightParts + palletsGrossWeight;

wdContext.currentSerachMaterialListElement().nodeVnTruckNode().currentVnTruckNodeElement().setVaGrossWeight(grossWeightParts);

wdContext.currentSerachMaterialListElement().nodeVnTruckNode().currentVnTruckNodeElement().setVaPalletsGrossWeight(palletsGrossWeight);

wdContext.currentSerachMaterialListElement().nodeVnTruckNode().currentVnTruckNodeElement().setVaTotalGrossWeight(totalGrossWeight);

wdContext.currentSerachMaterialListElement().nodeVnTruckNode().currentVnTruckNodeElement().setVaTotalPallets(totalPalletsRequired);

my first report success in which index value is cummin 0 n size of node is also 0

but its not cummin out of the for loop its giving exception in the for loop

thanks & regards

jaspreet