Coverage Report - org.codehaus.plexus.compiler.j2objc.DefaultJ2ObjCCompilerParser
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultJ2ObjCCompilerParser
0%
0/20
0%
0/8
6
 
 1  
 package org.codehaus.plexus.compiler.j2objc;
 2  
 
 3  
 import org.codehaus.plexus.compiler.CompilerMessage;
 4  
 import org.codehaus.plexus.compiler.CompilerMessage.Kind;
 5  
 
 6  
 /**
 7  
  * Handle the output of J2ObjC
 8  
  * 
 9  
  * @author lmaitre
 10  
  */
 11  0
 public class DefaultJ2ObjCCompilerParser {
 12  
 
 13  0
         private static String ERROR_PREFIX = "error: ";
 14  
 
 15  0
         private static String CONVERT_PREFIX = "translating ";
 16  
 
 17  0
         private static String TRANSLATION_PREFIX = "Translated ";
 18  
 
 19  
         /**
 20  
          * Parse a line of log, reading the error and translating lines.
 21  
          * 
 22  
          * @param line
 23  
          * @return The compiler message for this line or null if there is no need of
 24  
          *         a message.
 25  
          */
 26  
         public static CompilerMessage parseLine(String line) {
 27  0
                 String file = null;
 28  0
                 boolean error = false;
 29  0
                 int startline = -1;
 30  0
                 int startcolumn = -1;
 31  0
                 int endline = -1;
 32  0
                 int endcolumn = -1;
 33  
                 String message;
 34  
 
 35  0
                 if (line.startsWith(ERROR_PREFIX)) {
 36  0
                         message = line.substring(ERROR_PREFIX.length());
 37  0
                         error = true;
 38  0
                 } else if (line.startsWith(CONVERT_PREFIX)) {
 39  0
                         message = line;
 40  0
                 } else if (line.startsWith(TRANSLATION_PREFIX)) {
 41  0
                         message = line;
 42  
                 } else {
 43  0
                         System.err.println("Unknown output: " + line);
 44  
 
 45  0
                         return null;
 46  
                 }
 47  
 
 48  0
                 return new CompilerMessage(file, error ? Kind.ERROR : Kind.NOTE,
 49  
                                 startline, startcolumn, endline, endcolumn, message);
 50  
 
 51  
         }
 52  
 
 53  
 }