token-import: handle empty urls better

This commit is contained in:
Vincent Breitmoser
2017-09-05 20:28:09 +02:00
parent f1852338af
commit c1773de1c3
2 changed files with 3 additions and 2 deletions

View File

@@ -589,7 +589,7 @@ public class SecurityTokenHelper {
public String getUrl() throws IOException { public String getUrl() throws IOException {
byte[] data = getData(0x5F, 0x50); byte[] data = getData(0x5F, 0x50);
return new String(data); return new String(data).trim();
} }
public String getUserId() throws IOException { public String getUserId() throws IOException {

View File

@@ -29,6 +29,7 @@ import android.net.Uri;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.AsyncTaskLoader; import android.support.v4.content.AsyncTaskLoader;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.google.auto.value.AutoValue; import com.google.auto.value.AutoValue;
@@ -159,7 +160,7 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
try { try {
log.add(LogType.MSG_RET_URI_START, 0); log.add(LogType.MSG_RET_URI_START, 0);
if (tokenUri == null) { if (TextUtils.isEmpty(tokenUri)) {
log.add(LogType.MSG_RET_URI_NULL, 1); log.add(LogType.MSG_RET_URI_NULL, 1);
return KeyRetrievalResult.createWithError(log); return KeyRetrievalResult.createWithError(log);
} }