You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/12/12 12:15:25 UTC

svn commit: r486097 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io: InvalidClassException.java PipedOutputStream.java RandomAccessFile.java

Author: tellison
Date: Tue Dec 12 03:15:22 2006
New Revision: 486097

URL: http://svn.apache.org/viewvc?view=rev&rev=486097
Log:
Minor code tidy-up, fix compiler warnings, externalize strings.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedOutputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java?view=diff&rev=486097&r1=486096&r2=486097
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java Tue Dec 12 03:15:22 2006
@@ -15,8 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
-
+package java.io;
 
 /**
  * A problem was found with the class of one of the objects being serialized or
@@ -34,55 +33,55 @@
  */
 public class InvalidClassException extends ObjectStreamException {
 
-	private static final long serialVersionUID = -4333316296251054416L;
+    private static final long serialVersionUID = -4333316296251054416L;
 
-	/**
-	 * The fully qualified name of the class that caused the problem
-	 */
-	public String classname;
-
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public InvalidClassException(String detailMessage) {
-		super(detailMessage);
-	}
-
-	/**
-	 * Constructs a new instance of this class with its walkback, message and
-	 * the fully qualified name of the class which caused the exception filled
-	 * in.
-	 * 
-	 * @param className
-	 *            The detail message for the exception.
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public InvalidClassException(String className, String detailMessage) {
-		super(detailMessage);
-		this.classname = className;
-	}
-
-	/**
-	 * Answers the extra information message which was provided when the
-	 * exception was created. If no message was provided at creation time, then
-	 * answer null. If a message was provided and a class name which caused the
-	 * exception, the values are concatenated and returned.
-	 * 
-	 * @return The receiver's message, possibly concatenated with the name of
-	 *         the class that caused the problem.
-	 */
-	@Override
+    /**
+     * The fully qualified name of the class that caused the problem
+     */
+    public String classname;
+
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public InvalidClassException(String detailMessage) {
+        super(detailMessage);
+    }
+
+    /**
+     * Constructs a new instance of this class with its walkback, message and
+     * the fully qualified name of the class which caused the exception filled
+     * in.
+     * 
+     * @param className
+     *            The detail message for the exception.
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public InvalidClassException(String className, String detailMessage) {
+        super(detailMessage);
+        this.classname = className;
+    }
+
+    /**
+     * Answers the extra information message which was provided when the
+     * exception was created. If no message was provided at creation time, then
+     * answer null. If a message was provided and a class name which caused the
+     * exception, the values are concatenated and returned.
+     * 
+     * @return The receiver's message, possibly concatenated with the name of
+     *         the class that caused the problem.
+     */
+    @Override
     public String getMessage() {
-		String msg = super.getMessage();
-		if (classname != null) {
-			msg = classname + "; " + msg;
-		}
-		return msg;
-	}
+        String msg = super.getMessage();
+        if (classname != null) {
+            msg = classname + "; " + msg; //$NON-NLS-1$
+        }
+        return msg;
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedOutputStream.java?view=diff&rev=486097&r1=486096&r2=486097
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedOutputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedOutputStream.java Tue Dec 12 03:15:22 2006
@@ -147,7 +147,8 @@
     @Override
     public void write(byte buffer[], int offset, int count) throws IOException {
         if (dest == null) {
-            throw new IOException("Pipe not connected.");
+            // K007b=Pipe Not Connected
+            throw new IOException(Msg.getString("K007b")); //$NON-NLS-1$
         }
         super.write(buffer, offset, count);
     }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java?view=diff&rev=486097&r1=486096&r2=486097
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/RandomAccessFile.java Tue Dec 12 03:15:22 2006
@@ -48,7 +48,9 @@
 
     private boolean isReadOnly;
 
-    private class RepositionLock {}
+    private class RepositionLock {
+    }
+
     private Object repositionLock = new RepositionLock();
 
     /**
@@ -612,7 +614,7 @@
     public final String readUTF() throws IOException {
         int utfSize = readUnsignedShort();
         if (utfSize == 0) {
-            return "";
+            return ""; //$NON-NLS-1$
         }
         byte[] buf = new byte[utfSize];
         if (read(buf, 0, buf.length) == buf.length) {
@@ -739,10 +741,10 @@
      * @see #read(byte[], int, int)
      */
     public void write(byte[] buffer, int offset, int count) throws IOException {
-    	if (count > buffer.length - offset || count < 0 || offset < 0) {
+        if (count > buffer.length - offset || count < 0 || offset < 0) {
             throw new IndexOutOfBoundsException();
         }
-        if (count == 0){
+        if (count == 0) {
             return;
         }
         synchronized (repositionLock) {