Example usage for java.lang Exception getCause

List of usage examples for java.lang Exception getCause

Introduction

In this page you can find the example usage for java.lang Exception getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:com.wglxy.example.dashL.SearchActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    setTitleFromActivityLabel(R.id.title_text);
    showLogginLogout(findViewById(R.id.btn_login_logout));

    initUI();/*  w w  w.ja  v  a  2  s. c  om*/
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SEARCH_QUERY)
            && savedInstanceState.containsKey(KEY_USER_OBJ)) {
        searchStr = savedInstanceState.getString(KEY_SEARCH_QUERY);
        data = savedInstanceState.getParcelableArrayList(KEY_USER_OBJ);
    }

    try {
        Bundle args = getIntent().getExtras();
        searchStr = args.getString(Constants.KEY_SEARCH_ARGS);
        Log.e(LOG_TAG, "search query: " + searchStr);
        doSearch(searchStr);
    } catch (Exception ex) {
        Log.e(LOG_TAG, "no search args", ex.getCause());
        searchBar.setVisibility(View.VISIBLE);
        edt_search.requestFocus();
    }
}

From source file:com.sisrni.managedbean.OpcionesAdmMB.java

/**
 * *// ww w  . j  a  va 2 s  .  c  om
 *
 * @param country
 * @throws Exception
 */
public void preEditar(SsOpciones ssOpciones) throws Exception {
    try {
        int i = 0;
        this.ssOpciones = ssOpciones;
        selectedArrayRoles = new String[ssOpciones.getSsRolesList().size()];
        for (SsRoles mn : ssOpciones.getSsRolesList()) {
            selectedArrayRoles[i] = mn.getIdRol().toString();
            i++;
        }

        if (ssOpciones.getVisible().equalsIgnoreCase("S")) {
            visible = true;
        } else {
            visible = false;
        }

        RequestContext.getCurrentInstance().update("formAdmin");
        RequestContext.getCurrentInstance().update("formMenu");
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Error class MenusOpcionesMB - preEditar()\n" + e.getMessage(), e.getCause());
    } finally {

    }
}

From source file:com.sisrni.managedbean.OpcionesAdmMB.java

public void editar() throws Exception {
    try {// w  w w . jav  a2  s.c om

        for (SsRoles mn : ssOpciones.getSsRolesList()) {
            int deleteMenuOpciones = opcionesService.deleteOpcionesRoles(ssOpciones.getIdOpcion(),
                    mn.getIdRol());
        }
        selectedlistRoles = new ArrayList<SsRoles>();
        for (String us : selectedArrayRoles) {
            roles = new SsRoles();
            roles = ssRolesService.findById(Integer.parseInt(us.toString()));
            selectedlistRoles.add(roles);
            opcionesService.gurdarRolesOpciones(Integer.parseInt(us.toString()), ssOpciones.getIdOpcion());

        }
        if (visible) {
            ssOpciones.setVisible(String.valueOf('S'));
        } else {
            ssOpciones.setVisible(String.valueOf('N'));
        }
        opcionesService.merge(ssOpciones);
        getMenus();
        RequestContext.getCurrentInstance().update("formAdmin");
        RequestContext.getCurrentInstance().update("formMenu");
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Error class opcinesAdmMB - Editar()\n" + e.getMessage(), e.getCause());
    } finally {
        this.ssOpciones = null;
        this.ssOpciones = new SsOpciones();
        setActualizar(false);
    }
}

From source file:com.aliyun.openservices.odps.console.file.FileOperationCommand.java

private void getFile(Odps odps) throws ODPSConsoleException {

    int start = paras[2].startsWith("/") ? 1 : 0;
    String[] sp = paras[2].substring(start).split("/");
    String vName = sp[0];/*from   w ww.  j a va  2 s.com*/
    String pName = "";
    String filePath = "/";

    if (sp.length > 1) {
        pName = sp[1];
    } else {
        throwUsageError(System.err, "Invalid parameters - pls set partition name.");
    }

    if (sp.length > 2) {
        filePath = paras[2].substring(start + sp[0].length() + sp[1].length() + 2);
    }

    String tunnelEndpoint = getContext().getTunnelEndpoint();

    VolumeTunnel tunnel = new VolumeTunnel(odps);
    if (!StringUtils.isEmpty(tunnelEndpoint)) {
        tunnel.setEndpoint(tunnelEndpoint);
    }

    try {

        if (filePath.endsWith("/")) {

            Volume volume = odps.volumes().get(vName);
            String projectName = odps.projects().get().getName();
            UploadDownloadUtil.downloadFolder(filePath, paras[3], pName, projectName, volume, tunnel);

        } else if (!filePath.equals("")) {

            if (filePath.startsWith("/")) {
                filePath = filePath.substring(1);
            }

            DownloadSession down = tunnel.createDownloadSession(getCurrentProject(), vName, pName, filePath);
            File file = new File(paras[3]);
            UploadDownloadUtil.downloadFile(file, down);

        }

    } catch (Exception e) {
        throw new ODPSConsoleException(e.getMessage(), e.getCause());
    }
}

From source file:com.aliyun.openservices.odps.console.file.FileOperationCommand.java

private void putFile() throws ODPSConsoleException {
    int start = paras[3].startsWith("/") ? 1 : 0;

    String[] sp = paras[3].substring(start).split("/");
    String vName = sp[0];//w w w  .  ja v a 2 s  . c  o  m
    String pName = "";
    String filePath = "/";

    if (sp.length > 1) {
        pName = sp[1];
    } else {
        throwUsageError(System.err, "Invalid parameters - pls set partition name.");
    }

    if (sp.length > 2) {
        filePath = paras[3].substring(start + sp[0].length() + sp[1].length() + 2);
    }

    try {

        File file = new File(paras[2]);
        if (!file.exists()) {
            throw new ODPSConsoleException("file not exists.");
        }

        Odps odps = getCurrentOdps();

        String tunnelEndpoint = getContext().getTunnelEndpoint();

        VolumeTunnel tunnel = new VolumeTunnel(odps);
        if (!StringUtils.isEmpty(tunnelEndpoint)) {
            tunnel.setEndpoint(tunnelEndpoint);
        }
        UploadSession up = tunnel.createUploadSession(getCurrentProject(), vName, pName);

        if (file.exists() && file.isDirectory()) {

            filePath = (filePath.endsWith("/") ? filePath : filePath + "/") + file.getName();

            UploadDownloadUtil.uploadFolder(file, up, filePath);
        } else if (file.exists() && file.isFile()) {
            UploadDownloadUtil.uploadFile(file, up, filePath.equals("/") ? file.getName() : filePath);
        }

        up.commit(up.getFileList());
    } catch (Exception e) {
        throw new ODPSConsoleException(e.getMessage(), e.getCause());
    }
}

From source file:com.ai.bss.webui.party.controller.PartyController.java

@RequestMapping(value = "/rename/renameLegal", method = RequestMethod.POST)
public String renameLegal(@ModelAttribute("legal") @Valid Legal legal, BindingResult bindingResult,
        Model model) {//from  w  ww.j  av  a 2s  . co m
    if (!bindingResult.hasErrors()) {
        PartyId partyId = new PartyId(legal.getPartyId());
        PartyEntry partyEntry = client.getForObject("http://party-query-service/party/" + partyId,
                PartyEntry.class);
        if (null != partyEntry && (partyEntry instanceof LegalOrganizationEntry)) {
            RenameLegalCommand command = new RenameLegalCommand(partyId, legal.getLegalName());
            command.setOldLegalName(partyEntry.getName());
            command.setTenantId(TenantContext.getCurrentTenant());
            try {
                command = client.postForObject("http://party-service/party/RenameLegalCommand", command,
                        RenameLegalCommand.class);
                return "redirect:/party";
            } catch (Exception e) {
                bindingResult.rejectValue("legalName", "error.renameLegal.notChanged",
                        e.getCause().getMessage());
            }
        }
    }
    return "party/renameLegal";
}

From source file:gov.nih.nci.integration.catissue.client.CaTissueConsentClient.java

/**
 * This method is used to parse the incoming XML string and populate the 'Consents' object
 * /*w  w w  .ja v a 2 s.co  m*/
 * @param specimenListXMLStr
 * @return
 */
private Consents parseConsentsListXML(String consentsListXMLStr) throws ApplicationException {
    Consents consents = null;
    try {
        consents = (Consents) xStream.fromXML(new StringReader(consentsListXMLStr));
        // CHECKSTYLE:OFF
    } catch (Exception e) { // NOPMD
        // CHECKSTYLE:ON
        LOG.error(XLS_TRANSFORMATION_EXP + e.getCause(), e);
        throw new ApplicationException(XLS_TRANSFORMATION_EXP + e.getCause(), e);
    }
    return consents;
}

From source file:com.fer.hr.olap.query.QueryDeserializer.java

private Properties getProperties(Element queryElement) {
    Properties props = new Properties();
    try {/*w w w .  ja  v a  2s.  co  m*/

        Element propertiesElement = queryElement.getChild("Properties");
        if (propertiesElement != null) {
            for (int i = 0; i < propertiesElement.getChildren("Property").size(); i++) {
                Element p = (Element) propertiesElement.getChildren("Property").get(i);
                String k = p.getAttributeValue("name");
                String v = p.getAttributeValue("value");
                props.put(k, v);
            }

        }
    } catch (Exception e) {
        log.error("Exception", e.getCause());
    }
    return props;
}

From source file:com.ai.bss.webui.party.controller.PartyController.java

@RequestMapping(value = "/rename/renameIndividual", method = RequestMethod.POST)
public String renameIndividual(@ModelAttribute("individual") @Valid Individual individual,
        BindingResult bindingResult, Model model) {
    if (!bindingResult.hasErrors()) {
        PartyId partyId = new PartyId(individual.getPartyId());
        PartyEntry partyEntry = client.getForObject("http://party-query-service/party/" + partyId,
                PartyEntry.class);
        IndividualEntry individualEntry = (IndividualEntry) partyEntry;
        if (null != individualEntry) {
            RenameIndividualCommand command = new RenameIndividualCommand(partyId, individual.getFirstName(),
                    individual.getLastName());
            command.setOldFirstName(individualEntry.getFirstName());
            command.setOldLastName(individualEntry.getLastName());
            command.setTenantId(TenantContext.getCurrentTenant());
            try {
                command = client.postForObject("http://party-service/party/RenameIndividualCommand", command,
                        RenameIndividualCommand.class);
                return "redirect:/party";
            } catch (Exception e) {
                bindingResult.rejectValue("firstName", "error.renameIndividual.notChanged",
                        e.getCause().getMessage());
            }//from   w w w. j a  v  a2s.c om
        }
    }
    return "party/renameIndividual";
}