Program: 47092
Project: 47092
Buggy source:
/** 
 * Returns an XML (DIDL) representation of the DLNA node. It gives a complete representation of the item, with as many tags as available. Recommendations as per UPNP specification are followed where possible.
 * @param mediaRenderer Media Renderer for which to represent this information. Useful for some hacks.
 * @return String representing the item. An example would start like this:{@code <container id="0$1" childCount="1" parentID="0" restricted="true">}
 */
public final String getDidlString(RendererConfiguration mediaRenderer){
  PmsConfiguration configurationSpecificToRenderer=PMS.getConfiguration(mediaRenderer);
  StringBuilder sb=new StringBuilder();
  boolean subsAreValidForStreaming=false;
  boolean xbox360=mediaRenderer.isXbox360();
  if (!isFolder()) {
    if (format != null && format.isVideo()) {
      if (!configurationSpecificToRenderer.isDisableSubtitles() && (player != null && mediaRenderer.streamSubsForTranscodedVideo() || player == null) && media_subtitle != null && media_subtitle.isStreamable()) {
        subsAreValidForStreaming=true;
        LOGGER.trace("String_Node_Str" + media_subtitle.getExternalFile().getName());
      }
 else {
        LOGGER.trace("String_Node_Str" + getName());
      }
    }
    openTag(sb,"String_Node_Str");
  }
 else {
    openTag(sb,"String_Node_Str");
  }
  String id=getResourceId();
  if (xbox360) {
    id+="String_Node_Str";
  }
  addAttribute(sb,"String_Node_Str",id);
  if (isFolder()) {
    if (!isDiscovered() && childrenNumber() == 0) {
      addAttribute(sb,"String_Node_Str",1);
    }
 else {
      addAttribute(sb,"String_Node_Str",childrenNumber());
    }
  }
  id=getParentId();
  if (xbox360 && getFakeParentId() == null) {
    id+="String_Node_Str";
  }
  addAttribute(sb,"String_Node_Str",id);
  addAttribute(sb,"String_Node_Str","String_Node_Str");
  endTag(sb);
  StringBuilder wireshark=new StringBuilder();
  final DLNAMediaAudio firstAudioTrack=media != null ? media.getFirstAudioTrack() : null;
  String title;
  if (firstAudioTrack != null && StringUtils.isNotBlank(firstAudioTrack.getSongname()) && getFormat() != null && getFormat().isAudio()) {
    title=firstAudioTrack.getSongname() + (player != null && !configurationSpecificToRenderer.isHideEngineNames() ? ("String_Node_Str" + player.name() + "String_Node_Str") : "String_Node_Str");
  }
 else {
    title=(isFolder() || subsAreValidForStreaming) ? getDisplayName(null,false) : mediaRenderer.getUseSameExtension(getDisplayName(mediaRenderer,false));
  }
  title=resumeStr(title);
  addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(mediaRenderer.getDcTitle(title,nameSuffix,this)));
  wireshark.append("String_Node_Str").append(title).append("String_Node_Str");
  if (firstAudioTrack != null) {
    if (StringUtils.isNotBlank(firstAudioTrack.getAlbum())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getAlbum()));
    }
    if (StringUtils.isNotBlank(firstAudioTrack.getArtist())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getArtist()));
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getArtist()));
    }
    if (StringUtils.isNotBlank(firstAudioTrack.getGenre())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getGenre()));
    }
    if (firstAudioTrack.getTrack() > 0) {
      addXMLTagAndAttribute(sb,"String_Node_Str","String_Node_Str" + firstAudioTrack.getTrack());
    }
  }
  if (!isFolder()) {
    int indexCount=1;
    if (mediaRenderer.isDLNALocalizationRequired()) {
      indexCount=getDLNALocalesCount();
    }
    for (int c=0; c < indexCount; c++) {
      openTag(sb,"String_Node_Str");
      addAttribute(sb,"String_Node_Str","String_Node_Str");
      String dlnaOrgPnFlags=getDlnaOrgPnFlags(mediaRenderer,c);
      String tempString="String_Node_Str" + getRendererMimeType(mediaRenderer) + "String_Node_Str"+ (dlnaOrgPnFlags != null ? (dlnaOrgPnFlags + "String_Node_Str") : "String_Node_Str")+ getDlnaOrgOpFlags(mediaRenderer);
      wireshark.append(' ').append(tempString);
      addAttribute(sb,"String_Node_Str",tempString);
      if (subsAreValidForStreaming && mediaRenderer.offerSubtitlesByProtocolInfo() && !mediaRenderer.useClosedCaption()) {
        addAttribute(sb,"String_Node_Str",media_subtitle.getType().getExtension().toUpperCase());
        wireshark.append("String_Node_Str").append(media_subtitle.getType().getExtension().toUpperCase());
        addAttribute(sb,"String_Node_Str",getSubsURL(media_subtitle));
        wireshark.append("String_Node_Str").append(getSubsURL(media_subtitle));
      }
      if (getFormat() != null && getFormat().isVideo() && media != null && media.isMediaparsed()) {
        if (player == null) {
          wireshark.append("String_Node_Str").append(media.getSize());
          addAttribute(sb,"String_Node_Str",media.getSize());
        }
 else {
          long transcoded_size=mediaRenderer.getTranscodedSize();
          if (transcoded_size != 0) {
            wireshark.append("String_Node_Str").append(transcoded_size);
            addAttribute(sb,"String_Node_Str",transcoded_size);
          }
        }
        if (media.getDuration() != null) {
          if (getSplitRange().isEndLimitAvailable()) {
            wireshark.append("String_Node_Str").append(convertTimeToString(getSplitRange().getDuration(),DURATION_TIME_FORMAT));
            addAttribute(sb,"String_Node_Str",convertTimeToString(getSplitRange().getDuration(),DURATION_TIME_FORMAT));
          }
 else {
            wireshark.append("String_Node_Str").append(media.getDurationString());
            addAttribute(sb,"String_Node_Str",media.getDurationString());
          }
        }
        if (media.getResolution() != null) {
          if (player != null && mediaRenderer.isKeepAspectRatio()) {
            addAttribute(sb,"String_Node_Str",getResolutionForKeepAR(media.getWidth(),media.getHeight()));
          }
 else {
            addAttribute(sb,"String_Node_Str",media.getResolution());
          }
        }
        addAttribute(sb,"String_Node_Str",media.getRealVideoBitrate());
        if (firstAudioTrack != null) {
          if (firstAudioTrack.getAudioProperties().getNumberOfChannels() > 0) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getAudioProperties().getNumberOfChannels());
          }
          if (firstAudioTrack.getSampleFrequency() != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getSampleFrequency());
          }
        }
      }
 else       if (getFormat() != null && getFormat().isImage()) {
        if (media != null && media.isMediaparsed()) {
          wireshark.append("String_Node_Str").append(media.getSize());
          addAttribute(sb,"String_Node_Str",media.getSize());
          if (media.getResolution() != null) {
            addAttribute(sb,"String_Node_Str",media.getResolution());
          }
        }
 else {
          wireshark.append("String_Node_Str").append(length());
          addAttribute(sb,"String_Node_Str",length());
        }
      }
 else       if (getFormat() != null && getFormat().isAudio()) {
        if (media != null && media.isMediaparsed()) {
          addAttribute(sb,"String_Node_Str",media.getBitrate());
          if (media.getDuration() != null) {
            wireshark.append("String_Node_Str").append(convertTimeToString(media.getDuration(),DURATION_TIME_FORMAT));
            addAttribute(sb,"String_Node_Str",convertTimeToString(media.getDuration(),DURATION_TIME_FORMAT));
          }
          if (firstAudioTrack != null && firstAudioTrack.getSampleFrequency() != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getSampleFrequency());
          }
          if (firstAudioTrack != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getAudioProperties().getNumberOfChannels());
          }
          if (player == null) {
            wireshark.append("String_Node_Str").append(media.getSize());
            addAttribute(sb,"String_Node_Str",media.getSize());
          }
 else {
            if (firstAudioTrack != null) {
              int defaultFrequency=mediaRenderer.isTranscodeAudioTo441() ? 44100 : 48000;
              if (!configurationSpecificToRenderer.isAudioResample()) {
                try {
                  defaultFrequency=firstAudioTrack.getSampleRate();
                }
 catch (                Exception e) {
                  LOGGER.debug("String_Node_Str",e);
                }
              }
              int na=firstAudioTrack.getAudioProperties().getNumberOfChannels();
              if (na > 2) {
                na=2;
              }
              int finalSize=(int)(media.getDurationInSeconds() * defaultFrequency * 2* na);
              LOGGER.trace("String_Node_Str" + getSystemName() + "String_Node_Str"+ finalSize);
              wireshark.append("String_Node_Str").append(finalSize);
              addAttribute(sb,"String_Node_Str",finalSize);
            }
          }
        }
 else {
          wireshark.append("String_Node_Str").append(length());
          addAttribute(sb,"String_Node_Str",length());
        }
      }
 else {
        wireshark.append("String_Node_Str").append(DLNAMediaInfo.TRANS_SIZE).append("String_Node_Str");
        addAttribute(sb,"String_Node_Str",DLNAMediaInfo.TRANS_SIZE);
        addAttribute(sb,"String_Node_Str","String_Node_Str");
        addAttribute(sb,"String_Node_Str","String_Node_Str");
      }
      endTag(sb);
      String transcodedExtension="String_Node_Str";
      if (player != null && media != null) {
        if (media.isVideo()) {
          if (mediaRenderer.isTranscodeToMPEGTS()) {
            transcodedExtension="String_Node_Str";
          }
 else           if (mediaRenderer.isTranscodeToWMV() && !xbox360) {
            transcodedExtension="String_Node_Str";
          }
 else {
            transcodedExtension="String_Node_Str";
          }
        }
 else         if (media.isAudio()) {
          if (mediaRenderer.isTranscodeToMP3()) {
            transcodedExtension="String_Node_Str";
          }
 else           if (mediaRenderer.isTranscodeToWAV()) {
            transcodedExtension="String_Node_Str";
          }
 else {
            transcodedExtension="String_Node_Str";
          }
        }
      }
      wireshark.append(' ').append(getFileURL()).append(transcodedExtension);
      sb.append(getFileURL()).append(transcodedExtension);
      LOGGER.trace("String_Node_Str" + wireshark.toString());
      wireshark.setLength(0);
      closeTag(sb,"String_Node_Str");
    }
  }
  if (subsAreValidForStreaming) {
    String subsURL=getSubsURL(media_subtitle);
    if (mediaRenderer.useClosedCaption()) {
      openTag(sb,"String_Node_Str");
      addAttribute(sb,"String_Node_Str","String_Node_Str");
      endTag(sb);
      sb.append(subsURL);
      closeTag(sb,"String_Node_Str");
      LOGGER.trace("String_Node_Str" + subsURL);
    }
 else     if (mediaRenderer.offerSubtitlesAsResource()) {
      openTag(sb,"String_Node_Str");
      String subtitlesFormat=media_subtitle.getType().getExtension();
      if (StringUtils.isBlank(subtitlesFormat)) {
        subtitlesFormat="String_Node_Str";
      }
      addAttribute(sb,"String_Node_Str","String_Node_Str" + subtitlesFormat + "String_Node_Str");
      endTag(sb);
      sb.append(subsURL);
      closeTag(sb,"String_Node_Str");
      LOGGER.trace("String_Node_Str" + subtitlesFormat + "String_Node_Str"+ subsURL);
    }
  }
  if (!(isFolder() && !mediaRenderer.isSendFolderThumbnails())) {
    appendThumbnail(mediaRenderer,sb,"String_Node_Str");
    appendThumbnail(mediaRenderer,sb,"String_Node_Str");
  }
  if (getLastModified() > 0 && mediaRenderer.isSendDateMetadata()) {
    addXMLTagAndAttribute(sb,"String_Node_Str",SDF_DATE.format(new Date(getLastModified())));
  }
  String uclass;
  if (first != null && media != null && !media.isSecondaryFormatValid()) {
    uclass="String_Node_Str";
  }
 else {
    if (isFolder()) {
      uclass="String_Node_Str";
      if (xbox360 && getFakeParentId() != null) {
switch (getFakeParentId()) {
case "String_Node_Str":
          uclass="String_Node_Str";
        break;
case "String_Node_Str":
      uclass="String_Node_Str";
    break;
case "String_Node_Str":
  uclass="String_Node_Str";
break;
case "String_Node_Str":
uclass="String_Node_Str";
break;
}
}
}
 else if (getFormat() != null && getFormat().isVideo()) {
uclass="String_Node_Str";
}
 else if (getFormat() != null && getFormat().isImage()) {
uclass="String_Node_Str";
}
 else if (getFormat() != null && getFormat().isAudio()) {
uclass="String_Node_Str";
}
 else {
uclass="String_Node_Str";
}
}
addXMLTagAndAttribute(sb,"String_Node_Str",uclass);
if (isFolder()) {
closeTag(sb,"String_Node_Str");
}
 else {
closeTag(sb,"String_Node_Str");
}
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Returns an XML (DIDL) representation of the DLNA node. It gives a complete representation of the item, with as many tags as available. Recommendations as per UPNP specification are followed where possible.
 * @param mediaRenderer Media Renderer for which to represent this information. Useful for some hacks.
 * @return String representing the item. An example would start like this:{@code <container id="0$1" childCount="1" parentID="0" restricted="true">}
 */
public final String getDidlString(RendererConfiguration mediaRenderer){
  PmsConfiguration configurationSpecificToRenderer=PMS.getConfiguration(mediaRenderer);
  StringBuilder sb=new StringBuilder();
  boolean subsAreValidForStreaming=false;
  boolean xbox360=mediaRenderer.isXbox360();
  if (!isFolder()) {
    if (format != null && format.isVideo()) {
      if (!configurationSpecificToRenderer.isDisableSubtitles() && (player != null && mediaRenderer.streamSubsForTranscodedVideo() || player == null) && media_subtitle != null && media_subtitle.isStreamable()) {
        subsAreValidForStreaming=true;
        LOGGER.trace("String_Node_Str" + media_subtitle.getExternalFile().getName());
      }
 else {
        LOGGER.trace("String_Node_Str" + getName());
      }
    }
    openTag(sb,"String_Node_Str");
  }
 else {
    openTag(sb,"String_Node_Str");
  }
  String id=getResourceId();
  if (xbox360) {
    id+="String_Node_Str";
  }
  addAttribute(sb,"String_Node_Str",id);
  if (isFolder()) {
    if (!isDiscovered() && childrenNumber() == 0) {
      addAttribute(sb,"String_Node_Str",1);
    }
 else {
      addAttribute(sb,"String_Node_Str",childrenNumber());
    }
  }
  id=getParentId();
  if (xbox360 && getFakeParentId() == null) {
    id+="String_Node_Str";
  }
  addAttribute(sb,"String_Node_Str",id);
  addAttribute(sb,"String_Node_Str","String_Node_Str");
  endTag(sb);
  StringBuilder wireshark=new StringBuilder();
  final DLNAMediaAudio firstAudioTrack=media != null ? media.getFirstAudioTrack() : null;
  String title;
  if (firstAudioTrack != null && media.isAudio() && StringUtils.isNotBlank(firstAudioTrack.getSongname())) {
    title=firstAudioTrack.getSongname();
  }
 else {
    title=(isFolder() || subsAreValidForStreaming) ? getDisplayName(null,false) : mediaRenderer.getUseSameExtension(getDisplayName(mediaRenderer,false));
  }
  title=resumeStr(title);
  addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(mediaRenderer.getDcTitle(title,nameSuffix,this)));
  wireshark.append("String_Node_Str").append(title).append("String_Node_Str");
  if (firstAudioTrack != null) {
    if (StringUtils.isNotBlank(firstAudioTrack.getAlbum())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getAlbum()));
    }
    if (StringUtils.isNotBlank(firstAudioTrack.getArtist())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getArtist()));
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getArtist()));
    }
    if (StringUtils.isNotBlank(firstAudioTrack.getGenre())) {
      addXMLTagAndAttribute(sb,"String_Node_Str",encodeXML(firstAudioTrack.getGenre()));
    }
    if (firstAudioTrack.getTrack() > 0) {
      addXMLTagAndAttribute(sb,"String_Node_Str","String_Node_Str" + firstAudioTrack.getTrack());
    }
  }
  if (!isFolder()) {
    int indexCount=1;
    if (mediaRenderer.isDLNALocalizationRequired()) {
      indexCount=getDLNALocalesCount();
    }
    for (int c=0; c < indexCount; c++) {
      openTag(sb,"String_Node_Str");
      addAttribute(sb,"String_Node_Str","String_Node_Str");
      String dlnaOrgPnFlags=getDlnaOrgPnFlags(mediaRenderer,c);
      String tempString="String_Node_Str" + getRendererMimeType(mediaRenderer) + "String_Node_Str"+ (dlnaOrgPnFlags != null ? (dlnaOrgPnFlags + "String_Node_Str") : "String_Node_Str")+ getDlnaOrgOpFlags(mediaRenderer);
      wireshark.append(' ').append(tempString);
      addAttribute(sb,"String_Node_Str",tempString);
      if (subsAreValidForStreaming && mediaRenderer.offerSubtitlesByProtocolInfo() && !mediaRenderer.useClosedCaption()) {
        addAttribute(sb,"String_Node_Str",media_subtitle.getType().getExtension().toUpperCase());
        wireshark.append("String_Node_Str").append(media_subtitle.getType().getExtension().toUpperCase());
        addAttribute(sb,"String_Node_Str",getSubsURL(media_subtitle));
        wireshark.append("String_Node_Str").append(getSubsURL(media_subtitle));
      }
      if (getFormat() != null && getFormat().isVideo() && media != null && media.isMediaparsed()) {
        if (player == null) {
          wireshark.append("String_Node_Str").append(media.getSize());
          addAttribute(sb,"String_Node_Str",media.getSize());
        }
 else {
          long transcoded_size=mediaRenderer.getTranscodedSize();
          if (transcoded_size != 0) {
            wireshark.append("String_Node_Str").append(transcoded_size);
            addAttribute(sb,"String_Node_Str",transcoded_size);
          }
        }
        if (media.getDuration() != null) {
          if (getSplitRange().isEndLimitAvailable()) {
            wireshark.append("String_Node_Str").append(convertTimeToString(getSplitRange().getDuration(),DURATION_TIME_FORMAT));
            addAttribute(sb,"String_Node_Str",convertTimeToString(getSplitRange().getDuration(),DURATION_TIME_FORMAT));
          }
 else {
            wireshark.append("String_Node_Str").append(media.getDurationString());
            addAttribute(sb,"String_Node_Str",media.getDurationString());
          }
        }
        if (media.getResolution() != null) {
          if (player != null && mediaRenderer.isKeepAspectRatio()) {
            addAttribute(sb,"String_Node_Str",getResolutionForKeepAR(media.getWidth(),media.getHeight()));
          }
 else {
            addAttribute(sb,"String_Node_Str",media.getResolution());
          }
        }
        addAttribute(sb,"String_Node_Str",media.getRealVideoBitrate());
        if (firstAudioTrack != null) {
          if (firstAudioTrack.getAudioProperties().getNumberOfChannels() > 0) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getAudioProperties().getNumberOfChannels());
          }
          if (firstAudioTrack.getSampleFrequency() != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getSampleFrequency());
          }
        }
      }
 else       if (getFormat() != null && getFormat().isImage()) {
        if (media != null && media.isMediaparsed()) {
          wireshark.append("String_Node_Str").append(media.getSize());
          addAttribute(sb,"String_Node_Str",media.getSize());
          if (media.getResolution() != null) {
            addAttribute(sb,"String_Node_Str",media.getResolution());
          }
        }
 else {
          wireshark.append("String_Node_Str").append(length());
          addAttribute(sb,"String_Node_Str",length());
        }
      }
 else       if (getFormat() != null && getFormat().isAudio()) {
        if (media != null && media.isMediaparsed()) {
          addAttribute(sb,"String_Node_Str",media.getBitrate());
          if (media.getDuration() != null) {
            wireshark.append("String_Node_Str").append(convertTimeToString(media.getDuration(),DURATION_TIME_FORMAT));
            addAttribute(sb,"String_Node_Str",convertTimeToString(media.getDuration(),DURATION_TIME_FORMAT));
          }
          if (firstAudioTrack != null && firstAudioTrack.getSampleFrequency() != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getSampleFrequency());
          }
          if (firstAudioTrack != null) {
            addAttribute(sb,"String_Node_Str",firstAudioTrack.getAudioProperties().getNumberOfChannels());
          }
          if (player == null) {
            wireshark.append("String_Node_Str").append(media.getSize());
            addAttribute(sb,"String_Node_Str",media.getSize());
          }
 else {
            if (firstAudioTrack != null) {
              int defaultFrequency=mediaRenderer.isTranscodeAudioTo441() ? 44100 : 48000;
              if (!configurationSpecificToRenderer.isAudioResample()) {
                try {
                  defaultFrequency=firstAudioTrack.getSampleRate();
                }
 catch (                Exception e) {
                  LOGGER.debug("String_Node_Str",e);
                }
              }
              int na=firstAudioTrack.getAudioProperties().getNumberOfChannels();
              if (na > 2) {
                na=2;
              }
              int finalSize=(int)(media.getDurationInSeconds() * defaultFrequency * 2* na);
              LOGGER.trace("String_Node_Str" + getSystemName() + "String_Node_Str"+ finalSize);
              wireshark.append("String_Node_Str").append(finalSize);
              addAttribute(sb,"String_Node_Str",finalSize);
            }
          }
        }
 else {
          wireshark.append("String_Node_Str").append(length());
          addAttribute(sb,"String_Node_Str",length());
        }
      }
 else {
        wireshark.append("String_Node_Str").append(DLNAMediaInfo.TRANS_SIZE).append("String_Node_Str");
        addAttribute(sb,"String_Node_Str",DLNAMediaInfo.TRANS_SIZE);
        addAttribute(sb,"String_Node_Str","String_Node_Str");
        addAttribute(sb,"String_Node_Str","String_Node_Str");
      }
      endTag(sb);
      String transcodedExtension="String_Node_Str";
      if (player != null && media != null) {
        if (media.isVideo()) {
          if (mediaRenderer.isTranscodeToMPEGTS()) {
            transcodedExtension="String_Node_Str";
          }
 else           if (mediaRenderer.isTranscodeToWMV() && !xbox360) {
            transcodedExtension="String_Node_Str";
          }
 else {
            transcodedExtension="String_Node_Str";
          }
        }
 else         if (media.isAudio()) {
          if (mediaRenderer.isTranscodeToMP3()) {
            transcodedExtension="String_Node_Str";
          }
 else           if (mediaRenderer.isTranscodeToWAV()) {
            transcodedExtension="String_Node_Str";
          }
 else {
            transcodedExtension="String_Node_Str";
          }
        }
      }
      wireshark.append(' ').append(getFileURL()).append(transcodedExtension);
      sb.append(getFileURL()).append(transcodedExtension);
      LOGGER.trace("String_Node_Str" + wireshark.toString());
      wireshark.setLength(0);
      closeTag(sb,"String_Node_Str");
    }
  }
  if (subsAreValidForStreaming) {
    String subsURL=getSubsURL(media_subtitle);
    if (mediaRenderer.useClosedCaption()) {
      openTag(sb,"String_Node_Str");
      addAttribute(sb,"String_Node_Str","String_Node_Str");
      endTag(sb);
      sb.append(subsURL);
      closeTag(sb,"String_Node_Str");
      LOGGER.trace("String_Node_Str" + subsURL);
    }
 else     if (mediaRenderer.offerSubtitlesAsResource()) {
      openTag(sb,"String_Node_Str");
      String subtitlesFormat=media_subtitle.getType().getExtension();
      if (StringUtils.isBlank(subtitlesFormat)) {
        subtitlesFormat="String_Node_Str";
      }
      addAttribute(sb,"String_Node_Str","String_Node_Str" + subtitlesFormat + "String_Node_Str");
      endTag(sb);
      sb.append(subsURL);
      closeTag(sb,"String_Node_Str");
      LOGGER.trace("String_Node_Str" + subtitlesFormat + "String_Node_Str"+ subsURL);
    }
  }
  if (!(isFolder() && !mediaRenderer.isSendFolderThumbnails())) {
    appendThumbnail(mediaRenderer,sb,"String_Node_Str");
    appendThumbnail(mediaRenderer,sb,"String_Node_Str");
  }
  if (getLastModified() > 0 && mediaRenderer.isSendDateMetadata()) {
    addXMLTagAndAttribute(sb,"String_Node_Str",SDF_DATE.format(new Date(getLastModified())));
  }
  String uclass;
  if (first != null && media != null && !media.isSecondaryFormatValid()) {
    uclass="String_Node_Str";
  }
 else {
    if (isFolder()) {
      uclass="String_Node_Str";
      if (xbox360 && getFakeParentId() != null) {
switch (getFakeParentId()) {
case "String_Node_Str":
          uclass="String_Node_Str";
        break;
case "String_Node_Str":
      uclass="String_Node_Str";
    break;
case "String_Node_Str":
  uclass="String_Node_Str";
break;
case "String_Node_Str":
uclass="String_Node_Str";
break;
}
}
}
 else if (getFormat() != null && getFormat().isVideo()) {
uclass="String_Node_Str";
}
 else if (getFormat() != null && getFormat().isImage()) {
uclass="String_Node_Str";
}
 else if (getFormat() != null && getFormat().isAudio()) {
uclass="String_Node_Str";
}
 else {
uclass="String_Node_Str";
}
}
addXMLTagAndAttribute(sb,"String_Node_Str",uclass);
if (isFolder()) {
closeTag(sb,"String_Node_Str");
}
 else {
closeTag(sb,"String_Node_Str");
}
return sb.toString();
}