[cleanup] collapse identical catch blocks

With Java7, you don't need multiple identical catch blocks anymore

Related to #52.

(cherry picked from commit 322e1e5)
(cherry picked from commit 9d3b0ad)
This commit is contained in:
David Pilato 2015-02-04 14:45:20 +01:00
parent 0e81e351c2
commit 7c27d53ee1
3 changed files with 5 additions and 24 deletions

View File

@ -117,11 +117,7 @@ public class AzureComputeServiceImpl extends AbstractLifecycleComponent<AzureCom
Set<Instance> instances = buildInstancesFromXml(stream, port_name); Set<Instance> instances = buildInstancesFromXml(stream, port_name);
logger.trace("get instances from azure: {}", instances); logger.trace("get instances from azure: {}", instances);
return instances; return instances;
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException | XPathExpressionException | SAXException e) {
logger.warn("can not parse XML response: {}", e.getMessage());
} catch (XPathExpressionException e) {
logger.warn("can not parse XML response: {}", e.getMessage());
} catch (SAXException e) {
logger.warn("can not parse XML response: {}", e.getMessage()); logger.warn("can not parse XML response: {}", e.getMessage());
} catch (Exception e) { } catch (Exception e) {
logger.warn("can not get list of azure nodes: {}", e.getMessage()); logger.warn("can not get list of azure nodes: {}", e.getMessage());

View File

@ -60,9 +60,7 @@ public class AzureBlobContainer extends AbstractBlobContainer {
public boolean blobExists(String blobName) { public boolean blobExists(String blobName) {
try { try {
return blobStore.client().blobExists(blobStore.container(), buildKey(blobName)); return blobStore.client().blobExists(blobStore.container(), buildKey(blobName));
} catch (URISyntaxException e) { } catch (URISyntaxException | StorageException e) {
logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage());
} catch (StorageException e) {
logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage()); logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage());
} }
return false; return false;
@ -98,10 +96,7 @@ public class AzureBlobContainer extends AbstractBlobContainer {
public void deleteBlob(String blobName) throws IOException { public void deleteBlob(String blobName) throws IOException {
try { try {
blobStore.client().deleteBlob(blobStore.container(), buildKey(blobName)); blobStore.client().deleteBlob(blobStore.container(), buildKey(blobName));
} catch (URISyntaxException e) { } catch (URISyntaxException | StorageException e) {
logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage());
throw new IOException(e);
} catch (StorageException e) {
logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage()); logger.warn("can not access [{}] in container {{}}: {}", blobName, blobStore.container(), e.getMessage());
throw new IOException(e); throw new IOException(e);
} }
@ -112,13 +107,7 @@ public class AzureBlobContainer extends AbstractBlobContainer {
try { try {
return blobStore.client().listBlobsByPrefix(blobStore.container(), keyPath, prefix); return blobStore.client().listBlobsByPrefix(blobStore.container(), keyPath, prefix);
} catch (URISyntaxException e) { } catch (URISyntaxException | StorageException | ServiceException e) {
logger.warn("can not access [{}] in container {{}}: {}", prefix, blobStore.container(), e.getMessage());
throw new IOException(e);
} catch (StorageException e) {
logger.warn("can not access [{}] in container {{}}: {}", prefix, blobStore.container(), e.getMessage());
throw new IOException(e);
} catch (ServiceException e) {
logger.warn("can not access [{}] in container {{}}: {}", prefix, blobStore.container(), e.getMessage()); logger.warn("can not access [{}] in container {{}}: {}", prefix, blobStore.container(), e.getMessage());
throw new IOException(e); throw new IOException(e);
} }

View File

@ -76,11 +76,7 @@ public class AzureBlobStore extends AbstractComponent implements BlobStore {
try { try {
client.deleteFiles(container, keyPath); client.deleteFiles(container, keyPath);
} catch (URISyntaxException e) { } catch (URISyntaxException | StorageException | ServiceException e) {
logger.warn("can not remove [{}] in container {{}}: {}", keyPath, container, e.getMessage());
} catch (StorageException e) {
logger.warn("can not remove [{}] in container {{}}: {}", keyPath, container, e.getMessage());
} catch (ServiceException e) {
logger.warn("can not remove [{}] in container {{}}: {}", keyPath, container, e.getMessage()); logger.warn("can not remove [{}] in container {{}}: {}", keyPath, container, e.getMessage());
} }
} }