Example usage for javax.xml.bind JAXBException getMessage

List of usage examples for javax.xml.bind JAXBException getMessage

Introduction

In this page you can find the example usage for javax.xml.bind JAXBException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:ddf.security.pdp.xacml.processor.BalanaPdp.java

/**
 * Creates a JAXB context for the XACML request and response types.
 * /*w w w.  ja  v  a2 s .c  o  m*/
 * @throws PdpException
 */
private void createJaxbContext() throws PdpException {
    try {
        jaxbContext = JAXBContext.newInstance(RequestType.class, ResponseType.class);
    } catch (JAXBException e) {
        LOGGER.error(e.getMessage(), e);
        throw new PdpException(e);
    }
}

From source file:au.edu.usq.fascinator.harvester.fedora.FedoraHarvester.java

/**
 * Initialisation of Fedora Harvester plugin
 * /*from  w w w. j a  va  2  s .  c  om*/
 * @throws HarvesterException if fails to initialise
 */
@Override
public void init() throws HarvesterException {
    JsonConfigHelper config;

    // Read config
    try {
        config = new JsonConfigHelper(getJsonConfig().toString());
    } catch (IOException ex) {
        throw new HarvesterException("Failed reading configuration", ex);
    }

    baseUrl = config.get("harvester/fedora/baseUrl");
    maxRequests = Integer.parseInt(config.get("harvester/fedora/maxRequests"));
    requestSize = DEFAULT_REQUEST_SIZE;
    if (config.get("harvester/fedora/requestSize") != null) {
        requestSize = Integer.parseInt(config.get("harvester/fedora/requestSize"));
    }

    if (baseUrl != null) {
        restClient = new FedoraRestClient(baseUrl);
    } else {
        throw new HarvesterException("Fedora baseUrl is not set");
    }

    searchFiles = new LinkedList<File>();
    started = false;
    searchTerms = "*";
    URL u;
    try {
        u = new URL(baseUrl);
        String tmpDir = System.getProperty("java.io.tmpdir");
        String tmpName = u.getHost() + "_" + u.getPort();
        workDir = new File(tmpDir, tmpName);
        workDir.mkdirs();
        try {
            jc = JAXBContext.newInstance(ResultType.class);
            um = jc.createUnmarshaller();
        } catch (JAXBException jaxbe) {
            throw new HarvesterException(jaxbe.getMessage());
        }
    } catch (MalformedURLException e) {
        throw new HarvesterException("Malformed baseUrl: " + baseUrl, e);
    }

    //For now assume since is null....
    Date since = null;
    getItems(since);
}

From source file:gov.nih.nci.caxchange.transcend.CaXchangeRequestService.java

private ResponseMessage getJAXBExceptionResponseMessage(ResponseMessage respMessage, JAXBException ex) {
    final ErrorDetails errorDetails = new ErrorDetails();
    errorDetails.setErrorCode(String.valueOf(IntegrationError._1000.getErrorCode()));
    errorDetails.setErrorDescription(IntegrationError._1000.getMessage(null) + ex.getMessage());
    final Response response = new Response();
    response.setCaXchangeError(errorDetails);
    response.setResponseStatus(Statuses.FAILURE);
    respMessage.setResponse(response);//from  ww  w  . j av a  2 s.  c o  m
    return respMessage;
}

From source file:org.kemri.wellcome.dhisreport.api.impl.DHIS2ReportingServiceImpl.java

@Override
public void unMarshallandSaveReportTemplates(InputStream is) {
    JAXBContext jaxbContext = null;
    Unmarshaller jaxbUnmarshaller = null;
    ReportTemplates reportTemplates = null;
    try {/* w w w.  j a v a2s  .  c o m*/
        jaxbContext = JAXBContext.newInstance(ReportTemplates.class);
        jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        reportTemplates = (ReportTemplates) jaxbUnmarshaller.unmarshal(is);
        if (reportTemplates == null)
            log.error("\n reportTemplates : null");
    } catch (JAXBException e) {
        log.error(e.getMessage());
        e.printStackTrace();
    }

    for (DataElement de : reportTemplates.getDataElements()) {
        saveDataElement(de);
    }
    for (Disaggregation disagg : reportTemplates.getDisaggregations()) {
        saveDisaggregation(disagg);
    }
    for (ReportDefinition rd : reportTemplates.getReportDefinitions()) {
        for (DataValueTemplate dvt : rd.getDataValueTemplates()) {
            dvt.setReportDefinition(rd);
        }
        saveReportDefinition(rd);
    }
}

From source file:eu.eco2clouds.scheduler.em.EMClientHC.java

@Override
public ManagedExperiment getExperiment(String userId, int experimentId) {
    this.userId = userId;
    Boolean exception = false;/* w  ww. j  a  v a 2  s  . c  o m*/
    String testbedsUrl = url + "/" + experimentId;

    String response = getMethod(testbedsUrl, exception);

    ManagedExperiment me = null;

    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(ManagedExperiment.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        me = (ManagedExperiment) jaxbUnmarshaller.unmarshal(new StringReader(response));
    } catch (JAXBException e) {
        logger.warn("Error trying to parse returned status of hosts: " + url + testbedsUrl + " Exception: "
                + e.getMessage());
        exception = true;
    }

    if (exception)
        return null;
    return me;
}

From source file:eu.eco2clouds.scheduler.em.EMClientHC.java

@Override
public List<ManagedExperiment> listExperiments(String userId) {
    this.userId = userId;
    Boolean exception = false;//  ww w .  ja v  a 2 s. c  o  m
    String testbedsUrl = url;

    String response = getMethod(testbedsUrl, exception);

    List<ManagedExperiment> managedExperiments = new ArrayList<ManagedExperiment>();

    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        Collection collection = (Collection) jaxbUnmarshaller.unmarshal(new StringReader(response));
        managedExperiments = collection.getItems().getManagedExperiments();
    } catch (JAXBException e) {
        logger.warn("Error trying to parse returned status of hosts: " + url + testbedsUrl + " Exception: "
                + e.getMessage());
        exception = true;
    }

    if (exception)
        return new ArrayList<ManagedExperiment>();
    return managedExperiments;
}

From source file:eu.learnpad.cw.CWXwikiBridge.java

License:asdf

@Override
public void notifyRecommendations(String modelSetId, String simulationid, String userId, Recommendations rec)
        throws LpRestException {
    Writer recWriter = new StringWriter();
    JAXBContext jc;//from  w w w . j ava2  s. c o m
    try {
        jc = JAXBContext.newInstance(Recommendations.class);
        jc.createMarshaller().marshal(rec, recWriter);
    } catch (JAXBException e) {
        throw new LpRestExceptionXWikiImpl(e.getMessage(), e.getCause());
    }

    String msg = "modelSetId : " + modelSetId + "\n" + "simulationid : " + simulationid + "\n" + "userId : "
            + userId + "\n" + "recommendations : " + rec.toString();

    logger.info(msg);

    CWXwikiBridge.recsStore.put(userId, simulationid, rec);
}

From source file:org.excalibur.service.deployment.service.DeploymentServiceImpl.java

@Override
public Deployment findDeployment(final String username, final Integer deploymentId) {
    checkState(username != null && deploymentId != null, "Username and deploymentId must not be null!");

    final Deployment deployment = deploymentRepository_.findDeploymentById(deploymentId, username);

    if (deployment != null) {
        try {/*from   w  w  w . jav  a 2s. com*/
            Deployment fromXml = unmarshal(deployment.getAsText());

            for (Node node : fromXml.getNodes()) {
                deployment.withNode(node);
            }

            deployment.withCredentials(
                    fromXml.getCredentials().toArray(new Credential[fromXml.getCredentials().size()]));
        } catch (JAXBException exception) {
            LOG.error("Error in parsing deployment data. Cause: {}", exception.getMessage(), exception);
        }
    }
    return deployment;
}

From source file:org.dasein.cloud.azure.Azure.java

public void createDefaultStorageService() throws CloudException, InternalException {
    ProviderContext ctx = getContext();//from  ww  w  .  j  av  a  2s  .c  o  m

    if (ctx == null) {
        throw new AzureConfigException("No configuration was set for this request");
    }

    String randomSufix = UUID.randomUUID().toString().replace("-", "").substring(0, 13);
    String serviceName = "portalvhds" + randomSufix;
    CreateStorageServiceInputModel createStorageServiceInputModel = new CreateStorageServiceInputModel();
    createStorageServiceInputModel.setServiceName(serviceName);
    createStorageServiceInputModel.setDescription("Implicitly created storage service");
    createStorageServiceInputModel.setLabel(new String(Base64.encodeBase64(randomSufix.getBytes())));
    createStorageServiceInputModel.setLocation(ctx.getRegionId());
    createStorageServiceInputModel.setGeoReplicationEnabled("true");

    String requestId = null;
    AzureMethod azureMethod = new AzureMethod(this);
    try {
        requestId = azureMethod.post("/services/storageservices", createStorageServiceInputModel);
    } catch (JAXBException e) {
        logger.error(e.getMessage());
        throw new InternalException(e);
    }

    if (requestId != null) {
        int httpCode = azureMethod.getOperationStatus(requestId);
        while (httpCode == -1) {
            try {
                Thread.sleep(15000L);
            } catch (InterruptedException ignored) {
            }
            httpCode = azureMethod.getOperationStatus(requestId);
        }
        if (httpCode == HttpServletResponse.SC_OK) {
            storageEndpoint = "https://" + serviceName + ".blob.core.windows.net/";
        }
    }
}

From source file:com.xerox.amazonws.devpay.DevPayLS.java

/**
 * Gets list of active subscriptions by persistent identifier
 *
 * @param persistentIdentifier customers's PID
 * @return true if product is subscribed
 * @throws DevPayException wraps checked exceptions
 *//*from   ww w. ja v a2s.  co m*/
public List<String> getActiveSubscriptionsByPid(String persistentIdentifier) throws DevPayException {
    Map<String, String> params = new HashMap<String, String>();
    params.put("PersistentIdentifier", persistentIdentifier);
    GetMethod method = new GetMethod();
    try {
        GetActiveSubscriptionsByPidResponse response = makeRequest(method, "GetActiveSubscriptionsByPid",
                params, GetActiveSubscriptionsByPidResponse.class);

        GetActiveSubscriptionsByPidResult result = response.getGetActiveSubscriptionsByPidResult();
        return result.getProductCodes();
    } catch (JAXBException ex) {
        throw new DevPayException("Problem parsing returned message.", ex);
    } catch (HttpException ex) {
        throw new DevPayException(ex.getMessage(), ex);
    } catch (IOException ex) {
        throw new DevPayException(ex.getMessage(), ex);
    } finally {
        method.releaseConnection();
    }
}