File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
tmc-plugin/src/fi/helsinki/cs/tmc/spyware Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public String updateHostInformation(EventReceiver receiver) {
31
31
LoggableEvent event
32
32
= new LoggableEvent (
33
33
"host_information_update" ,
34
- data .toString ().getBytes (UTF8 ));
34
+ data .toString ().getBytes (Charset . forName ( "UTF-8" ) ));
35
35
receiver .receiveEvent (event );
36
36
37
37
return hostId ;
@@ -40,6 +40,14 @@ public String updateHostInformation(EventReceiver receiver) {
40
40
private static JsonMaker getStaticHostInformation () {
41
41
JsonMaker builder = JsonMaker .create ();
42
42
43
+ try {
44
+ InetAddress localMachine = java .net .InetAddress .getLocalHost ();
45
+ builder .add ("hostAddress" , localMachine .getHostAddress ());
46
+ builder .add ("hostName" , localMachine .getHostName ());
47
+ } catch (Exception ex ) {
48
+ log .log (Level .WARNING , "Exception while getting host name information: {0}" , ex );
49
+ }
50
+
43
51
try {
44
52
Enumeration <NetworkInterface > iterator = NetworkInterface .getNetworkInterfaces ();
45
53
List <String > macs = new ArrayList <String >(2 );
@@ -116,5 +124,5 @@ private static String byteToHex(byte[] bytes) {
116
124
}
117
125
return sb .toString ();
118
126
}
119
- }
120
127
128
+ }
You can’t perform that action at this time.
0 commit comments