| Class and Description |
|---|
| java.io.LineNumberInputStream
This class incorrectly assumes that bytes adequately represent
characters. As of JDK 1.1, the preferred way to operate on
character streams is via the new character-stream classes, which
include a class for counting line numbers.
|
| Field and Description |
|---|
| java.util.logging.Logger.global
Initialization of this field is prone to deadlocks.
The field must be initialized by the Logger class initialization
which may cause deadlocks with the LogManager class initialization.
In such cases two class initialization wait for each other to complete.
The preferred way to get the global logger object is via the call
Logger.getGlobal().
For compatibility with old JDK versions where the
Logger.getGlobal() is not available use the call
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
or Logger.getLogger("global"). |
| Method and Description |
|---|
| java.lang.Thread.countStackFrames()
The definition of this call depends on
Thread.suspend(),
which is deprecated. Further, the results of this call
were never well-defined. |
| java.lang.ClassLoader.defineClass(byte[], int, int)
Replaced by
defineClass(String, byte[], int, int) |
| java.lang.Thread.destroy()
This method was originally designed to destroy this
thread without any cleanup. Any monitors it held would have
remained locked. However, the method was never implemented.
If if were to be implemented, it would be deadlock-prone in
much the manner of
Thread.suspend(). If the target thread held
a lock protecting a critical system resource when it was
destroyed, no thread could ever access this resource again.
If another thread ever attempted to lock this resource, deadlock
would result. Such deadlocks typically manifest themselves as
"frozen" processes. For more information, see
Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?. |
| java.lang.String.getBytes(int, int, byte[], int)
This method does not properly convert characters into
bytes. As of JDK 1.1, the preferred way to do this is via the
String.getBytes() method, which uses the platform's default charset. |
| java.util.Date.getDate()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.DAY_OF_MONTH). |
| java.util.Date.getDay()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.DAY_OF_WEEK). |
| java.net.URLConnection.getDefaultRequestProperty(String)
The instance specific getRequestProperty method
should be used after an appropriate instance of URLConnection
is obtained.
|
| java.util.Date.getHours()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.HOUR_OF_DAY). |
| java.util.Date.getMinutes()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.MINUTE). |
| java.util.Date.getMonth()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.MONTH). |
| java.util.Date.getSeconds()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.SECOND). |
| java.util.Date.getTimezoneOffset()
As of JDK version 1.1,
replaced by
-(Calendar.get(Calendar.ZONE_OFFSET) +
Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000). |
| java.util.Date.getYear()
As of JDK version 1.1,
replaced by
Calendar.get(Calendar.YEAR) - 1900. |
| java.lang.Character.isSpace(char)
Replaced by isWhitespace(char).
|
| java.util.Date.parse(String)
As of JDK version 1.1,
replaced by
DateFormat.parse(String s). |
| java.io.ObjectInputStream.readLine()
This method does not properly convert bytes to characters.
see DataInputStream for the details and alternatives.
|
| java.io.DataInputStream.readLine()
This method does not properly convert bytes to characters.
As of JDK 1.1, the preferred way to read lines of text is via the
BufferedReader.readLine() method. Programs that use the
DataInputStream class to read lines can be converted to use
the BufferedReader class by replacing code of the form:
with:
|
| java.lang.Thread.resume()
This method exists solely for use with
Thread.suspend(),
which has been deprecated because it is deadlock-prone.
For more information, see
Why
are Thread.stop, Thread.suspend and Thread.resume Deprecated?. |
| java.util.Properties.save(OutputStream, String)
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
store(OutputStream out,
String comments) method or the
storeToXML(OutputStream os, String comment) method. |
| java.util.Date.setDate(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.DAY_OF_MONTH, int date). |
| java.net.URLConnection.setDefaultRequestProperty(String, String)
The instance specific setRequestProperty method
should be used after an appropriate instance of URLConnection
is obtained. Invoking this method will have no effect.
|
| java.util.Date.setHours(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.HOUR_OF_DAY, int hours). |
| java.util.Date.setMinutes(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.MINUTE, int minutes). |
| java.util.Date.setMonth(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.MONTH, int month). |
| java.util.Date.setSeconds(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.SECOND, int seconds). |
| java.net.URLStreamHandler.setURL(URL, String, String, int, String, String)
Use setURL(URL, String, String, int, String, String, String,
String);
|
| java.util.Date.setYear(int)
As of JDK version 1.1,
replaced by
Calendar.set(Calendar.YEAR, year + 1900). |
| java.lang.Thread.stop()
This method is inherently unsafe. Stopping a thread with
Thread.stop causes it to unlock all of the monitors that it
has locked (as a natural consequence of the unchecked
ThreadDeath exception propagating up the stack). If
any of the objects previously protected by these monitors were in
an inconsistent state, the damaged objects become visible to
other threads, potentially resulting in arbitrary behavior. Many
uses of stop should be replaced by code that simply
modifies some variable to indicate that the target thread should
stop running. The target thread should check this variable
regularly, and return from its run method in an orderly fashion
if the variable indicates that it is to stop running. If the
target thread waits for long periods (on a condition variable,
for example), the interrupt method should be used to
interrupt the wait.
For more information, see
Why
are Thread.stop, Thread.suspend and Thread.resume Deprecated?. |
| java.lang.Thread.stop(Throwable)
This method is inherently unsafe. See
Thread.stop()
for details. An additional danger of this
method is that it may be used to generate exceptions that the
target thread is unprepared to handle (including checked
exceptions that the thread could not possibly throw, were it
not for this method).
For more information, see
Why
are Thread.stop, Thread.suspend and Thread.resume Deprecated?. |
| java.lang.Thread.suspend()
This method has been deprecated, as it is
inherently deadlock-prone. If the target thread holds a lock on the
monitor protecting a critical system resource when it is suspended, no
thread can access this resource until the target thread is resumed. If
the thread that would resume the target thread attempts to lock this
monitor prior to calling
resume, deadlock results. Such
deadlocks typically manifest themselves as "frozen" processes.
For more information, see
Why
are Thread.stop, Thread.suspend and Thread.resume Deprecated?. |
| java.util.Date.toGMTString()
As of JDK version 1.1,
replaced by
DateFormat.format(Date date), using a
GMT TimeZone. |
| java.util.Date.toLocaleString()
As of JDK version 1.1,
replaced by
DateFormat.format(Date date). |
| java.io.ByteArrayOutputStream.toString(int)
This method does not properly convert bytes into characters.
As of JDK 1.1, the preferred way to do this is via the
toString(String enc) method, which takes an encoding-name
argument, or the toString() method, which uses the
platform's default character encoding. |
| java.io.File.toURL() |
| java.util.Date.UTC(int, int, int, int, int, int)
As of JDK version 1.1,
replaced by
Calendar.set(year + 1900, month, date,
hrs, min, sec) or GregorianCalendar(year + 1900,
month, date, hrs, min, sec), using a UTC
TimeZone, followed by Calendar.getTime().getTime(). |
| java.io.ObjectOutputStream.PutField.write(ObjectOutput)
This method does not write the values contained by this
PutField object in a proper format, and may
result in corruption of the serialization stream. The
correct way to write PutField data is by
calling the ObjectOutputStream.writeFields()
method. |
| Constructor and Description |
|---|
| java.util.Date(int, int, int)
As of JDK version 1.1,
replaced by
Calendar.set(year + 1900, month, date)
or GregorianCalendar(year + 1900, month, date). |
| java.util.Date(int, int, int, int, int)
As of JDK version 1.1,
replaced by
Calendar.set(year + 1900, month, date,
hrs, min) or GregorianCalendar(year + 1900,
month, date, hrs, min). |
| java.util.Date(int, int, int, int, int, int)
As of JDK version 1.1,
replaced by
Calendar.set(year + 1900, month, date,
hrs, min, sec) or GregorianCalendar(year + 1900,
month, date, hrs, min, sec). |
| java.util.Date(String)
As of JDK version 1.1,
replaced by
DateFormat.parse(String s). |
| java.lang.String(byte[], int)
This method does not properly convert bytes into
characters. As of JDK 1.1, the preferred way to do this is via the
String constructors that take a Charset, charset name, or that use the platform's
default charset. |
| java.lang.String(byte[], int, int, int)
This method does not properly convert bytes into characters.
As of JDK 1.1, the preferred way to do this is via the
String constructors that take a Charset, charset name, or that use the platform's
default charset. |
Copyright © 2016 API Design. All Rights Reserved.