Package play.exceptions

Examples of play.exceptions.CompilationException


*
*/
public class PlayExceptionUtils {
  public static Exception mapJapidJavaCodeError(Exception ex) {
    if (ex instanceof CompilationException) {
      CompilationException e = (CompilationException) ex;
      if (!e.isSourceAvailable())
        return e;

      // now map java error to japidview source code

      String srcFilePath = e.getSourceFile();
      if (!srcFilePath.startsWith("/app/japidviews/")) {
        return e;
      }
      else if (!srcFilePath.endsWith("java")) {
        return e;
      }

      String viewSourceFilePath = DirUtil.mapJavaToSrc(srcFilePath);
      // File file = new File(viewSourceFilePath);
      VirtualFile vf = VirtualFile.fromRelativePath(viewSourceFilePath);

      int oriLineNumber = mapJavaErrorLineToSrcLine(e.getSourceVirtualFile().contentAsString(), e.getLineNumber());
      e = new CompilationException(vf, "\"" + e.getMessage() + "\"", oriLineNumber, 0, 0);
      return e;
    }
    return ex;
  }
View Full Code Here


      if (tempName.startsWith(defaultTemplateRoot)) {
      } else {
        tempName = defaultTemplateRoot + File.separator + tempName;
      }
      VirtualFile vf = VirtualFile.fromRelativePath(tempName);
      CompilationException ce = new CompilationException(vf, "\"" + e.getMessage() + "\"", e.getLineNumber(), 0,
          0);
      throw ce;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here

      jpt.name = e.getTemplateName();
      jpt.source = e.getTemplateSrc();
      // throw new TemplateExecutionException(jpt, e.getLineNumber(),
      // e.getMessage(), e);
      VirtualFile vf = VirtualFile.fromRelativePath("/app/" + e.getTemplateName());
      throw new CompilationException(vf, "\"" + e.getMessage() + "\"", e.getLineNumber(), 0, 0);
    } catch (RuntimeException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
      throw e;
    }
View Full Code Here

                        String message = problem.getMessage();
                        if (problem.getID() == IProblem.CannotImportPackage) {
                            // Non sense !
                            message = problem.getArguments()[0] + " cannot be resolved";
                        }
                        throw new CompilationException(Play.classes.getApplicationClass(className).javaFile, message, problem.getSourceLineNumber(), problem.getSourceStart(), problem.getSourceEnd());
                    }
                }
                // Something has been compiled
                ClassFile[] clazzFiles = result.getClassFiles();
                for (int i = 0; i < clazzFiles.length; i++) {
View Full Code Here

                        String message = problem.getMessage();
                        if (problem.getID() == IProblem.CannotImportPackage) {
                            // Non sense !
                            message = problem.getArguments()[0] + " cannot be resolved";
                        }
                        throw new CompilationException(Play.classes.getApplicationClass(className).javaFile, message, problem.getSourceLineNumber(), problem.getSourceStart(), problem.getSourceEnd());
                    }
                }
                // Something has been compiled
                ClassFile[] clazzFiles = result.getClassFiles();
                for (int i = 0; i < clazzFiles.length; i++) {
View Full Code Here

                        String message = problem.getMessage();
                        if (problem.getID() == IProblem.CannotImportPackage) {
                            // Non sense !
                            message = problem.getArguments()[0] + " cannot be resolved";
                        }
                        throw new CompilationException(Play.classes.getApplicationClass(className).javaFile, message, problem.getSourceLineNumber(), problem.getSourceStart(), problem.getSourceEnd());
                    }
                }
                // Something has been compiled
                ClassFile[] clazzFiles = result.getClassFiles();
                for (int i = 0; i < clazzFiles.length; i++) {
View Full Code Here

TOP

Related Classes of play.exceptions.CompilationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.