-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b95
-
sparc
-
solaris_9
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b92)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b92, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
not relevant
A DESCRIPTION OF THE PROBLEM :
The example code in the JavaDoc for java.security.KeyStore is erroneous. It
doesn't use a finally block to ensure that the input stream is closed. For example:
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
// get user password and file input stream
char[] password = getPassword();
java.io.FileInputStream fis =
new java.io.FileInputStream("keyStoreName");
ks.load(fis, password);
fis.close();
Same problem for the example code showing a call to store.
Since example code in JavaDoc often gets widely copied, fixing this would be good.
Unclosed input/output streams can have seriously bad effects on enterprise applications.
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b92)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b92, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
not relevant
A DESCRIPTION OF THE PROBLEM :
The example code in the JavaDoc for java.security.KeyStore is erroneous. It
doesn't use a finally block to ensure that the input stream is closed. For example:
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
// get user password and file input stream
char[] password = getPassword();
java.io.FileInputStream fis =
new java.io.FileInputStream("keyStoreName");
ks.load(fis, password);
fis.close();
Same problem for the example code showing a call to store.
Since example code in JavaDoc often gets widely copied, fixing this would be good.
Unclosed input/output streams can have seriously bad effects on enterprise applications.
REPRODUCIBILITY :
This bug can be reproduced always.