public void endSubreport(String subreport){
  if (subreport.isEmpty()) {
    LOG.error(String.format("Tried to end non-existing report \"%s\"",subreport));
    return;
  }
  String topSubreport=subreports.peek();
  if (topSubreport.equals(subreport)) {
    subreports.pop();
    addLogEntry(new SubreportEndEntry(subreport));
    return;
  }
  LOG.error(String.format("Tried to end non-existing report \"%s\"",subreport));
}

public void endSubreport ( String subreport ) { if ( subreport . isEmpty ( ) ) { LOG . error ( String . format ( "Tried to end non-existing report \"%s\"" , subreport ) ) ; return ; } String topSubreport = subreports . peek ( ) ; if ( topSubreport . equals ( subreport ) ) { subreports . pop ( ) ; addLogEntry ( new SubreportEndEntry ( subreport ) ) ; return ; } LOG . error ( String . format ( "Tried to end non-existing report \"%s\"" , subreport ) ) ; }
closes the subreport . checks if the provided subreport name matches subreport name stored on the stack . if the names match , endsubreport will remove the subreport from stack and close it . otherwise , endsubreport will log an error in the report .
