Program: 64437
Project: 64437
Buggy source:
public PrefixMapperNamespaceResolver(org.eclipse.persistence.oxm.NamespacePrefixMapper mapper,NamespaceResolver nestedResolver){
  prefixMapper=mapper;
  String[] declarations=mapper.getContextualNamespaceDecls();
  if (declarations != null && declarations.length > 0) {
    contextualNamespaces=new NamespaceResolver();
    for (int i=0; i < declarations.length - 1; i+=2) {
      String prefix=declarations[i];
      String uri=declarations[i + 1];
      contextualNamespaces.put(prefix,uri);
    }
  }
  String defaultUri=null;
  if (nestedResolver != null) {
    for (    Object next : nestedResolver.getNamespaces()) {
      Namespace ns=(Namespace)next;
      String uri=ns.getNamespaceURI();
      String existingPrefix=null;
      if (contextualNamespaces != null) {
        existingPrefix=contextualNamespaces.resolveNamespaceURI(uri);
      }
      if (existingPrefix == null) {
        String originalPrefix=ns.getPrefix();
        String prefix=prefixMapper.getPreferredPrefix(uri,originalPrefix,true);
        if (prefix != null) {
          this.put(prefix,uri);
        }
 else {
          this.put(originalPrefix,uri);
        }
      }
    }
    defaultUri=nestedResolver.getDefaultNamespaceURI();
  }
  if (defaultUri != null) {
    String prefix=prefixMapper.getPreferredPrefix(defaultUri,"String_Node_Str",false);
    if ("String_Node_Str".equals(prefix) || prefix == null) {
      this.setDefaultNamespaceURI(defaultUri);
    }
 else {
      this.put(prefix,defaultUri);
    }
  }
  String[] uris=mapper.getPreDeclaredNamespaceUris();
  if (uris != null && uris.length > 0) {
    for (int i=0; i < uris.length; i++) {
      String uri=uris[i];
      String prefix=prefixMapper.getPreferredPrefix(uri,null,true);
      if (prefix != null) {
        this.put(prefix,uri);
      }
 else {
        this.put(this.generatePrefix(),uri);
      }
    }
  }
  declarations=prefixMapper.getPreDeclaredNamespaceUris2();
  if (declarations != null && declarations.length > 0) {
    for (int i=0; i < declarations.length - 1; i+=2) {
      String prefix=declarations[i];
      String uri=declarations[i + 1];
      this.put(prefix,uri);
    }
  }
}

Fixed version (ground truth):
public PrefixMapperNamespaceResolver(NamespacePrefixMapper mapper,NamespaceResolver nestedResolver){
  prefixMapper=mapper;
  String[] declarations=mapper.getContextualNamespaceDecls();
  if (declarations != null && declarations.length > 0) {
    contextualNamespaces=new NamespaceResolver();
    for (int i=0; i < declarations.length - 1; i+=2) {
      String prefix=declarations[i];
      String uri=declarations[i + 1];
      contextualNamespaces.put(prefix,uri);
    }
  }
  String defaultUri=null;
  if (nestedResolver != null) {
    for (    Object next : nestedResolver.getNamespaces()) {
      Namespace ns=(Namespace)next;
      String uri=ns.getNamespaceURI();
      String existingPrefix=null;
      if (contextualNamespaces != null) {
        existingPrefix=contextualNamespaces.resolveNamespaceURI(uri);
      }
      if (existingPrefix == null) {
        String originalPrefix=ns.getPrefix();
        String prefix=prefixMapper.getPreferredPrefix(uri,originalPrefix,true);
        if (prefix != null) {
          this.put(prefix,uri);
        }
 else {
          this.put(originalPrefix,uri);
        }
      }
    }
    defaultUri=nestedResolver.getDefaultNamespaceURI();
  }
  if (defaultUri != null) {
    String prefix=prefixMapper.getPreferredPrefix(defaultUri,"String_Node_Str",false);
    if ("String_Node_Str".equals(prefix) || prefix == null) {
      this.setDefaultNamespaceURI(defaultUri);
    }
 else {
      this.put(prefix,defaultUri);
    }
  }
  String[] uris=mapper.getPreDeclaredNamespaceUris();
  if (uris != null && uris.length > 0) {
    for (int i=0; i < uris.length; i++) {
      String uri=uris[i];
      String prefix=prefixMapper.getPreferredPrefix(uri,null,true);
      if (prefix != null) {
        this.put(prefix,uri);
      }
 else {
        this.put(this.generatePrefix(),uri);
      }
    }
  }
  declarations=prefixMapper.getPreDeclaredNamespaceUris2();
  if (declarations != null && declarations.length > 0) {
    for (int i=0; i < declarations.length - 1; i+=2) {
      String prefix=declarations[i];
      String uri=declarations[i + 1];
      this.put(prefix,uri);
    }
  }
}