diff --git a/README.md b/README.md index 682f2ba4a..1142b54d7 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,19 @@ Java 1.8 or above, with one of the following environments: io.minio minio - 7.0.2 + 7.1.4 ``` ## Download from gradle ```xml dependencies { - compile 'io.minio:minio:7.0.2' + compile 'io.minio:minio:7.1.4' } ``` ## Download from JAR -You can download the latest [JAR](https://repo1.maven.org/maven2/io/minio/minio/7.0.2/) directly from maven. +You can download the latest [JAR](https://repo1.maven.org/maven2/io/minio/minio/7.1.4/) directly from maven. ## Quick Start Example - File Uploader This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket. @@ -60,7 +60,7 @@ public class FileUploader { MinioClient minioClient = new MinioClient("https://play.min.io", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); // Check if the bucket already exists. - boolean isExist = + boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket("asiatrip").build()); if(isExist) { System.out.println("Bucket already exists."); @@ -81,12 +81,12 @@ public class FileUploader { #### Compile FileUploader ```sh -javac -cp "minio-7.0.2-all.jar" FileUploader.java +javac -cp "minio-7.1.4-all.jar" FileUploader.java ``` #### Run FileUploader ```sh -java -cp "minio-7.0.2-all.jar:." FileUploader +java -cp "minio-7.1.4-all.jar:." FileUploader /home/user/Photos/asiaphotos.zip is successfully uploaded as asiaphotos.zip to `asiatrip` bucket. mc ls play/asiatrip/ diff --git a/api/src/main/java/io/minio/ObjectWriteArgs.java b/api/src/main/java/io/minio/ObjectWriteArgs.java index c16f04961..59f74bb47 100644 --- a/api/src/main/java/io/minio/ObjectWriteArgs.java +++ b/api/src/main/java/io/minio/ObjectWriteArgs.java @@ -90,7 +90,7 @@ public Multimap genHeaders() { headers.put("x-amz-object-lock-mode", retention.mode().name()); headers.put( "x-amz-object-lock-retain-until-date", - retention.retainUntilDate().format(Time.HTTP_HEADER_DATE_FORMAT)); + retention.retainUntilDate().format(Time.RESPONSE_DATE_FORMAT)); } if (legalHold) { diff --git a/api/src/main/java/io/minio/Signer.java b/api/src/main/java/io/minio/Signer.java index 7a254d905..e7154cd2c 100644 --- a/api/src/main/java/io/minio/Signer.java +++ b/api/src/main/java/io/minio/Signer.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; +import java.util.stream.Collectors; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import okhttp3.Headers; @@ -142,7 +143,18 @@ private void setCanonicalHeaders() { for (String name : headers.names()) { String signedHeader = name.toLowerCase(Locale.US); if (!IGNORED_HEADERS.contains(signedHeader)) { - this.canonicalHeaders.put(signedHeader, headers.get(name)); + // Convert and add header values as per + // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html + // * Header having multiple values should be converted to comma separated values. + // * Multi-spaced value of header should be trimmed to single spaced value. + this.canonicalHeaders.put( + signedHeader, + headers.values(name).stream() + .map( + value -> { + return value.replaceAll("( +)", " "); + }) + .collect(Collectors.joining(","))); } } diff --git a/build.gradle b/build.gradle index e334f7368..d68a1ecd7 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,8 @@ plugins { id "com.github.johnrengelman.shadow" version "5.2.0" id "com.github.spotbugs" version "4.0.1" - id "io.codearte.nexus-staging" version "0.21.2" + id "io.codearte.nexus-staging" version "0.22.0" + id "de.marcphilipp.nexus-publish" version "0.4.0" id "com.diffplug.gradle.spotless" version "4.4.0" } @@ -29,10 +30,11 @@ plugins { * Root project definitions */ apply plugin: 'io.codearte.nexus-staging' +apply plugin: "de.marcphilipp.nexus-publish" allprojects { group = 'io.minio' - version = '7.1.0' + version = '7.1.5' if (!project.hasProperty('release')) { version += '-DEV' } @@ -44,6 +46,7 @@ subprojects { apply plugin: "com.diffplug.gradle.spotless" repositories { + mavenLocal() mavenCentral() } @@ -93,7 +96,7 @@ subprojects { check.dependsOn localeTest - sourceCompatibility = 1.8 + sourceCompatibility = JavaVersion.VERSION_1_8 spotless { java { @@ -109,17 +112,15 @@ subprojects { } project(':api') { - apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'java' apply plugin: 'maven' + apply plugin: 'maven-publish' apply plugin: 'signing' + apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: "de.marcphilipp.nexus-publish" archivesBaseName = 'minio' - nexusStaging { - packageGroup = group - stagingProfileId = '9b746c9f8abc1' - } - configurations.all { resolutionStrategy { force 'com.fasterxml.jackson.core:jackson-annotations:2.9.6' @@ -162,65 +163,67 @@ project(':api') { } } - artifacts { - archives javadocJar, sourcesJar, shadowJar - } - - signing { - if (project.properties.containsKey('signing.keyId')) { - sign configurations.archives - } - } - - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { - MavenDeployment deployment -> signing.signPom(deployment) - } - - ext.nexusUsername = project.properties['nexusUsername'] - ext.nexusPassword = project.properties['nexusPassword'] - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ext.nexusUsername, password: ext.nexusPassword) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ext.nexusUsername, password: ext.nexusPassword) - } - - pom.project { - name 'minio' - packaging 'jar' - description 'MinIO Java SDK for Amazon S3 Compatible Cloud Storage' - url 'https://github.com/minio/minio-java' - inceptionYear '2015' + publishing { + publications { + mavenJava(MavenPublication) { + artifactId archivesBaseName + from components.java + artifact sourcesJar + artifact shadowJar + artifact javadocJar + pom { + name = 'minio' + packaging = 'jar' + description = 'MinIO Java SDK for Amazon S3 Compatible Cloud Storage' + url = 'https://github.com/minio/minio-java' + inceptionYear = '2015' scm { - connection 'scm:git:git@github.com:minio/minio-java.git' - developerConnection 'scm:git:git@github.com:minio/minio-java.git' - url 'http://github.com/minio/minio-java' + connection = 'scm:git:git@github.com:minio/minio-java.git' + developerConnection = 'scm:git:git@github.com:minio/minio-java.git' + url = 'http://github.com/minio/minio-java' } licenses { license { - name 'The Apache License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { - id 'minio' - name 'MinIO Inc.' - email 'dev@min.io' + id = 'minio' + name = 'MinIO Inc.' + email = 'dev@min.io' } } } } } } + + signing { + if (project.properties.containsKey('signing.keyId')) { + sign publishing.publications.mavenJava + } + } + + nexusStaging { + packageGroup = group + stagingProfileId = '9b746c9f8abc1' + username = project.properties['nexusUsername'] + password = project.properties['nexusPassword'] + } + + nexusPublishing { + repositories { + sonatype { + username = project.properties['nexusUsername'] + password = project.properties['nexusPassword'] + } + } + } } project(':examples') { diff --git a/functional/FunctionalTest.java b/functional/FunctionalTest.java index f840844b0..a9131a983 100644 --- a/functional/FunctionalTest.java +++ b/functional/FunctionalTest.java @@ -846,6 +846,8 @@ public static void putObject_test() throws Exception { Map userMetadata = new HashMap<>(); userMetadata.put("My-Project", "Project One"); + userMetadata.put("My-header1", " a b c "); + userMetadata.put("My-Header2", "\"a b c\""); testPutObject( "[user metadata]",