From 6e0ddc2a8394e43954c488e62d0432b5d10c79a4 Mon Sep 17 00:00:00 2001 From: Alexey Zinchenko Date: Sun, 16 Jun 2019 14:42:42 +0300 Subject: [PATCH] Added codecov support. --- .travis.yml | 7 +++++-- README.md | 8 ++++++-- pom.xml | 13 +++++++++++++ .../openweathermap/api/utils/RequestUtils.java | 3 ++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81d8f1e..141b9a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: java install: mvn install -DskipTests -Dgpg.skip -script: mvn test -Dmaven.skip.deploy=true -Dgpg.skip +script: mvn cobertura:cobertura -Dmaven.skip.deploy=true -Dgpg.skip jdk: - openjdk8 - - openjdk11 \ No newline at end of file + - openjdk11 + +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/README.md b/README.md index 1f11f06..cb9c8d2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenWeatherMap Java API [![Build Status][ci-shield]][ci-link] +# OpenWeatherMap Java API [![Build Status][ci-shield]][ci-link] [![codecov][codecov-shield]][codecov-link] Java API for OpenWeatherMap services. ### Implemented features: @@ -51,4 +51,8 @@ compile('com.github.prominence:openweathermap-api:2.0-SNAPSHOT') MIT [ci-shield]: https://travis-ci.org/Prominence/openweathermap-java-api.svg?branch=master -[ci-link]: https://travis-ci.org/Prominence/openweathermap-java-api \ No newline at end of file +[ci-link]: https://travis-ci.org/Prominence/openweathermap-java-api + + +[codecov-shield]: https://codecov.io/gh/Prominence/openweathermap-java-api/branch/master/graph/badge.svg +[codecov-link]: https://codecov.io/gh/Prominence/openweathermap-java-api \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6eb0f24..56f844a 100644 --- a/pom.xml +++ b/pom.xml @@ -130,6 +130,19 @@ + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + true + + html + xml + + + + diff --git a/src/main/java/com/github/prominence/openweathermap/api/utils/RequestUtils.java b/src/main/java/com/github/prominence/openweathermap/api/utils/RequestUtils.java index f269952..44eec3c 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/utils/RequestUtils.java +++ b/src/main/java/com/github/prominence/openweathermap/api/utils/RequestUtils.java @@ -32,6 +32,7 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.nio.charset.StandardCharsets; public final class RequestUtils { @@ -78,7 +79,7 @@ public final class RequestUtils { private static String getRawResponse(InputStream inputStream) { StringBuilder result = new StringBuilder(); - try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { result.append(line);