-
Bug
-
Resolution: Not an Issue
-
P5
-
None
-
1.3.0
-
sparc
-
solaris_2.6
Name: sdR10048 Date: 04/25/2000
The method
public String toString()
of 5 classes:
java.awt.JobAttributes.DefaultSelectionType
java.awt.JobAttributes.DestinationType
java.awt.JobAttributes.DialogType
java.awt.JobAttributes.MultipleDocumentHandlingType
java.awt.JobAttributes.SidesType
returns wrong string.
The docs for all classes says:
public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the
toString method returns a string that "textually represents" this
object. The result should be a concise but informative representation
that is easy for a person to read. It is recommended that all
subclasses override this method.
The toString method for class Object returns a string consisting of
the name of the class of which the object is an instance, the at-sign
character `@', and the unsigned hexadecimal representation of the hash
code of the object. In other words, this method returns a string equal
to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Overrides:
toString in class Object
Following copied from class: java.lang.Object
Returns:
a string representation of the object.
the test:
--------------------------------------------------
import java.awt.JobAttributes.*;
public class Test {
public static void main(String[] args) {
Object objects[] = {
DefaultSelectionType.ALL,
DestinationType.FILE,
DialogType.COMMON,
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES,
SidesType.ONE_SIDED,
};
for (int i=0; i<objects.length; i++) {
System.out.println("Real life: "+objects[i].toString());
System.out.println(" Expected: "+objects[i].getClass().getName()+"@"+Integer.toHexString(objects[0].hashCode()));
}
}
}
the output:
--------------------------------------------------
] java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-A)
Java HotSpot(TM) Client VM (build 1.3.0-A, interpreted mode)
] java Test
Real life: all
Expected: java.awt.JobAttributes$DefaultSelectionType@0
Real life: file
Expected: java.awt.JobAttributes$DestinationType@0
Real life: common
Expected: java.awt.JobAttributes$DialogType@0
Real life: separate-documents-collated-copies
Expected: java.awt.JobAttributes$MultipleDocumentHandlingType@0
Real life: one-sided
Expected: java.awt.JobAttributes$SidesType@0
--------------------------------------------------
======================================================================
- relates to
-
JDK-4330490 java.awt.PageAttributes.*Type.toString() returns wrong string.
- Closed