Java Code Examples for javax.xml.bind.JAXBException#getLocalizedMessage()

The following examples show how to use javax.xml.bind.JAXBException#getLocalizedMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JaxContextCentralizer.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String processJAXBException(JAXBException e) {
   String message = null;
   if (e.getLinkedException() != null) {
      message = e.getLinkedException().getMessage();
   } else {
      message = e.getLocalizedMessage();
   }

   return message;
}
 
Example 2
Source File: JaxContextCentralizer.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String processJAXBException(JAXBException e) {
   String message = null;
   if (e.getLinkedException() != null) {
      message = e.getLinkedException().getMessage();
   } else {
      message = e.getLocalizedMessage();
   }

   return message;
}
 
Example 3
Source File: RemoteAdmin.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * @return string representing the cluster's version
 * @throws IOException
 *           if the endpoint does not exist, there is a timeout, or some other
 *           general failure mode
 */
public StorageClusterVersionModel getClusterVersion() throws IOException {

  StringBuilder path = new StringBuilder();
  path.append('/');
  if (accessToken != null) {
    path.append(accessToken);
    path.append('/');
  }

  path.append("version/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(), Constants.MIMETYPE_XML);
    code = response.getCode();
    switch (code) {
    case 200:
      try {

        return (StorageClusterVersionModel) getUnmarsheller().unmarshal(
            getInputStream(response));
      } catch (JAXBException jaxbe) {

        throw new IOException(
            "Issue parsing StorageClusterVersionModel object in XML form: "
                + jaxbe.getLocalizedMessage(), jaxbe);
      }
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException(path.toString() + " request returned " + code);
    }
  }
  throw new IOException("get request to " + path.toString()
      + " request timed out");
}