diff options
41 files changed, 1207 insertions, 1213 deletions
diff --git a/luni/src/main/java/java/io/ObjectInputStream.java b/luni/src/main/java/java/io/ObjectInputStream.java index abe07ee..b7a3584 100644 --- a/luni/src/main/java/java/io/ObjectInputStream.java +++ b/luni/src/main/java/java/io/ObjectInputStream.java @@ -2182,7 +2182,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput, if (enableResolve) { result = resolveObject(result); } - registerObjectRead(result, nextHandle(), unshared); + registerObjectRead(result, nextHandle(), unshared); return result; } diff --git a/luni/src/main/java/java/lang/Short.java b/luni/src/main/java/java/lang/Short.java index e2e7d61..fd7bca0 100644 --- a/luni/src/main/java/java/lang/Short.java +++ b/luni/src/main/java/java/lang/Short.java @@ -25,7 +25,7 @@ package java.lang; */ public final class Short extends Number implements Comparable<Short> { - private static final long serialVersionUID = 7515723908773894738L; + private static final long serialVersionUID = 7515723908773894738L; /** * The value which the receiver represents. @@ -69,9 +69,9 @@ public final class Short extends Number implements Comparable<Short> { * if {@code string} can not be decoded into a short value. * @see #parseShort(String) */ - public Short(String string) throws NumberFormatException { - this(parseShort(string)); - } + public Short(String string) throws NumberFormatException { + this(parseShort(string)); + } /** * Constructs a new {@code Short} with the specified primitive short value. @@ -79,14 +79,14 @@ public final class Short extends Number implements Comparable<Short> { * @param value * the primitive short value to store in the new instance. */ - public Short(short value) { - this.value = value; - } + public Short(short value) { + this.value = value; + } - @Override + @Override public byte byteValue() { - return (byte) value; - } + return (byte) value; + } /** * Compares this object to the specified short object to determine their @@ -103,9 +103,9 @@ public final class Short extends Number implements Comparable<Short> { * @see java.lang.Comparable * @since 1.2 */ - public int compareTo(Short object) { - return value > object.value ? 1 : (value < object.value ? -1 : 0); - } + public int compareTo(Short object) { + return value > object.value ? 1 : (value < object.value ? -1 : 0); + } /** * Parses the specified string and returns a {@code Short} instance if the @@ -120,19 +120,19 @@ public final class Short extends Number implements Comparable<Short> { * @throws NumberFormatException * if {@code string} can not be parsed as a short value. */ - public static Short decode(String string) throws NumberFormatException { - int intValue = Integer.decode(string).intValue(); - short result = (short) intValue; - if (result == intValue) { + public static Short decode(String string) throws NumberFormatException { + int intValue = Integer.decode(string).intValue(); + short result = (short) intValue; + if (result == intValue) { return valueOf(result); } - throw new NumberFormatException(); - } + throw new NumberFormatException(); + } - @Override + @Override public double doubleValue() { - return value; - } + return value; + } /** * Compares this instance with the specified object and indicates if they @@ -144,31 +144,31 @@ public final class Short extends Number implements Comparable<Short> { * @return {@code true} if the specified object is equal to this * {@code Short}; {@code false} otherwise. */ - @Override + @Override public boolean equals(Object object) { - return (object instanceof Short) - && (value == ((Short) object).value); - } + return (object instanceof Short) + && (value == ((Short) object).value); + } - @Override + @Override public float floatValue() { - return value; - } + return value; + } - @Override + @Override public int hashCode() { - return value; - } + return value; + } - @Override + @Override public int intValue() { - return value; - } + return value; + } - @Override + @Override public long longValue() { - return value; - } + return value; + } /** * Parses the specified string as a signed decimal short value. The ASCII @@ -181,9 +181,9 @@ public final class Short extends Number implements Comparable<Short> { * if {@code string} is {@code null}, has a length of zero or * can not be parsed as a short value. */ - public static short parseShort(String string) throws NumberFormatException { - return parseShort(string, 10); - } + public static short parseShort(String string) throws NumberFormatException { + return parseShort(string, 10); + } /** * Parses the specified string as a signed short value using the specified @@ -201,15 +201,15 @@ public final class Short extends Number implements Comparable<Short> { * {@code radix > Character.MAX_RADIX}, or if {@code string} * can not be parsed as a short value. */ - public static short parseShort(String string, int radix) - throws NumberFormatException { - int intValue = Integer.parseInt(string, radix); - short result = (short) intValue; - if (result == intValue) { + public static short parseShort(String string, int radix) + throws NumberFormatException { + int intValue = Integer.parseInt(string, radix); + short result = (short) intValue; + if (result == intValue) { return result; } - throw new NumberFormatException(); - } + throw new NumberFormatException(); + } /** * Gets the primitive value of this short. @@ -218,13 +218,13 @@ public final class Short extends Number implements Comparable<Short> { */ @Override public short shortValue() { - return value; - } + return value; + } - @Override + @Override public String toString() { - return Integer.toString(value); - } + return Integer.toString(value); + } /** * Returns a string containing a concise, human-readable description of the @@ -234,9 +234,9 @@ public final class Short extends Number implements Comparable<Short> { * the short to convert to a string. * @return a printable representation of {@code value}. */ - public static String toString(short value) { - return Integer.toString(value); - } + public static String toString(short value) { + return Integer.toString(value); + } /** * Parses the specified string as a signed decimal short value. @@ -250,9 +250,9 @@ public final class Short extends Number implements Comparable<Short> { * can not be parsed as a short value. * @see #parseShort(String) */ - public static Short valueOf(String string) throws NumberFormatException { - return valueOf(parseShort(string)); - } + public static Short valueOf(String string) throws NumberFormatException { + return valueOf(parseShort(string)); + } /** * Parses the specified string as a signed short value using the specified @@ -271,10 +271,10 @@ public final class Short extends Number implements Comparable<Short> { * can not be parsed as a short value. * @see #parseShort(String, int) */ - public static Short valueOf(String string, int radix) - throws NumberFormatException { - return valueOf(parseShort(string, radix)); - } + public static Short valueOf(String string, int radix) + throws NumberFormatException { + return valueOf(parseShort(string, radix)); + } /** * Reverses the bytes of the specified short. diff --git a/luni/src/main/java/java/lang/Void.java b/luni/src/main/java/java/lang/Void.java index 5699dee..aa08839 100644 --- a/luni/src/main/java/java/lang/Void.java +++ b/luni/src/main/java/java/lang/Void.java @@ -46,6 +46,6 @@ public final class Void extends Object { return (Class<Void>) voidType; } - private Void() { - } + private Void() { + } } diff --git a/luni/src/main/java/java/net/URL.java b/luni/src/main/java/java/net/URL.java index 184fc83..44874d3 100644 --- a/luni/src/main/java/java/net/URL.java +++ b/luni/src/main/java/java/net/URL.java @@ -244,7 +244,7 @@ public final class URL implements java.io.Serializable { index = -1; } else { // Ignore case in protocol names. - // Scheme is defined by ASCII characters. + // Scheme is defined by ASCII characters. protocol = Util.toASCIILowerCase(protocol); } } diff --git a/luni/src/main/java/java/security/DigestInputStream.java b/luni/src/main/java/java/security/DigestInputStream.java index d25f8db..480239a 100644 --- a/luni/src/main/java/java/security/DigestInputStream.java +++ b/luni/src/main/java/java/security/DigestInputStream.java @@ -131,7 +131,7 @@ public class DigestInputStream extends FilterInputStream { * @param on * {@code true} if the digest should be computed, {@code false} * otherwise. - * @see MessageDigest + * @see MessageDigest */ public void on(boolean on) { isOn = on; diff --git a/luni/src/main/java/java/security/DigestOutputStream.java b/luni/src/main/java/java/security/DigestOutputStream.java index ec5872c..014a413 100644 --- a/luni/src/main/java/java/security/DigestOutputStream.java +++ b/luni/src/main/java/java/security/DigestOutputStream.java @@ -116,7 +116,7 @@ public class DigestOutputStream extends FilterOutputStream { * @param on * {@code true} if the digest should be computed, {@code false} * otherwise. - * @see MessageDigest + * @see MessageDigest */ public void on(boolean on) { isOn = on; diff --git a/luni/src/main/java/java/security/KeyStore.java b/luni/src/main/java/java/security/KeyStore.java index 341fbf4..7816405 100644 --- a/luni/src/main/java/java/security/KeyStore.java +++ b/luni/src/main/java/java/security/KeyStore.java @@ -1231,9 +1231,9 @@ public class KeyStore { * the password, maybe {@code null}. */ public PasswordProtection(char[] password) { - if (password != null) { - this.password = password.clone(); - } + if (password != null) { + this.password = password.clone(); + } } /** diff --git a/luni/src/main/java/java/security/Provider.java b/luni/src/main/java/java/security/Provider.java index 735f84d..c107374 100644 --- a/luni/src/main/java/java/security/Provider.java +++ b/luni/src/main/java/java/security/Provider.java @@ -861,8 +861,8 @@ public abstract class Provider extends Properties { @SuppressWarnings("nls") private void putProviderInfo() { super.put("Provider.id name", null != name ? name : "null"); - super.put("Provider.id version", versionString); - super.put("Provider.id info", null != info ? info : "null"); + super.put("Provider.id version", versionString); + super.put("Provider.id info", null != info ? info : "null"); super.put("Provider.id className", this.getClass().getName()); } @@ -1157,7 +1157,7 @@ public abstract class Provider extends Properties { } private void readObject(java.io.ObjectInputStream in) throws NotActiveException, IOException, ClassNotFoundException { - in.defaultReadObject(); + in.defaultReadObject(); versionString = String.valueOf(version); providerNumber = -1; } diff --git a/luni/src/main/java/java/security/UnresolvedPermission.java b/luni/src/main/java/java/security/UnresolvedPermission.java index cb01c53..898cccb 100644 --- a/luni/src/main/java/java/security/UnresolvedPermission.java +++ b/luni/src/main/java/java/security/UnresolvedPermission.java @@ -154,10 +154,10 @@ public final class UnresolvedPermission extends Permission if (length > 0) { boolean found; for (int i = 0; i < length; i++) { - // Skip the checking for null - if(certs1[i] == null){ - continue; - } + // Skip the checking for null + if(certs1[i] == null){ + continue; + } found = false; for (int j = 0; j < length; j++) { if (certs1[i].equals(certs2[j])) { @@ -172,9 +172,9 @@ public final class UnresolvedPermission extends Permission } for (int i = 0; i < length; i++) { - if(certs2[i] == null){ - continue; - } + if(certs2[i] == null){ + continue; + } found = false; for (int j = 0; j < length; j++) { if (certs2[i].equals(certs1[j])) { diff --git a/luni/src/main/java/java/security/UnresolvedPermissionCollection.java b/luni/src/main/java/java/security/UnresolvedPermissionCollection.java index d21d6e4..1a6da62 100644 --- a/luni/src/main/java/java/security/UnresolvedPermissionCollection.java +++ b/luni/src/main/java/java/security/UnresolvedPermissionCollection.java @@ -157,7 +157,7 @@ final class UnresolvedPermissionCollection extends PermissionCollection { private void writeObject(java.io.ObjectOutputStream out) throws IOException { Hashtable permissions = new Hashtable(); for (Iterator iter = klasses.entrySet().iterator(); iter.hasNext();) { - Map.Entry entry = (Map.Entry) iter.next(); + Map.Entry entry = (Map.Entry) iter.next(); String key = (String) entry.getKey(); permissions.put(key, new Vector(((Collection) entry.getValue()))); } @@ -176,22 +176,22 @@ final class UnresolvedPermissionCollection extends PermissionCollection { klasses = new HashMap(); synchronized (klasses) { for (Iterator iter = permissions.entrySet().iterator(); iter - .hasNext();) { - Map.Entry entry = (Map.Entry) iter.next(); - String key = (String) entry.getKey(); - Collection values = (Collection) entry.getValue(); + .hasNext();) { + Map.Entry entry = (Map.Entry) iter.next(); + String key = (String) entry.getKey(); + Collection values = (Collection) entry.getValue(); - for (Iterator iterator = values.iterator(); iterator.hasNext();) { - UnresolvedPermission element = - (UnresolvedPermission) iterator.next(); + for (Iterator iterator = values.iterator(); iterator.hasNext();) { + UnresolvedPermission element = + (UnresolvedPermission) iterator.next(); - if (!element.getName().equals(key)) { - throw new InvalidObjectException( - Messages.getString("security.22")); - } - } - klasses.put(key, new HashSet(values)); - } + if (!element.getName().equals(key)) { + throw new InvalidObjectException( + Messages.getString("security.22")); + } + } + klasses.put(key, new HashSet(values)); + } } } }
\ No newline at end of file diff --git a/luni/src/main/java/java/security/cert/CollectionCertStoreParameters.java b/luni/src/main/java/java/security/cert/CollectionCertStoreParameters.java index cdd0a06..54b944b 100644 --- a/luni/src/main/java/java/security/cert/CollectionCertStoreParameters.java +++ b/luni/src/main/java/java/security/cert/CollectionCertStoreParameters.java @@ -72,10 +72,10 @@ public class CollectionCertStoreParameters implements CertStoreParameters { */ public Object clone() { try { - return super.clone(); - } catch (CloneNotSupportedException e) { - return null; - } + return super.clone(); + } catch (CloneNotSupportedException e) { + return null; + } } /** diff --git a/luni/src/main/java/java/security/cert/LDAPCertStoreParameters.java b/luni/src/main/java/java/security/cert/LDAPCertStoreParameters.java index d9d1982..90a396e 100644 --- a/luni/src/main/java/java/security/cert/LDAPCertStoreParameters.java +++ b/luni/src/main/java/java/security/cert/LDAPCertStoreParameters.java @@ -84,11 +84,11 @@ public class LDAPCertStoreParameters implements CertStoreParameters { * @return the cloned instance. */ public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - return null; - } + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + return null; + } } /** diff --git a/luni/src/main/java/java/security/cert/X509CRLSelector.java b/luni/src/main/java/java/security/cert/X509CRLSelector.java index 5d3ecf7..d79b557 100644 --- a/luni/src/main/java/java/security/cert/X509CRLSelector.java +++ b/luni/src/main/java/java/security/cert/X509CRLSelector.java @@ -452,14 +452,14 @@ public class X509CRLSelector implements CRLSelector { public Object clone() { X509CRLSelector result; - try { - result = (X509CRLSelector) super.clone(); - if (issuerNames != null) { - result.issuerNames = new ArrayList<String>(issuerNames); - } - } catch (CloneNotSupportedException e) { - result = null; - } + try { + result = (X509CRLSelector) super.clone(); + if (issuerNames != null) { + result.issuerNames = new ArrayList<String>(issuerNames); + } + } catch (CloneNotSupportedException e) { + result = null; + } return result; } } diff --git a/luni/src/main/java/java/security/cert/X509CertSelector.java b/luni/src/main/java/java/security/cert/X509CertSelector.java index f66515f..cbf2d57 100644 --- a/luni/src/main/java/java/security/cert/X509CertSelector.java +++ b/luni/src/main/java/java/security/cert/X509CertSelector.java @@ -1379,11 +1379,11 @@ public class X509CertSelector implements CertSelector { public Object clone() { X509CertSelector result; - try { - result = (X509CertSelector) super.clone(); - } catch (CloneNotSupportedException e) { - return null; - } + try { + result = (X509CertSelector) super.clone(); + } catch (CloneNotSupportedException e) { + return null; + } if (this.subjectKeyIdentifier != null) { result.subjectKeyIdentifier = diff --git a/luni/src/main/java/java/util/LinkedList.java b/luni/src/main/java/java/util/LinkedList.java index 4056b8e..6a9ae9b 100644 --- a/luni/src/main/java/java/util/LinkedList.java +++ b/luni/src/main/java/java/util/LinkedList.java @@ -181,14 +181,14 @@ public class LinkedList<E> extends AbstractSequentialList<E> implements } } - /* - * NOTES:descendingIterator is not fail-fast, according to the documentation - * and test case. - */ - private class ReverseLinkIterator<ET> implements Iterator<ET> { - private int expectedModCount; - - private final LinkedList<ET> list; + /* + * NOTES:descendingIterator is not fail-fast, according to the documentation + * and test case. + */ + private class ReverseLinkIterator<ET> implements Iterator<ET> { + private int expectedModCount; + + private final LinkedList<ET> list; private Link<ET> link; diff --git a/luni/src/main/java/java/util/Timer.java b/luni/src/main/java/java/util/Timer.java index bd5e0d0..105d5e7 100644 --- a/luni/src/main/java/java/util/Timer.java +++ b/luni/src/main/java/java/util/Timer.java @@ -322,28 +322,28 @@ public class Timer { } - private static final class FinalizerHelper { - private final TimerImpl impl; - - FinalizerHelper(TimerImpl impl) { - super(); - this.impl = impl; - } - - @Override - protected void finalize() { - synchronized (impl) { - impl.finished = true; - impl.notify(); - } - } - } - - private static long timerId; - - private synchronized static long nextId() { - return timerId++; - } + private static final class FinalizerHelper { + private final TimerImpl impl; + + FinalizerHelper(TimerImpl impl) { + super(); + this.impl = impl; + } + + @Override + protected void finalize() { + synchronized (impl) { + impl.finished = true; + impl.notify(); + } + } + } + + private static long timerId; + + private synchronized static long nextId() { + return timerId++; + } /* This object will be used in synchronization purposes */ private final TimerImpl impl; @@ -361,10 +361,10 @@ public class Timer { * @throws NullPointerException is {@code name} is {@code null} */ public Timer(String name, boolean isDaemon) { - super(); - if (name == null){ - throw new NullPointerException("name is null"); - } + super(); + if (name == null){ + throw new NullPointerException("name is null"); + } this.impl = new TimerImpl(name, isDaemon); this.finalizer = new FinalizerHelper(impl); } diff --git a/luni/src/main/java/java/util/prefs/XMLParser.java b/luni/src/main/java/java/util/prefs/XMLParser.java index 986429d..25d9556 100644 --- a/luni/src/main/java/java/util/prefs/XMLParser.java +++ b/luni/src/main/java/java/util/prefs/XMLParser.java @@ -474,7 +474,7 @@ class XMLParser { * load preferences from file, if cannot load, create a new one FIXME: need * lock or not? * - * @param file the XML file to be read + * @param file the XML file to be read * @return Properties instance which indicates the preferences key-value pairs */ static Properties loadFilePrefs(final File file) { diff --git a/luni/src/main/java/javax/xml/datatype/DatatypeConstants.java b/luni/src/main/java/javax/xml/datatype/DatatypeConstants.java index 4c2d271..f21bc7f 100644 --- a/luni/src/main/java/javax/xml/datatype/DatatypeConstants.java +++ b/luni/src/main/java/javax/xml/datatype/DatatypeConstants.java @@ -31,238 +31,238 @@ import javax.xml.namespace.QName; */ public final class DatatypeConstants { - + /** * <p>Private constructor to prevent instantiation.</p> */ - private DatatypeConstants() { - } - - /** - * Value for first month of year. - */ - public static final int JANUARY = 1; - - /** - * Value for second month of year. - */ - public static final int FEBRUARY = 2; - - /** - * Value for third month of year. - */ - public static final int MARCH = 3; - - /** - * Value for fourth month of year. - */ - public static final int APRIL = 4; - - /** - * Value for fifth month of year. - */ - public static final int MAY = 5; - - /** - * Value for sixth month of year. - */ - public static final int JUNE = 6; - - /** - * Value for seventh month of year. - */ - public static final int JULY = 7; - - /** - * Value for eighth month of year. - */ - public static final int AUGUST = 8; - - /** - * Value for ninth month of year. - */ - public static final int SEPTEMBER = 9; - - /** - * Value for tenth month of year. - */ - public static final int OCTOBER = 10; - - /** - * Value for eleven month of year. - */ - public static final int NOVEMBER = 11; - - /** - * Value for twelve month of year. - */ - public static final int DECEMBER = 12; - - /** - * <p>Comparison result.</p> - */ - public static final int LESSER = -1; - - /** - * <p>Comparison result.</p> - */ - public static final int EQUAL = 0; - - /** - * <p>Comparison result.</p> - */ - public static final int GREATER = 1; - - /** - * <p>Comparison result.</p> - */ - public static final int INDETERMINATE = 2; - - /** - * Designation that an "int" field is not set. - */ - public static final int FIELD_UNDEFINED = Integer.MIN_VALUE; - - /** - * <p>A constant that represents the years field.</p> - */ - public static final Field YEARS = new Field("YEARS", 0); + private DatatypeConstants() { + } + + /** + * Value for first month of year. + */ + public static final int JANUARY = 1; + + /** + * Value for second month of year. + */ + public static final int FEBRUARY = 2; + + /** + * Value for third month of year. + */ + public static final int MARCH = 3; + + /** + * Value for fourth month of year. + */ + public static final int APRIL = 4; + + /** + * Value for fifth month of year. + */ + public static final int MAY = 5; + + /** + * Value for sixth month of year. + */ + public static final int JUNE = 6; + + /** + * Value for seventh month of year. + */ + public static final int JULY = 7; + + /** + * Value for eighth month of year. + */ + public static final int AUGUST = 8; + + /** + * Value for ninth month of year. + */ + public static final int SEPTEMBER = 9; + + /** + * Value for tenth month of year. + */ + public static final int OCTOBER = 10; + + /** + * Value for eleven month of year. + */ + public static final int NOVEMBER = 11; + + /** + * Value for twelve month of year. + */ + public static final int DECEMBER = 12; + + /** + * <p>Comparison result.</p> + */ + public static final int LESSER = -1; + + /** + * <p>Comparison result.</p> + */ + public static final int EQUAL = 0; + + /** + * <p>Comparison result.</p> + */ + public static final int GREATER = 1; + + /** + * <p>Comparison result.</p> + */ + public static final int INDETERMINATE = 2; + + /** + * Designation that an "int" field is not set. + */ + public static final int FIELD_UNDEFINED = Integer.MIN_VALUE; + + /** + * <p>A constant that represents the years field.</p> + */ + public static final Field YEARS = new Field("YEARS", 0); - /** - * <p>A constant that represents the months field.</p> - */ - public static final Field MONTHS = new Field("MONTHS", 1); + /** + * <p>A constant that represents the months field.</p> + */ + public static final Field MONTHS = new Field("MONTHS", 1); - /** - * <p>A constant that represents the days field.</p> - */ - public static final Field DAYS = new Field("DAYS", 2); + /** + * <p>A constant that represents the days field.</p> + */ + public static final Field DAYS = new Field("DAYS", 2); - /** - * <p>A constant that represents the hours field.</p> - */ - public static final Field HOURS = new Field("HOURS", 3); + /** + * <p>A constant that represents the hours field.</p> + */ + public static final Field HOURS = new Field("HOURS", 3); - /** - * <p>A constant that represents the minutes field.</p> - */ - public static final Field MINUTES = new Field("MINUTES", 4); + /** + * <p>A constant that represents the minutes field.</p> + */ + public static final Field MINUTES = new Field("MINUTES", 4); - /** - * <p>A constant that represents the seconds field.</p> - */ - public static final Field SECONDS = new Field("SECONDS", 5); + /** + * <p>A constant that represents the seconds field.</p> + */ + public static final Field SECONDS = new Field("SECONDS", 5); - /** - * Type-safe enum class that represents six fields - * of the {@link Duration} class. - */ - public static final class Field { + /** + * Type-safe enum class that represents six fields + * of the {@link Duration} class. + */ + public static final class Field { + + /** + * <p><code>String</code> representation of <ode>Field</code>.</p> + */ + private final String str; + /** + * <p>Unique id of the field.</p> + * + * <p>This value allows the {@link Duration} class to use switch + * statements to process fields.</p> + */ + private final int id; - /** - * <p><code>String</code> representation of <ode>Field</code>.</p> - */ - private final String str; - /** - * <p>Unique id of the field.</p> - * - * <p>This value allows the {@link Duration} class to use switch - * statements to process fields.</p> - */ - private final int id; + /** + * <p>Construct a <code>Field</code> with specified values.</p> + * @param str <code>String</code> representation of <code>Field</code> + * @param id <code>int</code> representation of <code>Field</code> + */ + private Field(final String str, final int id) { + this.str = str; + this.id = id; + } + /** + * Returns a field name in English. This method + * is intended to be used for debugging/diagnosis + * and not for display to end-users. + * + * @return + * a non-null valid String constant. + */ + public String toString() { return str; } - /** - * <p>Construct a <code>Field</code> with specified values.</p> - * @param str <code>String</code> representation of <code>Field</code> - * @param id <code>int</code> representation of <code>Field</code> - */ - private Field(final String str, final int id) { - this.str = str; - this.id = id; - } - /** - * Returns a field name in English. This method - * is intended to be used for debugging/diagnosis - * and not for display to end-users. - * - * @return - * a non-null valid String constant. - */ - public String toString() { return str; } - - /** - * <p>Get id of this Field.</p> - * - * @return Id of field. - */ - public int getId() { - return id; - } - } - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p> - */ - public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p> - */ - public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p> - */ - public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p> - */ - public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p> - */ - public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p> - */ - public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p> - */ - public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth"); - - /** - * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p> - */ - public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay"); - - /** - * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p> - */ - public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration"); - - /** - * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p> - */ - public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration"); - - /** - * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p> - */ - public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration"); - - /** - * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes. - */ - public static final int MAX_TIMEZONE_OFFSET = -14 * 60; - - /** - * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes. - */ - public static final int MIN_TIMEZONE_OFFSET = 14 * 60; - + /** + * <p>Get id of this Field.</p> + * + * @return Id of field. + */ + public int getId() { + return id; + } + } + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p> + */ + public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p> + */ + public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p> + */ + public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p> + */ + public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p> + */ + public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p> + */ + public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p> + */ + public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth"); + + /** + * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p> + */ + public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay"); + + /** + * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p> + */ + public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration"); + + /** + * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p> + */ + public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration"); + + /** + * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p> + */ + public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration"); + + /** + * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes. + */ + public static final int MAX_TIMEZONE_OFFSET = -14 * 60; + + /** + * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes. + */ + public static final int MIN_TIMEZONE_OFFSET = 14 * 60; + } diff --git a/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java b/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java index fb302dc..cbf3108 100644 --- a/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java +++ b/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java @@ -455,7 +455,7 @@ public abstract class DatatypeFactory { * * @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. * @throws UnsupportedOperationException If implementation cannot support requested values. - */ + */ public Duration newDurationDayTime( final boolean isPositive, final BigInteger day, @@ -497,7 +497,7 @@ public abstract class DatatypeFactory { * and <code>second</code>. * * @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. - */ + */ public Duration newDurationDayTime( final boolean isPositive, final int day, @@ -609,7 +609,7 @@ public abstract class DatatypeFactory { * * @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. * @throws UnsupportedOperationException If implementation cannot support requested values. - */ + */ public Duration newDurationYearMonth( final boolean isPositive, final BigInteger year, @@ -642,7 +642,7 @@ public abstract class DatatypeFactory { * @return New <code>Duration</code> created using the specified <code>year</code> and <code>month</code>. * * @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. - */ + */ public Duration newDurationYearMonth( final boolean isPositive, final int year, diff --git a/luni/src/main/java/javax/xml/datatype/Duration.java b/luni/src/main/java/javax/xml/datatype/Duration.java index 8eed4d5..e5b4a12 100644 --- a/luni/src/main/java/javax/xml/datatype/Duration.java +++ b/luni/src/main/java/javax/xml/datatype/Duration.java @@ -700,7 +700,7 @@ public abstract class Duration { * @return * always return a non-null valid <code>Duration</code> object. */ - public abstract Duration negate(); + public abstract Duration negate(); /** * <p>Converts the years and months fields into the days field diff --git a/luni/src/main/java/javax/xml/datatype/FactoryFinder.java b/luni/src/main/java/javax/xml/datatype/FactoryFinder.java index ddea15b..175b5f3 100644 --- a/luni/src/main/java/javax/xml/datatype/FactoryFinder.java +++ b/luni/src/main/java/javax/xml/datatype/FactoryFinder.java @@ -38,12 +38,12 @@ import java.util.Properties; * @since 1.5 */ final class FactoryFinder { - - /** - * <p>Name of class to display in output messages.</p> - */ - private static final String CLASS_NAME = "javax.xml.datatype.FactoryFinder"; - + + /** + * <p>Name of class to display in output messages.</p> + */ + private static final String CLASS_NAME = "javax.xml.datatype.FactoryFinder"; + /** * <p>Debug flag to trace loading process.</p> */ @@ -52,25 +52,25 @@ final class FactoryFinder { /** * <p>Cache properties for performance.</p> */ - private static Properties cacheProps = new Properties(); - - /** - * <p>First time requires initialization overhead.</p> - */ - private static boolean firstTime = true; + private static Properties cacheProps = new Properties(); + + /** + * <p>First time requires initialization overhead.</p> + */ + private static boolean firstTime = true; /** * Default columns per line. */ private static final int DEFAULT_LINE_LENGTH = 80; - - /** - * <p>Check to see if debugging enabled by property.</p> - * - * <p>Use try/catch block to support applets, which throws + + /** + * <p>Check to see if debugging enabled by property.</p> + * + * <p>Use try/catch block to support applets, which throws * SecurityException out of this code.</p> - * - */ + * + */ static { try { String val = SecuritySupport.getSystemProperty("jaxp.debug"); @@ -83,17 +83,17 @@ final class FactoryFinder { private FactoryFinder() {} - /** - * <p>Output debugging messages.</p> - * - * @param msg <code>String</code> to print to <code>stderr</code>. - */ + /** + * <p>Output debugging messages.</p> + * + * @param msg <code>String</code> to print to <code>stderr</code>. + */ private static void debugPrintln(String msg) { if (debug) { System.err.println( - CLASS_NAME - + ":" - + msg); + CLASS_NAME + + ":" + + msg); } } @@ -142,10 +142,10 @@ final class FactoryFinder { * @throws ConfigurationError If class could not be created. */ static Object newInstance( - String className, + String className, ClassLoader classLoader) throws ConfigurationError { - + try { Class spiClass; if (classLoader == null) { @@ -155,7 +155,7 @@ final class FactoryFinder { } if (debug) { - debugPrintln("Loaded " + className + " from " + which(spiClass)); + debugPrintln("Loaded " + className + " from " + which(spiClass)); } return spiClass.newInstance(); @@ -183,7 +183,7 @@ final class FactoryFinder { */ static Object find(String factoryId, String fallbackClassName) throws ConfigurationError { - + ClassLoader classLoader = findClassLoader(); // Use the system property first @@ -194,35 +194,35 @@ final class FactoryFinder { return newInstance(systemProp, classLoader); } } catch (SecurityException se) { - ; // NOP, explicitly ignore SecurityException + ; // NOP, explicitly ignore SecurityException } // try to read from $java.home/lib/jaxp.properties try { String javah = SecuritySupport.getSystemProperty("java.home"); String configFile = javah + File.separator + "lib" + File.separator + "jaxp.properties"; - String factoryClassName = null; - if (firstTime) { - synchronized (cacheProps) { - if (firstTime) { - File f = new File(configFile); - firstTime = false; - if (SecuritySupport.doesFileExist(f)) { - if (debug) debugPrintln("Read properties file " + f); - cacheProps.load(SecuritySupport.getFileInputStream(f)); - } - } - } - } - factoryClassName = cacheProps.getProperty(factoryId); + String factoryClassName = null; + if (firstTime) { + synchronized (cacheProps) { + if (firstTime) { + File f = new File(configFile); + firstTime = false; + if (SecuritySupport.doesFileExist(f)) { + if (debug) debugPrintln("Read properties file " + f); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(factoryId); if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); - - if (factoryClassName != null) { - return newInstance(factoryClassName, classLoader); - } + + if (factoryClassName != null) { + return newInstance(factoryClassName, classLoader); + } } catch (Exception ex) { if (debug) { - ex.printStackTrace(); + ex.printStackTrace(); } } @@ -316,16 +316,16 @@ final class FactoryFinder { return null; } - /** - * <p>Configuration Error.</p> - */ + /** + * <p>Configuration Error.</p> + */ static class ConfigurationError extends Error { private static final long serialVersionUID = -3644413026244211347L; - - /** - * <p>Exception that caused the error.</p> - */ + + /** + * <p>Exception that caused the error.</p> + */ private Exception exception; /** @@ -340,11 +340,11 @@ final class FactoryFinder { this.exception = x; } - /** - * <p>Get the Exception that caused the error.</p> - * - * @return Exception that caused the error. - */ + /** + * <p>Get the Exception that caused the error.</p> + * + * @return Exception that caused the error. + */ Exception getException() { return exception; } @@ -368,13 +368,13 @@ final class FactoryFinder { URL it; if (loader != null) { - it = loader.getResource(classnameAsResource); + it = loader.getResource(classnameAsResource); } else { - it = ClassLoader.getSystemResource(classnameAsResource); + it = ClassLoader.getSystemResource(classnameAsResource); } if (it != null) { - return it.toString(); + return it.toString(); } } // The VM ran out of memory or there was some other serious problem. Re-throw. @@ -388,7 +388,7 @@ final class FactoryFinder { catch (Throwable t) { // work defensively. if (debug) { - t.printStackTrace(); + t.printStackTrace(); } } return "unknown location"; diff --git a/luni/src/main/java/javax/xml/datatype/SecuritySupport.java b/luni/src/main/java/javax/xml/datatype/SecuritySupport.java index da82748..98eac32 100644 --- a/luni/src/main/java/javax/xml/datatype/SecuritySupport.java +++ b/luni/src/main/java/javax/xml/datatype/SecuritySupport.java @@ -40,20 +40,20 @@ final class SecuritySupport { private SecuritySupport() {} static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); } static String getSystemProperty(final String propName) { - return (String) + return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); @@ -64,16 +64,16 @@ final class SecuritySupport { static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { + try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } } static InputStream getResourceAsStream(final ClassLoader cl, diff --git a/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java b/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java index c2ff3e6..6d047fe 100644 --- a/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java +++ b/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java @@ -176,70 +176,70 @@ import java.util.GregorianCalendar; */ public abstract class XMLGregorianCalendar - implements Cloneable { + implements Cloneable { - /** - * <p>Unset all fields to undefined.</p> - * - * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields - * to null.</p> - */ - public abstract void clear(); + /** + * <p>Unset all fields to undefined.</p> + * + * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields + * to null.</p> + */ + public abstract void clear(); - /** - * <p>Reset this <code>XMLGregorianCalendar</code> to its original values.</p> - * - * <p><code>XMLGregorianCalendar</code> is reset to the same values as when it was created with - * {@link DatatypeFactory#newXMLGregorianCalendar()}, - * {@link DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)}, - * {@link DatatypeFactory#newXMLGregorianCalendar( - * BigInteger year, - * int month, - * int day, - * int hour, - * int minute, - * int second, - * BigDecimal fractionalSecond, - * int timezone)}, - * {@link DatatypeFactory#newXMLGregorianCalendar( - * int year, - * int month, - * int day, - * int hour, - * int minute, - * int second, - * int millisecond, - * int timezone)}, - * {@link DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)}, - * {@link DatatypeFactory#newXMLGregorianCalendarDate( - * int year, - * int month, - * int day, - * int timezone)}, - * {@link DatatypeFactory#newXMLGregorianCalendarTime( - * int hours, - * int minutes, - * int seconds, - * int timezone)}, - * {@link DatatypeFactory#newXMLGregorianCalendarTime( - * int hours, - * int minutes, - * int seconds, - * BigDecimal fractionalSecond, - * int timezone)} or - * {@link DatatypeFactory#newXMLGregorianCalendarTime( - * int hours, - * int minutes, - * int seconds, - * int milliseconds, - * int timezone)}. - * </p> - * - * <p><code>reset()</code> is designed to allow the reuse of existing <code>XMLGregorianCalendar</code>s - * thus saving resources associated with the creation of new <code>XMLGregorianCalendar</code>s.</p> - */ - public abstract void reset(); - + /** + * <p>Reset this <code>XMLGregorianCalendar</code> to its original values.</p> + * + * <p><code>XMLGregorianCalendar</code> is reset to the same values as when it was created with + * {@link DatatypeFactory#newXMLGregorianCalendar()}, + * {@link DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)}, + * {@link DatatypeFactory#newXMLGregorianCalendar( + * BigInteger year, + * int month, + * int day, + * int hour, + * int minute, + * int second, + * BigDecimal fractionalSecond, + * int timezone)}, + * {@link DatatypeFactory#newXMLGregorianCalendar( + * int year, + * int month, + * int day, + * int hour, + * int minute, + * int second, + * int millisecond, + * int timezone)}, + * {@link DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)}, + * {@link DatatypeFactory#newXMLGregorianCalendarDate( + * int year, + * int month, + * int day, + * int timezone)}, + * {@link DatatypeFactory#newXMLGregorianCalendarTime( + * int hours, + * int minutes, + * int seconds, + * int timezone)}, + * {@link DatatypeFactory#newXMLGregorianCalendarTime( + * int hours, + * int minutes, + * int seconds, + * BigDecimal fractionalSecond, + * int timezone)} or + * {@link DatatypeFactory#newXMLGregorianCalendarTime( + * int hours, + * int minutes, + * int seconds, + * int milliseconds, + * int timezone)}. + * </p> + * + * <p><code>reset()</code> is designed to allow the reuse of existing <code>XMLGregorianCalendar</code>s + * thus saving resources associated with the creation of new <code>XMLGregorianCalendar</code>s.</p> + */ + public abstract void reset(); + /** * <p>Set low and high order component of XSD <code>dateTime</code> year field.</p> * @@ -325,76 +325,76 @@ public abstract class XMLGregorianCalendar * <a href="#datetimefieldmapping">date/time field mapping table</a>. */ public void setTime(int hour, int minute, int second) { - - setTime( - hour, - minute, - second, - null // fractional - ); + + setTime( + hour, + minute, + second, + null // fractional + ); } - /** - * <p>Set hours.</p> - * - * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * @param hour value constraints summarized in <a href="#datetimefield-hour">hour field of date/time field mapping table</a>. - * - * @throws IllegalArgumentException if <code>hour</code> parameter is outside value constraints for the field as specified in - * <a href="#datetimefieldmapping">date/time field mapping table</a>. - */ - public abstract void setHour(int hour); + /** + * <p>Set hours.</p> + * + * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * @param hour value constraints summarized in <a href="#datetimefield-hour">hour field of date/time field mapping table</a>. + * + * @throws IllegalArgumentException if <code>hour</code> parameter is outside value constraints for the field as specified in + * <a href="#datetimefieldmapping">date/time field mapping table</a>. + */ + public abstract void setHour(int hour); - /** - * <p>Set minutes.</p> - * - * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * @param minute value constraints summarized in <a href="#datetimefield-minute">minute field of date/time field mapping table</a>. - * - * @throws IllegalArgumentException if <code>minute</code> parameter is outside value constraints for the field as specified in - * <a href="#datetimefieldmapping">date/time field mapping table</a>. - */ - public abstract void setMinute(int minute); + /** + * <p>Set minutes.</p> + * + * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * @param minute value constraints summarized in <a href="#datetimefield-minute">minute field of date/time field mapping table</a>. + * + * @throws IllegalArgumentException if <code>minute</code> parameter is outside value constraints for the field as specified in + * <a href="#datetimefieldmapping">date/time field mapping table</a>. + */ + public abstract void setMinute(int minute); - /** - * <p>Set seconds.</p> - * - * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * @param second value constraints summarized in <a href="#datetimefield-second">second field of date/time field mapping table</a>. - * - * @throws IllegalArgumentException if <code>second</code> parameter is outside value constraints for the field as specified in - * <a href="#datetimefieldmapping">date/time field mapping table</a>. - */ - public abstract void setSecond(int second); - - /** - * <p>Set milliseconds.</p> - * - * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * @param millisecond value constraints summarized in - * <a href="#datetimefield-millisecond">millisecond field of date/time field mapping table</a>. - * - * @throws IllegalArgumentException if <code>millisecond</code> parameter is outside value constraints for the field as specified - * in <a href="#datetimefieldmapping">date/time field mapping table</a>. - */ - public abstract void setMillisecond(int millisecond); + /** + * <p>Set seconds.</p> + * + * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * @param second value constraints summarized in <a href="#datetimefield-second">second field of date/time field mapping table</a>. + * + * @throws IllegalArgumentException if <code>second</code> parameter is outside value constraints for the field as specified in + * <a href="#datetimefieldmapping">date/time field mapping table</a>. + */ + public abstract void setSecond(int second); + + /** + * <p>Set milliseconds.</p> + * + * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * @param millisecond value constraints summarized in + * <a href="#datetimefield-millisecond">millisecond field of date/time field mapping table</a>. + * + * @throws IllegalArgumentException if <code>millisecond</code> parameter is outside value constraints for the field as specified + * in <a href="#datetimefieldmapping">date/time field mapping table</a>. + */ + public abstract void setMillisecond(int millisecond); - /** - * <p>Set fractional seconds.</p> - * - * <p>Unset this field by invoking the setter with a parameter value of <code>null</code>.</p> - * - * @param fractional value constraints summarized in - * <a href="#datetimefield-fractional">fractional field of date/time field mapping table</a>. - * - * @throws IllegalArgumentException if <code>fractional</code> parameter is outside value constraints for the field as specified - * in <a href="#datetimefieldmapping">date/time field mapping table</a>. - */ - public abstract void setFractionalSecond(BigDecimal fractional); + /** + * <p>Set fractional seconds.</p> + * + * <p>Unset this field by invoking the setter with a parameter value of <code>null</code>.</p> + * + * @param fractional value constraints summarized in + * <a href="#datetimefield-fractional">fractional field of date/time field mapping table</a>. + * + * @throws IllegalArgumentException if <code>fractional</code> parameter is outside value constraints for the field as specified + * in <a href="#datetimefieldmapping">date/time field mapping table</a>. + */ + public abstract void setFractionalSecond(BigDecimal fractional); /** * <p>Set time as one unit, including the optional infinite precision @@ -418,8 +418,8 @@ public abstract class XMLGregorianCalendar int minute, int second, BigDecimal fractional) { - - setHour(hour); + + setHour(hour); setMinute(minute); setSecond(second); setFractionalSecond(fractional); @@ -442,180 +442,180 @@ public abstract class XMLGregorianCalendar * <a href="#datetimefieldmapping">date/time field mapping table</a>. */ public void setTime(int hour, int minute, int second, int millisecond) { - + setHour(hour); setMinute(minute); setSecond(second); setMillisecond(millisecond); } - /** - * <p>Return high order component for XML Schema 1.0 dateTime datatype field for - * <code>year</code>. - * <code>null</code> if this optional part of the year field is not defined.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> - * @return eon of this <code>XMLGregorianCalendar</code>. The value - * returned is an integer multiple of 10^9. - * - * @see #getYear() - * @see #getEonAndYear() - */ - public abstract BigInteger getEon(); + /** + * <p>Return high order component for XML Schema 1.0 dateTime datatype field for + * <code>year</code>. + * <code>null</code> if this optional part of the year field is not defined.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> + * @return eon of this <code>XMLGregorianCalendar</code>. The value + * returned is an integer multiple of 10^9. + * + * @see #getYear() + * @see #getEonAndYear() + */ + public abstract BigInteger getEon(); - /** - * <p>Return low order component for XML Schema 1.0 dateTime datatype field for - * <code>year</code> or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> - * - * @return year of this <code>XMLGregorianCalendar</code>. - * - * @see #getEon() - * @see #getEonAndYear() - */ - public abstract int getYear(); + /** + * <p>Return low order component for XML Schema 1.0 dateTime datatype field for + * <code>year</code> or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> + * + * @return year of this <code>XMLGregorianCalendar</code>. + * + * @see #getEon() + * @see #getEonAndYear() + */ + public abstract int getYear(); - /** - * <p>Return XML Schema 1.0 dateTime datatype field for - * <code>year</code>.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> - * - * @return sum of <code>eon</code> and <code>BigInteger.valueOf(year)</code> - * when both fields are defined. When only <code>year</code> is defined, - * return it. When both <code>eon</code> and <code>year</code> are not - * defined, return <code>null</code>. - * - * @see #getEon() - * @see #getYear() - */ - public abstract BigInteger getEonAndYear(); + /** + * <p>Return XML Schema 1.0 dateTime datatype field for + * <code>year</code>.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p> + * + * @return sum of <code>eon</code> and <code>BigInteger.valueOf(year)</code> + * when both fields are defined. When only <code>year</code> is defined, + * return it. When both <code>eon</code> and <code>year</code> are not + * defined, return <code>null</code>. + * + * @see #getEon() + * @see #getYear() + */ + public abstract BigInteger getEonAndYear(); - /** - * <p>Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-month">month field of date/time field mapping table</a>.</p> - * - * @return year of this <code>XMLGregorianCalendar</code>. - * - */ - public abstract int getMonth(); + /** + * <p>Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-month">month field of date/time field mapping table</a>.</p> + * + * @return year of this <code>XMLGregorianCalendar</code>. + * + */ + public abstract int getMonth(); - /** - * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-day">day field of date/time field mapping table</a>.</p> - * - * @see #setDay(int) - */ - public abstract int getDay(); + /** + * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-day">day field of date/time field mapping table</a>.</p> + * + * @see #setDay(int) + */ + public abstract int getDay(); - /** - * Return timezone offset in minutes or - * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined. - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>.</p> - * - * @see #setTimezone(int) - */ - public abstract int getTimezone(); + /** + * Return timezone offset in minutes or + * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined. + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>.</p> + * + * @see #setTimezone(int) + */ + public abstract int getTimezone(); - /** - * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. - * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.</p> - * @see #setTime(int, int, int) - */ - public abstract int getHour(); + /** + * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. + * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.</p> + * @see #setTime(int, int, int) + */ + public abstract int getHour(); - /** - * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.</p> - * @see #setTime(int, int, int) - */ - public abstract int getMinute(); + /** + * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.</p> + * @see #setTime(int, int, int) + */ + public abstract int getMinute(); - /** - * <p>Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * <p>Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. - * When this field is not defined, the optional xs:dateTime - * fractional seconds field, represented by - * {@link #getFractionalSecond()} and {@link #getMillisecond()}, - * must not be defined.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> - * - * @return Second of this <code>XMLGregorianCalendar</code>. - * - * @see #getFractionalSecond() - * @see #getMillisecond() - * @see #setTime(int, int, int) - */ - public abstract int getSecond(); + /** + * <p>Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * <p>Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * When this field is not defined, the optional xs:dateTime + * fractional seconds field, represented by + * {@link #getFractionalSecond()} and {@link #getMillisecond()}, + * must not be defined.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> + * + * @return Second of this <code>XMLGregorianCalendar</code>. + * + * @see #getFractionalSecond() + * @see #getMillisecond() + * @see #setTime(int, int, int) + */ + public abstract int getSecond(); - /** - * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> - * - * <p>This method represents a convenience accessor to infinite - * precision fractional second value returned by - * {@link #getFractionalSecond()}. The returned value is the rounded - * down to milliseconds value of - * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} - * returns <code>null</code>, this method must return - * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * <p>Value constraints for this value are summarized in - * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> - * - * @return Millisecond of this <code>XMLGregorianCalendar</code>. - * - * @see #getFractionalSecond() - * @see #setTime(int, int, int) - */ - public int getMillisecond() { - - BigDecimal fractionalSeconds = getFractionalSecond(); - - // is field undefined? - if (fractionalSeconds == null) { - return DatatypeConstants.FIELD_UNDEFINED; - } - - return getFractionalSecond().movePointRight(3).intValue(); - } + /** + * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> + * + * <p>This method represents a convenience accessor to infinite + * precision fractional second value returned by + * {@link #getFractionalSecond()}. The returned value is the rounded + * down to milliseconds value of + * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} + * returns <code>null</code>, this method must return + * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * <p>Value constraints for this value are summarized in + * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> + * + * @return Millisecond of this <code>XMLGregorianCalendar</code>. + * + * @see #getFractionalSecond() + * @see #setTime(int, int, int) + */ + public int getMillisecond() { + + BigDecimal fractionalSeconds = getFractionalSecond(); + + // is field undefined? + if (fractionalSeconds == null) { + return DatatypeConstants.FIELD_UNDEFINED; + } + + return getFractionalSecond().movePointRight(3).intValue(); + } - /** - * <p>Return fractional seconds.</p> - * - * <p><code>null</code> is returned when this optional field is not defined.</p> - * - * <p>Value constraints are detailed in - * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> - * - * <p>This optional field can only have a defined value when the - * xs:dateTime second field, represented by {@link #getSecond()}, - * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.</p> - * - * @return fractional seconds of this <code>XMLGregorianCalendar</code>. - * - * @see #getSecond() - * @see #setTime(int, int, int, BigDecimal) - */ - public abstract BigDecimal getFractionalSecond(); + /** + * <p>Return fractional seconds.</p> + * + * <p><code>null</code> is returned when this optional field is not defined.</p> + * + * <p>Value constraints are detailed in + * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> + * + * <p>This optional field can only have a defined value when the + * xs:dateTime second field, represented by {@link #getSecond()}, + * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.</p> + * + * @return fractional seconds of this <code>XMLGregorianCalendar</code>. + * + * @see #getSecond() + * @see #setTime(int, int, int, BigDecimal) + */ + public abstract BigDecimal getFractionalSecond(); // comparisons /** @@ -677,7 +677,7 @@ public abstract class XMLGregorianCalendar public int hashCode() { // Following two dates compare to EQUALS since in different timezones. - // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 + // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. @@ -826,21 +826,21 @@ public abstract class XMLGregorianCalendar */ public abstract QName getXMLSchemaType(); - /** - * <p>Returns a <code>String</code> representation of this <code>XMLGregorianCalendar</code> <code>Object</code>.</p> - * - * <p>The result is a lexical representation generated by {@link #toXMLFormat()}.</p> - * - * @return A non-<code>null</code> valid <code>String</code> representation of this <code>XMLGregorianCalendar</code>. - * + /** + * <p>Returns a <code>String</code> representation of this <code>XMLGregorianCalendar</code> <code>Object</code>.</p> + * + * <p>The result is a lexical representation generated by {@link #toXMLFormat()}.</p> + * + * @return A non-<code>null</code> valid <code>String</code> representation of this <code>XMLGregorianCalendar</code>. + * * @throws IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. * * @see #toXMLFormat() - */ + */ public String toString() { - - return toXMLFormat(); + + return toXMLFormat(); } /** @@ -1006,9 +1006,9 @@ public abstract class XMLGregorianCalendar * @return a java.util.GregorianCalendar conversion of this instance. */ public abstract GregorianCalendar toGregorianCalendar( - java.util.TimeZone timezone, - java.util.Locale aLocale, - XMLGregorianCalendar defaults); + java.util.TimeZone timezone, + java.util.Locale aLocale, + XMLGregorianCalendar defaults); /** * <p>Returns a <code>java.util.TimeZone</code> for this class.</p> diff --git a/luni/src/main/java/javax/xml/namespace/QName.java b/luni/src/main/java/javax/xml/namespace/QName.java index 8fd5f07..b0272e7 100644 --- a/luni/src/main/java/javax/xml/namespace/QName.java +++ b/luni/src/main/java/javax/xml/namespace/QName.java @@ -351,28 +351,28 @@ public class QName implements Serializable { return namespaceURI.hashCode() ^ localPart.hashCode(); } - /** - * <p><code>String</code> representation of this - * <code>QName</code>.</p> - * - * <p>The commonly accepted way of representing a <code>QName</code> - * as a <code>String</code> was <a href="http://jclark.com/xml/xmlns.htm">defined</a> - * by James Clark. Although this is not a <em>standard</em> - * specification, it is in common use, e.g. {@link javax.xml.transform.Transformer#setParameter(String name, Object value)}. - * This implementation represents a <code>QName</code> as: - * "{" + Namespace URI + "}" + local part. If the Namespace URI - * <code>.equals(XMLConstants.NULL_NS_URI)</code>, only the - * local part is returned. An appropriate use of this method is - * for debugging or logging for human consumption.</p> - * - * <p>Note the prefix value is <strong><em>NOT</em></strong> - * returned as part of the <code>String</code> representation.</p> - * - * <p>This method satisfies the general contract of {@link - * java.lang.Object#toString() Object.toString()}.</p> - * - * @return <code>String</code> representation of this <code>QName</code> - */ + /** + * <p><code>String</code> representation of this + * <code>QName</code>.</p> + * + * <p>The commonly accepted way of representing a <code>QName</code> + * as a <code>String</code> was <a href="http://jclark.com/xml/xmlns.htm">defined</a> + * by James Clark. Although this is not a <em>standard</em> + * specification, it is in common use, e.g. {@link javax.xml.transform.Transformer#setParameter(String name, Object value)}. + * This implementation represents a <code>QName</code> as: + * "{" + Namespace URI + "}" + local part. If the Namespace URI + * <code>.equals(XMLConstants.NULL_NS_URI)</code>, only the + * local part is returned. An appropriate use of this method is + * for debugging or logging for human consumption.</p> + * + * <p>Note the prefix value is <strong><em>NOT</em></strong> + * returned as part of the <code>String</code> representation.</p> + * + * <p>This method satisfies the general contract of {@link + * java.lang.Object#toString() Object.toString()}.</p> + * + * @return <code>String</code> representation of this <code>QName</code> + */ public String toString() { String _qNameAsString = qNameAsString; if (_qNameAsString == null) { diff --git a/luni/src/main/java/javax/xml/parsers/DocumentBuilder.java b/luni/src/main/java/javax/xml/parsers/DocumentBuilder.java index 1f0163b..6fc393f 100644 --- a/luni/src/main/java/javax/xml/parsers/DocumentBuilder.java +++ b/luni/src/main/java/javax/xml/parsers/DocumentBuilder.java @@ -62,29 +62,29 @@ public abstract class DocumentBuilder { protected DocumentBuilder () { } - /** - * <p>Reset this <code>DocumentBuilder</code> to its original configuration.</p> - * - * <p><code>DocumentBuilder</code> is reset to the same state as when it was created with - * {@link DocumentBuilderFactory#newDocumentBuilder()}. - * <code>reset()</code> is designed to allow the reuse of existing <code>DocumentBuilder</code>s - * thus saving resources associated with the creation of new <code>DocumentBuilder</code>s.</p> - * - * <p>The reset <code>DocumentBuilder</code> is not guaranteed to have the same {@link EntityResolver} or {@link ErrorHandler} - * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal - * <code>EntityResolver</code> and <code>ErrorHandler</code>.</p> - * - * @since 1.5 - */ - public void reset() { - - // implementors should override this method - throw new UnsupportedOperationException( - "This DocumentBuilder, \"" + this.getClass().getName() + "\", does not support the reset functionality." - + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" - + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" - ); - } + /** + * <p>Reset this <code>DocumentBuilder</code> to its original configuration.</p> + * + * <p><code>DocumentBuilder</code> is reset to the same state as when it was created with + * {@link DocumentBuilderFactory#newDocumentBuilder()}. + * <code>reset()</code> is designed to allow the reuse of existing <code>DocumentBuilder</code>s + * thus saving resources associated with the creation of new <code>DocumentBuilder</code>s.</p> + * + * <p>The reset <code>DocumentBuilder</code> is not guaranteed to have the same {@link EntityResolver} or {@link ErrorHandler} + * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal + * <code>EntityResolver</code> and <code>ErrorHandler</code>.</p> + * + * @since 1.5 + */ + public void reset() { + + // implementors should override this method + throw new UnsupportedOperationException( + "This DocumentBuilder, \"" + this.getClass().getName() + "\", does not support the reset functionality." + + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" + + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" + ); + } /** * Parse the content of the given <code>InputStream</code> as an XML diff --git a/luni/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java b/luni/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java index 01da97b..4ce53ab 100644 --- a/luni/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java +++ b/luni/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java @@ -295,64 +295,64 @@ public abstract class DocumentBuilderFactory { public abstract Object getAttribute(String name) throws IllegalArgumentException; - /** - * <p>Set a feature for this <code>DocumentBuilderFactory</code> and <code>DocumentBuilder</code>s created by this factory.</p> - * - * <p> - * Feature names are fully qualified {@link java.net.URI}s. - * Implementations may define their own features. - * An {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the - * <code>DocumentBuilder</code>s it creates cannot support the feature. - * It is possible for an <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state. - * </p> - * - * <p> - * All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. - * When the feature is:</p> - * <ul> - * <li> - * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. - * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. - * If XML processing is limited for security reasons, it will be reported via a call to the registered - * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}. - * See {@link DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}. - * </li> - * <li> - * <code>false</code>: the implementation will processing XML according to the XML specifications without - * regard to possible implementation limits. - * </li> - * </ul> - * - * @param name Feature name. - * @param value Is feature state <code>true</code> or <code>false</code>. - * - * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code> or the <code>DocumentBuilder</code>s - * it creates cannot support this feature. + /** + * <p>Set a feature for this <code>DocumentBuilderFactory</code> and <code>DocumentBuilder</code>s created by this factory.</p> + * + * <p> + * Feature names are fully qualified {@link java.net.URI}s. + * Implementations may define their own features. + * An {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the + * <code>DocumentBuilder</code>s it creates cannot support the feature. + * It is possible for an <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state. + * </p> + * + * <p> + * All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:</p> + * <ul> + * <li> + * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. + * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. + * If XML processing is limited for security reasons, it will be reported via a call to the registered + * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}. + * See {@link DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}. + * </li> + * <li> + * <code>false</code>: the implementation will processing XML according to the XML specifications without + * regard to possible implementation limits. + * </li> + * </ul> + * + * @param name Feature name. + * @param value Is feature state <code>true</code> or <code>false</code>. + * + * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code> or the <code>DocumentBuilder</code>s + * it creates cannot support this feature. * @throws NullPointerException If the <code>name</code> parameter is null. - */ - public abstract void setFeature(String name, boolean value) - throws ParserConfigurationException; + */ + public abstract void setFeature(String name, boolean value) + throws ParserConfigurationException; - /** - * <p>Get the state of the named feature.</p> - * - * <p> - * Feature names are fully qualified {@link java.net.URI}s. - * Implementations may define their own features. - * An {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the - * <code>DocumentBuilder</code>s it creates cannot support the feature. - * It is possible for an <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state. - * </p> - * - * @param name Feature name. - * - * @return State of the named feature. - * - * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code> - * or the <code>DocumentBuilder</code>s it creates cannot support this feature. - */ - public abstract boolean getFeature(String name) - throws ParserConfigurationException; + /** + * <p>Get the state of the named feature.</p> + * + * <p> + * Feature names are fully qualified {@link java.net.URI}s. + * Implementations may define their own features. + * An {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the + * <code>DocumentBuilder</code>s it creates cannot support the feature. + * It is possible for an <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state. + * </p> + * + * @param name Feature name. + * + * @return State of the named feature. + * + * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code> + * or the <code>DocumentBuilder</code>s it creates cannot support this feature. + */ + public abstract boolean getFeature(String name) + throws ParserConfigurationException; /** * Gets the {@link Schema} object specified through diff --git a/luni/src/main/java/javax/xml/parsers/SAXParser.java b/luni/src/main/java/javax/xml/parsers/SAXParser.java index 8c52461..53223ac 100644 --- a/luni/src/main/java/javax/xml/parsers/SAXParser.java +++ b/luni/src/main/java/javax/xml/parsers/SAXParser.java @@ -83,29 +83,29 @@ public abstract class SAXParser { } - /** - * <p>Reset this <code>SAXParser</code> to its original configuration.</p> - * - * <p><code>SAXParser</code> is reset to the same state as when it was created with - * {@link SAXParserFactory#newSAXParser()}. - * <code>reset()</code> is designed to allow the reuse of existing <code>SAXParser</code>s - * thus saving resources associated with the creation of new <code>SAXParser</code>s.</p> - * - * <p>The reset <code>SAXParser</code> is not guaranteed to have the same {@link Schema} - * <code>Object</code>, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal - * <code>Schema</code>.</p> - * - * @since 1.5 - */ - public void reset() { + /** + * <p>Reset this <code>SAXParser</code> to its original configuration.</p> + * + * <p><code>SAXParser</code> is reset to the same state as when it was created with + * {@link SAXParserFactory#newSAXParser()}. + * <code>reset()</code> is designed to allow the reuse of existing <code>SAXParser</code>s + * thus saving resources associated with the creation of new <code>SAXParser</code>s.</p> + * + * <p>The reset <code>SAXParser</code> is not guaranteed to have the same {@link Schema} + * <code>Object</code>, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal + * <code>Schema</code>.</p> + * + * @since 1.5 + */ + public void reset() { - // implementors should override this method - throw new UnsupportedOperationException( - "This SAXParser, \"" + this.getClass().getName() + "\", does not support the reset functionality." - + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" - + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" - ); - } + // implementors should override this method + throw new UnsupportedOperationException( + "This SAXParser, \"" + this.getClass().getName() + "\", does not support the reset functionality." + + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" + + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" + ); + } /** * <p>Parse the content of the given {@link java.io.InputStream} diff --git a/luni/src/main/java/javax/xml/parsers/SAXParserFactory.java b/luni/src/main/java/javax/xml/parsers/SAXParserFactory.java index 5cb6ad7..339fccd 100644 --- a/luni/src/main/java/javax/xml/parsers/SAXParserFactory.java +++ b/luni/src/main/java/javax/xml/parsers/SAXParserFactory.java @@ -184,22 +184,22 @@ public abstract class SAXParserFactory { * A list of the core features and properties can be found at * <a href="http://www.saxproject.org/">http://www.saxproject.org/</a></p> * - * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. - * When the feature is</p> - * <ul> - * <li> - * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. - * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. - * If XML processing is limited for security reasons, it will be reported via a call to the registered - * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}. - * See {@link SAXParser} <code>parse</code> methods for handler specification. - * </li> - * <li> - * When the feature is <code>false</code>, the implementation will processing XML according to the XML specifications without - * regard to possible implementation limits. - * </li> - * </ul> - * + * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is</p> + * <ul> + * <li> + * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. + * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. + * If XML processing is limited for security reasons, it will be reported via a call to the registered + * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}. + * See {@link SAXParser} <code>parse</code> methods for handler specification. + * </li> + * <li> + * When the feature is <code>false</code>, the implementation will processing XML according to the XML specifications without + * regard to possible implementation limits. + * </li> + * </ul> + * * @param name The name of the feature to be set. * @param value The value of the feature to be set. * diff --git a/luni/src/main/java/javax/xml/parsers/SecuritySupport.java b/luni/src/main/java/javax/xml/parsers/SecuritySupport.java index bd655a8..e4f76f0 100644 --- a/luni/src/main/java/javax/xml/parsers/SecuritySupport.java +++ b/luni/src/main/java/javax/xml/parsers/SecuritySupport.java @@ -40,20 +40,20 @@ final class SecuritySupport { private SecuritySupport() {} static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); } static String getSystemProperty(final String propName) { - return (String) + return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); @@ -64,16 +64,16 @@ final class SecuritySupport { static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { + try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } } static InputStream getResourceAsStream(final ClassLoader cl, diff --git a/luni/src/main/java/javax/xml/transform/SecuritySupport.java b/luni/src/main/java/javax/xml/transform/SecuritySupport.java index 6ac527d..0b052f6 100644 --- a/luni/src/main/java/javax/xml/transform/SecuritySupport.java +++ b/luni/src/main/java/javax/xml/transform/SecuritySupport.java @@ -40,20 +40,20 @@ final class SecuritySupport { private SecuritySupport() {} static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); } static String getSystemProperty(final String propName) { - return (String) + return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); @@ -64,16 +64,16 @@ final class SecuritySupport { static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { + try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } } static InputStream getResourceAsStream(final ClassLoader cl, diff --git a/luni/src/main/java/javax/xml/transform/Transformer.java b/luni/src/main/java/javax/xml/transform/Transformer.java index 30f795d..b4f3c29 100644 --- a/luni/src/main/java/javax/xml/transform/Transformer.java +++ b/luni/src/main/java/javax/xml/transform/Transformer.java @@ -48,32 +48,32 @@ public abstract class Transformer { */ protected Transformer() { } - /** - * <p>Reset this <code>Transformer</code> to its original configuration.</p> - * - * <p><code>Transformer</code> is reset to the same state as when it was created with - * {@link TransformerFactory#newTransformer()}, - * {@link TransformerFactory#newTransformer(Source source)} or - * {@link Templates#newTransformer()}. - * <code>reset()</code> is designed to allow the reuse of existing <code>Transformer</code>s - * thus saving resources associated with the creation of new <code>Transformer</code>s.</p> - * - * <p>The reset <code>Transformer</code> is not guaranteed to have the same {@link URIResolver} - * or {@link ErrorListener} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. - * It is guaranteed to have a functionally equal <code>URIResolver</code> - * and <code>ErrorListener</code>.</p> - * - * @since 1.5 - */ - public void reset() { + /** + * <p>Reset this <code>Transformer</code> to its original configuration.</p> + * + * <p><code>Transformer</code> is reset to the same state as when it was created with + * {@link TransformerFactory#newTransformer()}, + * {@link TransformerFactory#newTransformer(Source source)} or + * {@link Templates#newTransformer()}. + * <code>reset()</code> is designed to allow the reuse of existing <code>Transformer</code>s + * thus saving resources associated with the creation of new <code>Transformer</code>s.</p> + * + * <p>The reset <code>Transformer</code> is not guaranteed to have the same {@link URIResolver} + * or {@link ErrorListener} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. + * It is guaranteed to have a functionally equal <code>URIResolver</code> + * and <code>ErrorListener</code>.</p> + * + * @since 1.5 + */ + public void reset() { - // implementors should override this method - throw new UnsupportedOperationException( - "This Transformer, \"" + this.getClass().getName() + "\", does not support the reset functionality." - + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" - + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" - ); - } + // implementors should override this method + throw new UnsupportedOperationException( + "This Transformer, \"" + this.getClass().getName() + "\", does not support the reset functionality." + + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" + + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" + ); + } /** * <p>Transform the XML <code>Source</code> to a <code>Result</code>. diff --git a/luni/src/main/java/javax/xml/transform/TransformerFactory.java b/luni/src/main/java/javax/xml/transform/TransformerFactory.java index daabe2b..c9fbd73 100644 --- a/luni/src/main/java/javax/xml/transform/TransformerFactory.java +++ b/luni/src/main/java/javax/xml/transform/TransformerFactory.java @@ -224,58 +224,58 @@ public abstract class TransformerFactory { //======= CONFIGURATION METHODS ======= - /** - * <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s - * or <code>Template</code>s created by this factory.</p> - * - * <p> - * Feature names are fully qualified {@link java.net.URI}s. - * Implementations may define their own features. - * An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the - * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature. - * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state. - * </p> - * - * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. - * When the feature is:</p> - * <ul> - * <li> - * <code>true</code>: the implementation will limit XML processing to conform to implementation limits - * and behave in a secure fashion as defined by the implementation. - * Examples include resolving user defined style sheets and functions. - * If XML processing is limited for security reasons, it will be reported via a call to the registered - * {@link ErrorListener#fatalError(TransformerException exception)}. - * See {@link #setErrorListener(ErrorListener listener)}. - * </li> - * <li> - * <code>false</code>: the implementation will processing XML according to the XML specifications without - * regard to possible implementation limits. - * </li> - * </ul> - * - * @param name Feature name. - * @param value Is feature state <code>true</code> or <code>false</code>. - * - * @throws TransformerConfigurationException if this <code>TransformerFactory</code> - * or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature. + /** + * <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s + * or <code>Template</code>s created by this factory.</p> + * + * <p> + * Feature names are fully qualified {@link java.net.URI}s. + * Implementations may define their own features. + * An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the + * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature. + * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state. + * </p> + * + * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:</p> + * <ul> + * <li> + * <code>true</code>: the implementation will limit XML processing to conform to implementation limits + * and behave in a secure fashion as defined by the implementation. + * Examples include resolving user defined style sheets and functions. + * If XML processing is limited for security reasons, it will be reported via a call to the registered + * {@link ErrorListener#fatalError(TransformerException exception)}. + * See {@link #setErrorListener(ErrorListener listener)}. + * </li> + * <li> + * <code>false</code>: the implementation will processing XML according to the XML specifications without + * regard to possible implementation limits. + * </li> + * </ul> + * + * @param name Feature name. + * @param value Is feature state <code>true</code> or <code>false</code>. + * + * @throws TransformerConfigurationException if this <code>TransformerFactory</code> + * or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature. * @throws NullPointerException If the <code>name</code> parameter is null. - */ - public abstract void setFeature(String name, boolean value) - throws TransformerConfigurationException; + */ + public abstract void setFeature(String name, boolean value) + throws TransformerConfigurationException; /** * Look up the value of a feature. * - * <p> - * Feature names are fully qualified {@link java.net.URI}s. - * Implementations may define their own features. - * <code>false</code> is returned if this <code>TransformerFactory</code> or the - * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature. - * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state. - * </p> - * - * @param name Feature name. - * + * <p> + * Feature names are fully qualified {@link java.net.URI}s. + * Implementations may define their own features. + * <code>false</code> is returned if this <code>TransformerFactory</code> or the + * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature. + * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state. + * </p> + * + * @param name Feature name. + * * @return The current state of the feature, <code>true</code> or <code>false</code>. * * @throws NullPointerException If the <code>name</code> parameter is null. diff --git a/luni/src/main/java/javax/xml/validation/SchemaFactory.java b/luni/src/main/java/javax/xml/validation/SchemaFactory.java index 143b8ca..aff316e 100644 --- a/luni/src/main/java/javax/xml/validation/SchemaFactory.java +++ b/luni/src/main/java/javax/xml/validation/SchemaFactory.java @@ -227,19 +227,19 @@ public abstract class SchemaFactory { // } // END android-only - /** - * <p>Is specified schema supported by this <code>SchemaFactory</code>?</p> - * - * @param schemaLanguage Specifies the schema language which the returned <code>SchemaFactory</code> will understand. + /** + * <p>Is specified schema supported by this <code>SchemaFactory</code>?</p> + * + * @param schemaLanguage Specifies the schema language which the returned <code>SchemaFactory</code> will understand. * <code>schemaLanguage</code> must specify a <a href="#schemaLanguage">valid</a> schema language. - * - * @return <code>true</code> if <code>SchemaFactory</code> supports <code>schemaLanguage</code>, else <code>false</code>. - * - * @throws NullPointerException If <code>schemaLanguage</code> is <code>null</code>. - * @throws IllegalArgumentException If <code>schemaLanguage.length() == 0</code> - * or <code>schemaLanguage</code> does not specify a <a href="#schemaLanguage">valid</a> schema language. - */ - public abstract boolean isSchemaLanguageSupported(String schemaLanguage); + * + * @return <code>true</code> if <code>SchemaFactory</code> supports <code>schemaLanguage</code>, else <code>false</code>. + * + * @throws NullPointerException If <code>schemaLanguage</code> is <code>null</code>. + * @throws IllegalArgumentException If <code>schemaLanguage.length() == 0</code> + * or <code>schemaLanguage</code> does not specify a <a href="#schemaLanguage">valid</a> schema language. + */ + public abstract boolean isSchemaLanguageSupported(String schemaLanguage); /** * Look up the value of a feature flag. @@ -263,9 +263,9 @@ public abstract class SchemaFactory { * @see #setFeature(String, boolean) */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - + if (name == null) { - throw new NullPointerException("the name parameter is null"); + throw new NullPointerException("the name parameter is null"); } throw new SAXNotRecognizedException(name); } @@ -282,22 +282,22 @@ public abstract class SchemaFactory { * possible for a {@link SchemaFactory} to expose a feature value but * to be unable to change the current value.</p> * - * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. - * When the feature is:</p> - * <ul> - * <li> - * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. - * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. - * If XML processing is limited for security reasons, it will be reported via a call to the registered - * {@link ErrorHandler#fatalError(SAXParseException exception)}. - * See {@link #setErrorHandler(ErrorHandler errorHandler)}. - * </li> - * <li> - * <code>false</code>: the implementation will processing XML according to the XML specifications without - * regard to possible implementation limits. - * </li> - * </ul> - * + * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:</p> + * <ul> + * <li> + * <code>true</code>: the implementation will limit XML processing to conform to implementation limits. + * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. + * If XML processing is limited for security reasons, it will be reported via a call to the registered + * {@link ErrorHandler#fatalError(SAXParseException exception)}. + * See {@link #setErrorHandler(ErrorHandler errorHandler)}. + * </li> + * <li> + * <code>false</code>: the implementation will processing XML according to the XML specifications without + * regard to possible implementation limits. + * </li> + * </ul> + * * @param name The feature name, which is a non-null fully-qualified URI. * @param value The requested value of the feature (true or false). * @@ -312,9 +312,9 @@ public abstract class SchemaFactory { * @see #getFeature(String) */ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { - + if (name == null) { - throw new NullPointerException("the name parameter is null"); + throw new NullPointerException("the name parameter is null"); } throw new SAXNotRecognizedException(name); } @@ -340,9 +340,9 @@ public abstract class SchemaFactory { * if the name parameter is null. */ public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { - + if (name == null) { - throw new NullPointerException("the name parameter is null"); + throw new NullPointerException("the name parameter is null"); } throw new SAXNotRecognizedException(name); } @@ -372,9 +372,9 @@ public abstract class SchemaFactory { * @see #setProperty(String, Object) */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - + if (name == null) { - throw new NullPointerException("the name parameter is null"); + throw new NullPointerException("the name parameter is null"); } throw new SAXNotRecognizedException(name); } @@ -525,7 +525,7 @@ public abstract class SchemaFactory { * @throws NullPointerException if <tt>schema</tt> is null. */ public Schema newSchema(Source schema) throws SAXException { - return newSchema(new Source[]{schema}); + return newSchema(new Source[]{schema}); } /** diff --git a/luni/src/main/java/javax/xml/validation/SchemaFactoryFinder.java b/luni/src/main/java/javax/xml/validation/SchemaFactoryFinder.java index ba9a92e..5e4bc79 100644 --- a/luni/src/main/java/javax/xml/validation/SchemaFactoryFinder.java +++ b/luni/src/main/java/javax/xml/validation/SchemaFactoryFinder.java @@ -51,12 +51,12 @@ final class SchemaFactoryFinder { /** * <p>Cache properties for performance.</p> */ - private static Properties cacheProps = new Properties(); + private static Properties cacheProps = new Properties(); - /** - * <p>First time requires initialization overhead.</p> - */ - private static boolean firstTime = true; + /** + * <p>First time requires initialization overhead.</p> + */ + private static boolean firstTime = true; /** * Default columns per line. diff --git a/luni/src/main/java/javax/xml/validation/SecuritySupport.java b/luni/src/main/java/javax/xml/validation/SecuritySupport.java index 7821ad9..5dfafa6 100644 --- a/luni/src/main/java/javax/xml/validation/SecuritySupport.java +++ b/luni/src/main/java/javax/xml/validation/SecuritySupport.java @@ -42,20 +42,20 @@ final class SecuritySupport { private SecuritySupport() {} static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); } static String getSystemProperty(final String propName) { - return (String) + return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); @@ -66,31 +66,31 @@ final class SecuritySupport { static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { + try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } } static InputStream getURLInputStream(final URL url) throws IOException { - try { + try { return (InputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { return url.openStream(); } }); - } catch (PrivilegedActionException e) { - throw (IOException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (IOException)e.getException(); + } } static URL getResourceAsURL(final ClassLoader cl, diff --git a/luni/src/main/java/javax/xml/validation/Validator.java b/luni/src/main/java/javax/xml/validation/Validator.java index 63f320a..316f957 100644 --- a/luni/src/main/java/javax/xml/validation/Validator.java +++ b/luni/src/main/java/javax/xml/validation/Validator.java @@ -65,19 +65,19 @@ public abstract class Validator { protected Validator() { } - /** - * <p>Reset this <code>Validator</code> to its original configuration.</p> - * - * <p><code>Validator</code> is reset to the same state as when it was created with - * {@link Schema#newValidator()}. - * <code>reset()</code> is designed to allow the reuse of existing <code>Validator</code>s - * thus saving resources associated with the creation of new <code>Validator</code>s.</p> - * - * <p>The reset <code>Validator</code> is not guaranteed to have the same {@link LSResourceResolver} or {@link ErrorHandler} - * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal - * <code>LSResourceResolver</code> and <code>ErrorHandler</code>.</p> - */ - public abstract void reset(); + /** + * <p>Reset this <code>Validator</code> to its original configuration.</p> + * + * <p><code>Validator</code> is reset to the same state as when it was created with + * {@link Schema#newValidator()}. + * <code>reset()</code> is designed to allow the reuse of existing <code>Validator</code>s + * thus saving resources associated with the creation of new <code>Validator</code>s.</p> + * + * <p>The reset <code>Validator</code> is not guaranteed to have the same {@link LSResourceResolver} or {@link ErrorHandler} + * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal + * <code>LSResourceResolver</code> and <code>ErrorHandler</code>.</p> + */ + public abstract void reset(); /** * Validates the specified input. diff --git a/luni/src/main/java/javax/xml/xpath/SecuritySupport.java b/luni/src/main/java/javax/xml/xpath/SecuritySupport.java index 2490552..a97829f 100644 --- a/luni/src/main/java/javax/xml/xpath/SecuritySupport.java +++ b/luni/src/main/java/javax/xml/xpath/SecuritySupport.java @@ -42,20 +42,20 @@ final class SecuritySupport { private SecuritySupport() {} static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); } static String getSystemProperty(final String propName) { - return (String) + return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); @@ -66,31 +66,31 @@ final class SecuritySupport { static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { + try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } } static InputStream getURLInputStream(final URL url) throws IOException { - try { + try { return (InputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { return url.openStream(); } }); - } catch (PrivilegedActionException e) { - throw (IOException)e.getException(); - } + } catch (PrivilegedActionException e) { + throw (IOException)e.getException(); + } } static URL getResourceAsURL(final ClassLoader cl, diff --git a/luni/src/main/java/javax/xml/xpath/XPath.java b/luni/src/main/java/javax/xml/xpath/XPath.java index 749b9b5..70d6ff1 100644 --- a/luni/src/main/java/javax/xml/xpath/XPath.java +++ b/luni/src/main/java/javax/xml/xpath/XPath.java @@ -85,20 +85,20 @@ import javax.xml.namespace.NamespaceContext; */ public interface XPath { - /** - * <p>Reset this <code>XPath</code> to its original configuration.</p> - * - * <p><code>XPath</code> is reset to the same state as when it was created with - * {@link XPathFactory#newXPath()}. - * <code>reset()</code> is designed to allow the reuse of existing <code>XPath</code>s - * thus saving resources associated with the creation of new <code>XPath</code>s.</p> - * - * <p>The reset <code>XPath</code> is not guaranteed to have the same {@link XPathFunctionResolver}, {@link XPathVariableResolver} - * or {@link NamespaceContext} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. - * It is guaranteed to have a functionally equal <code>XPathFunctionResolver</code>, <code>XPathVariableResolver</code> - * and <code>NamespaceContext</code>.</p> - */ - public void reset(); + /** + * <p>Reset this <code>XPath</code> to its original configuration.</p> + * + * <p><code>XPath</code> is reset to the same state as when it was created with + * {@link XPathFactory#newXPath()}. + * <code>reset()</code> is designed to allow the reuse of existing <code>XPath</code>s + * thus saving resources associated with the creation of new <code>XPath</code>s.</p> + * + * <p>The reset <code>XPath</code> is not guaranteed to have the same {@link XPathFunctionResolver}, {@link XPathVariableResolver} + * or {@link NamespaceContext} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. + * It is guaranteed to have a functionally equal <code>XPathFunctionResolver</code>, <code>XPathVariableResolver</code> + * and <code>NamespaceContext</code>.</p> + */ + public void reset(); /** * <p>Establish a variable resolver.</p> diff --git a/luni/src/main/java/javax/xml/xpath/XPathFactory.java b/luni/src/main/java/javax/xml/xpath/XPathFactory.java index 410181c..eaeca9b 100644 --- a/luni/src/main/java/javax/xml/xpath/XPathFactory.java +++ b/luni/src/main/java/javax/xml/xpath/XPathFactory.java @@ -65,17 +65,17 @@ public abstract class XPathFactory { * @return Instance of an <code>XPathFactory</code>. */ public static final XPathFactory newInstance() { - try { - return newInstance(DEFAULT_OBJECT_MODEL_URI); - } - catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) { - throw new RuntimeException( - "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: " - + DEFAULT_OBJECT_MODEL_URI - + " with the XPathFactoryConfigurationException: " - + xpathFactoryConfigurationException.toString() - ); - } + try { + return newInstance(DEFAULT_OBJECT_MODEL_URI); + } + catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) { + throw new RuntimeException( + "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: " + + DEFAULT_OBJECT_MODEL_URI + + " with the XPathFactoryConfigurationException: " + + xpathFactoryConfigurationException.toString() + ); + } } /** @@ -192,17 +192,17 @@ public abstract class XPathFactory { return xpathFactory; } - /** - * <p>Is specified object model supported by this <code>XPathFactory</code>?</p> - * - * @param objectModel Specifies the object model which the returned <code>XPathFactory</code> will understand. - * - * @return <code>true</code> if <code>XPathFactory</code> supports <code>objectModel</code>, else <code>false</code>. - * - * @throws NullPointerException If <code>objectModel</code> is <code>null</code>. - * @throws IllegalArgumentException If <code>objectModel.length() == 0</code>. - */ - public abstract boolean isObjectModelSupported(String objectModel); + /** + * <p>Is specified object model supported by this <code>XPathFactory</code>?</p> + * + * @param objectModel Specifies the object model which the returned <code>XPathFactory</code> will understand. + * + * @return <code>true</code> if <code>XPathFactory</code> supports <code>objectModel</code>, else <code>false</code>. + * + * @throws NullPointerException If <code>objectModel</code> is <code>null</code>. + * @throws IllegalArgumentException If <code>objectModel.length() == 0</code>. + */ + public abstract boolean isObjectModelSupported(String objectModel); /** * <p>Set a feature for this <code>XPathFactory</code> and <code>XPath</code>s created by this factory.</p> @@ -229,12 +229,12 @@ public abstract class XPathFactory { * it creates cannot support this feature. * @throws NullPointerException if <code>name</code> is <code>null</code>. */ - public abstract void setFeature(String name, boolean value) - throws XPathFactoryConfigurationException; + public abstract void setFeature(String name, boolean value) + throws XPathFactoryConfigurationException; - /** - * <p>Get the state of the named feature.</p> - * + /** + * <p>Get the state of the named feature.</p> + * * <p> * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. @@ -243,16 +243,16 @@ public abstract class XPathFactory { * It is possible for an <code>XPathFactory</code> to expose a feature value but be unable to change its state. * </p> * - * @param name Feature name. - * - * @return State of the named feature. - * + * @param name Feature name. + * + * @return State of the named feature. + * * @throws XPathFactoryConfigurationException if this <code>XPathFactory</code> or the <code>XPath</code>s * it creates cannot support this feature. * @throws NullPointerException if <code>name</code> is <code>null</code>. - */ - public abstract boolean getFeature(String name) - throws XPathFactoryConfigurationException; + */ + public abstract boolean getFeature(String name) + throws XPathFactoryConfigurationException; /** * <p>Establish a default variable resolver.</p> diff --git a/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java b/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java index 39d2f49..f9d365c 100644 --- a/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java +++ b/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java @@ -63,12 +63,12 @@ final class XPathFactoryFinder { /** * <p>Cache properties for performance.</p> */ - private static Properties cacheProps = new Properties(); + private static Properties cacheProps = new Properties(); - /** - * <p>First time requires initialization overhead.</p> - */ - private static boolean firstTime = true; + /** + * <p>First time requires initialization overhead.</p> + */ + private static boolean firstTime = true; /** * <p>Conditional debug printing.</p> diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java index 99eb03b..af97e9f 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlParser.java +++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java @@ -33,7 +33,7 @@ import org.xmlpull.v1.*; public class KXmlParser implements XmlPullParser { private Object location; - static final private String UNEXPECTED_EOF = "Unexpected EOF"; + static final private String UNEXPECTED_EOF = "Unexpected EOF"; static final private String ILLEGAL_TYPE = "Wrong event type"; static final private int LEGACY = 999; static final private int XML_DECL = 998; @@ -291,20 +291,20 @@ public class KXmlParser implements XmlPullParser { while (true) { attributeCount = -1; - // degenerated needs to be handled before error because of possible - // processor expectations(!) + // degenerated needs to be handled before error because of possible + // processor expectations(!) - if (degenerated) { - degenerated = false; - type = END_TAG; - return; - } + if (degenerated) { + degenerated = false; + type = END_TAG; + return; + } if (error != null) { for (int i = 0; i < error.length(); i++) push(error.charAt(i)); - // text = error; + //text = error; error = null; type = COMMENT; return; @@ -357,7 +357,7 @@ public class KXmlParser implements XmlPullParser { if (isWhitespace) type = IGNORABLE_WHITESPACE; // make exception switchable for instances.chg... !!!! - // else + // else // exception ("text '"+getText ()+"' not allowed outside root element"); } return; @@ -563,7 +563,7 @@ public class KXmlParser implements XmlPullParser { if (!name.equals(elementStack[sp + 3])) { error("expected: /" + elementStack[sp + 3] + " read: " + name); - // become case insensitive in relaxed mode + // become case insensitive in relaxed mode // int probe = sp; // while (probe >= 0 && !name.toLowerCase().equals(elementStack[probe + 3].toLowerCase())) { @@ -573,7 +573,7 @@ public class KXmlParser implements XmlPullParser { // // if (probe < 0) { // stackMismatch = 0; -// // text = "unexpected end tag ignored"; +// // text = "unexpected end tag ignored"; // type = COMMENT; // return; // } @@ -693,25 +693,24 @@ public class KXmlParser implements XmlPullParser { skip(); if (peek(0) != '=') { - if(!relaxed){ - error("Attr.value missing f. "+attrName); - } + if(!relaxed){ + error("Attr.value missing f. "+attrName); + } attributes[i] = attrName; - } - else { + } else { read('='); skip(); int delimiter = peek(0); if (delimiter != '\'' && delimiter != '"') { - if(!relaxed){ - error("attr value delimiter missing!"); - } + if(!relaxed){ + error("attr value delimiter missing!"); + } delimiter = ' '; + } else { + read(); } - else - read(); - + int p = txtPos; // BEGIN android-changed: distinguish attribute values from normal text. pushText(delimiter, true, true); @@ -739,14 +738,14 @@ public class KXmlParser implements XmlPullParser { nspCounts[depth] = nspCounts[depth - 1]; /* - if(!relaxed){ + if(!relaxed){ for (int i = attributeCount - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (getAttributeName(i).equals(getAttributeName(j))) exception("Duplicate Attribute: " + getAttributeName(i)); } } - } + } */ if (processNsp) adjustNsp(); @@ -776,21 +775,16 @@ public class KXmlParser implements XmlPullParser { read(); break; } - if (c < 128 - && (c < '0' || c > '9') - && (c < 'a' || c > 'z') - && (c < 'A' || c > 'Z') - && c != '_' - && c != '-' - && c != '#') { - if(!relaxed){ - error("unterminated entity ref"); - } - - // BEGIN android-removed: avoid log spam. - // System.out.println("broken entitiy: "+get(pos-1)); - // END android-removed - + if (c < 128 && (c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') + && c != '_' && c != '-' && c != '#') { + if(!relaxed){ + error("unterminated entity ref"); + } + + // BEGIN android-removed: avoid log spam. + // System.out.println("broken entitiy: "+get(pos-1)); + // END android-removed + //; ends with:"+(char)c); // if (c != -1) // push(c); @@ -898,10 +892,10 @@ public class KXmlParser implements XmlPullParser { result = peek[0]; peek[0] = peek[1]; } - // else { - // result = peek[0]; - // System.arraycopy (peek, 1, peek, 0, peekCount-1); - // } + // else { + // result = peek[0]; + // System.arraycopy (peek, 1, peek, 0, peekCount-1); + // } peekCount--; column++; @@ -1176,8 +1170,8 @@ public class KXmlParser implements XmlPullParser { return version; if (isProp(property, true, "xmldecl-standalone")) return standalone; - if (isProp(property, true, "location")) - return location != null ? location : reader.toString(); + if (isProp(property, true, "location")) + return location != null ? location : reader.toString(); return null; } @@ -1257,15 +1251,14 @@ public class KXmlParser implements XmlPullParser { buf.append(text); } - buf.append("@"+line + ":" + column); - if(location != null){ - buf.append(" in "); - buf.append(location); - } - else if(reader != null){ - buf.append(" in "); - buf.append(reader.toString()); - } + buf.append("@"+line + ":" + column); + if(location != null){ + buf.append(" in "); + buf.append(location); + } else if(reader != null){ + buf.append(" in "); + buf.append(reader.toString()); + } return buf.toString(); } @@ -1385,7 +1378,7 @@ public class KXmlParser implements XmlPullParser { nextImpl(); if (type < minType) minType = type; - // if (curr <= TEXT) type = curr; + // if (curr <= TEXT) type = curr; } while (minType > ENTITY_REF // ignorable || (minType >= TEXT && peekType() >= TEXT)); @@ -1465,10 +1458,11 @@ public class KXmlParser implements XmlPullParser { public void setProperty(String property, Object value) throws XmlPullParserException { - if(isProp(property, true, "location")) - location = value; - else - throw new XmlPullParserException("unsupported property: " + property); + if(isProp(property, true, "location")) { + location = value; + } else { + throw new XmlPullParserException("unsupported property: " + property); + } } /** @@ -1477,7 +1471,7 @@ public class KXmlParser implements XmlPullParser { * parser will be positioned on corresponding END_TAG. */ - // Implementation copied from Alek's mail... + // Implementation copied from Alek's mail... public void skipSubTree() throws XmlPullParserException, IOException { require(START_TAG, null, null); |