INTERNAL: refactor DAResult (enum -> class) 57/40757/1
authorgreatim <jaewon81.lim@samsung.com>
Mon, 8 Jun 2015 17:38:17 +0000 (02:38 +0900)
committergreatim <jaewon81.lim@samsung.com>
Mon, 8 Jun 2015 17:38:17 +0000 (02:38 +0900)
change DAResult to class from enum
DAResult has 'ErrorCode' enum and detail message 'String'

Change-Id: Ia828d6e7737322a62734966003642cd2c6eb1008
Signed-off-by: greatim <jaewon81.lim@samsung.com>
20 files changed:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DALimit.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DAResult.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/control/StartTraceManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/control/StopTraceManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CommonAction.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/ExitHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/ReplayManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/ProcessInformation.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/p30/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/p40/Communicator40.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/DataChannelThread.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/HeartBeatThread.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogBinarySettingsPage.java

index e058868..4cd9fd6 100644 (file)
@@ -25,6 +25,7 @@
 
 package org.tizen.dynamicanalyzer.common;
 
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
@@ -80,7 +81,7 @@ public class DALimit {
                        return;
                }
 
-               DAResult result = DAResult.ERR_OUT_OF_MEMORY;
+               DAResult result = new DAResult(ErrorCode.ERR_OUT_OF_MEMORY);
                result.setDetailMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
                                + PathManager.DA_INSTALL_PATH + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
                CommandAction.stopTrace(result, false);
index b5df592..e4d8e15 100755 (executable)
@@ -28,81 +28,101 @@ package org.tizen.dynamicanalyzer.common;
 import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
 import org.tizen.dynamicanalyzer.util.Logger;
 
-public enum DAResult {
-       SUCCESS(0, "Success!"),
-       ERR_EXCEPTION_OCCURRED(-1, "Excpetion is occurred "),
-
-       // error that is not shown to the user (3 digits) ( -100 ~ -999 )
-       ERR_INVALID_VERSION(-100, "not supported version"),
-       ERR_REMOTE_PORT_GET_FAILED(-101, "remote port get failed!!"),
-       ERR_CONTROL_SOCKET_CREATION_FAIL(-102, "control socket creation is failed"),
-       ERR_DATA_SOCKET_CREATION_FAIL(-103, "data socket creation is failed"),
-       ERR_CONTROL_SOCKET_CONNECTION_CLOSED(-104, "connection closed"),
-       ERR_PROTOCOL_NOT_SUPPORTED(-105, "procotol is not supported"),
-       ERR_FILE_IS_NOT_EXISTS(-201, "File is not exist!"),
-       ERR_UPLOAD_FILE_FAILED(-202, "file upload is failed!"),
-       ERR_SDB_PUSH_FAILED(-203, "sdb push returns null"),
-       ERR_READELF_SIZE_GET_FAILED(-204, "readelf size get failed"),
-       ERR_READELF_UPLOAD_FAILED(-205, "readelf file size is different!!"),
-       ERR_MSG_STOP_FAIL(-502, "stop message is not ok"),
-       ERR_MSG_RUNTIME_FAIL(-503, "runtime message is not ok"),
-       ERR_TARGET_INFO_GET_FAIL(-505, "target info get fail..."),
-       ERR_KEEP_ALIVE(-506, "keep alive message ack fail..."),
-       ERR_RECEIVE_ACK_FAIL(-508, "receiving ack message fail..."),
-       ERR_PROCESS_ADD_INFO_GET_FAIL(-509, "failed to get process add info..."),
-       ERR_SWAP_INSTRUMENTATION_FAIL(-510, "failed to instrument..."),
-       ERR_DA_IS_EXIT(-901, "Dynamic Analyzer is closing"),
-
-       // error that is shown to the user (4 digits) ( -1000 ~ -9999 )
-       ERR_OUT_OF_MEMORY(-1001, UserErrorWarningLabels.ERROR_OUT_OF_MEMORY),
-       ERR_NO_DEVICE(-1010, UserErrorWarningLabels.ERROR_DEVICE_NOT_FOUND),
-       ERR_DISCONNECTED(-1011, UserErrorWarningLabels.ERROR_DEVICE_CONNECTION),
-       ERR_NO_APP(-1020, UserErrorWarningLabels.ERROR_NONEXIST_APPLICATION),
-       ERR_INVALID_APP(-1021, UserErrorWarningLabels.ERROR_UNSUPPORTED_APPLICATION),
-       ERR_BY_SECURITY(-1030, UserErrorWarningLabels.ERROR_BY_SECURITY_REASON),
-       ERR_BY_USER_CANCEL(-1031, UserErrorWarningLabels.WARNING_USER_CANCEL),
-       ERR_CONFIG_FAILED(-1100, UserErrorWarningLabels.ERROR_CONFIGURATION_FAILED),
-       ERR_LIB_NOTFOUND_INRPM(-1101, UserErrorWarningLabels.ERROR_LIB_NOT_FOUND_INRPM),
-       ERR_RPM_NOTFOUND(-1102, UserErrorWarningLabels.ERROR_RPM_NOT_FOUND),
-       ERR_START_DATA_CHANNEL(-2001, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_START_MESSAGE_PARSER(-2002, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_START_LOG_PARSER(-2003, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_STOP_DATA_CHANNEL(-2004, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_STOP_MESSAGE_PARSER(-2005, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_STOP_LOG_PARSER(-2006, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_CONTINUITY_BROKEN(-2010, UserErrorWarningLabels.WARNING_OVERHEAD_EXPLODE),
-       ERR_WRONG_MESSAGE_FORMAT(-2011, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_DATA_SOCKET_CLOSED(-2012, UserErrorWarningLabels.ERROR_CONNECTION_CLOSED),
-       ERR_DOWNLOAD_FILE_FAILED(-2013, UserErrorWarningLabels.ERROR_DOWNLOAD_FILE_FAILED),
-
-       ERR_MSG_START_FAIL(-2101, UserErrorWarningLabels.ERROR_START_TRACE_FAILED),
-       ERR_MSG_SEND_FAIL(-2102, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
-       ERR_BIN_INFO_GET_FAIL(-2103, UserErrorWarningLabels.ERROR_FAILED_OPERATION),
-       ERR_SCREENSHOT_GET_FAIL(-2104, UserErrorWarningLabels.ERROR_SCREENSHOT_FAILED),
-
-       ERR_UNKNOWN(-9999, UserErrorWarningLabels.ERROR_BY_UNKNOWN_REASON);
-
-       private final int errNo;
-       private final String errMsg;
+public class DAResult {
+       public enum ErrorCode {
+               SUCCESS(0, "Success!"),
+               ERR_EXCEPTION_OCCURRED(-1, "Excpetion is occurred "),
+
+               // error that is not shown to the user (3 digits) ( -100 ~ -999 )
+               ERR_INVALID_VERSION(-100, "not supported version"),
+               ERR_REMOTE_PORT_GET_FAILED(-101, "remote port get failed!!"),
+               ERR_CONTROL_SOCKET_CREATION_FAIL(-102, "control socket creation is failed"),
+               ERR_DATA_SOCKET_CREATION_FAIL(-103, "data socket creation is failed"),
+               ERR_CONTROL_SOCKET_CONNECTION_CLOSED(-104, "connection closed"),
+               ERR_PROTOCOL_NOT_SUPPORTED(-105, "procotol is not supported"),
+               ERR_FILE_IS_NOT_EXISTS(-201, "File is not exist!"),
+               ERR_UPLOAD_FILE_FAILED(-202, "file upload is failed!"),
+               ERR_SDB_PUSH_FAILED(-203, "sdb push returns null"),
+               ERR_READELF_SIZE_GET_FAILED(-204, "readelf size get failed"),
+               ERR_READELF_UPLOAD_FAILED(-205, "readelf file size is different!!"),
+               ERR_MSG_STOP_FAIL(-502, "stop message is not ok"),
+               ERR_MSG_RUNTIME_FAIL(-503, "runtime message is not ok"),
+               ERR_TARGET_INFO_GET_FAIL(-505, "target info get fail..."),
+               ERR_KEEP_ALIVE(-506, "keep alive message ack fail..."),
+               ERR_RECEIVE_ACK_FAIL(-508, "receiving ack message fail..."),
+               ERR_PROCESS_ADD_INFO_GET_FAIL(-509, "failed to get process add info..."),
+               ERR_SWAP_INSTRUMENTATION_FAIL(-510, "failed to instrument..."),
+               ERR_DA_IS_EXIT(-901, "Dynamic Analyzer is closing"),
+
+               // error that is shown to the user (4 digits) ( -1000 ~ -9999 )
+               ERR_OUT_OF_MEMORY(-1001, UserErrorWarningLabels.ERROR_OUT_OF_MEMORY),
+               ERR_NO_DEVICE(-1010, UserErrorWarningLabels.ERROR_DEVICE_NOT_FOUND),
+               ERR_DISCONNECTED(-1011, UserErrorWarningLabels.ERROR_DEVICE_CONNECTION),
+               ERR_NO_APP(-1020, UserErrorWarningLabels.ERROR_NONEXIST_APPLICATION),
+               ERR_INVALID_APP(-1021, UserErrorWarningLabels.ERROR_UNSUPPORTED_APPLICATION),
+               ERR_BY_SECURITY(-1030, UserErrorWarningLabels.ERROR_BY_SECURITY_REASON),
+               ERR_BY_USER_CANCEL(-1031, UserErrorWarningLabels.WARNING_USER_CANCEL),
+               ERR_CONFIG_FAILED(-1100, UserErrorWarningLabels.ERROR_CONFIGURATION_FAILED),
+               ERR_LIB_NOTFOUND_INRPM(-1101, UserErrorWarningLabels.ERROR_LIB_NOT_FOUND_INRPM),
+               ERR_RPM_NOTFOUND(-1102, UserErrorWarningLabels.ERROR_RPM_NOT_FOUND),
+               ERR_START_DATA_CHANNEL(-2001, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_START_MESSAGE_PARSER(-2002, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_START_LOG_PARSER(-2003, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_STOP_DATA_CHANNEL(-2004, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_STOP_MESSAGE_PARSER(-2005, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_STOP_LOG_PARSER(-2006, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_CONTINUITY_BROKEN(-2010, UserErrorWarningLabels.WARNING_OVERHEAD_EXPLODE),
+               ERR_WRONG_MESSAGE_FORMAT(-2011, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_DATA_SOCKET_CLOSED(-2012, UserErrorWarningLabels.ERROR_CONNECTION_CLOSED),
+               ERR_DOWNLOAD_FILE_FAILED(-2013, UserErrorWarningLabels.ERROR_DOWNLOAD_FILE_FAILED),
+
+               ERR_MSG_START_FAIL(-2101, UserErrorWarningLabels.ERROR_START_TRACE_FAILED),
+               ERR_MSG_SEND_FAIL(-2102, UserErrorWarningLabels.ERROR_INTERNAL_REASON),
+               ERR_BIN_INFO_GET_FAIL(-2103, UserErrorWarningLabels.ERROR_FAILED_OPERATION),
+               ERR_SCREENSHOT_GET_FAIL(-2104, UserErrorWarningLabels.ERROR_SCREENSHOT_FAILED),
+
+               ERR_UNKNOWN(-9999, UserErrorWarningLabels.ERROR_BY_UNKNOWN_REASON);
+
+               private final int errNumber;
+               private final String errMessage;
+
+               private ErrorCode(int num, String msg) {
+                       this.errNumber = num;
+                       this.errMessage = msg;
+               }
+
+               public int getErrorNumber() {
+                       return this.errNumber;
+               }
+
+               public String getErrorMessage() {
+                       return this.errMessage;
+               }
+       }
+
+       private ErrorCode errCode;
        private String detailMsg;
 
-       private DAResult(int num, String msg) {
-               errNo = num;
-               errMsg = msg;
-               detailMsg = null;
+       public DAResult(ErrorCode code) {
+               this.errCode = code;
+               this.detailMsg = null;
        }
 
-       public DAResult reset() {
-               detailMsg = null;
-               return this;
+       public DAResult(ErrorCode code, String msg) {
+               this.errCode = code;
+               this.detailMsg = msg;
        }
 
        public int getErrorNumber() {
-               return errNo;
+               return errCode.getErrorNumber();
+       }
+
+       public void setDetailMessage(String message) {
+               this.detailMsg = message;
        }
 
        public String getMessage() {
-               StringBuffer message = new StringBuffer(errMsg);
+               StringBuffer message = new StringBuffer(errCode.getErrorMessage());
                if (null != detailMsg) {
                        message.append("\n");
                        message.append(detailMsg);
@@ -111,26 +131,16 @@ public enum DAResult {
                return message.toString();
        }
 
-       public static DAResult getDAResult(int num) {
-               DAResult[] errors = values();
-               for (int i = 0; i < errors.length; i++) {
-                       if (errors[i].getErrorNumber() == num) {
-                               return errors[i];
-                       }
-               }
-               return DAResult.ERR_UNKNOWN;
-       }
-
        @Override
        public String toString() {
                StringBuffer str = new StringBuffer();
 
-               if (0 != errNo) {
+               if (errCode != ErrorCode.SUCCESS) {
                        str.append("[ERROR : ");
                } else {
                        str.append("[SUCCESS : ");
                }
-               str.append(errMsg + "]");
+               str.append(errCode.errMessage + "]");
                if (null != detailMsg) {
                        str.append("\n[DETAIL : ");
                        str.append(detailMsg + "]");
@@ -138,27 +148,29 @@ public enum DAResult {
                return str.toString();
        }
 
-       /**
-        * Set detail error message for give error code.<br/>
-        * Do not set detail message for DAResult.SUCCESS
-        * 
-        * @param message
-        *            detail message for error code
-        */
-       public void setDetailMessage(String message) {
-               this.detailMsg = message;
-       }
-
-       public boolean equals(DAResult target) {
-               if (target.getErrorNumber() != errNo) {
-                       return false;
+       @Override
+       public boolean equals(Object target) {
+               if (target instanceof DAResult) {
+                       DAResult res = (DAResult) target;
+                       if (res.errCode == this.errCode) {
+                               return true;
+                       } else {
+                               return false;
+                       }
+               } else if (target instanceof ErrorCode) {
+                       ErrorCode code = (ErrorCode) target;
+                       if (code == this.errCode) {
+                               return true;
+                       } else {
+                               return false;
+                       }
                } else {
-                       return true;
+                       return false;
                }
        }
 
        public boolean isSuccess() {
-               if (this.errNo == SUCCESS.errNo) {
+               if (this.errCode == ErrorCode.SUCCESS) {
                        return true;
                } else {
                        return false;
@@ -182,12 +194,12 @@ public enum DAResult {
        public void printDebug() {
                String method = getMethodName(2) + "()";
                StringBuffer str = new StringBuffer();
-               if (0 != errNo) {
+               if (errCode != ErrorCode.SUCCESS) {
                        str.append("[ERROR : ");
                } else {
                        str.append("[SUCCESS : ");
                }
-               str.append(errMsg + "   ");
+               str.append(errCode.errMessage + "   ");
                if (null != method) {
                        str.append("METHOD : " + method + " ]");
                }
index 0ffda36..6ec63a1 100644 (file)
@@ -41,6 +41,7 @@ import java.util.List;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.protocol.DebugLog;
 import org.tizen.dynamicanalyzer.protocol.ProtocolConstants;
@@ -96,7 +97,7 @@ public class BaseCommunicator {
        }
 
        public DAResult connect() {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
 
                try {
                        // open debug writer
@@ -136,7 +137,7 @@ public class BaseCommunicator {
                        result = createControlSocket();
                        if (!result.isSuccess()) {
                                Logger.warning(result.toString());
-                               result = DAResult.ERR_CONTROL_SOCKET_CREATION_FAIL;
+                               result = new DAResult(ErrorCode.ERR_CONTROL_SOCKET_CREATION_FAIL);
                                return result;
                        }
 
@@ -144,7 +145,7 @@ public class BaseCommunicator {
                        protocolVersion = checkVersion();
                        if (protocolVersion == null || protocolVersion.isEmpty()) {
                                Logger.error("Failed to get version of protocol");
-                               result = DAResult.ERR_INVALID_VERSION;
+                               result = new DAResult(ErrorCode.ERR_INVALID_VERSION);
                                return result;
                        }
 
@@ -200,11 +201,11 @@ public class BaseCommunicator {
                // close debug writer
                DebugLog.closeControlChannelWriter();
 
-               return DAResult.SUCCESS;
+               return new DAResult(ErrorCode.SUCCESS);
        }
 
        private DAResult getRemotePort() {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
                final List<String> portLines = new ArrayList<String>();
 
                long start = System.currentTimeMillis();
@@ -244,7 +245,7 @@ public class BaseCommunicator {
 
                if (remotePort < 0) {
                        Logger.error("!!failed to get port number of da manager!!");
-                       result = DAResult.ERR_REMOTE_PORT_GET_FAILED;
+                       result = new DAResult(ErrorCode.ERR_REMOTE_PORT_GET_FAILED);
                } else {
                        Logger.debug("!!port number is obtained successfully!! : " + remotePort);
                }
@@ -253,7 +254,7 @@ public class BaseCommunicator {
        }
 
        private DAResult createControlSocket() {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
                Socket sock = null;
                try {
                        sock = new Socket(CommonConstants.LOCAL_HOST, localPort);
@@ -261,15 +262,15 @@ public class BaseCommunicator {
                        sock.setReuseAddress(true);
                        sock.setTcpNoDelay(true);
                } catch (UnknownHostException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                } catch (SocketException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                } catch (IOException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                }
@@ -347,7 +348,7 @@ public class BaseCommunicator {
        }
 
        private DAResult makeSubCommunicator() {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
 
                if (VERSION40.equals(protocolVersion)) {
                        subCommunicator = new Communicator40(this);
@@ -355,7 +356,7 @@ public class BaseCommunicator {
                        subCommunicator = new Communicator30(this);
                } else {
                        // unknown version
-                       result = DAResult.ERR_INVALID_VERSION;
+                       result = new DAResult(ErrorCode.ERR_INVALID_VERSION);
                }
 
                return result;
index 2394235..48682f6 100755 (executable)
@@ -34,6 +34,7 @@ import java.net.ServerSocket;
 import org.tizen.common.sdb.command.SdbCommand;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.IShellOutputReceiver;
@@ -149,38 +150,38 @@ public class CommunicatorUtils {
        }
 
        public static DAResult forward(IDevice device, int local, int remote) {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
                if (null != device && isOnline(device)) {
                        try {
                                device.createForward(local, remote);
                                Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
                        } catch (TimeoutException e) {
                                Logger.exception(e);
-                               result = DAResult.ERR_EXCEPTION_OCCURRED;
+                               result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                                result.setDetailMessage(e.getMessage());
                        } catch (SdbCommandRejectedException e) {
                                Logger.exception(e);
-                               result = DAResult.ERR_EXCEPTION_OCCURRED;
+                               result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                                result.setDetailMessage(e.getMessage());
                        } catch (IOException e) {
                                Logger.exception(e);
-                               result = DAResult.ERR_EXCEPTION_OCCURRED;
+                               result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                                result.setDetailMessage(e.getMessage());
                        } catch (InterruptedException e) {
                                Logger.exception(e);
-                               result = DAResult.ERR_EXCEPTION_OCCURRED;
+                               result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                                result.setDetailMessage(e.getMessage());
                        } catch (NullPointerException e) {
                                Logger.exception(e);
-                               result = DAResult.ERR_EXCEPTION_OCCURRED;
+                               result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                                result.setDetailMessage(e.getMessage());
                        }
                } else if (null == device) {
-                       result = DAResult.ERR_NO_DEVICE;
+                       result = new DAResult(ErrorCode.ERR_NO_DEVICE);
                } else if (!isOnline(device)) {
-                       result = DAResult.ERR_DISCONNECTED;
+                       result = new DAResult(ErrorCode.ERR_DISCONNECTED);
                } else {
-                       result = DAResult.ERR_UNKNOWN;
+                       result = new DAResult(ErrorCode.ERR_UNKNOWN);
                }
                return result;
        }
index 4e7c5bf..59b72e9 100644 (file)
@@ -37,6 +37,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
 import org.tizen.dynamicanalyzer.common.DALimit;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.path.PathConstants;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
@@ -67,9 +68,9 @@ public class DACommunicator {
                if (device != null) {
                        CommunicatorUtils.execShellCommand(device.getIDevice(),
                                        AnalyzerShellCommands.CMD_REMOVE + CommonConstants.SPACE + path);
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -78,12 +79,12 @@ public class DACommunicator {
                if (device != null) {
                        SyncResult res = CommunicatorUtils.pull(device.getIDevice(), from, to);
                        if (null != res && res.isOk()) {
-                               return DAResult.SUCCESS;
+                               return new DAResult(ErrorCode.SUCCESS);
                        } else {
-                               return DAResult.ERR_DOWNLOAD_FILE_FAILED;
+                               return new DAResult(ErrorCode.ERR_DOWNLOAD_FILE_FAILED);
                        }
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -338,10 +339,10 @@ public class DACommunicator {
                        } catch (UnsupportedProtocolException e) {
                                // never happened currently
                                Logger.error("It is not supported to send start trace message by communicator");
-                               return DAResult.ERR_PROTOCOL_NOT_SUPPORTED;
+                               return new DAResult(ErrorCode.ERR_PROTOCOL_NOT_SUPPORTED);
                        }
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -353,10 +354,10 @@ public class DACommunicator {
                        } catch (UnsupportedProtocolException e) {
                                // never happened currently
                                Logger.error("It is not supported to send stop trace message by communicator");
-                               return DAResult.ERR_PROTOCOL_NOT_SUPPORTED;
+                               return new DAResult(ErrorCode.ERR_PROTOCOL_NOT_SUPPORTED);
                        }
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -368,10 +369,10 @@ public class DACommunicator {
                        } catch (UnsupportedProtocolException e) {
                                // never happened currently
                                Logger.error("It is not supported to send configuration message by communicator");
-                               return DAResult.ERR_PROTOCOL_NOT_SUPPORTED;
+                               return new DAResult(ErrorCode.ERR_PROTOCOL_NOT_SUPPORTED);
                        }
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -381,7 +382,7 @@ public class DACommunicator {
                if (curDev != null) {
                        return curDev.getCommunicator().getSubCommunicator().sendBinaryInfoMessage(null, paths);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -392,7 +393,7 @@ public class DACommunicator {
                        return curDev.getCommunicator().getSubCommunicator()
                                        .sendInstrumentAddMessage(null, paths);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -403,7 +404,7 @@ public class DACommunicator {
                        return curDev.getCommunicator().getSubCommunicator()
                                        .sendInstrumentRemoveMessage(null, paths);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -415,7 +416,7 @@ public class DACommunicator {
                        return curDev.getCommunicator().getSubCommunicator()
                                        .sendProcessAddInfoMessage(null, pids, infoMap);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 
@@ -425,7 +426,7 @@ public class DACommunicator {
                if (curDev != null) {
                        return curDev.getCommunicator().getSubCommunicator().sendScreenshotMessage(null);
                } else {
-                       return DAResult.ERR_NO_DEVICE;
+                       return new DAResult(ErrorCode.ERR_NO_DEVICE);
                }
        }
 }
index 73b1340..965bcd1 100644 (file)
@@ -49,6 +49,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.handlers.CommandAction;
@@ -318,7 +319,7 @@ public class IDECommunicator implements Runnable {
                BinarySettingManager.getInstance().addBinarySettingData(addBinData);
                BinarySettingManager.getInstance().checkSourcePath(addBinData);
 
-               DAResult result = DAResult.ERR_BIN_INFO_GET_FAIL;
+               DAResult result = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                try {
                        result = DACommunicator.getBinaryInformation(addBinPath);
                        DACommunicator.addInstrumentation(addBinPath);
index 2bdaf98..a37ecbf 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.DAState;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
@@ -115,25 +116,25 @@ public class StartTraceManager implements Runnable {
 
        @Override
        public void run() {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
 
                try {
                        startThread = Thread.currentThread();
 
                        if (!CommonAction.checkDeviceValidness()) {
-                               result = DAResult.ERR_DISCONNECTED;
+                               result = new DAResult(ErrorCode.ERR_DISCONNECTED);
                                return;
                        }
                        setStageComplete(STAGE.CHECK_DEV);
 
                        if (!CommonAction.checkApplicationValidness()) {
-                               result = DAResult.ERR_INVALID_APP;
+                               result = new DAResult(ErrorCode.ERR_INVALID_APP);
                                return;
                        }
                        setStageComplete(STAGE.CHECK_APP);
 
                        if (!CommonAction.checkConfiguration()) {
-                               result = DAResult.ERR_CONFIG_FAILED;
+                               result = new DAResult(ErrorCode.ERR_CONFIG_FAILED);
                                return;
                        }
                        setStageComplete(STAGE.CHECK_CONFIG);
@@ -152,7 +153,7 @@ public class StartTraceManager implements Runnable {
                        // start data receive thread
                        if (!DataChannelThread.getInstance().start()) {
                                // failed to start data channel thread
-                               result = DAResult.ERR_START_DATA_CHANNEL;
+                               result = new DAResult(ErrorCode.ERR_START_DATA_CHANNEL);
                                return;
                        }
                        setStageComplete(STAGE.CREATE_DATATHREAD);
@@ -160,7 +161,7 @@ public class StartTraceManager implements Runnable {
                        // start message parser thread
                        if (!MessageParser.getInstance().start()) {
                                // failed to start message parser
-                               result = DAResult.ERR_START_MESSAGE_PARSER;
+                               result = new DAResult(ErrorCode.ERR_START_MESSAGE_PARSER);
                                return;
                        }
                        setStageComplete(STAGE.CREATE_MESSAGEPARSER);
@@ -168,7 +169,7 @@ public class StartTraceManager implements Runnable {
                        // start log parser thread
                        if (!LogParser.getInstance().start()) {
                                // failed to start log parser
-                               result = DAResult.ERR_START_LOG_PARSER;
+                               result = new DAResult(ErrorCode.ERR_START_LOG_PARSER);
                                return;
                        }
                        setStageComplete(STAGE.CREATE_LOGPARSER);
@@ -233,7 +234,7 @@ public class StartTraceManager implements Runnable {
                        // Thread.currentThread().interrupt();
 
                        // set DA state to canceling
-                       result = DAResult.ERR_BY_USER_CANCEL;
+                       result = new DAResult(ErrorCode.ERR_BY_USER_CANCEL);
                } finally {
                        // set DA state as result of start progress
                        if (lastStage != STAGE.FINAL) {
index 5b30752..18e753a 100644 (file)
@@ -126,7 +126,7 @@ public class StopTraceManager implements Runnable {
                        setStageComplete(STAGE.STOP_UPDATE_TIMER);
 
                        // if error code equals with canceling then stop threads by force
-                       if (error.equals(DAResult.ERR_BY_USER_CANCEL)) {
+                       if (error.equals(DAResult.ErrorCode.ERR_BY_USER_CANCEL)) {
                                // stop data channel
                                DataChannelThread.getInstance().stopForced();
                                setStageComplete(STAGE.STOP_DATATHREAD);
@@ -193,7 +193,7 @@ public class StopTraceManager implements Runnable {
 
                        // close progress dialog if not error case
                        if (progressDlg != null) {
-                               if (error.isSuccess() || error.equals(DAResult.ERR_BY_USER_CANCEL)) {
+                               if (error.isSuccess() || error.equals(DAResult.ErrorCode.ERR_BY_USER_CANCEL)) {
                                        Display.getDefault().syncExec(new Runnable() {
                                                @Override
                                                public void run() {
index 5a36fd5..7572095 100644 (file)
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.DeviceInfo;
 import org.tizen.dynamicanalyzer.communicator.DeviceManager;
@@ -60,7 +61,7 @@ public class CommonAction {
                                result = DACommunicator.configure();
                        } catch (InterruptedException e) {
                                Logger.error("Interrupted during send configuration message");
-                               result = DAResult.ERR_CONFIG_FAILED;
+                               result = new DAResult(ErrorCode.ERR_CONFIG_FAILED);
                        }
 
                        // check result
index 57be84a..f7cb1c4 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.DeviceManager;
 import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
@@ -44,7 +45,7 @@ public class ExitHandler extends AbstractHandler {
        public Object execute(ExecutionEvent event) throws ExecutionException {
                AnalyzerManager.setExit(true);
 
-               CommandAction.stopTrace(DAResult.ERR_BY_USER_CANCEL, false);
+               CommandAction.stopTrace(new DAResult(ErrorCode.ERR_BY_USER_CANCEL), false);
 
                SideWorker.stop();
                IDECommunicator.stopIDEcommunicatorThread();
index bb8ddd6..ba3e83c 100644 (file)
@@ -29,6 +29,7 @@ package org.tizen.dynamicanalyzer.handlers;
 
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.model.DATime;
 import org.tizen.dynamicanalyzer.setting.Feature;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
@@ -50,12 +51,11 @@ public class ReplayManager {
        }
 
        public static void setStopAlarm() {
-               if (isReplay
-                               && SettingDataManager.INSTANCE.isOptionsSelectedFeature(Feature.AUTO_STOP)) {
+               if (isReplay && SettingDataManager.INSTANCE.isOptionsSelectedFeature(Feature.AUTO_STOP)) {
                        Toolbar.INSTANCE.setTimerAlarm(stopTime, new IAlarm() {
                                @Override
                                public void action() {
-                                       CommandAction.stopTrace(DAResult.SUCCESS, false);
+                                       CommandAction.stopTrace(new DAResult(ErrorCode.SUCCESS), false);
                                        reset();
                                }
                        });
index 2138ac4..1544fa0 100644 (file)
@@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.ProcessAdditionalInfo;
 import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
@@ -102,7 +103,7 @@ public class ProcessInformation {
                                pids.add(Integer.valueOf(pid));
                                Map<Integer, ProcessAdditionalInfo> infoMap = new HashMap<Integer, ProcessAdditionalInfo>();
 
-                               DAResult result = DAResult.ERR_PROCESS_ADD_INFO_GET_FAIL;
+                               DAResult result = new DAResult(ErrorCode.ERR_PROCESS_ADD_INFO_GET_FAIL);
                                try {
                                        result = DACommunicator.getProcessAdditionalInfo(pids, infoMap);
                                } catch (InterruptedException e) {
index 5f5df3c..3cba5f2 100644 (file)
@@ -46,6 +46,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.ElfSymbolExtractor;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
@@ -104,7 +105,7 @@ public class Communicator30 extends SubCommunicator {
                result = createDataSocket(localPort);
                if (!result.isSuccess()) {
                        Logger.warning(result.toString());
-                       return DAResult.ERR_DATA_SOCKET_CREATION_FAIL;
+                       return new DAResult(ErrorCode.ERR_DATA_SOCKET_CREATION_FAIL);
                }
 
                // get target information
@@ -138,11 +139,11 @@ public class Communicator30 extends SubCommunicator {
                        }
                }
 
-               return DAResult.SUCCESS;
+               return new DAResult(ErrorCode.SUCCESS);
        }
 
        protected DAResult createDataSocket(int localPort) {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
                Socket dataSock = null;
                try {
                        dataSock = new Socket(CommonConstants.LOCAL_HOST, localPort);
@@ -150,15 +151,15 @@ public class Communicator30 extends SubCommunicator {
                        dataSock.setReuseAddress(true);
                        dataSock.setTcpNoDelay(true);
                } catch (UnknownHostException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                } catch (SocketException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                } catch (IOException e) {
-                       result = DAResult.ERR_EXCEPTION_OCCURRED;
+                       result = new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED);
                        result.setDetailMessage(e.getMessage());
                        Logger.exception(e);
                }
@@ -211,11 +212,11 @@ public class Communicator30 extends SubCommunicator {
                                }
                                tInfo.setDevices(deviceList);
 
-                               return DAResult.SUCCESS;
+                               return new DAResult(ErrorCode.SUCCESS);
                        }
                }
 
-               return DAResult.ERR_TARGET_INFO_GET_FAIL;
+               return new DAResult(ErrorCode.ERR_TARGET_INFO_GET_FAIL);
        }
 
        protected Map<Integer, String> getApiMap() {
@@ -284,9 +285,9 @@ public class Communicator30 extends SubCommunicator {
 
                if (result != null && result.isSuccess()
                                && result.isCorrectID(ProtocolConstant30.MSG_CONFIG_ACK)) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_CONFIG_FAILED;
+                       return new DAResult(ErrorCode.ERR_CONFIG_FAILED);
                }
        }
 
@@ -298,7 +299,7 @@ public class Communicator30 extends SubCommunicator {
                // serialize application inst.
                if (!serializeApplicationInst(ps)) {
                        Logger.error("cannot get application inst");
-                       return DAResult.ERR_MSG_START_FAIL;
+                       return new DAResult(ErrorCode.ERR_MSG_START_FAIL);
                }
 
                // serialize the replay data
@@ -320,9 +321,9 @@ public class Communicator30 extends SubCommunicator {
                                AnalyzerManager.waitStartAck.notifyAll();
                        }
 
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_MSG_START_FAIL;
+                       return new DAResult(ErrorCode.ERR_MSG_START_FAIL);
                }
        }
 
@@ -502,9 +503,9 @@ public class Communicator30 extends SubCommunicator {
                AckMessage result = parent.handleControlMessage(msg);
                if (result != null && result.isSuccess()
                                && result.isCorrectID(ProtocolConstant30.MSG_STOP_ACK)) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_MSG_STOP_FAIL;
+                       return new DAResult(ErrorCode.ERR_MSG_STOP_FAIL);
                }
        }
 
@@ -556,7 +557,7 @@ public class Communicator30 extends SubCommunicator {
 
                if (libInstList.isEmpty()) {
                        Logger.warning("Failed to send instrumentation : there is no available binary");
-                       return DAResult.ERR_SWAP_INSTRUMENTATION_FAIL;
+                       return new DAResult(ErrorCode.ERR_SWAP_INSTRUMENTATION_FAIL);
                }
 
                // serialize library inst. count
@@ -580,9 +581,9 @@ public class Communicator30 extends SubCommunicator {
                }
 
                if (result != null && result.isCorrectID(ackMsg) && result.isSuccess()) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_SWAP_INSTRUMENTATION_FAIL;
+                       return new DAResult(ErrorCode.ERR_SWAP_INSTRUMENTATION_FAIL);
                }
        }
 
@@ -615,11 +616,11 @@ public class Communicator30 extends SubCommunicator {
                        }
                }
 
-               return DAResult.ERR_BIN_INFO_GET_FAIL.reset();
+               return new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
        }
 
        protected DAResult parseBinaryInfo(byte[] payload, List<String> targetPaths) {
-               DAResult ret = DAResult.SUCCESS;
+               DAResult ret = new DAResult(ErrorCode.SUCCESS);
                StringBuffer detailErrorMsg = new StringBuffer();
 
                ProtocolParser parser = new ProtocolParser(payload);
@@ -655,7 +656,7 @@ public class Communicator30 extends SubCommunicator {
                                                        + targetPath + ")");
                                }
 
-                               ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               ret = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                                continue;
                        }
 
@@ -666,7 +667,7 @@ public class Communicator30 extends SubCommunicator {
                                }
                                detailErrorMsg.append(result.getMessage());
 
-                               ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               ret = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                        }
                }
 
@@ -678,7 +679,7 @@ public class Communicator30 extends SubCommunicator {
        }
 
        protected DAResult checkDirtyOfBinary(BinaryInfo binInfo, String localBinaryPath) {
-               DAResult result = DAResult.SUCCESS;
+               DAResult result = new DAResult(ErrorCode.SUCCESS);
                String targetPath = binInfo.getTargetBinaryPath();
 
                String[] splitLocalBinaryPath = localBinaryPath.split(Pattern.quote(File.separator));
@@ -741,16 +742,16 @@ public class Communicator30 extends SubCommunicator {
                DeviceInfo curDev = parent.getDevice();
 
                if (!CommunicatorUtils.becomeSuperUser(curDev.getIDevice())) {
-                       return DAResult.ERR_BY_SECURITY;
+                       return new DAResult(ErrorCode.ERR_BY_SECURITY);
                }
 
                SyncResult res = CommunicatorUtils.pull(curDev.getIDevice(), from, to);
                if (null != res && res.isOk()) {
                        Logger.debug("binary copy success : " + from);//$NON-NLS-1$ 
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
                        Logger.debug("Failed to get " + from); //$NON-NLS-1$ 
-                       return DAResult.ERR_DOWNLOAD_FILE_FAILED;
+                       return new DAResult(ErrorCode.ERR_DOWNLOAD_FILE_FAILED);
                }
        }
 
@@ -805,9 +806,9 @@ public class Communicator30 extends SubCommunicator {
                AckMessage result = parent.handleControlMessage(msg);
                if (result != null && result.isCorrectID(ProtocolConstant30.MSG_KEEP_ALIVE_ACK)
                                && result.isSuccess()) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_KEEP_ALIVE;
+                       return new DAResult(ErrorCode.ERR_KEEP_ALIVE);
                }
        }
 
@@ -877,9 +878,9 @@ public class Communicator30 extends SubCommunicator {
 
                AckMessage result = parent.handleControlMessage(msg, 0, false);
                if (result != null && result.isSuccess()) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_SCREENSHOT_GET_FAIL;
+                       return new DAResult(ErrorCode.ERR_SCREENSHOT_GET_FAIL);
                }
        }
 
@@ -923,9 +924,9 @@ public class Communicator30 extends SubCommunicator {
                }
 
                if (infoMap.isEmpty()) {
-                       return DAResult.ERR_PROCESS_ADD_INFO_GET_FAIL;
+                       return new DAResult(ErrorCode.ERR_PROCESS_ADD_INFO_GET_FAIL);
                } else {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                }
        }
 
index d131f77..6e4d756 100644 (file)
@@ -36,6 +36,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.communicator.AckMessage;
 import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
@@ -76,7 +77,7 @@ public class Communicator40 extends Communicator30 {
                result = createDataSocket(localPort);
                if (!result.isSuccess()) {
                        Logger.warning(result.toString());
-                       return DAResult.ERR_DATA_SOCKET_CREATION_FAIL;
+                       return new DAResult(ErrorCode.ERR_DATA_SOCKET_CREATION_FAIL);
                }
 
                // get target information
@@ -138,9 +139,9 @@ public class Communicator40 extends Communicator30 {
 
                if (result != null && result.isSuccess()
                                && result.isCorrectID(ProtocolConstant40.MSG_CONFIG_ACK)) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_CONFIG_FAILED;
+                       return new DAResult(ErrorCode.ERR_CONFIG_FAILED);
                }
        }
 
@@ -153,9 +154,9 @@ public class Communicator40 extends Communicator30 {
                AckMessage result = parent.handleControlMessage(msg);
                if (result != null && result.isCorrectID(ProtocolConstant40.MSG_KEEP_ALIVE_ACK)
                                && result.isSuccess()) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_KEEP_ALIVE;
+                       return new DAResult(ErrorCode.ERR_KEEP_ALIVE);
                }
        }
 
@@ -169,9 +170,9 @@ public class Communicator40 extends Communicator30 {
                AckMessage result = parent.handleControlMessage(msg, 0);
                if (result != null && result.isSuccess()
                                && result.isCorrectID(ProtocolConstant40.MSG_GET_SCREENSHOT_ACK)) {
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_SCREENSHOT_GET_FAIL;
+                       return new DAResult(ErrorCode.ERR_SCREENSHOT_GET_FAIL);
                }
        }
 
@@ -206,9 +207,9 @@ public class Communicator40 extends Communicator30 {
                                }
                        }
 
-                       return DAResult.SUCCESS;
+                       return new DAResult(ErrorCode.SUCCESS);
                } else {
-                       return DAResult.ERR_MSG_SEND_FAIL;
+                       return new DAResult(ErrorCode.ERR_MSG_SEND_FAIL);
                }
        }
 
@@ -407,11 +408,11 @@ public class Communicator40 extends Communicator30 {
                        }
                }
 
-               return DAResult.ERR_BIN_INFO_GET_FAIL.reset();
+               return new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
        }
 
        protected DAResult parseBinaryInfo(byte[] payload) {
-               DAResult ret = DAResult.SUCCESS;
+               DAResult ret = new DAResult(ErrorCode.SUCCESS);
                StringBuffer detailErrorMsg = new StringBuffer();
 
                ProtocolParser parser = new ProtocolParser(payload);
@@ -447,7 +448,7 @@ public class Communicator40 extends Communicator30 {
                                                        + targetPath + ")");
                                }
 
-                               ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               ret = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                                continue;
                        }
 
@@ -458,7 +459,7 @@ public class Communicator40 extends Communicator30 {
                                }
                                detailErrorMsg.append(result.getMessage());
 
-                               ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               ret = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                        }
                }
 
index 593f8d0..e9b33d4 100644 (file)
@@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.handlers.ReplayManager;
 import org.tizen.dynamicanalyzer.ui.file.FilePage;
@@ -131,7 +132,7 @@ public class ShortCutKeyBindingHandler extends AbstractHandler {
                        if (DAState.isStartable()) {
                                CommandAction.startTrace();
                        } else if (DAState.isRunning()) {
-                               CommandAction.stopTrace(DAResult.SUCCESS, false);
+                               CommandAction.stopTrace(new DAResult(ErrorCode.SUCCESS), false);
                        } else {
                                Logger.error("Wrong shortcut action for starting trace");
                        }
index fb59f3a..b2208e6 100644 (file)
@@ -39,6 +39,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DALimit;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.control.DataThread;
 import org.tizen.dynamicanalyzer.control.SideWorker;
 import org.tizen.dynamicanalyzer.handlers.CommandAction;
@@ -62,7 +63,9 @@ public class DataChannelThread extends DataThread<Object> {
        private int protocolVersion = -1;
 
        private enum STATE {
-               INITIALIZED, ACTIVATED, TERMINATED;
+               INITIALIZED,
+               ACTIVATED,
+               TERMINATED;
        }
 
        private STATE state = STATE.INITIALIZED;
@@ -113,8 +116,8 @@ public class DataChannelThread extends DataThread<Object> {
                // set data socket variable
                dataSocket = Global.getCurrentDeviceInfo().getCommunicator().getSubCommunicator()
                                .getDataSocket(0);
-               protocolVersion = Protocol.getVersionValue(Global.getCurrentDeviceInfo()
-                               .getCommunicator().getProtocolVersion());
+               protocolVersion = Protocol.getVersionValue(Global.getCurrentDeviceInfo().getCommunicator()
+                               .getProtocolVersion());
 
                clearSocketReceiveBuffer();
        }
@@ -212,14 +215,14 @@ public class DataChannelThread extends DataThread<Object> {
 
                                                if (!continuity) {
                                                        // if sequence continuity is broken, then send stop work to side worker
-                                                       notifyStopWork(DAResult.ERR_CONTINUITY_BROKEN);
+                                                       notifyStopWork(new DAResult(ErrorCode.ERR_CONTINUITY_BROKEN));
                                                }
 
                                                // check for payload size
                                                int payloadsize = log.getPayloadSize();
                                                if (payloadsize < 0 || payloadsize > DALimit.MAX_PAYLOAD_SIZE) {
                                                        // wrong message format, stop profiling
-                                                       notifyStopWork(DAResult.ERR_WRONG_MESSAGE_FORMAT);
+                                                       notifyStopWork(new DAResult(ErrorCode.ERR_WRONG_MESSAGE_FORMAT));
                                                        changeToDropMode();
 
                                                        // this means there is no more data to parse, so push EOQ
@@ -266,7 +269,7 @@ public class DataChannelThread extends DataThread<Object> {
                        pushEOQ();
 
                        if (AnalyzerManager.isDataSocketClosed()) {
-                               notifyStopWork(DAResult.ERR_DATA_SOCKET_CLOSED);
+                               notifyStopWork(new DAResult(ErrorCode.ERR_DATA_SOCKET_CLOSED));
                        }
 
                        synchronized (waitObject) {
index 16be679..c789a54 100644 (file)
@@ -30,6 +30,7 @@ import java.util.List;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.communicator.DeviceInfo;
 import org.tizen.dynamicanalyzer.communicator.DeviceManager;
 import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
@@ -51,7 +52,7 @@ public class HeartBeatThread implements Runnable {
                                                result = device.getCommunicator().getSubCommunicator()
                                                                .sendKeepAliveMessage(null);
                                        } catch (UnsupportedProtocolException e) {
-                                               result = DAResult.ERR_PROTOCOL_NOT_SUPPORTED;
+                                               result = new DAResult(ErrorCode.ERR_PROTOCOL_NOT_SUPPORTED);
                                        }
 
                                        if (!result.isSuccess()) {
index ec80526..0703a5f 100644 (file)
@@ -31,6 +31,7 @@ import java.util.List;
 
 import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.common.DAResult;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
@@ -105,7 +106,7 @@ public class BinarySettingProcessor implements Runnable {
                        BinarySettingProgressManager.getInstance().setValue(5);
 
                        // get binary info
-                       DAResult result = DAResult.ERR_BIN_INFO_GET_FAIL;
+                       DAResult result = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                        if (binPaths.size() > 0) {
                                try {
                                        result = DACommunicator.getBinaryInformation(binPaths);
@@ -176,7 +177,7 @@ public class BinarySettingProcessor implements Runnable {
                        }
 
                        if (paths.size() > 0) {
-                               DAResult result = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               DAResult result = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                                try {
                                        result = DACommunicator.getBinaryInformation(paths);
                                } catch (InterruptedException e) {
index f0bd282..4b81215 100755 (executable)
@@ -51,6 +51,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.DeviceInfo;
 import org.tizen.dynamicanalyzer.communicator.DeviceManager;
@@ -337,7 +338,7 @@ public enum Toolbar {
                                if (DAState.isStartable()) {
                                        CommandAction.startTrace();
                                } else if (DAState.isRunning()) {
-                                       CommandAction.stopTrace(DAResult.SUCCESS, false);
+                                       CommandAction.stopTrace(new DAResult(ErrorCode.SUCCESS), false);
                                } else {
                                        Logger.error("Wrong action for start button");
                                }
@@ -1098,7 +1099,7 @@ public enum Toolbar {
                        }
 
                        if (!binPaths.isEmpty()) {
-                               DAResult hr = DAResult.ERR_BIN_INFO_GET_FAIL;
+                               DAResult hr = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                                try {
                                        hr = DACommunicator.getBinaryInformation(binPaths);
                                } catch (InterruptedException e) {
index 14b932e..690d5bf 100644 (file)
@@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.DeviceInfo;
@@ -100,7 +101,7 @@ public class SettingDialogBinarySettingsPage extends DAPageComposite {
                public void handleClickEvent(DACustomButton button) {
                        DeviceInfo curDev = Global.getCurrentDeviceInfo();
                        if (curDev == null) {
-                               UIAction.showWarning(DAResult.ERR_NO_DEVICE, 400, 150);
+                               UIAction.showWarning(new DAResult(ErrorCode.ERR_NO_DEVICE), 400, 150);
                        } else {
                                DeviceExplorerDialog dialog = new DeviceExplorerDialog(getShell(), true);
                                // dialog.setFilter(".so");
@@ -149,7 +150,7 @@ public class SettingDialogBinarySettingsPage extends DAPageComposite {
                public void handleClickEvent(DACustomButton button) {
                        DeviceInfo curDev = Global.getCurrentDeviceInfo();
                        if (curDev == null) {
-                               UIAction.showWarning(DAResult.ERR_NO_DEVICE, 400, 150);
+                               UIAction.showWarning(new DAResult(ErrorCode.ERR_NO_DEVICE), 400, 150);
                                return;
                        }