Program: 29235
Project: 29235
Buggy source:
public static HashMap parseConstraints(WebBundleDescriptor wbd){
  if (logger.isLoggable(Level.FINE)) {
    logger.entering("String_Node_Str","String_Node_Str");
  }
  Set<Role> roleSet=wbd.getRoles();
  HashMap<String,MapValue> qpMap=new HashMap();
  qpMap.put("String_Node_Str",new MapValue("String_Node_Str"));
  Enumeration<SecurityConstraint> esc=wbd.getSecurityConstraints();
  while (esc.hasMoreElements()) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,"String_Node_Str");
    }
    SecurityConstraint sc=esc.nextElement();
    AuthorizationConstraint ac=sc.getAuthorizationConstraint();
    UserDataConstraint udc=sc.getUserDataConstraint();
    for (    WebResourceCollection wrc : sc.getWebResourceCollections()) {
      if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,"String_Node_Str");
      }
      for (      String url : wrc.getUrlPatterns()) {
        if (url != null) {
          url=url.replaceAll("String_Node_Str","String_Node_Str");
        }
        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE,"String_Node_Str" + url);
        }
        MapValue mValue=qpMap.get(url);
        if (mValue == null) {
          mValue=new MapValue(url);
          for (          Map.Entry<String,MapValue> qpVal : qpMap.entrySet()) {
            String otherUrl=qpVal.getKey();
            int otherUrlType=patternType(otherUrl);
switch (patternType(url)) {
case PT_PREFIX:
              if ((otherUrlType == PT_PREFIX || otherUrlType == PT_EXACT) && implies(url,otherUrl))               mValue.addQualifier(otherUrl);
 else               if (otherUrlType == PT_PREFIX && implies(otherUrl,url))               qpVal.getValue().addQualifier(url);
 else               if (otherUrlType == PT_EXTENSION || otherUrlType == PT_DEFAULT)               qpVal.getValue().addQualifier(url);
            break;
case PT_EXTENSION:
          if (otherUrlType == PT_PREFIX || (otherUrlType == PT_EXACT && implies(url,otherUrl)))           mValue.addQualifier(otherUrl);
 else           if (otherUrlType == PT_DEFAULT)           qpVal.getValue().addQualifier(url);
        break;
case PT_DEFAULT:
      if (otherUrlType != PT_DEFAULT)       mValue.addQualifier(otherUrl);
    break;
case PT_EXACT:
  if ((otherUrlType == PT_PREFIX || otherUrlType == PT_EXTENSION) && implies(otherUrl,url))   qpVal.getValue().addQualifier(url);
 else   if (otherUrlType == PT_DEFAULT)   qpVal.getValue().addQualifier(url);
break;
}
}
qpMap.put(url,mValue);
}
String[] methodNames=wrc.getHttpMethodsAsArray();
BitSet methods=MethodValue.methodArrayToSet(methodNames);
BitSet omittedMethods=null;
if (methods.isEmpty()) {
String[] omittedNames=wrc.getHttpMethodOmissionsAsArray();
omittedMethods=MethodValue.methodArrayToSet(omittedNames);
}
mValue.setMethodOutcomes(roleSet,ac,udc,methods,omittedMethods);
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str" + url);
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str");
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str");
}
}
if (logger.isLoggable(Level.FINE)) {
logger.exiting("String_Node_Str","String_Node_Str");
}
return qpMap;
}

Fixed version (ground truth):
public static HashMap parseConstraints(WebBundleDescriptor wbd){
  if (logger.isLoggable(Level.FINE)) {
    logger.entering("String_Node_Str","String_Node_Str");
  }
  Set<Role> roleSet=wbd.getRoles();
  HashMap<String,MapValue> qpMap=new HashMap();
  qpMap.put("String_Node_Str",new MapValue("String_Node_Str"));
  Enumeration<SecurityConstraint> esc=wbd.getSecurityConstraints();
  while (esc.hasMoreElements()) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,"String_Node_Str");
    }
    SecurityConstraint sc=esc.nextElement();
    AuthorizationConstraint ac=sc.getAuthorizationConstraint();
    UserDataConstraint udc=sc.getUserDataConstraint();
    for (    WebResourceCollection wrc : sc.getWebResourceCollections()) {
      if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,"String_Node_Str");
      }
      for (      String url : wrc.getUrlPatterns()) {
        if (url != null) {
          url=url.replaceAll("String_Node_Str","String_Node_Str");
        }
        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE,"String_Node_Str" + url);
        }
        MapValue mValue=qpMap.get(url);
        if (mValue == null) {
          mValue=new MapValue(url);
          for (          Map.Entry<String,MapValue> qpVal : qpMap.entrySet()) {
            String otherUrl=qpVal.getKey();
            int otherUrlType=patternType(otherUrl);
switch (patternType(url)) {
case PT_PREFIX:
              if ((otherUrlType == PT_PREFIX || otherUrlType == PT_EXACT) && implies(url,otherUrl))               mValue.addQualifier(otherUrl);
 else               if (otherUrlType == PT_PREFIX && implies(otherUrl,url))               qpVal.getValue().addQualifier(url);
 else               if (otherUrlType == PT_EXTENSION || otherUrlType == PT_DEFAULT)               qpVal.getValue().addQualifier(url);
            break;
case PT_EXTENSION:
          if (otherUrlType == PT_PREFIX || (otherUrlType == PT_EXACT && implies(url,otherUrl)))           mValue.addQualifier(otherUrl);
 else           if (otherUrlType == PT_DEFAULT)           qpVal.getValue().addQualifier(url);
        break;
case PT_DEFAULT:
      if (otherUrlType != PT_DEFAULT)       mValue.addQualifier(otherUrl);
    break;
case PT_EXACT:
  if ((otherUrlType == PT_PREFIX || otherUrlType == PT_EXTENSION) && implies(otherUrl,url))   qpVal.getValue().addQualifier(url);
 else   if (otherUrlType == PT_DEFAULT)   qpVal.getValue().addQualifier(url);
break;
default :
break;
}
}
qpMap.put(url,mValue);
}
String[] methodNames=wrc.getHttpMethodsAsArray();
BitSet methods=MethodValue.methodArrayToSet(methodNames);
BitSet omittedMethods=null;
if (methods.isEmpty()) {
String[] omittedNames=wrc.getHttpMethodOmissionsAsArray();
omittedMethods=MethodValue.methodArrayToSet(omittedNames);
}
mValue.setMethodOutcomes(roleSet,ac,udc,methods,omittedMethods);
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str" + url);
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str");
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"String_Node_Str");
}
}
if (logger.isLoggable(Level.FINE)) {
logger.exiting("String_Node_Str","String_Node_Str");
}
return qpMap;
}