aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java12
2 files changed, 7 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java b/server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java
index 66d172e808a..60df0574a76 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java
@@ -24,6 +24,7 @@ import com.google.common.base.Throwables;
import com.google.protobuf.Message;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import org.apache.commons.io.IOUtils;
import org.sonar.api.server.ws.Request;
@@ -54,7 +55,7 @@ public class WsUtils {
msg.writeTo(output);
} else {
response.stream().setMediaType(MediaTypes.JSON);
- try (OutputStreamWriter writer = new OutputStreamWriter(output)) {
+ try (OutputStreamWriter writer = new OutputStreamWriter(output, StandardCharsets.UTF_8)) {
ProtobufJsonFormat.write(msg, JsonWriter.of(writer));
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
index cd397e3df94..554ff4d6a54 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
@@ -19,15 +19,13 @@
*/
package org.sonar.api.utils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-import javax.annotation.Nullable;
-
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.annotation.Nullable;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
/**
* @since 4.3
@@ -47,7 +45,7 @@ public class Duration implements Serializable {
}
private Duration(int days, int hours, int minutes, int hoursInDay) {
- this((days * hoursInDay * MINUTES_IN_ONE_HOUR) + (hours * MINUTES_IN_ONE_HOUR) + minutes);
+ this(((long) days * hoursInDay * MINUTES_IN_ONE_HOUR) + (hours * MINUTES_IN_ONE_HOUR) + minutes);
}
/**