summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPark Kyoung Won <kw0712.park@samsung.com>2017-10-11 18:23:38 +0900
committerPark Kyoung Won <kw0712.park@samsung.com>2017-10-11 18:23:38 +0900
commit8c5097c8dc0d62243ba5114be28bac2be7530771 (patch)
treeebb6b75581c5317a50c69e66045fbeb7d8234585
parenta3df71a20596b7a5bac3d1216ce1def50c92ca3b (diff)
parent54e0f5f4af4ed34addc36f89ab99bf63df3a5db3 (diff)
downloademulator-control-panel-devices-8c5097c8dc0d62243ba5114be28bac2be7530771.tar.gz
emulator-control-panel-devices-8c5097c8dc0d62243ba5114be28bac2be7530771.tar.bz2
emulator-control-panel-devices-8c5097c8dc0d62243ba5114be28bac2be7530771.zip
Merge branch 'develop' into tizen_studio_2.0_p3.0
-rw-r--r--ECP-DEVICES/resource/string/device_messages.properties1
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/appmanager/AppManagerController.java16
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/battery/ui/BatteryController.java7
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/hds/ui/HDSPane.java13
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationManualController.java19
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationMap.java9
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/network/ui/NetworkController.java26
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/nfc/NFCUtil.java11
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/nfc/ui/NFCController.java17
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/nfc/ui/TizenRemoteFileDialog.java39
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/rssi/ui/RSSIController.java2
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/SensorFileOperation.java8
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/accelerometer/AccelViewController.java11
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/geo/MagneticViewController.java8
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/FXMLSensorGuiController.java7
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/MobileCanvas.java60
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gyro/GyroViewController.java7
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/sensor/cli/SensorFileCLI.java4
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/telephony/cli/TelephonyData.java20
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/ProtocolBuilder.java4
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/StructureGA.java19
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/sms/crytography/DecodeMsg.java80
-rw-r--r--ECP-DEVICES/src/org/tizen/ecp/telephony/ui/TelephonyController.java32
-rw-r--r--package/changelog3
-rw-r--r--package/pkginfo.manifest2
25 files changed, 276 insertions, 149 deletions
diff --git a/ECP-DEVICES/resource/string/device_messages.properties b/ECP-DEVICES/resource/string/device_messages.properties
index b9361f3..0a4f8ef 100644
--- a/ECP-DEVICES/resource/string/device_messages.properties
+++ b/ECP-DEVICES/resource/string/device_messages.properties
@@ -242,6 +242,7 @@ UninstallerDisplay.19=Failed to Uninstall. Waiting time is over.
UninstallerDisplay.20=Failed to Uninstall. Selection App(s) is(are) not Matching.
UninstallerDisplay.21=Failed to Uninstall. I/O error.
UninstallerDisplay.22=Failed to Uninstall. SDB binary is missing.
+UninstallerDisplay.23=Failed to Uninstall. Unknown Error.
UninstallerDisplay.9=User Installed Applications
USBCLI.0=usb
USBCLI.1=set <state>
diff --git a/ECP-DEVICES/src/org/tizen/ecp/appmanager/AppManagerController.java b/ECP-DEVICES/src/org/tizen/ecp/appmanager/AppManagerController.java
index 3440ba0..9708be8 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/appmanager/AppManagerController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/appmanager/AppManagerController.java
@@ -79,7 +79,7 @@ public class AppManagerController implements Initializable {
+ " pkgid " + patternLs + " name " + patternLs + " version " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ patternLs + ".*");
private String shellResult = null;
- private final ArrayList<AppInfo> appList = new ArrayList<AppInfo>();
+ private final ArrayList<AppInfo> appList = new ArrayList<>();
@Override
public void initialize(URL location, ResourceBundle resources) {
@@ -177,6 +177,9 @@ public class AppManagerController implements Initializable {
int result = removeApp(pkginfo);
switch (result) {
+ case AppConstants.SUCCESS:
+ logger.info("Succeeded to uninstall."); //$NON-NLS-1$
+ break;
case AppConstants.SDBCOMMANDREJECTEDERROR:
errorMsg = DeviceMessages.getString("UninstallerDisplay.18"); //$NON-NLS-1$
break;
@@ -193,7 +196,8 @@ public class AppManagerController implements Initializable {
errorMsg = DeviceMessages.getString("UninstallerDisplay.22"); //$NON-NLS-1$
break;
default:
- logger.info("Succeeded to uninstall."); //$NON-NLS-1$
+ logger.warning("Unknown Error"); //$NON-NLS-1$
+ errorMsg = DeviceMessages.getString("UninstallerDisplay.23"); //$NON-NLS-1$
break;
}
if (errorMsg == null) {
@@ -281,7 +285,9 @@ public class AppManagerController implements Initializable {
}
public void refresh() {
- progressIndicator.getParent().setVisible(true);
+ if(progressIndicator.getParent() != null ) {
+ progressIndicator.getParent().setVisible(true);
+ }
progressIndicator.setVisible(true);
tableAppList.getItems().clear();
tableAppList.setDisable(true);
@@ -340,7 +346,9 @@ public class AppManagerController implements Initializable {
buttonRefresh.setDisable(false);
buttonUninstall.setDisable(true);
tableAppList.setDisable(false);
- progressIndicator.getParent().setVisible(false);
+ if(progressIndicator.getParent() != null ) {
+ progressIndicator.getParent().setVisible(false);
+ }
progressIndicator.setVisible(false);
if (errorMsg != null) {
MessageBox.error(errorMsg);
diff --git a/ECP-DEVICES/src/org/tizen/ecp/battery/ui/BatteryController.java b/ECP-DEVICES/src/org/tizen/ecp/battery/ui/BatteryController.java
index 56813bb..444abcb 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/battery/ui/BatteryController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/battery/ui/BatteryController.java
@@ -60,6 +60,9 @@ public class BatteryController implements Initializable {
@FXML
public void onMouseClicked(MouseEvent event) {
+ if (fx_connect_lbl.getGraphic() == null) {
+ return;
+ }
if (fx_connect_lbl.getGraphic().getId() == BatteryConstants.STR_CHARGER_OFF) {
setCharge(true, true);
} else {
@@ -116,7 +119,7 @@ public class BatteryController implements Initializable {
@FXML
public void onTextChanged(ActionEvent event) {
String sLevel = fx_level_textfield.getText();
- if (sLevel.matches(BatteryConstants.NUMBERREGX)) {
+ if (sLevel != null && sLevel.matches(BatteryConstants.NUMBERREGX)) {
int iLevel = Integer.parseInt(sLevel);
// check the number between 0 and 100
if (iLevel >= BatteryConstants.BATTERY_LEVEL_MIN && iLevel <= BatteryConstants.BATTERY_LEVEL_MAX) {
@@ -153,7 +156,7 @@ public class BatteryController implements Initializable {
fx_connect_lbl.setGraphic(off);
}
if (isSent) {
- send(BatteryConstants.BATTERY_CHARGER_ID, (isOn == true) ? 1 : 0);
+ send(BatteryConstants.BATTERY_CHARGER_ID, isOn == true ? 1 : 0);
}
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/hds/ui/HDSPane.java b/ECP-DEVICES/src/org/tizen/ecp/hds/ui/HDSPane.java
index b255171..da742c4 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/hds/ui/HDSPane.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/hds/ui/HDSPane.java
@@ -110,8 +110,9 @@ public class HDSPane extends ECPPopupPane implements Initializable {
}
logger.info("HDS status : " + data); //$NON-NLS-1$
- if (data == null || data.isEmpty())
+ if (data == null || data.isEmpty()) {
return;
+ }
HDSItems.clear();
@@ -261,7 +262,8 @@ public class HDSPane extends ECPPopupPane implements Initializable {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
- if (!fxHostDirTxt.getText().isEmpty() && !fxDestDirTxt.getText().isEmpty()) {
+ if (fxHostDirTxt.getText() != null && !fxHostDirTxt.getText().isEmpty()
+ && fxDestDirTxt.getText() != null && !fxDestDirTxt.getText().isEmpty()) {
fxMountBtn.setDisable(false);
} else {
fxMountBtn.setDisable(true);
@@ -455,7 +457,7 @@ public class HDSPane extends ECPPopupPane implements Initializable {
private boolean validateHost(String text) {
File file;
- if (text.isEmpty()) {
+ if (text == null || text.isEmpty()) {
MessageBox.error(DeviceMessages.getString("HDSDisplay.13")); //$NON-NLS-1$
return false;
}
@@ -479,7 +481,7 @@ public class HDSPane extends ECPPopupPane implements Initializable {
}
private boolean validateDest(String text) {
- if (text.isEmpty()) {
+ if (text == null || text.isEmpty()) {
MessageBox.error(DeviceMessages.getString("HDSDisplay.15")); //$NON-NLS-1$
return false;
}
@@ -497,6 +499,9 @@ public class HDSPane extends ECPPopupPane implements Initializable {
}
private boolean validatePCI(String data) {
+ if (data == null) {
+ return false;
+ }
int numData;
try {
numData = Integer.parseInt(data);
diff --git a/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationManualController.java b/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationManualController.java
index 4c7391c..d26b75d 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationManualController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationManualController.java
@@ -61,7 +61,7 @@ public class LocationManualController extends LocationCommonControl {
private InjectTask task = null;
private LocationInjector injector = null;
- private ArrayList<GeoLocationVO> locationVO = new ArrayList<GeoLocationVO>();
+ private ArrayList<GeoLocationVO> locationVO = new ArrayList<>();
// TODO:need validation check(textLatitude, textLogitude, textAltitude,
// textHorizontal)
@@ -70,12 +70,18 @@ public class LocationManualController extends LocationCommonControl {
public void OnClickInjectManualLocation(ActionEvent event) {
// if (!isTimerStop) {
buttonInjectMaunalLocation.setDisable(true);
- textLatitude.getText();
+
+ if (textLatitude.getText() == null || textLongitude.getText() == null || textAltitude.getText() == null
+ || textHorizontal.getText() == null) {
+ logger.warning("latitude: " + textLatitude.getText() + ", longitude: " //$NON-NLS-1$ //$NON-NLS-2$
+ + textLongitude.getText() + ", altitude: " + textAltitude.getText() //$NON-NLS-1$
+ + ", accuracy: " + textHorizontal.getText());
+ return;
+ }
+
Double latitude = Double.parseDouble(textLatitude.getText().trim());
Double longitude = Double.parseDouble(textLongitude.getText().trim());
-
Double altitude = Double.parseDouble(textAltitude.getText().trim());
-
Double accuracy = Double.parseDouble(textHorizontal.getText().trim());
logger.info("latitude: " + latitude + ", longitude: " //$NON-NLS-1$ //$NON-NLS-2$
@@ -232,7 +238,7 @@ public class LocationManualController extends LocationCommonControl {
private boolean validateManualValues(TextField text, int min, int max) {
double value;
- if (text == null) {
+ if (text == null || text.getText() == null) {
return false;
}
@@ -307,7 +313,7 @@ public class LocationManualController extends LocationCommonControl {
}
private void checkSameAndInsert(TextField textBox, String value) {
- if (value == null || value.isEmpty()) {
+ if (textBox.getText() == null || value == null || value.isEmpty()) {
return;
}
double existvalue = 0.0, incomingValue = 0.0;
@@ -327,6 +333,7 @@ public class LocationManualController extends LocationCommonControl {
}
class InjectTask extends TimerTask {
+ @Override
public void run() {
injector = new LocationInjector();
diff --git a/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationMap.java b/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationMap.java
index e800aec..9c4af63 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationMap.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/location/ui/LocationMap.java
@@ -63,15 +63,18 @@ public class LocationMap extends Parent {
private void trustAllCertificates() {
TrustManager[] trustmanager = new TrustManager[] { new X509TrustManager() {
+ @Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
+ @Override
public void checkClientTrusted(java.security.cert.X509Certificate[] arg0, String arg1)
throws java.security.cert.CertificateException {
// Auto-generated method stub
}
+ @Override
public void checkServerTrusted(java.security.cert.X509Certificate[] arg0, String arg1)
throws java.security.cert.CertificateException {
// Auto-generated method stub
@@ -149,8 +152,10 @@ public class LocationMap extends Parent {
final Worker.State oldState, final Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
doc = (JSObject) webEngine.executeScript("window");
- doc.setMember("MapHandler", new MapHandler());
- controller.mapView.setDisable(false);
+ if (doc != null) {
+ doc.setMember("MapHandler", new MapHandler());
+ controller.mapView.setDisable(false);
+ }
}
}
});
diff --git a/ECP-DEVICES/src/org/tizen/ecp/network/ui/NetworkController.java b/ECP-DEVICES/src/org/tizen/ecp/network/ui/NetworkController.java
index d973ee3..d35ad5e 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/network/ui/NetworkController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/network/ui/NetworkController.java
@@ -29,7 +29,6 @@ import java.net.URL;
import java.util.ResourceBundle;
import org.tizen.ecp.control.ButtonToggleEvent;
-import org.tizen.ecp.control.TizenCheckBox;
import org.tizen.ecp.control.TizenRadioButton;
import org.tizen.ecp.control.TizenToggleButton;
import org.tizen.ecp.dialog.MessageBox;
@@ -79,9 +78,7 @@ public class NetworkController implements Initializable {
Label fx_refresh_lbl, fx_sAddr_lbl, fx_dAddr_lbl;
@FXML
TableColumn<NetworkInfo, String> fx_interface_column, fx_protocol_column, fx_fd_column, fx_sAddr_column,
- fx_sPort_column, fx_dAddr_column, fx_dPort_column, fx_revQ_column, fx_sendQ_column;
-
- TizenCheckBox hidden_cb;
+ fx_sPort_column, fx_dAddr_column, fx_dPort_column, fx_revQ_column, fx_sendQ_column;
@FXML
Button fx_sendMsg_btn, fx_SMS_set_btn, fx_MMS_set_btn;
@@ -116,11 +113,11 @@ public class NetworkController implements Initializable {
public void handle(ButtonToggleEvent event) {
if (status_toggle.getOn()) {
MessageSender.getInstance()
- .sendMonitorReq(createNetworkConnectMsg(NetworkConstants.CMD_SET_LINK_UP));
+ .sendMonitorReq(createNetworkConnectMsg(NetworkConstants.CMD_SET_LINK_UP));
MessageSender.getInstance().sendMonitorReq(createUsernetMsg());
} else {
MessageSender.getInstance()
- .sendMonitorReq(createNetworkConnectMsg(NetworkConstants.CMD_SET_LINK_DOWN));
+ .sendMonitorReq(createNetworkConnectMsg(NetworkConstants.CMD_SET_LINK_DOWN));
}
}
});
@@ -161,14 +158,14 @@ public class NetworkController implements Initializable {
}
private String checkPorts(PORT_TYPE port) {
- String portNum = null;
+ String portNum = "";
if (port == PORT_TYPE.SOURCE_PORT) {
portNum = fx_sPort_textfield.getText();
} else if (port == PORT_TYPE.DESTINATION_PORT) {
portNum = fx_dPort_textfield.getText();
}
- if (portNum.isEmpty()) {
+ if (portNum == null || portNum.isEmpty()) {
MessageBox.error(NetworkConstants.EMPTY_PORT_ERR);
portNum = NetworkConstants.INVALID_PORT_NUM;
} else if (!portNum.matches(NetworkConstants.PORTREGX)) {
@@ -197,8 +194,9 @@ public class NetworkController implements Initializable {
String[] lineSplit = message.split("\r\n"); //$NON-NLS-1$
String lan = null;
clearNetworkInfo();
- if (status_toggle.getOn() == false)
+ if (status_toggle.getOn() == false) {
return;
+ }
for (String line : lineSplit) {
if (line.length() < 72) {
@@ -213,7 +211,7 @@ public class NetworkController implements Initializable {
continue;
}
- NetworkInfo cl = new NetworkInfo((lan == null) ? StringResources.EMPTY : lan, line.substring(0, 18).trim(),
+ NetworkInfo cl = new NetworkInfo(lan == null ? StringResources.EMPTY : lan, line.substring(0, 18).trim(),
line.substring(18, 22).trim(), line.substring(22, 38).trim(), line.substring(38, 44).trim(),
line.substring(44, 60).trim(), line.substring(60, 66).trim(), line.substring(66, 72).trim(),
line.substring(72, line.length()).trim());
@@ -226,8 +224,9 @@ public class NetworkController implements Initializable {
@FXML
public void onRefreshPressed(MouseEvent event) {
fx_refresh_lbl.setGraphic(refresh_sel);
- if (status_toggle.getOn())
+ if (status_toggle.getOn()) {
MessageSender.getInstance().sendMonitorReq(createUsernetMsg());
+ }
}
@FXML
@@ -246,10 +245,11 @@ public class NetworkController implements Initializable {
}
public void setProtocol(String connect) {
- if (connect.equals(NetworkConstants.CONNECT))
+ if (connect.equals(NetworkConstants.CONNECT)) {
status_toggle.setOn(true);
- else
+ } else {
status_toggle.setOn(false);
+ }
}
public void clearNetworkInfo() {
diff --git a/ECP-DEVICES/src/org/tizen/ecp/nfc/NFCUtil.java b/ECP-DEVICES/src/org/tizen/ecp/nfc/NFCUtil.java
index ae27afe..afa07c3 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/nfc/NFCUtil.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/nfc/NFCUtil.java
@@ -57,9 +57,9 @@ public class NFCUtil {
String[] vals = value.split(StringResources.COMMA);
int count = Integer.valueOf(vals[1]);
- List<NDEFRecord> list = new ArrayList<NDEFRecord>();
+ List<NDEFRecord> list = new ArrayList<>();
for (int i = 0; i < count; i++) {
- String temp = vals[2 + (4 * i)];
+ String temp = vals[2 + 4 * i];
NDEFFormat format = null;
for (NDEFFormat f : NDEFFormat.values()) {
if (String.valueOf(f.getFormat()).equals(temp)) {
@@ -70,13 +70,16 @@ public class NFCUtil {
if (format == null) {
continue;
}
- list.add(new NDEFRecord(format, vals[3 + (4 * i)],
- vals[4 + (4 * i)], vals[5 + (4 * i)]));
+ list.add(new NDEFRecord(format, vals[3 + 4 * i],
+ vals[4 + 4 * i], vals[5 + 4 * i]));
}
return list;
}
public static void checkInvalidCharacters(String text) throws NFCEventException {
+ if (text == null) {
+ throw new NFCEventException(NFCErrorString.InvalidCharAscii);
+ }
for (char c : text.toCharArray()) {
if (c == '\n') {
throw new NFCEventException(NFCErrorString.InvalidCharNewLine);
diff --git a/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/NFCController.java b/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/NFCController.java
index c1dfe96..237e84a 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/NFCController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/NFCController.java
@@ -155,7 +155,7 @@ public class NFCController implements Initializable {
// message list length
private int nTotalLength = 0;
private final int nMaxNDFEMessageLength = 4096;
- private ArrayList<NDEFRecord> RecordList = new ArrayList<NDEFRecord>();
+ private ArrayList<NDEFRecord> RecordList = new ArrayList<>();
// check invalid characters
private final NDEFRecord oldRecord = new NDEFRecord(NDEFFormat.EMPTY, StringResources.EMPTY, StringResources.EMPTY, StringResources.EMPTY);
@@ -451,7 +451,7 @@ public class NFCController implements Initializable {
private void addRecords(List<NDEFRecord> newRecordList) {
int i = 0;
- RecordList = new ArrayList<NDEFRecord>();
+ RecordList = new ArrayList<>();
for (NDEFRecord record : newRecordList) {
logger.info("addRecord"); //$NON-NLS-1$
@@ -536,19 +536,20 @@ public class NFCController implements Initializable {
if (selectedIndex == 1) {
record.setTypeName(TypeNameList.get(typeNameCombo.getSelectionModel().getSelectedIndex()));
} else {
- if (typeNameText.getText().isEmpty() == true)
+ if (typeNameText.getText() == null || typeNameText.getText().isEmpty() == true) {
record.setTypeName(NFCConstants.NULL);
- else
+ } else {
record.setTypeName(typeNameText.getText());
+ }
}
- if (idText.getText().isEmpty() == true) {
+ if (idText.getText() == null || idText.getText().isEmpty() == true) {
record.setId(NFCConstants.NULL);
} else {
record.setId(idText.getText());
}
- if (payloadText.getText().isEmpty() == true) {
+ if (payloadText.getText() == null || payloadText.getText().isEmpty() == true) {
record.setPayload(NFCConstants.NULL);
} else {
record.setPayload(payloadText.getText());
@@ -713,7 +714,7 @@ public class NFCController implements Initializable {
DeviceNtf devNtf = (DeviceNtf) param;
- String value = (devNtf.getData().toStringUtf8());
+ String value = devNtf.getData().toStringUtf8();
logger.info("value:" + value); //$NON-NLS-1$
if (value != null) {
String[] vals = value.split(StringResources.COLON);
@@ -809,7 +810,7 @@ public class NFCController implements Initializable {
}
private void checkLength(TextField tf, int maxLength) {
- if (tf.getText().length() > maxLength) {
+ if (tf.getText() != null && tf.getText().length() > maxLength) {
String s = tf.getText().substring(0, maxLength);
tf.setText(s);
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/TizenRemoteFileDialog.java b/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/TizenRemoteFileDialog.java
index 240e5fb..b3df153 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/TizenRemoteFileDialog.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/nfc/ui/TizenRemoteFileDialog.java
@@ -135,8 +135,13 @@ public class TizenRemoteFileDialog {
});
// add dialog content
- dialog.getDialogPane().setContent(makeContent());
- okButton.setDisable(true);
+ if (dialog.getDialogPane() != null) {
+ dialog.getDialogPane().setContent(makeContent());
+ }
+
+ if (okButton != null) {
+ okButton.setDisable(true);
+ }
return dialog.showAndWait();
}
@@ -172,23 +177,28 @@ public class TizenRemoteFileDialog {
});
// create tree view
- vBox.getChildren().addAll(createFileTreeView(), errorTextLabel);
-
-
+ TreeView<FileTreeData> fileTreeView = createFileTreeView();
+ if(fileTreeView == null) {
+ errorTextLabel.setText(NFCErrorString.MediaFileException);
+ }
+ vBox.getChildren().addAll(fileTreeView, errorTextLabel);
return anchorPane;
}
private TreeItem<FileTreeData> oldTreeItem;
private TreeView<FileTreeData> createFileTreeView() {
- treeRoot = new TreeItem<FileTreeData>(new FileTreeData());
- treeView = new TreeView<FileTreeData>(treeRoot);
+ treeRoot = new TreeItem<>(new FileTreeData());
+ treeView = new TreeView<>(treeRoot);
VBox.setVgrow(treeView, Priority.ALWAYS);
treeView.setCellFactory(FileTreeCell.extractor());
treeView.setShowRoot(false);
// tree selection listener
+ if (treeView.getSelectionModel() == null) {
+ return null;
+ }
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<FileTreeData>>() {
@Override
public void changed(ObservableValue<? extends TreeItem<FileTreeData>> observable,
@@ -199,7 +209,7 @@ public class TizenRemoteFileDialog {
// XXX: Case that move to hidden root
if (newValue == treeRoot) {
- if (oldTreeItem != null) {
+ if (oldTreeItem != null && treeView.getSelectionModel() != null) {
treeView.getSelectionModel().select(oldTreeItem);
}
return;
@@ -256,7 +266,7 @@ class ItemAddWorker extends Thread {
TreeItem<FileTreeData> parent;
FileEntry fileEntry;
- List<FileEntry> entries = new ArrayList<FileEntry>();
+ List<FileEntry> entries = new ArrayList<>();
public ItemAddWorker(FileEntry fileEntry, TreeItem<FileTreeData> parent) {
this.fileEntry = fileEntry;
@@ -282,7 +292,8 @@ class ItemAddWorker extends Thread {
treeItem.expandedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) {
- if (arg2 == null || treeItem.getValue().isChildChecking()
+ if (arg2 == null || treeItem.getValue() == null
+ || treeItem.getValue().isChildChecking()
|| treeItem.getValue().isChildChecked()) {
return;
}
@@ -313,20 +324,22 @@ class ItemAddWorker extends Thread {
parent.getChildren().clear();
for (FileEntry en : entries) {
- TreeItem<FileTreeData> newItem = new TreeItem<FileTreeData>(
+ TreeItem<FileTreeData> newItem = new TreeItem<>(
new FileTreeData(en));
parent.getChildren().add(newItem);
// Add a dummy item
// to get a tree-expand arrow,
// to show an indicator.
- if (newItem.getValue().isDirectory()) {
+ if (newItem.getValue() != null && newItem.getValue().isDirectory()) {
newItem.getChildren().add(new TreeItem<FileTreeData>());
}
addExpandListener(newItem);
}
- parent.getValue().setTreeItemState(TreeItemState.CHILD_CHECKED);
+ if (parent.getValue() != null) {
+ parent.getValue().setTreeItemState(TreeItemState.CHILD_CHECKED);
+ }
}
};
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/rssi/ui/RSSIController.java b/ECP-DEVICES/src/org/tizen/ecp/rssi/ui/RSSIController.java
index b03d3db..bb6b26b 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/rssi/ui/RSSIController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/rssi/ui/RSSIController.java
@@ -120,7 +120,7 @@ public class RSSIController implements Initializable {
@FXML
public void onTextChanged(ActionEvent event) {
String sLevel = fx_level_textfield.getText();
- if (sLevel.matches(RSSIConstants.NUMBERREGX)) {
+ if (sLevel != null && sLevel.matches(RSSIConstants.NUMBERREGX)) {
// check the number between 0 and 4
int iLevel = Integer.parseInt(sLevel);
if (iLevel >= RSSIConstants.LV0 && iLevel <= RSSIConstants.LV4) {
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/SensorFileOperation.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/SensorFileOperation.java
index f1beff6..96092a1 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/SensorFileOperation.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/SensorFileOperation.java
@@ -40,15 +40,15 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javafx.event.EventHandler;
-
import org.tizen.ecp.utils.LogUtil;
+import javafx.event.EventHandler;
+
public abstract class SensorFileOperation {
protected Logger logger;
private Thread workerThread;
- private List<File> fileList = new ArrayList<File>();
+ private List<File> fileList = new ArrayList<>();
private boolean isFinished = false;
@@ -177,7 +177,7 @@ public abstract class SensorFileOperation {
if (data[3] == null || data[3].isEmpty()) {
z = 0;
} else {
- z = Double.parseDouble(data[2]);
+ z = Double.parseDouble(data[3]);
}
} catch (NumberFormatException e) {
logger.log(Level.SEVERE,
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/accelerometer/AccelViewController.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/accelerometer/AccelViewController.java
index 8b6116a..38279b7 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/accelerometer/AccelViewController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/accelerometer/AccelViewController.java
@@ -47,6 +47,7 @@ import javafx.scene.control.Slider;
public class AccelViewController extends FXMLSensorViewController {
//private static double G = 9.80665;
private DecimalFormat df = new DecimalFormat(AccConstants.DECIMAL_FORMAT_ACCEL);
+ private boolean isSend = true;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
@@ -90,6 +91,9 @@ public class AccelViewController extends FXMLSensorViewController {
@Override
protected void onEnterToTextField(TizenTextField textField, Slider slider) {
String text = textField.getText();
+ if(text == null) {
+ return;
+ }
try {
// throw 'NumberFormatException'
@@ -127,6 +131,10 @@ public class AccelViewController extends FXMLSensorViewController {
@Override
public void sendMessage() {
+ if (!isSend) {
+ return;
+ }
+
double x = Math.round(fxXSlider.getValue() * 100d) / 100d;
double y = Math.round(fxYSlider.getValue() * 100d) / 100d;
double z = Math.round(fxZSlider.getValue() * 100d) / 100d;
@@ -145,6 +153,8 @@ public class AccelViewController extends FXMLSensorViewController {
if (data == null || data.isEmpty()) {
return;
}
+
+ isSend = false;
int g = 980665;
String[] values = data.split(","); //$NON-NLS-1$
Double dxVal = Double.parseDouble(values[0]) / g;
@@ -158,5 +168,6 @@ public class AccelViewController extends FXMLSensorViewController {
fxXSlider.setValue(x);
fxYSlider.setValue(y);
fxZSlider.setValue(z);
+ isSend = true;
}
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/geo/MagneticViewController.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/geo/MagneticViewController.java
index cd5c8b8..48061f4 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/geo/MagneticViewController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/geo/MagneticViewController.java
@@ -49,6 +49,7 @@ import javafx.scene.control.Slider;
public class MagneticViewController extends FXMLSensorViewController {
private DecimalFormat df = new DecimalFormat(AccConstants.DECIMAL_FORMAT_MAGNETIC);
+ private boolean isSend = true;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
@@ -120,6 +121,10 @@ public class MagneticViewController extends FXMLSensorViewController {
@Override
public void sendMessage() {
+ if (!isSend) {
+ return;
+ }
+
int x = (int) Math.round(fxXSlider.getValue());
int y = (int) Math.round(fxYSlider.getValue());
int z = (int) Math.round(fxZSlider.getValue());
@@ -135,13 +140,16 @@ public class MagneticViewController extends FXMLSensorViewController {
return;
}
+ isSend = false;
String[] values = data.split(" "); //$NON-NLS-1$
int xData = Integer.parseInt(values[0]);
int yData = Integer.parseInt(values[1]);
int zData = Integer.parseInt(values[2]);
+ fxXSlider.setValueChanging(false);
fxXSlider.setValue(xData);
fxYSlider.setValue(yData);
fxZSlider.setValue(zData);
+ isSend = true;
}
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/FXMLSensorGuiController.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/FXMLSensorGuiController.java
index d92a4bc..eed1dcb 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/FXMLSensorGuiController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/FXMLSensorGuiController.java
@@ -162,7 +162,8 @@ public class FXMLSensorGuiController implements Initializable {
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
double value = newValue.doubleValue() - orientation_pitch;
- if (panel.pitchDegree.get() != value) {
+
+ if (Double.compare(value, panel.pitchDegree.get()) != 0) {
panel.pitchDegree.set(value);
panel.repaint();
@@ -181,7 +182,7 @@ public class FXMLSensorGuiController implements Initializable {
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
double value = newValue.doubleValue() - orientation_roll;
- if (panel.rollDegree.get() != value) {
+ if (Double.compare(value, panel.rollDegree.get()) != 0) {
panel.rollDegree.set(value);
panel.repaint();
@@ -200,7 +201,7 @@ public class FXMLSensorGuiController implements Initializable {
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
double value = newValue.doubleValue() - orientation_yaw;
- if (panel.yawDegree.get() != value) {
+ if (Double.compare(value, panel.yawDegree.get()) != 0) {
panel.yawDegree.set(value);
panel.repaint();
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/MobileCanvas.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/MobileCanvas.java
index 67a459d..66472c9 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/MobileCanvas.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gui/MobileCanvas.java
@@ -220,8 +220,6 @@ public class MobileCanvas implements IConnection {
// gyro
boolean gyroStart;
- Vector old_vector_yz;
- Vector old_vector_xz;
double old_gyroYaw;
double old_gyroPitch;
double old_gyroRoll;
@@ -584,8 +582,8 @@ public class MobileCanvas implements IConnection {
ax = Fx / m;
az = Fz / m;
- vx += (ax) * dt;
- vz += (az) * dt;
+ vx += ax * dt;
+ vz += az * dt;
accx += vx * dt;
accz += vz * dt;
@@ -623,18 +621,24 @@ public class MobileCanvas implements IConnection {
if (limit > 0) {
// limit on each component separately, as each is
// a separate sensor.
- if (accelx > limit)
+ if (accelx > limit) {
accelx = limit;
- if (accelx < -limit)
+ }
+ if (accelx < -limit) {
accelx = -limit;
- if (accely > limit)
+ }
+ if (accely > limit) {
accely = limit;
- if (accely < -limit)
+ }
+ if (accely < -limit) {
accely = -limit;
- if (accelz > limit)
+ }
+ if (accelz > limit) {
accelz = limit;
- if (accelz < -limit)
+ }
+ if (accelz < -limit) {
accelz = -limit;
+ }
}
yaw = yawDegree.get();
@@ -697,20 +701,23 @@ public class MobileCanvas implements IConnection {
read_accelz = accelz;
}
- if (read_accelx / g > 2)
+ if (read_accelx / g > 2) {
read_accelx = 2 * g;
- else if (read_accelx / g < -2)
+ } else if (read_accelx / g < -2) {
read_accelx = -2 * g;
+ }
- if (read_accely / g > 2)
+ if (read_accely / g > 2) {
read_accely = 2 * g;
- else if (read_accely / g < -2)
+ } else if (read_accely / g < -2) {
read_accely = -2 * g;
+ }
- if (read_accelz / g > 2)
+ if (read_accelz / g > 2) {
read_accelz = 2 * g;
- else if (read_accelz / g < -2)
+ } else if (read_accelz / g < -2) {
read_accelz = -2 * g;
+ }
}
if (currentTime >= orientation_next_update) {
@@ -846,16 +853,20 @@ public class MobileCanvas implements IConnection {
double draw_pitch = old_gyro_pitchDegree - pitchDegree.get();
double draw_yaw = old_gyro_yawDegree - yawDegree.get();
int vector_len = phone.length;
- if (!is_Axis)
+ if (!is_Axis) {
vector_len = 32;
+ }
for (int i = 0; i < vector_len; i += 2) {
- if (i == 0)
+ if (i == 0) {
g2.setStroke(Color.RED);
- if (i == 24)
+ }
+ if (i == 24) {
g2.setStroke(Color.BLUE);
- if (i == 32)
+ }
+ if (i == 32) {
g2.setStroke(Color.BLACK);
+ }
Vector v1 = new Vector(phone[i]);
Vector v2 = new Vector(phone[i + 1]);
@@ -891,23 +902,26 @@ public class MobileCanvas implements IConnection {
/ (centerz - v2.y), centery - (v2.z + movez) * centerz
/ (centerz - v2.y));
- if (i == 32)
+ if (i == 32) {
g2.strokeText(" x+", (float) (centerx + (v1.x + movex) //$NON-NLS-1$
* centerz / (centerz - v1.y)),
(float) (centery - (v1.z + movez) * centerz
/ (centerz - v1.y)));
+ }
- if (i == 34)
+ if (i == 34) {
g2.strokeText(" y+", (float) (centerx + (v1.x + movex) //$NON-NLS-1$
* centerz / (centerz - v1.y)),
(float) (centery - (v1.z + movez) * centerz
/ (centerz - v1.y)));
+ }
- if (i == 36)
+ if (i == 36) {
g2.strokeText(" z+", (float) (centerx + (v1.x + movex) //$NON-NLS-1$
* centerz / (centerz - v1.y)),
(float) (centery - (v1.z + movez) * centerz
/ (centerz - v1.y)));
+ }
}
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gyro/GyroViewController.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gyro/GyroViewController.java
index 0a3a016..df24e0a 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gyro/GyroViewController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/axis/gyro/GyroViewController.java
@@ -49,6 +49,7 @@ import javafx.scene.control.Slider;
public class GyroViewController extends FXMLSensorViewController {
private DecimalFormat df = new DecimalFormat(AccConstants.DECIMAL_FORMAT_GYRO);
+ private boolean isSend = true;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
@@ -125,6 +126,10 @@ public class GyroViewController extends FXMLSensorViewController {
@Override
public void sendMessage() {
+ if (!isSend) {
+ return;
+ }
+
int x = (int) Math.round(fxXSlider.getValue());
int y = (int) Math.round(fxYSlider.getValue());
int z = (int) Math.round(fxZSlider.getValue());
@@ -141,6 +146,7 @@ public class GyroViewController extends FXMLSensorViewController {
return;
}
+ isSend = false;
String[] values = data.split(","); //$NON-NLS-1$
double x = Math.round(Double.parseDouble(values[0]));
@@ -150,5 +156,6 @@ public class GyroViewController extends FXMLSensorViewController {
fxXSlider.setValue(x);
fxYSlider.setValue(y);
fxZSlider.setValue(z);
+ isSend = true;
}
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/sensor/cli/SensorFileCLI.java b/ECP-DEVICES/src/org/tizen/ecp/sensor/cli/SensorFileCLI.java
index 34cc974..0cf5115 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/sensor/cli/SensorFileCLI.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/sensor/cli/SensorFileCLI.java
@@ -69,7 +69,6 @@ public class SensorFileCLI extends AbstractEmulatorCLI {
@Override
public int execute() {
int ret = 0;
- boolean result = false;
if (sensor == null
|| !(ACCEL.equals(sensor) || GYRO.equals(sensor) || GEO
@@ -102,13 +101,12 @@ public class SensorFileCLI extends AbstractEmulatorCLI {
OutputUtil.printError(DeviceMessages.getString("SensorFileCLI.10"), e); //$NON-NLS-1$
return CLIConstants.ERR_INTERRUPTED;
}
- */
if (!result) {
OutputUtil.printFail();
return CLIConstants.ERR_FAIL_ANSWER;
}
-
+ */
OutputUtil.printOK();
return CLIConstants.ERR_SUCCESS;
diff --git a/ECP-DEVICES/src/org/tizen/ecp/telephony/cli/TelephonyData.java b/ECP-DEVICES/src/org/tizen/ecp/telephony/cli/TelephonyData.java
index ee5d9c2..3842334 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/telephony/cli/TelephonyData.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/telephony/cli/TelephonyData.java
@@ -250,9 +250,15 @@ public class TelephonyData implements ILsn {
event.setCallType(findCallType(sga.getInt("CALL_TYPE"))); //$NON-NLS-1$
byte[] temp = sga.getByteArray("CALL_NUMBER"); //$NON-NLS-1$
- event.setCallNumber(new String(temp).trim());
- int s = temp[0];
- event.setCallStatus(findCallStatus(s));
+ if (temp.length != 0) {
+ event.setCallNumber(new String(temp).trim());
+ int s = temp[0];
+ event.setCallStatus(findCallStatus(s));
+ } else {
+ event.setCallNumber("");
+ event.setCallStatus(null);
+ }
+
dialing = true;
this.callEvent = event;
@@ -276,6 +282,12 @@ public class TelephonyData implements ILsn {
item.setMultiParty(body.getInt("MULTIPARTY", i) == 1 ? true //$NON-NLS-1$
: false);
item.setMobileType(findMobileType(body.getInt("DIR", i))); //$NON-NLS-1$
+ byte[] number = body.getByteArray("NUMBER", i);
+ if (number.length != 0) {
+ item.setNumber(new String(number).trim());
+ } else {
+ item.setNumber("");
+ }
item.setNumber(new String(body.getByteArray("NUMBER", i)).trim()); //$NON-NLS-1$
if (item.getStatus() == null || item.getStatus() == CallStatus.NONE) {
loopCount++;
@@ -470,7 +482,7 @@ public class TelephonyData implements ILsn {
if (length == 0) {
receiver.analyzePacket();
- } else {
+ } else if (buf != null){
receiver.analyzePacket(buf);
}
diff --git a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/ProtocolBuilder.java b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/ProtocolBuilder.java
index d5e4ffa..093ca2a 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/ProtocolBuilder.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/ProtocolBuilder.java
@@ -171,7 +171,9 @@ public class ProtocolBuilder implements IProtocolBuilder{
byte[] buf = sga.getByteArray("DATA"); //$NON-NLS-1$
DecodeMsg decode = decodeMsg;
- decode.DecodeSmsSubmitTpdu(tpdu_submit, 500, convertToChar(buf, 3, buf.length - 3));
+ if (buf.length == 0 || decode.DecodeSmsSubmitTpdu(tpdu_submit, 500, convertToChar(buf, 3, buf.length - 3)) == false) {
+ return new String[0];
+ }
msgData[0] = tpdu_submit.getDestAddr().getDiallingNum();
if(decode.isRelayedsms()) {
msgData[1] = String.valueOf(decode.getSmsbuffer()).trim();
diff --git a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/StructureGA.java b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/StructureGA.java
index 8f8f6b8..89d493b 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/StructureGA.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/StructureGA.java
@@ -36,7 +36,7 @@ public class StructureGA {
private ArrayList<AbstractItem> list;
public StructureGA() {
- list = new ArrayList<AbstractItem>();
+ list = new ArrayList<>();
}
public void addShortItem(String name) {
@@ -69,8 +69,9 @@ public class StructureGA {
public void setByteArray(String name, int idx, byte[] value) {
ByteArrayItem item = (ByteArrayItem) getItem(name);
- if (item == null)
+ if (item == null) {
return;
+ }
item.setValue(idx, value);
}
@@ -81,8 +82,9 @@ public class StructureGA {
public void setInt(String name, int idx, int value) {
IntItem item = (IntItem) getItem(name);
- if (item == null)
+ if (item == null) {
return;
+ }
item.setValue(idx, value);
}
@@ -93,8 +95,9 @@ public class StructureGA {
public byte[] getByteArray(String name, int idx) {
ByteArrayItem item = (ByteArrayItem) getItem(name);
- if (item == null)
- return null;
+ if (item == null) {
+ return new byte[0];
+ }
return item.getValue(idx);
}
@@ -105,15 +108,17 @@ public class StructureGA {
public int getInt(String name, int idx) {
IntItem item = (IntItem) getItem(name);
- if (item == null)
+ if (item == null) {
return 0;
+ }
return item.getValue(idx);
}
private AbstractItem getItem(String name) {
- if (name == null)
+ if (name == null) {
return null;
+ }
AbstractItem result = null;
for (int i = 0; i < list.size(); i++) {
diff --git a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/sms/crytography/DecodeMsg.java b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/sms/crytography/DecodeMsg.java
index 5123f44..4077f77 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/sms/crytography/DecodeMsg.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/telephony/protocol/sms/crytography/DecodeMsg.java
@@ -33,8 +33,11 @@ package org.tizen.ecp.telephony.protocol.sms.crytography;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.logging.Logger;
import org.tizen.ecp.string.DeviceMessages;
+import org.tizen.ecp.utils.LogUtil;
+
public class DecodeMsg {
int ton, npi;
@@ -46,6 +49,7 @@ public class DecodeMsg {
private int udhl;
private HashSet<String> deliveryReportNumSet;
private boolean isDecodeEnd;
+ Logger logger = LogUtil.getECPLogger(DecodeMsg.class).getLogger();
public DecodeMsg() {
deliveryReportNumSet = new HashSet<>();
@@ -207,7 +211,7 @@ public class DecodeMsg {
this.isDecodeEnd = isDecodeEnd;
}
- public void DecodeSmsSubmitTpdu(TPDU_SMS_SUBMIT tpdu_submit, int pdu_len, char[] pPDU) {
+ public boolean DecodeSmsSubmitTpdu(TPDU_SMS_SUBMIT tpdu_submit, int pdu_len, char[] pPDU) {
isDecodeEnd = false;
int scaAddr_len = 0;
int destAddr_len = 0;
@@ -222,7 +226,7 @@ public class DecodeMsg {
scaAddr_len = getSize(diallingNum);
- if ((scaAddr_len % 2) != 0) {
+ if (scaAddr_len % 2 != 0) {
position += scaAddr_len / 2 + 1;
} else {
position += scaAddr_len / 2;
@@ -245,11 +249,11 @@ public class DecodeMsg {
/* TP-MTI, TP-RD, TP-VPF, TP-RP, TP_UDHI, TP-SRR */
tpdu_submit.setMsgType(EnumConstants.SMS_TPDU_SUBMIT);
- tpdu_submit.setRd(((pPDU[position] & 0x04) != 0) ? true : false);
+ tpdu_submit.setRd((pPDU[position] & 0x04) != 0 ? true : false);
tpdu_submit.setVpf((pPDU[position] & 0x18) >> 3);
- tpdu_submit.setSrr(((pPDU[position] & 0x20) != 0) ? true : false);
- tpdu_submit.setUdhi(((pPDU[position] & 0x40) != 0) ? true : false);
- tpdu_submit.setRp(((pPDU[position] & 0x80) != 0) ? true : false);
+ tpdu_submit.setSrr((pPDU[position] & 0x20) != 0 ? true : false);
+ tpdu_submit.setUdhi((pPDU[position] & 0x40) != 0 ? true : false);
+ tpdu_submit.setRp((pPDU[position] & 0x80) != 0 ? true : false);
position++;
/* TP-MR */
@@ -258,11 +262,13 @@ public class DecodeMsg {
/* TP-DA */
Arrays.fill(diallingNum, '\u0000');
- SmsUtilDecodeAddrField_dst(diallingNum, getCharArray(pPDU, position));
+ if (SmsUtilDecodeAddrField_dst(diallingNum, getCharArray(pPDU, position)) == false) {
+ return false;
+ }
position += 2;
destAddr_len = getSize(diallingNum);
- if ((destAddr_len % 2) != 0) {
+ if (destAddr_len % 2 != 0) {
position += destAddr_len / 2 + 1;
} else {
position += destAddr_len / 2;
@@ -311,7 +317,7 @@ public class DecodeMsg {
/* TP UD */
if (tpdu_submit.isUdhi()) {
udhl = pPDU[position];
- int fillbits = 7 - ((pPDU[position] * 8) % 7);
+ int fillbits = 7 - pPDU[position] * 8 % 7;
position += udhl;
udhl += fillbits;
@@ -405,6 +411,7 @@ public class DecodeMsg {
deliveryReport = false;
}
isDecodeEnd = true;
+ return true;
}
private char[] getCharArray(char[] org, int start) {
@@ -419,16 +426,17 @@ public class DecodeMsg {
private void SmsUtilDecodeDCS(TapiNetTextCodingScheme pCodingScheme, char dcs) {
if (dcs < 0x80) {
- if (dcs < 0x40)
+ if (dcs < 0x40) {
// bits 7..4 = 00xx : general data coding indication
pCodingScheme.setCodingGroupType(EnumConstants.TAPI_NETTEXT_CODGRP_SM_GENERAL_DCS);
- else
+ } else {
// bits 7..4 = 01xx : message
// marked for automatic deletion
// group. bits 5..0 are coded
// exactly the same as group
// 00xx
pCodingScheme.setCodingGroupType(EnumConstants.TAPI_NETTEXT_CODGRP_SM_AUTO_DELETION);
+ }
if ((dcs & 0x20) != 0) {
// compressed
@@ -472,10 +480,11 @@ public class DecodeMsg {
{
pCodingScheme.setCodingGroupType(EnumConstants.TAPI_NETTEXT_CODGRP_SM_WAITING_DISCARD);
} else if (dcs < 0xF0) {
- if (dcs < 0xE0)
+ if (dcs < 0xE0) {
pCodingScheme.setCodingGroupType(EnumConstants.TAPI_NETTEXT_CODGRP_SM_WAITING_STORE);
- else
+ } else {
pCodingScheme.setCodingGroupType(EnumConstants.TAPI_NETTEXT_CODGRP_SM_WAITING_STORE_UCS2);
+ }
if ((dcs & 0x08) != 0) {
pCodingScheme.setbMsgIndActive(true);
@@ -493,12 +502,12 @@ public class DecodeMsg {
}
}
- private void SmsUtilDecodeAddrField_sca(char[] diallingNum, char[] pAddrField) {
+ private boolean SmsUtilDecodeAddrField_sca(char[] diallingNum, char[] pAddrField) {
int index = 0;
int dialnumLen = 0;
int length = 0;
- ton = ((pAddrField[index + 1] & 0x70) >> 4);
+ ton = (pAddrField[index + 1] & 0x70) >> 4;
npi = pAddrField[index + 1] & 0x0F;
if (ton != EnumConstants.SIM_TON_ALPHA_NUMERIC) {
@@ -507,7 +516,7 @@ public class DecodeMsg {
dialnumLen = (pAddrField[index++] - 1) * 2;
}
} else {
- dialnumLen = (((pAddrField[index++] + 1) / 2) * 8) / 7;
+ dialnumLen = (pAddrField[index++] + 1) / 2 * 8 / 7;
}
if (dialnumLen > EnumConstants.SIM_SMSP_ADDRESS_LEN) {
@@ -518,24 +527,24 @@ public class DecodeMsg {
index++;
if (ton != EnumConstants.SIM_TON_ALPHA_NUMERIC) {
- SmsUtilConvertBCD2Digit(diallingNum, getCharArray(pAddrField, index), dialnumLen);
- } else {
- SmsUtilUnpackGSMCode(diallingNum, getCharArray(pAddrField, index), dialnumLen);
+ return SmsUtilConvertBCD2Digit(diallingNum, getCharArray(pAddrField, index), dialnumLen);
}
+ SmsUtilUnpackGSMCode(diallingNum, getCharArray(pAddrField, index), dialnumLen);
+ return true;
}
- private void SmsUtilDecodeAddrField_dst(char[] diallingNum, char[] pAddrField) {
+ private boolean SmsUtilDecodeAddrField_dst(char[] diallingNum, char[] pAddrField) {
// int ton, npi;
int index = 0;
int dialnumLen = 0;
- ton = ((pAddrField[index + 1] & (char)0x70)) >> 4;
+ ton = (pAddrField[index + 1] & (char)0x70) >> 4;
npi = pAddrField[index + 1] & 0x0F;
if (ton != EnumConstants.SIM_TON_ALPHA_NUMERIC) {
dialnumLen = pAddrField[index++];
} else {
- dialnumLen = (((pAddrField[index++] + 1) / 2) * 8) / 7;
+ dialnumLen = (pAddrField[index++] + 1) / 2 * 8 / 7;
}
if (dialnumLen > EnumConstants.SIM_SMSP_ADDRESS_LEN) {
@@ -546,28 +555,28 @@ public class DecodeMsg {
index++;
if (ton != EnumConstants.SIM_TON_ALPHA_NUMERIC) {
- SmsUtilConvertBCD2Digit(diallingNum, getCharArray(pAddrField, index), dialnumLen);
- } else {
- SmsUtilUnpackGSMCode(diallingNum, getCharArray(pAddrField, index), dialnumLen);
+ return SmsUtilConvertBCD2Digit(diallingNum, getCharArray(pAddrField, index), dialnumLen);
}
+ SmsUtilUnpackGSMCode(diallingNum, getCharArray(pAddrField, index), dialnumLen);
+ return true;
}
- private void SmsUtilConvertBCD2Digit(char[] pDigits, char[] pBCD, int digitLen) {
+ private boolean SmsUtilConvertBCD2Digit(char[] pDigits, char[] pBCD, int digitLen) {
int i, bcdLen;
char[] c = { 0x00, 0x00 };
char higher, lower;
if (pBCD == null || pDigits == null) {
- System.out.println(DeviceMessages.getString("DecodeMsg.0")); //$NON-NLS-1$
- throw null;
+ logger.warning(DeviceMessages.getString("DecodeMsg.0"));
+ return false;
}
if (digitLen == 0) {
pDigits[0] = 0x00;
- return;
+ return true;
}
- if ((digitLen % 2) != 0) {
+ if (digitLen % 2 != 0) {
bcdLen = digitLen / 2 + 1;
} else {
bcdLen = digitLen / 2;
@@ -589,7 +598,7 @@ public class DecodeMsg {
lower = (char) AcToupper(c[0]);
}
- higher = (char) ((pBCD[i] >> 4) & 0x0F);
+ higher = (char) (pBCD[i] >> 4 & 0x0F);
if (higher == 0x0A) {
higher = '*';
@@ -600,7 +609,7 @@ public class DecodeMsg {
} else if (higher == 0x0F) {
pDigits[getSize(pDigits)] = lower;
pDigits[bcdLen * 2 - 1] = '\0';
- return;
+ return true;
} else {
AcItoa(higher, c, 16);
higher = (char) AcToupper(c[0]);
@@ -609,6 +618,7 @@ public class DecodeMsg {
pDigits[getSize(pDigits)] = higher;
}
pDigits[digitLen] = '\0';
+ return true;
}
private int getSize(char[] array) {
@@ -619,7 +629,7 @@ public class DecodeMsg {
}
private int AcToupper(int ch) {
- return (('a' <= (ch) && (ch) <= 'z') ? ((ch) - ('a' - 'A')) : (ch));
+ return 'a' <= ch && ch <= 'z' ? ch - ('a' - 'A') : ch;
}
private void AcItoa(int n, char[] str, int b) {
@@ -646,13 +656,13 @@ public class DecodeMsg {
int pos = 0;
for (int i = 0; i < in_len; i++, pos++) {
- szData[i] = (char) ((pIn[pos] << shift) & 0x7F);
+ szData[i] = (char) (pIn[pos] << shift & 0x7F);
if (pos != 0) {
/*
* except the first byte, a character contains some bits from
* the previous byte
*/
- szData[i] |= pIn[pos - 1] >> (8 - shift);
+ szData[i] |= pIn[pos - 1] >> 8 - shift;
}
shift++;
diff --git a/ECP-DEVICES/src/org/tizen/ecp/telephony/ui/TelephonyController.java b/ECP-DEVICES/src/org/tizen/ecp/telephony/ui/TelephonyController.java
index c3f1dba..8ec934c 100644
--- a/ECP-DEVICES/src/org/tizen/ecp/telephony/ui/TelephonyController.java
+++ b/ECP-DEVICES/src/org/tizen/ecp/telephony/ui/TelephonyController.java
@@ -259,8 +259,11 @@ public class TelephonyController implements Initializable {
if (!originatingAddress_ComboData.contains(number)) {
originatingAddress_ComboData.add(number);
}
- protocolBuilder.sendMSG(number, port_cb.isSelected() ?
- Short.parseShort(fx_port_textfield.getText()) : -1, fx_message_textfield.getText());
+ short port = -1;
+ if (port_cb.isSelected() && fx_port_textfield.getText() != null) {
+ port = Short.parseShort(fx_port_textfield.getText());
+ }
+ protocolBuilder.sendMSG(number, port, fx_message_textfield.getText());
fx_message_textfield.clear();
}
@@ -305,12 +308,12 @@ public class TelephonyController implements Initializable {
MessageBox.error(TelephonyConstants.CALL_WAITING_MODE_OFF_ERR);
return null;
}
- String number = fx_MT_number_tf.getText().trim();
+ String number = fx_MT_number_tf.getText();
if (number == null || number.length() == 0) {
setConnectMTButtonStatus(false);
return null;
}
- return number;
+ return number.trim();
}
public void setCallWaiting(boolean status) {
@@ -437,9 +440,9 @@ public class TelephonyController implements Initializable {
} else if (status == 4 || status == 5) {
incoming = true;
}
-
+ byte[] number = body.getByteArray("NUMBER", i);
CallInfo cl = new CallInfo(body.getInt("IDX", i), status, body.getInt("MULTIPARTY", i), momt,
- new String(body.getByteArray("NUMBER", i)).trim());
+ (number.length != 0 ? new String(number) : new String("")).trim());
String tmp1 = cl.getNumber();
String tmp2 = fx_MO_number_lbl.getText();
@@ -503,8 +506,9 @@ public class TelephonyController implements Initializable {
if (status < 0 || momt < 0) {
continue;
}
+ byte[] number = body.getByteArray("NUMBER", i);
CallInfo cl = new CallInfo(body.getInt("IDX", i), status, body.getInt("MULTIPARTY", i), momt,
- new String(body.getByteArray("NUMBER", i)).trim());
+ (number.length != 0 ? new String(number) : new String("")).trim());
if (status == 4 || status == 5) {
incoming = true;
@@ -546,8 +550,9 @@ public class TelephonyController implements Initializable {
incoming = true;
}
+ byte[] number = body.getByteArray("NUMBER", i);
CallInfo cl = new CallInfo(body.getInt("IDX", i), status, body.getInt("MULTIPARTY", i), momt,
- new String(body.getByteArray("NUMBER", i)).trim());
+ (number.length != 0 ? new String(number) : new String("")).trim());
callList.add(cl);
calling = true;
@@ -577,14 +582,16 @@ public class TelephonyController implements Initializable {
StructureGA sga = aga.getBody();
int callId = sga.getInt("CALL_ID"); //$NON-NLS-1$
int callType = sga.getInt("CALL_TYPE"); //$NON-NLS-1$
- String callNumber = new String(sga.getByteArray("CALL_NUMBER")) //$NON-NLS-1$
- .trim();
+ byte[] number = sga.getByteArray("CALL_NUMBER");
+ String callNumber = (number.length != 0 ? new String(number) : new String("")).trim();
fx_MO_callID_lbl.setText(String.valueOf(callId));
fx_MO_number_lbl.setText(callNumber);
fx_MO_callType_lbl.setText(TelephonyConstants.CALL_TYPE_LIST[callType]);
- fx_MO_callType_lbl.getParent().layout();
+ if (fx_MO_callType_lbl.getParent() != null) {
+ fx_MO_callType_lbl.getParent().layout();
+ }
fx_MO_disconnect_btn.setDisable(false);
byte[] callStatus = sga.getByteArray("CALL_NUMBER"); //$NON-NLS-1$
@@ -701,6 +708,9 @@ public class TelephonyController implements Initializable {
public void run(AbstractGA aga) {
DecodeMsg decode = new DecodeMsg();
String[] msgData = protocolBuilder.parseMSG(aga.getBody(), decode);
+ if (msgData.length == 0) {
+ return;
+ }
fx_received_callNumber_lbl.setText(msgData[0]);
fx_received_msg_lbl.setText(msgData[1]);
protocolBuilder.sendDeliveryReport(decode, msgData[2]);
diff --git a/package/changelog b/package/changelog
index 658717f..dd747f8 100644
--- a/package/changelog
+++ b/package/changelog
@@ -1,3 +1,6 @@
+* 2.1.9
+- fix bugs and svace issue
+== Kyoungwon Park <kw0712.park@samsung.com> 2017-10-11
* 2.1.6
- sms cli: fix return message waiting process
== Kyoungwon Park <kw0712.park@samsung.com> 2017-04-12
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
index e4e22ca..c5c2ef1 100644
--- a/package/pkginfo.manifest
+++ b/package/pkginfo.manifest
@@ -1,5 +1,5 @@
Source: emulator-control-panel-devices
-Version: 2.1.6
+Version: 2.1.9
Maintainer: Jinhyung Choi <jinh0.choi@samsung.com>
Package: mobile-3.0-emulator-control-panel-devices