当前位置: 首页>>代码示例>>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;未经允许,请勿转载。