|
|
вернуться в форумRuntime error 4 switch(in.sval) { case "register": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); in.nextToken(); pas=in.sval; if(pas==null) pas=Integer.toString((int)in.nval); if(m.containsKey(log)) out.println("fail: user already exists"); else { m.put(log,pas); out.println("success: new user added"); } } break; case "login": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); in.nextToken(); pas=in.sval; if(pas==null) pas=Integer.toString((int)in.nval); if(!m.containsKey(log)) out.println("fail: no such user"); else if(!m.get(log).equals(pas)) out.println("fail: incorrect password"); else if(a.contains(log)) out.println("fail: already logged in"); else { a.add(log); //out.println(m.get(log) + " " + pas); out.println("success: user logged in"); } } break; case "logout": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); if(!m.containsKey(log)) out.println("fail: no such user"); else if(!a.contains(log)) out.println("fail: already logged out"); else { a.remove(log); out.println("success: user logged out"); } } break;
} |
|
|