Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318188

Summary: Usability Issue - Confusing error message thrown when get/set mismatch is present.
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david.twelves, rick.barkhouse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Blaise Doughan CLA 2010-06-28 11:05:20 EDT
A confusing error message is thrown for the following scenario.  Granted this scenario is odd.

Problematic class:

public class Customer {

    private int id;

    public int getId() {
        return id;
    }

    public void setName(int name) {
        this.id = name;
    }

    @Override
    public boolean equals(Object object) {
        if(null == object || Customer.class != object.getClass()) {
            return false;
        }
        Customer customer = (Customer) object;
        return customer.getId() == id;
    }

}


Error Message:

javax.xml.bind.JAXBException: 
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-7198] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Class: [int] was not found while converting from class names to classes.
Internal Exception: java.lang.ClassNotFoundException: int

 - with linked exception:
[Exception [EclipseLink-0] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-7198] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Class: [int] was not found while converting from class names to classes.
Internal Exception: java.lang.ClassNotFoundException: int
]
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:247)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:207)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:104)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:94)
	at org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmladapter.negative.NegativeTestCases.testNegative(NegativeTestCases.java:32)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Runtime Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-7198] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Class: [int] was not found while converting from class names to classes.
Internal Exception: java.lang.ClassNotFoundException: int

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:471)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:628)
	at org.eclipse.persistence.oxm.XMLContext.<init>(XMLContext.java:213)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:336)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:245)
	... 22 more
Comment 1 Rick Barkhouse CLA 2011-05-03 14:16:45 EDT
Created attachment 194620 [details]
Patch
Comment 2 Rick Barkhouse CLA 2011-05-03 14:24:43 EDT
EclipseLink is no longer throwing this exception in this case, but I have added code to our tests to ensure that this case will be caught if a regression occurs.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:25:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink