From b583761ae43224ab9f16752fdc7808d325b22159 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Fri, 11 Feb 2022 10:49:02 -0800 Subject: [PATCH 1/3] Don't modify signature of 'Connection' constructor. --- labkey-client-api/src/org/labkey/remoteapi/Connection.java | 7 ++++--- .../src/org/labkey/remoteapi/query/ImportDataCommand.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/labkey-client-api/src/org/labkey/remoteapi/Connection.java b/labkey-client-api/src/org/labkey/remoteapi/Connection.java index 15c7b63f..aa67c7f0 100644 --- a/labkey-client-api/src/org/labkey/remoteapi/Connection.java +++ b/labkey-client-api/src/org/labkey/remoteapi/Connection.java @@ -173,13 +173,14 @@ public Connection(String baseUrl, CredentialsProvider credentialsProvider) * Constructs a new Connection object with a base URL that attempts authentication via .netrc/_netrc entry, if present. * If not present, connects as guest. * @param baseUrl The base URL + * @throws URISyntaxException if the given url is not a valid URI * @throws IOException if there are problems reading the credentials * @see NetrcCredentialsProvider * @see #Connection(URI, CredentialsProvider) */ - public Connection(String baseUrl) throws IOException + public Connection(String baseUrl) throws URISyntaxException, IOException { - this(toURI(baseUrl), new NetrcCredentialsProvider(toURI(baseUrl))); + this(new URI(baseUrl), new NetrcCredentialsProvider(new URI(baseUrl))); } /** @@ -541,4 +542,4 @@ private static URI toURI(String baseUrl) throw new IllegalArgumentException("Invalid target server URL: " + baseUrl); } } -} \ No newline at end of file +} diff --git a/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java b/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java index 6a6462d0..8774c74f 100644 --- a/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java +++ b/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java @@ -32,6 +32,7 @@ import java.io.InputStreamReader; import java.io.StringWriter; import java.net.URI; +import java.net.URISyntaxException; import java.util.Arrays; import java.util.Objects; import java.util.stream.Collectors; @@ -297,7 +298,7 @@ public ImportDataCommand copy() return new ImportDataCommand(this); } - public static void main(String[] args) throws IOException + public static void main(String[] args) throws IOException, URISyntaxException { // required String baseServerUrl = null; From d4a948fdaad0dca64c50db8885bb75b0b82573d3 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Fri, 11 Feb 2022 16:15:51 -0800 Subject: [PATCH 2/3] Update changelog for next release --- labkey-client-api/CHANGELOG.md | 8 +++++++- .../src/org/labkey/remoteapi/Connection.java | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/labkey-client-api/CHANGELOG.md b/labkey-client-api/CHANGELOG.md index 96add7c5..b36a360e 100644 --- a/labkey-client-api/CHANGELOG.md +++ b/labkey-client-api/CHANGELOG.md @@ -1,8 +1,14 @@ # The LabKey Remote API Library for Java - Change Log +## version TBD +*Released*: TBD +* [Issue 43380](https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=43380): ImportDataCommand missing options supported by query-import.api +* Remove `CheckForStudyReloadCommand.java` +* Remove `URISyntaxException` from one `Connection` constructor + ## version 1.4.0 *Released*: 16 June 2021 -* Issue 43246: Lineage query NPE while processing an UploadedFile +* [Issue 43246](https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=43246): Lineage query NPE while processing an UploadedFile * Additional lineage options and support additional properties in response * Update dependency version numbers * Update to Gradle 7.1 diff --git a/labkey-client-api/src/org/labkey/remoteapi/Connection.java b/labkey-client-api/src/org/labkey/remoteapi/Connection.java index aa67c7f0..80f133d5 100644 --- a/labkey-client-api/src/org/labkey/remoteapi/Connection.java +++ b/labkey-client-api/src/org/labkey/remoteapi/Connection.java @@ -142,7 +142,7 @@ public Connection(URI baseURI, CredentialsProvider credentialsProvider) { if (baseURI.getHost() == null || baseURI.getScheme() == null) { - throw new IllegalArgumentException("Invalid server URL: " + baseURI.toString()); + throw new IllegalArgumentException("Invalid server URL: " + baseURI); } _baseURI = baseURI; _credentialsProvider = credentialsProvider; @@ -173,14 +173,13 @@ public Connection(String baseUrl, CredentialsProvider credentialsProvider) * Constructs a new Connection object with a base URL that attempts authentication via .netrc/_netrc entry, if present. * If not present, connects as guest. * @param baseUrl The base URL - * @throws URISyntaxException if the given url is not a valid URI * @throws IOException if there are problems reading the credentials * @see NetrcCredentialsProvider * @see #Connection(URI, CredentialsProvider) */ - public Connection(String baseUrl) throws URISyntaxException, IOException + public Connection(String baseUrl) throws IOException { - this(new URI(baseUrl), new NetrcCredentialsProvider(new URI(baseUrl))); + this(toURI(baseUrl), new NetrcCredentialsProvider(toURI(baseUrl))); } /** From afffbde0c047c5ed03099fe712c6c1e20eb0f3c0 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Mon, 18 Apr 2022 13:30:22 -0700 Subject: [PATCH 3/3] Clean up some warnings --- .../src/org/labkey/remoteapi/query/ImportDataCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java b/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java index 8774c74f..202f8f76 100644 --- a/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java +++ b/labkey-client-api/src/org/labkey/remoteapi/query/ImportDataCommand.java @@ -32,7 +32,7 @@ import java.io.InputStreamReader; import java.io.StringWriter; import java.net.URI; -import java.net.URISyntaxException; +import java.nio.charset.Charset; import java.util.Arrays; import java.util.Objects; import java.util.stream.Collectors; @@ -298,7 +298,7 @@ public ImportDataCommand copy() return new ImportDataCommand(this); } - public static void main(String[] args) throws IOException, URISyntaxException + public static void main(String[] args) throws IOException { // required String baseServerUrl = null; @@ -581,7 +581,7 @@ private static void printUsage() private static String readFully(InputStream in) throws IOException { StringWriter sw = new StringWriter(); - try (BufferedReader buf = new BufferedReader(new InputStreamReader(in))) + try (BufferedReader buf = new BufferedReader(new InputStreamReader(in, Charset.defaultCharset()))) { String line; do