Skip to content

Commit

Permalink
BZ-1326805 - Serialization problems on websphere as a result of BZ-12…
Browse files Browse the repository at this point in the history
…99549 (#442)
  • Loading branch information
mrietveld authored and mswiderski committed Apr 20, 2016
1 parent f787f6c commit 224900c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Expand Up @@ -125,6 +125,10 @@ public static void clearDeploymentJaxbContext() {

// JAXBContext methods --------------------------------------------------------------------------------------------------------

JAXBContext getRequestContext() {
return requestJaxbContext.get();
}

/*
* (non-Javadoc)
* @see javax.xml.bind.JAXBContext#createUnmarshaller()
Expand Down Expand Up @@ -167,8 +171,6 @@ public Validator createValidator() throws JAXBException {

// Deployment jaxbContext management and creation logic -----------------------------------------------------------------------



@Override
public boolean equals( Object obj ) {
if( obj instanceof DynamicJaxbContext ) {
Expand All @@ -177,5 +179,4 @@ public boolean equals( Object obj ) {
return false;
}


}
}
Expand Up @@ -39,6 +39,25 @@ public class DynamicJaxbContextManager {

private static final Logger logger = LoggerFactory.getLogger(DynamicJaxbContextManager.class);


private final static boolean onWebsphere;
private final static String WEBSPHERE_JAXB_CACHING_CLASS_NAME
= "org.apache.wink.common.internal.providers.entity.xml.AbstractJAXBProvider";

static {
// websphere stuff
boolean classFound = false;
try {
Class.forName(WEBSPHERE_JAXB_CACHING_CLASS_NAME);
classFound = true;
} catch (ClassNotFoundException e) {
// no-op
}
onWebsphere = classFound;
}

// LOGGING IF MULTIPLE INSTANCES ARE CREATED ----------------------------------------------------------------------------------

private static AtomicInteger instanceCreated = new AtomicInteger(0);

public DynamicJaxbContextManager() {
Expand Down Expand Up @@ -204,6 +223,10 @@ private void removeClassFromJaxbContextClassList( List<Class> classList, Illegal
}

public JAXBContext getJaxbContext() {
return _jaxbContextInstance;
if (onWebsphere ) {
return _jaxbContextInstance.getRequestContext();
} else {
return _jaxbContextInstance;
}
}
}

0 comments on commit 224900c

Please sign in to comment.