You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/01/31 11:04:22 UTC
svn commit: r617085 [2/14] - in /harmony/enhanced/classlib/branches/java6:
depends/build/ depends/build/platform/ depends/libs/ depends/oss/ make/
make/linux.x86_64.libstdc++6/ make/windows.x86/ make/windows.x86_64/
modules/archive/META-INF/ modules/ar...
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Appendable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Appendable.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Appendable.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Appendable.java Thu Jan 31 02:04:05 2008
@@ -22,66 +22,80 @@
* Appendable is an object used to append character or character sequence. Any
* class implements this interface can receive data formatted by
* <code>Formatter</code>. The appended character or character sequence
- * should be valid accroding to the rules described
+ * should be valid according to the rules described
* <code>Unicode Character Representation</code>.
* <p>
- * Appendable itself does not gurantee thread safety. This responsibility is up
- * to the implementing class.</p>
+ * Appendable itself does not guarantee thread safety. This responsibility is up
+ * to the implementing class.
+ * </p>
* <p>
* The implementing class can choose different exception handling mechanism. It
* can choose to throw exceptions other than IOException but which must be
* compatible with IOException, or does not throw any exceptions at all and use
- * error code instead. All in all, the implementing class does not gurantee to
- * propagate the exception declared by this interface.</p>
- *
+ * error code instead. All in all, the implementing class does not guarantee to
+ * propagate the exception declared by this interface.
+ * </p>
*/
public interface Appendable {
-
+
/**
* Append the given character.
*
- * @param c the character to append
+ * @param c
+ * the character to append
* @return this <code>Appendable</code>
- * @throws IOException if some I/O operation fails
+ * @throws IOException
+ * if some I/O operation fails
*/
Appendable append(char c) throws IOException;
/**
* Append the given <code>CharSequence</code>.
* <p>
- * The behaviour of this method depends on the implementation class of
- * <code>Appendable</code>.</p>
+ * The behaviour of this method depends on the implementation class of
+ * <code>Appendable</code>.
+ * </p>
* <p>
- * If the give <code>CharSequence</code> is null, the sequence is treated as
- * String "null".</p>
+ * If the give <code>CharSequence</code> is null, the sequence is treated
+ * as String "null".
+ * </p>
*
- * @param csq the <code>CharSequence</code> to be append
+ * @param csq
+ * the <code>CharSequence</code> to be append
* @return this <code>Appendable</code>
- * @throws IOException if some I/O operation fails
+ * @throws IOException
+ * if some I/O operation fails
*/
Appendable append(CharSequence csq) throws IOException;
/**
* Append part of the given <code>CharSequence</code>.
- * <p>
- * If the given <code>CharSequence</code> is not null, this method behaves
- * same as the following statement:</p>
- * <pre> out.append(csq.subSequence(start, end)) </pre>
- * <p>
- * If the give <code>CharSequence</code> is null, the sequence is treated as
- * String "null".</p>
*
- * @param csq the <code>CharSequence</code> to be append
- * @param start the index to spicify the start position of
- * <code>CharSequence</code> to be append, must be non-negative,
- * and not larger than the end
- * @param end the index to speicify the end position of
- * <code>CharSequence</code> to be append, must be non-negative,
- * and not larger than the size of csq
+ * If the given <code>CharSequence</code> is not null, this method behaves
+ * same as the following statement:
+ *
+ * <pre>
+ * out.append(csq.subSequence(start, end))
+ * </pre>
+ *
+ * If the give <code>CharSequence</code> is null, the sequence is treated
+ * as String "null".
+ *
+ * @param csq
+ * the <code>CharSequence</code> to be append
+ * @param start
+ * the index to specify the start position of
+ * <code>CharSequence</code> to be append, must be
+ * non-negative, and not larger than the <code>end</code>
+ * @param end
+ * the index to specify the end position of
+ * <code>CharSequence</code> to be append, must be
+ * non-negative, and not larger than the size of <code>csq</code>
* @return this <code>Appendable</code>
- * @throws IOException if some I/O operation fails
+ * @throws IOException
+ * if some I/O operation fails
* @throws IndexOutOfBoundsException
- * if the start or end is illegal
+ * if the start or end is illegal
*/
Appendable append(CharSequence csq, int start, int end) throws IOException;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArithmeticException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArithmeticException.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArithmeticException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArithmeticException.java Thu Jan 31 02:04:05 2008
@@ -17,7 +17,6 @@
package java.lang;
-
/**
* This runtime exception is thrown when the an invalid arithmetic operation is
* attempted.
@@ -27,20 +26,20 @@
private static final long serialVersionUID = 2256477558314496007L;
/**
- * Constructs a new instance of this class with its walkback filled in.
- */
- public ArithmeticException() {
- super();
- }
+ * Constructs a new instance of this class with its walkback filled in.
+ */
+ public ArithmeticException() {
+ super();
+ }
- /**
- * Constructs a new instance of this class with its walkback and message
- * filled in.
- *
- * @param detailMessage
- * String The detail message for the exception.
- */
- public ArithmeticException(String detailMessage) {
- super(detailMessage);
- }
+ /**
+ * Constructs a new instance of this class with its walkback and message
+ * filled in.
+ *
+ * @param detailMessage
+ * String The detail message for the exception.
+ */
+ public ArithmeticException(String detailMessage) {
+ super(detailMessage);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArrayStoreException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArrayStoreException.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArrayStoreException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ArrayStoreException.java Thu Jan 31 02:04:05 2008
@@ -17,7 +17,6 @@
package java.lang;
-
/**
* This runtime exception is thrown when a program attempts to store into an
* array an element of a a type which the array can not hold..
@@ -27,20 +26,20 @@
private static final long serialVersionUID = -4522193890499838241L;
/**
- * Constructs a new instance of this class with its walkback filled in.
- */
- public ArrayStoreException() {
- super();
- }
+ * Constructs a new instance of this class with its walkback filled in.
+ */
+ public ArrayStoreException() {
+ super();
+ }
- /**
- * Constructs a new instance of this class with its walkback and message
- * filled in.
- *
- * @param detailMessage
- * String The detail message for the exception.
- */
- public ArrayStoreException(String detailMessage) {
- super(detailMessage);
- }
+ /**
+ * Constructs a new instance of this class with its walkback and message
+ * filled in.
+ *
+ * @param detailMessage
+ * String The detail message for the exception.
+ */
+ public ArrayStoreException(String detailMessage) {
+ super(detailMessage);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AssertionError.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AssertionError.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AssertionError.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/AssertionError.java Thu Jan 31 02:04:05 2008
@@ -18,9 +18,7 @@
package java.lang;
/**
- * <p>
* Indicates that an assertion has failed.
- * </p>
*
* @since 1.4
*/
@@ -29,24 +27,21 @@
private static final long serialVersionUID = -5013299493970297370L;
/**
- * <p>
* Constructs an instance without a message.
- * </p>
*/
public AssertionError() {
super();
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(Object)} of the object passed. If the object passed
- * is an instanceof {@link Throwable}, then it also becomes the cause of
+ * is an instance of {@link Throwable}, then it also becomes the cause of
* this error.
- * </p>
*
- * @param detailMessage The value to be converted into the message and
- * optionally the cause.
+ * @param detailMessage
+ * The value to be converted into the message and optionally the
+ * cause.
*/
public AssertionError(Object detailMessage) {
super(String.valueOf(detailMessage),
@@ -55,72 +50,66 @@
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(boolean)} of the boolean passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(boolean detailMessage) {
this(String.valueOf(detailMessage));
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(char)} of the char passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(char detailMessage) {
this(String.valueOf(detailMessage));
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(int)} of the int passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(int detailMessage) {
this(Integer.toString(detailMessage));
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(long)} of the long passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(long detailMessage) {
this(Long.toString(detailMessage));
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(float)} of the float passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(float detailMessage) {
this(Float.toString(detailMessage));
}
/**
- * <p>
* Constructs an instance with a message that is the
* {@link String#valueOf(double)} of the double passed.
- * </p>
*
- * @param detailMessage The value to be converted into the message.
+ * @param detailMessage
+ * The value to be converted into the message.
*/
public AssertionError(double detailMessage) {
this(Double.toString(detailMessage));
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Boolean.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Boolean.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Boolean.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Boolean.java Thu Jan 31 02:04:05 2008
@@ -20,9 +20,7 @@
import java.io.Serializable;
/**
- * <p>
* Boolean is the wrapper for the primitive type <code>boolean</code>.
- * </p>
*
* @since 1.0
*/
@@ -36,7 +34,7 @@
private final boolean value;
/**
- * The java.lang.Class that represents this class.
+ * The {@link java.lang.Class} that represents this class.
*/
@SuppressWarnings("unchecked")
public static final Class<Boolean> TYPE = (Class<Boolean>) new boolean[0]
@@ -95,6 +93,7 @@
* In this case, the argument must also be a Boolean, and the receiver and
* argument must represent the same boolean value (i.e. both true or both
* false).
+ * </p>
*
* @param o
* the object to compare with this object
@@ -110,18 +109,16 @@
}
/**
- * <p>
* Compares this <code>Boolean</code> to another <code>Boolean</code>.
* If this instance has the same value as the instance passed, then
* <code>0</code> is returned. If this instance is <code>true</code> and
* the instance passed is <code>false</code>, then a positive value is
* returned. If this instance is <code>false</code> and the instance
* passed is <code>true</code>, then a negative value is returned.
- * </p>
*
* @param that
* The instance to compare to.
- * @throws java.lang.NullPointerException
+ * @throws NullPointerException
* if <code>that</code> is <code>null</code>.
* @since 1.5
* @see java.lang.Comparable
@@ -144,7 +141,6 @@
* answer the same value for this method.
*
* @return the receiver's hash
- *
* @see #equals
*/
@Override
@@ -179,11 +175,9 @@
}
/**
- * <p>
* Parses the string as a <code>boolean</code>. If the string is not
* <code>null</code> and is equal to <code>"true"</code>, regardless
* case, then <code>true</code> is returned, otherwise <code>false</code>.
- * </p>
*
* @param s
* The string to parse.
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Byte.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Byte.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Byte.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Byte.java Thu Jan 31 02:04:05 2008
@@ -18,320 +18,315 @@
package java.lang;
/**
- * <p>Byte is the wrapper for the primitive type <code>byte</code>.</p>
+ * Byte is the wrapper for the primitive type <code>byte</code>.
+ *
* @since 1.1
*/
-public final class Byte extends Number implements Comparable<Byte> {
- private static final long serialVersionUID = -7183698231559129828L;
+public final class Byte extends Number implements Comparable<Byte> {
- /**
- * The value which the receiver represents.
- */
- private final byte value;
+ private static final long serialVersionUID = -7183698231559129828L;
- /**
- * <p>
+ /**
+ * The value which the receiver represents.
+ */
+ private final byte value;
+
+ /**
* Constant for the maximum <code>byte</code> value, 2<sup>7</sup>-1.
- * </p>
*/
public static final byte MAX_VALUE = (byte) 0x7F;
/**
- * <p>
* Constant for the minimum <code>byte</code> value, -2<sup>7</sup>.
- * </p>
*/
public static final byte MIN_VALUE = (byte) 0x80;
-
+
/**
- * <p>
* Constant for the number of bits to represent a <code>byte</code> in
* two's compliment form.
- * </p>
*
* @since 1.5
*/
public static final int SIZE = 8;
- /**
- * The java.lang.Class that represents this class.
- */
+ /**
+ * The java.lang.Class that represents this class.
+ */
@SuppressWarnings("unchecked")
public static final Class<Byte> TYPE = (Class<Byte>) new byte[0].getClass()
.getComponentType();
- // Note: This can't be set to "byte.class", since *that* is
- // defined to be "java.lang.Byte.TYPE";
-
+ // Note: This can't be set to "byte.class", since *that* is
+ // defined to be "java.lang.Byte.TYPE";
+
/**
- * <p>
* A cache of instances used by {@link #valueOf(byte)} and auto-boxing.
- * </p>
*/
private static final Byte[] CACHE = new Byte[256];
- /**
- * Constructs a new instance of the receiver which represents the byte
- * valued argument.
- *
- * @param value
- * the byte to store in the new instance.
- */
- public Byte(byte value) {
- this.value = value;
- }
-
- /**
- * Constructs a new instance of this class given a string.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public Byte(String string) throws NumberFormatException {
- this(parseByte(string));
- }
-
- /**
- * Answers the byte value which the receiver represents
- *
- * @return byte the value of the receiver.
- */
- @Override
+ /**
+ * Constructs a new instance of the receiver which represents the byte
+ * valued argument.
+ *
+ * @param value
+ * the byte to store in the new instance.
+ */
+ public Byte(byte value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a new instance of this class given a string.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public Byte(String string) throws NumberFormatException {
+ this(parseByte(string));
+ }
+
+ /**
+ * Answers the byte value which the receiver represents
+ *
+ * @return byte the value of the receiver.
+ */
+ @Override
public byte byteValue() {
- return value;
- }
+ return value;
+ }
- /**
- * <p>
+ /**
* Compares this <code>Byte</code> to the <code>Byte</code> passed. If
* this instance's value is equal to the value of the instance passed, then
* 0 is returned. If this instance's value is less than the value of the
* instance passed, then a negative value is returned. If this instance's
* value is greater than the value of the instance passed, then a positive
* value is returned.
- * </p>
*
- * @param object The instance to compare to.
- * @throws NullPointerException if <code>object</code> is
- * <code>null</code>.
+ * @param object
+ * The instance to compare to.
+ * @throws NullPointerException
+ * if <code>object</code> is <code>null</code>.
* @since 1.2
*/
public int compareTo(Byte object) {
return value > object.value ? 1 : (value < object.value ? -1 : 0);
}
- /**
- * Parses the string argument as if it was a byte value and returns the
- * result. It is an error if the received string does not contain a
- * representation of a single byte quantity. The string may be a hexadecimal
- * ("0x..."), octal ("0..."), or decimal ("...") representation of a byte.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @return Byte the value represented by the argument
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public static Byte decode(String string) throws NumberFormatException {
- int intValue = Integer.decode(string).intValue();
- byte result = (byte) intValue;
- if (result == intValue) {
+ /**
+ * Parses the string argument as if it was a byte value and returns the
+ * result. It is an error if the received string does not contain a
+ * representation of a single byte quantity. The string may be a hexadecimal
+ * ("0x..."), octal ("0..."), or decimal ("...") representation of a byte.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @return Byte the value represented by the argument
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public static Byte decode(String string) throws NumberFormatException {
+ int intValue = Integer.decode(string).intValue();
+ byte result = (byte) intValue;
+ if (result == intValue) {
return valueOf(result);
}
- throw new NumberFormatException();
- }
+ throw new NumberFormatException();
+ }
- /**
- * Answers the double value which the receiver represents
- *
- * @return double the value of the receiver.
- */
- @Override
+ /**
+ * Answers the double value which the receiver represents
+ *
+ * @return double the value of the receiver.
+ */
+ @Override
public double doubleValue() {
- return value;
- }
+ return value;
+ }
- /**
- * Compares the argument to the receiver, and answers true if they represent
- * the <em>same</em> object using a class specific comparison.
- * <p>
- * In this case, the argument must also be a Byte, and the receiver and
- * argument must represent the same byte value.
- *
- * @param object
- * the object to compare with this object
- * @return <code>true</code> if the object is the same as this object
- * <code>false</code> if it is different from this object
- * @see #hashCode
- */
- @Override
+ /**
+ * Compares the argument to the receiver, and answers true if they represent
+ * the <em>same</em> object using a class specific comparison.
+ * <p>
+ * In this case, the argument must also be a Byte, and the receiver and
+ * argument must represent the same byte value.
+ * </p>
+ *
+ * @param object
+ * the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object
+ * <code>false</code> if it is different from this object
+ * @see #hashCode
+ */
+ @Override
public boolean equals(Object object) {
- return (object == this) || (object instanceof Byte)
- && (value == ((Byte) object).value);
- }
-
- /**
- * Answers the float value which the receiver represents
- *
- * @return float the value of the receiver.
- */
- @Override
+ return (object == this) || (object instanceof Byte)
+ && (value == ((Byte) object).value);
+ }
+
+ /**
+ * Answers the float value which the receiver represents
+ *
+ * @return float the value of the receiver.
+ */
+ @Override
public float floatValue() {
- return value;
- }
+ return value;
+ }
- /**
- * Answers an integer hash code for the receiver. Any two objects which
- * answer <code>true</code> when passed to <code>equals</code> must
- * answer the same value for this method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
- @Override
+ /**
+ * Answers an integer hash code for the receiver. Any two objects which
+ * answer <code>true</code> when passed to <code>equals</code> must
+ * answer the same value for this method.
+ *
+ * @return the receiver's hash
+ * @see #equals
+ */
+ @Override
public int hashCode() {
- return value;
- }
+ return value;
+ }
- /**
- * Answers the int value which the receiver represents
- *
- * @return int the value of the receiver.
- */
- @Override
+ /**
+ * Answers the int value which the receiver represents
+ *
+ * @return int the value of the receiver.
+ */
+ @Override
public int intValue() {
- return value;
- }
+ return value;
+ }
- /**
- * Answers the long value which the receiver represents
- *
- * @return long the value of the receiver.
- */
- @Override
+ /**
+ * Answers the long value which the receiver represents
+ *
+ * @return long the value of the receiver.
+ */
+ @Override
public long longValue() {
- return value;
- }
+ return value;
+ }
- /**
- * Parses the string argument as if it was a byte value and returns the
- * result. Throws NumberFormatException if the string does not represent a
- * single byte quantity.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @return byte the value represented by the argument
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public static byte parseByte(String string) throws NumberFormatException {
- int intValue = Integer.parseInt(string);
- byte result = (byte) intValue;
- if (result == intValue) {
+ /**
+ * Parses the string argument as if it was a byte value and returns the
+ * result. Throws NumberFormatException if the string does not represent a
+ * single byte quantity.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @return byte the value represented by the argument
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public static byte parseByte(String string) throws NumberFormatException {
+ int intValue = Integer.parseInt(string);
+ byte result = (byte) intValue;
+ if (result == intValue) {
return result;
}
- throw new NumberFormatException();
- }
+ throw new NumberFormatException();
+ }
- /**
- * Parses the string argument as if it was a byte value and returns the
- * result. Throws NumberFormatException if the string does not represent a
- * single byte quantity. The second argument specifies the radix to use when
- * parsing the value.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @param radix
- * the radix to use when parsing.
- * @return byte the value represented by the argument
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public static byte parseByte(String string, int radix)
- throws NumberFormatException {
- int intValue = Integer.parseInt(string, radix);
- byte result = (byte) intValue;
- if (result == intValue) {
+ /**
+ * Parses the string argument as if it was a byte value and returns the
+ * result. Throws NumberFormatException if the string does not represent a
+ * single byte quantity. The second argument specifies the radix to use when
+ * parsing the value.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @param radix
+ * the radix to use when parsing.
+ * @return byte the value represented by the argument
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public static byte parseByte(String string, int radix)
+ throws NumberFormatException {
+ int intValue = Integer.parseInt(string, radix);
+ byte result = (byte) intValue;
+ if (result == intValue) {
return result;
}
- throw new NumberFormatException();
- }
+ throw new NumberFormatException();
+ }
- /**
- * Answers the short value which the receiver represents
- *
- * @return short the value of the receiver.
- */
- @Override
+ /**
+ * Answers the short value which the receiver represents
+ *
+ * @return short the value of the receiver.
+ */
+ @Override
public short shortValue() {
- return value;
- }
+ return value;
+ }
- /**
- * Answers a string containing a concise, human-readable description of the
- * receiver.
- *
- * @return a printable representation for the receiver.
- */
- @Override
+ /**
+ * Answers a string containing a concise, human-readable description of the
+ * receiver.
+ *
+ * @return a printable representation for the receiver.
+ */
+ @Override
public String toString() {
- return Integer.toString(value);
- }
+ return Integer.toString(value);
+ }
+
+ /**
+ * Answers a string containing a concise, human-readable description of the
+ * argument.
+ *
+ * @param value
+ * byte the byte to convert.
+ * @return String a printable representation for the byte.
+ */
+ public static String toString(byte value) {
+ return Integer.toString(value);
+ }
- /**
- * Answers a string containing a concise, human-readable description of the
- * argument.
- *
- * @param value
- * byte the byte to convert.
- * @return String a printable representation for the byte.
- */
- public static String toString(byte value) {
- return Integer.toString(value);
- }
-
- /**
- * Parses the string argument as if it was a byte value and returns a Byte
- * representing the result. Throws NumberFormatException if the string
- * cannot be parsed as a byte quantity.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @return Byte the value represented by the argument
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public static Byte valueOf(String string) throws NumberFormatException {
- return valueOf(parseByte(string));
- }
-
- /**
- * Parses the string argument as if it was a byte value and returns a Byte
- * representing the result. Throws NumberFormatException if the string
- * cannot be parsed as a byte quantity. The second argument specifies the
- * radix to use when parsing the value.
- *
- * @param string
- * a string representation of a single byte quantity.
- * @param radix
- * the radix to use when parsing.
- * @return Byte the value represented by the argument
- * @throws NumberFormatException
- * if the argument could not be parsed as a byte quantity.
- */
- public static Byte valueOf(String string, int radix)
- throws NumberFormatException {
- return valueOf(parseByte(string, radix));
- }
-
- /**
- * <p>Returns a <code>Byte</code> instance for the <code>byte</code> value passed.
- * This method is preferred over the constructor, as this method may maintain a cache
- * of instances.</p>
- * @param b The byte value.
+ /**
+ * Parses the string argument as if it was a byte value and returns a Byte
+ * representing the result. Throws NumberFormatException if the string
+ * cannot be parsed as a byte quantity.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @return Byte the value represented by the argument
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public static Byte valueOf(String string) throws NumberFormatException {
+ return valueOf(parseByte(string));
+ }
+
+ /**
+ * Parses the string argument as if it was a byte value and returns a Byte
+ * representing the result. Throws NumberFormatException if the string
+ * cannot be parsed as a byte quantity. The second argument specifies the
+ * radix to use when parsing the value.
+ *
+ * @param string
+ * a string representation of a single byte quantity.
+ * @param radix
+ * the radix to use when parsing.
+ * @return Byte the value represented by the argument
+ * @throws NumberFormatException
+ * if the argument could not be parsed as a byte quantity.
+ */
+ public static Byte valueOf(String string, int radix)
+ throws NumberFormatException {
+ return valueOf(parseByte(string, radix));
+ }
+
+ /**
+ * Returns a <code>Byte</code> instance for the <code>byte</code> value
+ * passed. This method is preferred over the constructor, as this method may
+ * maintain a cache of instances.
+ *
+ * @param b
+ * The byte value.
* @return A <code>Byte</code> instance.
* @since 1.5
*/
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/NumberFormatException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/NumberFormatException.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/NumberFormatException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/NumberFormatException.java Thu Jan 31 02:04:05 2008
@@ -17,30 +17,29 @@
package java.lang;
-
/**
* This runtime exception is thrown when a "string to number" conversion routine
* is passed an invalid value.
*/
-public class NumberFormatException extends java.lang.IllegalArgumentException {
+public class NumberFormatException extends IllegalArgumentException {
private static final long serialVersionUID = -2848938806368998894L;
/**
- * Constructs a new instance of this class with its walkback filled in.
- */
- public NumberFormatException() {
- super();
- }
+ * Constructs a new instance of this class with its walkback filled in.
+ */
+ public NumberFormatException() {
+ super();
+ }
- /**
- * Constructs a new instance of this class with its walkback and message
- * filled in.
- *
- * @param detailMessage
- * String The detail message for the exception.
- */
- public NumberFormatException(String detailMessage) {
- super(detailMessage);
- }
+ /**
+ * Constructs a new instance of this class with its walkback and message
+ * filled in.
+ *
+ * @param detailMessage
+ * String The detail message for the exception.
+ */
+ public NumberFormatException(String detailMessage) {
+ super(detailMessage);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/OutOfMemoryError.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/OutOfMemoryError.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/OutOfMemoryError.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/OutOfMemoryError.java Thu Jan 31 02:04:05 2008
@@ -24,7 +24,7 @@
* virtual machine which can not be satisfied using the available platform
* resources.
*/
-public class OutOfMemoryError extends java.lang.VirtualMachineError {
+public class OutOfMemoryError extends VirtualMachineError {
private static final long serialVersionUID = 8228564086184010517L;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Override.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Override.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Override.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Override.java Thu Jan 31 02:04:05 2008
@@ -22,11 +22,9 @@
import java.lang.annotation.Target;
/**
- * <p>
* An annotation to indicate that a method is intended to override a superclass
* method. This provides a compile-time assertion that a method actually
* overrides the superclass method.
- * </p>
*
* @since 1.5
*/
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Process.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Process.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Process.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/Process.java Thu Jan 31 02:04:05 2008
@@ -17,7 +17,6 @@
package java.lang;
-
import java.io.InputStream;
import java.io.OutputStream;
@@ -27,60 +26,60 @@
*/
public abstract class Process {
- /**
- * Terimates the receiver and closes any associated streams.
- */
- abstract public void destroy();
-
- /**
- * Answers the exit value of the receiving Process. It is available only
- * when the OS subprocess is finished.
- *
- * @return The exit value of the receiver.
- *
- * @throws IllegalThreadStateException
- * If the receiver has not terminated.
- */
- abstract public int exitValue();
-
- /**
- * Answers the receiver's error output stream.
- * <p>
- * Note: This is an InputStream which allows reading of the other threads
- * "stderr".
- *
- * @return The error stream associated with the receiver
- */
- abstract public InputStream getErrorStream();
-
- /**
- * Answers the receiver's standard input stream
- * <p>
- * Note: This is an InputStream which allows reading from the other process'
- * "stdout".
- *
- * @return The receiver's process' stdin.
- */
- abstract public InputStream getInputStream();
-
- /**
- * Answers the receiver's standard output stream
- * <p>
- * Note: This is an OutputStream which allows writing to the other process'
- * "stdin".
- *
- * @return The receiver's process' stdout.
- */
- abstract public OutputStream getOutputStream();
-
- /**
- * Causes the calling thread to wait for the process associated with the
- * receiver to finish executing.
- *
- * @return The exit value of the Process being waited on
- *
- * @throws InterruptedException
- * If the calling thread is interrupted
- */
- abstract public int waitFor() throws InterruptedException;
+ /**
+ * Terminates the receiver and closes any associated streams.
+ */
+ abstract public void destroy();
+
+ /**
+ * Answers the exit value of the receiving Process. It is available only
+ * when the OS subprocess is finished.
+ *
+ * @return The exit value of the receiver.
+ *
+ * @throws IllegalThreadStateException
+ * If the receiver has not terminated.
+ */
+ abstract public int exitValue();
+
+ /**
+ * Answers the receiver's error output stream.
+ * <p>
+ * Note: This is an InputStream which allows reading of the other threads
+ * "stderr".
+ *
+ * @return The error stream associated with the receiver
+ */
+ abstract public InputStream getErrorStream();
+
+ /**
+ * Answers the receiver's standard input stream
+ * <p>
+ * Note: This is an InputStream which allows reading from the other process'
+ * "stdout".
+ *
+ * @return The receiver's process' stdin.
+ */
+ abstract public InputStream getInputStream();
+
+ /**
+ * Answers the receiver's standard output stream
+ * <p>
+ * Note: This is an OutputStream which allows writing to the other process'
+ * "stdin".
+ *
+ * @return The receiver's process' stdout.
+ */
+ abstract public OutputStream getOutputStream();
+
+ /**
+ * Causes the calling thread to wait for the process associated with the
+ * receiver to finish executing.
+ *
+ * @return The exit value of the Process being waited on
+ *
+ * @throws InterruptedException
+ * If the calling thread is interrupted
+ */
+ abstract public int waitFor() throws InterruptedException;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuffer.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuffer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuffer.java Thu Jan 31 02:04:05 2008
@@ -155,8 +155,8 @@
* the integer
* @return this StringBuffer
*/
- public StringBuffer append(int i) {
- return append(Integer.toString(i));
+ public StringBuffer append(int value) {
+ return append(Integer.toString(value));
}
/**
@@ -203,7 +203,7 @@
/**
* Adds the specified StringBuffer to the end of this StringBuffer.
*
- * @param sbuffer
+ * @param sb
* the StringBuffer
* @return this StringBuffer
*
@@ -472,8 +472,8 @@
* when buffer is null
*/
@Override
- public synchronized void getChars(int start, int end, char[] buffer, int idx) {
- super.getChars(start, end, buffer, idx);
+ public synchronized void getChars(int start, int end, char[] buffer, int index) {
+ super.getChars(start, end, buffer, index);
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuilder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuilder.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuilder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/StringBuilder.java Thu Jan 31 02:04:05 2008
@@ -269,7 +269,7 @@
* according to the rule defined by {@link String#valueOf(char[])}.
* </p>
*
- * @param str The <code>char[]</code> value to append to this object.
+ * @param ch The <code>char[]</code> value to append to this object.
* @return A reference to this object.
*
* @see String#valueOf(char[])
@@ -443,7 +443,7 @@
* </p>
*
* @param offset The index of this object to insert the value.
- * @param b The <code>int</code> value to insert into this object.
+ * @param i The <code>int</code> value to insert into this object.
* @return A reference to this object.
*
* @throws StringIndexOutOfBoundsException if <code>offset</code> is
@@ -465,7 +465,7 @@
* </p>
*
* @param offset The index of this object to insert the value.
- * @param b The <code>long</code> value to insert into this object.
+ * @param l The <code>long</code> value to insert into this object.
* @return A reference to this object.
*
* @throws StringIndexOutOfBoundsException if <code>offset</code> is
@@ -487,7 +487,7 @@
* </p>
*
* @param offset The index of this object to insert the value.
- * @param b The <code>float</code> value to insert into this object.
+ * @param f The <code>float</code> value to insert into this object.
* @return A reference to this object.
*
* @throws StringIndexOutOfBoundsException if <code>offset</code> is
@@ -531,7 +531,7 @@
* </p>
*
* @param offset The index of this object to insert the value.
- * @param b The <code>Object</code> value to insert into this object.
+ * @param obj The <code>Object</code> value to insert into this object.
* @return A reference to this object.
*
* @throws StringIndexOutOfBoundsException if <code>offset</code> is
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Authenticator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Authenticator.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Authenticator.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Authenticator.java Thu Jan 31 02:04:05 2008
@@ -26,8 +26,8 @@
* It should override <code>getPasswordAuthentication()</code> which dictates
* how the authentication info should be obtained.
*
- * @see java.net.Authenticator.setDefault(java.net.ConnectionAuthenticator),
- * @see java.net.getPasswordAuthentication()
+ * @see Authenticator#setDefault(Authenticator)
+ * @see Authenticator#getPasswordAuthentication()
*/
public abstract class Authenticator {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/DatagramSocketImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/DatagramSocketImpl.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/DatagramSocketImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/DatagramSocketImpl.java Thu Jan 31 02:04:05 2008
@@ -135,7 +135,8 @@
*
* @param addr
* the multicast group to be joined
- * @@throws IOException may be thrown while joining a group
+ * @throws IOException
+ * may be thrown while joining a group
*/
protected abstract void join(InetAddress addr) throws IOException;
@@ -148,7 +149,8 @@
* the multicast group to be joined
* @param netInterface
* the network interface on which the addresses should be dropped
- * @@throws IOException may be thrown while joining a group
+ * @throws IOException
+ * may be thrown while joining a group
*/
protected abstract void joinGroup(SocketAddress addr,
NetworkInterface netInterface) throws IOException;
@@ -158,7 +160,8 @@
*
* @param addr
* the multicast group to be left
- * @@throws IOException May be thrown while leaving the group
+ * @throws IOException
+ * May be thrown while leaving the group
*/
protected abstract void leave(InetAddress addr) throws IOException;
@@ -169,7 +172,8 @@
* the multicast group to be left
* @param netInterface
* the network interface on which the addresses should be dropped
- * @@throws IOException May be thrown while leaving the group
+ * @throws IOException
+ * May be thrown while leaving the group
*/
protected abstract void leaveGroup(SocketAddress addr,
NetworkInterface netInterface) throws IOException;
@@ -224,7 +228,7 @@
*
* @param ttl
* the time-to-live, 0<ttl<= 255
- * @@throws IOException The exception thrown while setting the TTL
+ * @throws IOException The exception thrown while setting the TTL
*/
protected abstract void setTimeToLive(int ttl) throws IOException;
@@ -233,7 +237,7 @@
*
* @param ttl
* the time-to-live, 0<ttl<= 255
- * @@throws IOException The exception thrown while setting the TTL
+ * @throws IOException The exception thrown while setting the TTL
* @deprecated Replaced by setTimeToLive
* @see #setTimeToLive(int)
*/
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java Thu Jan 31 02:04:05 2008
@@ -594,11 +594,11 @@
if (array.length == 0) {
return -1;
}
- Comparable<Object> key = (Comparable<Object>) object;
+
int low = startIndex, mid = 0, high = endIndex - 1, result = 0;
while (low <= high) {
mid = (low + high) >>> 1;
- if ((result = key.compareTo(array[mid])) > 0) {
+ if ((result = ((Comparable<Object>)array[mid]).compareTo(object)) < 0){
low = mid + 1;
} else if (result == 0) {
return mid;
@@ -606,7 +606,7 @@
high = mid - 1;
}
}
- return -mid - (result <= 0 ? 1 : 2);
+ return -mid - (result >= 0 ? 1 : 2);
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java Thu Jan 31 02:04:05 2008
@@ -2017,7 +2017,7 @@
* calling rotate(list, 3) or rotate(list, -7) would modify the list to look
* like this: [8, 9, 0, 1, 2, 3, 4, 5, 6, 7]
*
- * @param list
+ * @param lst
* @param dist
* It can be any integer: 0, positive, negative, larger than the
* list size
@@ -2510,10 +2510,12 @@
/**
* Returns a dynamically typesafe view of the specified map.
*
- * @param c
+ * @param m
* the map
- * @param type
- * the type of the elements is permitted to insert
+ * @param keyType
+ * the type of keys permitted to be inserted
+ * @param valueType
+ * the type of values permitted to be inserted
*
* @return a typesafe map
*/
@@ -2525,7 +2527,7 @@
/**
* Returns a dynamically typesafe view of the specified list.
*
- * @param c
+ * @param list
* the list
* @param type
* the type of the elements is permitted to insert
@@ -2556,10 +2558,12 @@
/**
* Returns a dynamically typesafe view of the specified sorted map.
*
- * @param c
+ * @param m
* the sorted map
- * @param type
- * the type of the elements is permitted to insert
+ * @param keyType
+ * the type of keys permitted to be inserted
+ * @param valueType
+ * the type of values permitted to be inserted
*
* @return a typesafe sorted map
*/
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Currency.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Currency.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Currency.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Currency.java Thu Jan 31 02:04:05 2008
@@ -72,9 +72,14 @@
* if the locale's country is not a supported ISO 3166 Country
*/
public static Currency getInstance(Locale locale) {
- com.ibm.icu.util.Currency currency = com.ibm.icu.util.Currency.getInstance(locale);
- if(currency == null) {
+ com.ibm.icu.util.Currency currency = null;
+ try {
+ currency = com.ibm.icu.util.Currency.getInstance(locale);
+ } catch (IllegalArgumentException e) {
return null;
+ }
+ if (currency == null) {
+ throw new IllegalArgumentException(locale.getCountry());
}
String currencyCode = currency.getCurrencyCode();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Scanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Scanner.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Scanner.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Scanner.java Thu Jan 31 02:04:05 2008
@@ -1704,7 +1704,7 @@
/**
* Remove is not a supported operation on Scanner.
*
- * @throw UnsupportedOperationException if this method is invoked
+ * @throws UnsupportedOperationException if this method is invoked
*/
public void remove() {
throw new UnsupportedOperationException();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java Thu Jan 31 02:04:05 2008
@@ -100,7 +100,7 @@
* Returns the index of the first occurrence of the object.
*
* @return the index of the first occurrence of the object
- * @param o
+ * @param object
* the object to be searched
*/
public synchronized int search(Object object) {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/file/Handler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/file/Handler.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/file/Handler.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/file/Handler.java Thu Jan 31 02:04:05 2008
@@ -49,7 +49,7 @@
* The behaviour of this method is the same as openConnection(URL).
* <code>proxy</code> is not used in FileURLConnection.
*
- * @param u
+ * @param url
* the URL which the connection is pointing to
* @param proxy
* Proxy
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java Thu Jan 31 02:04:05 2008
@@ -189,11 +189,12 @@
}
/**
- * Answers the value corresponding to the specified key, null if no such key
- * exists.
+ * Answers the value corresponding to the specified key.
*
* @param key
- * @return
+ * the key to look up.
+ * @return Answers the value for the given key, or <code>null</code> if no
+ * such key exists.
*/
public String get(String key) {
LinkedList<String> result = keyTable.get(key.toLowerCase());
@@ -206,7 +207,7 @@
/**
* Answers the number of keys stored in this header
*
- * @return
+ * @return the number of keys.
*/
public int length() {
return props.size() / 2;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/Handler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/Handler.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/Handler.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/Handler.java Thu Jan 31 02:04:05 2008
@@ -36,8 +36,9 @@
* @param u
* java.net.URL The URL to which the connection is pointing to
*
- * @thows IOException thrown if an IO error occurs when this method tries to
- * establish connection.
+ * @throws IOException
+ * thrown if an IO error occurs when this method tries to
+ * establish connection.
*/
@Override
protected URLConnection openConnection(URL u) throws IOException {
@@ -75,7 +76,8 @@
file = file.substring(0, file.indexOf('!') + 1) + spec;
} else {
int idx = file.indexOf('!');
- String tmpFile = file.substring(idx + 1, file.lastIndexOf('/') + 1) + spec;
+ String tmpFile = file.substring(idx + 1, file.lastIndexOf('/') + 1)
+ + spec;
tmpFile = URLUtil.canonicalizePath(tmpFile);
file = file.substring(0, idx + 1) + tmpFile;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java Thu Jan 31 02:04:05 2008
@@ -17,6 +17,7 @@
package org.apache.harmony.luni.internal.reflect;
+import java.io.PrintStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
@@ -38,9 +39,7 @@
private static Method ObjectHashCodeMethod;
- private static Method ObjectToStringMethod;
-
- private static Method ClassForNameMethod;
+ private static Method ObjectToStringMethod;
private static Method ClassGetMethod;
@@ -54,8 +53,8 @@
public static byte[] generateBytes(String typeName, Class[] interfaces) {
ProxyClassFile classFile = new ProxyClassFile(typeName, interfaces);
- classFile.addFields();
classFile.findMethods(interfaces);
+ classFile.addFields();
classFile.addMethods();
classFile.addAttributes();
return classFile.getBytes();
@@ -139,9 +138,12 @@
private int constantPoolOffset;
private ProxyMethod[] proxyMethods;
+
+ private String typeName;
ProxyClassFile(String typeName, Class[] interfaces) {
super();
+ this.typeName = typeName;
header = new byte[INITIAL_HEADER_SIZE];
// generate the magic numbers inside the header
header[headerOffset++] = (byte) (0xCAFEBABEL >> 24);
@@ -152,7 +154,7 @@
header[headerOffset++] = 0;
header[headerOffset++] = 0;
header[headerOffset++] = 0;
- header[headerOffset++] = 46;
+ header[headerOffset++] = 49;
constantPoolOffset = headerOffset;
headerOffset += 2;
constantPool = new ProxyConstantPool(this);
@@ -190,14 +192,119 @@
header[constantPoolOffset] = (byte) constantPoolCount;
}
- private void addFields() {
- writeUnsignedShort(0); // we have no fields
+ private void writeStaticInitializer() {
+ writeUnsignedShort(AccStatic);
+ writeUnsignedShort(constantPool.literalIndex(new char[] {'<', 'c', 'l', 'i', 'n', 'i', 't', '>'}));
+ writeUnsignedShort(constantPool.literalIndex(new char[]{'(', ')','V'}));
+ writeUnsignedShort(1); //todo add Exceptions
+ generateCodeAttribute3();
+ }
+
+ private void completeCodeDescription(int codeLength, int offset, int maxLocals) {
+ writeUnsignedWord(codeLength + 8, offset);
+ writeUnsignedShort(maxLocals + 10, offset + 4);
+ writeUnsignedShort(maxLocals, offset + 6);
+ writeUnsignedWord(codeLength - 12, offset + 8);
+ }
+
+ private void initializeField(ProxyMethod m, int index) {
+ String methodName = m.method.getName();
+ Class[] params = m.method.getParameterTypes();
+ int paramLengths = params.length;
+ writeLdcWithClass(m.getDeclaringClass().getName());
+ writeLdc(methodName);
+ writeIntConstant(paramLengths);
+ writeUnsignedByte(OPC_anewarray);
+ writeUnsignedShort(constantPool.typeIndex("java/lang/Class"));
+ for (int i = 0; i < paramLengths; i++) {
+ writeUnsignedByte(OPC_dup);
+ writeIntConstant(i);
+ if (params[i].isPrimitive()) {
+ writeUnsignedByte(OPC_getstatic);
+ writeUnsignedShort(constantPool.literalIndex(typeWrapperName(params[i]),
+ "TYPE", Class.class));
+
+ } else {
+ writeLdcWithClass(params[i].getName());
+ }
+ writeUnsignedByte(OPC_aastore);
+ }
+
+ if (ClassGetMethod == null) {
+ try {
+ ClassGetMethod = Class.class.getMethod("getMethod",
+ new Class[] { String.class, Class[].class });
+ } catch (NoSuchMethodException e) {
+ throw new InternalError();
+ }
+ }
+ writeUnsignedByte(OPC_invokevirtual);
+ writeUnsignedShort(constantPool.literalIndex(ClassGetMethod));
+ writeUnsignedByte(OPC_putstatic);
+ writeUnsignedShort(constantPool.literalIndex(typeName,
+ getFieldNamebyMethodName(methodName, index),
+ Method.class));
+ }
+
+ private void generateCodeAttribute3() {
+ writeUnsignedShort(constantPool.literalIndex(CodeName));
+ int codeStart = contentsOffset;
+ writeUnsignedWord(0); //skip these fields so far
+ writeUnsignedWord(0);
+ writeUnsignedWord(0);
+ for (int i = 0; i < proxyMethods.length; i ++) {
+ initializeField(proxyMethods[i], i);
+ }
+ int gotoTarget = contentsOffset;
+ writeUnsignedByte(OPC_goto);
+ int targetForGotoOffset = contentsOffset;
+ writeUnsignedShort(4); //to be updated
+ int handlerStart = contentsOffset - codeStart - 12;
+ generateExceptionHandler();
+ gotoTarget = contentsOffset - gotoTarget;
+ writeUnsignedByte(OPC_return);
+ writeUnsignedShort(gotoTarget, targetForGotoOffset);
+ completeCodeDescription(contentsOffset - codeStart, codeStart, 1);
+ writeUnsignedShort(1);
+ writeUnsignedShort(0);
+ writeUnsignedShort(handlerStart);
+ writeUnsignedShort(handlerStart);
+ writeUnsignedShort(constantPool.typeIndex("java/lang/Exception"));
+ writeUnsignedShort(0); // there are no attributes for the code
+ }
+
+ //return handlerStart
+ private void generateExceptionHandler() {
+ //writeUnsignedByte(OPC_astore_0);
+ writeUnsignedByte(OPC_astore_0);
+ writeUnsignedByte(OPC_aload_0);
+
+ writeUnsignedByte(OPC_getstatic);
+ writeUnsignedShort(constantPool.literalIndex("java/lang/System",
+ "err",
+ PrintStream.class));
+ Method m = null;
+ try {
+ m = Exception.class.getMethod("printStackTrace", new Class[] {PrintStream.class});
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+
+ writeUnsignedByte(OPC_invokevirtual);
+ writeUnsignedShort(constantPool.literalIndex(m));
+ }
+
+
+ private String getFieldNamebyMethodName(String methodName, int index) {
+ return methodName + "Method" + index;
}
+
private void addMethods() {
int methodCount = proxyMethods.length;
- writeUnsignedShort(methodCount + 1);
-
+ writeUnsignedShort(methodCount + 2);
+
+
// save constructor
writeUnsignedShort(AccPublic);
writeUnsignedShort(constantPool.literalIndex(Init));
@@ -228,15 +335,15 @@
writeUnsignedShort(0); // no exceptions table
writeUnsignedShort(0); // there are no attributes for the code
// attribute
+
for (int i = 0; i < methodCount; i++) {
ProxyMethod pMethod = proxyMethods[i];
Method method = pMethod.method;
writeUnsignedShort(AccPublic | AccFinal);
- writeUnsignedShort(constantPool.literalIndex(method.getName()
- .toCharArray()));
- writeUnsignedShort(constantPool
- .literalIndex(getConstantPoolName(method)));
+ writeUnsignedShort(constantPool.literalIndex(method.getName().toCharArray()));
+ writeUnsignedShort(constantPool.literalIndex(getConstantPoolName(method)));
+
Class[] thrownsExceptions = pMethod.commonExceptions;
int eLength = thrownsExceptions.length;
if (eLength > 0) {
@@ -255,8 +362,10 @@
} else {
writeUnsignedShort(1); // store just the code attribute
}
- generateCodeAttribute(pMethod);
+ generateCodeAttribute(pMethod, i);
}
+
+ writeStaticInitializer();
}
private void findMethods(Class[] interfaces) {
@@ -280,9 +389,9 @@
}
ArrayList<ProxyMethod> allMethods = new ArrayList<ProxyMethod>(25);
- allMethods.add(new ProxyMethod(ObjectEqualsMethod));
- allMethods.add(new ProxyMethod(ObjectHashCodeMethod));
- allMethods.add(new ProxyMethod(ObjectToStringMethod));
+ allMethods.add(new ProxyMethod(Object.class, ObjectEqualsMethod));
+ allMethods.add(new ProxyMethod(Object.class, ObjectHashCodeMethod));
+ allMethods.add(new ProxyMethod(Object.class, ObjectToStringMethod));
HashSet<Class<?>> interfacesSeen = new HashSet<Class<?>>();
for (Class<?> element : interfaces) {
@@ -293,7 +402,20 @@
allMethods.toArray(proxyMethods);
}
- private void findMethods(Class<?> nextInterface,
+ private void addFields() {
+ //writeUnsignedShort(0); // we have no fields
+ int methodCount = proxyMethods.length;
+ writeUnsignedShort(methodCount);
+ for (int i = 0; i < methodCount; i ++) {
+ writeUnsignedShort(AccPublic | AccStatic);
+ String methodName = getFieldNamebyMethodName(proxyMethods[i].method.getName(), i);
+ writeUnsignedShort(constantPool.literalIndex(methodName.toCharArray()));
+ writeUnsignedShort(constantPool.literalIndex("Ljava/lang/reflect/Method;".toCharArray()));
+ writeUnsignedShort(0);
+ }
+ }
+
+ private void findMethods(Class<?> nextInterface,
ArrayList<ProxyMethod> allMethods, HashSet<Class<?>> interfacesSeen) {
/*
* add the nextInterface's methods to allMethods if an equivalent method
@@ -313,7 +435,7 @@
continue nextMethod;
}
}
- allMethods.add(new ProxyMethod(method));
+ allMethods.add(new ProxyMethod(nextInterface, method));
}
Class<?>[] superInterfaces = nextInterface.getInterfaces();
@@ -323,7 +445,7 @@
}
}
- private void generateCodeAttribute(ProxyMethod pMethod) {
+ private void generateCodeAttribute(ProxyMethod pMethod, int index) {
int codeAttributeOffset = contentsOffset;
int contentsLength = contents.length;
if (contentsOffset + 20 + 100 >= contentsLength) {
@@ -359,7 +481,9 @@
writeUnsignedByte(OPC_aload_0);
Method method = pMethod.method;
Class[] argTypes = method.getParameterTypes();
- genCallGetMethod(method.getDeclaringClass(), method.getName(), argTypes);
+ writeUnsignedByte(OPC_getstatic);
+ writeUnsignedShort(constantPool.literalIndex(typeName,
+ getFieldNamebyMethodName(pMethod.method.getName(), index),Method.class));
int maxLocals = genInvokeArgs(argTypes);
writeUnsignedByte(OPC_invokeinterface);
if (HandlerInvokeMethod == null) {
@@ -450,52 +574,7 @@
contents[codeAttributeOffset + 13] = (byte) codeLength;
}
- /**
- * Perform call to Class.getMethod(String, Class[]) receiver 13 ldc 37
- * (java.lang.String) "java.lang.Object" 15 invokestatic 43
- * java.lang.Class.forName(Ljava.lang.String;)Ljava.lang.Class; selector 37
- * ldc 55 (java.lang.String) "equals" plus method args 39 iconst0 40
- * anewarray 39 java.lang.Class or 39 iconst1 40 anewarray 39
- * java.lang.Class 43 dup 44 iconst0 53 ldc 37 (java.lang.String)
- * "java.lang.Object" 55 invokestatic 43
- * java.lang.Class.forName(Ljava.lang.String;)Ljava.lang.Class; 77 aastore
- * or 39 iconst2 40 anewarray 39 java.lang.Class 43 dup 44 iconst0 45
- * getstatic 102 java.lang.Integer.TYPE Ljava.lang.Class; 48 aastore 49 dup
- * 50 iconst1 51 getstatic 104 java.lang.Boolean.TYPE Ljava.lang.Class; 54
- * aastore then 78 invokevirtual 59
- * java.lang.Class.getMethod(Ljava.lang.String;[Ljava.lang.Class;)Ljava.lang.reflect.Method;
- */
- private void genCallGetMethod(Class<?> receiverType, String selector,
- Class[] argTypes) {
- genCallClassForName(receiverType.getName());
- writeLdc(selector);
- int length = argTypes.length;
- writeIntConstant(length);
- writeUnsignedByte(OPC_anewarray);
- writeUnsignedShort(constantPool.typeIndex("java/lang/Class"));
- for (int i = 0; i < length; i++) {
- writeUnsignedByte(OPC_dup);
- writeIntConstant(i);
- Class<?> type = argTypes[i];
- if (type.isPrimitive()) {
- writeUnsignedByte(OPC_getstatic);
- writeUnsignedShort(constantPool.literalIndex(typeField(type)));
- } else {
- genCallClassForName(type.getName());
- }
- writeUnsignedByte(OPC_aastore);
- }
- writeUnsignedByte(OPC_invokevirtual);
- if (ClassGetMethod == null) {
- try {
- ClassGetMethod = Class.class.getMethod("getMethod",
- new Class[] { String.class, Class[].class });
- } catch (NoSuchMethodException e) {
- throw new InternalError();
- }
- }
- writeUnsignedShort(constantPool.literalIndex(ClassGetMethod));
- }
+
/**
* Add argument array for call to InvocationHandler.invoke
@@ -669,21 +748,7 @@
writeUnsignedShort(constantPool.typeIndex(type.getName()));
writeUnsignedByte(OPC_areturn);
}
- }
-
- private void genCallClassForName(String typeName) {
- writeLdc(typeName);
- writeUnsignedByte(OPC_invokestatic);
- if (ClassForNameMethod == null) {
- try {
- ClassForNameMethod = Class.class.getMethod("forName",
- new Class[] { String.class });
- } catch (NoSuchMethodException e) {
- throw new InternalError();
- }
- }
- writeUnsignedShort(constantPool.literalIndex(ClassForNameMethod));
- }
+ }
private void genLoadArg(int argByteOffset) {
if (argByteOffset > 255) {
@@ -911,6 +976,20 @@
writeUnsignedByte(index);
}
}
+
+ private void writeLdcWithClass(String name) {
+ int index = constantPool.typeIndex(name);
+ if (index <= 0) {
+ throw new InternalError();
+ }
+ if (index > 255) {
+ writeUnsignedByte(OPC_ldc_w);
+ writeUnsignedShort(index);
+ } else {
+ writeUnsignedByte(OPC_ldc);
+ writeUnsignedByte(index);
+ }
+ }
private void writeUnsignedByte(int b) {
try {
@@ -921,7 +1000,7 @@
+ INCREMENT_SIZE]), 0, actualLength);
contents[contentsOffset - 1] = (byte) b;
}
- }
+ }
private void writeUnsignedShort(int b) {
writeUnsignedByte(b >>> 8);
@@ -934,4 +1013,28 @@
writeUnsignedByte(b >>> 8);
writeUnsignedByte(b);
}
+
+ private void writeUnsignedByte(int b, int offset) {
+ try {
+ contents[offset] = (byte) b;
+ } catch (IndexOutOfBoundsException e) {
+ int actualLength = contents.length;
+ System.arraycopy(contents, 0, (contents = new byte[actualLength
+ + INCREMENT_SIZE]), 0, actualLength);
+ contents[offset - 1] = (byte) b;
+ }
+ }
+
+ private void writeUnsignedShort(int b, int offset) {
+ writeUnsignedByte(b >>> 8, offset);
+ writeUnsignedByte(b, offset + 1);
+ }
+
+ private void writeUnsignedWord(int b, int offset) {
+ writeUnsignedByte(b >>> 24, offset);
+ writeUnsignedByte(b >>> 16, offset + 1);
+ writeUnsignedByte(b >>> 8, offset + 2);
+ writeUnsignedByte(b, offset + 3);
+ }
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyConstantPool.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyConstantPool.java Thu Jan 31 02:04:05 2008
@@ -121,23 +121,27 @@
}
return index;
}
-
- int literalIndex(Field aField) {
+
+ int literalIndex(Field aField) {
+ return literalIndex(aField.getDeclaringClass().getName(), aField.getName(), aField.getType());
+ }
+
+ int literalIndex(String declaringClass, String name, Class clazz) {
int index;
- if ((index = fieldCache.get(aField)) < 0) {
- int classIndex = typeIndex(aField.getDeclaringClass().getName());
+ String key = declaringClass + "." + name;
+ if ((index = fieldCache.get(key)) < 0) {
+ int classIndex = typeIndex(declaringClass);
int nameAndTypeIndex = literalIndexForNameAndType(
- literalIndex(aField.getName().toCharArray()),
- literalIndex(ProxyClassFile.getConstantPoolName(aField
- .getType())));
- index = fieldCache.put(aField, currentIndex++);
+ literalIndex(name.toCharArray()),
+ literalIndex(ProxyClassFile.getConstantPoolName(clazz)));
+ index = fieldCache.put(key, currentIndex++);
writeU1(FieldRefTag);
writeU2(classIndex);
writeU2(nameAndTypeIndex);
}
return index;
- }
-
+ }
+
int literalIndex(Constructor<?> aMethod) {
int index;
if ((index = methodCache.get(aMethod)) < 0) {
@@ -251,7 +255,7 @@
return index;
}
- private int literalIndexForNameAndType(int nameIndex, int typeIndex) {
+ int literalIndexForNameAndType(int nameIndex, int typeIndex) {
int index;
int[] key = new int[] { nameIndex, typeIndex };
if ((index = nameAndTypeCache.get(key)) == -1) {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyMethod.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyMethod.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyMethod.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyMethod.java Thu Jan 31 02:04:05 2008
@@ -23,10 +23,12 @@
class ProxyMethod {
Method method;
+ Class declaringClass;
Class[] commonExceptions;
- ProxyMethod(Method method) {
+ ProxyMethod(Class declaringClass, Method method) {
+ this.declaringClass = declaringClass;
this.method = method;
this.commonExceptions = method.getExceptionTypes();
}
@@ -127,6 +129,10 @@
}
}
return true;
+ }
+
+ Class getDeclaringClass() {
+ return declaringClass;
}
}