javaee / jaxb2-commons

JAXB Implementation project has been contributed to Eclipse Foundation. This repository is for legacy review only. Please refer to the Eclipse EE4J Metro project for the very latest
https://eclipse-ee4j.github.io/jaxb-ri/
Other
16 stars 15 forks source link

CopyBuilder.copy should indicate which elements it cant copy #10

Closed glassfishrobot closed 16 years ago

glassfishrobot commented 16 years ago

Currently it just says java.lang.UnsupportedOperationException and not what exactly is unsupported. Need to use debugger to find out.

Environment

Operating System: All Platform: All

Affected Versions

[0.3]

glassfishrobot commented 16 years ago

Reported by najmi

glassfishrobot commented 16 years ago

lexi said: UOE is thrown if cloning using the clone() method for some reason fails. I've changed the code to report the error more verbously:

if (object instanceof Cloneable) { try { final Method cloneMethod = object.getClass().getMethod("clone", (Class[]) null); if (cloneMethod.isAccessible())

{ return cloneMethod.invoke(object, (Object[]) null); }

else

{ throw new UnsupportedOperationException( "Could not clone object [" + object + "].", new CloneNotSupportedException( "Object class [" + object.getClass() + "] implements java.lang.Cloneable interface, " + "but clone() method is not accessible. " + "By convention, classes that implement java.lang.Cloneable " + "should override java.lang.Object.clone() method (which is protected) " + "with a public method.")); }

} catch (Exception ex)

{ throw new UnsupportedOperationException( "Could not clone the object [" + object + "] as invocation of the clone() method has thrown an exception.", ex); }

}

The fix will be available in 0.3.1.

glassfishrobot commented 16 years ago

najmi said: Created an attachment (id=8) HJ3 Generated source file for AnyValueType in rim.xsd

glassfishrobot commented 16 years ago

lexi said: Done.

glassfishrobot commented 16 years ago

File: AnyValueType.java Attached By: najmi

glassfishrobot commented 16 years ago

Was assigned to lexi

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAXB2_COMMONS-10

glassfishrobot commented 16 years ago

Marked as fixed on Friday, November 21st 2008, 8:48:19 pm