import org.tizen.dynamicanalyzer.util.Logger;
public enum DAResult {
- SUCCESS(0, "Success!"), ERR_EXCEPTION_OCCURRED(-1, "Excpetion occurred "),
+ SUCCESS(0, "Success!"),
+ ERR_EXCEPTION_OCCURRED(-1, "Excpetion occurred "),
// error that is not shown to the user (3 digits) ( -100 ~ -999 )
ERR_INVALID_VERSION(-100, "not supported version"),
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_DOWNLOAD_FILE_FAILED(-206, "downloading file is failed"),
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_BIN_INFO_GET_FAIL(-507, "binary info get 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_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_MSG_START_FAIL(-2007, UserErrorWarningLabels.ERROR_START_TRACE_FAILED),
- ERR_MSG_SEND_FAIL(-2008, 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;
detailMsg = null;
}
+ public DAResult reset() {
+ detailMsg = null;
+ return this;
+ }
+
public int getErrorNumber() {
return errNo;
}
public String getMessage() {
- if (null == detailMsg) {
- return errMsg;
- } else {
- return detailMsg;
+ StringBuffer message = new StringBuffer(errMsg);
+ if (null != detailMsg) {
+ message.append("\n");
+ message.append(detailMsg);
}
+
+ return message.toString();
}
public static DAResult getDAResult(int num) {
@Override
public String toString() {
- String str = "";
+ StringBuffer str = new StringBuffer();
+
if (0 != errNo) {
- str += "[ERROR : ";
+ str.append("[ERROR : ");
} else {
- str += "[SUCCESS : ";
+ str.append("[SUCCESS : ");
}
- str += (errMsg + "]");
+ str.append(errMsg + "]");
if (null != detailMsg) {
- str += ("\n[DETAIL : " + detailMsg + "]");
+ str.append("\n[DETAIL : ");
+ str.append(detailMsg + "]");
}
- return str;
+ return str.toString();
}
public void setDetailMessage(String message) {
public void printDebug() {
String method = getMethodName(2) + "()";
- String str = "";
+ StringBuffer str = new StringBuffer();
if (0 != errNo) {
- str += "[ERROR : ";
+ str.append("[ERROR : ");
} else {
- str += "[SUCCESS : ";
+ str.append("[SUCCESS : ");
}
- str += (errMsg + " ");
+ str.append(errMsg + " ");
if (null != method) {
- str += ("METHOD : " + method + " ]");
+ str.append("METHOD : " + method + " ]");
}
- Logger.debug(str);
+ Logger.debug(str.toString());
}
}
import org.eclipse.swt.widgets.Display;
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.path.PathManager;
BinarySettingManager.getInstance().addBinarySettingData(addBinData);
BinarySettingManager.getInstance().checkSourcePath(addBinData);
+ DAResult result = DAResult.ERR_BIN_INFO_GET_FAIL;
try {
- DACommunicator.getBinaryInformation(addBinPath);
+ result = DACommunicator.getBinaryInformation(addBinPath);
DACommunicator.addInstrumentation(addBinPath);
} catch (InterruptedException e) {
Logger.warning("Sending message by communicator is interrupted");
+ UserErrorWarningLabels.ERROR_UNSUPPORTED_PROTOCOL;
}
+ if (!result.isSuccess()) {
+ return result.getMessage();
+ }
+
return null;
}
public static String ERROR_DEVICE_CONNECTION;
public static String ERROR_DEVICE_NOT_FOUND;
public static String ERROR_UNSUPPORTED_PROTOCOL;
-
+
public static String ERROR_BY_SECURITY_REASON;
-
+
public static String ERROR_NONEXIST_APPLICATION;
public static String ERROR_UNSUPPORTED_APPLICATION;
public static String ERROR_CONFIGURATION_FAILED;
public static String ERROR_CONNECTION_CLOSED;
-
+ public static String ERROR_DOWNLOAD_FILE_FAILED;
+
+ public static String ERROR_FAILED_OPERATION;
public static String ERROR_INTERNAL_REASON;
-
public static String ERROR_BY_UNKNOWN_REASON;
-
public static String ERROR_OUT_OF_MEMORY;
-
public static String ERROR_START_TRACE_FAILED;
+ public static String ERROR_NONEXIST_BINARY;
+ public static String ERROR_NONELF_BINARY;
+
+ public static String ERROR_SCREENSHOT_FAILED;
+
public static String WARNING_PATH_NOT_FOUND;
public static String WARNING_FILE_NOT_FOUND;
-
+
public static String WARNING_RUNNING_PROCESS_LIMIT;
public static String WARNING_OVERHEAD_EXPLODE;
-
+
public static String WARNING_USER_CANCEL;
-
+
static {
NLS.initializeMessages(BUNDLE_NAME, UserErrorWarningLabels.class);
}
ERROR_CONFIGURATION_FAILED=Configuration is failed.
ERROR_CONNECTION_CLOSED=Connection with target device is closed.\nPlease check the connection with device.
+ERROR_DOWNLOAD_FILE_FAILED=Downloading file is failed.
+ERROR_FAILED_OPERATION=Operation failed.
ERROR_INTERNAL_REASON=Failed by internal reason.\nPlease try again or restart DA.
-
ERROR_BY_UNKNOWN_REASON=Failed by unknown reason.
-
ERROR_OUT_OF_MEMORY=Out of memory in Dynamic Analyzer.\nIf you want to use more memory, increase the -xmx value\nof the dynamic-analyzer.ini file in Dynamic Analyzer installed directory.\n
-
ERROR_START_TRACE_FAILED=Cannot start trace.\nCurrent application may not be available for trace.
+ERROR_NONEXIST_BINARY=Binary does not exist in device.
+ERROR_NONELF_BINARY=Binary is not ELF format.
+
+ERROR_SCREENSHOT_FAILED=Taking screen-shot is failed.
+
WARNING_PATH_NOT_FOUND=Path cannot be found.
WARNING_FILE_NOT_FOUND=File cannot be found.
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.communicator.AckMessage;
import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DeviceInfo;
import org.tizen.dynamicanalyzer.communicator.ISerializable;
import org.tizen.dynamicanalyzer.communicator.ProcessAdditionalInfo;
-import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
import org.tizen.dynamicanalyzer.communicator.ProtocolParser;
import org.tizen.dynamicanalyzer.communicator.ProtocolSerializer;
import org.tizen.dynamicanalyzer.communicator.SubCommunicator;
-import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.control.ApplistManager;
import org.tizen.dynamicanalyzer.control.IProgress;
import org.tizen.dynamicanalyzer.handlers.ReplayManager;
-import org.tizen.dynamicanalyzer.handlers.UIAction;
import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
import org.tizen.dynamicanalyzer.model.DATime;
+import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.project.DeviceStatusInfo;
import org.tizen.dynamicanalyzer.setting.Feature;
import org.tizen.dynamicanalyzer.setting.SettingDataManager;
import org.tizen.dynamicanalyzer.setting.TargetData;
-import org.tizen.dynamicanalyzer.swap.communicator.SwapErrorCode;
import org.tizen.dynamicanalyzer.swap.model.data.RecordEventObject;
import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
import org.tizen.dynamicanalyzer.ui.toolbar.replay.data.ReplayDataManager;
byte[] msg = ps.toByteArray();
AckMessage result = parent.handleControlMessage(msg);
- if (result != null && result.isCorrectID(ProtocolConstant30.MSG_BINARY_INFO_ACK)) {
- if (result.isSuccess()
- || (result.getReturnCode() == SwapErrorCode.ERR_WRONG_MESSAGE_DATA
- .getErrorNumber() && result.getPayloadLength() > INT_SIZE)) {
+ if (result != null && result.isCorrectID(ProtocolConstant30.MSG_BINARY_INFO_ACK)
+ && result.isSuccess()) {
+ // partial success is not allowed in protocol 3.0
- // parse binary info
- return parseBinaryInfo(result.getPayload(), binPaths);
- }
+ // parse binary info
+ return parseBinaryInfo(result.getPayload(), binPaths);
+ } else {
+ return DAResult.ERR_BIN_INFO_GET_FAIL;
}
-
- return DAResult.ERR_BIN_INFO_GET_FAIL;
}
protected DAResult parseBinaryInfo(byte[] payload, List<String> targetPaths) {
- DAResult ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+ DAResult ret = DAResult.SUCCESS;
+ StringBuffer detailErrorMsg = new StringBuffer();
ProtocolParser parser = new ProtocolParser(payload);
parser.getInt(); // for return code
if (binaryType < 0) {
// binary does not exist in target(-1) or is non-elf binary(-2)
// so do not try to download binary from target
+ if (detailErrorMsg.length() != 0) {
+ detailErrorMsg.append("\n");
+ }
+
+ if (binaryType == ProtocolConstant30.BINTYPE_NOT_EXIST) {
+ detailErrorMsg.append(UserErrorWarningLabels.ERROR_NONEXIST_BINARY + "("
+ + targetPath + ")");
+ } else if (binaryType == ProtocolConstant30.BINTYPE_NOT_ELF) {
+ detailErrorMsg.append(UserErrorWarningLabels.ERROR_NONELF_BINARY + "("
+ + targetPath + ")");
+ }
+
+ ret = DAResult.ERR_BIN_INFO_GET_FAIL;
continue;
}
DAResult result = checkDirtyOfBinary(binInfo, localBinaryPath);
if (!result.isSuccess()) {
- // popup warning dialog with result
- UIAction.showWarning(result, 480, 153);
- } else {
- ret = DAResult.SUCCESS;
+ if (detailErrorMsg.length() != 0) {
+ detailErrorMsg.append("\n");
+ }
+ detailErrorMsg.append(result.getMessage());
+
+ ret = DAResult.ERR_BIN_INFO_GET_FAIL;
}
}
+ if (!ret.isSuccess()) {
+ ret.setDetailMessage(detailErrorMsg.toString());
+ }
+
return ret;
}
result = pullTheFile(targetPath, localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
- } else if (result.equals(DAResult.ERR_BY_SECURITY)) {
- // continue : do nothing
}
} else {
// if local binary exist already, then check for md5sum
result = pullTheFile(targetPath, localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
- } else if (result.equals(DAResult.ERR_BY_SECURITY)) {
- // continue : do nothing
}
} else {
binInfo.setTempBinaryPath(localBinaryPath);
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;
} else {
Logger.debug("Failed to get " + from); //$NON-NLS-1$
- return DAResult.ERR_BIN_INFO_GET_FAIL;
+ return DAResult.ERR_DOWNLOAD_FILE_FAILED;
}
-
- return DAResult.SUCCESS;
}
protected String getMd5Command() {
if (result != null && result.isSuccess()) {
return DAResult.SUCCESS;
} else {
- return DAResult.ERR_MSG_SEND_FAIL;
+ return DAResult.ERR_SCREENSHOT_GET_FAIL;
}
}
public static final int APPTYPE_COMMON_EXEC = 3;
public static final int APPTYPE_WEB = 4;
+ // binary type
+ public static final int BINTYPE_NOT_EXIST = -1;
+ public static final int BINTYPE_NOT_ELF = -2;
+ public static final int BINTYPE_PIE = 1;
}
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.control.ApplistManager;
import org.tizen.dynamicanalyzer.control.IProgress;
-import org.tizen.dynamicanalyzer.handlers.UIAction;
import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
+import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.project.PackageInfo;
&& result.isCorrectID(ProtocolConstant40.MSG_GET_SCREENSHOT_ACK)) {
return DAResult.SUCCESS;
} else {
- return DAResult.ERR_MSG_SEND_FAIL;
+ return DAResult.ERR_SCREENSHOT_GET_FAIL;
}
}
}
protected DAResult parseBinaryInfo(byte[] payload) {
- DAResult ret = DAResult.ERR_BIN_INFO_GET_FAIL;
+ DAResult ret = DAResult.SUCCESS;
+ StringBuffer detailErrorMsg = new StringBuffer();
ProtocolParser parser = new ProtocolParser(payload);
parser.getInt(); // for return code
if (binaryType < 0) {
// binary does not exist in target(-1) or is non-elf binary(-2)
// so do not try to download binary from target
+ if (detailErrorMsg.length() != 0) {
+ detailErrorMsg.append("\n");
+ }
+
+ if (binaryType == ProtocolConstant40.BINTYPE_NOT_EXIST) {
+ detailErrorMsg.append(UserErrorWarningLabels.ERROR_NONEXIST_BINARY + "("
+ + targetPath + ")");
+ } else if (binaryType == ProtocolConstant40.BINTYPE_NOT_ELF) {
+ detailErrorMsg.append(UserErrorWarningLabels.ERROR_NONELF_BINARY + "("
+ + targetPath + ")");
+ }
+
+ ret = DAResult.ERR_BIN_INFO_GET_FAIL;
continue;
}
DAResult result = checkDirtyOfBinary(binInfo, localBinaryPath);
if (!result.isSuccess()) {
- // popup warning dialog with result
- UIAction.showWarning(result, 480, 153);
- } else {
- ret = DAResult.SUCCESS;
+ if (detailErrorMsg.length() != 0) {
+ detailErrorMsg.append("\n");
+ }
+ detailErrorMsg.append(result.getMessage());
+
+ ret = DAResult.ERR_BIN_INFO_GET_FAIL;
}
}
+ if (!ret.isSuccess()) {
+ ret.setDetailMessage(detailErrorMsg.toString());
+ }
+
return ret;
}
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.UnsupportedProtocolException;
+import org.tizen.dynamicanalyzer.handlers.UIAction;
import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.project.DeviceStatusInfo;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
} catch (UnsupportedProtocolException e) {
Logger.warning("Getting binary info is not supported by communicator");
}
+
+ if (!result.isSuccess()) {
+ UIAction.showWarning(result);
+ }
}
BinarySettingProgressManager.getInstance().setValue(50);
}
if (paths.size() > 0) {
+ DAResult result = DAResult.ERR_BIN_INFO_GET_FAIL;
try {
- DACommunicator.getBinaryInformation(paths);
+ result = DACommunicator.getBinaryInformation(paths);
} catch (InterruptedException e) {
Logger.warning("Interrupted during get binary info");
} catch (UnsupportedProtocolException e) {
Logger.warning("Getting binary info is not supported by communicator");
}
+
+ if (!result.isSuccess()) {
+ UIAction.showWarning(result);
+ }
}
DeviceStatusInfo sinfo = Global.getCurrentDeviceInfo().getDeviceStatusInfo();
}
if (!hr.isSuccess()) {
+ UIAction.showWarning(hr);
Logger.warning("Failed to get binary info : " + hr.getMessage());
}
}