private CharBuffer filter(char[] array){
  CharBuffer buf=new CharBuffer();
  CharBuffer fun=new CharBuffer();
  CharBuffer file=new CharBuffer();
  int i=0;
  while (i < array.length) {
    fun.clear();
    file.clear();
    int start=i;
    int end;
    for (end=i; end < array.length && array[end] != '\n'; end++) {
    }
    for (; i < end && Character.isWhitespace(array[i]); i++) {
      fun.append(array[i]);
    }
    for (; i < end && !Character.isWhitespace(array[i]); i++) {
      fun.append(array[i]);
    }
    if (!fun.endsWith("at")) {
      for (i=start; i < end; i++) {
        buf.append(array[i]);
      }
      i=end + 1;
      buf.append('\n');
      continue;
    }
    for (; i < end && Character.isWhitespace(array[i]); i++) {
    }
    fun.clear();
    for (; i < end && !Character.isWhitespace(array[i]) && array[i] != '('; i++) {
      fun.append(array[i]);
    }
    if (i < end && array[i] == '(')     i++;
    for (; i < end && !Character.isWhitespace(array[i]) && array[i] != ':' && array[i] != ')'; i++) {
      file.append(array[i]);
    }
    int line=-1;
    if (i < end && array[i] == ':') {
      line=0;
      for (i++; i < end && array[i] >= '0' && array[i] <= '9'; i++) {
        line=10 * line + array[i] - '0';
      }
    }
    for (; i < end && !Character.isWhitespace(array[i]) && array[i] != ':' && array[i] != ')'; i++) {
      file.append(array[i]);
    }
    buf.append("\tat ");
    buf.append(fun);
    buf.append("(");
    String dstFile=file.toString();
    if (dstFile.equals(_dstFilename)) {
      convertError(buf,line);
    }
 else {
      buf.append(file);
      if (line > 0) {
        buf.append(":");
        buf.append(line);
      }
    }
    buf.append(array,i,end - i);
    buf.append('\n');
    i=end + 1;
  }
  return buf;
}

private CharBuffer filter ( char [ ] array ) { CharBuffer buf = new CharBuffer ( ) ; CharBuffer fun = new CharBuffer ( ) ; CharBuffer file = new CharBuffer ( ) ; int i = 0 ; while ( i < array . length ) { fun . clear ( ) ; file . clear ( ) ; int start = i ; int end ; for ( end = i ; end < array . length && array [ end ] != '\n' ; end ++ ) { } for ( ; i < end && Character . isWhitespace ( array [ i ] ) ; i ++ ) { fun . append ( array [ i ] ) ; } for ( ; i < end && ! Character . isWhitespace ( array [ i ] ) ; i ++ ) { fun . append ( array [ i ] ) ; } if ( ! fun . endsWith ( "at" ) ) { for ( i = start ; i < end ; i ++ ) { buf . append ( array [ i ] ) ; } i = end + 1 ; buf . append ( '\n' ) ; continue ; } for ( ; i < end && Character . isWhitespace ( array [ i ] ) ; i ++ ) { } fun . clear ( ) ; for ( ; i < end && ! Character . isWhitespace ( array [ i ] ) && array [ i ] != '(' ; i ++ ) { fun . append ( array [ i ] ) ; } if ( i < end && array [ i ] == '(' ) i ++ ; for ( ; i < end && ! Character . isWhitespace ( array [ i ] ) && array [ i ] != ':' && array [ i ] != ')' ; i ++ ) { file . append ( array [ i ] ) ; } int line = - 1 ; if ( i < end && array [ i ] == ':' ) { line = 0 ; for ( i ++ ; i < end && array [ i ] >= '0' && array [ i ] <= '9' ; i ++ ) { line = 10 * line + array [ i ] - '0' ; } } for ( ; i < end && ! Character . isWhitespace ( array [ i ] ) && array [ i ] != ':' && array [ i ] != ')' ; i ++ ) { file . append ( array [ i ] ) ; } buf . append ( "\tat " ) ; buf . append ( fun ) ; buf . append ( "(" ) ; String dstFile = file . toString ( ) ; if ( dstFile . equals ( _dstFilename ) ) { convertError ( buf , line ) ; } else { buf . append ( file ) ; if ( line > 0 ) { buf . append ( ":" ) ; buf . append ( line ) ; } } buf . append ( array , i , end - i ) ; buf . append ( '\n' ) ; i = end + 1 ; } return buf ; }
parses a java stack trace , converting files and line numbers when possible .
