From 2801dabe425a03c2c497bbab5bd35020f1f5f30b Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Thu, 1 Nov 2018 13:34:59 +0100 Subject: [PATCH 1/4] Bump dev version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b26135b2..7ba1b754 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ subprojects { // Configuration // //---------------------------------------------------------------------------// - version = '0.11.2' + version = '0.11.3-SNAPSHOT' group = 'org.radarcns' ext.githubRepoName = 'RADAR-CNS/RADAR-Commons' From 168a6fdf9a83295098a251c6bea302cbfcc28ae5 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 6 Nov 2018 15:14:57 +0100 Subject: [PATCH 2/4] Fix buffer overflow issue --- .../java/org/radarcns/producer/rest/BinaryRecordRequest.java | 2 +- .../main/java/org/radarcns/producer/rest/JsonRecordRequest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/radar-commons/src/main/java/org/radarcns/producer/rest/BinaryRecordRequest.java b/radar-commons/src/main/java/org/radarcns/producer/rest/BinaryRecordRequest.java index 5b710935..8b1df3ae 100644 --- a/radar-commons/src/main/java/org/radarcns/producer/rest/BinaryRecordRequest.java +++ b/radar-commons/src/main/java/org/radarcns/producer/rest/BinaryRecordRequest.java @@ -127,6 +127,6 @@ public void prepare(ParsedSchemaMetadata keySchema, ParsedSchemaMetadata valueSc public String content(int maxLength) throws IOException { Buffer buffer = new Buffer(); writeToSink(buffer, maxLength / 2 - 2); - return "0x" + bytesToHex(buffer.readByteArray(maxLength - 2)); + return "0x" + bytesToHex(buffer.readByteArray(Math.min(buffer.size(), maxLength - 2))); } } diff --git a/radar-commons/src/main/java/org/radarcns/producer/rest/JsonRecordRequest.java b/radar-commons/src/main/java/org/radarcns/producer/rest/JsonRecordRequest.java index 42984dd2..fbd13b3f 100644 --- a/radar-commons/src/main/java/org/radarcns/producer/rest/JsonRecordRequest.java +++ b/radar-commons/src/main/java/org/radarcns/producer/rest/JsonRecordRequest.java @@ -121,6 +121,6 @@ public void prepare(ParsedSchemaMetadata keySchema, ParsedSchemaMetadata valueSc public String content(int maxLength) throws IOException { Buffer buffer = new Buffer(); writeToSink(buffer, maxLength); - return buffer.readString(maxLength, StandardCharsets.UTF_8); + return buffer.readString(Math.min(buffer.size(), maxLength), StandardCharsets.UTF_8); } } From 3b1d6ff4747bd43f3c939e1b531d947e65543d72 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Fri, 9 Nov 2018 10:32:23 +0100 Subject: [PATCH 3/4] Ensure that serverschema is not set if an exception occurs --- .../src/main/java/org/radarcns/data/RemoteSchemaEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radar-commons/src/main/java/org/radarcns/data/RemoteSchemaEncoder.java b/radar-commons/src/main/java/org/radarcns/data/RemoteSchemaEncoder.java index 97d6cbd5..e9934279 100644 --- a/radar-commons/src/main/java/org/radarcns/data/RemoteSchemaEncoder.java +++ b/radar-commons/src/main/java/org/radarcns/data/RemoteSchemaEncoder.java @@ -63,7 +63,6 @@ public final void setReaderSchema(ParsedSchemaMetadata readerSchema) && readerSchema.getSchema().equals(this.serverSchema.getSchema())) { return; } - this.serverSchema = readerSchema; try { if (!isGeneric) { this.mapper = AvroDataMapperFactory.IDENTITY_MAPPER; @@ -74,6 +73,7 @@ public final void setReaderSchema(ParsedSchemaMetadata readerSchema) null); encoder = recordEncoder.writer(readerSchema.getSchema(), Object.class); } + this.serverSchema = readerSchema; } catch (IOException ex) { throw new IllegalStateException("Cannot construct Avro writer", ex); } From 06918a8b679e0c1908102ad7816d80436de4b02a Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 13 Nov 2018 16:25:21 +0100 Subject: [PATCH 4/4] Bump version --- README.md | 10 +++++----- build.gradle | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fb97e12d..dced8fce 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation group: 'org.radarcns', name: 'radar-commons', version: '0.11.2' + implementation group: 'org.radarcns', name: 'radar-commons', version: '0.11.3' } ``` @@ -26,7 +26,7 @@ repositories { } dependencies { - implementation group: 'org.radarcns', name: 'radar-commons-server', version: '0.11.2' + implementation group: 'org.radarcns', name: 'radar-commons-server', version: '0.11.3' } ``` @@ -40,7 +40,7 @@ repositories { } dependencies { - testImplementation group: 'org.radarcns', name: 'radar-commons-testing', version: '0.11.2' + testImplementation group: 'org.radarcns', name: 'radar-commons-testing', version: '0.11.3' } ``` @@ -53,7 +53,7 @@ repositories { } dependencies { - runtimeOnly group: 'org.radarcns', name: 'radar-commons-unsafe', version: '0.11.2' + runtimeOnly group: 'org.radarcns', name: 'radar-commons-unsafe', version: '0.11.3' } ``` @@ -78,7 +78,7 @@ configurations.all { } dependencies { - compile group: 'org.radarcns', name: 'radar-commons', version: '0.11.3-SNAPSHOT', changing: true + compile group: 'org.radarcns', name: 'radar-commons', version: '0.11.4-SNAPSHOT', changing: true } ``` diff --git a/build.gradle b/build.gradle index 7ba1b754..dcb68b01 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ subprojects { // Configuration // //---------------------------------------------------------------------------// - version = '0.11.3-SNAPSHOT' + version = '0.11.3' group = 'org.radarcns' ext.githubRepoName = 'RADAR-CNS/RADAR-Commons'