Re: svn commit: r424890 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/BufferedInputStream.java test/java/tests/api/java/io/BufferedInputStreamTest.java
Richard Liang wrote: Vladimir Ivanov wrote: No, this test will be fail if the issue 667 returns back :) I see. Thanks a lot. I will try to provide a patch to fix this issue. Harmony-1140 was raised. And Paulex had applied my patch. Thanks a lot. Best regards, Richard Richard Thanks, Vladimir On 8/10/06, Richard Liang [EMAIL PROTECTED] wrote: Paulex Yang wrote: Oops, it's my fault that missed to find this. Would you mind to provide a patch for this? or I'll fix it myself. let me fix it. But I'm not sure if Vladimir Ivanov has any concerns about this issue. Richard. Richard Liang wrote: Hello Paulex, It seems that the test case is invalid, because the tests will always pass whether buf.close() throws IOException or not. +try { +buf.close(); +} catch (IOException e) { +//expected +} } Please have a look at the following tests which passes on RI, but fails on Harmony. public void test_close() throws IOException {//regression for HARMONY-667 BufferedInputStream buf = new BufferedInputStream(null, 5); buf.close(); } Thanks a lot. Best regards, Richard. [EMAIL PROTECTED] wrote: Author: pyang Date: Sun Jul 23 20:29:14 2006 New Revision: 424890 URL: http://svn.apache.org/viewvc?rev=424890view=rev Log: Fix for HARMONY-667 ( [classlib][io]java.io.BufferedInputStream.skip(int n) unexpected NPE) Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java?rev=424890r1=424889r2=424890view=diff == --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java Sun Jul 23 20:29:14 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable +/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -109,6 +109,9 @@ * If an error occurs attempting to close this stream. */ public synchronized void close() throws IOException { +if(null == in){ +throw new IOException(org.apache.harmony.luni.util.Msg.getString(K0059)); +} super.close(); buf = null; } @@ -311,6 +314,9 @@ * occurs. */ public synchronized long skip(long amount) throws IOException { +if(null == in){ +throw new IOException(org.apache.harmony.luni.util.Msg.getString(K0059)); +} if (amount 1) return 0; Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java?rev=424890r1=424889r2=424890view=diff == --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java Sun Jul 23 20:29:14 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable +/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -120,6 +120,14 @@ // Test for method void java.io.BufferedInputStream.close() new BufferedInputStream(isFile); new BufferedInputStream(isFile); + +//regression for HARMONY-667 +BufferedInputStream buf = new BufferedInputStream(null, 5); +try { +buf.close(); +} catch (IOException e) { +//expected +} } /** @@ -310,6 +318,14 @@ } catch (java.io.IOException e) { fail(Exception during skip test); } + +//regression
Re: svn commit: r424890 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/BufferedInputStream.java test/java/tests/api/java/io/BufferedInputStreamTest.java
Vladimir Ivanov wrote: No, this test will be fail if the issue 667 returns back :) I see. Thanks a lot. I will try to provide a patch to fix this issue. Richard Thanks, Vladimir On 8/10/06, Richard Liang [EMAIL PROTECTED] wrote: Paulex Yang wrote: Oops, it's my fault that missed to find this. Would you mind to provide a patch for this? or I'll fix it myself. let me fix it. But I'm not sure if Vladimir Ivanov has any concerns about this issue. Richard. Richard Liang wrote: Hello Paulex, It seems that the test case is invalid, because the tests will always pass whether buf.close() throws IOException or not. +try { +buf.close(); +} catch (IOException e) { +//expected +} } Please have a look at the following tests which passes on RI, but fails on Harmony. public void test_close() throws IOException {//regression for HARMONY-667 BufferedInputStream buf = new BufferedInputStream(null, 5); buf.close(); } Thanks a lot. Best regards, Richard. [EMAIL PROTECTED] wrote: Author: pyang Date: Sun Jul 23 20:29:14 2006 New Revision: 424890 URL: http://svn.apache.org/viewvc?rev=424890view=rev Log: Fix for HARMONY-667 ( [classlib][io]java.io.BufferedInputStream.skip(int n) unexpected NPE) Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java?rev=424890r1=424889r2=424890view=diff == --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java Sun Jul 23 20:29:14 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable +/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -109,6 +109,9 @@ * If an error occurs attempting to close this stream. */ public synchronized void close() throws IOException { +if(null == in){ +throw new IOException(org.apache.harmony.luni.util.Msg.getString(K0059)); +} super.close(); buf = null; } @@ -311,6 +314,9 @@ * occurs. */ public synchronized long skip(long amount) throws IOException { +if(null == in){ +throw new IOException(org.apache.harmony.luni.util.Msg.getString(K0059)); +} if (amount 1) return 0; Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java?rev=424890r1=424889r2=424890view=diff == --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java Sun Jul 23 20:29:14 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable +/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -120,6 +120,14 @@ // Test for method void java.io.BufferedInputStream.close() new BufferedInputStream(isFile); new BufferedInputStream(isFile); + +//regression for HARMONY-667 +BufferedInputStream buf = new BufferedInputStream(null, 5); +try { +buf.close(); +} catch (IOException e) { +//expected +} } /** @@ -310,6 +318,14 @@ } catch (java.io.IOException e) { fail(Exception during skip test); } + +//regression for HARMONY-667 +BufferedInputStream buf = new BufferedInputStream(null, 5); +try { +buf.skip(10); +