Program: 16670
Project: 16670
Buggy source:
/** 
 * @param packageName
 * @return cannot return <code>null</null>
 * @throws IOException
 */
public Set<ServletDescriptor> findServlets(String packageName,String startPath,ClassLoader classLoader) throws IOException {
  Set<ServletDescriptor> servlets=new LinkedHashSet<ServletDescriptor>();
  PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver=new PathMatchingResourcePatternResolver(classLoader);
  String patternFinder=ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(packageName) + "String_Node_Str";
  Resource[] resources=pathMatchingResourcePatternResolver.getResources(patternFinder);
  SimpleMetadataReaderFactory simpleMetadataReaderFactory=new SimpleMetadataReaderFactory();
  getLogger().debug("String_Node_Str" + resources.length + "String_Node_Str"+ patternFinder);
  for (  Resource resource : resources) {
    getLogger().debug("String_Node_Str" + resource.getFilename());
    MetadataReader metadataReader=simpleMetadataReaderFactory.getMetadataReader(resource);
    AnnotationMetadata annotationMetadata=getAnnotationMetadataIfServlet(metadataReader,simpleMetadataReaderFactory,pathMatchingResourcePatternResolver);
    if (annotationMetadata != null) {
      Map<String,Object> annotationAttributes=annotationMetadata.getAnnotationAttributes(RemoteServiceRelativePath.class.getName());
      getLogger().debug("String_Node_Str" + metadataReader.getClassMetadata().getClassName());
      if (StringUtils.isNotBlank(startPath)) {
        StringBuilder path=new StringBuilder();
        if (!startPath.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(startPath);
        String annotationPathValue=(String)annotationAttributes.get("String_Node_Str");
        if (!annotationPathValue.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(annotationPathValue);
        ServletDescriptor servletDescriptor=new ServletDescriptor(path.toString(),metadataReader.getClassMetadata().getClassName());
        servlets.add(servletDescriptor);
      }
 else {
        StringBuilder path=new StringBuilder();
        String annotationPathValue=(String)annotationAttributes.get("String_Node_Str");
        if (!annotationPathValue.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(annotationPathValue);
        ServletDescriptor servletDescriptor=new ServletDescriptor(path.toString(),metadataReader.getClassMetadata().getClassName());
        servlets.add(servletDescriptor);
      }
    }
  }
  return servlets;
}

Fixed version (ground truth):
/** 
 * @param packageName
 * @return cannot return <code>null</code>
 * @throws IOException
 */
public Set<ServletDescriptor> findServlets(String packageName,String startPath,ClassLoader classLoader) throws IOException {
  Set<ServletDescriptor> servlets=new LinkedHashSet<ServletDescriptor>();
  PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver=new PathMatchingResourcePatternResolver(classLoader);
  String patternFinder=ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(packageName) + "String_Node_Str";
  Resource[] resources=pathMatchingResourcePatternResolver.getResources(patternFinder);
  SimpleMetadataReaderFactory simpleMetadataReaderFactory=new SimpleMetadataReaderFactory();
  getLogger().debug("String_Node_Str" + resources.length + "String_Node_Str"+ patternFinder);
  for (  Resource resource : resources) {
    getLogger().debug("String_Node_Str" + resource.getFilename());
    MetadataReader metadataReader=simpleMetadataReaderFactory.getMetadataReader(resource);
    AnnotationMetadata annotationMetadata=getAnnotationMetadataIfServlet(metadataReader,simpleMetadataReaderFactory,pathMatchingResourcePatternResolver);
    if (annotationMetadata != null) {
      Map<String,Object> annotationAttributes=annotationMetadata.getAnnotationAttributes(RemoteServiceRelativePath.class.getName());
      getLogger().debug("String_Node_Str" + metadataReader.getClassMetadata().getClassName());
      if (StringUtils.isNotBlank(startPath)) {
        StringBuilder path=new StringBuilder();
        if (!startPath.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(startPath);
        String annotationPathValue=(String)annotationAttributes.get("String_Node_Str");
        if (!annotationPathValue.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(annotationPathValue);
        ServletDescriptor servletDescriptor=new ServletDescriptor(path.toString(),metadataReader.getClassMetadata().getClassName());
        servlets.add(servletDescriptor);
      }
 else {
        StringBuilder path=new StringBuilder();
        String annotationPathValue=(String)annotationAttributes.get("String_Node_Str");
        if (!annotationPathValue.startsWith("String_Node_Str")) {
          path.append('/');
        }
        path.append(annotationPathValue);
        ServletDescriptor servletDescriptor=new ServletDescriptor(path.toString(),metadataReader.getClassMetadata().getClassName());
        servlets.add(servletDescriptor);
      }
    }
  }
  return servlets;
}