Program: 64133
Project: 64133
Buggy source:
/** 
 * A convenience method to get the domain class (i.e. <i>Customer</i>) from  the parameter/return type (i.e. <i>Customer</i>, <i>List&lt;Customer></i>, <i>JAXBElement&lt;Customer></i>, <i>JAXBElement&lt;? extends Customer></i>,  <i>List&lt;JAXBElement&lt;Customer>></i>, or  <i>List&lt;JAXBElement&lt;? extends Customer>></i>).
 * @param genericType - The parameter/return type of the JAX-RS operation.
 * @return The corresponding domain class.
 */
protected Class<?> getDomainClass(Type genericType){
  if (genericType instanceof Class && genericType != JAXBElement.class) {
    Class<?> clazz=(Class<?>)genericType;
    if (clazz.isArray()) {
      return getDomainClass(clazz.getComponentType());
    }
    return clazz;
  }
 else   if (genericType instanceof ParameterizedType) {
    Type type=((ParameterizedType)genericType).getActualTypeArguments()[0];
    if (type instanceof ParameterizedType) {
      Type rawType=((ParameterizedType)type).getRawType();
      if (rawType == JAXBElement.class) {
        return getDomainClass(type);
      }
    }
 else     if (type instanceof WildcardType) {
      Type[] upperTypes=((WildcardType)type).getUpperBounds();
      if (upperTypes.length > 0) {
        Type upperType=upperTypes[0];
        if (upperType instanceof Class) {
          return (Class<?>)upperType;
        }
      }
    }
 else     if (JAXBElement.class == type) {
      return Object.class;
    }
    return (Class<?>)type;
  }
 else   if (genericType instanceof GenericArrayType) {
    GenericArrayType genericArrayType=(GenericArrayType)genericType;
    return getDomainClass(genericArrayType.getGenericComponentType());
  }
 else {
    return Object.class;
  }
}

Fixed version (ground truth):
/** 
 * A convenience method to get the domain class (i.e. <i>Customer</i>) from  the parameter/return type (i.e. <i>Customer</i>, <i>List&lt;Customer></i>, <i>JAXBElement&lt;Customer></i>, <i>JAXBElement&lt;? extends Customer></i>,  <i>List&lt;JAXBElement&lt;Customer>></i>, or  <i>List&lt;JAXBElement&lt;? extends Customer>></i>).
 * @param genericType - The parameter/return type of the JAX-RS operation.
 * @return The corresponding domain class.
 */
protected Class<?> getDomainClass(Type genericType){
  if (null == genericType) {
    return Object.class;
  }
  if (genericType instanceof Class && genericType != JAXBElement.class) {
    Class<?> clazz=(Class<?>)genericType;
    if (clazz.isArray()) {
      return getDomainClass(clazz.getComponentType());
    }
    return clazz;
  }
 else   if (genericType instanceof ParameterizedType) {
    Type type=((ParameterizedType)genericType).getActualTypeArguments()[0];
    if (type instanceof ParameterizedType) {
      Type rawType=((ParameterizedType)type).getRawType();
      if (rawType == JAXBElement.class) {
        return getDomainClass(type);
      }
    }
 else     if (type instanceof WildcardType) {
      Type[] upperTypes=((WildcardType)type).getUpperBounds();
      if (upperTypes.length > 0) {
        Type upperType=upperTypes[0];
        if (upperType instanceof Class) {
          return (Class<?>)upperType;
        }
      }
    }
 else     if (JAXBElement.class == type) {
      return Object.class;
    }
    return (Class<?>)type;
  }
 else   if (genericType instanceof GenericArrayType) {
    GenericArrayType genericArrayType=(GenericArrayType)genericType;
    return getDomainClass(genericArrayType.getGenericComponentType());
  }
 else {
    return Object.class;
  }
}