From: <tk...@hy...> - 2008-05-14 06:45:08
|
Author: tkeeney Date: 2008-05-13 23:45:05 -0700 (Tue, 13 May 2008) New Revision: 9519 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=9519 Modified: trunk/src/org/hyperic/hq/agent/client/LegacyAgentCommandsClientImpl.java Log: Fixed the agentSendFileData() command so that it would throw the AgentRemoteException generated on the agent side. Before, it was returning silently. Modified: trunk/src/org/hyperic/hq/agent/client/LegacyAgentCommandsClientImpl.java =================================================================== --- trunk/src/org/hyperic/hq/agent/client/LegacyAgentCommandsClientImpl.java 2008-05-14 06:40:26 UTC (rev 9518) +++ trunk/src/org/hyperic/hq/agent/client/LegacyAgentCommandsClientImpl.java 2008-05-14 06:45:05 UTC (rev 9519) @@ -194,11 +194,25 @@ sPair = this.agentConn.sendCommandHeaders(cmd, this.verAPI.getVersion(), args); - try { - return this.sendData(sPair.getOutputStream(), destFiles, streams); + try { + FileDataResult[] rs = this.sendData(sPair.getOutputStream(), destFiles, streams); + + // this is necessary so that remote exceptions are propagated + // back to the client + this.agentConn.getCommandResult(sPair); + + return rs; } catch(IOException exc){ throw new AgentRemoteException("IO Exception while sending " + "file data: " + exc.getMessage()); + } finally { + // make sure the socket is closed - may not be closed if sendData() + // throws an exception + try { + sPair.close(); + } catch (IOException e) { + // swallow + } } } |