Name: rmT116609 Date: 03/16/2004
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
Solaris 5.9
A DESCRIPTION OF THE PROBLEM :
When using the jar tool to update a jar file with the read only attribute set, the attribute is unset and the file is edited without warning.
This means that it is easy to accidentally update a file that is not meant to change. The purpose of the read only file attribute is to prevent accidental changes to files, and the jar tool violates this.
Note this bug also exists in 1.5.0 Beta 1.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile two Test classes: javac Test.java
2. Create a jar file with one class: jar cf Test.jar Test1.class
3. Make jar file read only: attrib +r Test.jar
4. Update the jar file with the other class: jar uf Test.jar Test2.class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect step 4 to produce an error saying the jar file cannot be updated because it is read only, the file being unaffected by step 4.
i.e. I expect the same behaviour as if step 4 was jar cf, which produces a file access error if the target is a read only file.
ACTUAL -
The jar file is no longer read only and includes both classes.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Test1 {}
class Test2 {}
---------- END SOURCE ----------
(Incident Review ID: 243743)
======================================================================
###@###.### 2004-03-17
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
Solaris 5.9
A DESCRIPTION OF THE PROBLEM :
When using the jar tool to update a jar file with the read only attribute set, the attribute is unset and the file is edited without warning.
This means that it is easy to accidentally update a file that is not meant to change. The purpose of the read only file attribute is to prevent accidental changes to files, and the jar tool violates this.
Note this bug also exists in 1.5.0 Beta 1.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile two Test classes: javac Test.java
2. Create a jar file with one class: jar cf Test.jar Test1.class
3. Make jar file read only: attrib +r Test.jar
4. Update the jar file with the other class: jar uf Test.jar Test2.class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect step 4 to produce an error saying the jar file cannot be updated because it is read only, the file being unaffected by step 4.
i.e. I expect the same behaviour as if step 4 was jar cf, which produces a file access error if the target is a read only file.
ACTUAL -
The jar file is no longer read only and includes both classes.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Test1 {}
class Test2 {}
---------- END SOURCE ----------
(Incident Review ID: 243743)
======================================================================
###@###.### 2004-03-17