Fixed bug #18 - login with empty username

This commit is contained in:
Gideon le Grange 2015-03-28 17:03:05 +02:00
parent cddb19d11f
commit ae639d323f
1 changed files with 3 additions and 0 deletions

View File

@ -85,6 +85,9 @@ public final class ApiConnectionImpl extends ApiConnection {
*/
@Override
public void login(String username, String password) throws MikrotikApiException, InterruptedException {
if (username.trim().isEmpty()) {
throw new ApiConnectionException("API username cannot be empty");
}
List<Map<String, String>> list = execute("/login");
Map<String, String> res = list.get(0);
String hash = res.get("ret");