Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed args bug

  • Loading branch information...
commit 165b5726fd1379c6c97408365e88e8e796edeced 1 parent f34c2d4
@janpaul123 janpaul123 authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 Main.java
View
10 Main.java
@@ -20,16 +20,16 @@ public Main(String[] args)
ICache cache;
try {
- if (args.length < 5) throw new Exception("Usage: java Main port configfile.txt serverId cacheSize");
+ if (args.length < 4) throw new Exception("Usage: java Main port configfile.txt serverId cacheSize");
- Scanner scanner = new Scanner(new FileInputStream(args[2]));
+ Scanner scanner = new Scanner(new FileInputStream(args[1]));
Vector<String> serverNames = new Vector<String>();
while (scanner.hasNextLine()) {
serverNames.add(scanner.nextLine());
}
- cache = new RemoteCache((String[])serverNames.toArray(), Integer.parseInt(args[3]), new BasicCache(Integer.parseInt(args[4])));
+ cache = new RemoteCache((String[])serverNames.toArray(), Integer.parseInt(args[2]), new BasicCache(Integer.parseInt(args[3])));
} catch (Exception e) {
e.printStackTrace();
System.err.println("Using basic cache...");
@@ -38,8 +38,8 @@ public Main(String[] args)
int port;
- if (args.length > 1)
- port = Integer.parseInt(args[1]);
+ if (args.length > 0)
+ port = Integer.parseInt(args[0]);
else
port = 8081;
Please sign in to comment.
Something went wrong with that request. Please try again.