Program: 15588
Project: 15588
Buggy source:
private String processRequestImpl(String api,Object object,String clientId,String token){
  String result="String_Node_Str";
  try {
    SensorManager sensorManager=new SensorManager();
    Sensor sensor=null;
    String triples="String_Node_Str";
switch (api) {
case "String_Node_Str":
      if (object instanceof Sensor)       sensor=(Sensor)object;
 else       break;
    logger.info("String_Node_Str" + sensor.getId());
  String permissionString=PermissionsUtil.ADD_SENSOR;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
  String sensorTypeId=sensorManager.getSensorTypeId(sensor.getSensorType().toLowerCase());
  triples=TriplesDataRetriever.getSensorTripleMetadata(sensor,sensorTypeId);
  if ((sensor.getMetaGraph() == null) || (sensor.getMetaGraph() == "String_Node_Str"))   sensor.setMetaGraph(propertyManagement.getSchedulerLsmMetaGraph());
  sensorManager.setDataGraph(sensor.getDataGraph());
  sensorManager.setMetaGraph(sensor.getMetaGraph());
  sensorManager.insertTriplesToGraph(sensor.getMetaGraph(),triples);
  logger.info("String_Node_Str");
}
 else {
  result="String_Node_Str";
  logger.info(result);
}
break;
case "String_Node_Str":
Observation observation=null;
if (object instanceof Observation) observation=(Observation)object;
 else break;
logger.info("String_Node_Str" + observation.getId());
triples="String_Node_Str";
permissionString=PermissionsUtil.UPDATE_SENSOR_DATA;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if ((observation.getMetaGraph() == null) || (observation.getMetaGraph() == "String_Node_Str")) observation.setMetaGraph(propertyManagement.getLSMLocalMetaGraph());
sensorManager.setDataGraph(observation.getDataGraph());
sensorManager.setMetaGraph(observation.getMetaGraph());
sensor=sensorManager.getSpecifiedSensorWithSensorId(observation.getSensor());
if (sensor == null) {
result="String_Node_Str" + observation.getSensor() + "String_Node_Str";
return result;
}
String foi="String_Node_Str";
if (observation.getFeatureOfInterest().equals("String_Node_Str") || observation.getFeatureOfInterest() == null) foi=ConnectionManager.propertyManagement.getOpeniotResourceNamespace() + Double.toString(sensor.getPlace().getLat()).replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + Double.toString(sensor.getPlace().getLng()).replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
 else foi=observation.getFeatureOfInterest();
triples+=TriplesDataRetriever.getObservationTripleData(observation.getId(),observation.getSensor(),foi,observation.getTimes());
OntModel model=ModelFactory.createOntologyModel();
for (ObservedProperty obv : observation.getReadings()) {
OntClass cl=model.createClass(obv.getPropertyType());
if (obv.getUnit().equals("String_Node_Str")) triples+=TriplesDataRetriever.getTripleDataHasNoUnit("String_Node_Str",cl.getLocalName(),obv.getValue(),observation.getId(),sensor.getProperties().get(obv.getPropertyType()),observation.getTimes());
 else triples+=TriplesDataRetriever.getTripleDataHasUnit("String_Node_Str",cl.getLocalName(),obv.getValue(),obv.getUnit(),observation.getId(),sensor.getProperties().get(obv.getPropertyType()),observation.getTimes());
}
sensorManager.insertTriplesToGraph(observation.getDataGraph(),triples);
logger.info("String_Node_Str");
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
RDFTuple tuple=null;
if (object instanceof RDFTuple) tuple=(RDFTuple)object;
 else break;
permissionString=PermissionsUtil.ADD_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
sensorManager.insertTriplesToGraph(tuple.getGraphURL(),tuple.getNtriple());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
tuple=null;
if (object instanceof RDFTuple) tuple=(RDFTuple)object;
 else break;
permissionString=PermissionsUtil.DEL_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if (tuple.getNtriple().equals("String_Node_Str")) {
sensorManager.clearGraph(tuple.getGraphURL());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
 else {
sensorManager.deleteTriples(tuple.getGraphURL(),tuple.getNtriple());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
HashMap<String,String> patterns=null;
permissionString=PermissionsUtil.UPDATE_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if (object instanceof HashMap<?,?>) patterns=(HashMap<String,String>)object;
sensorManager.updateGraph(patterns.get("String_Node_Str"),patterns.get("String_Node_Str"),patterns.get("String_Node_Str"));
}
 else {
result="String_Node_Str";
logger.info(result);
}
default :
break;
}
}
 catch (Exception e) {
logger.error("String_Node_Str",e);
result=e.toString();
}
return result;
}

Fixed version (ground truth):
private String processRequestImpl(String api,Object object,String clientId,String token){
  String result="String_Node_Str";
  try {
    SensorManager sensorManager=new SensorManager();
    Sensor sensor=null;
    String triples="String_Node_Str";
switch (api) {
case "String_Node_Str":
      if (object instanceof Sensor)       sensor=(Sensor)object;
 else       break;
    logger.info("String_Node_Str" + sensor.getId());
  String permissionString=PermissionsUtil.ADD_SENSOR;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
  if ((sensor.getMetaGraph() == null) || (sensor.getMetaGraph() == "String_Node_Str"))   sensor.setMetaGraph(propertyManagement.getSchedulerLsmMetaGraph());
  sensorManager.setDataGraph(sensor.getDataGraph());
  sensorManager.setMetaGraph(sensor.getMetaGraph());
  String sensorTypeId=sensorManager.getSensorTypeId(sensor.getSensorType().toLowerCase());
  triples=TriplesDataRetriever.getSensorTripleMetadata(sensor,sensorTypeId);
  sensorManager.insertTriplesToGraph(sensor.getMetaGraph(),triples);
  logger.info("String_Node_Str");
}
 else {
  result="String_Node_Str";
  logger.info(result);
}
break;
case "String_Node_Str":
Observation observation=null;
if (object instanceof Observation) observation=(Observation)object;
 else break;
logger.info("String_Node_Str" + observation.getId());
triples="String_Node_Str";
permissionString=PermissionsUtil.UPDATE_SENSOR_DATA;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if ((observation.getMetaGraph() == null) || (observation.getMetaGraph() == "String_Node_Str")) observation.setMetaGraph(propertyManagement.getLSMLocalMetaGraph());
sensorManager.setDataGraph(observation.getDataGraph());
sensorManager.setMetaGraph(observation.getMetaGraph());
sensor=sensorManager.getSpecifiedSensorWithSensorId(observation.getSensor());
if (sensor == null) {
result="String_Node_Str" + observation.getSensor() + "String_Node_Str";
return result;
}
String foi="String_Node_Str";
if (observation.getFeatureOfInterest().equals("String_Node_Str") || observation.getFeatureOfInterest() == null) foi=ConnectionManager.propertyManagement.getOpeniotResourceNamespace() + Double.toString(sensor.getPlace().getLat()).replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + Double.toString(sensor.getPlace().getLng()).replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
 else foi=observation.getFeatureOfInterest();
triples+=TriplesDataRetriever.getObservationTripleData(observation.getId(),observation.getSensor(),foi,observation.getTimes());
OntModel model=ModelFactory.createOntologyModel();
for (ObservedProperty obv : observation.getReadings()) {
OntClass cl=model.createClass(obv.getPropertyType());
if (obv.getUnit().equals("String_Node_Str")) triples+=TriplesDataRetriever.getTripleDataHasNoUnit("String_Node_Str",cl.getLocalName(),obv.getValue(),observation.getId(),sensor.getProperties().get(obv.getPropertyType()),observation.getTimes());
 else triples+=TriplesDataRetriever.getTripleDataHasUnit("String_Node_Str",cl.getLocalName(),obv.getValue(),obv.getUnit(),observation.getId(),sensor.getProperties().get(obv.getPropertyType()),observation.getTimes());
}
sensorManager.insertTriplesToGraph(observation.getDataGraph(),triples);
logger.info("String_Node_Str");
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
RDFTuple tuple=null;
if (object instanceof RDFTuple) tuple=(RDFTuple)object;
 else break;
permissionString=PermissionsUtil.ADD_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
sensorManager.insertTriplesToGraph(tuple.getGraphURL(),tuple.getNtriple());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
tuple=null;
if (object instanceof RDFTuple) tuple=(RDFTuple)object;
 else break;
permissionString=PermissionsUtil.DEL_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if (tuple.getNtriple().equals("String_Node_Str")) {
sensorManager.clearGraph(tuple.getGraphURL());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
 else {
sensorManager.deleteTriples(tuple.getGraphURL(),tuple.getNtriple());
logger.info("String_Node_Str" + tuple.getGraphURL());
}
}
 else {
result="String_Node_Str";
logger.info(result);
}
break;
case "String_Node_Str":
HashMap<String,String> patterns=null;
permissionString=PermissionsUtil.UPDATE_TRIPLES;
if (SecurityUtil.hasPermission(permissionString,getServletContext(),token,clientId)) {
if (object instanceof HashMap<?,?>) patterns=(HashMap<String,String>)object;
sensorManager.updateGraph(patterns.get("String_Node_Str"),patterns.get("String_Node_Str"),patterns.get("String_Node_Str"));
}
 else {
result="String_Node_Str";
logger.info(result);
}
default :
break;
}
}
 catch (Exception e) {
logger.error("String_Node_Str",e);
result=e.toString();
}
return result;
}