aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/io/PrintStream.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gandalf@gcc.gnu.org>2012-03-23 15:19:26 +0000
committerAndrew John Hughes <gandalf@gcc.gnu.org>2012-03-23 15:19:26 +0000
commit0563022a206294757effa44686727bffc4f7c2bd (patch)
treefebe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/java/io/PrintStream.java
parent21669dfe20db0246ece395db5558a081a5c7088f (diff)
downloadgcc-0563022a206294757effa44686727bffc4f7c2bd.zip
gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.gz
gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.bz2
Merge GNU Classpath 0.99 into libjava.
From-SVN: r185741
Diffstat (limited to 'libjava/classpath/java/io/PrintStream.java')
-rw-r--r--libjava/classpath/java/io/PrintStream.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/libjava/classpath/java/io/PrintStream.java b/libjava/classpath/java/io/PrintStream.java
index eaab7c3..caa6035 100644
--- a/libjava/classpath/java/io/PrintStream.java
+++ b/libjava/classpath/java/io/PrintStream.java
@@ -181,10 +181,15 @@ public class PrintStream extends FilterOutputStream implements Appendable
* @param out The <code>OutputStream</code> to write to.
* @param auto_flush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
+ * @exception NullPointerException If out is null.
*/
public PrintStream (OutputStream out, boolean auto_flush)
{
super (out);
+
+ if (out == null)
+ throw new NullPointerException("out is null");
+
String encoding;
try {
encoding = SystemProperties.getProperty("file.encoding");
@@ -213,12 +218,19 @@ public class PrintStream extends FilterOutputStream implements Appendable
* line, <code>false</code> otherwise
* @param encoding The name of the character encoding to use for this
* object.
+ * @exception NullPointerException If out or encoding is null.
*/
public PrintStream (OutputStream out, boolean auto_flush, String encoding)
throws UnsupportedEncodingException
{
super (out);
+ if (out == null)
+ throw new NullPointerException("out is null");
+
+ if (encoding == null)
+ throw new NullPointerException("encoding is null");
+
new String(new byte[]{0}, encoding); // check if encoding is supported
this.encoding = encoding;
this.auto_flush = auto_flush;