Skip to content

Commit

Permalink
fix(category): remove characters specials of the output XML
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Del Pino <idelpino@teclib.com>
  • Loading branch information
Ivan Del Pino authored and rafaelje committed Sep 26, 2018
1 parent 7e258d7 commit 9ddf0a3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example_java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {

defaultConfig {
applicationId "org.flyve.example_java"
minSdkVersion 23
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public CategoryValue(String value, String xmlName, String jsonName) {
jsonName = "";
}

if (value.contains("<") || value.contains(">")) {
value = value.replaceAll("[<>]", "");
}

this.value = value;
this.jsonName = jsonName;
this.xmlName = xmlName;
Expand All @@ -73,6 +77,10 @@ public CategoryValue(String value, String xmlName, String jsonName, Boolean isPr
jsonName = "";
}

if (value.contains("<") || value.contains(">")) {
value = value.replaceAll("[<>]", "");
}

this.value = value;
this.jsonName = jsonName;
this.xmlName = xmlName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@
import android.net.DhcpInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;

import org.flyve.inventory.FILog;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.net.Inet6Address;
Expand All @@ -53,8 +50,6 @@
import java.util.List;
import java.util.Scanner;

import static android.content.Context.TELEPHONY_SERVICE;

/**
* This class get all the information of the Network
*/
Expand Down Expand Up @@ -207,7 +202,7 @@ public String getSpeed() {
* @return string the BSSID of the current access point
*/
public String getBSSID() {
return String.valueOf(wifi.getBSSID());
return wifi.getBSSID() != null ? String.valueOf(wifi.getBSSID()) : "N/A";
}

/**
Expand All @@ -216,7 +211,7 @@ public String getBSSID() {
*
*/
public String getSSID() {
return String.valueOf(wifi.getSSID());
return wifi.getSSID() != null ? String.valueOf(wifi.getSSID()) : "N/A";
}

/**
Expand Down Expand Up @@ -287,8 +282,10 @@ public String getDescription() {
try {
InetAddress inetAddress = InetAddress.getByAddress(ip);
NetworkInterface netInterface = NetworkInterface.getByInetAddress(inetAddress);
name = netInterface.getDisplayName();
return name;
if (netInterface != null ) {
name = netInterface.getDisplayName();
return name;
}
} catch (UnknownHostException e) {
FILog.e(e.getMessage());
} catch (SocketException e) {
Expand Down

0 comments on commit 9ddf0a3

Please sign in to comment.