Package org.apache.sling.scripting.jsp.jasper

Examples of org.apache.sling.scripting.jsp.jasper.JasperException


     *
     * @param errMsg Parse error message
     * @param exception Parse exception
     */
    public void jspError(String errMsg, Exception ex) throws JasperException {
        throw new JasperException(errMsg, ex);
    }
View Full Code Here


                buf.append("\n");
                buf.append(details[i].getErrorMessage());
            }
        }
        //buf.append("\n\nStacktrace:");
        throw new JasperException(
                Localizer.getMessage("jsp.error.unable.compile") + ": " + buf);
    }
View Full Code Here

     * @param exception Compilation exception
     */
    public void javacError(String errorReport, Exception exception)
    throws JasperException {
       
        throw new JasperException(
                Localizer.getMessage("jsp.error.unable.compile"), exception);
    }
View Full Code Here

                        if (annotationProcessor != null) {
                           annotationProcessor.processAnnotations(servlet);
                           annotationProcessor.postConstruct(servlet);
                        }
                    } catch (IllegalAccessException e) {
                        throw new JasperException(e);
                    } catch (InstantiationException e) {
                        throw new JasperException(e);
                    } catch (Exception e) {
                        throw new JasperException(e);
                    }
                   
                    servlet.init(config);

                    if (!firstTime) {
View Full Code Here

            if (reload) {
                tagHandlerClass = ctxt.load();
                reload = false;
            }
        } catch (FileNotFoundException ex) {
            throw new JasperException(ex);
  }

  return tagHandlerClass;
    }
View Full Code Here

            }
        } catch (Exception ex) {
            if (options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw new JasperException(ex);
            }
        }

        try {
           
            /*
             * (3) Service request
             */
            if (theServlet instanceof SingleThreadModel) {
               // sync on the wrapper so that the freshness
               // of the page is determined right before servicing
               synchronized (this) {
                   theServlet.service(request, response);
                }
            } else {
                theServlet.service(request, response);
            }

        } catch (UnavailableException ex) {
            String includeRequestUri = (String)
                request.getAttribute("javax.servlet.include.request_uri");
            if (includeRequestUri != null) {
                // This file was included. Throw an exception as
                // a response.sendError() will be ignored by the
                // servlet engine.
                throw ex;
            } else {
                int unavailableSeconds = ex.getUnavailableSeconds();
                if (unavailableSeconds <= 0) {
                    unavailableSeconds = 60;        // Arbitrary default
                }
                available = System.currentTimeMillis() +
                    (unavailableSeconds * 1000L);
                response.sendError
                    (HttpServletResponse.SC_SERVICE_UNAVAILABLE,
                     ex.getMessage());
            }
        } catch (ServletException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (IOException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (IllegalStateException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (Exception ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw new JasperException(ex);
            }
        }
    }
View Full Code Here

            }

            if (jspFrame == null) {
                // If we couldn't find a frame in the stack trace corresponding
                // to the generated servlet class, we can't really add anything
                return new JasperException(exMessage, realException);
            }
            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) {
                    return new JasperException(exMessage, realException);
                }

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

        } else if (n instanceof Node.NamedAttribute) {
            ci = ((Node.NamedAttribute) n).getChildInfo();
        } else {
            // Cannot access err since this method is static, but at
            // least flag an error.
            throw new JasperException("Unexpected Node Type");
            // err.getString(
            // "jsp.error.internal.unexpected_node_type" ) );
        }

        if (ci.hasUseBean()) {
View Full Code Here

      } else {
    return getValueFromPropertyEditorManager(
                                            t, propertyName, s);
            }
        } catch (Exception ex) {
            throw new JasperException(ex);
        }
    }
View Full Code Here

    }
      }
      if ( method != null ) {
    if (type.isArray()) {
                    if (request == null) {
      throw new JasperException(
                Localizer.getMessage("jsp.error.beans.setproperty.noindexset"));
                    }
        Class t = type.getComponentType();
        String[] values = request.getParameterValues(param);
        //XXX Please check.
        if(values == null) return;
        if(t.equals(String.class)) {
      method.invoke(bean, new Object[] { values });
        } else {
      Object tmpval = null;
      createTypedArray (prop, bean, method, values, t,
            propertyEditorClass);
        }
    } else {
        if(value == null || (param != null && value.equals(""))) return;
        Object oval = convert(prop, value, type, propertyEditorClass);
        if ( oval != null )
      method.invoke(bean, new Object[] { oval });
    }
      }
  } catch (Exception ex) {
      throw new JasperException(ex);
  }
        if (!ignoreMethodNF && (method == null)) {
            if (type == null) {
    throw new JasperException(
                    Localizer.getMessage("jsp.error.beans.noproperty",
           prop,
           bean.getClass().getName()));
            } else {
    throw new JasperException(
              Localizer.getMessage("jsp.error.beans.nomethod.setproperty",
           prop,
           type.getName(),
           bean.getClass().getName()));
            }
View Full Code Here

TOP

Related Classes of org.apache.sling.scripting.jsp.jasper.JasperException

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.