harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
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 GMT
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 <code>in</code>.
@@ -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);
+	}
+
 }



Mime
View raw message