Program: 6673
Project: 6673
Buggy source:
@Override protected void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String rssUrl;
  String endpointFilter;
  String callBackUrl;
  FeedEntry feed;
  if ((!(req.getHeader("String_Node_Str").equals(HTTP_POST_HEADER_TYPE))) || (req.getParameter(HTTP_POST_PARAMETER_HUB_MODE) == null)) {
    resp.setStatus(HttpStatus.SC_BAD_REQUEST);
    return;
  }
  rssUrl=req.getParameter(HTTP_POST_PARAMETER_RSS_TOPIC_URL);
  endpointFilter=req.getParameter(HTTP_POST_PARAMETER_ENDPOINT_FILTER);
  callBackUrl=req.getParameter(HTTP_POST_PARAMETER_URL_CALLBACK);
switch (HubMode.valueOf(req.getParameter(HTTP_POST_PARAMETER_HUB_MODE))) {
case publish:
    if ((rssUrl != null) && (createReader(rssUrl))) {
      registrations.addTopic(rssUrl);
      responseCode=HttpStatus.SC_CREATED;
    }
 else {
      responseCode=HttpStatus.SC_BAD_REQUEST;
    }
  break;
case unpublish:
if (rssUrl != null) {
  new SendSubscription(client,rssUrl,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_REMOVED,this,HUB_UPDATE_TOPIC_DELETE);
  responseCode=HttpStatus.SC_ACCEPTED;
}
 else {
  responseCode=HttpStatus.SC_BAD_REQUEST;
}
break;
case update:
if ((rssUrl == null) || (readers.get(rssUrl) == null)) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
feed=readers.get(rssUrl).getLastEntry();
if (feed == null) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
try {
@SuppressWarnings("String_Node_Str") EndpointDescription edp=getEndpointDescriptionFromJSON(json.fromJSON(feed.content()));
if (feed.title().equals(FEED_TITLE_NEW)) {
registrations.addEndpoint(rssUrl,edp);
new SendSubscription(client,edp,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_ADDED,this);
}
 else if (feed.title().equals(FEED_TITLE_REMOVE)) {
registrations.removeEndpoint(rssUrl,edp);
new SendSubscription(client,edp,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_REMOVED,this);
}
responseCode=HttpStatus.SC_ACCEPTED;
}
 catch (ParseException e) {
responseCode=HttpStatus.SC_BAD_REQUEST;
logger.log(LogService.LOG_ERROR,"String_Node_Str",e);
}
break;
case subscribe:
if ((endpointFilter == null) || (callBackUrl == null)) {
responseCode=HttpStatus.SC_BAD_REQUEST;
}
 else {
registrations.addSubscrition(callBackUrl,endpointFilter);
responseCode=HttpStatus.SC_CREATED;
new SendSubscription(client,callBackUrl,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_ADDED,this);
}
break;
case unsubscribe:
if (callBackUrl == null) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
registrations.removeSubscribtion(callBackUrl);
responseCode=HttpStatus.SC_ACCEPTED;
break;
case getAllEndpoints:
resp.setContentType("String_Node_Str");
for (EndpointDescription endpoint : registrations.getAllEndpoints()) {
resp.getWriter().append(endpoint.toString() + "String_Node_Str");
}
responseCode=HttpStatus.SC_ACCEPTED;
break;
default :
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
resp.setStatus(responseCode);
}

Fixed version (ground truth):
@Override protected void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String rssUrl;
  String endpointFilter;
  String callBackUrl;
  FeedEntry feed;
  if ((!(req.getHeader("String_Node_Str").equals(HTTP_POST_HEADER_TYPE))) || (req.getParameter(HTTP_POST_PARAMETER_HUB_MODE) == null)) {
    resp.setStatus(HttpStatus.SC_BAD_REQUEST);
    return;
  }
  rssUrl=req.getParameter(HTTP_POST_PARAMETER_RSS_TOPIC_URL);
  endpointFilter=req.getParameter(HTTP_POST_PARAMETER_ENDPOINT_FILTER);
  callBackUrl=req.getParameter(HTTP_POST_PARAMETER_URL_CALLBACK);
switch (HubMode.valueOf(req.getParameter(HTTP_POST_PARAMETER_HUB_MODE))) {
case publish:
    if ((rssUrl != null) && (createReader(rssUrl))) {
      registrations.addTopic(rssUrl);
      responseCode=HttpStatus.SC_CREATED;
    }
 else {
      responseCode=HttpStatus.SC_BAD_REQUEST;
    }
  break;
case unpublish:
if (rssUrl != null) {
  subscription=new SendSubscription(client,rssUrl,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_REMOVED,this,HUB_UPDATE_TOPIC_DELETE);
  subscription.start();
  responseCode=HttpStatus.SC_ACCEPTED;
}
 else {
  responseCode=HttpStatus.SC_BAD_REQUEST;
}
break;
case update:
if ((rssUrl == null) || (readers.get(rssUrl) == null)) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
feed=readers.get(rssUrl).getLastEntry();
if (feed == null) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
try {
@SuppressWarnings("String_Node_Str") EndpointDescription edp=getEndpointDescriptionFromJSON(json.fromJSON(feed.content()));
if (feed.title().equals(FEED_TITLE_NEW)) {
registrations.addEndpoint(rssUrl,edp);
subscription=new SendSubscription(client,edp,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_ADDED,this);
subscription.start();
}
 else if (feed.title().equals(FEED_TITLE_REMOVE)) {
registrations.removeEndpoint(rssUrl,edp);
subscription=new SendSubscription(client,edp,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_REMOVED,this);
subscription.start();
}
responseCode=HttpStatus.SC_ACCEPTED;
}
 catch (ParseException e) {
responseCode=HttpStatus.SC_BAD_REQUEST;
logger.log(LogService.LOG_ERROR,"String_Node_Str",e);
}
break;
case subscribe:
if ((endpointFilter == null) || (callBackUrl == null)) {
responseCode=HttpStatus.SC_BAD_REQUEST;
}
 else {
registrations.addSubscrition(callBackUrl,endpointFilter);
responseCode=HttpStatus.SC_CREATED;
subscription=new SendSubscription(client,callBackUrl,HUB_SUBSCRIPTION_UPDATE_ENDPOINT_ADDED,this);
subscription.start();
}
break;
case unsubscribe:
if (callBackUrl == null) {
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
registrations.removeSubscribtion(callBackUrl);
responseCode=HttpStatus.SC_ACCEPTED;
break;
case getAllEndpoints:
resp.setContentType("String_Node_Str");
for (EndpointDescription endpoint : registrations.getAllEndpoints()) {
resp.getWriter().append(endpoint.toString() + "String_Node_Str");
}
responseCode=HttpStatus.SC_ACCEPTED;
break;
default :
responseCode=HttpStatus.SC_BAD_REQUEST;
break;
}
resp.setStatus(responseCode);
}