From cf6c567567c5dda3bf79a9787d35a7ccc875e0a3 Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Thu, 17 Mar 2016 11:49:24 -0700 Subject: [PATCH 1/5] Update IPUtil.java handle NPE --- src/javachat/network/util/IPUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/javachat/network/util/IPUtil.java b/src/javachat/network/util/IPUtil.java index 2545011..09ddd0e 100644 --- a/src/javachat/network/util/IPUtil.java +++ b/src/javachat/network/util/IPUtil.java @@ -39,7 +39,7 @@ public static String getExternalIPAddress(){ return in.readLine(); //you get the IP as a String } catch (IOException ex) { } finally { - try { in.close(); } catch (IOException ex) {} + try { in.close(); } catch (Exception ex) {} } return null; } From 5172f189547bcf4302fb4300cb4481904a0aee5b Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Thu, 17 Mar 2016 11:51:26 -0700 Subject: [PATCH 2/5] Create start-chat.sh quick startup script --- start-chat.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 start-chat.sh diff --git a/start-chat.sh b/start-chat.sh new file mode 100644 index 0000000..6e8a6d6 --- /dev/null +++ b/start-chat.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +java -classpath dist/JavaChat.jar:lib/\* javachat.JavaChat > /dev/null 2>&1 From 0024ce4a861d089556f0fc05cf80e713dd2ebe44 Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Thu, 17 Mar 2016 12:09:07 -0700 Subject: [PATCH 3/5] Update README credit author --- README | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README b/README index 9d5b1ec..044132d 100644 --- a/README +++ b/README @@ -6,4 +6,7 @@ client programs to join. When running as the server a local client is created to connect to it. -------------------------------------------------------------------------------- Code in this project is licensed under the GNU GENERAL PUBLIC LICENSE -http://www.gnu.org/licenses/gpl.txt \ No newline at end of file +http://www.gnu.org/licenses/gpl.txt + +Written by Chris Hallson and originally found here: https://github.com/DrLabman/JavaChat +Only slight modification to suit my environment. From 612923651f92989dea103f144a8f9df6da487632 Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Fri, 25 Mar 2016 14:02:56 -0700 Subject: [PATCH 4/5] update start script for gumshoe options --- start-chat.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/start-chat.sh b/start-chat.sh index 6e8a6d6..e6487cc 100644 --- a/start-chat.sh +++ b/start-chat.sh @@ -1,3 +1,60 @@ #! /bin/sh +# -java -classpath dist/JavaChat.jar:lib/\* javachat.JavaChat > /dev/null 2>&1 +## make sure JavaChat is ready +if [ -z "$CHAT_HOME" ] +then + CHAT_HOME=`dirname $0` +fi + +if [ ! -f $CHAT_HOME/dist/JavaChat.jar ] +then + echo 'ERROR: JavaChat library not found (project not built?)' 1>&2 + exit 1 +fi + +## configure java cmdline for JavaChat + +# classpath + no other jvm options + main class +if [ -z "$CLASSPATH" ] +then + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/\*" +else + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/\*:$CLASSPATH" +fi +CHAT_OPTS= +CHAT_ARGS=javachat.JavaChat + +#### include gumshoe? + +if [ "x$1" = x--gumshoe ] +then + ## make sure gumshoe is ready + if [ -z "$GUMSHOE_HOME ] + then + echo ERROR: UMSHOE_HOME environment variable is not set 1>&2 + exit 1 + fi + if [ ! -f $GUMSHOE_HOME/gumshoe-probes/target/gumshoe-probes-0.1.0-SNAPSHOT.jar -o \ + ! -f $GUMSHOE_HOME/gumshoe-tools/target/gumshoe-tools-0.1.0-SNAPSHOT.jar ] + then + echo 'ERROR: gumshoe libraries not found (GUMSHOE_HOME wrong value or project not built?)' 1>&2 + exit 1 + fi + + ## update java cmdline for gumshoe + + # add gumshoe probe (data collection/filtering) and tool (gui) libs to classpath + CLASSPATH="$CLASSPATH:$GUMSHOE_HOME/gumshoe-probes/target/gumshoe-probes-0.1.0-SNAPSHOT.jar" + CLASSPATH="$CLASSPATH:$GUMSHOE_HOME/gumshoe-tools/target/gumshoe-tools-0.1.0-SNAPSHOT.jar" + # add tiny hook to JVM + CHAT_OPTS="$CHAT_OPTS -Xbootclasspath/p:$GUMSHOE_HOME/gumshoe-hooks/target/gumshoe-hooks-0.1.0-SNAPSHOT.jar" + # makes a better demo if we report faster (30s) and don't trim the stack + CHAT_OPTS="$CHAT_OPTS -Dgumshoe.socket-io.period=30000" + CHAT_OPTS="$CHAT_OPTS -Dgumshoe.socket-io.exclude=" + # gumshoe becomes "main" + CHAT_ARGS="com.dell.gumshoe.tools.Gumshoe $CHAT_ARGS" +fi + +## run it +java -classpath "$CLASSPATH" $CHAT_OPTS $CHAT_ARGS > /dev/null 2>&1 From 303c5d74111c020274cdaa8ae6bea384f55ed75a Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Mon, 28 Mar 2016 11:57:51 -0700 Subject: [PATCH 5/5] fix startup scrip CLASSPATH, update notes --- .gitignore | 2 ++ README | 3 ++- start-chat.sh | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d0b71a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +dist diff --git a/README b/README index 044132d..b403d80 100644 --- a/README +++ b/README @@ -9,4 +9,5 @@ Code in this project is licensed under the GNU GENERAL PUBLIC LICENSE http://www.gnu.org/licenses/gpl.txt Written by Chris Hallson and originally found here: https://github.com/DrLabman/JavaChat -Only slight modification to suit my environment. +Only slight modification to suit my environment. And handle one exception (could not run +without whatismyip.com). diff --git a/start-chat.sh b/start-chat.sh index e6487cc..7e37e89 100644 --- a/start-chat.sh +++ b/start-chat.sh @@ -18,9 +18,9 @@ fi # classpath + no other jvm options + main class if [ -z "$CLASSPATH" ] then - CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/\*" + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/*" else - CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/\*:$CLASSPATH" + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/*:$CLASSPATH" fi CHAT_OPTS= CHAT_ARGS=javachat.JavaChat @@ -30,9 +30,9 @@ CHAT_ARGS=javachat.JavaChat if [ "x$1" = x--gumshoe ] then ## make sure gumshoe is ready - if [ -z "$GUMSHOE_HOME ] + if [ -z "$GUMSHOE_HOME" ] then - echo ERROR: UMSHOE_HOME environment variable is not set 1>&2 + echo ERROR: GUMSHOE_HOME environment variable is not set 1>&2 exit 1 fi if [ ! -f $GUMSHOE_HOME/gumshoe-probes/target/gumshoe-probes-0.1.0-SNAPSHOT.jar -o \ @@ -57,4 +57,4 @@ then fi ## run it -java -classpath "$CLASSPATH" $CHAT_OPTS $CHAT_ARGS > /dev/null 2>&1 +java -classpath "$CLASSPATH" $CHAT_OPTS $CHAT_ARGS