List of usage examples for java.lang LinkageError toString
public String toString()
From source file:org.hyperic.hq.agent.server.CommandDispatcher.java
/** * Dispatch a method after verifying that the version APIs * match up./* www . j a v a2 s . c o m*/ * * @param cmd Method to invoke * @param inStream Stream which can read from the client * @param outStream Stream which can write to the client * * @return the return value from the dispatched method * @throws AgentRemoteException indicating some error occurred dispatching * the method. */ public AgentRemoteValue processRequest(AgentCommand cmd, InputStream inStream, OutputStream outStream) throws AgentRemoteException { final long start = now(); final String command = cmd.getCommand(); boolean legalCommand = false; try { AgentServerHandler handler; AgentAPIInfo apiInfo; Object val; if ((val = commands.get(cmd.getCommand())) == null) { throw new AgentRemoteException("Unknown command, '" + cmd.getCommand() + "'"); } handler = (AgentServerHandler) val; apiInfo = handler.getAPIInfo(); if (!apiInfo.isCompatible(cmd.getCommandVersion())) { throw new AgentRemoteException( "Client API mismatch: " + cmd.getCommandVersion() + " vs. " + apiInfo.getVersion()); } legalCommand = true; if (log.isDebugEnabled()) { log.debug("processing cmd=" + cmd.getCommand() + ", arg=" + cmd.getCommandArg()); } return handler.dispatchCommand(cmd.getCommand(), cmd.getCommandArg(), inStream, outStream); } catch (AgentRemoteException exc) { throw exc; } catch (Exception exc) { log.error("Error while processing request", exc); throw new AgentRemoteException(exc.toString(), exc); } catch (LinkageError err) { AgentRemoteException e = new AgentRemoteException(err.toString()); e.initCause(err); throw e; } finally { long end = now(); if (legalCommand) { statsCollector.addStat(end - start, COMMAND_DISPATCHER_INCOMING_COMMAND); statsCollector.addStat(end - start, COMMAND_DISPATCHER_INCOMING_COMMAND + "_" + command.toUpperCase()); } else { statsCollector.addStat(1, COMMAND_DISPATCHER_ILLEGAL_COMMAND); } } }