[siemensrds] Update to documentation (#13913)
* [siemensrds] resolve issue #13906 * [siemensrds] add chapter to readme Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
committed by
GitHub
parent
70cca8fc77
commit
3ea004ad35
@@ -27,6 +27,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
@@ -61,7 +62,7 @@ public class RdsAccessToken {
|
||||
|
||||
private @Nullable Date expDate = null;
|
||||
|
||||
/*
|
||||
/**
|
||||
* public static method: execute the HTTP POST on the server
|
||||
*/
|
||||
public static String httpGetTokenJson(String apiKey, String payload) throws RdsCloudException, IOException {
|
||||
@@ -105,14 +106,14 @@ public class RdsAccessToken {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* public method: parse the JSON, and create a class that encapsulates the data
|
||||
*/
|
||||
public static @Nullable RdsAccessToken createFromJson(String json) {
|
||||
return GSON.fromJson(json, RdsAccessToken.class);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* public method: return the access token
|
||||
*/
|
||||
public String getToken() throws RdsCloudException {
|
||||
@@ -123,14 +124,14 @@ public class RdsAccessToken {
|
||||
throw new RdsCloudException("no access token");
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* public method: check if the token has expired
|
||||
*/
|
||||
public boolean isExpired() {
|
||||
Date expDate = this.expDate;
|
||||
if (expDate == null) {
|
||||
try {
|
||||
expDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z").parse(expires);
|
||||
expDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH).parse(expires);
|
||||
} catch (ParseException e) {
|
||||
logger.debug("isExpired: expiry date parsing exception");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user