Program: 20610
Project: 20610
Buggy source:
/** 
 * A specific method for parsing the given sampler mapping and return a pair of rdf-type and the associated dictionary-sampler 
 * @param samplerMapping - A single entry in the sampler-function mappings which contains the rdf-type and itsassociated dictionary-sampler
 * @return - A pair of rdf-type and its associated dictionary-sampler 
 * @throws IOException - In case that one of the samplers fails to run init (which uses some external files forloading the different labels
 * @throws IllegalStateException - In case of an un-familiar d-sampler
 */
private TypeDSamplerPair parseSamplerMapping(Resource samplerMapping) throws IOException {
  String dSamplerType=samplerMapping.getProperty(RDF.type).getObject().toString();
  if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CUSTOM_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal dataPathLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_SOURCE)).getObject();
    String dataPath=dataPathLit.getString();
    CustomDictionarySampler customDicSampler=new CustomDictionarySampler();
    customDicSampler.init(dataPath);
    return new TypeDSamplerPair(type,customDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_STD_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal dataPathLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_SOURCE)).getObject();
    String dataPath=dataPathLit.getString();
    Resource mode=(Resource)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_MODE)).getObject();
    SamplingMode samplingMode=parseSamplingMode(mode);
    StdDictionarySampler dSampler=new StdDictionarySampler();
    dSampler.init(dataPath);
    dSampler.setSamplingMode(samplingMode);
    return new TypeDSamplerPair(type,dSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CTR_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal labelLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_LABEL)).getObject();
    String label=labelLit.getString();
    Resource mode=(Resource)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_MODE)).getObject();
    SamplingMode samplingMode=parseSamplingMode(mode);
    CounterDictionarySampler ctrDicSampler=new CounterDictionarySampler();
    ctrDicSampler.init(label);
    ctrDicSampler.setSamplingMode(samplingMode);
    return new TypeDSamplerPair(type,ctrDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_EXT_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    ExternalConstDictionarySampler extDicSampler=new ExternalConstDictionarySampler();
    return new TypeDSamplerPair(type,extDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CONST_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal labelLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_LABEL)).getObject();
    String label=labelLit.getString();
    ConstDictionarySampler constDicSampler=new ConstDictionarySampler();
    constDicSampler.init(label);
    return new TypeDSamplerPair(type,constDicSampler);
  }
 else   throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * A specific method for parsing the given sampler mapping and return a pair of rdf-type and the associated dictionary-sampler 
 * @param samplerMapping - A single entry in the sampler-function mappings which contains the rdf-type and itsassociated dictionary-sampler
 * @return - A pair of rdf-type and its associated dictionary-sampler 
 * @throws IOException - In case that one of the samplers fails to run init (which uses some external files forloading the different labels
 * @throws IllegalStateException - In case of an un-familiar d-sampler
 */
private TypeDSamplerPair parseSamplerMapping(Resource samplerMapping) throws IOException {
  String dSamplerType=samplerMapping.getProperty(RDF.type).getObject().toString();
  if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CUSTOM_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal dataPathLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_SOURCE)).getObject();
    String dataPath=dataPathLit.getString();
    CustomDictionarySampler customDicSampler=new CustomDictionarySampler();
    customDicSampler.init(dataPath);
    return new TypeDSamplerPair(type,customDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_STD_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal dataPathLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_SOURCE)).getObject();
    String dataPath=dataPathLit.getString();
    Resource mode=(Resource)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_MODE)).getObject();
    SamplingMode samplingMode=parseSamplingMode(mode);
    StdDictionarySampler dSampler=new StdDictionarySampler();
    dSampler.setSamplingMode(samplingMode);
    dSampler.init(dataPath);
    return new TypeDSamplerPair(type,dSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CTR_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal labelLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_LABEL)).getObject();
    String label=labelLit.getString();
    Resource mode=(Resource)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_MODE)).getObject();
    SamplingMode samplingMode=parseSamplingMode(mode);
    CounterDictionarySampler ctrDicSampler=new CounterDictionarySampler();
    ctrDicSampler.init(label);
    ctrDicSampler.setSamplingMode(samplingMode);
    return new TypeDSamplerPair(type,ctrDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_EXT_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    ExternalConstDictionarySampler extDicSampler=new ExternalConstDictionarySampler();
    return new TypeDSamplerPair(type,extDicSampler);
  }
 else   if (dSamplerType.equals(RDF_GEN_NS + RdfGenTypes.RES_RDF_TYPE_CONST_DIC_SAMPLER)) {
    Literal typeLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_TYPE)).getObject();
    String type=typeLit.getString();
    Literal labelLit=(Literal)samplerMapping.getProperty(new PropertyImpl(RDF_GEN_NS + RdfGenTypes.PROP_RDF_TYPE_LABEL)).getObject();
    String label=labelLit.getString();
    ConstDictionarySampler constDicSampler=new ConstDictionarySampler();
    constDicSampler.init(label);
    return new TypeDSamplerPair(type,constDicSampler);
  }
 else   throw new IllegalStateException("String_Node_Str");
}