Created
November 28, 2014 15:00
-
-
Save dashorst/051a2cc07ad8f25635ea to your computer and use it in GitHub Desktop.
A brilliant piece of code...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sun.xml.bind.v2.model.impl; | |
... | |
public class ModelBuilder { | |
... | |
static { | |
try { | |
XmlSchema s = null; | |
s.location(); | |
} catch (NullPointerException e) { | |
// as epxected | |
} catch (NoSuchMethodError e) { | |
// this is not a 2.1 API. Where is it being loaded from? | |
Messages res; | |
if (SecureLoader.getClassClassLoader(XmlSchema.class) == null) { | |
res = Messages.INCOMPATIBLE_API_VERSION_MUSTANG; | |
} else { | |
res = Messages.INCOMPATIBLE_API_VERSION; | |
} | |
throw new LinkageError( res.format( | |
Which.which(XmlSchema.class), | |
Which.which(ModelBuilder.class) | |
)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It makes me both chuckle and cry every time I see that (usually when I turn on NPE breakpoints in eclipse)