Package org.apache.sling.api

Examples of org.apache.sling.api.SlingException


            }
            final Processor processor = new ProcessorWrapper(configuration, this.factoryCache);
            processor.init(context, configuration);
            return processor;
        } catch (final IOException ioe) {
            throw new SlingException("Unable to setup processor: " + ioe.getMessage(), ioe);
        }
    }
View Full Code Here


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

            if (options.getDisplaySourceFragment() && detail.getJspExtract() != null ) {
                return new SlingException(Localizer.getMessage
                        ("jsp.exception", detail.getJspFileName(),
                                "" + jspLineNumber) +
                                "\n\n" + detail.getJspExtract() +
                                "\n", realException);

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

        if (doGenerateName) {
            try {
                path = generateName(request, path);
            } catch (RepositoryException re) {
                throw new SlingException("Failed to generate name", re);
            }
        }

        return path;
    }
View Full Code Here

            response.setPath(r.getPath());
            response.setTitle("Content modified by " + getClass().getSimpleName());
            n.setProperty(getClass().getName(), "Operation was applied to " + n.getPath());
            n.getSession().save();
        } catch(RepositoryException re) {
            throw new SlingException(getClass().getSimpleName() + " failed", re);
        }
    }
View Full Code Here

            response.setPath(r.getPath());
            response.setTitle("Content modified by " + getClass().getSimpleName());
            n.setProperty(getClass().getName(), "Old-style operation was applied to " + n.getPath());
            n.getSession().save();
        } catch(RepositoryException re) {
            throw new SlingException(getClass().getSimpleName() + " failed", re);
        }
    }
View Full Code Here

                rctxt.addWrapper(scriptName, wrapper);

                return wrapper;
            } catch (JasperException je) {
                if (je.getCause() != null) {
                    throw new SlingException(je.getMessage(), je.getCause());
                }
                throw new SlingException("Cannot create JSP", je);
            }
        }
    }
View Full Code Here

     * @param e
     * @throws org.apache.sling.api.SlingException wrapping the given exception
     */
    private SlingException wrapException(Exception e) {
        log.warn("Error in QueryServlet: " + e.toString(), e);
        return new SlingException(e.toString(), e);
    }
View Full Code Here

     * @param e
     * @throws SlingException wrapping the given exception
     */
    private void reportException(Exception e) {
        log.warn("Error in JsonRendererServlet: " + e.toString(), e);
        throw new SlingException(e.toString(), e);
    }
View Full Code Here

            eval(props);

        } catch (ScriptEvaluationException see) {
            throw see;
        } catch (Exception e) {
            throw new SlingException("Cannot get DefaultSlingScript: "
                + e.getMessage(), e);
        }
    }
View Full Code Here

        if (doGenerateName) {
            try {
                path = generateName(request, path);
            } catch (RepositoryException re) {
                throw new SlingException("Failed to generate name", re);
            }
        }

        return path;
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.api.SlingException

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.