nus-yam/ex-repair huggingface dataset:
Program: 102561
Project: 102561
Buggy source:
private ExoSocialMedia jsonToExoSocialMedia(JSONObject jsonObject){
  ExoSocialMedia mediaObject=new ExoSocialMedia();
  try {
    mediaObject.setTitle(jsonObject.getString(EMBED_TITLE));
    mediaObject.setHtml(jsonObject.getString(EMBED_HTML));
    mediaObject.setType(jsonObject.getString(EMBED_TYPE));
    mediaObject.setProvider(jsonObject.getString(EMBED_PROVIDER));
    mediaObject.setDescription(jsonObject.has(EMBED_DESC) ? jsonObject.getString(EMBED_DESC) : "String_Node_Str");
    mediaObject.setUrl(jsonObject.has(EMBED_URL) ? jsonObject.getString(EMBED_URL) : "String_Node_Str");
    return mediaObject;
  }
 catch (  JSONException e) {
    log.warn("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
private ExoSocialMedia jsonToExoSocialMedia(JSONObject jsonObject){
  ExoSocialMedia mediaObject=new ExoSocialMedia();
  try {
    mediaObject.setTitle(jsonObject.getString(EMBED_TITLE));
    mediaObject.setHtml(jsonObject.getString(EMBED_HTML));
    mediaObject.setType(jsonObject.getString(EMBED_TYPE));
    mediaObject.setProvider(jsonObject.getString(EMBED_PROVIDER));
    mediaObject.setDescription(jsonObject.has(EMBED_DESC) ? jsonObject.getString(EMBED_DESC) : "String_Node_Str");
    mediaObject.setUrl(jsonObject.has(EMBED_URL) ? jsonObject.getString(EMBED_URL) : "String_Node_Str");
    return mediaObject;
  }
 catch (  JSONException e) {
    LOG.warn("String_Node_Str",e);
    return null;
  }
}
Program: 102562
Project: 102562
Buggy source:
private JSONObject getOembedData(URL url){
  BufferedReader bufferedReader;
  try {
    bufferedReader=new BufferedReader(new InputStreamReader(url.openStream()));
    StringBuffer stringBuffer=new StringBuffer();
    String eachLine=null;
    while ((eachLine=bufferedReader.readLine()) != null) {
      stringBuffer.append(eachLine);
    }
    bufferedReader.close();
    return new JSONObject(stringBuffer.toString());
  }
 catch (  JSONException e) {
    log.warn("String_Node_Str",e);
    return null;
  }
catch (  IOException e) {
    log.warn("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
private JSONObject getOembedData(URL url){
  BufferedReader bufferedReader;
  try {
    bufferedReader=new BufferedReader(new InputStreamReader(url.openStream()));
    StringBuffer stringBuffer=new StringBuffer();
    String eachLine=null;
    while ((eachLine=bufferedReader.readLine()) != null) {
      stringBuffer.append(eachLine);
    }
    bufferedReader.close();
    return new JSONObject(stringBuffer.toString());
  }
 catch (  JSONException e) {
    LOG.warn("String_Node_Str",e);
    return null;
  }
catch (  IOException e) {
    LOG.warn("String_Node_Str",e);
    return null;
  }
catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    return null;
  }
}
Program: 102563
Project: 102563
Buggy source:
private URL getOembedUrl(String url){
  try {
    for (    Pattern pattern : schemeEndpointMap.keySet()) {
      Matcher matcher=pattern.matcher(url);
      if (matcher.find()) {
        String endpoint=schemeEndpointMap.get(pattern);
        return new URL(String.format(endpoint,url));
      }
    }
    return null;
  }
 catch (  MalformedURLException e) {
    log.warn("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
private URL getOembedUrl(String url){
  try {
    for (    Pattern pattern : schemeEndpointMap.keySet()) {
      Matcher matcher=pattern.matcher(url);
      if (matcher.find()) {
        String endpoint=schemeEndpointMap.get(pattern);
        return new URL(String.format(endpoint,url));
      }
    }
    return null;
  }
 catch (  MalformedURLException e) {
    LOG.warn("String_Node_Str",e);
    return null;
  }
}
Program: 102564
Project: 102564
Buggy source:
/** 
 * test slideshare link
 */
public void testSlideShare(){
  ExoSocialMedia slideObj=embedder.getExoSocialMedia("String_Node_Str");
  assertEquals("String_Node_Str",slideObj.getProvider());
}

Fixed version (ground truth):
/** 
 * test slideshare link
 */
public void testSlideShare(){
  ExoSocialMedia slideObj=embedder.getExoSocialMedia("String_Node_Str");
  if (slideObj == null) {
    LOG.warn("String_Node_Str");
  }
 else {
    assertEquals("String_Node_Str",slideObj.getProvider());
  }
}
Program: 102565
Project: 102565
Buggy source:
/** 
 * Test youtube link
 */
public void testYoutube(){
  ExoSocialMedia videoObj=embedder.getExoSocialMedia("String_Node_Str");
  assertEquals("String_Node_Str",videoObj.getProvider());
}

Fixed version (ground truth):
/** 
 * Test youtube link
 */
public void testYoutube(){
  ExoSocialMedia videoObj=embedder.getExoSocialMedia("String_Node_Str");
  if (videoObj == null) {
    LOG.warn("String_Node_Str");
  }
 else {
    assertEquals("String_Node_Str",videoObj.getProvider());
  }
}
Program: 102566
Project: 102566
Buggy source:
/** 
 * gets linkShare
 * @param link
 * @param lang
 * @return linkShare
 */
private LinkShare getLinkShare(String link,String lang) throws Exception {
  if (link == null || link.length() == 0) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  LinkShare ls;
  try {
    if (lang != null) {
      ls=LinkShare.getInstance(link,lang);
    }
 else {
      ls=LinkShare.getInstance(link);
    }
  }
 catch (  Exception ex) {
    throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
  }
  return ls;
}

Fixed version (ground truth):
/** 
 * gets linkShare
 * @param link
 * @param lang
 * @return linkShare
 */
private LinkShare getLinkShare(String link,String lang) throws Exception {
  if (link == null || link.length() == 0) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  LinkShare ls;
  try {
    if (lang != null) {
      ls=LinkShare.getInstance(link,lang);
    }
 else {
      ls=LinkShare.getInstance(link);
    }
  }
 catch (  Exception ex) {
    throw new WebApplicationException(ex,Response.Status.INTERNAL_SERVER_ERROR);
  }
  return ls;
}
Program: 102567
Project: 102567
Buggy source:
/** 
 * Gets activity link of the space.
 * @param providerId
 * @param remoteId
 * @param groupId
 * @return
 * @since 1.2.8
 */
public static String getActivityUriForSpace(final String providerId,final String remoteId,final String groupId){
  return String.format("String_Node_Str",getPortalName(null),groupId,remoteId);
}

Fixed version (ground truth):
/** 
 * Gets activity link of the space.
 * @param remoteId
 * @param groupId
 * @return
 * @since 1.2.8
 */
public static String getActivityUriForSpace(final String remoteId,final String groupId){
  return String.format("String_Node_Str",getPortalName(null),groupId,remoteId);
}
Program: 102568
Project: 102568
Buggy source:
/** 
 * Builds pretty name base on the basic name in case create more than one space with the same name.
 * @param groupId
 * @return
 */
public static String buildGroupId(String groupId){
  String checkedGroupId=groupId;
  String mainPatternGroupId=null;
  String numberPattern=NUMBER_REG_PATTERN;
  if (checkedGroupId.substring(checkedGroupId.lastIndexOf(UNDER_SCORE_STR) + 1).matches(numberPattern)) {
    mainPatternGroupId=checkedGroupId.substring(0,checkedGroupId.lastIndexOf(UNDER_SCORE_STR));
  }
 else {
    mainPatternGroupId=checkedGroupId;
  }
  boolean hasNext=true;
  int extendPattern=0;
  while (hasNext) {
    ++extendPattern;
    checkedGroupId=cleanString(mainPatternGroupId + SPACE_STR + extendPattern);
    ExoContainer container=ExoContainerContext.getCurrentContainer();
    IdentityManager idm=(IdentityManager)container.getComponentInstanceOfType(IdentityManager.class);
    Identity identity=idm.getOrCreateIdentity(SpaceIdentityProvider.NAME,checkedGroupId,true);
    if (identity == null) {
      hasNext=false;
    }
  }
  return checkedGroupId;
}

Fixed version (ground truth):
/** 
 * Builds pretty name base on the basic name in case create more than one space with the same name.
 * @param prettyName
 * @param parentGroupId
 * @return
 * @since 1.2.8
 */
public static String buildGroupId(String prettyName,String parentGroupId){
  String checkedGroupId=prettyName;
  String mainPatternGroupId=null;
  String numberPattern=NUMBER_REG_PATTERN;
  if (checkedGroupId.substring(checkedGroupId.lastIndexOf(UNDER_SCORE_STR) + 1).matches(numberPattern)) {
    mainPatternGroupId=checkedGroupId.substring(0,checkedGroupId.lastIndexOf(UNDER_SCORE_STR));
  }
 else {
    mainPatternGroupId=checkedGroupId;
  }
  boolean hasNext=true;
  int extendPattern=0;
  while (hasNext) {
    ++extendPattern;
    checkedGroupId=cleanString(mainPatternGroupId + SPACE_STR + extendPattern);
    ExoContainer container=ExoContainerContext.getCurrentContainer();
    SpaceService spaceService=(SpaceService)container.getComponentInstanceOfType(SpaceService.class);
    if (spaceService.getSpaceByGroupId(parentGroupId + "String_Node_Str" + checkedGroupId) != null) {
      continue;
    }
    IdentityManager idm=(IdentityManager)container.getComponentInstanceOfType(IdentityManager.class);
    Identity identity=idm.getOrCreateIdentity(SpaceIdentityProvider.NAME,checkedGroupId,true);
    if (identity == null) {
      hasNext=false;
    }
  }
  return checkedGroupId;
}
Program: 102570
Project: 102570
Buggy source:
private void fillStream(ActivityEntity activityEntity,ExoSocialActivity activity){
  ActivityStream stream=new ActivityStreamImpl();
  IdentityEntity identityEntity=activityEntity.getIdentity();
  stream.setId(identityEntity.getId());
  stream.setPrettyId(identityEntity.getRemoteId());
  stream.setType(identityEntity.getProviderId());
  if (identityEntity != null && SpaceIdentityProvider.NAME.equals(identityEntity.getProviderId())) {
    Space space=spaceStorage.getSpaceByPrettyName(identityEntity.getRemoteId());
    if (space != null) {
      String groupId=space.getGroupId().split("String_Node_Str")[2];
      stream.setPermaLink(LinkProvider.getActivityUriForSpace(identityEntity.getProviderId(),identityEntity.getRemoteId(),groupId));
    }
  }
 else {
    stream.setPermaLink(LinkProvider.getActivityUri(identityEntity.getProviderId(),identityEntity.getRemoteId()));
  }
  activity.setActivityStream(stream);
  activity.setStreamId(stream.getId());
  activity.setStreamOwner(stream.getPrettyId());
}

Fixed version (ground truth):
private void fillStream(ActivityEntity activityEntity,ExoSocialActivity activity){
  ActivityStream stream=new ActivityStreamImpl();
  IdentityEntity identityEntity=activityEntity.getIdentity();
  stream.setId(identityEntity.getId());
  stream.setPrettyId(identityEntity.getRemoteId());
  stream.setType(identityEntity.getProviderId());
  if (identityEntity != null && SpaceIdentityProvider.NAME.equals(identityEntity.getProviderId())) {
    Space space=spaceStorage.getSpaceByPrettyName(identityEntity.getRemoteId());
    if (space != null) {
      String groupId=space.getGroupId().split("String_Node_Str")[2];
      stream.setPermaLink(LinkProvider.getActivityUriForSpace(identityEntity.getRemoteId(),groupId));
    }
  }
 else {
    stream.setPermaLink(LinkProvider.getActivityUri(identityEntity.getProviderId(),identityEntity.getRemoteId()));
  }
  activity.setActivityStream(stream);
  activity.setStreamId(stream.getId());
  activity.setStreamOwner(stream.getPrettyId());
}
Program: 102571
Project: 102571
Buggy source:
/** 
 * {@inheritDoc}
 */
public void deleteSpace(final String id) throws SpaceStorageException {
  storage.deleteSpace(id);
  SpaceData removed=exoSpaceCache.remove(new SpaceKey(id));
  exoSpacesCountCache.clearCache();
  exoSpacesCache.clearCache();
  if (removed != null) {
    cleanRef(removed);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void deleteSpace(final String id) throws SpaceStorageException {
  storage.deleteSpace(id);
  SpaceData removed=exoSpaceCache.remove(new SpaceKey(id));
  exoSpacesCountCache.clearCache();
  exoSpacesCache.clearCache();
  if (removed != null) {
    cleanRef(removed);
  }
  getCachedActivityStorage().invalidate();
}
Program: 102572
Project: 102572
Buggy source:
/** 
 * Gets base url (host + post) from a context uriInfo. <p/> For example: http://localhost:8080
 * @return the base url (host + port)
 * @author <a href="http://hoatle">hoatle (hoatlevan at gmail dot com)</a>
 * @since  1.2.3
 */
public static final String getBaseUrl(){
  HttpServletRequest currentServletRequest=getCurrentServletRequest();
  String port="String_Node_Str";
  if (currentServletRequest.getRemotePort() != -1) {
    port="String_Node_Str" + currentServletRequest.getRemotePort();
  }
  return currentServletRequest.getScheme() + "String_Node_Str" + currentServletRequest.getRemoteHost()+ port;
}

Fixed version (ground truth):
/** 
 * Gets base url (host + post) from a context uriInfo. <p/> For example: http://localhost:8080
 * @return the base url (host + port)
 * @author <a href="http://hoatle">hoatle (hoatlevan at gmail dot com)</a>
 * @since  1.2.3
 */
public static final String getBaseUrl(){
  HttpServletRequest currentServletRequest=getCurrentServletRequest();
  return currentServletRequest.getScheme() + "String_Node_Str" + currentServletRequest.getServerName()+ "String_Node_Str"+ currentServletRequest.getServerPort();
}
Program: 102573
Project: 102573
Buggy source:
private void setFakeCurrentEnvironmentContext(String urlRequest){
  EnvironmentContext envctx=new EnvironmentContext();
  HttpServletRequest httpRequest=new FakeHttpServletRequest(urlRequest);
  envctx.put(HttpServletRequest.class,httpRequest);
  EnvironmentContext.setCurrent(envctx);
}

Fixed version (ground truth):
private void setFakeCurrentEnvironmentContext(String urlRequest){
  EnvironmentContext envctx=new EnvironmentContext();
  HttpServletRequest httpRequest=new MockHttpServletRequest(urlRequest,null,0,"String_Node_Str",null);
  envctx.put(HttpServletRequest.class,httpRequest);
  EnvironmentContext.setCurrent(envctx);
}
Program: 102575
Project: 102575
Buggy source:
/** 
 * Constructors to set the list of activities and the number of comments, the number of likes.
 * @param activityList     the activity list
 * @param numberOfComments the number of comments
 * @param numberOfLikes    the number of likes
 */
public ActivityRestListOut(List<ExoSocialActivity> activityList,int numberOfComments,int numberOfLikes,String portalContainerName){
  if (activityList == null || activityList.size() == 0) {
    initialize();
    return;
  }
 else   if (activityList.size() > MAX_LIMIT) {
    activityList=activityList.subList(0,MAX_LIMIT - 1);
  }
  numberOfComments=Math.min(numberOfComments,MAX_NUMBER_OF_COMMENTS);
  numberOfLikes=Math.min(numberOfLikes,MAX_NUMBER_OF_LIKES);
  initialize(activityList,numberOfComments,numberOfLikes,portalContainerName);
}

Fixed version (ground truth):
/** 
 * Constructors to set the list of activities and the number of comments, the number of likes.
 * @param activityList     the activity list
 * @param numberOfComments the number of comments
 * @param numberOfLikes    the number of likes
 */
public ActivityRestListOut(List<ExoSocialActivity> activityList,int numberOfComments,int numberOfLikes,String portalContainerName){
  if (activityList == null || activityList.size() == 0) {
    initialize();
    return;
  }
 else   if (activityList.size() > MAX_LIMIT) {
    activityList=activityList.subList(0,MAX_LIMIT - 1);
  }
  numberOfComments=numberOfComments >= 0 ? numberOfComments : 0;
  numberOfComments=Math.min(numberOfComments,MAX_NUMBER_OF_COMMENTS);
  numberOfLikes=numberOfLikes >= 0 ? numberOfLikes : 0;
  numberOfLikes=Math.min(numberOfLikes,MAX_NUMBER_OF_LIKES);
  initialize(activityList,numberOfComments,numberOfLikes,portalContainerName);
}
Program: 102576
Project: 102576
Buggy source:
private void setFakeCurrentEnvironmentContext(String urlRequest){
  EnvironmentContext envctx=new EnvironmentContext();
  HttpServletRequest httpRequest=new MockHttpServletRequest(urlRequest,null,0,"String_Node_Str",null);
  envctx.put(HttpServletRequest.class,httpRequest);
  EnvironmentContext.setCurrent(envctx);
}

Fixed version (ground truth):
private void setFakeCurrentEnvironmentContext(String urlRequest){
  EnvironmentContext envctx=new EnvironmentContext();
  HttpServletRequest httpRequest=new SocialMockHttpServletRequest(urlRequest,null,0,"String_Node_Str",null);
  envctx.put(HttpServletRequest.class,httpRequest);
  EnvironmentContext.setCurrent(envctx);
}
Program: 102577
Project: 102577
Buggy source:
/** 
 * Initializes all components for the first time.
 * @throws Exception
 */
public UIDisplayProfileList() throws Exception {
  iterator=addChild(UIPageIterator.class,null,ITERATOR_ID);
  uiProfileUserSearchPeople=createUIComponent(UIProfileUserSearch.class,null,"String_Node_Str");
  addChild(uiProfileUserSearchPeople);
  this.identityList=new ArrayList<Identity>();
}

Fixed version (ground truth):
/** 
 * Constructor to initialize iterator.
 * @throws Exception
 */
public UIDisplayProfileList() throws Exception {
  uiProfileUserSearch=addChild(UIProfileUserSearch.class,null,null);
  uiProfileUserSearch.setHasPeopleTab(false);
  init();
}
Program: 102578
Project: 102578
Buggy source:
@Override public void execute(Event<UIDisplayProfileList> event) throws Exception {
  UIDisplayProfileList uiMyRelation=event.getSource();
  UIProfileUserSearch uiProfileUserSearch=uiMyRelation.getChild(UIProfileUserSearch.class);
  List<Identity> identityList=uiProfileUserSearch.getIdentityList();
  uiMyRelation.setIdentityList(identityList);
  uiMyRelation.setSearched(true);
}

Fixed version (ground truth):
@Override public void execute(Event<UIDisplayProfileList> event) throws Exception {
  UIDisplayProfileList uiAllPeople=event.getSource();
  uiAllPeople.loadSearch();
  uiAllPeople.setLoadAtEnd(false);
}
Program: 102579
Project: 102579
Buggy source:
/** 
 * Initializes user search form fields. Initials and adds components as children to search form.
 * @throws Exception
 */
public UIProfileUserSearch() throws Exception {
  List<SelectItemOption<String>> options=new ArrayList<SelectItemOption<String>>();
  options.add(new SelectItemOption<String>(GENDER_DEFAULT));
  options.add(new SelectItemOption<String>(MALE));
  options.add(new SelectItemOption<String>(FEMALE));
  addUIFormInput(new UIFormStringInput(SEARCH,USER_CONTACT,USER_CONTACT));
  addUIFormInput(new UIFormStringInput(Profile.POSITION,Profile.POSITION,Profile.POSITION));
  addUIFormInput(new UIFormStringInput(Profile.EXPERIENCES_SKILLS,Profile.EXPERIENCES_SKILLS,Profile.EXPERIENCES_SKILLS));
  addUIFormInput(new UIFormSelectBox(Profile.GENDER,Profile.GENDER,options));
  profileFilter=new ProfileFilter();
  setHasPeopleTab(false);
  setSelectedChar(ALL_FILTER);
}

Fixed version (ground truth):
/** 
 * Initializes user search form fields. Initials and adds components as children to search form.
 * @throws Exception
 */
public UIProfileUserSearch() throws Exception {
  ResourceBundle resourceBudle=PortalRequestContext.getCurrentInstance().getApplicationResourceBundle();
  String defaultName=resourceBudle.getString("String_Node_Str");
  String defaultPos=resourceBudle.getString("String_Node_Str");
  String defaultSkills=resourceBudle.getString("String_Node_Str");
  String defaultGender=resourceBudle.getString("String_Node_Str");
  String defaultMale=resourceBudle.getString("String_Node_Str");
  String defaultFeMale=resourceBudle.getString("String_Node_Str");
  List<SelectItemOption<String>> options=new ArrayList<SelectItemOption<String>>();
  options.add(new SelectItemOption<String>(defaultGender));
  options.add(new SelectItemOption<String>(defaultMale));
  options.add(new SelectItemOption<String>(defaultFeMale));
  addUIFormInput(new UIFormStringInput(SEARCH,USER_CONTACT,defaultName));
  addUIFormInput(new UIFormStringInput(Profile.POSITION,Profile.POSITION,defaultPos));
  addUIFormInput(new UIFormStringInput(Profile.EXPERIENCES_SKILLS,Profile.EXPERIENCES_SKILLS,defaultSkills));
  addUIFormInput(new UIFormSelectBox(Profile.GENDER,Profile.GENDER,options)).setId("String_Node_Str");
  profileFilter=new ProfileFilter();
  setHasPeopleTab(false);
  setSelectedChar(ALL_FILTER);
}
Program: 102580
Project: 102580
Buggy source:
/** 
 * Gets page node list for displaying as application links.
 * @return page node list
 * @throws Exception
 */
public List<PageNode> getApps() throws Exception {
  String spaceUrl=SpaceUtils.getSpaceUrl();
  SpaceService spaceSrc=getApplicationComponent(SpaceService.class);
  space=spaceSrc.getSpaceByUrl(spaceUrl);
  if (space == null) {
    return new ArrayList<PageNode>(0);
  }
  DataStorage dataStorage=getApplicationComponent(DataStorage.class);
  PageNavigation pageNav=dataStorage.getPageNavigation(PortalConfig.GROUP_TYPE,space.getGroupId());
  PageNode homeNode=SpaceUtils.getHomeNode(pageNav,space.getUrl());
  if (homeNode == null) {
    throw new Exception("String_Node_Str");
  }
  List<PageNode> list=homeNode.getNodes();
  PageNode pageNode=null;
  for (  PageNode node : list) {
    if (node.getName().contains(SPACE_SETTING_PORTLET)) {
      pageNode=node;
      break;
    }
  }
  if (!isLeader() && (pageNode != null)) {
    list.remove(pageNode);
  }
  Collections.sort(list,new ApplicationComparator());
  return list;
}

Fixed version (ground truth):
/** 
 * Gets page node list for displaying as application links.
 * @return page node list
 * @throws Exception
 */
public List<PageNode> getApps() throws Exception {
  String spaceUrl=SpaceUtils.getSpaceUrl();
  SpaceService spaceSrc=getApplicationComponent(SpaceService.class);
  space=spaceSrc.getSpaceByUrl(spaceUrl);
  if (space == null) {
    return new ArrayList<PageNode>(0);
  }
  DataStorage dataStorage=getApplicationComponent(DataStorage.class);
  PageNavigation pageNav=dataStorage.getPageNavigation(PortalConfig.GROUP_TYPE,space.getGroupId());
  PageNode homeNode=SpaceUtils.getHomeNode(pageNav,space.getUrl());
  if (homeNode == null) {
    throw new Exception("String_Node_Str");
  }
  List<PageNode> list=homeNode.getNodes();
  PageNode pageNode=null;
  for (  PageNode node : list) {
    if (SPACE_SETTINGS.equals(node.getName())) {
      pageNode=node;
      break;
    }
  }
  if (!hasSettingPermission() && (pageNode != null)) {
    list.remove(pageNode);
  }
  Collections.sort(list,new ApplicationComparator());
  return list;
}
Program: 102581
Project: 102581
Buggy source:
public boolean isRender(PageNode spaceNode,PageNode applicationNode) throws SpaceException {
  SpaceService spaceSrv=getSpaceService();
  String remoteUser=getUserId();
  String spaceUrl=spaceNode.getUri();
  if (spaceUrl.contains("String_Node_Str")) {
    spaceUrl=spaceUrl.split("String_Node_Str")[0];
  }
  Space space=spaceSrv.getSpaceByUrl(spaceUrl);
  if (space == null) {
    return false;
  }
  if (spaceSrv.hasSettingPermission(space,remoteUser)) {
    return true;
  }
  String appName=applicationNode.getName();
  if (!appName.contains(SPACE_SETTING_PORTLET)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isRender(PageNode spaceNode,PageNode applicationNode) throws SpaceException {
  SpaceService spaceSrv=getSpaceService();
  String remoteUser=getUserId();
  String spaceUrl=spaceNode.getUri();
  if (spaceUrl.contains("String_Node_Str")) {
    spaceUrl=spaceUrl.split("String_Node_Str")[0];
  }
  Space space=spaceSrv.getSpaceByUrl(spaceUrl);
  if (space == null) {
    return false;
  }
  if (spaceSrv.hasSettingPermission(space,remoteUser)) {
    return true;
  }
  if (SPACE_SETTINGS.equals(applicationNode.getName())) {
    return false;
  }
  return true;
}
Program: 102582
Project: 102582
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Identity getIdentity(String identityId,boolean forceLoadOrReloadProfile){
  Identity cachedIdentity=identityCacheById.get(identityId);
  if (cachedIdentity != null) {
    return cachedIdentity;
  }
  Identity foundIdentity=super.getIdentity(identityId,forceLoadOrReloadProfile);
  if (foundIdentity != null) {
    identityCacheById.put(identityId,foundIdentity);
    cachedIdentity=foundIdentity;
  }
  return cachedIdentity;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Identity getIdentity(String identityId,boolean forceLoadOrReloadProfile){
  Identity cachedIdentity=identityCacheById.get(identityId);
  if (cachedIdentity != null && !forceLoadOrReloadProfile) {
    return cachedIdentity;
  }
  Identity foundIdentity=super.getIdentity(identityId,forceLoadOrReloadProfile);
  if (foundIdentity != null) {
    identityCacheById.put(identityId,foundIdentity);
    cachedIdentity=foundIdentity;
  }
  return cachedIdentity;
}
Program: 102583
Project: 102583
Buggy source:
public void setActivity(ExoSocialActivity activity){
  this.activity=activity;
  setOwnerIdentity(Utils.getIdentityManager().getIdentity(activity.getUserId()));
  addChild(new UIFormTextAreaInput("String_Node_Str" + activity.getId(),"String_Node_Str",null));
  try {
    refresh();
  }
 catch (  ActivityStorageException e) {
    LOG.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void setActivity(ExoSocialActivity activity){
  this.activity=activity;
  setOwnerIdentity(Utils.getIdentityManager().getIdentity(activity.getUserId(),true));
  addChild(new UIFormTextAreaInput("String_Node_Str" + activity.getId(),"String_Node_Str",null));
  try {
    refresh();
  }
 catch (  ActivityStorageException e) {
    LOG.error(e.getMessage(),e);
  }
}
Program: 102584
Project: 102584
Buggy source:
/** 
 * Checks if a node is a selected node
 * @param node
 * @return true or false
 */
public boolean isSelectedNode(PageNode node){
  if (selectedNode_ != null && node.getUri().equals(selectedNode_.getUri())) {
    return true;
  }
  if (selectedParent_ != null || selectedParent_ instanceof PageNode) {
    return node.getUri().equals(((PageNode)selectedParent_).getUri());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if a node is a selected node
 * @param node
 * @return true or false
 */
public boolean isSelectedNode(PageNode node){
  if (selectedNode_ != null && node.getUri().equals(selectedNode_.getUri())) {
    return true;
  }
  if (selectedParent_ != null && selectedParent_ instanceof PageNode) {
    return node.getUri().equals(((PageNode)selectedParent_).getUri());
  }
  return false;
}
Program: 102585
Project: 102585
Buggy source:
public GlobalId getGlobalId(){
  return GlobalId.create(providerId,remoteId);
}

Fixed version (ground truth):
/** 
 * @return global id of identity
 */
public GlobalId getGlobalId(){
  if (globalId == null)   globalId=GlobalId.create(providerId,remoteId);
  return globalId;
}
Program: 102586
Project: 102586
Buggy source:
public String toString(){
  return providerId + "String_Node_Str" + remoteId;
}

Fixed version (ground truth):
/** 
 * @return the global id string of identity
 */
@Override public String toString(){
  return getGlobalId().toString();
}
Program: 102587
Project: 102587
Buggy source:
/** 
 * Adds component when add buttons clicked.<br>
 * @throws Exception
 */
private void addUIFormInput() throws Exception {
  expIdx+=1;
  addUIFormInput(new UIFormStringInput(COMPANY + expIdx,null,null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,3,90));
  addUIFormInput(new UIFormStringInput(POSITION + expIdx,null,null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,3,90));
  addUIFormInput(new UIFormTextAreaInput(DESCRIPTION + expIdx,null,null));
  UIFormTextAreaInput uiDespcription=getChildById(DESCRIPTION + expIdx);
  uiDespcription.setColumns(23);
  uiDespcription.setRows(3);
  addUIFormInput(new UIFormTextAreaInput(SKILLS + expIdx,null,null));
  UIFormTextAreaInput uiFormTextAreaInput=getChildById(SKILLS + expIdx);
  uiFormTextAreaInput.setColumns(23);
  uiFormTextAreaInput.setRows(3);
  addUIFormInput(new UIFormDateTimeInput(START_DATE + expIdx,null,null,false).addValidator(DateTimeValidator.class).addValidator(MandatoryValidator.class));
  addUIFormInput(new UIFormDateTimeInput(END_DATE + expIdx,null,null,false).addValidator(MandatoryValidator.class).addValidator(DateTimeValidator.class));
  UIFormCheckBoxInput<Boolean> uiDateInputCheck=new UIFormCheckBoxInput<Boolean>(Integer.toString(expIdx),null,false);
  uiDateInputCheck.setComponentConfig(UIFormCheckBoxInput.class,"String_Node_Str");
  uiDateInputCheck.setOnChange("String_Node_Str",uiDateInputCheck.getId());
  addUIFormInput(uiDateInputCheck);
}

Fixed version (ground truth):
/** 
 * Adds component when add buttons clicked.<br>
 * @throws Exception
 */
private void addUIFormInput() throws Exception {
  expIdx+=1;
  addUIFormInput(new UIFormStringInput(COMPANY + expIdx,null,null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,3,90));
  addUIFormInput(new UIFormStringInput(POSITION + expIdx,null,null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,3,90));
  addUIFormInput(new UIFormTextAreaInput(DESCRIPTION + expIdx,null,null));
  UIFormTextAreaInput uiDespcription=getChildById(DESCRIPTION + expIdx);
  uiDespcription.setColumns(28);
  uiDespcription.setRows(3);
  addUIFormInput(new UIFormTextAreaInput(SKILLS + expIdx,null,null));
  UIFormTextAreaInput uiFormTextAreaInput=getChildById(SKILLS + expIdx);
  uiFormTextAreaInput.setColumns(28);
  uiFormTextAreaInput.setRows(3);
  addUIFormInput(new UIFormDateTimeInput(START_DATE + expIdx,null,null,false).addValidator(DateTimeValidator.class).addValidator(MandatoryValidator.class));
  addUIFormInput(new UIFormDateTimeInput(END_DATE + expIdx,null,null,false).addValidator(MandatoryValidator.class).addValidator(DateTimeValidator.class));
  UIFormCheckBoxInput<Boolean> uiDateInputCheck=new UIFormCheckBoxInput<Boolean>(Integer.toString(expIdx),null,false);
  uiDateInputCheck.setComponentConfig(UIFormCheckBoxInput.class,"String_Node_Str");
  uiDateInputCheck.setOnChange("String_Node_Str",uiDateInputCheck.getId());
  addUIFormInput(uiDateInputCheck);
}
Program: 102588
Project: 102588
Buggy source:
/** 
 * Activates classic application type in a space
 * @param space
 * @param appId
 * @throws SpaceException
 */
private void activateApplicationClassic(Space space,String appId,String appName) throws SpaceException {
  PageNavigation nav=SpaceUtils.createGroupNavigation(space.getGroupId());
  PageNode pageNode=createPageNodeFromApplication(space,appId,appName,false);
  UIPortal uiPortal=Util.getUIPortal();
  PageNode selectedNode=null;
  try {
    selectedNode=uiPortal.getSelectedNode();
  }
 catch (  Exception e2) {
    e2.printStackTrace();
  }
  UIPortalApplication uiPortalApp=Util.getUIPortalApplication();
  UserPortalConfig userPortalConfig=uiPortalApp.getUserPortalConfig();
  List<PageNavigation> navigations=userPortalConfig.getNavigations();
  for (  PageNavigation navi : navigations) {
    if ((navi.getOwner()).equals(nav.getOwner())) {
      nav=navi;
      break;
    }
  }
  try {
    PageNode homeNode=SpaceUtils.getHomeNode(nav,space.getUrl());
    if (homeNode == null) {
      throw new Exception("String_Node_Str");
    }
    List<PageNode> childNodes=homeNode.getChildren();
    if (childNodes == null)     childNodes=new ArrayList<PageNode>();
    childNodes.add(pageNode);
    dataStorage.save(nav);
    if ("String_Node_Str".equals(appId))     changeDashBoardColumn(pageNode);
    uiPortal.setSelectedNode(selectedNode);
    uiPortal.setSelectedNavigation(nav);
    SpaceUtils.setNavigation(nav);
  }
 catch (  Exception e) {
    try {
    }
 catch (    Exception e1) {
    }
    throw new SpaceException(SpaceException.Code.UNABLE_TO_ADD_APPLICATION,e);
  }
}

Fixed version (ground truth):
/** 
 * Activates classic application type in a space
 * @param space
 * @param appId
 * @throws SpaceException
 */
private void activateApplicationClassic(Space space,String appId,String appName) throws SpaceException {
  PageNavigation nav=SpaceUtils.createGroupNavigation(space.getGroupId());
  PageNode pageNode=createPageNodeFromApplication(space,appId,appName,false);
  UIPortal uiPortal=Util.getUIPortal();
  PageNode selectedNode=null;
  try {
    selectedNode=uiPortal.getSelectedNode();
  }
 catch (  Exception e2) {
    e2.printStackTrace();
  }
  UIPortalApplication uiPortalApp=Util.getUIPortalApplication();
  UserPortalConfig userPortalConfig=uiPortalApp.getUserPortalConfig();
  List<PageNavigation> navigations=userPortalConfig.getNavigations();
  for (  PageNavigation navi : navigations) {
    if ((navi.getOwner()).equals(nav.getOwner())) {
      nav=navi;
      break;
    }
  }
  try {
    PageNode homeNode=SpaceUtils.getHomeNode(nav,space.getUrl());
    if (homeNode == null) {
      throw new Exception("String_Node_Str");
    }
    List<PageNode> childNodes=homeNode.getChildren();
    if (childNodes == null)     childNodes=new ArrayList<PageNode>();
    childNodes.add(pageNode);
    dataStorage.save(nav);
    uiPortal.setSelectedNode(selectedNode);
    uiPortal.setSelectedNavigation(nav);
    SpaceUtils.setNavigation(nav);
  }
 catch (  Exception e) {
    try {
    }
 catch (    Exception e1) {
    }
    throw new SpaceException(SpaceException.Code.UNABLE_TO_ADD_APPLICATION,e);
  }
}
Program: 102589
Project: 102589
Buggy source:
/** 
 * Inits the app.
 * @param space the space
 * @param homeNodeApp the home node app
 * @param apps the apps
 * @throws SpaceException the space exception {@inheritDoc}
 */
public void initApp(Space space,String homeNodeApp,List<String> apps) throws SpaceException {
  try {
    PageNavigation spaceNav=SpaceUtils.createGroupNavigation(space.getGroupId());
    PageNode homeNode=createPageNodeFromApplication(space,homeNodeApp,null,true);
    List<PageNode> childNodes=homeNode.getChildren();
    if (childNodes == null)     childNodes=new ArrayList<PageNode>();
    PageNode dashBoardPageNode=null;
    for (    String app : apps) {
      app=(app.trim()).split("String_Node_Str")[0];
      PageNode appNode=createPageNodeFromApplication(space,app,null,false);
      if ("String_Node_Str".equals(app))       dashBoardPageNode=appNode;
      childNodes.add(appNode);
    }
    spaceNav.addNode(homeNode);
    dataStorage.save(spaceNav);
    changeDashBoardColumn(dashBoardPageNode);
    SpaceUtils.setNavigation(spaceNav);
    PortalConfig portalConfig=dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE,space.getGroupId());
    LOG.info("String_Node_Str" + portalConfig);
  }
 catch (  Exception e) {
    throw new SpaceException(SpaceException.Code.UNABLE_TO_INIT_APP,e);
  }
}

Fixed version (ground truth):
/** 
 * Inits the app.
 * @param space the space
 * @param homeNodeApp the home node app
 * @param apps the apps
 * @throws SpaceException the space exception {@inheritDoc}
 */
public void initApp(Space space,String homeNodeApp,List<String> apps) throws SpaceException {
  try {
    PageNavigation spaceNav=SpaceUtils.createGroupNavigation(space.getGroupId());
    PageNode homeNode=createPageNodeFromApplication(space,homeNodeApp,null,true);
    List<PageNode> childNodes=homeNode.getChildren();
    if (childNodes == null)     childNodes=new ArrayList<PageNode>();
    for (    String app : apps) {
      app=(app.trim()).split("String_Node_Str")[0];
      PageNode appNode=createPageNodeFromApplication(space,app,null,false);
      childNodes.add(appNode);
    }
    spaceNav.addNode(homeNode);
    dataStorage.save(spaceNav);
    SpaceUtils.setNavigation(spaceNav);
    PortalConfig portalConfig=dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE,space.getGroupId());
    LOG.info("String_Node_Str" + portalConfig);
  }
 catch (  Exception e) {
    throw new SpaceException(SpaceException.Code.UNABLE_TO_INIT_APP,e);
  }
}
Program: 102590
Project: 102590
Buggy source:
/** 
 * destroys like by identityId and gets json/xml return format
 * @param uriInfo
 * @param activityId
 * @param identityId
 * @param format 
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyLike(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String identityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=destroyLike(activityId,identityId);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * destroys like by identityId and gets json/xml return format
 * @param uriInfo
 * @param activityId
 * @param identityId
 * @param format
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyLike(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String identityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=destroyLike(activityId,identityId);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102591
Project: 102591
Buggy source:
/** 
 * shows list of like by activityId and returns json/xml format
 * @param uriInfo
 * @param activityId
 * @param format 
 * @return response
 * @throws Exception
 */
@GET @Path("String_Node_Str") public Response showLikes(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=showLikes(activityId);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * shows list of like by activityId and returns json/xml format
 * @param uriInfo
 * @param activityId
 * @param format
 * @return response
 * @throws Exception
 */
@GET @Path("String_Node_Str") public Response showLikes(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=showLikes(activityId);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102592
Project: 102592
Buggy source:
/** 
 * destroys comments and returns json/xml format
 * @param uriInfo
 * @param activityId
 * @param commentId
 * @param format 
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyComment(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String commentId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=destroyComment(activityId,commentId);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * destroys comments and returns json/xml format
 * @param uriInfo
 * @param activityId
 * @param commentId
 * @param format
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyComment(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String commentId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=destroyComment(activityId,commentId);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102593
Project: 102593
Buggy source:
/** 
 * updates comment by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format 
 * @param comment
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateComment(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,Activity comment) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=updateComment(activityId,comment);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * updates comment by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format
 * @param comment
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateComment(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,Activity comment) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=updateComment(activityId,comment);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102594
Project: 102594
Buggy source:
/** 
 * destroys activity and gets json/xml return format
 * @param uriInfo
 * @param activityId
 * @param format 
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyActivity(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  Activity activity=destroyActivity(activityId);
  return Util.getResponse(activity,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * destroys activity and gets json/xml return format
 * @param uriInfo
 * @param activityId
 * @param format
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") public Response destroyActivity(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  Activity activity=destroyActivity(activityId);
  return Util.getResponse(activity,uriInfo,mediaType,Response.Status.OK);
}
Program: 102595
Project: 102595
Buggy source:
/** 
 * updates like by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format 
 * @param like
 * @return response
 * @throws Exception 
 */
@POST @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateLike(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,Like like) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=updateLike(activityId,like);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * updates like by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format
 * @param like
 * @return response
 * @throws Exception
 */
@POST @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Response updateLike(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,Like like) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  LikeList likeList=null;
  likeList=updateLike(activityId,like);
  return Util.getResponse(likeList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102596
Project: 102596
Buggy source:
/** 
 * shows comment list by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format 
 * @return response
 * @throws Exception
 */
@GET @Path("String_Node_Str") public Response showComments(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=showComments(activityId);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * shows comment list by json/xml format
 * @param uriInfo
 * @param activityId
 * @param format
 * @return response
 * @throws Exception
 */
@GET @Path("String_Node_Str") public Response showComments(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format) throws Exception {
  MediaType mediaType=Util.getMediaType(format);
  portalName_=portalName;
  CommentList commentList=null;
  commentList=showComments(activityId);
  return Util.getResponse(commentList,uriInfo,mediaType,Response.Status.OK);
}
Program: 102597
Project: 102597
Buggy source:
/** 
 * Sets space to work with
 * @param space
 * @throws Exception 
 */
public void setSpace(Space space) throws Exception {
  space_=space;
  init();
}

Fixed version (ground truth):
/** 
 * Sets space to work with
 * @param space
 * @throws Exception
 */
public void setSpace(Space space) throws Exception {
  space_=space;
  init();
}
Program: 102598
Project: 102598
Buggy source:
/** 
 * initialize
 * @throws Exception
 */
private void init() throws Exception {
  if (space_ == null) {
    LOG.warn("String_Node_Str");
    return;
  }
  setChildren(null);
  Identity spaceIdentity=getIdentityManager().getOrCreateIdentity(SpaceIdentityProvider.NAME,space_.getId());
  activityList_=getActivityManager().getActivities(spaceIdentity);
  if (activityList_ != null)   Collections.reverse(activityList_);
  addChild(UIActivitiesContainer.class,null,null).setActivityList(activityList_).setIndex(0);
}

Fixed version (ground truth):
/** 
 * initialize
 * @throws Exception
 */
private void init() throws Exception {
  if (space_ == null) {
    LOG.warn("String_Node_Str");
    return;
  }
  setChildren(null);
  Identity spaceIdentity=getIdentityManager().getOrCreateIdentity(SpaceIdentityProvider.NAME,space_.getId());
  activityList_=getActivityManager().getActivities(spaceIdentity);
  addChild(UIActivitiesContainer.class,null,null).setActivityList(activityList_).setIndex(0);
}
Program: 102599
Project: 102599
Buggy source:
@Override public Status3 call() throws XfsException {
  Status3 result;
  XfsInfoCommand<CimInfoCommand> command=new XfsInfoCommand<CimInfoCommand>(idcService,CimInfoCommand.STATUS);
  WFSResult wfsResult=null;
  try {
    wfsResult=command.call();
    result=IdcFactory.create(idcService.getXfsVersion(),wfsResult.getResults(),Status3.class);
    if (LOG.isInfoEnabled()) {
      LOG.info("String_Node_Str",result);
    }
  }
  finally {
    if (wfsResult != null) {
      XfsServiceManager.getInstance().free(wfsResult);
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public Status3 call() throws XfsException {
  Status3 result;
  XfsInfoCommand<IdcInfoCommand> command=new XfsInfoCommand<IdcInfoCommand>(idcService,IdcInfoCommand.STATUS);
  WFSResult wfsResult=null;
  try {
    wfsResult=command.call();
    result=IdcFactory.create(idcService.getXfsVersion(),wfsResult.getResults(),Status3.class);
    if (LOG.isInfoEnabled()) {
      LOG.info("String_Node_Str",result);
    }
  }
  finally {
    if (wfsResult != null) {
      XfsServiceManager.getInstance().free(wfsResult);
    }
  }
  return result;
}