Beispiel #1
0
 private void displayWrappedLine(
     FailureTableDisplay display, int maxLabelLength, String line, int type) {
   int labelLength = line.length();
   if (labelLength < maxLabelLength) {
     display.addTraceLine(type, line);
   } else {
     display.addTraceLine(type, line.substring(0, maxLabelLength));
     int offset = maxLabelLength;
     while (offset < labelLength) {
       int nextOffset = Math.min(labelLength, offset + maxLabelLength);
       display.addTraceLine(LINE_TYPE_NORMAL, line.substring(offset, nextOffset));
       offset = nextOffset;
     }
   }
 }
Beispiel #2
0
 public void display(FailureTableDisplay display, int maxLabelLength) {
   StringReader stringReader = new StringReader(trace);
   BufferedReader bufferedReader = new BufferedReader(stringReader);
   try {
     String line = readLine(bufferedReader);
     if (line == null) {
       return;
     }
     displayWrappedLine(
         display, maxLabelLength, line, error ? LINE_TYPE_EXCEPTION : LINE_TYPE_NORMAL);
     while ((line = readLine(bufferedReader)) != null) {
       int type = error && isAStackFrame(line) ? LINE_TYPE_STACKFRAME : LINE_TYPE_NORMAL;
       displayWrappedLine(display, maxLabelLength, line, type);
     }
   } catch (IOException e) {
     display.addTraceLine(LINE_TYPE_NORMAL, trace);
   }
 }