Exemple #1
0
 public static String formatResourceDiagnostics(
     List<Resource.Diagnostic> diagnostics, String messagePrefix, String newLine) {
   if (diagnostics.size() <= 0) {
     return null;
   }
   StringBuilder s = new StringBuilder();
   s.append(messagePrefix);
   for (Resource.Diagnostic diagnostic : diagnostics) {
     s.append(newLine);
     String location = diagnostic.getLocation();
     if (location != null) {
       s.append(location);
       s.append(":");
     }
     s.append(diagnostic.getLine());
     try {
       int column = diagnostic.getColumn();
       s.append(":");
       s.append(column);
     } catch (Exception e) {
     } // UnsupportedOperationException is normal
     s.append(": ");
     s.append(diagnostic.getMessage());
   }
   return s.toString();
 }
 private void logErrors(Resource csResource) {
   for (Resource.Diagnostic diagnostic : csResource.getErrors()) {
     log(
         diagnostic.getMessage()
             + " (line "
             + diagnostic.getLine()
             + ", column "
             + diagnostic.getColumn()
             + ") in "
             + csResource.getURI().toString(),
         Project.MSG_ERR);
   }
 }