I am entirely new to Java with some background in C#. I am currently using Eclipse to run a method in a program to compare the method's arguments with usernames and passwords from a text file.
However, after running the code, I received an error called "java.lang.ArrayIndexOutOfBoundsException = 1". I do not understand why it has happened. Below contains the code and the file. I am trying to read only the three usernames and passwords on top.The other three below is just populating it and using later in the program.
**Update: Okay. I already fixed in changing the token into token[0] and token1. And it still doesn't work.
**Update no. 2: Also, this is the code that contains when I call the method. Below:
 s.login("tomrichards", "96744213");
public boolean login (String user, String password) {
  FileReader fr = new FileReader ("auth.txt");
  LineNumberReader r = new LineNumberReader (fr);
  String I = "";
  boolean identity = false;
  String name = "";
  String password = "";
  while ((I = r.readLine()) != null) {
    String [] token = I.split(";");
    name = token[0];
    pass = token[1];
    if (name.equals(user) && pass.equals(password)) {
      identity = true;
      System.out.println("Username " + name + "Password " + pass);
      return true;
    }
    else {
      identity = false;
      return false; 
    }
  }
   r.close();
}
**Update no.3: I double checked to see if there was any missing ";" in the text file, and there was none.

