CLOUDSTACK-8656: reporting ignored exceptions in server

This commit is contained in:
Daan Hoogland 2015-08-04 15:50:35 +02:00
parent a0ba7d310e
commit 6fa8b7578e
4 changed files with 11 additions and 14 deletions

View File

@ -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");
}
}

View File

@ -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);

View File

@ -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("\\\\" ,"/" );

View File

@ -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 {