/** * If they key's format looks correct, return {@code null}. Otherwise return * a string that describes what the problem is. * * <p> * NOTE: This function only performs some cursory checks on the format of the key. * Even if it returns {@code null} (which means "no problem"), it doesn't mean * that what you passed in is an actual valid Dropbox API app key. * </p> */ public static /*@Nullable*/String getKeyFormatError(String key) { return getTokenPartError(key); }
/** * If they secret's format looks correct, return {@code null}. Otherwise return * a string that describes what the problem is. * * <p> * NOTE: This function only performs some cursory checks on the format. Even if it * returns {@code null} (which means "no problem"), it doesn't mean that what * you passed in is an actual valid Dropbox API app key. * </p> */ public static /*@Nullable*/String getSecretFormatError(String key) { return getTokenPartError(key); }
public static void checkKeyArg(String key) { String error = getTokenPartError(key); if (error == null) return; throw new IllegalArgumentException("Bad 'key': " + error); }
public static void checkSecretArg(String secret) { String error = getTokenPartError(secret); if (error == null) return; throw new IllegalArgumentException("Bad 'secret': " + error); } }
@Override public String read(JsonParser parser) throws IOException, JsonReadException { try { String v = parser.getText(); String error = DbxAppInfo.getTokenPartError(v); if (error != null) { throw new JsonReadException(error, parser.getTokenLocation()); } parser.nextToken(); return v; } catch (JsonParseException ex) { throw JsonReadException.fromJackson(ex); } }