5 Replies Latest reply: Feb 12, 2013 3:38 PM by vladodias RSS

    java.io.IOException: The operation completed successfully

    vladodias
      Hi,

      Got this exception on the in.read() operation... code bellow... I'm clueless... The exception itself looks weird... Any pointers will be helpful...

      java.io.IOException: The operation completed successfully
      InputStream in = new FileInputStream(sourceFile);
      OutputStream out = new FileOutputStream(destinationFile);
                                  
      // Transfer bytes from in to out
      byte[] buf = new byte[1024];
      int length;
                          
      while ((length = in.read(buf)) > 0) {
                              
         out.write(buf, 0, length);
      }
      in.close();
      out.close();
      Cheers,
      Vlad
        • 1. Re: java.io.IOException: The operation completed successfully
          EJP
          Platform? File system? Were either of the files share-mounts?
          • 2. Re: java.io.IOException: The operation completed successfully
            vladodias
            EJP wrote:
            Platform? File system? Were either of the files share-mounts?
            Pretty outdated jrockit90_150_10 running weblogic 9.2, both read and write files are on shared folders...

            I have a gap feeling that this may be a jrockit bug... But would prefer to workaround the code rather than upgrade jrockit at this stage...

            Cheers,
            Vlad
            • 3. Re: java.io.IOException: The operation completed successfully
              EJP
              Operating system?

              I would have to add my view based on many years of unwanted experience that any application that uses shared folders for any purpose is really asking for trouble.
              • 4. Re: java.io.IOException: The operation completed successfully
                vladodias
                EJP wrote:
                Operating system?
                windows server 2003 as weblogic host, the other servers are probably windows as well...
                I would have to add my view based on many years of unwanted experience that any application that uses shared folders for any purpose is really asking for trouble.
                Totally agree, mate... This is legacy stuff and I'm planning to upgrade this as soon as I have the chance...

                By the way, I figured out the root cause... file permissions... The weird stuff is... 1. The error message has nothing to do with permissions... 2. The code above is surrounded with an if(sourceFile.canRead()) that's answering true... 3. I can browse the directory and create files there... But the truth is I can NOT read the file itself...

                I passed the problem on to the server guys, now they are struggling because according what they see there the user is suppose to have full rights on those folders/files... I guess windows server file permissions are that straight forward, are they?

                Cheers,
                Vlad
                • 5. Re: java.io.IOException: The operation completed successfully
                  vladodias
                  Found this bug... 6203387 : File.canRead() reports wrong value (win)
                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6203387

                  It seems like File.canRead() just doesn't work for windows NTFS... And there won't be a fix for that...