Project

General

Profile

bug #3811

Updated by Andreas Müller over 2 years ago

at line 83 and 86 the out stream reference is null. 


 


 It is recommended to set the **warning** to **error** for these kind of code checks in _Window->Preferences->Java->Compiler->!Errors/Warnings->Potential Programming Problems->Null Pointer Access_ 


 


 As a hot fix I simply commented the method body 



 



 ~~~ 
 
 public ModelAndView getData(@RequestParam("lsid") LSID lsid,  
			                      
			                     @RequestParam("start") Integer start,  
			                      
			                     @RequestParam("length") Integer length, 
			                     
			                     HttpServletResponse response) throws LSIDServerException, IOException    { 
		 
		 OutputStream out = null; 
		 
		 InputStream data = null; 
		 
		 try { 
			 
			 data = lsidDataService.getDataByRange(lsid,start,length); 
		     
		     if(data != null) { 
		    	 
		    	 response.setContentType("application/octet-stream"); 
		    	 
		    	 byte[] bytes = new byte[1024]; 
		    	 
		    	 int numbytes = data.read(bytes); 
		    	 
		    	 while (numbytes != -1) { 
		    		 
		    		 out.write(bytes,0,numbytes); 
		    		 
		    		 numbytes = data.read(bytes); 
		    	 
		    	 } 
		    	 
		    	 out.flush(); 
		     
		     } 
		 
		 } finally { 
			 
			 if (out != null) { 
				 
				 out.close(); 
			 
			 } 
			
			 
			
			 if (data != null) { 
				 
				 data.close(); 
			 
			 } 
		 
		 } 
		 
		 return null; 
	 
	 } 
 
 ~~~ 
 

Back