Program: 44634
Project: 44634
Buggy source:
@SuppressWarnings("String_Node_Str") public <T>T getTaxonomy(String taxonomyIdOrName,ResourceRepresentationType<T> taxonomyOutput,FetchLevel fetchLevel,boolean prettyPrint){
  if (StringUtils.isBlank(taxonomyIdOrName)) {
    return null;
  }
  if (!CmsConstants.UUIDPattern.matcher(taxonomyIdOrName).matches() && Taxonomy.REPOSITORY_USER_FOLKSONOMY_NAME.equals(taxonomyIdOrName)) {
    throw new CmsException("String_Node_Str");
  }
  ByteArrayOutputStream os=null;
  try {
    Session session=getSession();
    Node taxonomyNode=getTaxonomyNodeByIdOrName(session,taxonomyIdOrName);
    if (taxonomyNode == null) {
      return null;
    }
    if (taxonomyOutput == null || ResourceRepresentationType.TAXONOMY_INSTANCE.equals(taxonomyOutput) || ResourceRepresentationType.TAXONOMY_LIST.equals(taxonomyOutput)) {
      Taxonomy taxonomy=taxonomyRenderer.renderTaxonomy(taxonomyNode,null,cmsRepositoryEntityFactoryForActiveClient.newTaxonomy());
      if (fetchLevel != null) {
switch (fetchLevel) {
case ENTITY_AND_CHILDREN:
          taxonomy.getRootTopics();
        break;
case FULL:
      loadAllChildren(taxonomy.getRootTopics());
    break;
default :
  break;
}
}
if (taxonomyOutput == null || ResourceRepresentationType.TAXONOMY_INSTANCE.equals(taxonomyOutput)) {
return (T)taxonomy;
}
 else {
CmsOutcome<Taxonomy> outcome=new CmsOutcomeImpl<Taxonomy>(1,0,1);
outcome.getResults().add(taxonomy);
return (T)outcome;
}
}
 else if (ResourceRepresentationType.XML.equals(taxonomyOutput) || ResourceRepresentationType.JSON.equals(taxonomyOutput)) {
String taxonomy=null;
os=new ByteArrayOutputStream();
serializationDao.serializeCmsRepositoryEntity(taxonomyNode,os,taxonomyOutput,CmsEntityType.TAXONOMY,null,fetchLevel,true,false,prettyPrint);
taxonomy=new String(os.toByteArray(),"String_Node_Str");
return (T)taxonomy;
}
 else {
throw new CmsException("String_Node_Str" + taxonomyOutput);
}
}
 catch (RepositoryException ex) {
throw new CmsException(ex);
}
catch (Exception e) {
throw new CmsException(e);
}
 finally {
IOUtils.closeQuietly(os);
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>T getTaxonomy(String taxonomyIdOrName,ResourceRepresentationType<T> taxonomyOutput,FetchLevel fetchLevel,boolean prettyPrint){
  if (StringUtils.isBlank(taxonomyIdOrName)) {
    return null;
  }
  if (!CmsConstants.UUIDPattern.matcher(taxonomyIdOrName).matches() && Taxonomy.REPOSITORY_USER_FOLKSONOMY_NAME.equals(taxonomyIdOrName)) {
    throw new CmsException("String_Node_Str");
  }
  ByteArrayOutputStream os=null;
  try {
    Session session=getSession();
    Node taxonomyNode=getTaxonomyNodeByIdOrName(session,taxonomyIdOrName);
    if (taxonomyNode == null) {
      return null;
    }
    if (taxonomyOutput == null || ResourceRepresentationType.TAXONOMY_INSTANCE.equals(taxonomyOutput) || ResourceRepresentationType.TAXONOMY_LIST.equals(taxonomyOutput)) {
      Taxonomy taxonomy=taxonomyRenderer.renderTaxonomy(taxonomyNode,null,cmsRepositoryEntityFactoryForActiveClient.newTaxonomy());
      if (fetchLevel != null) {
switch (fetchLevel) {
case ENTITY_AND_CHILDREN:
          taxonomy.getRootTopics();
        break;
case FULL:
      loadAllChildren(taxonomy.getRootTopics());
    break;
default :
  break;
}
}
if (taxonomyOutput == null || ResourceRepresentationType.TAXONOMY_INSTANCE.equals(taxonomyOutput)) {
return (T)taxonomy;
}
 else {
CmsOutcome<Taxonomy> outcome=new CmsOutcomeImpl<Taxonomy>(1,0,1);
outcome.getResults().add(taxonomy);
return (T)outcome;
}
}
 else if (ResourceRepresentationType.XML.equals(taxonomyOutput) || ResourceRepresentationType.JSON.equals(taxonomyOutput)) {
String taxonomy=null;
os=new ByteArrayOutputStream();
SerializationConfiguration serializationConfiguration=SerializationConfiguration.taxonomy().prettyPrint(prettyPrint).representationType(taxonomyOutput).build();
serializationDao.serializeCmsRepositoryEntity(taxonomyNode,os,CmsEntityType.TAXONOMY,null,fetchLevel,true,serializationConfiguration);
taxonomy=new String(os.toByteArray(),"String_Node_Str");
return (T)taxonomy;
}
 else {
throw new CmsException("String_Node_Str" + taxonomyOutput);
}
}
 catch (RepositoryException ex) {
throw new CmsException(ex);
}
catch (Exception e) {
throw new CmsException(e);
}
 finally {
IOUtils.closeQuietly(os);
}
}