Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 26361 invoked from network); 31 Mar 2006 16:21:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Mar 2006 16:21:36 -0000 Received: (qmail 9400 invoked by uid 500); 31 Mar 2006 16:20:59 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 9367 invoked by uid 500); 31 Mar 2006 16:20:59 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 9356 invoked by uid 99); 31 Mar 2006 16:20:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Mar 2006 08:20:59 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 31 Mar 2006 08:20:56 -0800 Received: (qmail 25898 invoked by uid 65534); 31 Mar 2006 16:20:31 -0000 Message-ID: <20060331162031.25894.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r390451 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/ test/java/org/apache/harmony/tests/java/io/ Date: Fri, 31 Mar 2006 16:20:26 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: tellison Date: Fri Mar 31 08:20:17 2006 New Revision: 390451 URL: http://svn.apache.org/viewcvs?rev=390451&view=rev Log: Fix for HARMONY-232 (Some other minor Java 5 updates in java.io package) Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectStreamConstantsTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FilterInputStream.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamConstants.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FilterInputStream.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FilterInputStream.java?rev=390451&r1=390450&r2=390451&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FilterInputStream.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FilterInputStream.java Fri Mar 31 08:20:17 2006 @@ -29,7 +29,7 @@ /** * The target InputStream which is being filtered. */ - protected InputStream in; + protected volatile InputStream in; /** * Constructs a new FilterInputStream on the InputStream in. @@ -184,5 +184,4 @@ public long skip(long count) throws IOException { return in.skip(count); } - } Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamConstants.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamConstants.java?rev=390451&r1=390450&r2=390451&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamConstants.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamConstants.java Fri Mar 31 08:20:17 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2004 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. @@ -64,7 +64,7 @@ public static final byte TC_PROXYCLASSDESC = (byte) 0x7D; - public static final byte TC_MAX = 0x7D; + public static final byte TC_MAX = 0x7E; /** * The first object dumped gets assigned this handle/ID @@ -90,5 +90,15 @@ public static final byte SC_EXTERNALIZABLE = 0x04; public static final byte SC_BLOCK_DATA = 0x08; // If SC_EXTERNALIZABLE - + + /** + * constant for new enum + */ + public static final byte TC_ENUM = 0x7E; + + /** + * the bitmask denoting that the object is a enum + */ + public static final byte SC_ENUM = 0x10; + } Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java?rev=390451&r1=390450&r2=390451&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java Fri Mar 31 08:20:17 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2004 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. @@ -15,7 +15,6 @@ package java.io; - /** * PushbackInputStream is a filter class which allows bytes read to be pushed * back into the stream so that they can be reread. Parsers may find this @@ -291,5 +290,31 @@ throw new IOException(com.ibm.oti.util.Msg.getString("K007e")); //$NON-NLS-1$ } else throw new IOException(); + } + + /** + * Make a mark of the current position in the stream but the mark method + * does nothing. + * + * @param readlimit + * the maximum number of bytes that are able to be read before the + * mark becomes invalid + * @override the method mark in FilterInputStream + */ + public void mark(int readlimit) { + return; + } + + /** + * Reset current position to the mark made previously int the stream, but + * the reset method will throw IOException and do nothing else if called. + * + * @override the method reset in FilterInputStream + * @throws IOException + * If the method is called + */ + + public void reset() throws IOException { + throw new IOException(); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java?rev=390451&r1=390450&r2=390451&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java Fri Mar 31 08:20:17 2006 @@ -35,6 +35,7 @@ suite.addTestSuite(BufferedReaderTest.class); suite.addTestSuite(PushBackInputStreamTest.class); suite.addTestSuite(RandomAccessFileTest.class); + suite.addTestSuite(ObjectStreamConstantsTest.class); //$JUnit-END$ return suite; } Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectStreamConstantsTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectStreamConstantsTest.java?rev=390451&view=auto ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectStreamConstantsTest.java (added) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectStreamConstantsTest.java Fri Mar 31 08:20:17 2006 @@ -0,0 +1,47 @@ +/* Copyright 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.tests.java.io; + +import java.io.ObjectStreamConstants; +import junit.framework.TestCase; + +public class ObjectStreamConstantsTest extends TestCase { + + /** + * @tests java.io.ObjectStreamConstants#TC_ENUM + */ + public void test_TC_ENUM() { + assertEquals(126, MockObjectStreamConstants.TC_ENUM); + } + + /** + * @tests java.io.ObjectStreamConstants#SC_ENUM + */ + public void test_SC_ENUM() { + assertEquals(16, MockObjectStreamConstants.SC_ENUM); + } + + /** + * @tests java.io.ObjectStreamConstants#TC_MAX + */ + public void test_TC_MAX() { + assertEquals(126, MockObjectStreamConstants.TC_MAX); + } + + private class MockObjectStreamConstants implements ObjectStreamConstants { + // empty + } +} Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java?rev=390451&r1=390450&r2=390451&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java Fri Mar 31 08:20:17 2006 @@ -37,4 +37,25 @@ // expected } } + + public void test_reset() { + PushbackInputStream pb = new PushbackInputStream( + new ByteArrayInputStream(new byte[] { 0 }), 2); + try { + pb.reset(); + fail("Should throw IOException"); + } catch (IOException e) { + // expected + } + } + + public void test_mark() { + PushbackInputStream pb = new PushbackInputStream( + new ByteArrayInputStream(new byte[] { 0 }), 2); + pb.mark(Integer.MAX_VALUE); + pb.mark(0); + pb.mark(-1); + pb.mark(Integer.MIN_VALUE); + } + }