[ 
https://issues.apache.org/jira/browse/ODE-751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806018#action_12806018
 ] 

David Carver edited comment on ODE-751 at 1/28/10 7:05 PM:
-----------------------------------------------------------

In ode.apache.org.utils.StreamUtils the following code is getting some FindBugs 
errors reported.

 public static void extractJar(File dest, InputStream is) throws IOException {
   JarInputStream jis = new JarInputStream(is);
   JarEntry je;
   while ((je = jis.getNextJarEntry()) != null) {
     File outputFile = new File(dest, je.getName());
     if (je.isDirectory()) {
       outputFile.mkdirs();
     }
     else {
       outputFile.getParentFile().mkdirs();
       BufferedOutputStream bos = new BufferedOutputStream(new 
FileOutputStream(outputFile));
       copy(bos, jis);
       bos.flush();
       bos.close();
     }
     jis.closeEntry();
   }
 }

The above code does not check to see if mkdirs() method returns true or false.  
 FindBugs is complaining because the return value is not checked.  It could 
lead to some issues and possible IOException erros being tossed.   This may 
actually be the desired behavior but thought I'd check here.

The exact error message from FindBugs is:

message org.apache.ode.utils.StreamUtils.extractJar(File, InputStream) ignores 
exceptional return value of java.io.File.mkdirs()

The same issue happens in FileUtilsTest, 
TempFileManager.getTemporaryDirectory() as well

      was (Author: kingargyle):
    In ode.apache.org.utils.StreamUtils the following code is getting some 
FindBugs errors reported.

 public static void extractJar(File dest, InputStream is) throws IOException {
   JarInputStream jis = new JarInputStream(is);
   JarEntry je;
   while ((je = jis.getNextJarEntry()) != null) {
     File outputFile = new File(dest, je.getName());
     if (je.isDirectory()) {
       outputFile.mkdirs();
     }
     else {
       outputFile.getParentFile().mkdirs();
       BufferedOutputStream bos = new BufferedOutputStream(new 
FileOutputStream(outputFile));
       copy(bos, jis);
       bos.flush();
       bos.close();
     }
     jis.closeEntry();
   }
 }

The above code does not check to see if mkdirs() method returns true or false.  
 FindBugs is complaining because the return value is not checked.  It could 
lead to some issues and possible IOException erros being tossed.   This may 
actually be the desired behavior but thought I'd check here.

The exact error message from FindBugs is:

message org.apache.ode.utils.StreamUtils.extractJar(File, InputStream) ignores 
exceptional return value of java.io.File.mkdirs()

  
> FindBugs Patches for ODE Runtime
> --------------------------------
>
>                 Key: ODE-751
>                 URL: https://issues.apache.org/jira/browse/ODE-751
>             Project: ODE
>          Issue Type: Bug
>          Components: BPEL Runtime
>         Environment: linux
>            Reporter: David Carver
>         Attachments: odebpelapipatchv2.txt, odebpelpatch.txt
>
>
> Running FindBugs (http://findbugs.sourceforge.net/) against the bpel-api 
> project, the following error:
> Equals method for org.apache.ode.bpel.iapi.Endpoint assumes the argument is 
> of type Endpoint
> Will attach a patch to correct these issues.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to