Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InitializationException eats exception of constructor called by @XStreamConverter #37

Closed
ge0ffrey opened this issue Jan 21, 2016 · 2 comments

Comments

@ge0ffrey
Copy link

commented Jan 21, 2016

We have code like this (in optaplanner.org):

public class CloudBalance {

    @XStreamConverter(value = XStreamScoreConverter.class, types = {HardSoftScoreDefinition.class})
    private HardSoftScore score;

}

public class XStreamScoreConverter {

    public XStreamScoreConverter(Class scoreClass, Class scoreDefinitionClass) {
        if (scoreDefinitionClass.equals(HardSoftScoreDefinition.class)) { // true
            throw new IllegalStateException("Please don't eat me!!!");
        }
    }
}

And that throws this exception:

com.thoughtworks.xstream.InitializationException: Cannot instantiate converter ...XStreamScoreConverter for type ...HardSoftScore : Cannot construct ...XStreamScoreConverter : null

Notice that the IllegalStateException "Please don't eat me!!!" is actually eaten. Instead of being eaten, it should be wrapped as a cause:

Caused by: ...IllegalStateException Please don't eat me!!!
@joehni joehni added the bug label Feb 9, 2016
@joehni joehni added this to the 1.4.x milestone Feb 9, 2016
@joehni joehni self-assigned this Feb 9, 2016
@joehni

This comment has been minimized.

Copy link
Member

commented Feb 9, 2016

Caused by JDK 1.3 compatibility code ;-)

joehni added a commit that referenced this issue Feb 9, 2016
InvocationTargetException. Closes #37.
@joehni joehni closed this in e2f0a64 Feb 9, 2016
@ge0ffrey

This comment has been minimized.

Copy link
Author

commented Feb 9, 2016

Thanks, xstream is great :)

@joehni joehni modified the milestones: 1.4.9, 1.4.x Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.