CLOUDSTACK-8656: reporting ignored exceptions in server Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6fa8b757 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6fa8b757 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6fa8b757
Branch: refs/heads/master Commit: 6fa8b7578e27e73bb2d90be1970347c2e79c3b09 Parents: a0ba7d3 Author: Daan Hoogland <[email protected]> Authored: Tue Aug 4 15:50:35 2015 +0200 Committer: Daan Hoogland <[email protected]> Committed: Tue Aug 4 15:50:35 2015 +0200 ---------------------------------------------------------------------- .../cloud/network/ExternalIpAddressAllocator.java | 16 ++++------------ .../network/lb/LoadBalancingRulesManagerImpl.java | 1 + .../com/cloud/server/ConfigurationServerImpl.java | 6 ++++-- .../src/com/cloud/servlet/ConsoleProxyServlet.java | 2 ++ 4 files changed, 11 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fa8b757/server/src/com/cloud/network/ExternalIpAddressAllocator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/ExternalIpAddressAllocator.java b/server/src/com/cloud/network/ExternalIpAddressAllocator.java index 3cf3580..58b30f4 100644 --- a/server/src/com/cloud/network/ExternalIpAddressAllocator.java +++ b/server/src/com/cloud/network/ExternalIpAddressAllocator.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.network; +import static com.cloud.utils.AutoCloseableUtil.closeAutoCloseable; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -81,12 +83,7 @@ public class ExternalIpAddressAllocator extends AdapterBase implements IpAddrAll } catch (IOException e) { return new IpAddr(); } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } + closeAutoCloseable(in, "closing buffered reader"); } } @@ -121,12 +118,7 @@ public class ExternalIpAddressAllocator extends AdapterBase implements IpAddrAll } catch (IOException e) { return false; } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } + closeAutoCloseable(in, "buffered reader close"); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fa8b757/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index d7a85b6..81b9bb1 100644 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -693,6 +693,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements if (backupState.equals(FirewallRule.State.Active)) applyLoadBalancerConfig(cmd.getLbRuleId()); } catch (ResourceUnavailableException e1) { + s_logger.info("[ignored] applying load balancer config.", e1); } finally { loadBalancer.setState(backupState); _lbDao.persist(loadBalancer); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fa8b757/server/src/com/cloud/server/ConfigurationServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index e7a928a..5ff548c 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -43,7 +43,6 @@ import javax.crypto.SecretKey; import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.utils.nio.Link; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -118,6 +117,7 @@ import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; +import com.cloud.utils.nio.Link; import com.cloud.utils.script.Script; public class ConfigurationServerImpl extends ManagerBase implements ConfigurationServer { @@ -757,6 +757,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio try (DataInputStream dis = new DataInputStream(new FileInputStream(privkeyfile))) { dis.readFully(arr1); } catch (EOFException e) { + s_logger.info("[ignored] eof reached"); } catch (Exception e) { s_logger.error("Cannot read the private key file", e); throw new CloudRuntimeException("Cannot read the private key file"); @@ -766,6 +767,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio try (DataInputStream dis = new DataInputStream(new FileInputStream(pubkeyfile))) { dis.readFully(arr2); } catch (EOFException e) { + s_logger.info("[ignored] eof reached"); } catch (Exception e) { s_logger.warn("Cannot read the public key file", e); throw new CloudRuntimeException("Cannot read the public key file"); @@ -902,7 +904,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio } else { command = new Script("/bin/bash", s_logger); } - if (this.isOnWindows()) { + if (isOnWindows()) { scriptPath = scriptPath.replaceAll("\\\\" ,"/" ); systemVmIsoPath = systemVmIsoPath.replaceAll("\\\\" ,"/" ); publicKeyPath = publicKeyPath.replaceAll("\\\\" ,"/" ); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fa8b757/server/src/com/cloud/servlet/ConsoleProxyServlet.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java index 3389d92..cc788c7 100644 --- a/server/src/com/cloud/servlet/ConsoleProxyServlet.java +++ b/server/src/com/cloud/servlet/ConsoleProxyServlet.java @@ -228,12 +228,14 @@ public class ConsoleProxyServlet extends HttpServlet { try { w = Integer.parseInt(value); } catch (NumberFormatException e) { + s_logger.info("[ignored] not a number: " + value); } value = req.getParameter("h"); try { h = Integer.parseInt(value); } catch (NumberFormatException e) { + s_logger.info("[ignored] not a number: " + value); } try {
