Fix: Java agent protocol network endianness consistency
[lttng-ust.git] / liblttng-ust-java-agent / java / lttng-ust-agent-common / org / lttng / ust / agent / client / SessiondDisableEventCommand.java
index 39d14b0db6e157c6c936c83f5744e51e84bacbbb..2956c7e20363f2cd0cbbe73bfc873453f3ff74b1 100644 (file)
@@ -21,8 +21,6 @@ package org.lttng.ust.agent.client;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-import org.lttng.ust.agent.AbstractLttngAgent;
-
 /**
  * Session daemon command indicating to the Java agent that some events were
  * disabled in the tracing session.
@@ -40,13 +38,24 @@ class SessiondDisableEventCommand implements ISessiondCommand {
                        throw new IllegalArgumentException();
                }
                ByteBuffer buf = ByteBuffer.wrap(data);
-               buf.order(ByteOrder.LITTLE_ENDIAN);
+               buf.order(ByteOrder.BIG_ENDIAN);
                eventName = new String(data).trim();
        }
 
        @Override
-       public ILttngAgentResponse execute(AbstractLttngAgent<?> agent) {
+       public LttngAgentResponse execute(ILttngTcpClientListener agent) {
                boolean success = agent.eventDisabled(this.eventName);
-               return (success ? ILttngAgentResponse.SUCESS_RESPONSE : ILttngAgentResponse.FAILURE_RESPONSE);
+               return (success ? LttngAgentResponse.SUCESS_RESPONSE : DISABLE_EVENT_FAILURE_RESPONSE);
        }
+
+       /**
+        * Response sent when the disable-event command asks to disable an
+        * unknown event.
+        */
+       private static final LttngAgentResponse DISABLE_EVENT_FAILURE_RESPONSE = new LttngAgentResponse() {
+               @Override
+               public ReturnCode getReturnCode() {
+                       return ReturnCode.CODE_UNK_LOGGER_NAME;
+               }
+       };
 }
This page took 0.024514 seconds and 4 git commands to generate.