Commit 38271500 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

If __CanSetPrintStream__ is being set on a __CanSetPrintStream__, then use its...

If __CanSetPrintStream__ is being set on a __CanSetPrintStream__, then use its target rather than the class itself.
parent e83b0393
......@@ -51,6 +51,9 @@ More detailed changes:
* Added `java.util.Vector`, it was missing.
* Added support for ISO-8859-15, this is the newer encoding with the
Euro symbol.
* Corrected bug in `__CanSetPrintStream__` where if it were set to itself
then it could lead to infinite recursion, instead if this kind of
stream is attempted to be set it will use the target.
* Implemented `java.io.InputStream`.
* Implemented `java.util.EventObject`.
* Implemented `java.util.Hashtable`.
......
......@@ -473,6 +473,12 @@ final class __CanSetPrintStream__
if (__ps == null)
throw new NullPointerException("NARG");
// If this is a can set stream then we likely tried to restore the
// old output stream, so if we ever print anything again this will
// fail completely with infinite recursion.
while (__ps instanceof __CanSetPrintStream__)
__ps = ((__CanSetPrintStream__)__ps)._target;
// Lock
synchronized (lock)
{
......@@ -481,7 +487,7 @@ final class __CanSetPrintStream__
// trickery could be done which causes flush to fail.
try
{
flush();
this.flush();
}
// Completely ignore, also do not try printing the stack trace
......@@ -491,7 +497,7 @@ final class __CanSetPrintStream__
}
// Change it
_target = __ps;
this._target = __ps;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment