本文整理匯總了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");
}