Package org.jahia.exceptions

Examples of org.jahia.exceptions.JahiaException


    public static String getParameterValue( Node paramParent,
                                    String parameterName)
                                    throws JahiaException {

        if (!paramParent.hasChildNodes()) {
            throw new JahiaException("No parameters available on portlet XML tag",
                     "Parent has no children at all",
                     JahiaException.CRITICAL_SEVERITY,
                     JahiaException.CONFIG_ERROR);
        }

        Node curNode = paramParent.getFirstChild();
        while (curNode != null) {

            //JahiaConsole.println("XMLParser.getParameterValue", "Looking for param...["+curNode.getNodeName()+"]");
            // let's go through all the children nodes
            if (curNode.getNodeType() == Node.ELEMENT_NODE) {

                if (curNode.getNodeName().equalsIgnoreCase(PARAMETER_TAG)) {
                    // we have found a parameter tag, let's check further for match of param name
                    NamedNodeMap attr = curNode.getAttributes();
                    Node paramAttrNode = attr.getNamedItem(PARAMETER_TAG_NAME_ATTRIBUTE);
                    if (paramAttrNode != null) {

                        if (paramAttrNode.getNodeValue().equalsIgnoreCase(parameterName)) {
                            // we found the parameter
                            //JahiaConsole.println("XMLParser.getParameterValue", "Found parameter " + parameterName);
                            // we must now extract value of text node below this node.
                            Node textNode = curNode.getFirstChild();
                            if ( textNode == null ){ // check this otherwise nullpointer exception NK
                                return "";
                            } else {
                                if (textNode.getNodeType() == Node.TEXT_NODE) {
                                    return textNode.getNodeValue();
                                } else {
                                    throw new JahiaException(ERROR_READING_FILE_MSG,
                                    "Value of paramater is not in correct format, should only be text",
                                    JahiaException.CRITICAL_SEVERITY,
                                    JahiaException.CONFIG_ERROR);
                                }
                            }
                        }
                    } else {
                        throw new JahiaException(ERROR_READING_FILE_MSG,
                            "No attribute name found on parameter !",
                            JahiaException.CRITICAL_SEVERITY,
                            JahiaException.CONFIG_ERROR);
                    }
                }
View Full Code Here


            logger.debug(
                "  -> ERROR : Could not get the Services Registry instance.");
            return false;
        } catch (JahiaException je) {
            throw new JahiaException(je.getJahiaErrorMsg(),
                "Service Registry Initialization Exception",
                JahiaException.INITIALIZATION_ERROR,
                JahiaException.FATAL_SEVERITY,
                je);
        }
View Full Code Here

                .getApplicationByContext(id);
        if (appBean == null) {
            String errMsg = "Error getting application bean for application [" + id + "]";
            logger.debug (errMsg);

            throw new JahiaException (errMsg, errMsg,
                    JahiaException.ERROR_SEVERITY,
                    JahiaException.APPLICATION_ERROR);
        }

        return getApplicationContext (appBean);
View Full Code Here

            final JCRNodeWrapper wrapper = parentNodeWrapper.addNode(key,
                    Constants.JAHIANT_CATEGORY);
            jcrSessionWrapper.save();
            newCategory = new Category(createCategoryBeanFromNode(wrapper));
        } catch (ItemExistsException e) {
            throw new JahiaException("Category " + key
                    + " already exists", "Category " + key
                    + " already exists", JahiaException.DATA_ERROR,
                    JahiaException.ERROR_SEVERITY);           
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
View Full Code Here

                } else {
                    String msg = "Category "
                            + categoryBean.getKey()
                            + (categories.size() == 0 ? "not found"
                                    : " exists multiple times and could not be deleted");
                    throw new JahiaException(msg, msg,
                            JahiaException.DATA_ERROR,
                            JahiaException.ERROR_SEVERITY);                      
                }
            } else {
                node = jcrSessionWrapper.getNodeByUUID(categoryBean.getId());
View Full Code Here

     * throw an exception if the service hasn't been loaded successfully
     */
    private void checkIsLoaded() throws JahiaException {

        if (!isLoaded) {
            throw new JahiaException("Error accessing a service that was not initialized successfully",
                    "Error accessing a service that was not initialized successfully",
                    JahiaException.SERVICE_ERROR, JahiaException.CRITICAL_SEVERITY);
        }

    }
View Full Code Here

        } catch (IOException e) {

            logger.error ("addFileWatcher:: " + e.getMessage (), e);

            throw new JahiaException ("JahiaFileWatcherBaseService", "failed adding File Watcher",
                    JahiaException.SERVICE_ERROR, JahiaException.WARNING_SEVERITY, e);
        }

    }
View Full Code Here

            }

        } catch (IOException e) {
            logger.error ("startFileWatcher:: " + e.getMessage (), e);

            throw new JahiaException ("JahiaFileWatcherBaseService", "failed starting File Watcher",
                    JahiaException.SERVICE_ERROR, JahiaException.WARNING_SEVERITY, e);
        }
    }
View Full Code Here

        } catch (IOException ioe) {

            logger.error(" fail unzipping " + ioe.getMessage(), ioe);

            throw new JahiaException("JahiaArchiveFileHandler",
                                     "faile processing unzip",
                                     JahiaException.SERVICE_ERROR,
                                     JahiaException.ERROR_SEVERITY, ioe);

        }
View Full Code Here

        } catch (IOException ioe) {

            logger.error(" fail unzipping " + ioe.getMessage(), ioe);

            throw new JahiaException(CLASS_NAME, "faile processing unzip",
                                     JahiaException.SERVICE_ERROR,
                                     JahiaException.ERROR_SEVERITY, ioe);

        }
View Full Code Here

TOP

Related Classes of org.jahia.exceptions.JahiaException

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.