United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4073756 : java.io.File.renameTo fails on a NFS mounted location

Details
Type:
Bug
Submit Date:
1997-08-22
Status:
Closed
Updated Date:
1997-12-19
Project Name:
JDK
Resolved Date:
1997-12-19
Component:
core-libs
OS:
solaris_2.6,windows_95
Sub-Component:
java.io
CPU:
x86,sparc,generic
Priority:
P3
Resolution:
Not an Issue
Affected Versions:
1.1,1.2.0,1.3.0
Fixed Versions:

Related Reports
Duplicate:
Duplicate:

Sub Tasks

Description

Name: joT67522			Date: 08/22/97


This is sample code for a java application. The renameTo method works
on a local file system. When the renameTo is used to rename a file
on the local file system to a NFS mounted path it fails. It does
not throw an exception. This application is running on Solaris.

    final public void Close(){
        if(fevents != null){
           System.out.println("IN CLOSE " + Filename);
           try{
            fevents.close();
            fevents = null;
            if(renamefile == true){
              System.out.println("Rename from " + tempfile);  
              System.out.println("Rename to   " + Filename);
              File tempf = new File(tempfile);
              File newf = new File(Filename);
              if(newf.exists() == true)
                newf.delete();
              tempf.renameTo(newf);
              renamefile = false;
              Filename = null;
            }

           }catch(Exception e){
            System.out.println("Exception Close " + e);
            exceptionLog("CLOSE",e);
           }
        }

        if( sourceData != null){
            try{
             sourceData.close();
             sourceData = null;
            }catch(Exception e){
             exceptionLog("CLOSE",e);
            }

        }
    }

company - Digital Solutions, Inc. , email - ###@###.###
======================================================================

                                    

Comments
WORK AROUND



Name: joT67522			Date: 08/22/97



======================================================================
                                     
2004-06-11
EVALUATION

Rather than throwing an exception, the File.renameTo method returns a boolean
to indicate success or failure; the submitted code does not check this value.

In this case the renameTo method is failing because, unlike the Unix "mv"
command, the File.renameTo method is not specified to copy a file across
filesystems when necessary; it will only rename a file within a single
filesystem.

-- mr@eng 12/18/1997
                                     
1997-12-18



Hardware and Software, Engineered to Work Together