Example usage for javax.servlet ServletException getMessage

List of usage examples for javax.servlet ServletException getMessage

Introduction

In this page you can find the example usage for javax.servlet ServletException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.pentaho.platform.web.servlet.AnalysisViewService.java

private void newAnalysisView(final HttpServletRequest request, final HttpServletResponse response)
        throws IOException {

    PentahoSystem.systemEntryPoint();/*from   w w  w  .  ja v a 2 s . co  m*/
    try {
        List<MondrianCatalog> catalogs = mondrianCatalogService.listCatalogs(getPentahoSession(request), true);
        request.setAttribute("catalog", catalogs); //$NON-NLS-1$
        try {
            RequestDispatcher dispatcher = request.getRequestDispatcher("NewAnalysisView"); //$NON-NLS-1$
            if (dispatcher != null) {
                dispatcher.forward(request, response);
            }
        } catch (ServletException e) {
            WebServiceUtil.writeString(response.getOutputStream(), WebServiceUtil.getErrorXml(e.getMessage()),
                    false);
        }
    } finally {
        PentahoSystem.systemExitPoint();
    }
}

From source file:io.adeptj.runtime.server.Server.java

/**
 * Bootstrap Undertow Server and OSGi Framework.
 *//*from w ww.  ja v a  2  s . c  om*/
@Override
public void start() {
    this.cfgReference = new WeakReference<>(Configs.of().undertow());
    Config httpConf = Objects.requireNonNull(this.cfgReference.get()).getConfig(KEY_HTTP);
    int httpPort = this.handlePortAvailability(httpConf);
    LOGGER.info("Starting AdeptJ Runtime @port: [{}]", httpPort);
    this.printBanner();
    this.deploymentManager = Servlets.defaultContainer().addDeployment(this.deploymentInfo());
    this.deploymentManager.deploy();
    try {
        this.rootHandler = this.rootHandler(this.deploymentManager.start());
        this.undertow = this
                .enableAJP(this.enableHttp2(ServerOptions.build(this.workerOptions(Undertow.builder()),
                        Objects.requireNonNull(this.cfgReference.get()))))
                .addHttpListener(httpPort, httpConf.getString(KEY_HOST)).setHandler(this.rootHandler).build();
        this.undertow.start();
    } catch (ServletException ex) {
        throw new InitializationException(ex.getMessage(), ex);
    }
    if (!Environment.isServerConfFileExists()) {
        this.createServerConfFile();
    }
}

From source file:org.openbravo.client.kernel.KernelUtils.java

/**
 * Returns the parent tab of a BaseOBObject which belongs to a given tab
 * /*from  www.ja va 2  s  .  c  om*/
 * @param tab
 *          The tab the object belongs to
 * @return The parent tab of the given tab, <code>null</code> in case the tab is root
 */
public Tab getParentTab(Tab tab) {
    if (tab.getTabLevel() == 0L) {
        // root level, there is no parent
        return null;
    }

    ConnectionProvider connection = new DalConnectionProvider(false);
    Tab targetTab = null;
    String tabId = null;
    try {
        tabId = KernelUtilsData.getParentTab(connection, tab.getWindow().getId(), tab.getTabLevel().toString(),
                tab.getSequenceNumber().toString());
        if (tabId != null) {
            targetTab = OBDal.getInstance().get(Tab.class, tabId);
        }
    } catch (ServletException e) {
        log.error(e.getMessage(), e);
    }
    return targetTab;
}

From source file:org.openbravo.client.kernel.KernelUtils.java

/**
 * Returns the list of subtabs of a given tab
 * //from ww w .  java2  s. co  m
 * @param tab
 *          The tab whose subtabs are to be retrieved
 * @param onlyFirstLevel
 *          Boolean used to determine whether all the descendent tabs should be returned or only
 *          the next level ones
 * @return The list of subtabs of the given tab, an empty List if the tab has none
 */
public List<Tab> getTabSubtabs(Tab tab, boolean onlyFirstLevel) {
    ConnectionProvider connection = new DalConnectionProvider(false);
    Long seqno = tab.getSequenceNumber();
    Long tabLevel = tab.getTabLevel();
    String windowId = tab.getWindow().getId();
    KernelUtilsData[] tabIds = null;
    try {
        if (onlyFirstLevel) {
            tabIds = KernelUtilsData.getFirstLevelSubtabs(connection, windowId, seqno.toString(),
                    tabLevel.toString());
        } else {
            tabIds = KernelUtilsData.getAllSubtabs(connection, windowId, seqno.toString(), tabLevel.toString());
        }
    } catch (ServletException e) {
        log.error(e.getMessage(), e);
    }
    List<Tab> subTabList = new ArrayList<Tab>();
    for (int i = 0; i < tabIds.length; i++) {
        String tabId = tabIds[i].adTabId;
        Tab subTab = OBDal.getInstance().get(Tab.class, tabId);
        subTabList.add(subTab);
    }
    return subTabList;
}

From source file:io.hops.hopsworks.api.user.AuthService.java

private void logoutAndInvalidateSession(HttpServletRequest req) throws UserException {
    Users user = userFacade.findByEmail(req.getRemoteUser());
    try {/* ww  w.  j a v a 2  s.co m*/
        req.getSession().invalidate();
        req.logout();
        if (user != null) {
            authController.registerLogout(user, req);
            //remove zeppelin ticket for user
            TicketContainer.instance.invalidate(user.getEmail());
        }
    } catch (ServletException e) {
        accountAuditFacade.registerLoginInfo(user, UserAuditActions.LOGOUT.name(),
                UserAuditActions.FAILED.name(), req);
        throw new UserException(RESTCodes.UserErrorCode.LOGOUT_FAILURE, Level.SEVERE, null, e.getMessage(), e);
    }
}

From source file:org.openbravo.erpCommon.ad_actionButton.ProcessGoods.java

private void processReceipt(HttpServletResponse response, VariablesSecureApp vars, String strdocaction,
        String strVoidMinoutDate, String strVoidMinoutAcctDate) throws ServletException, IOException {
    final String strWindowId = vars.getGlobalVariable("inpwindowId", "ProcessGoods|Window_ID",
            IsIDFilter.instance);//from www .j  a  v  a 2s  . c o m
    final String strTabId = vars.getGlobalVariable("inpTabId", "ProcessGoods|Tab_ID", IsIDFilter.instance);
    final String strM_Inout_ID = vars.getGlobalVariable("inpKey", strWindowId + "|M_Inout_ID", "");

    OBError myMessage = null;
    try {
        ShipmentInOut goods = (ShipmentInOut) OBDal.getInstance().getProxy(ShipmentInOut.ENTITY_NAME,
                strM_Inout_ID);
        goods.setDocumentAction(strdocaction);
        OBDal.getInstance().save(goods);
        OBDal.getInstance().flush();

        Process process = null;
        try {
            OBContext.setAdminMode(true);
            process = (Process) OBDal.getInstance().getProxy(Process.ENTITY_NAME, M_Inout_Post_ID);
        } finally {
            OBContext.restorePreviousMode();
        }

        Map<String, String> parameters = null;
        if (!strVoidMinoutDate.isEmpty() && !strVoidMinoutAcctDate.isEmpty()) {
            Date voidDate = null;
            Date voidAcctDate = null;
            try {
                voidDate = OBDateUtils.getDate(strVoidMinoutDate);
                voidAcctDate = OBDateUtils.getDate(strVoidMinoutAcctDate);
            } catch (ParseException pe) {
                voidDate = new Date();
                voidAcctDate = new Date();
                log4j.error("Not possible to parse the following date: " + strVoidMinoutDate, pe);
                log4j.error("Not possible to parse the following date: " + strVoidMinoutAcctDate, pe);
            }
            parameters = new HashMap<String, String>();
            parameters.put("voidedDocumentDate", OBDateUtils.formatDate(voidDate, "yyyy-MM-dd"));
            parameters.put("voidedDocumentAcctDate", OBDateUtils.formatDate(voidAcctDate, "yyyy-MM-dd"));
        }

        final ProcessInstance pinstance = CallProcess.getInstance().call(process, strM_Inout_ID, parameters);
        OBDal.getInstance().getSession().refresh(goods);
        goods.setProcessGoodsJava(goods.getDocumentAction());
        OBDal.getInstance().save(goods);
        OBDal.getInstance().flush();
        OBDal.getInstance().commitAndClose();

        final PInstanceProcessData[] pinstanceData = PInstanceProcessData.select(this, pinstance.getId());
        myMessage = Utility.getProcessInstanceMessage(this, vars, pinstanceData);
        log4j.debug(myMessage.getMessage());
        vars.setMessage(strTabId, myMessage);

        String strWindowPath = Utility.getTabURL(strTabId, "R", true);
        if (strWindowPath.equals("")) {
            strWindowPath = strDefaultServlet;
        }
        printPageClosePopUp(response, vars, strWindowPath);

    } catch (ServletException ex) {
        myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
        if (!myMessage.isConnectionAvailable()) {
            bdErrorConnection(response);
            return;
        } else {
            vars.setMessage(strTabId, myMessage);
        }
    }
}

From source file:com.xmarts.ringingPayroll.rpf_process.Upload.java

private OBError process(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId,
        String strTab, String strProcessId, String strPath, String strPosted, String strWindowPath,
        String strDocNo) {/* w w w .j  a va  2 s . c  o  m*/
    OBError myMessage = new OBError();
    myMessage.setTitle(Utility.messageBD(this, "Error", vars.getLanguage()));
    System.out.println("entro al metodo" + strKey);
    String g = strKey;
    String r = null;
    for (int x = 2; x < g.length(); x = x + 3) {
        if (x == 2) {
            r = "" + g.charAt(x - 2) + g.charAt(x - 1) + g.charAt(x);
        } else {
            r = r + "/" + g.charAt(x - 2) + g.charAt(x - 1) + g.charAt(x);
        }
        System.out.println(x);
        if (x == 29) {
            r = r + "/" + g.charAt(x + 1) + g.charAt(x + 2) + "/";
        }
    }
    System.out.println("Ruta del id divido " + r);

    String strDireccion = globalParameters.strFTPDirectory + "/" + "06D8871F1C124F4B93722C0742B2604A" + "/" + r;

    System.out.println("Direccion del attachments " + strDireccion);

    try {

        String archivo = UploadData.file(new DalConnectionProvider(), strKey);
        if (archivo.equals("")) {
            myMessage.setMessage("Es necesario adjuntar el archivo de Excel");
            myMessage.setType("Error");
            myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Error",
                    OBContext.getOBContext().getLanguage().getLanguage()));
            return myMessage;
        }
        String archivoDestino = strDireccion + archivo;
        System.out.println("Nombre del archivo " + archivoDestino);

        RPFConcept rpfcon = OBDal.getInstance().get(RPFConcept.class, strKey);

        Client client = rpfcon.getClient();
        String clien = client.getId();
        System.out.println("Client " + clien);

        Organization organiz = rpfcon.getOrganization();
        String org = organiz.getId();
        System.out.println("Organization " + org);

        User user = rpfcon.getCreatedBy();
        String use = user.getId();
        System.out.println("User " + use);

        try {
            Workbook archivoExcel = Workbook.getWorkbook(new File(archivoDestino));
            System.out.println("Nmero de Hojas\t" + archivoExcel.getNumberOfSheets());
            for (int sheetNo = 0; sheetNo < archivoExcel.getNumberOfSheets(); sheetNo++) // Recorre                                                                                                                                                       
            {
                Sheet hoja = archivoExcel.getSheet(sheetNo);
                int numColumnas = hoja.getColumns();
                System.out.println("Columnas " + numColumnas);
                if (numColumnas >= 6) {
                    //System.out.println("El excel tiene mas columnas de las requeridas, favor de validarlo");
                    myMessage.setMessage("El excel tiene mas columnas de las requeridas, favor de validarlo");
                    myMessage.setType("Error");
                    myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Error",
                            OBContext.getOBContext().getLanguage().getLanguage()));
                    return myMessage;
                } else {
                    if (numColumnas <= 4) {
                        //System.out.println("El excel tiene menos columnas de las requeridas, favor de validarlo");
                        myMessage.setMessage(
                                "El excel tiene menos columnas de las requeridas, favor de validarlo");
                        myMessage.setType("Error");
                        myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Error",
                                OBContext.getOBContext().getLanguage().getLanguage()));
                        return myMessage;
                    } else {
                        int numFilas = hoja.getRows();
                        System.out.println("Filas " + numFilas);
                        String data;
                        System.out.println("Nombre de la Hoja\t" + archivoExcel.getSheet(sheetNo).getName());
                        UploadData.eliminar(this, strKey);
                        System.out.println("Borrando lineas antes cargardas");
                        for (int fila = 0; fila < numFilas; fila++) { // Recorre cada 
                            // fila de la  hoja 
                            String num = null;
                            String con = null;
                            String percep = null;
                            String deducci = null;
                            String dias = null;
                            for (int columna = 0; columna < numColumnas; columna++) { // Recorre                                                                                
                                // cada columna de la fila 
                                data = hoja.getCell(columna, fila).getContents();
                                if (columna == 0) {
                                    num = data;
                                } else {
                                    if (columna == 1) {
                                        con = data;
                                    } else {
                                        if (columna == 2) {
                                            if (data.equals("")) {
                                                percep = "0";
                                            } else {
                                                percep = data;
                                            }
                                        } else {
                                            if (columna == 3) {
                                                if (data.equals("")) {
                                                    deducci = "0";
                                                } else {
                                                    deducci = data;
                                                }
                                            } else {
                                                if (columna == 4) {
                                                    dias = data;
                                                }
                                            }
                                        }
                                    }
                                }
                                //System.out.println(columna+" "+fila);
                                //System.out.print(data + " ")1; 

                            }
                            if (num.equals("") && con.equals("")) {
                                System.out.println("entro al break");
                                break;
                            } else {
                                System.out.println(
                                        num + " " + con + " " + percep + " " + deducci + " " + dias + "\n");
                                System.out.println("Guardando datos");
                                UploadData.cargar(this, clien, org, use, use, con, strKey, num, percep, deducci,
                                        dias);
                                System.out.println("Termino de guardar la informacion");
                            }
                        }
                    }
                }
            }
        } catch (Exception ioe) {
            System.out.println("Entro al try exception");
            myMessage.setMessage(ioe.getMessage());
            myMessage.setType("Error");
            myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Error",
                    OBContext.getOBContext().getLanguage().getLanguage()));
            return myMessage;
        }
    } catch (ServletException e) {
        System.out.println("Entro al try Servelet exception");
        myMessage.setMessage(e.getMessage());
        myMessage.setType("Error");
        myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Error",
                OBContext.getOBContext().getLanguage().getLanguage()));
        return myMessage;
    }
    myMessage.setMessage("El excel fue cargado exitosamente.");
    myMessage.setType("Success");
    myMessage.setTitle(Utility.messageBD(new DalConnectionProvider(), "Success",
            OBContext.getOBContext().getLanguage().getLanguage()));

    return myMessage;
}

From source file:org.bonitasoft.console.common.server.login.filter.AuthenticationFilter.java

protected boolean handleTenantPausedException(final HttpServletRequestAccessor requestAccessor,
        final HttpServletResponseAccessor responseAccessor, final ServletException e) throws ServletException {
    final TenantIsPausedRedirectionToMaintenancePageException tenantIsPausedException = (TenantIsPausedRedirectionToMaintenancePageException) e
            .getCause();// w w w. ja  v a  2s.com
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE, "redirection to maintenance page : " + e.getMessage(), e);
    }
    redirectToMaintenance(requestAccessor, responseAccessor, tenantIsPausedException.getTenantId());
    return false;
}

From source file:ch.entwine.weblounge.workbench.WorkbenchService.java

/**
 * Returns the pagelet editor or <code>null</code> if either one of the page,
 * the composer or the is not available.
 * /*from   w w  w  .  j  av  a 2s .co m*/
 * @param site
 *          the site
 * @param pageURI
 *          the page uri
 * @param composerId
 *          the composer id
 * @param pageletIndex
 *          the pagelet index
 * @param language
 *          the environment
 * @param environment
 *          the execution environment
 * @return the pagelet editor
 * @throws IOException
 *           if reading the pagelet fails
 */
public PageletEditor getEditor(Site site, ResourceURI pageURI, String composerId, int pageletIndex,
        String language, Environment environment) throws IOException {
    if (site == null)
        throw new IllegalArgumentException("Site must not be null");
    if (composerId == null)
        throw new IllegalArgumentException("Composer must not be null");
    if (pageletIndex < 0)
        throw new IllegalArgumentException("Pagelet index must be a positive integer");

    Page page = getPage(site, pageURI);
    if (page == null) {
        logger.warn("Client requested pagelet editor for non existing page {}", pageURI);
        return null;
    }

    // Load the composer
    Composer composer = page.getComposer(composerId);
    if (composer == null) {
        logger.warn("Client requested pagelet editor for non existing composer '{}' on page {}", composerId,
                pageURI);
        return null;
    }

    // Get the pagelet
    if (composer.getPagelets().length <= pageletIndex || composer.size() <= pageletIndex) {
        logger.warn("Client requested pagelet editor for non existing pagelet on page {}", pageURI);
        return null;
    }

    Pagelet pagelet = composer.getPagelet(pageletIndex);
    pagelet = new TrimpathPageletWrapper(pagelet);
    PageletEditor pageletEditor = new PageletEditor(pagelet, pageURI, composerId, pageletIndex, environment);

    // Load the contents of the editor url
    URL editorURL = pageletEditor.getEditorURL();
    if (editorURL != null) {
        String rendererContent = null;
        try {
            rendererContent = loadContents(editorURL, site, page, composer, pagelet, environment, language);
            pageletEditor.setEditor(rendererContent);
        } catch (ServletException e) {
            logger.warn("Error processing the pagelet renderer at {}: {}", editorURL, e.getMessage());
        }
    }

    return pageletEditor;
}

From source file:ch.entwine.weblounge.workbench.WorkbenchService.java

/**
 * Returns the pagelet renderer or <code>null</code> if either one of the
 * page, the composer or the is not available.
 * //from  www.  j a v  a  2s. co  m
 * @param site
 *          the site
 * @param pageURI
 *          the page uri
 * @param composerId
 *          the composer id
 * @param pageletIndex
 *          the pagelet index
 * @param language
 *          the language
 * @param environment
 *          the environment
 * @return the pagelet renderer
 * @throws IOException
 *           if reading the pagelet fails
 */
public String getRenderer(Site site, ResourceURI pageURI, String composerId, int pageletIndex, String language,
        Environment environment) throws IOException {

    Page page = getPage(site, pageURI);
    if (page == null) {
        logger.warn("Client requested pagelet renderer for non existing page {}", pageURI);
        return null;
    }

    // Load the composer
    Composer composer = page.getComposer(composerId);
    if (composer == null) {
        logger.warn("Client requested pagelet renderer for non existing composer {} on page {}", composerId,
                pageURI);
        return null;
    }

    // Get the pagelet
    if (composer.getPagelets().length <= pageletIndex || composer.size() <= pageletIndex) {
        logger.warn("Client requested pagelet renderer for non existing pagelet on page {}", pageURI);
        return null;
    }

    Pagelet pagelet = composer.getPagelet(pageletIndex);
    Module module = site.getModule(pagelet.getModule());
    if (module == null) {
        logger.warn("Client requested pagelet renderer for non existing module {}", pagelet.getModule());
        return null;
    }

    PageletRenderer renderer = module.getRenderer(pagelet.getIdentifier());
    if (renderer == null) {
        logger.warn("Client requested pagelet renderer for non existing renderer on pagelet {}",
                pagelet.getIdentifier());
        return null;
    }

    // Load the contents of the renderer url
    renderer.setEnvironment(environment);
    URL rendererURL = renderer.getRenderer();
    String rendererContent = null;
    if (rendererURL != null) {
        try {
            rendererContent = loadContents(rendererURL, site, page, composer, pagelet, environment, language);
        } catch (ServletException e) {
            logger.warn("Error processing the pagelet renderer at {}: {}", rendererURL, e.getMessage());
            throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
        }
    }

    return rendererContent;
}