Program: 67397
Project: 67397
Buggy source:
/** 
 * Create and return a new schema for the given namespace.  ElementFormDefault and AttributeFormDefault can be set via SchemaModelGeneratorProperties object.  The namespace resolver's default namespace will be set if non-null.
 * @param uri
 * @param nr
 * @param schemaCount
 * @param properties
 * @return
 */
protected Schema buildNewSchema(String uri,NamespaceResolver nr,int schemaCount,SchemaModelGeneratorProperties properties){
  Schema schema=new Schema();
  schema.setName(SCHEMA_FILE_NAME + schemaCount + SCHEMA_FILE_EXT);
  schemaCount++;
  String defaultNamespace=null;
  if (nr != null) {
    defaultNamespace=nr.getDefaultNamespaceURI();
    if (defaultNamespace != null) {
      schema.setDefaultNamespace(defaultNamespace);
      schema.getNamespaceResolver().setDefaultNamespaceURI(defaultNamespace);
    }
  }
  if (!uri.equals(EMPTY_STRING)) {
    schema.setTargetNamespace(uri);
    String prefix=null;
    if (nr != null) {
      prefix=nr.resolveNamespaceURI(uri);
    }
    if (prefix == null && !uri.equals(defaultNamespace)) {
      prefix=schema.getNamespaceResolver().generatePrefix();
      schema.getNamespaceResolver().put(prefix,uri);
    }
  }
  Properties props=properties.getProperties(uri);
  if (props != null) {
    if (props.containsKey(SchemaModelGeneratorProperties.ELEMENT_FORM_QUALIFIED_KEY)) {
      schema.setElementFormDefault((Boolean)props.get(SchemaModelGeneratorProperties.ELEMENT_FORM_QUALIFIED_KEY));
    }
    if (props.containsKey(SchemaModelGeneratorProperties.ATTRIBUTE_FORM_QUALIFIED_KEY)) {
      schema.setAttributeFormDefault((Boolean)props.get(SchemaModelGeneratorProperties.ATTRIBUTE_FORM_QUALIFIED_KEY));
    }
  }
  return schema;
}

Fixed version (ground truth):
/** 
 * Create and return a new schema for the given namespace.  ElementFormDefault and AttributeFormDefault can be set via SchemaModelGeneratorProperties object.  The namespace resolver's default namespace will be set if non-null.
 * @param uri
 * @param nr
 * @param schemaCount
 * @param properties
 * @return
 */
protected Schema buildNewSchema(String uri,NamespaceResolver nr,int schemaCount,SchemaModelGeneratorProperties properties){
  Schema schema=new Schema();
  schema.setName(SCHEMA_FILE_NAME + schemaCount + SCHEMA_FILE_EXT);
  schemaCount++;
  String defaultNamespace=null;
  if (nr != null) {
    defaultNamespace=nr.getDefaultNamespaceURI();
    if (defaultNamespace != null) {
      schema.setDefaultNamespace(defaultNamespace);
      schema.getNamespaceResolver().setDefaultNamespaceURI(defaultNamespace);
    }
  }
  if (!uri.equals(EMPTY_STRING)) {
    schema.setTargetNamespace(uri);
    String prefix=null;
    if (nr != null) {
      prefix=nr.resolveNamespaceURI(uri);
    }
    if (prefix == null && !uri.equals(defaultNamespace)) {
      prefix=schema.getNamespaceResolver().generatePrefix();
      schema.getNamespaceResolver().put(prefix,uri);
    }
  }
  if (properties != null) {
    Properties props=properties.getProperties(uri);
    if (props != null) {
      if (props.containsKey(SchemaModelGeneratorProperties.ELEMENT_FORM_QUALIFIED_KEY)) {
        schema.setElementFormDefault((Boolean)props.get(SchemaModelGeneratorProperties.ELEMENT_FORM_QUALIFIED_KEY));
      }
      if (props.containsKey(SchemaModelGeneratorProperties.ATTRIBUTE_FORM_QUALIFIED_KEY)) {
        schema.setAttributeFormDefault((Boolean)props.get(SchemaModelGeneratorProperties.ATTRIBUTE_FORM_QUALIFIED_KEY));
      }
    }
  }
  return schema;
}