You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Kommineni, Sateesh (GE Consumer & Industrial)" <sa...@ge.com> on 2004/01/21 13:25:46 UTC

RE: Exception =java.lang.ArrayIndexOutOfBoundsException: 112

Hi,

   I am getting the following Exception..
   java.lang.ArrayIndexOutOfBoundsException: 112 
   In my earlier mail i mentioned just 112 , which i got by printing the getMessage() on exception. Sorry for just mentioning 112

   Why i am getting ArrayIndexOutofBoundsException when i am trying to write the data to a ServletOutputStream object..

   Shall i need to specify the byte size i am going to write to the stream??

   Pls let me know your thoughts..

-Sateesh



-----Original Message-----
From: Avik Sengupta [mailto:avik.sengupta@itellix.com]
Sent: Wednesday, January 21, 2004 5:37 PM
To: POI Users List
Subject: Re: Exception = 112


>  What does the 112 mean ?? 

You tell me. You are eating up the exception. 

On Wed, 2004-01-21 at 16:53, Kommineni, Sateesh (GE Consumer &
Industrial) wrote:
> Hi All,	
> 
>     I am trying to modify an existing Excel File using the POI.
> 
>     The Environment details are 
> 
>      WSAD5.0 , POI = jakarta-poi-1.5.0-dev-20020415
> 
>    When i try to generate a File using the below given code...i am getting the Error:
>  ....
>  [4/21/03 16:30:59:364 GMT+05:30] 26adc544 SystemOut     O Created a Row ..
>  [4/21/03 16:30:59:364 GMT+05:30] 26adc544 SystemOut     O  About to write the 
>  [4/21/03 16:30:59:414 GMT+05:30] 26adc544 SystemOut     O Excpe in generateWorkBook()=112
> 
>   What does the 112 mean ?? 
> 
> ========================================================================================
> public void generateWorkBook(OutputStream out, ArrayList ctqDetails)throws Exception{
> 		
> 		System.out.println(" Here in generateWorkBook() and out="+out);		
> 		GEISQMSCtqBeanEx ctqBeanEx = null;
> 		HSSFWorkbook wb = null;
> 		HSSFRow  row 	= null;
> 		HSSFCell cell 	= null;
> 		FileOutputStream fout= null;
> 		POIFSFileSystem fs =null;
> 		String oldPartNum ="";
> 		try{
> 			if(path==null)
> 			  throw new Exception("Path is Not set Error..");
> 			fs  = new POIFSFileSystem(new FileInputStream(path+FILE_NAME));
>     			wb = new HSSFWorkbook(fs);
> 			HSSFSheet sheet = wb.getSheet("Ctq Details");
> 			System.out.println("No.of Sheets After="+wb.getNumberOfSheets());
> 			int noOfCtqs    =  ctqDetails.size();
> 			System.out.println("No.Of CTQs="+noOfCtqs);
> 			for(int i=0;i<noOfCtqs;i++){
> 				ctqBeanEx  = (CtqBeanEx) ctqDetails.get(i);
> 				System.out.println("Part Number"+(i+1)+" ="+ctqBeanEx.getPartNumber()+" Ctq Number="+ctqBeanEx.getCtqNumber());
> 				
> 				if(oldPartNum==null)
> 					oldPartNum = ctqBeanEx.getPartNumber();
> 				row	=	sheet.createRow((short)i);	
> 				System.out.println("Old Part="+oldPartNum);
> 				if(oldPartNum!=null && !oldPartNum.equals(ctqBeanEx.getPartNumber())){
> 					// Column 0 is Part Number		
> 					cell = row.createCell((short)0);
> 					cell.setCellValue(ctqBeanEx.getPartNumber());
> 					cell.setCellType(HSSFCell.CELL_TYPE_STRING);
> 					
> 				}
> 				// Column 1 is CTQ Number
> 				cell = row.createCell((short)1);
> 				cell.setCellValue(Integer.parseInt(ctqBeanEx.getCtqNumber()));
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 				
> 				// Column 2 is SubGroup Size
> 				cell = row.createCell((short)2);
> 				cell.setCellValue(ctqBeanEx.getSubGroupSize());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 	
> 				// Column 3 is Ctq Specification
> 				cell = row.createCell((short)3);
> 				cell.setCellValue(ctqBeanEx.getCtqSpec());
> 				cell.setCellType(HSSFCell.CELL_TYPE_STRING);
> 				
> 				// Column 4 is Unit Of Measure
> 				cell = row.createCell((short)4);
> 				cell.setCellValue(ctqBeanEx.getUom());
> 				cell.setCellType(HSSFCell.CELL_TYPE_STRING);
> 				
> 				
> 	
> 				// Column 5 is USL
> 				cell = row.createCell((short)5);
> 				cell.setCellValue(ctqBeanEx.getUsl());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 				
> 				// Column 6 is LSL
> 				cell = row.createCell((short)6);
> 				cell.setCellValue(ctqBeanEx.getLsl());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 	
> 				// Column 7 is Nominal
> 				cell = row.createCell((short)7);
> 				cell.setCellValue(ctqBeanEx.getNominal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 				
> 				// Column 8 is UAL
> 				/*
> 				cell = row.createCell((short)8);
> 				cell.setCellValue(ctqBeanEx.getUal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				
> 	
> 	
> 				// Column 9 is LAL
> 				cell = row.createCell((short)9);
> 				cell.setCellValue(ctqBeanEx.getLal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				*/			
> 				System.out.println("Created a Row ..");
> 				oldPartNum = ctqBeanEx.getPartNumber();
> 									
> 			}
> 			System.out.println("About to write the ");
> 			int index = FILE_NAME.indexOf('.');
> 			fout=new FileOutputStream(path+FILE_NAME.substring(0,index)+"1.xls");
> 			wb.write(fout);
> 			System.out.println("Done with fout");
> 			if(out!=null){
> 		        System.out.println("About to write the data to the Servlet OutputStream");
> 		    	wb.write(out);
> 			}
> 
> 	    	System.out.println("After constructing the Excel Sheet");
> 		}
> 		catch(Exception e){
> 		   System.out.println("Excpe in generateWorkBook()="+e.getMessage());
> 		   throw e;
> 		}
> 		finally{
> 			try{
> 				fout.close();		   
> 			}
> 			catch(Exception e){
> 			   throw new Exception("Unable to close the FileOutputStream="+e.getMessage());
> 			}
> 		}
> 
> 	}
> 
> ==========================================================================================
> 
> Thanks in Advance..
> Sateesh
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


RE: Exception =java.lang.ArrayIndexOutOfBoundsException: 112

Posted by Robert Lowe <rm...@rmlowe.com>.
Sateesh, I think you should modify your code to show the whole stack trace.
I'm sure you'll get much better help if you can provide a full stack trace.



Best regards,

Robert Lowe
http://RMLowe.com/



-----Original Message-----
From: Kommineni, Sateesh (GE Consumer & Industrial)
[mailto:sateesh.kommineni@ge.com]
Sent: Wednesday, January 21, 2004 8:26 PM
To: POI Users List
Subject: RE: Exception =java.lang.ArrayIndexOutOfBoundsException: 112


Hi,

   I am getting the following Exception..
   java.lang.ArrayIndexOutOfBoundsException: 112
   In my earlier mail i mentioned just 112 , which i got by printing the
getMessage() on exception. Sorry for just mentioning 112

   Why i am getting ArrayIndexOutofBoundsException when i am trying to write
the data to a ServletOutputStream object..

   Shall i need to specify the byte size i am going to write to the stream??

   Pls let me know your thoughts..

-Sateesh



-----Original Message-----
From: Avik Sengupta [mailto:avik.sengupta@itellix.com]
Sent: Wednesday, January 21, 2004 5:37 PM
To: POI Users List
Subject: Re: Exception = 112


>  What does the 112 mean ??

You tell me. You are eating up the exception.

On Wed, 2004-01-21 at 16:53, Kommineni, Sateesh (GE Consumer &
Industrial) wrote:
> Hi All,
>
>     I am trying to modify an existing Excel File using the POI.
>
>     The Environment details are
>
>      WSAD5.0 , POI = jakarta-poi-1.5.0-dev-20020415
>
>    When i try to generate a File using the below given code...i am getting
the Error:
>  ....
>  [4/21/03 16:30:59:364 GMT+05:30] 26adc544 SystemOut     O Created a Row
..
>  [4/21/03 16:30:59:364 GMT+05:30] 26adc544 SystemOut     O  About to write
the
>  [4/21/03 16:30:59:414 GMT+05:30] 26adc544 SystemOut     O Excpe in
generateWorkBook()=112
>
>   What does the 112 mean ??
>
>
============================================================================
============
> public void generateWorkBook(OutputStream out, ArrayList ctqDetails)throws
Exception{
>
> 		System.out.println(" Here in generateWorkBook() and out="+out);
> 		GEISQMSCtqBeanEx ctqBeanEx = null;
> 		HSSFWorkbook wb = null;
> 		HSSFRow  row 	= null;
> 		HSSFCell cell 	= null;
> 		FileOutputStream fout= null;
> 		POIFSFileSystem fs =null;
> 		String oldPartNum ="";
> 		try{
> 			if(path==null)
> 			  throw new Exception("Path is Not set Error..");
> 			fs  = new POIFSFileSystem(new FileInputStream(path+FILE_NAME));
>     			wb = new HSSFWorkbook(fs);
> 			HSSFSheet sheet = wb.getSheet("Ctq Details");
> 			System.out.println("No.of Sheets After="+wb.getNumberOfSheets());
> 			int noOfCtqs    =  ctqDetails.size();
> 			System.out.println("No.Of CTQs="+noOfCtqs);
> 			for(int i=0;i<noOfCtqs;i++){
> 				ctqBeanEx  = (CtqBeanEx) ctqDetails.get(i);
> 				System.out.println("Part Number"+(i+1)+"
="+ctqBeanEx.getPartNumber()+" Ctq Number="+ctqBeanEx.getCtqNumber());
>
> 				if(oldPartNum==null)
> 					oldPartNum = ctqBeanEx.getPartNumber();
> 				row	=	sheet.createRow((short)i);
> 				System.out.println("Old Part="+oldPartNum);
> 				if(oldPartNum!=null && !oldPartNum.equals(ctqBeanEx.getPartNumber())){
> 					// Column 0 is Part Number
> 					cell = row.createCell((short)0);
> 					cell.setCellValue(ctqBeanEx.getPartNumber());
> 					cell.setCellType(HSSFCell.CELL_TYPE_STRING);
>
> 				}
> 				// Column 1 is CTQ Number
> 				cell = row.createCell((short)1);
> 				cell.setCellValue(Integer.parseInt(ctqBeanEx.getCtqNumber()));
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
> 				// Column 2 is SubGroup Size
> 				cell = row.createCell((short)2);
> 				cell.setCellValue(ctqBeanEx.getSubGroupSize());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
> 				// Column 3 is Ctq Specification
> 				cell = row.createCell((short)3);
> 				cell.setCellValue(ctqBeanEx.getCtqSpec());
> 				cell.setCellType(HSSFCell.CELL_TYPE_STRING);
>
> 				// Column 4 is Unit Of Measure
> 				cell = row.createCell((short)4);
> 				cell.setCellValue(ctqBeanEx.getUom());
> 				cell.setCellType(HSSFCell.CELL_TYPE_STRING);
>
>
>
> 				// Column 5 is USL
> 				cell = row.createCell((short)5);
> 				cell.setCellValue(ctqBeanEx.getUsl());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
> 				// Column 6 is LSL
> 				cell = row.createCell((short)6);
> 				cell.setCellValue(ctqBeanEx.getLsl());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
> 				// Column 7 is Nominal
> 				cell = row.createCell((short)7);
> 				cell.setCellValue(ctqBeanEx.getNominal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
> 				// Column 8 is UAL
> 				/*
> 				cell = row.createCell((short)8);
> 				cell.setCellValue(ctqBeanEx.getUal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>
>
>
> 				// Column 9 is LAL
> 				cell = row.createCell((short)9);
> 				cell.setCellValue(ctqBeanEx.getLal());
> 				cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
> 				*/
> 				System.out.println("Created a Row ..");
> 				oldPartNum = ctqBeanEx.getPartNumber();
>
> 			}
> 			System.out.println("About to write the ");
> 			int index = FILE_NAME.indexOf('.');
> 			fout=new FileOutputStream(path+FILE_NAME.substring(0,index)+"1.xls");
> 			wb.write(fout);
> 			System.out.println("Done with fout");
> 			if(out!=null){
> 		        System.out.println("About to write the data to the Servlet
OutputStream");
> 		    	wb.write(out);
> 			}
>
> 	    	System.out.println("After constructing the Excel Sheet");
> 		}
> 		catch(Exception e){
> 		   System.out.println("Excpe in generateWorkBook()="+e.getMessage());
> 		   throw e;
> 		}
> 		finally{
> 			try{
> 				fout.close();
> 			}
> 			catch(Exception e){
> 			   throw new Exception("Unable to close the
FileOutputStream="+e.getMessage());
> 			}
> 		}
>
> 	}
>
>
============================================================================
==============
>
> Thanks in Advance..
> Sateesh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org