Program: 29339
Project: 29339
Buggy source:
/** 
 * {@inheritDoc}
 */
public MessageEndpoint createEndpoint(XAResource xaResource,long timeout) throws UnavailableException {
synchronized (this) {
    if (myState == BLOCKED) {
      try {
        wait(timeout);
      }
 catch (      Exception e) {
      }
 finally {
        myState=UNBLOCKED;
      }
    }
  }
  if (!started_) {
    logger.log(Level.WARNING,"String_Node_Str");
    throw new UnavailableException("String_Node_Str");
  }
  MessageEndpoint endpoint=null;
  try {
    ResourceHandle resourceHandle=allocator_.createResource(xaResource);
    MessageBeanListener listener=messageBeanPM_.createMessageBeanListener(resourceHandle);
    String moduleID=getDescriptor().getApplication().getModuleID();
    Class endpointClass=null;
    ClassLoader loader=null;
    try {
      BundleDescriptor moduleDesc=getDescriptor().getEjbBundleDescriptor();
      loader=moduleDesc.getClassLoader();
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
    if (loader == null) {
      loader=Thread.currentThread().getContextClassLoader();
    }
    endpointClass=loader.loadClass(MESSAGE_ENDPOINT);
    String msgListenerType=getDescriptor().getMessageListenerType();
    if (msgListenerType == null || "String_Node_Str".equals(msgListenerType))     msgListenerType="String_Node_Str";
    Class listenerClass=loader.loadClass(msgListenerType);
    MessageEndpointInvocationHandler handler=new MessageEndpointInvocationHandler(listener,messageBeanPM_);
    endpoint=(MessageEndpoint)Proxy.newProxyInstance(loader,new Class[]{endpointClass,listenerClass},handler);
  }
 catch (  Exception ex) {
    throw (UnavailableException)(new UnavailableException()).initCause(ex);
  }
  return endpoint;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MessageEndpoint createEndpoint(XAResource xaResource,long timeout) throws UnavailableException {
synchronized (this) {
    while (myState == BLOCKED) {
      try {
        wait(timeout);
      }
 catch (      Exception e) {
      }
 finally {
        myState=UNBLOCKED;
      }
    }
  }
  if (!started_) {
    logger.log(Level.WARNING,"String_Node_Str");
    throw new UnavailableException("String_Node_Str");
  }
  MessageEndpoint endpoint=null;
  try {
    ResourceHandle resourceHandle=allocator_.createResource(xaResource);
    MessageBeanListener listener=messageBeanPM_.createMessageBeanListener(resourceHandle);
    String moduleID=getDescriptor().getApplication().getModuleID();
    Class endpointClass=null;
    ClassLoader loader=null;
    try {
      BundleDescriptor moduleDesc=getDescriptor().getEjbBundleDescriptor();
      loader=moduleDesc.getClassLoader();
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
    if (loader == null) {
      loader=Thread.currentThread().getContextClassLoader();
    }
    endpointClass=loader.loadClass(MESSAGE_ENDPOINT);
    String msgListenerType=getDescriptor().getMessageListenerType();
    if (msgListenerType == null || "String_Node_Str".equals(msgListenerType))     msgListenerType="String_Node_Str";
    Class listenerClass=loader.loadClass(msgListenerType);
    MessageEndpointInvocationHandler handler=new MessageEndpointInvocationHandler(listener,messageBeanPM_);
    endpoint=(MessageEndpoint)Proxy.newProxyInstance(loader,new Class[]{endpointClass,listenerClass},handler);
  }
 catch (  Exception ex) {
    throw (UnavailableException)(new UnavailableException()).initCause(ex);
  }
  return endpoint;
}