diff --git a/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentCollectionResource.java b/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentCollectionResource.java index d52c33fddbd..0463fc3a746 100644 --- a/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentCollectionResource.java +++ b/modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDeploymentCollectionResource.java @@ -15,8 +15,8 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -242,11 +242,7 @@ public Map splitQueryString(String queryString) { protected String decode(String string) { if (string != null) { - try { - return URLDecoder.decode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLDecoder.decode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/service/BaseSpringRestTestCase.java b/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/service/BaseSpringRestTestCase.java index be93f444e5c..3a8f416a9c0 100644 --- a/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/service/BaseSpringRestTestCase.java +++ b/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/service/BaseSpringRestTestCase.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -301,11 +300,7 @@ protected void closeHttpConnections() { protected String encode(String string) { if (string != null) { - try { - return URLEncoder.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLEncoder.encode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java b/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java index 84afd92c981..1b6077f13df 100644 --- a/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java +++ b/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java @@ -14,7 +14,7 @@ import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -31,8 +31,6 @@ public class AppDeploymentBuilderImpl implements AppDeploymentBuilder { - protected static final String DEFAULT_ENCODING = "UTF-8"; - protected transient AppRepositoryServiceImpl repositoryService; protected transient AppResourceEntityManager resourceEntityManager; @@ -93,11 +91,7 @@ public AppDeploymentBuilder addString(String resourceName, String text) { AppResourceEntity resource = resourceEntityManager.create(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unable to get bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java index f3f8222847c..040b3624e26 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java @@ -14,7 +14,7 @@ import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -32,8 +32,6 @@ public class CmmnDeploymentBuilderImpl implements CmmnDeploymentBuilder { - protected static final String DEFAULT_ENCODING = "UTF-8"; - protected transient CmmnRepositoryServiceImpl repositoryService; protected transient CmmnResourceEntityManager resourceEntityManager; @@ -93,11 +91,7 @@ public CmmnDeploymentBuilder addString(String resourceName, String text) { CmmnResourceEntity resource = resourceEntityManager.create(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unable to get bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/DeploymentCollectionResource.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/DeploymentCollectionResource.java index bdcc5dcc007..8174478fd91 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/DeploymentCollectionResource.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/DeploymentCollectionResource.java @@ -16,8 +16,8 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -257,11 +257,7 @@ public Map splitQueryString(String queryString) { protected String decode(String string) { if (string != null) { - try { - return URLDecoder.decode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLDecoder.decode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/BaseSpringRestTestCase.java b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/BaseSpringRestTestCase.java index 68ef7c35894..12313f9a806 100644 --- a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/BaseSpringRestTestCase.java +++ b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/BaseSpringRestTestCase.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -337,11 +336,7 @@ protected void closeHttpConnections() { protected String encode(String string) { if (string != null) { - try { - return URLEncoder.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLEncoder.encode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java b/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java index b8ec2192bb2..fcd3dab1286 100644 --- a/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java +++ b/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java @@ -15,7 +15,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; @@ -37,7 +36,6 @@ public class DmnDeploymentBuilderImpl implements DmnDeploymentBuilder, Serializable { private static final long serialVersionUID = 1L; - protected static final String DEFAULT_ENCODING = "UTF-8"; protected transient DmnRepositoryServiceImpl repositoryService; protected transient DmnResourceEntityManager resourceEntityManager; @@ -98,11 +96,7 @@ public DmnDeploymentBuilder addString(String resourceName, String text) { DmnResourceEntity resource = resourceEntityManager.create(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unable to get decision table bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/service/api/BaseSpringDmnRestTestCase.java b/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/service/api/BaseSpringDmnRestTestCase.java index 6af7bb9c069..d2f7a11591a 100644 --- a/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/service/api/BaseSpringDmnRestTestCase.java +++ b/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/service/api/BaseSpringDmnRestTestCase.java @@ -15,7 +15,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -223,11 +222,7 @@ protected void closeHttpConnections() { protected String encode(String string) { if (string != null) { - try { - return URLEncoder.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLEncoder.encode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/StringStreamSource.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/StringStreamSource.java index dc7a5b7ba3e..c6c74ab6856 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/StringStreamSource.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/StringStreamSource.java @@ -14,34 +14,34 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import org.flowable.common.engine.api.FlowableException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; /** * @author Tom Baeyens */ public class StringStreamSource implements StreamSource { - String string; - String byteArrayEncoding = "utf-8"; + protected final String string; + protected final Charset byteArrayEncoding; public StringStreamSource(String string) { - this.string = string; + this(string, StandardCharsets.UTF_8); } public StringStreamSource(String string, String byteArrayEncoding) { + this.string = string; + this.byteArrayEncoding = Charset.forName(byteArrayEncoding); + } + + public StringStreamSource(String string, Charset byteArrayEncoding) { this.string = string; this.byteArrayEncoding = byteArrayEncoding; } @Override public InputStream getInputStream() { - try { - return new ByteArrayInputStream(byteArrayEncoding == null ? string.getBytes() : string.getBytes(byteArrayEncoding)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unsupported encoding for string", e); - } + return new ByteArrayInputStream(byteArrayEncoding == null ? string.getBytes() : string.getBytes(byteArrayEncoding)); } @Override diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java index b89c6f90ae1..ba277366f23 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java @@ -15,7 +15,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.HashMap; @@ -44,7 +43,6 @@ public class DeploymentBuilderImpl implements DeploymentBuilder, Serializable { private static final long serialVersionUID = 1L; - protected static final String DEFAULT_ENCODING = "UTF-8"; protected transient RepositoryServiceImpl repositoryService; protected transient ResourceEntityManager resourceEntityManager; @@ -96,11 +94,7 @@ public DeploymentBuilder addString(String resourceName, String text) { } ResourceEntity resource = resourceEntityManager.create(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unable to get process bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/deployment/ParsedDeploymentTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/deployment/ParsedDeploymentTest.java index ec3e4c0f559..4d2d55bb4e8 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/deployment/ParsedDeploymentTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/deployment/ParsedDeploymentTest.java @@ -15,7 +15,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; @@ -72,7 +71,7 @@ public void tearDown() { } @Test - public void testCreateAndQuery() throws UnsupportedEncodingException { + public void testCreateAndQuery() { DeploymentEntity entity = assembleUnpersistedDeploymentEntity(); ParsedDeploymentBuilderFactory builderFactory = processEngineConfiguration.getParsedDeploymentBuilderFactory(); @@ -111,14 +110,14 @@ private ProcessDefinitionEntity getProcessDefinitionEntityFromList(List" + " " + " " diff --git a/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java b/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java index db4b53b644d..b6b2b3f3ffc 100644 --- a/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java +++ b/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java @@ -16,8 +16,8 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -246,11 +246,7 @@ public Map splitQueryString(String queryString) { protected String decode(String string) { if (string != null) { - try { - return URLDecoder.decode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLDecoder.decode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/service/BaseSpringRestTestCase.java b/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/service/BaseSpringRestTestCase.java index 5b6c3ed57ab..691cb3ee0e1 100644 --- a/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/service/BaseSpringRestTestCase.java +++ b/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/service/BaseSpringRestTestCase.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -343,11 +342,7 @@ protected void closeHttpConnections() { protected String encode(String string) { if (string != null) { - try { - return URLEncoder.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLEncoder.encode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java index b68b19b485c..abdb9d01297 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java @@ -15,7 +15,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.flowable.common.engine.api.FlowableException; @@ -34,7 +34,6 @@ public class EventDeploymentBuilderImpl implements EventDeploymentBuilder, Serializable { private static final long serialVersionUID = 1L; - protected static final String DEFAULT_ENCODING = "UTF-8"; protected transient EventRepositoryServiceImpl repositoryService; protected transient EventResourceEntityManager resourceEntityManager; @@ -94,11 +93,7 @@ public EventDeploymentBuilder addString(String resourceName, String text) { EventResourceEntity resource = resourceEntityManager.create(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new FlowableException("Unable to get event definition bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java index 637d8344f65..c8106269176 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java @@ -16,8 +16,8 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -256,11 +256,7 @@ public Map splitQueryString(String queryString) { protected String decode(String string) { if (string != null) { - try { - return URLDecoder.decode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLDecoder.decode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable-rest/src/test/java/org/flowable/rest/service/BaseSpringRestTestCase.java b/modules/flowable-rest/src/test/java/org/flowable/rest/service/BaseSpringRestTestCase.java index 813e0628f74..97923df7fe6 100644 --- a/modules/flowable-rest/src/test/java/org/flowable/rest/service/BaseSpringRestTestCase.java +++ b/modules/flowable-rest/src/test/java/org/flowable/rest/service/BaseSpringRestTestCase.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -393,11 +392,7 @@ protected void closeHttpConnections() { protected String encode(String string) { if (string != null) { - try { - return URLEncoder.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - throw new IllegalStateException("JVM does not support UTF-8 encoding.", uee); - } + return URLEncoder.encode(string, StandardCharsets.UTF_8); } return null; } diff --git a/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentBuilderImpl.java b/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentBuilderImpl.java index 3e60aa48b0e..c3ddc45fb01 100644 --- a/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentBuilderImpl.java +++ b/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentBuilderImpl.java @@ -14,7 +14,6 @@ import java.io.InputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.zip.ZipEntry; @@ -39,7 +38,6 @@ public class DeploymentBuilderImpl implements DeploymentBuilder, Serializable { private static final long serialVersionUID = 1L; - protected static final String DEFAULT_ENCODING = "UTF-8"; protected transient RepositoryServiceImpl repositoryService; protected DeploymentEntity deployment = new DeploymentEntity(); @@ -81,11 +79,7 @@ public DeploymentBuilder addString(String resourceName, String text) { } ResourceEntity resource = new ResourceEntity(); resource.setName(resourceName); - try { - resource.setBytes(text.getBytes(DEFAULT_ENCODING)); - } catch (UnsupportedEncodingException e) { - throw new ActivitiException("Unable to get process bytes.", e); - } + resource.setBytes(text.getBytes(StandardCharsets.UTF_8)); deployment.addResource(resource); return this; } diff --git a/modules/flowable5-test/src/test/java/org/activiti/engine/test/bpmn/mail/AttachmentsBean.java b/modules/flowable5-test/src/test/java/org/activiti/engine/test/bpmn/mail/AttachmentsBean.java index f9f09e23795..ad6b171fd0a 100644 --- a/modules/flowable5-test/src/test/java/org/activiti/engine/test/bpmn/mail/AttachmentsBean.java +++ b/modules/flowable5-test/src/test/java/org/activiti/engine/test/bpmn/mail/AttachmentsBean.java @@ -18,7 +18,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import org.apache.commons.lang3.Validate; @@ -93,12 +93,7 @@ public String getContentType() { @Override public InputStream getInputStream() { - try { - return new ByteArrayInputStream(content.getBytes("UTF-8")); - } catch (UnsupportedEncodingException e) { - // this should not happen, since utf-8 is supported in stock jdk, but anyway - return new ByteArrayInputStream(content.getBytes()); - } + return new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); } @Override