Re: 6998583 Code review request

2010-11-24 Thread Dr Andrew John Hughes
On 22 November 2010 14:20, Vincent Ryan vincent.x.r...@oracle.com wrote:
 Fix looks good Sean.

 On 22/11/2010 13:50, Seán Coffey wrote:
 Brad, Vinnie,

 This is a forward port of 6998583 to JDK 7. Can you review ?

 http://cr.openjdk.java.net/~coffeys/6998583/webrev.6998583.0/

 Thanks,
 Sean.



In:
+
+(InputStream)java.security.AccessController.doPrivileged
+(new java.security.PrivilegedExceptionAction() {
+public Object run() throws
URISyntaxException, IOException {
+if
(device.getProtocol().equalsIgnoreCase(file)) {
+return new FileInputStream(new
File(device.toURI()));
+} else {
+return new
BufferedInputStream(device.openStream(), 512);
+}

run could return InputStream, avoiding the cast, as
PrivilegedExceptionAction can take InputStream as a type parameter.

+devRandom = java.security.AccessController.doPrivileged
+(new java.security.PrivilegedExceptionAction() {
+public Object run() throws
URISyntaxException, IOException {
+if
(device.getProtocol().equalsIgnoreCase(file)) {
+return new FileInputStream(new
File(device.toURI()));
+} else {
+return new
BufferedInputStream(device.openStream(), 512);
+}

-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


Re: 6998583 Code review request

2010-11-24 Thread Dr Andrew John Hughes
On 25 November 2010 00:29, Dr Andrew John Hughes
gnu_and...@member.fsf.org wrote:
 On 22 November 2010 14:20, Vincent Ryan vincent.x.r...@oracle.com wrote:
 Fix looks good Sean.

 On 22/11/2010 13:50, Seán Coffey wrote:
 Brad, Vinnie,

 This is a forward port of 6998583 to JDK 7. Can you review ?

 http://cr.openjdk.java.net/~coffeys/6998583/webrev.6998583.0/

 Thanks,
 Sean.



 In:
 +
 +                    (InputStream)java.security.AccessController.doPrivileged
 +                        (new java.security.PrivilegedExceptionAction() {
 +                            public Object run() throws
 URISyntaxException, IOException {
 +                                if
 (device.getProtocol().equalsIgnoreCase(file)) {
 +                                    return new FileInputStream(new
 File(device.toURI()));
 +                                } else {
 +                                    return new
 BufferedInputStream(device.openStream(), 512);
 +                                }

 run could return InputStream, avoiding the cast, as
 PrivilegedExceptionAction can take InputStream as a type parameter.


Final example should have been:

 +                    devRandom = java.security.AccessController.doPrivileged
 +                        (new 
 java.security.PrivilegedExceptionActionInputStream() {
 +                            public InputStream run() throws
 URISyntaxException, IOException {
 +                                if
 (device.getProtocol().equalsIgnoreCase(file)) {
 +                                    return new FileInputStream(new
 File(device.toURI()));
 +                                } else {
 +                                    return new
 BufferedInputStream(device.openStream(), 512);
 +                                }




-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


Re: 6998583 Code review request

2010-11-22 Thread Vincent Ryan
Fix looks good Sean.

On 22/11/2010 13:50, Seán Coffey wrote:
 Brad, Vinnie,
 
 This is a forward port of 6998583 to JDK 7. Can you review ?
 
 http://cr.openjdk.java.net/~coffeys/6998583/webrev.6998583.0/
 
 Thanks,
 Sean.