src/share/classes/java/util/Properties.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 35,64 ****
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.lang.reflect.*;
/**
! * The <code>Properties</code> class represents a persistent set of
! * properties. The <code>Properties</code> can be saved to a stream
* or loaded from a stream. Each key and its corresponding value in
* the property list is a string.
* <p>
* A property list can contain another property list as its
* "defaults"; this second property list is searched if
* the property key is not found in the original property list.
* <p>
! * Because <code>Properties</code> inherits from <code>Hashtable</code>, the
! * <code>put</code> and <code>putAll</code> methods can be applied to a
! * <code>Properties</code> object. Their use is strongly discouraged as they
* allow the caller to insert entries whose keys or values are not
! * <code>Strings</code>. The <code>setProperty</code> method should be used
! * instead. If the <code>store</code> or <code>save</code> method is called
! * on a "compromised" <code>Properties</code> object that contains a
! * non-<code>String</code> key or value, the call will fail. Similarly,
! * the call to the <code>propertyNames</code> or <code>list</code> method
! * will fail if it is called on a "compromised" <code>Properties</code>
! * object that contains a non-<code>String</code> key.
*
* <p>
* The {@link #load(java.io.Reader) load(Reader)} <tt>/</tt>
* {@link #store(java.io.Writer, java.lang.String) store(Writer, String)}
* methods load and store properties from and to a character based stream
--- 35,64 ----
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.lang.reflect.*;
/**
! * The {@code Properties} class represents a persistent set of
! * properties. The {@code Properties} can be saved to a stream
* or loaded from a stream. Each key and its corresponding value in
* the property list is a string.
* <p>
* A property list can contain another property list as its
* "defaults"; this second property list is searched if
* the property key is not found in the original property list.
* <p>
! * Because {@code Properties} inherits from {@code Hashtable}, the
! * {@code put} and {@code putAll} methods can be applied to a
! * {@code Properties} object. Their use is strongly discouraged as they
* allow the caller to insert entries whose keys or values are not
! * {@code Strings}. The {@code setProperty} method should be used
! * instead. If the {@code store} or {@code save} method is called
! * on a "compromised" {@code Properties} object that contains a
! * non-{@code String} key or value, the call will fail. Similarly,
! * the call to the {@code propertyNames} or {@code list} method
! * will fail if it is called on a "compromised" {@code Properties}
! * object that contains a non-{@code String} key.
*
* <p>
* The {@link #load(java.io.Reader) load(Reader)} <tt>/</tt>
* {@link #store(java.io.Writer, java.lang.String) store(Writer, String)}
* methods load and store properties from and to a character based stream
*** 144,162 ****
public Properties(Properties defaults) {
this.defaults = defaults;
}
/**
! * Calls the <tt>Hashtable</tt> method <code>put</code>. Provided for
* parallelism with the <tt>getProperty</tt> method. Enforces use of
* strings for property keys and values. The value returned is the
! * result of the <tt>Hashtable</tt> call to <code>put</code>.
*
* @param key the key to be placed into this property list.
* @param value the value corresponding to <tt>key</tt>.
* @return the previous value of the specified key in this property
! * list, or <code>null</code> if it did not have one.
* @see #getProperty
* @since 1.2
*/
public synchronized Object setProperty(String key, String value) {
return put(key, value);
--- 144,162 ----
public Properties(Properties defaults) {
this.defaults = defaults;
}
/**
! * Calls the <tt>Hashtable</tt> method {@code put}. Provided for
* parallelism with the <tt>getProperty</tt> method. Enforces use of
* strings for property keys and values. The value returned is the
! * result of the <tt>Hashtable</tt> call to {@code put}.
*
* @param key the key to be placed into this property list.
* @param value the value corresponding to <tt>key</tt>.
* @return the previous value of the specified key in this property
! * list, or {@code null} if it did not have one.
* @see #getProperty
* @since 1.2
*/
public synchronized Object setProperty(String key, String value) {
return put(key, value);
*** 169,199 ****
* <p>
* Properties are processed in terms of lines. There are two
* kinds of line, <i>natural lines</i> and <i>logical lines</i>.
* A natural line is defined as a line of
* characters that is terminated either by a set of line terminator
! * characters (<code>\n</code> or <code>\r</code> or <code>\r\n</code>)
* or by the end of the stream. A natural line may be either a blank line,
* a comment line, or hold all or some of a key-element pair. A logical
* line holds all the data of a key-element pair, which may be spread
* out across several adjacent natural lines by escaping
* the line terminator sequence with a backslash character
! * <code>\</code>. Note that a comment line cannot be extended
* in this manner; every natural line that is a comment must have
* its own comment indicator, as described below. Lines are read from
* input until the end of the stream is reached.
*
* <p>
* A natural line that contains only white space characters is
* considered blank and is ignored. A comment line has an ASCII
! * <code>'#'</code> or <code>'!'</code> as its first non-white
* space character; comment lines are also ignored and do not
* encode key-element information. In addition to line
* terminators, this format considers the characters space
! * (<code>' '</code>, <code>'\u0020'</code>), tab
! * (<code>'\t'</code>, <code>'\u0009'</code>), and form feed
! * (<code>'\f'</code>, <code>'\u000C'</code>) to be white
* space.
*
* <p>
* If a logical line is spread across several natural lines, the
* backslash escaping the line terminator sequence, the line
--- 169,199 ----
* <p>
* Properties are processed in terms of lines. There are two
* kinds of line, <i>natural lines</i> and <i>logical lines</i>.
* A natural line is defined as a line of
* characters that is terminated either by a set of line terminator
! * characters ({@code \n} or {@code \r} or {@code \r\n})
* or by the end of the stream. A natural line may be either a blank line,
* a comment line, or hold all or some of a key-element pair. A logical
* line holds all the data of a key-element pair, which may be spread
* out across several adjacent natural lines by escaping
* the line terminator sequence with a backslash character
! * {@code \}. Note that a comment line cannot be extended
* in this manner; every natural line that is a comment must have
* its own comment indicator, as described below. Lines are read from
* input until the end of the stream is reached.
*
* <p>
* A natural line that contains only white space characters is
* considered blank and is ignored. A comment line has an ASCII
! * {@code '#'} or {@code '!'} as its first non-white
* space character; comment lines are also ignored and do not
* encode key-element information. In addition to line
* terminators, this format considers the characters space
! * ({@code ' '}, {@code '\u005Cu0020'}), tab
! * ({@code '\t'}, {@code '\u005Cu0009'}), and form feed
! * ({@code '\f'}, {@code '\u005Cu000C'}) to be white
* space.
*
* <p>
* If a logical line is spread across several natural lines, the
* backslash escaping the line terminator sequence, the line
*** 213,247 ****
* backslashes after escape processing.
*
* <p>
* The key contains all of the characters in the line starting
* with the first non-white space character and up to, but not
! * including, the first unescaped <code>'='</code>,
! * <code>':'</code>, or white space character other than a line
* terminator. All of these key termination characters may be
* included in the key by escaping them with a preceding backslash
* character; for example,<p>
*
! * <code>\:\=</code><p>
*
! * would be the two-character key <code>":="</code>. Line
! * terminator characters can be included using <code>\r</code> and
! * <code>\n</code> escape sequences. Any white space after the
* key is skipped; if the first non-white space character after
! * the key is <code>'='</code> or <code>':'</code>, then it is
* ignored and any white space characters after it are also
* skipped. All remaining characters on the line become part of
* the associated element string; if there are no remaining
* characters, the element is the empty string
! * <code>""</code>. Once the raw character sequences
* constituting the key and element are identified, escape
* processing is performed as described above.
*
* <p>
* As an example, each of the following three lines specifies the key
! * <code>"Truth"</code> and the associated element value
! * <code>"Beauty"</code>:
* <p>
* <pre>
* Truth = Beauty
* Truth:Beauty
* Truth :Beauty
--- 213,247 ----
* backslashes after escape processing.
*
* <p>
* The key contains all of the characters in the line starting
* with the first non-white space character and up to, but not
! * including, the first unescaped {@code '='},
! * {@code ':'}, or white space character other than a line
* terminator. All of these key termination characters may be
* included in the key by escaping them with a preceding backslash
* character; for example,<p>
*
! * {@code \:\=}<p>
*
! * would be the two-character key {@code ":="}. Line
! * terminator characters can be included using {@code \r} and
! * {@code \n} escape sequences. Any white space after the
* key is skipped; if the first non-white space character after
! * the key is {@code '='} or {@code ':'}, then it is
* ignored and any white space characters after it are also
* skipped. All remaining characters on the line become part of
* the associated element string; if there are no remaining
* characters, the element is the empty string
! * {@code ""}. Once the raw character sequences
* constituting the key and element are identified, escape
* processing is performed as described above.
*
* <p>
* As an example, each of the following three lines specifies the key
! * {@code "Truth"} and the associated element value
! * {@code "Beauty"}:
* <p>
* <pre>
* Truth = Beauty
* Truth:Beauty
* Truth :Beauty
*** 252,276 ****
* <pre>
* fruits apple, banana, pear, \
* cantaloupe, watermelon, \
* kiwi, mango
* </pre>
! * The key is <code>"fruits"</code> and the associated element is:
* <p>
* <pre>"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"</pre>
! * Note that a space appears before each <code>\</code> so that a space
! * will appear after each comma in the final result; the <code>\</code>,
* line terminator, and leading white space on the continuation line are
* merely discarded and are <i>not</i> replaced by one or more other
* characters.
* <p>
* As a third example, the line:
* <p>
* <pre>cheeses
* </pre>
! * specifies that the key is <code>"cheeses"</code> and the associated
! * element is the empty string <code>""</code>.<p>
* <p>
*
* <a name="unicodeescapes"></a>
* Characters in keys and elements can be represented in escape
* sequences similar to those used for character and string literals
--- 252,276 ----
* <pre>
* fruits apple, banana, pear, \
* cantaloupe, watermelon, \
* kiwi, mango
* </pre>
! * The key is {@code "fruits"} and the associated element is:
* <p>
* <pre>"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"</pre>
! * Note that a space appears before each {@code \} so that a space
! * will appear after each comma in the final result; the {@code \},
* line terminator, and leading white space on the continuation line are
* merely discarded and are <i>not</i> replaced by one or more other
* characters.
* <p>
* As a third example, the line:
* <p>
* <pre>cheeses
* </pre>
! * specifies that the key is {@code "cheeses"} and the associated
! * element is the empty string {@code ""}.<p>
* <p>
*
* <a name="unicodeescapes"></a>
* Characters in keys and elements can be represented in escape
* sequences similar to those used for character and string literals
*** 281,301 ****
* escapes used for characters and strings are:
*
* <ul>
* <li> Octal escapes are not recognized.
*
! * <li> The character sequence <code>\b</code> does <i>not</i>
* represent a backspace character.
*
* <li> The method does not treat a backslash character,
! * <code>\</code>, before a non-valid escape character as an
* error; the backslash is silently dropped. For example, in a
! * Java string the sequence <code>"\z"</code> would cause a
* compile time error. In contrast, this method silently drops
* the backslash. Therefore, this method treats the two character
! * sequence <code>"\b"</code> as equivalent to the single
! * character <code>'b'</code>.
*
* <li> Escapes are not necessary for single and double quotes;
* however, by the rule above, single and double quote characters
* preceded by a backslash still yield single and double quote
* characters, respectively.
--- 281,301 ----
* escapes used for characters and strings are:
*
* <ul>
* <li> Octal escapes are not recognized.
*
! * <li> The character sequence {@code \b} does <i>not</i>
* represent a backspace character.
*
* <li> The method does not treat a backslash character,
! * {@code \}, before a non-valid escape character as an
* error; the backslash is silently dropped. For example, in a
! * Java string the sequence {@code "\z"} would cause a
* compile time error. In contrast, this method silently drops
* the backslash. Therefore, this method treats the two character
! * sequence {@code "\b"} as equivalent to the single
! * character {@code 'b'}.
*
* <li> Escapes are not necessary for single and double quotes;
* however, by the rule above, single and double quote characters
* preceded by a backslash still yield single and double quote
* characters, respectively.
*** 687,710 ****
bw.write(comments.substring(last, current));
bw.newLine();
}
/**
! * Calls the <code>store(OutputStream out, String comments)</code> method
* and suppresses IOExceptions that were thrown.
*
* @deprecated This method does not throw an IOException if an I/O error
* occurs while saving the property list. The preferred way to save a
! * properties list is via the <code>store(OutputStream out,
! * String comments)</code> method or the
! * <code>storeToXML(OutputStream os, String comment)</code> method.
*
* @param out an output stream.
* @param comments a description of the property list.
! * @exception ClassCastException if this <code>Properties</code> object
* contains any keys or values that are not
! * <code>Strings</code>.
*/
@Deprecated
public void save(OutputStream out, String comments) {
try {
store(out, comments);
--- 687,710 ----
bw.write(comments.substring(last, current));
bw.newLine();
}
/**
! * Calls the {@code store(OutputStream out, String comments)} method
* and suppresses IOExceptions that were thrown.
*
* @deprecated This method does not throw an IOException if an I/O error
* occurs while saving the property list. The preferred way to save a
! * properties list is via the {@code store(OutputStream out,
! * String comments)} method or the
! * {@code storeToXML(OutputStream os, String comment)} method.
*
* @param out an output stream.
* @param comments a description of the property list.
! * @exception ClassCastException if this {@code Properties} object
* contains any keys or values that are not
! * {@code Strings}.
*/
@Deprecated
public void save(OutputStream out, String comments) {
try {
store(out, comments);
*** 712,765 ****
}
}
/**
* Writes this property list (key and element pairs) in this
! * <code>Properties</code> table to the output character stream in a
* format suitable for using the {@link #load(java.io.Reader) load(Reader)}
* method.
* <p>
! * Properties from the defaults table of this <code>Properties</code>
* table (if any) are <i>not</i> written out by this method.
* <p>
! * If the comments argument is not null, then an ASCII <code>#</code>
* character, the comments string, and a line separator are first written
! * to the output stream. Thus, the <code>comments</code> can serve as an
* identifying comment. Any one of a line feed ('\n'), a carriage
* return ('\r'), or a carriage return followed immediately by a line feed
! * in comments is replaced by a line separator generated by the <code>Writer</code>
! * and if the next character in comments is not character <code>#</code> or
! * character <code>!</code> then an ASCII <code>#</code> is written out
* after that line separator.
* <p>
* Next, a comment line is always written, consisting of an ASCII
! * <code>#</code> character, the current date and time (as if produced
! * by the <code>toString</code> method of <code>Date</code> for the
! * current time), and a line separator as generated by the <code>Writer</code>.
* <p>
! * Then every entry in this <code>Properties</code> table is
* written out, one per line. For each entry the key string is
! * written, then an ASCII <code>=</code>, then the associated
* element string. For the key, all space characters are
! * written with a preceding <code>\</code> character. For the
* element, leading space characters, but not embedded or trailing
! * space characters, are written with a preceding <code>\</code>
! * character. The key and element characters <code>#</code>,
! * <code>!</code>, <code>=</code>, and <code>:</code> are written
* with a preceding backslash to ensure that they are properly loaded.
* <p>
* After the entries have been written, the output stream is flushed.
* The output stream remains open after this method returns.
* <p>
*
* @param writer an output character stream writer.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
! * @exception ClassCastException if this <code>Properties</code> object
! * contains any keys or values that are not <code>Strings</code>.
! * @exception NullPointerException if <code>writer</code> is null.
* @since 1.6
*/
public void store(Writer writer, String comments)
throws IOException
{
--- 712,765 ----
}
}
/**
* Writes this property list (key and element pairs) in this
! * {@code Properties} table to the output character stream in a
* format suitable for using the {@link #load(java.io.Reader) load(Reader)}
* method.
* <p>
! * Properties from the defaults table of this {@code Properties}
* table (if any) are <i>not</i> written out by this method.
* <p>
! * If the comments argument is not null, then an ASCII {@code #}
* character, the comments string, and a line separator are first written
! * to the output stream. Thus, the {@code comments} can serve as an
* identifying comment. Any one of a line feed ('\n'), a carriage
* return ('\r'), or a carriage return followed immediately by a line feed
! * in comments is replaced by a line separator generated by the {@code Writer}
! * and if the next character in comments is not character {@code #} or
! * character {@code !} then an ASCII {@code #} is written out
* after that line separator.
* <p>
* Next, a comment line is always written, consisting of an ASCII
! * {@code #} character, the current date and time (as if produced
! * by the {@code toString} method of {@code Date} for the
! * current time), and a line separator as generated by the {@code Writer}.
* <p>
! * Then every entry in this {@code Properties} table is
* written out, one per line. For each entry the key string is
! * written, then an ASCII {@code =}, then the associated
* element string. For the key, all space characters are
! * written with a preceding {@code \} character. For the
* element, leading space characters, but not embedded or trailing
! * space characters, are written with a preceding {@code \}
! * character. The key and element characters {@code #},
! * {@code !}, {@code =}, and {@code :} are written
* with a preceding backslash to ensure that they are properly loaded.
* <p>
* After the entries have been written, the output stream is flushed.
* The output stream remains open after this method returns.
* <p>
*
* @param writer an output character stream writer.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
! * @exception ClassCastException if this {@code Properties} object
! * contains any keys or values that are not {@code Strings}.
! * @exception NullPointerException if {@code writer} is null.
* @since 1.6
*/
public void store(Writer writer, String comments)
throws IOException
{
*** 769,812 ****
false);
}
/**
* Writes this property list (key and element pairs) in this
! * <code>Properties</code> table to the output stream in a format suitable
! * for loading into a <code>Properties</code> table using the
* {@link #load(InputStream) load(InputStream)} method.
* <p>
! * Properties from the defaults table of this <code>Properties</code>
* table (if any) are <i>not</i> written out by this method.
* <p>
* This method outputs the comments, properties keys and values in
* the same format as specified in
* {@link #store(java.io.Writer, java.lang.String) store(Writer)},
* with the following differences:
* <ul>
* <li>The stream is written using the ISO 8859-1 character encoding.
*
* <li>Characters not in Latin-1 in the comments are written as
! * <code>\u</code><i>xxxx</i> for their appropriate unicode
* hexadecimal value <i>xxxx</i>.
*
! * <li>Characters less than <code>\u0020</code> and characters greater
! * than <code>\u007E</code> in property keys or values are written
! * as <code>\u</code><i>xxxx</i> for the appropriate hexadecimal
* value <i>xxxx</i>.
* </ul>
* <p>
* After the entries have been written, the output stream is flushed.
* The output stream remains open after this method returns.
* <p>
* @param out an output stream.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
! * @exception ClassCastException if this <code>Properties</code> object
! * contains any keys or values that are not <code>Strings</code>.
! * @exception NullPointerException if <code>out</code> is null.
* @since 1.2
*/
public void store(OutputStream out, String comments)
throws IOException
{
--- 769,812 ----
false);
}
/**
* Writes this property list (key and element pairs) in this
! * {@code Properties} table to the output stream in a format suitable
! * for loading into a {@code Properties} table using the
* {@link #load(InputStream) load(InputStream)} method.
* <p>
! * Properties from the defaults table of this {@code Properties}
* table (if any) are <i>not</i> written out by this method.
* <p>
* This method outputs the comments, properties keys and values in
* the same format as specified in
* {@link #store(java.io.Writer, java.lang.String) store(Writer)},
* with the following differences:
* <ul>
* <li>The stream is written using the ISO 8859-1 character encoding.
*
* <li>Characters not in Latin-1 in the comments are written as
! * {@code \u005Cu}<i>xxxx</i> for their appropriate unicode
* hexadecimal value <i>xxxx</i>.
*
! * <li>Characters less than {@code \u005Cu0020} and characters greater
! * than {@code \u005Cu007E} in property keys or values are written
! * as {@code \u005Cu}<i>xxxx</i> for the appropriate hexadecimal
* value <i>xxxx</i>.
* </ul>
* <p>
* After the entries have been written, the output stream is flushed.
* The output stream remains open after this method returns.
* <p>
* @param out an output stream.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
! * @exception ClassCastException if this {@code Properties} object
! * contains any keys or values that are not {@code Strings}.
! * @exception NullPointerException if {@code out} is null.
* @since 1.2
*/
public void store(OutputStream out, String comments)
throws IOException
{
*** 855,865 ****
* @param in the input stream from which to read the XML document.
* @throws IOException if reading from the specified input stream
* results in an <tt>IOException</tt>.
* @throws InvalidPropertiesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
! * @throws NullPointerException if <code>in</code> is null.
* @see #storeToXML(OutputStream, String, String)
* @since 1.5
*/
public synchronized void loadFromXML(InputStream in)
throws IOException, InvalidPropertiesFormatException
--- 855,865 ----
* @param in the input stream from which to read the XML document.
* @throws IOException if reading from the specified input stream
* results in an <tt>IOException</tt>.
* @throws InvalidPropertiesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
! * @throws NullPointerException if {@code in} is null.
* @see #storeToXML(OutputStream, String, String)
* @since 1.5
*/
public synchronized void loadFromXML(InputStream in)
throws IOException, InvalidPropertiesFormatException
*** 877,894 ****
* <p> An invocation of this method of the form <tt>props.storeToXML(os,
* comment)</tt> behaves in exactly the same way as the invocation
* <tt>props.storeToXML(os, comment, "UTF-8");</tt>.
*
* @param os the output stream on which to emit the XML document.
! * @param comment a description of the property list, or <code>null</code>
* if no comment is desired.
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
! * @throws NullPointerException if <code>os</code> is null.
! * @throws ClassCastException if this <code>Properties</code> object
* contains any keys or values that are not
! * <code>Strings</code>.
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public void storeToXML(OutputStream os, String comment)
throws IOException
--- 877,894 ----
* <p> An invocation of this method of the form <tt>props.storeToXML(os,
* comment)</tt> behaves in exactly the same way as the invocation
* <tt>props.storeToXML(os, comment, "UTF-8");</tt>.
*
* @param os the output stream on which to emit the XML document.
! * @param comment a description of the property list, or {@code null}
* if no comment is desired.
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
! * @throws NullPointerException if {@code os} is null.
! * @throws ClassCastException if this {@code Properties} object
* contains any keys or values that are not
! * {@code Strings}.
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public void storeToXML(OutputStream os, String comment)
throws IOException
*** 905,933 ****
* <p>The XML document will have the following DOCTYPE declaration:
* <pre>
* <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
* </pre>
*
! *<p>If the specified comment is <code>null</code> then no comment
* will be stored in the document.
*
* <p>The specified stream remains open after this method returns.
*
* @param os the output stream on which to emit the XML document.
! * @param comment a description of the property list, or <code>null</code>
* if no comment is desired.
* @param encoding the name of a supported
* <a href="../lang/package-summary.html#charenc">
* character encoding</a>
*
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
! * @throws NullPointerException if <code>os</code> is <code>null</code>,
! * or if <code>encoding</code> is <code>null</code>.
! * @throws ClassCastException if this <code>Properties</code> object
* contains any keys or values that are not
! * <code>Strings</code>.
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public void storeToXML(OutputStream os, String comment, String encoding)
throws IOException
--- 905,933 ----
* <p>The XML document will have the following DOCTYPE declaration:
* <pre>
* <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
* </pre>
*
! *<p>If the specified comment is {@code null} then no comment
* will be stored in the document.
*
* <p>The specified stream remains open after this method returns.
*
* @param os the output stream on which to emit the XML document.
! * @param comment a description of the property list, or {@code null}
* if no comment is desired.
* @param encoding the name of a supported
* <a href="../lang/package-summary.html#charenc">
* character encoding</a>
*
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
! * @throws NullPointerException if {@code os} is {@code null},
! * or if {@code encoding} is {@code null}.
! * @throws ClassCastException if this {@code Properties} object
* contains any keys or values that are not
! * {@code Strings}.
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public void storeToXML(OutputStream os, String comment, String encoding)
throws IOException
*** 939,949 ****
/**
* Searches for the property with the specified key in this property list.
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns
! * <code>null</code> if the property is not found.
*
* @param key the property key.
* @return the value in this property list with the specified key value.
* @see #setProperty
* @see #defaults
--- 939,949 ----
/**
* Searches for the property with the specified key in this property list.
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns
! * {@code null} if the property is not found.
*
* @param key the property key.
* @return the value in this property list with the specified key value.
* @see #setProperty
* @see #defaults