Fixed bug #18 - login with empty username
This commit is contained in:
parent
cddb19d11f
commit
ae639d323f
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue