Examples of JavacErrorDetail


Examples of org.apache.jasper.compiler.JavacErrorDetail

                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            }
            else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                        jspFrame.getMethodName(),
                        this.ctxt.getCompiler().getPageNodes(),
                        null,
                        javaLineNumber,
                        ctxt);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                if (options.getDisplaySourceFragment()) {
                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(),
                                    "" + jspLineNumber) +
                                    "\n\n" + detail.getJspExtract() +
                                    "\n\nStacktrace:", ex);
                   
                } else {
                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(),
                                    "" + jspLineNumber), ex);
                }
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            }

            int javaLineNumber = jspFrame.getLineNumber();
            JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                    jspFrame.getMethodName(),
                    this.ctxt.getCompiler().getPageNodes(),
                    null,
                    javaLineNumber,
                    ctxt);

            // If the line number is less than one we couldn't find out
            // where in the JSP things went wrong
            int jspLineNumber = detail.getJspBeginLineNumber();
            if (jspLineNumber < 1) {
                throw new JasperException(ex);
            }

            if (options.getDisplaySourceFragment()) {
                return new JasperException(Localizer.getMessage
                        ("jsp.exception", detail.getJspFileName(),
                                "" + jspLineNumber) + Constants.NEWLINE +
                                Constants.NEWLINE + detail.getJspExtract() +
                                Constants.NEWLINE + Constants.NEWLINE +
                                "Stacktrace:", ex);

            }

            return new JasperException(Localizer.getMessage
                    ("jsp.exception", detail.getJspFileName(),
                            "" + jspLineNumber), ex);
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
                return (JasperException) ex;
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // to the generated servlet class or we don't have a copy of the
                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            } else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                        jspFrame.getMethodName(),
                        this.ctxt.getCompiler().getPageNodes(),
                        null,
                        javaLineNumber,
                        ctxt);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                if (options.getDisplaySourceFragment()) {
                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(),
                                    "" + jspLineNumber) +
                                    "\n\n" + detail.getJspExtract() +
                                    "\n\nStacktrace:", ex);
                   
                } else {
                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(),
                                    "" + jspLineNumber), ex);
                }
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            }

            int javaLineNumber = jspFrame.getLineNumber();
            JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                    jspFrame.getMethodName(),
                    this.ctxt.getCompiler().getPageNodes(),
                    null,
                    javaLineNumber,
                    ctxt);

            // If the line number is less than one we couldn't find out
            // where in the JSP things went wrong
            int jspLineNumber = detail.getJspBeginLineNumber();
            if (jspLineNumber < 1) {
                throw new JasperException(ex);
            }

            if (options.getDisplaySourceFragment()) {
                return new JasperException(Localizer.getMessage
                        ("jsp.exception", detail.getJspFileName(),
                                "" + jspLineNumber) + Constants.NEWLINE +
                                Constants.NEWLINE + detail.getJspExtract() +
                                Constants.NEWLINE + Constants.NEWLINE +
                                "Stacktrace:", ex);
               
            }

            return new JasperException(Localizer.getMessage
                    ("jsp.exception", detail.getJspFileName(),
                            "" + jspLineNumber), ex);
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
                return (JasperException) ex;
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            }

            int javaLineNumber = jspFrame.getLineNumber();
            JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                    jspFrame.getMethodName(),
                    this.ctxt.getCompiler().getPageNodes(),
                    null,
                    javaLineNumber,
                    ctxt);

            // If the line number is less than one we couldn't find out
            // where in the JSP things went wrong
            int jspLineNumber = detail.getJspBeginLineNumber();
            if (jspLineNumber < 1) {
                throw new JasperException(ex);
            }

            if (options.getDisplaySourceFragment()) {
                return new JasperException(Localizer.getMessage
                        ("jsp.exception", detail.getJspFileName(),
                                "" + jspLineNumber) + Constants.NEWLINE +
                                Constants.NEWLINE + detail.getJspExtract() +
                                Constants.NEWLINE + Constants.NEWLINE +
                                "Stacktrace:", ex);
               
            }

            return new JasperException(Localizer.getMessage
                    ("jsp.exception", detail.getJspFileName(),
                            "" + jspLineNumber), ex);
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
                return (JasperException) ex;
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // to the generated servlet class, we can't really add anything
                return new JasperException(ex);
            }
            else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                                                                           jspFrame.getMethodName(),
                                                                           this.ctxt.getCompiler().getPageNodes(),
                                                                           null,
                                                                           javaLineNumber);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                // Read both files in, so we can inspect them
                String[] jspLines = readFile
                    (this.ctxt.getResourceAsStream(this.ctxt.getJspFile()));

                String[] javaLines = readFile
                    (new FileInputStream(this.ctxt.getServletJavaFileName()));

                // If the line contains the opening of a multi-line scriptlet
                // block, then the JSP line number we got back is probably
                // faulty.  Scan forward to match the java line...
                if (jspLines[jspLineNumber-1].lastIndexOf("<%") >
                    jspLines[jspLineNumber-1].lastIndexOf("%>")) {
                    String javaLine = javaLines[javaLineNumber-1].trim();

                    for (int i=jspLineNumber-1; i<jspLines.length; i++) {
                        if (jspLines[i].indexOf(javaLine) != -1) {
                            jspLineNumber = i+1;
                            break;
                        }
                    }
                }

                // copy out a fragment of JSP to display to the user
                StringBuffer buffer = new StringBuffer(1024);
                int startIndex = Math.max(0, jspLineNumber-1-3);
                int endIndex = Math.min(jspLines.length-1, jspLineNumber-1+3);

                for (int i=startIndex;i<=endIndex; ++i) {
                    buffer.append(i+1);
                    buffer.append(": ");
                    buffer.append(jspLines[i]);
                    buffer.append("\n");
                }

                return new JasperException(
                                           "Exception in JSP: " + detail.getJspFileName() + ":" +
                                           jspLineNumber + "\n\n" + buffer + "\n\nStacktrace:", ex);
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            return new JasperException(ex);
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // to the generated servlet class, we can't really add anything
                return new JasperException(ex);
            }
            else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                                                                           jspFrame.getMethodName(),
                                                                           this.ctxt.getCompiler().getPageNodes(),
                                                                           null,
                                                                           javaLineNumber);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                if (options.getDisplaySourceFragment()) {

                    // Read both files in, so we can inspect them
                    String[] jspLines = readFile
                    (this.ctxt.getResourceAsStream(this.ctxt.getJspFile()));

                    String[] javaLines = readFile
                    (new FileInputStream(this.ctxt.getServletJavaFileName()));

                    // If the line contains the opening of a multi-line scriptlet
                    // block, then the JSP line number we got back is probably
                    // faulty.  Scan forward to match the java line...
                    if (jspLines[jspLineNumber-1].lastIndexOf("<%") >
                    jspLines[jspLineNumber-1].lastIndexOf("%>")) {
                        String javaLine = javaLines[javaLineNumber-1].trim();

                        for (int i=jspLineNumber-1; i<jspLines.length; i++) {
                            if (jspLines[i].indexOf(javaLine) != -1) {
                                jspLineNumber = i+1;
                                break;
                            }
                        }
                    }

                    // copy out a fragment of JSP to display to the user
                    StringBuffer buffer = new StringBuffer(1024);
                    int startIndex = Math.max(0, jspLineNumber-1-3);
                    int endIndex = Math.min(jspLines.length-1, jspLineNumber-1+3);

                    for (int i=startIndex;i<=endIndex; ++i) {
                        buffer.append(i+1);
                        buffer.append(": ");
                        buffer.append(jspLines[i]);
                        buffer.append("\n");
                    }

                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(), "" + jspLineNumber) + "\n" + buffer, ex);
                   
                } else {
                    return new JasperException(Localizer.getMessage
                            ("jsp.exception", detail.getJspFileName(), "" + jspLineNumber), ex);
                }
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            return new JasperException(ex);
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // to the generated servlet class, we can't really add anything
                return new JasperException(ex);
            }
            else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                        jspFrame.getMethodName(),
                        this.ctxt.getCompiler().getPageNodes(),
                        null,
                        javaLineNumber,
                        this.ctxt);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                return new JasperException("Exception in JSP: " +
                        detail.getJspFileName() + ":" + jspLineNumber + "\n\n" +
                        detail.getJspExtract() + "\n\nStacktrace:", ex);
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
                return (JasperException) ex;
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // to the generated servlet class or we don't have a copy of the
                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            } else {
                int javaLineNumber = jspFrame.getLineNumber();
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                        jspFrame.getMethodName(),
                        this.ctxt.getCompiler().getPageNodes(),
                        null,
                        javaLineNumber,
                        ctxt);

                // If the line number is less than one we couldn't find out
                // where in the JSP things went wrong
                int jspLineNumber = detail.getJspBeginLineNumber();
                if (jspLineNumber < 1) {
                    throw new JasperException(ex);
                }

                if (options.getDisplaySourceFragment()) {
                    return new JasperException(MESSAGES.jspExceptionWithDetails(detail.getJspFileName(),
                            jspLineNumber, detail.getJspExtract()), ex);
                   
                } else {
                    return new JasperException(MESSAGES.jspException(detail.getJspFileName(), jspLineNumber), ex);
                }
            }
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
View Full Code Here

Examples of org.apache.jasper.compiler.JavacErrorDetail

                // parsed JSP to hand, we can't really add anything
                return new JasperException(ex);
            }

            int javaLineNumber = jspFrame.getLineNumber();
            JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                    jspFrame.getMethodName(),
                    this.ctxt.getCompiler().getPageNodes(),
                    null,
                    javaLineNumber,
                    ctxt);

            // If the line number is less than one we couldn't find out
            // where in the JSP things went wrong
            int jspLineNumber = detail.getJspBeginLineNumber();
            if (jspLineNumber < 1) {
                throw new JasperException(ex);
            }

            if (options.getDisplaySourceFragment()) {
                return new JasperException(Localizer.getMessage
                        ("jsp.exception", detail.getJspFileName(),
                                "" + jspLineNumber) + Constants.NEWLINE +
                                Constants.NEWLINE + detail.getJspExtract() +
                                Constants.NEWLINE + Constants.NEWLINE +
                                "Stacktrace:", ex);
               
            }

            return new JasperException(Localizer.getMessage
                    ("jsp.exception", detail.getJspFileName(),
                            "" + jspLineNumber), ex);
        } catch (Exception je) {
            // If anything goes wrong, just revert to the original behaviour
            if (ex instanceof JasperException) {
                return (JasperException) ex;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.