Program: 190171
Project: 190171
Buggy source:
private void readAttribute(XMLStreamReader reader,String classAtt,String typeAtt) throws Exception {
  String id="String_Node_Str";
  String type="String_Node_Str";
  String title="String_Node_Str";
  String defaultStr="String_Node_Str";
  for (int i=0; i < reader.getAttributeCount(); i++) {
    String attName=reader.getAttributeName(i).getLocalPart();
    if (ATTRIBUTE_ID.equalsIgnoreCase(attName)) {
      id=reader.getAttributeValue(i);
    }
 else     if (ATTRIBUTE_TYPE.equalsIgnoreCase(attName) || ATTRIBUTE_TYPE2.equalsIgnoreCase(attName)) {
      type=reader.getAttributeValue(i);
    }
 else     if (ATTRIBUTE_TITLE.equalsIgnoreCase(attName)) {
      title=reader.getAttributeValue(i);
    }
  }
  if (title.isEmpty()) {
    title=id;
  }
  if (!id.isEmpty() && !type.isEmpty()) {
    if (classAtt.isEmpty() || !(classAtt.equalsIgnoreCase("String_Node_Str") || classAtt.equalsIgnoreCase("String_Node_Str"))) {
      report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title),Issue.Level.SEVERE));
    }
    boolean end=false;
    boolean defaultFlag=false;
    while (reader.hasNext() && !end) {
      int xmltype=reader.next();
switch (xmltype) {
case XMLStreamReader.START_ELEMENT:
        if (ATTRIBUTE_DEFAULT.equalsIgnoreCase(xmlReader.getLocalName())) {
          defaultFlag=true;
        }
      break;
case XMLStreamReader.CHARACTERS:
    if (defaultFlag && !xmlReader.isWhiteSpace()) {
      defaultStr=xmlReader.getText();
    }
  break;
case XMLStreamReader.END_ELEMENT:
if (ATTRIBUTE.equalsIgnoreCase(xmlReader.getLocalName())) {
  end=true;
}
break;
}
}
boolean dynamic=typeAtt.equalsIgnoreCase("String_Node_Str");
AttributeType attributeType=AttributeType.STRING;
if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BOOLEAN : AttributeType.BOOLEAN;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_INT : AttributeType.INT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_LONG : AttributeType.LONG;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_FLOAT : AttributeType.FLOAT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_DOUBLE : AttributeType.DOUBLE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_STRING : AttributeType.STRING;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BIGDECIMAL : AttributeType.BIGDECIMAL;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BIGINTEGER : AttributeType.BIGINTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BYTE : AttributeType.BYTE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_CHAR : AttributeType.CHAR;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_SHORT : AttributeType.SHORT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BOOLEAN;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_INTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_LONG;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_FLOAT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_DOUBLE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_STRING;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BIGDECIMAL;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BIGINTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BYTE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_CHARACTER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_SHORT;
}
 else {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",type),Issue.Level.SEVERE));
return;
}
Object defaultValue=null;
if (!defaultStr.isEmpty()) {
try {
defaultValue=attributeType.parse(defaultStr);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",defaultStr,title));
}
 catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()),Issue.Level.SEVERE));
}
}
if ("String_Node_Str".equalsIgnoreCase(classAtt) || classAtt.isEmpty()) {
if (container.getAttributeModel().getNodeTable().hasColumn(id)) {
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",id));
return;
}
container.getAttributeModel().getNodeTable().addColumn(id,title,attributeType,AttributeOrigin.DATA,defaultValue);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()));
}
 else if ("String_Node_Str".equalsIgnoreCase(classAtt) || classAtt.isEmpty()) {
if (container.getAttributeModel().getEdgeTable().hasColumn(id)) {
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",id));
return;
}
container.getAttributeModel().getEdgeTable().addColumn(id,title,attributeType,AttributeOrigin.DATA,defaultValue);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()));
}
}
 else {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title),Issue.Level.SEVERE));
}
}

Fixed version (ground truth):
private void readAttribute(XMLStreamReader reader,String classAtt,String typeAtt) throws Exception {
  String id="String_Node_Str";
  String type="String_Node_Str";
  String title="String_Node_Str";
  String defaultStr="String_Node_Str";
  for (int i=0; i < reader.getAttributeCount(); i++) {
    String attName=reader.getAttributeName(i).getLocalPart();
    if (ATTRIBUTE_ID.equalsIgnoreCase(attName)) {
      id=reader.getAttributeValue(i);
    }
 else     if (ATTRIBUTE_TYPE.equalsIgnoreCase(attName) || ATTRIBUTE_TYPE2.equalsIgnoreCase(attName)) {
      type=reader.getAttributeValue(i);
    }
 else     if (ATTRIBUTE_TITLE.equalsIgnoreCase(attName)) {
      title=reader.getAttributeValue(i);
    }
  }
  if (title.isEmpty()) {
    title=id;
  }
  if (!id.isEmpty() && !type.isEmpty()) {
    if (classAtt.isEmpty() || !(classAtt.equalsIgnoreCase("String_Node_Str") || classAtt.equalsIgnoreCase("String_Node_Str"))) {
      report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title),Issue.Level.SEVERE));
    }
    boolean end=false;
    boolean defaultFlag=false;
    while (reader.hasNext() && !end) {
      int xmltype=reader.next();
switch (xmltype) {
case XMLStreamReader.START_ELEMENT:
        if (ATTRIBUTE_DEFAULT.equalsIgnoreCase(xmlReader.getLocalName())) {
          defaultFlag=true;
        }
      break;
case XMLStreamReader.CHARACTERS:
    if (defaultFlag && !xmlReader.isWhiteSpace()) {
      defaultStr=xmlReader.getText();
    }
  break;
case XMLStreamReader.END_ELEMENT:
if (ATTRIBUTE.equalsIgnoreCase(xmlReader.getLocalName())) {
  end=true;
}
break;
}
}
boolean dynamic=typeAtt.equalsIgnoreCase("String_Node_Str");
AttributeType attributeType=AttributeType.STRING;
if (type.equalsIgnoreCase("String_Node_Str") || type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BOOLEAN : AttributeType.BOOLEAN;
}
 else if (type.equalsIgnoreCase("String_Node_Str") || type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_INT : AttributeType.INT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_LONG : AttributeType.LONG;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_FLOAT : AttributeType.FLOAT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_DOUBLE : AttributeType.DOUBLE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_STRING : AttributeType.STRING;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BIGDECIMAL : AttributeType.BIGDECIMAL;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BIGINTEGER : AttributeType.BIGINTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_BYTE : AttributeType.BYTE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_CHAR : AttributeType.CHAR;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=dynamic ? AttributeType.DYNAMIC_SHORT : AttributeType.SHORT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BOOLEAN;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_INTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_LONG;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_FLOAT;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_DOUBLE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_STRING;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BIGDECIMAL;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BIGINTEGER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_BYTE;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_CHARACTER;
}
 else if (type.equalsIgnoreCase("String_Node_Str")) {
attributeType=AttributeType.LIST_SHORT;
}
 else {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",type),Issue.Level.SEVERE));
return;
}
Object defaultValue=null;
if (!defaultStr.isEmpty()) {
try {
defaultValue=attributeType.parse(defaultStr);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",defaultStr,title));
}
 catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()),Issue.Level.SEVERE));
}
}
if ("String_Node_Str".equalsIgnoreCase(classAtt) || classAtt.isEmpty()) {
if (container.getAttributeModel().getNodeTable().hasColumn(id)) {
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",id));
return;
}
container.getAttributeModel().getNodeTable().addColumn(id,title,attributeType,AttributeOrigin.DATA,defaultValue);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()));
}
 else if ("String_Node_Str".equalsIgnoreCase(classAtt) || classAtt.isEmpty()) {
if (container.getAttributeModel().getEdgeTable().hasColumn(id)) {
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",id));
return;
}
container.getAttributeModel().getEdgeTable().addColumn(id,title,attributeType,AttributeOrigin.DATA,defaultValue);
report.log(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title,attributeType.getTypeString()));
}
}
 else {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class,"String_Node_Str",title),Issue.Level.SEVERE));
}
}