diff --git a/server/src/com/cloud/network/ExternalIpAddressAllocator.java b/server/src/com/cloud/network/ExternalIpAddressAllocator.java index 3cf358067ee..58b30f4d57b 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"); } } diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index d7a85b6ff4f..81b9bb1a622 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 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); diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index e7a928acfdb..5ff548c7f3e 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("\\\\" ,"/" ); diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java index 3389d92752f..cc788c7b118 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 {