Program: 52063
Project: 52063
Buggy source:
/** 
 * Update community. Replace all information about community except: id, handle and expandle items.
 * @param communityId Id of community in DSpace.
 * @param community Instance of community which will replace actual community in DSpace.
 * @param headers If you want to access to community under logged user into context. In headers must be set header "rest-dspace-token" with passed token from login method.
 * @return Response 200 if was all ok. Otherwise 400 if was id incorrect or401 if logged user has no permission to delete community.
 * @throws WebApplicationException It is throw when was problem with creating context or problem with database reading or writing. Or problem with writing to community caused by authorization.
 */
@PUT @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateCommunity(@PathParam("String_Node_Str") Integer communityId,Community community,@QueryParam("String_Node_Str") String user_ip,@QueryParam("String_Node_Str") String user_agent,@QueryParam("String_Node_Str") String xforwarderfor,@Context HttpHeaders headers,@Context HttpServletRequest request) throws WebApplicationException {
  log.info("String_Node_Str" + communityId + "String_Node_Str");
  org.dspace.core.Context context=null;
  try {
    context=createContext(getUser(headers));
    org.dspace.content.Community dspaceCommunity=findCommunity(context,communityId,org.dspace.core.Constants.WRITE);
    writeStats(dspaceCommunity,UsageEvent.Action.UPDATE,user_ip,user_agent,xforwarderfor,headers,request);
    dspaceCommunity.setMetadata("String_Node_Str",community.getName());
    dspaceCommunity.setMetadata(org.dspace.content.Community.COPYRIGHT_TEXT,community.getCopyrightText());
    dspaceCommunity.setMetadata(org.dspace.content.Community.INTRODUCTORY_TEXT,community.getIntroductoryText());
    dspaceCommunity.setMetadata(org.dspace.content.Community.SHORT_DESCRIPTION,community.getShortDescription());
    dspaceCommunity.setMetadata(org.dspace.content.Community.SIDEBAR_TEXT,community.getSidebarText());
    dspaceCommunity.update();
    context.complete();
  }
 catch (  SQLException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
catch (  ContextException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
catch (  AuthorizeException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
 finally {
    processFinally(context);
  }
  log.info("String_Node_Str" + communityId + "String_Node_Str");
  return Response.ok().build();
}

Fixed version (ground truth):
/** 
 * Update community. Replace all information about community except: id, handle and expandle items.
 * @param communityId Id of community in DSpace.
 * @param community Instance of community which will replace actual community in DSpace.
 * @param headers If you want to access to community under logged user into context. In headers must be set header "rest-dspace-token" with passed token from login method.
 * @return Response 200 if was all ok. Otherwise 400 if was id incorrect or401 if logged user has no permission to delete community.
 * @throws WebApplicationException It is throw when was problem with creating context or problem with database reading or writing. Or problem with writing to community caused by authorization.
 */
@PUT @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateCommunity(@PathParam("String_Node_Str") Integer communityId,Community community,@QueryParam("String_Node_Str") String user_ip,@QueryParam("String_Node_Str") String user_agent,@QueryParam("String_Node_Str") String xforwarderfor,@Context HttpHeaders headers,@Context HttpServletRequest request) throws WebApplicationException {
  log.info("String_Node_Str" + communityId + "String_Node_Str");
  org.dspace.core.Context context=null;
  try {
    context=createContext(getUser(headers));
    org.dspace.content.Community dspaceCommunity=findCommunity(context,communityId,org.dspace.core.Constants.WRITE);
    writeStats(dspaceCommunity,UsageEvent.Action.UPDATE,user_ip,user_agent,xforwarderfor,headers,request,context);
    dspaceCommunity.setMetadata("String_Node_Str",community.getName());
    dspaceCommunity.setMetadata(org.dspace.content.Community.COPYRIGHT_TEXT,community.getCopyrightText());
    dspaceCommunity.setMetadata(org.dspace.content.Community.INTRODUCTORY_TEXT,community.getIntroductoryText());
    dspaceCommunity.setMetadata(org.dspace.content.Community.SHORT_DESCRIPTION,community.getShortDescription());
    dspaceCommunity.setMetadata(org.dspace.content.Community.SIDEBAR_TEXT,community.getSidebarText());
    dspaceCommunity.update();
    context.complete();
  }
 catch (  SQLException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
catch (  ContextException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
catch (  AuthorizeException e) {
    processException("String_Node_Str" + communityId + "String_Node_Str"+ e,context);
  }
 finally {
    processFinally(context);
  }
  log.info("String_Node_Str" + communityId + "String_Node_Str");
  return Response.ok().build();
}