Program: 177217
Project: 177217
Buggy source:
/** 
 * Finds the adapter type of the specified type, given the referer and the package of the referer.
 * @param adaptedType The type for which to find the adapter.
 * @param referer The referer.
 * @param pckg The package of the referer.
 * @return The adapter type, or null if none was found.
 */
private static AdapterType findAdapterType(TypeMirror adaptedType,Declaration referer,PackageDeclaration pckg){
  adaptedType=unwrapComponentType(adaptedType);
  XmlJavaTypeAdapter typeAdapterInfo=referer.getAnnotation(XmlJavaTypeAdapter.class);
  if (adaptedType instanceof DeclaredType) {
    if (typeAdapterInfo == null) {
      typeAdapterInfo=((DeclaredType)adaptedType).getDeclaration().getAnnotation(XmlJavaTypeAdapter.class);
    }
    if (typeAdapterInfo == null) {
      typeAdapterInfo=getAdaptersOfPackage(pckg).get(((DeclaredType)adaptedType).getDeclaration().getQualifiedName());
    }
    if (typeAdapterInfo != null) {
      ClassType adapterTypeMirror;
      try {
        Class adaptedClass=typeAdapterInfo.value();
        AnnotationProcessorEnvironment ape=Context.getCurrentEnvironment();
        adapterTypeMirror=(ClassType)ape.getTypeUtils().getDeclaredType(ape.getTypeDeclaration(adaptedClass.getName()));
      }
 catch (      MirroredTypeException e) {
        adapterTypeMirror=(ClassType)e.getTypeMirror();
      }
      AdapterType adapterType=new AdapterType(adapterTypeMirror);
      if (!adaptedType.equals(adapterType.getAdaptedType())) {
        throw new ValidationException(referer.getPosition(),"String_Node_Str" + adapterTypeMirror.getDeclaration().getQualifiedName() + "String_Node_Str"+ adaptedType);
      }
      return adapterType;
    }
  }
 else   if (typeAdapterInfo != null) {
    throw new ValidationException(referer.getPosition(),"String_Node_Str" + adaptedType + "String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the adapter type of the specified type, given the referer and the package of the referer.
 * @param adaptedType The type for which to find the adapter.
 * @param referer The referer.
 * @param pckg The package of the referer.
 * @return The adapter type, or null if none was found.
 */
private static AdapterType findAdapterType(TypeMirror adaptedType,Declaration referer,PackageDeclaration pckg){
  adaptedType=unwrapComponentType(adaptedType);
  XmlJavaTypeAdapter typeAdapterInfo=referer != null ? referer.getAnnotation(XmlJavaTypeAdapter.class) : null;
  if (adaptedType instanceof DeclaredType) {
    if (typeAdapterInfo == null) {
      typeAdapterInfo=((DeclaredType)adaptedType).getDeclaration().getAnnotation(XmlJavaTypeAdapter.class);
    }
    if ((typeAdapterInfo == null) && (pckg != null)) {
      typeAdapterInfo=getAdaptersOfPackage(pckg).get(((DeclaredType)adaptedType).getDeclaration().getQualifiedName());
    }
    if (typeAdapterInfo != null) {
      ClassType adapterTypeMirror;
      try {
        Class adaptedClass=typeAdapterInfo.value();
        AnnotationProcessorEnvironment ape=Context.getCurrentEnvironment();
        adapterTypeMirror=(ClassType)ape.getTypeUtils().getDeclaredType(ape.getTypeDeclaration(adaptedClass.getName()));
      }
 catch (      MirroredTypeException e) {
        adapterTypeMirror=(ClassType)e.getTypeMirror();
      }
      AdapterType adapterType=new AdapterType(adapterTypeMirror);
      if (!adaptedType.equals(adapterType.getAdaptedType())) {
        throw new ValidationException(referer.getPosition(),"String_Node_Str" + adapterTypeMirror.getDeclaration().getQualifiedName() + "String_Node_Str"+ adaptedType);
      }
      return adapterType;
    }
  }
 else   if (typeAdapterInfo != null) {
    throw new ValidationException(referer.getPosition(),"String_Node_Str" + adaptedType + "String_Node_Str");
  }
  return null;
}