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:ch.entwine.weblounge.workbench.WorkbenchService.java

public String getRenderer(Site site, ResourceURI pageURI, String composerId, int pageletIndex, String pageXml,
        String language, Environment environment)
        throws IOException, ParserConfigurationException, SAXException {

    InputStream is = null;//from  w  w  w .j  a va2 s  .  co  m
    Page page = null;
    try {
        PageReader pageReader = new PageReader();
        is = IOUtils.toInputStream(pageXml, "utf-8");
        page = pageReader.read(is, site);
    } finally {
        IOUtils.closeQuietly(is);
    }

    // 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;
}

From source file:com.centurylink.mdw.hub.servlet.SoapServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    if (logger.isMdwDebugEnabled()) {
        logger.mdwDebug("SOAP Listener GET Request:\n" + request.getRequestURI()
                + (request.getQueryString() == null ? "" : ("?" + request.getQueryString())));
    }/*from   ww  w . ja v  a  2  s  .  co m*/

    if (request.getServletPath().endsWith(RPC_SERVICE_PATH) || RPC_SERVICE_PATH.equals(request.getPathInfo())) {
        Asset rpcWsdlAsset = AssetCache.getAsset(Package.MDW + "/MdwRpcWebService.wsdl", Asset.WSDL);
        response.setContentType("text/xml");
        response.getWriter().print(substituteRuntimeWsdl(rpcWsdlAsset.getStringContent()));
    } else if (request.getPathInfo() == null || request.getPathInfo().equalsIgnoreCase("mdw.wsdl")) {
        // forward to general wsdl
        RequestDispatcher requestDispatcher = request.getRequestDispatcher("/mdw.wsdl");
        requestDispatcher.forward(request, response);
    } else if (request.getPathInfo().toUpperCase().endsWith(Asset.WSDL)) {
        String wsdlAsset = request.getPathInfo().substring(1);
        Asset asset = AssetCache.getAsset(wsdlAsset, Asset.WSDL);
        if (asset == null) {
            // try trimming file extension
            wsdlAsset = wsdlAsset.substring(0, wsdlAsset.length() - 5);
            asset = AssetCache.getAsset(wsdlAsset, Asset.WSDL);
        }
        if (asset == null) {
            // try with lowercase extension
            wsdlAsset = wsdlAsset + ".wsdl";
            asset = AssetCache.getAsset(wsdlAsset, Asset.WSDL);
        }
        if (asset == null) {
            String message = "No WSDL resource found: " + request.getPathInfo().substring(1);
            logger.severe(message);
            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            response.getWriter().print(message);
        } else {
            response.setContentType("text/xml");
            response.getWriter().print(substituteRuntimeWsdl(asset.getStringContent()));
        }
    } else {
        ServletException ex = new ServletException(
                "HTTP GET not supported for URL: " + request.getRequestURL());
        logger.severeException(ex.getMessage(), ex);
        throw ex;
    }
}

From source file:org.apache.ranger.security.web.filter.RangerKRBAuthenticationFilter.java

public RangerKRBAuthenticationFilter() {
    try {//from  w  ww.j av a  2  s.c  om
        init(null);
    } catch (ServletException e) {
        LOG.error("Error while initializing Filter : " + e.getMessage());
    }
}

From source file:be.fedict.eid.idp.webapp.ProtocolExitServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    LOG.debug("doGet");
    HttpSession httpSession = request.getSession();
    IdentityProviderProtocolService protocolService;
    try {/*from   w  ww  . java2 s . c  o m*/
        protocolService = ProtocolEntryServlet.getProtocolService(request);
    } catch (ServletException e) {
        httpSession.setAttribute(this.protocolErrorMessageSessionAttributeInitParam, e.getMessage());
        response.sendRedirect(request.getContextPath() + this.protocolErrorPageInitParam);
        return;
    }

    String protocolId = protocolService.getId();
    this.statistics.countAuthentication(protocolId);

    // get optional RP from Http Session
    RPEntity rp = (RPEntity) request.getSession().getAttribute(Constants.RP_SESSION_ATTRIBUTE);

    // get eID data from Http Session
    Identity identity = (Identity) httpSession
            .getAttribute(IdentityDataMessageHandler.IDENTITY_SESSION_ATTRIBUTE);
    Address address = (Address) httpSession.getAttribute(IdentityDataMessageHandler.ADDRESS_SESSION_ATTRIBUTE);
    String authenticatedIdentifier = (String) httpSession
            .getAttribute(AuthenticationDataMessageHandler.AUTHENTICATED_USER_IDENTIFIER_SESSION_ATTRIBUTE);
    X509Certificate authnCertificate = (X509Certificate) httpSession
            .getAttribute(IdentityDataMessageHandler.AUTHN_CERT_SESSION_ATTRIBUTE);
    byte[] photo = (byte[]) httpSession.getAttribute(IdentityDataMessageHandler.PHOTO_SESSION_ATTRIBUTE);

    // get userID + attributes
    String userId;
    if (null != identity) {
        userId = getUniqueId(identity.getNationalNumber(), rp);
    } else {
        userId = getUniqueId(authenticatedIdentifier, rp);
    }
    Map<String, Attribute> attributes = getAttributes(userId, identity, address, authnCertificate, photo);

    // add derived attributes
    for (IdentityProviderAttributeService attributeService : this.attributeServiceManager
            .getAttributeServices()) {

        attributeService.addAttribute(attributes);
    }

    // filter out attributes if RP was authenticated
    if (null != rp) {
        attributes = filterAttributes(rp, attributes);
    }

    // get RP SecretKey and/or PublicKey
    SecretKey secretKey = null;
    PublicKey publicKey = null;
    if (null != rp) {

        try {
            if (null != rp.getAttributeSecretKey()) {
                secretKey = CryptoUtil.getSecretKey(rp.getAttributeSecretAlgorithm(),
                        rp.getAttributeSecretKey());
            }

            if (null != rp.getAttributePublicKey()) {
                publicKey = CryptoUtil.getPublicKey(rp.getAttributePublicKey());
            }
        } catch (Exception e) {
            LOG.error("protocol error: " + e.getMessage(), e);
            httpSession.setAttribute(this.protocolErrorMessageSessionAttributeInitParam, e.getMessage());
            response.sendRedirect(request.getContextPath() + this.protocolErrorPageInitParam);
            return;
        }
    }

    // set encryption info if needed
    if (null != rp) {
        setEncryptionInfo(rp, attributes);
    }

    // set protocol specific URIs if possible
    for (Attribute attribute : attributes.values()) {
        attribute.setUri(getUri(protocolService.getId(), attribute.getUri()));
    }

    String targetURL = null;
    if (null != rp) {
        targetURL = rp.getTargetURL();
    }

    // return protocol specific response
    ReturnResponse returnResponse;
    try {
        returnResponse = protocolService.handleReturnResponse(httpSession, userId, attributes, secretKey,
                publicKey, targetURL, request, response);
    } catch (Exception e) {
        LOG.error("protocol error: " + e.getMessage(), e);
        httpSession.setAttribute(this.protocolErrorMessageSessionAttributeInitParam, e.getMessage());
        response.sendRedirect(request.getContextPath() + this.protocolErrorPageInitParam);
        return;
    }
    if (null != returnResponse) {
        /*
         * This means that the protocol service wants us to construct some
         * Browser POST response towards the Service Provider landing site.
         */
        if (null == returnResponse.getActionUrl()) {

            LOG.error("No action URL specified");
            httpSession.setAttribute(this.protocolErrorMessageSessionAttributeInitParam,
                    "No action URL specified");
            response.sendRedirect(request.getContextPath() + this.protocolErrorPageInitParam);
            return;
        }

        LOG.debug("constructing generic Browser POST response...");
        httpSession.setAttribute(this.responseActionSessionAttributeInitParam, returnResponse.getActionUrl());
        httpSession.setAttribute(this.responseAttributesSessionAttributeInitParam,
                returnResponse.getAttributes());
        response.sendRedirect(request.getContextPath() + this.protocolResponsePostPageInitParam);
        return;
    }

    /*
     * Clean-up the session here as it is no longer used after this point.
     */
    httpSession.invalidate();
}

From source file:org.apache.atlas.web.filters.AtlasAuthenticationFilter.java

public AtlasAuthenticationFilter() {
    try {/*from   w  w w .j a  va2  s.  co m*/
        LOG.info("AtlasAuthenticationFilter initialization started");
        init(null);
    } catch (ServletException e) {
        LOG.error("Error while initializing AtlasAuthenticationFilter : {}", e.getMessage());
    }
}

From source file:org.deegree.enterprise.servlet.OGCServletController.java

private void initServices(ServletContext context) throws ServletException {

    // get list of OGC services
    String serviceList = this.getRequiredInitParameter(SERVICE);

    String[] serviceNames = StringTools.toArray(serviceList, ",", false);

    ServiceLookup lookup = ServiceLookup.getInstance();
    for (int i = 0; i < serviceNames.length; i++) {
        LOG.logInfo(StringTools.concat(100, "---- Initializing ", serviceNames[i].toUpperCase(), " ----"));
        try {/*  w w  w .  j  ava2  s  .c  o m*/
            String className = this.getRequiredInitParameter(serviceNames[i] + HANDLER_CLASS);
            Class<?> handlerClzz = Class.forName(className);

            // initialize each service factory
            String s = this.getRequiredInitParameter(serviceNames[i] + HANDLER_CONF);
            URL serviceConfigurationURL = WebappResourceResolver.resolveFileLocation(s, context, LOG);

            // set configuration
            LOG.logInfo(StringTools.concat(300, "Reading configuration for ", serviceNames[i].toUpperCase(),
                    " from URL: '", serviceConfigurationURL, "'."));

            String factoryClassName = SERVICE_FACTORIES_MAPPINGS.get(handlerClzz);

            Class<?> factory = Class.forName(factoryClassName);
            Method method = factory.getMethod("setConfiguration", new Class[] { URL.class });
            method.invoke(factory, new Object[] { serviceConfigurationURL });

            // The csw-ebrim profile adds an alternative service name, it too is registred with the CSW handler.
            if ("CSW".equals(serviceNames[i].toUpperCase())) {
                lookup.addService(OGCRequestFactory.CSW_SERVICE_NAME_EBRIM.toUpperCase(), handlerClzz);
            }
            // put handler to available service list
            lookup.addService(serviceNames[i].toUpperCase(), handlerClzz);

            LOG.logInfo(StringTools.concat(300, serviceNames[i].toUpperCase(), " successfully initialized."));
        } catch (ServletException e) {
            LOG.logError(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            e.getTargetException().printStackTrace();
            LOG.logError(this.produceMessage(ERR_MSG, new Object[] { serviceNames[i] }), e);
        } catch (Exception e) {
            LOG.logError("Can't initialize OGC service:" + serviceNames[i], e);
        }
    }
}

From source file:org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.java

/**
 * Process a REST message coming in from the Servlet transport.
 * @param mainInMsgContext supertenant's MessageContext
 * @param to the full transport url//from   w w w  . ja v a 2 s .  co  m
 * @param tenant name of the tenant
 * @param tenantConfigCtx tenant ConfigurationContext
 * @param serviceName the part of the to url after the service
 * @param request servlet request
 * @param response servlet response
 * @throws AxisFault if an error occcus
 */
private void doServletRest(MessageContext mainInMsgContext, String to, String tenant,
        ConfigurationContext tenantConfigCtx, String serviceName, HttpServletRequest request,
        HttpServletResponse response) throws AxisFault {
    String serviceWithSlashT = TENANT_DELIMITER + tenant + "/" + serviceName;
    String requestUri = "local://" + tenantConfigCtx.getServicePath() + "/" + serviceName
            + (to.endsWith(serviceWithSlashT) ? ""
                    : "/" + to.substring(to.indexOf(serviceWithSlashT) + serviceWithSlashT.length() + 1));

    MultitenantRESTServlet restServlet = new MultitenantRESTServlet(tenantConfigCtx, requestUri, tenant);

    String httpMethod = (String) mainInMsgContext.getProperty(HTTPConstants.HTTP_METHOD);
    try {
        if (httpMethod.equals(Constants.Configuration.HTTP_METHOD_GET)) {
            restServlet.doGet(request, response);
        } else if (httpMethod.equals(Constants.Configuration.HTTP_METHOD_POST)) {
            restServlet.doPost(request, response);
        } else if (httpMethod.equals(Constants.Configuration.HTTP_METHOD_PUT)) {
            restServlet.doPut(request, response);
        } else if (httpMethod.equals(Constants.Configuration.HTTP_METHOD_DELETE)) {
            restServlet.doDelete(request, response);
        } else {
            // TODO: throw exception: Invalid verb
        }
    } catch (ServletException e) {
        throw new AxisFault(e.getMessage(), e);
    } catch (IOException e) {
        throw new AxisFault(e.getMessage(), e);
    }

    // Send the response
    MessageContext tenantOutMsgContext = restServlet.getOutMessageContext();
    MessageContext tenantOutFaultMsgContext = restServlet.getOutFaultMessageContext();

    // for a fault case both out and fault contexts are not null. so first we need to
    // check the fault context
    if (tenantOutFaultMsgContext != null) {
        // TODO: set the fault exception
        MessageContext mainOutFaultMsgContext = MessageContextBuilder
                .createFaultMessageContext(mainInMsgContext, null);
        mainOutFaultMsgContext.setEnvelope(tenantOutFaultMsgContext.getEnvelope());
        throw new AxisFault("Problem with executing the message", mainOutFaultMsgContext);
    } else if (tenantOutMsgContext != null) {
        MessageContext mainOutMsgContext = MessageContextBuilder.createOutMessageContext(mainInMsgContext);
        mainOutMsgContext.getOperationContext().addMessageContext(mainOutMsgContext);
        mainOutMsgContext.getAxisOperation().getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)
                .setElementQName(tenantOutMsgContext.getAxisOperation()
                        .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getElementQName());
        mainOutMsgContext.getAxisService().addSchema(tenantOutMsgContext.getAxisService().getSchema());
        mainOutMsgContext.setEnvelope(tenantOutMsgContext.getEnvelope());
        mainOutMsgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
                tenantOutMsgContext.getProperty(Constants.Configuration.MESSAGE_TYPE));
        try {
            AxisEngine.send(mainOutMsgContext);
        } finally {
            mainOutMsgContext.getAxisService().getSchema()
                    .removeAll(tenantOutMsgContext.getAxisService().getSchema());
        }
    }
}

From source file:com.extjs.djn.ioc.servlet.BaseDirectJNgineServlet.java

protected void createDirectJNgineRouter(ServletConfig configuration) throws ServletException {
    assert configuration != null;

    Timer subtaskTimer = new Timer();
    GlobalConfiguration globalConfiguration = createGlobalConfiguration(configuration);

    List<ApiConfiguration> apiConfigurations = createApiConfigurationsFromServletConfigurationApi(
            configuration);//from  w  w w.  j av a2s  .c  o m
    subtaskTimer.stop();
    subtaskTimer.logDebugTimeInMilliseconds("Djn initialization: Servlet Configuration Load time");

    subtaskTimer.restart();
    Registry registry = new Registry(globalConfiguration);
    Scanner scanner = new Scanner(registry);
    scanner.scanAndRegisterApiConfigurations(apiConfigurations);
    subtaskTimer.stop();
    subtaskTimer.logDebugTimeInMilliseconds("Djn initialization: Standard Api processing time");

    subtaskTimer.restart();
    performCustomRegistryConfiguration(registry);
    subtaskTimer.stop();
    subtaskTimer.logDebugTimeInMilliseconds("Djn initialization: Custom Registry processing time");

    subtaskTimer.restart();
    try {
        CodeFileGenerator.updateApiFiles(registry);
        subtaskTimer.stop();
        subtaskTimer.logDebugTimeInMilliseconds("Djn initialization: Api Files creation time");
    } catch (IOException ex) {
        ServletException e = new ServletException("Unable to create DirectJNgine API files", ex);
        logger.fatal(e.getMessage(), e);
        throw e;
    }

    subtaskTimer.restart();
    this.uploader = UploadFormPostRequestProcessor.createFileUploader();
    this.processor = createRequestRouter(registry, globalConfiguration);
    subtaskTimer.stop();
    subtaskTimer.logDebugTimeInMilliseconds("Djn initialization: Request Processor initialization time");
}

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

private OBError process(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId,
        String strTab, String strProcessId, String strPath, String strPosted, String strWindowPath,
        String strDocNo) {/*from   ww  w  .j  a v a  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 + "/" + "06D7B5E8C9D54AB28DA8CBD95D30F833" + "/" + 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);

        RPFUploadEmp rpfcon = OBDal.getInstance().get(RPFUploadEmp.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 >= 32) {
                    //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 <= 30) {
                        //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.elim(this);
                        System.out.println("Borrando lineas antes cargardas");
                        for (int fila = 0; fila < numFilas; fila++) { // Recorre cada 
                            // fila de la  hoja 
                            String nom = null;
                            String rfc = null;
                            String calle = null;
                            String noext = null;
                            String noint = null;
                            String col = null;
                            String loc = null;
                            String mun = null;
                            String est = null;
                            String pais = null;
                            String cp = null;
                            String regis = null;
                            String num = null;
                            String curp = null;
                            String tiporeg = null;
                            String numseg = null;
                            String depa = null;
                            String banco = null;
                            String fechaini = null;
                            String antigue = null;
                            String puesto = null;
                            String tipocon = null;
                            String tipojor = null;
                            String salariob = null;
                            String riesgo = null;
                            String salariod = null;
                            String met = null;
                            String cond = null;
                            String mon = null;
                            String forma = null;
                            String numcuenta = null;
                            for (int columna = 0; columna < numColumnas; columna++) { // Recorre                                                                                
                                // cada columna de la fila 
                                data = hoja.getCell(columna, fila).getContents();
                                if (columna == 0) {
                                    nom = data;
                                }
                                if (columna == 1) {
                                    rfc = data;
                                }
                                if (columna == 2) {
                                    calle = data;
                                }
                                if (columna == 3) {
                                    noext = data;
                                }
                                if (columna == 4) {
                                    noint = data;
                                }
                                if (columna == 5) {
                                    col = data;
                                }
                                if (columna == 6) {
                                    loc = data;
                                }
                                if (columna == 7) {
                                    mun = data;
                                }
                                if (columna == 8) {
                                    est = data;
                                }
                                if (columna == 9) {
                                    pais = data;
                                }
                                if (columna == 10) {
                                    cp = data;
                                }
                                if (columna == 11) {
                                    regis = data;
                                }
                                if (columna == 12) {
                                    num = data;
                                }
                                if (columna == 13) {
                                    curp = data;
                                }
                                if (columna == 14) {
                                    tiporeg = data;
                                }
                                if (columna == 15) {
                                    numseg = data;
                                }
                                if (columna == 16) {
                                    depa = data;
                                }
                                if (columna == 17) {
                                    banco = data;
                                }
                                if (columna == 18) {
                                    fechaini = data;
                                }
                                if (columna == 19) {
                                    antigue = data;
                                }
                                if (columna == 20) {
                                    puesto = data;
                                }
                                if (columna == 21) {
                                    tipocon = data;
                                }
                                if (columna == 22) {
                                    tipojor = data;
                                }
                                if (columna == 23) {
                                    salariob = data;
                                }
                                if (columna == 24) {
                                    riesgo = data;
                                }
                                if (columna == 25) {
                                    salariod = data;
                                }
                                if (columna == 26) {
                                    met = data;
                                }
                                if (columna == 27) {
                                    cond = data;
                                }
                                if (columna == 28) {
                                    mon = data;
                                }
                                if (columna == 29) {
                                    forma = data;
                                }
                                if (columna == 30) {
                                    numcuenta = data;
                                }
                                //System.out.println(columna+" "+fila);
                                //System.out.print(data + " ")1; 
                            }
                            if (nom.equals("") && rfc.equals("") && calle.equals("")) {
                                System.out.println("entro al break");
                                break;
                            } else {
                                //System.out.println(num+" "+con+" "+percep+" "+deducci+" "+dias+"\n"); 
                                System.out.println("Guardando datos");
                                if (nom.equals("NombreEmpleado") && rfc.equals("RFC")
                                        && calle.equals("Calle")) {
                                    System.out.println("entro al encabezado :p");
                                } else {
                                    UploadData.uplo(this, clien, org, use, use, nom, rfc, calle, noext, noint,
                                            col, loc, mun, est, pais, cp, num, curp, tiporeg, numseg, depa,
                                            banco, fechaini, antigue, puesto, tipocon, tipojor, salariob,
                                            riesgo, salariod, met, cond, mon, forma, numcuenta, regis);
                                    System.out.println("Termino de guardar la informacion");
                                }
                            }
                        }
                    } //cierra el else de las columnas
                }
            }
        } 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.openbravo.erpCommon.ad_reports.ReportMaterialDimensionalAnalysesJR.java

private void printPageHtml(HttpServletRequest request, HttpServletResponse response, VariablesSecureApp vars,
        String strComparative, String strDateFrom, String strDateTo, String strPartnerGroup,
        String strcBpartnerId, String strProductCategory, String strmProductId, String strNotShown,
        String strShown, String strDateFromRef, String strDateToRef, String strOrg, String strOrder,
        String strMayor, String strMenor, String strCurrencyId, String strOutput)
        throws IOException, ServletException {
    if (log4j.isDebugEnabled())
        log4j.debug("Output: print html");
    String strOrderby = "";
    String[] discard = { "", "", "", "", "" };
    String[] discard1 = { "selEliminarBody1", "discard", "discard", "discard", "discard", "discard", "discard",
            "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard",
            "discard", "discard", "discard", "discard", "discard" };
    if (strOrg.equals(""))
        strOrg = vars.getOrg();//from  w  w w. j a va 2 s . c o m
    if (strComparative.equals("Y"))
        discard1[0] = "selEliminarBody2";
    String strTitle = "";
    strTitle = Utility.messageBD(this, "From", vars.getLanguage()) + " " + strDateFrom + " "
            + Utility.messageBD(this, "To", vars.getLanguage()) + " " + strDateTo;
    if (!strPartnerGroup.equals(""))
        strTitle = strTitle + ", " + Utility.messageBD(this, "ForBPartnerGroup", vars.getLanguage()) + " "
                + ReportMaterialDimensionalAnalysesJRData.selectBpgroup(this, strPartnerGroup);

    if (!strProductCategory.equals(""))
        strTitle = strTitle + " " + Utility.messageBD(this, "And", vars.getLanguage()) + " "
                + Utility.messageBD(this, "ProductCategory", vars.getLanguage()) + " "
                + ReportMaterialDimensionalAnalysesJRData.selectProductCategory(this, strProductCategory);

    ReportMaterialDimensionalAnalysesJRData[] data = null;
    String[] strShownArray = { "", "", "", "", "" };
    if (strShown.startsWith("("))
        strShown = strShown.substring(1, strShown.length() - 1);
    if (!strShown.equals("")) {
        strShown = Replace.replace(strShown, "'", "");
        strShown = Replace.replace(strShown, " ", "");
        StringTokenizer st = new StringTokenizer(strShown, ",", false);
        int intContador = 0;
        while (st.hasMoreTokens()) {
            strShownArray[intContador] = st.nextToken();
            intContador++;
        }

    }
    ReportMaterialDimensionalAnalysesJRData[] dimensionLabel = null;
    if (vars.getLanguage().equals("en_US")) {
        dimensionLabel = ReportMaterialDimensionalAnalysesJRData.selectNotShown(this, "");
    } else {
        dimensionLabel = ReportMaterialDimensionalAnalysesJRData.selectNotShownTrl(this, vars.getLanguage(),
                "");
    }
    String[] strTextShow = { "", "", "", "", "" };
    String[] strLevelLabel = { "", "", "", "", "" };
    int intDiscard = 0;
    int intProductLevel = 6;
    int intAuxDiscard = -1;
    for (int i = 0; i < 5; i++) {
        if (strShownArray[i].equals("1")) {
            strTextShow[i] = "C_BP_GROUP.NAME";
            intDiscard++;
            strLevelLabel[i] = dimensionLabel[0].name;
        } else if (strShownArray[i].equals("2")) {
            strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('C_Bpartner'), to_char( C_BPARTNER.C_BPARTNER_ID), to_char('"
                    + vars.getLanguage() + "'))";
            intDiscard++;
            strLevelLabel[i] = dimensionLabel[1].name;
        } else if (strShownArray[i].equals("3")) {
            strTextShow[i] = "M_PRODUCT_CATEGORY.NAME";
            intDiscard++;
            strLevelLabel[i] = dimensionLabel[2].name;
        } else if (strShownArray[i].equals("4")) {
            strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('M_Product'), to_char( M_PRODUCT.M_PRODUCT_ID), to_char('"
                    + vars.getLanguage()
                    + "'))|| CASE WHEN uomsymbol IS NULL THEN '' ELSE to_char(' ('||uomsymbol||')') END";
            intAuxDiscard = i;
            intDiscard++;
            intProductLevel = i + 1;
            strLevelLabel[i] = dimensionLabel[3].name;
        } else if (strShownArray[i].equals("5")) {
            strTextShow[i] = "M_INOUT.DOCUMENTNO";
            intDiscard++;
            strLevelLabel[i] = dimensionLabel[4].name;
        } else {
            strTextShow[i] = "''";
            discard[i] = "display:none;";
        }
    }
    if (intDiscard != 0 || intAuxDiscard != -1) {
        int k = 1;
        if (intDiscard == 1) {
            strOrderby = " ORDER BY NIVEL" + k + ",";
        } else {
            strOrderby = " ORDER BY ";
        }
        while (k < intDiscard) {
            strOrderby = strOrderby + "NIVEL" + k + ",";
            k++;
        }
        if (k == 1) {
            if (strOrder.equals("Normal")) {
                strOrderby = " ORDER BY NIVEL" + k;
            } else if (strOrder.equals("Amountasc")) {
                strOrderby = " ORDER BY QTY ASC";
            } else if (strOrder.equals("Amountdesc")) {
                strOrderby = " ORDER BY QTY DESC";
            } else {
                strOrderby = "1";
            }
        } else {
            if (strOrder.equals("Normal")) {
                strOrderby += "NIVEL" + k;
            } else if (strOrder.equals("Amountasc")) {
                strOrderby += "QTY ASC";
            } else if (strOrder.equals("Amountdesc")) {
                strOrderby += "QTY DESC";
            } else {
                strOrderby = "1";
            }
        }

    } else {
        strOrderby = " ORDER BY 1";
    }
    String strHaving = "";
    if (!strMayor.equals("") && !strMenor.equals("")) {
        strHaving = " HAVING (SUM(QTY) > " + strMayor + " AND SUM(QTY) < " + strMenor + ")";
    } else if (!strMayor.equals("") && strMenor.equals("")) {
        strHaving = " HAVING (SUM(QTY) > " + strMayor + ")";
    } else if (strMayor.equals("") && !strMenor.equals("")) {
        strHaving = " HAVING (SUM(QTY) < " + strMenor + ")";
    } else {
        strHaving = " HAVING SUM(QTY) <> 0 OR SUM(QTYREF) <> 0";
    }
    strOrderby = strHaving + strOrderby;

    // Checks if there is a conversion rate for each of the transactions of
    // the report
    String strConvRateErrorMsg = "";
    OBError myMessage = null;
    myMessage = new OBError();
    if (strComparative.equals("Y")) {
        try {
            data = ReportMaterialDimensionalAnalysesJRData.select(this, strCurrencyId, strTextShow[0],
                    strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4],
                    Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg),
                    Utility.getContext(this, vars, "#User_Client", "ReportMaterialDimensionalAnalysesJR"),
                    strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strPartnerGroup, strcBpartnerId,
                    strProductCategory, strmProductId, strDateFromRef,
                    DateTimeData.nDaysAfter(this, strDateToRef, "1"), strOrderby);
        } catch (ServletException ex) {
            myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
        }
    } else {
        try {
            data = ReportMaterialDimensionalAnalysesJRData.selectNoComparative(this, strCurrencyId,
                    strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4],
                    Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg),
                    Utility.getContext(this, vars, "#User_Client", "ReportMaterialDimensionalAnalysesJR"),
                    strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strPartnerGroup, strcBpartnerId,
                    strProductCategory, strmProductId, strOrderby);
        } catch (ServletException ex) {
            myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
        }
    }
    strConvRateErrorMsg = myMessage.getMessage();
    // If a conversion rate is missing for a certain transaction, an error
    // message window pops-up.
    if (!strConvRateErrorMsg.equals("") && strConvRateErrorMsg != null) {
        advisePopUp(request, response, "ERROR",
                Utility.messageBD(this, "NoConversionRateHeader", vars.getLanguage()), strConvRateErrorMsg);
    } else { // Otherwise, the report is launched
        String strReportPath = "";
        if (strComparative.equals("Y")) {
            strReportPath = "@basedesign@/org/openbravo/erpCommon/ad_reports/SimpleDimensionalComparative.jrxml";
        } else {
            strReportPath = "@basedesign@/org/openbravo/erpCommon/ad_reports/SimpleDimensionalNoComparative.jrxml";
        }

        if (data == null || data.length == 0) {
            advisePopUp(request, response, "WARNING",
                    Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()),
                    Utility.messageBD(this, "NoDataFound", vars.getLanguage()));
        } else {
            HashMap<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("LEVEL1_LABEL", strLevelLabel[0]);
            parameters.put("LEVEL2_LABEL", strLevelLabel[1]);
            parameters.put("LEVEL3_LABEL", strLevelLabel[2]);
            parameters.put("LEVEL4_LABEL", strLevelLabel[3]);
            parameters.put("LEVEL5_LABEL", strLevelLabel[4]);
            parameters.put("DIMENSIONS", new Integer(intDiscard));
            parameters.put("REPORT_SUBTITLE", strTitle);
            parameters.put("PRODUCT_LEVEL", new Integer(intProductLevel));
            renderJR(vars, response, strReportPath, strOutput, parameters, data, null);
        }
    }
}