當前位置: 首頁>>代碼示例>>Java>>正文


Java JAXBException.getLocalizedMessage方法代碼示例

本文整理匯總了Java中javax.xml.bind.JAXBException.getLocalizedMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java JAXBException.getLocalizedMessage方法的具體用法?Java JAXBException.getLocalizedMessage怎麽用?Java JAXBException.getLocalizedMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.bind.JAXBException的用法示例。


在下文中一共展示了JAXBException.getLocalizedMessage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getClusterVersion

import javax.xml.bind.JAXBException; //導入方法依賴的package包/類
/**
 * @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(
            new ByteArrayInputStream(response.getBody()));
      } catch (JAXBException jaxbe) {

        throw new IOException(
            "Issue parsing StorageClusterVersionModel object in XML form: "
                + jaxbe.getLocalizedMessage());
      }
    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");
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:50,代碼來源:RemoteAdmin.java


注:本文中的javax.xml.bind.JAXBException.getLocalizedMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。