aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-06-27 12:01:58 +0200
committerMattias Andrée <maandree@operamail.com>2013-06-27 12:01:58 +0200
commit5793b6bb9adb54a83229da47a1fa59500b57c396 (patch)
treeb1075b9edf8e37af89efa1861fd1f2fcc8f356eb
parentadd options to java test (diff)
downloadargparser-5793b6bb9adb54a83229da47a1fa59500b57c396.tar.gz
argparser-5793b6bb9adb54a83229da47a1fa59500b57c396.tar.bz2
argparser-5793b6bb9adb54a83229da47a1fa59500b57c396.tar.xz
message should be null if there are no message arguments
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/ArgParser.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ArgParser.java b/src/ArgParser.java
index c063b37..6611b04 100644
--- a/src/ArgParser.java
+++ b/src/ArgParser.java
@@ -1042,14 +1042,16 @@ public class ArgParser
break;
} }
- final StringBuilder sb = new StringBuilder();
- for (final String file : this.files)
- { sb.append(' ');
- sb.append(file);
+ if (this.files.size() > 0)
+ { final StringBuilder sb = new StringBuilder();
+ for (final String file : this.files)
+ { sb.append(' ');
+ sb.append(file);
+ }
+ this.message = sb.toString();
+ if (this.message.length() > 0)
+ this.message = this.message.substring(1);
}
- this.message = sb.toString();
- if (this.message.length() > 0)
- this.message = this.message.substring(1);
if (this.unrecognisedCount > 5)
{ int more = this.unrecognisedCount - 5;