You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2018/10/04 19:38:19 UTC
knox git commit: KNOX-1511 - Enable forbiddenapis commons-io
signatures
Repository: knox
Updated Branches:
refs/heads/master 5d9b75e6b -> 4889be64e
KNOX-1511 - Enable forbiddenapis commons-io signatures
Signed-off-by: Kevin Risden <kr...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/4889be64
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/4889be64
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/4889be64
Branch: refs/heads/master
Commit: 4889be64eeb0bbf42c82b1a984427c2e1340cfdc
Parents: 5d9b75e
Author: Kevin Risden <kr...@apache.org>
Authored: Thu Oct 4 15:06:21 2018 -0400
Committer: Kevin Risden <kr...@apache.org>
Committed: Thu Oct 4 15:37:58 2018 -0400
----------------------------------------------------------------------
.../impl/HostmapDeploymentContributorTest.java | 3 ++-
.../rewrite/impl/UrlRewriteResponseTest.java | 2 +-
.../impl/DefaultServiceRegistryService.java | 5 ++--
.../topology/impl/DefaultTopologyService.java | 5 ++--
.../org/apache/knox/gateway/util/KnoxCLI.java | 2 +-
.../topology/DefaultTopologyServiceTest.java | 25 +++++++++++++-------
.../ZooKeeperConfigurationMonitorTest.java | 14 +++++------
.../simple/SimpleDescriptorHandlerTest.java | 6 ++---
.../apache/knox/gateway/util/KnoxCLITest.java | 23 +++++++++---------
...teConfigurationRegistryConfigParserTest.java | 3 ++-
...eConfigurationRegistryClientServiceTest.java | 2 +-
.../gateway/AmbariServiceDefinitionTest.java | 3 ++-
.../gateway/GatewayAdminTopologyFuncTest.java | 9 +++----
.../apache/knox/gateway/GatewayAppFuncTest.java | 19 ++++++++-------
.../knox/gateway/GatewayMultiFuncTest.java | 16 ++++++-------
.../apache/knox/gateway/GatewaySslFuncTest.java | 3 ++-
.../SimpleDescriptorHandlerFuncTest.java | 3 ++-
.../monitor/RemoteConfigurationMonitorTest.java | 14 +++++------
pom.xml | 4 ++++
19 files changed, 92 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-provider-rewrite-func-hostmap-static/src/test/java/org/apache/knox/gateway/hostmap/impl/HostmapDeploymentContributorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-hostmap-static/src/test/java/org/apache/knox/gateway/hostmap/impl/HostmapDeploymentContributorTest.java b/gateway-provider-rewrite-func-hostmap-static/src/test/java/org/apache/knox/gateway/hostmap/impl/HostmapDeploymentContributorTest.java
index 9f7d531..8f98152 100644
--- a/gateway-provider-rewrite-func-hostmap-static/src/test/java/org/apache/knox/gateway/hostmap/impl/HostmapDeploymentContributorTest.java
+++ b/gateway-provider-rewrite-func-hostmap-static/src/test/java/org/apache/knox/gateway/hostmap/impl/HostmapDeploymentContributorTest.java
@@ -30,6 +30,7 @@ import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -91,7 +92,7 @@ public class HostmapDeploymentContributorTest {
assertThat( funcDesc.config(), is( "/WEB-INF/hostmap.txt" ) );
Node node = webArchive.get( "/WEB-INF/hostmap.txt" );
- String asset = IOUtils.toString( node.getAsset().openStream() );
+ String asset = IOUtils.toString( node.getAsset().openStream(), StandardCharsets.UTF_8 );
assertThat( asset, containsString( "test-host-external=test-host-internal" ) );
// Just make sure it doesn't blow up.
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
index 6c329cb..927d22b 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
@@ -156,7 +156,7 @@ public class UrlRewriteResponseTest {
rewriteResponse.streamResponse( input, output );
inStream = isGzip ? new GZIPInputStream( new FileInputStream( outputFile ) ) : new FileInputStream( outputFile );
- assertThat( String.valueOf( IOUtils.toCharArray( inStream ) ), is( content ) );
+ assertThat( String.valueOf( IOUtils.toCharArray( inStream, StandardCharsets.UTF_8 ) ), is( content ) );
} finally {
if ( inStream != null ) {
inStream.close();
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
index 92f661e..5a7e63b 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
@@ -35,6 +35,7 @@ import org.apache.knox.gateway.services.security.CryptoService;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.List;
@@ -107,7 +108,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
clusterServices.put(serviceName , regEntry);
String json = renderAsJsonString(registry);
try {
- FileUtils.write(new File(registryFileName), json);
+ FileUtils.write(new File(registryFileName), json, StandardCharsets.UTF_8);
rc = true;
} catch (IOException e) {
// log appropriately
@@ -184,7 +185,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
File registryFile = new File(securityDir, filename);
if (registryFile.exists()) {
try {
- String json = FileUtils.readFileToString(registryFile);
+ String json = FileUtils.readFileToString(registryFile, StandardCharsets.UTF_8);
Registry reg = (Registry) getMapFromJsonString(json);
if (reg != null) {
registry = reg;
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
index 303add4..50b01fc 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
@@ -72,6 +72,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.net.URISyntaxException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -776,7 +777,7 @@ public class DefaultTopologyService
File destFile = new File(dest, name);
try {
- FileUtils.writeStringToFile(destFile, content);
+ FileUtils.writeStringToFile(destFile, content, StandardCharsets.UTF_8);
log.wroteConfigurationFile(destFile.getAbsolutePath());
result = true;
} catch (IOException e) {
@@ -996,7 +997,7 @@ public class DefaultTopologyService
boolean affectedDescriptors = false;
// Identify any descriptors associated with the cluster configuration change
for (File descriptor : topologyService.getDescriptors()) {
- String descriptorContent = FileUtils.readFileToString(descriptor);
+ String descriptorContent = FileUtils.readFileToString(descriptor, StandardCharsets.UTF_8);
if (descriptorContent.contains(source)) {
if (descriptorContent.contains(clusterName)) {
affectedDescriptors = true;
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
index 416a0a1..fd39bb4 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
@@ -1980,7 +1980,7 @@ public class KnoxCLI extends Configured implements Tool {
}
private void upload(RemoteConfigurationRegistryClient client, String entryPath, File source) throws Exception {
- String content = FileUtils.readFileToString(source);
+ String content = FileUtils.readFileToString(source, StandardCharsets.UTF_8);
if (client.entryExists(entryPath)) {
// If it exists, then we're going to set the data
client.setEntryData(entryPath, content);
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java
index 8a9b5be..ac50312 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java
@@ -41,6 +41,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -450,16 +451,20 @@ public class DefaultTopologyServiceTest {
// "Deploy" the referenced provider configs first
boolean isDeployed =
ts.deployProviderConfiguration(provConfOne,
- FileUtils.readFileToString(new File(ClassLoader.getSystemResource(
- "org/apache/knox/gateway/topology/file/provider-config-one.xml").toURI())));
+ FileUtils.readFileToString(
+ new File(ClassLoader.getSystemResource(
+ "org/apache/knox/gateway/topology/file/provider-config-one.xml").toURI()),
+ StandardCharsets.UTF_8));
assertTrue(isDeployed);
File provConfOneFile = new File(sharedProvidersDir, provConfOne);
assertTrue(provConfOneFile.exists());
isDeployed =
ts.deployProviderConfiguration(provConfTwo,
- FileUtils.readFileToString(new File(ClassLoader.getSystemResource(
- "org/apache/knox/gateway/topology/file/ambari-cluster-policy.xml").toURI())));
+ FileUtils.readFileToString(
+ new File(ClassLoader.getSystemResource(
+ "org/apache/knox/gateway/topology/file/ambari-cluster-policy.xml").toURI()),
+ StandardCharsets.UTF_8));
assertTrue(isDeployed);
File provConfTwoFile = new File(sharedProvidersDir, provConfTwo);
assertTrue(provConfTwoFile.exists());
@@ -474,8 +479,10 @@ public class DefaultTopologyServiceTest {
// "Deploy" the simple descriptor, which depends on provConfOne
isDeployed =
ts.deployDescriptor(simpleDescName,
- FileUtils.readFileToString(new File(ClassLoader.getSystemResource(
- "org/apache/knox/gateway/topology/file/simple-descriptor-six.json").toURI())));
+ FileUtils.readFileToString(
+ new File(ClassLoader.getSystemResource(
+ "org/apache/knox/gateway/topology/file/simple-descriptor-six.json").toURI()),
+ StandardCharsets.UTF_8));
assertTrue(isDeployed);
File simpleDesc = new File(descriptorsDir, simpleDescName);
assertTrue(simpleDesc.exists());
@@ -496,8 +503,10 @@ public class DefaultTopologyServiceTest {
// Overwrite the simple descriptor with content that changes the provider config reference to provConfTwo
isDeployed =
ts.deployDescriptor(simpleDescName,
- FileUtils.readFileToString(new File(ClassLoader.getSystemResource(
- "org/apache/knox/gateway/topology/file/simple-descriptor-five.json").toURI())));
+ FileUtils.readFileToString(
+ new File(ClassLoader.getSystemResource(
+ "org/apache/knox/gateway/topology/file/simple-descriptor-five.json").toURI()),
+ StandardCharsets.UTF_8));
assertTrue(isDeployed);
assertTrue(simpleDesc.exists());
ts.getProviderConfigurations();
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
index 100e2e6..4ec368f 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
@@ -200,17 +200,17 @@ public class ZooKeeperConfigurationMonitorTest {
client.create().withMode(CreateMode.PERSISTENT).forPath(pc_one_znode, TEST_PROVIDERS_CONFIG_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_one.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one));
+ assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(getProviderPath("providers-config2.xml"), TEST_PROVIDERS_CONFIG_2.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_two.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two));
+ assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two, StandardCharsets.UTF_8));
client.setData().forPath(pc_two_znode, TEST_PROVIDERS_CONFIG_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_two.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two));
+ assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two, StandardCharsets.UTF_8));
client.delete().forPath(pc_two_znode);
Thread.sleep(100);
@@ -230,22 +230,22 @@ public class ZooKeeperConfigurationMonitorTest {
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_one_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_one.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_two_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_two.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two, StandardCharsets.UTF_8));
client.setData().forPath(desc_two_znode, TEST_DESCRIPTOR_2.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_two.exists());
- assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two));
+ assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_three_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_three.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three, StandardCharsets.UTF_8));
client.delete().forPath(desc_two_znode);
Thread.sleep(100);
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/test/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandlerTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandlerTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandlerTest.java
index 899d3a9..ad3e0e6 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandlerTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandlerTest.java
@@ -175,7 +175,7 @@ public class SimpleDescriptorHandlerTest {
// Write the externalized provider config to a temp file
File providerConfig = new File(System.getProperty("java.io.tmpdir"), "ambari-cluster-policy.xml");
- FileUtils.write(providerConfig, TEST_PROVIDER_CONFIG);
+ FileUtils.write(providerConfig, TEST_PROVIDER_CONFIG, StandardCharsets.UTF_8);
File topologyFile = null;
try {
@@ -573,7 +573,7 @@ public class SimpleDescriptorHandlerTest {
// Write the externalized provider config to a temp file
File providerConfig = new File(System.getProperty("java.io.tmpdir"), "ambari-cluster-policy.xml");
- FileUtils.write(providerConfig, TEST_HA_PROVIDER_CONFIG);
+ FileUtils.write(providerConfig, TEST_HA_PROVIDER_CONFIG, StandardCharsets.UTF_8);
File topologyFile = null;
try {
@@ -768,7 +768,7 @@ public class SimpleDescriptorHandlerTest {
private File writeProviderConfig(String path, String content) throws IOException {
File f = new File(path);
- FileUtils.write(f, content);
+ FileUtils.write(f, content, StandardCharsets.UTF_8);
return f;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
index 6bc151e..861c050 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
@@ -37,6 +37,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.containsString;
@@ -135,7 +136,7 @@ public class KnoxCLITest {
final String[] uploadArgs = {"upload-provider-config", testProviderConfig.getAbsolutePath(),
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testProviderConfig, providerConfigContent);
+ FileUtils.writeStringToFile(testProviderConfig, providerConfigContent, StandardCharsets.UTF_8);
final String[] args = {"get-registry-acl", "/knox/config/shared-providers",
@@ -180,7 +181,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testProviderConfig, providerConfigContent);
+ FileUtils.writeStringToFile(testProviderConfig, providerConfigContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
@@ -203,7 +204,7 @@ public class KnoxCLITest {
File registryFile = new File(testRegistry, "knox/config/shared-providers/" + providerConfigName);
assertTrue(registryFile.exists());
- assertEquals(FileUtils.readFileToString(registryFile), providerConfigContent);
+ assertEquals(FileUtils.readFileToString(registryFile, StandardCharsets.UTF_8), providerConfigContent);
} finally {
FileUtils.forceDelete(testRoot);
}
@@ -228,7 +229,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testProviderConfig, providerConfigContent);
+ FileUtils.writeStringToFile(testProviderConfig, providerConfigContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
@@ -244,7 +245,7 @@ public class KnoxCLITest {
assertFalse((new File(testRegistry, "knox/config/shared-providers/" + providerConfigName)).exists());
File registryFile = new File(testRegistry, "knox/config/shared-providers/" + entryName);
assertTrue(registryFile.exists());
- assertEquals(FileUtils.readFileToString(registryFile), providerConfigContent);
+ assertEquals(FileUtils.readFileToString(registryFile, StandardCharsets.UTF_8), providerConfigContent);
} finally {
FileUtils.forceDelete(testRoot);
}
@@ -267,7 +268,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testDescriptor, descriptorContent);
+ FileUtils.writeStringToFile(testDescriptor, descriptorContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
@@ -290,7 +291,7 @@ public class KnoxCLITest {
File registryFile = new File(testRegistry, "knox/config/descriptors/" + descriptorName);
assertTrue(registryFile.exists());
- assertEquals(FileUtils.readFileToString(registryFile), descriptorContent);
+ assertEquals(FileUtils.readFileToString(registryFile, StandardCharsets.UTF_8), descriptorContent);
} finally {
FileUtils.forceDelete(testRoot);
}
@@ -314,7 +315,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testDescriptor, descriptorContent);
+ FileUtils.writeStringToFile(testDescriptor, descriptorContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
@@ -330,7 +331,7 @@ public class KnoxCLITest {
assertFalse((new File(testRegistry, "knox/config/descriptors/" + descriptorName)).exists());
File registryFile = new File(testRegistry, "knox/config/descriptors/" + entryName);
assertTrue(registryFile.exists());
- assertEquals(FileUtils.readFileToString(registryFile), descriptorContent);
+ assertEquals(FileUtils.readFileToString(registryFile, StandardCharsets.UTF_8), descriptorContent);
} finally {
FileUtils.forceDelete(testRoot);
}
@@ -353,7 +354,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testProviderConfig, providerConfigContent);
+ FileUtils.writeStringToFile(testProviderConfig, providerConfigContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
@@ -405,7 +406,7 @@ public class KnoxCLITest {
"--registry-client", "test_client",
"--master", "master"};
- FileUtils.writeStringToFile(testDescriptor, descriptorContent);
+ FileUtils.writeStringToFile(testDescriptor, descriptorContent, StandardCharsets.UTF_8);
KnoxCLI cli = new KnoxCLI();
Configuration config = new GatewayConfigImpl();
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/config/RemoteConfigurationRegistryConfigParserTest.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/config/RemoteConfigurationRegistryConfigParserTest.java b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/config/RemoteConfigurationRegistryConfigParserTest.java
index 1720cb9..66a8140 100644
--- a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/config/RemoteConfigurationRegistryConfigParserTest.java
+++ b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/config/RemoteConfigurationRegistryConfigParserTest.java
@@ -22,6 +22,7 @@ import org.apache.knox.gateway.service.config.remote.util.RemoteRegistryConfigTe
import org.junit.Test;
import java.io.File;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -71,7 +72,7 @@ public class RemoteConfigurationRegistryConfigParserTest {
File registryConfigFile = File.createTempFile("remote-registries", "xml");
try {
- FileUtils.writeStringToFile(registryConfigFile, configXML);
+ FileUtils.writeStringToFile(registryConfigFile, configXML, StandardCharsets.UTF_8);
List<RemoteConfigurationRegistryConfig> configs =
RemoteConfigurationRegistriesParser.getConfig(registryConfigFile.getAbsolutePath());
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTest.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTest.java b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTest.java
index 981a037..ba4d213 100644
--- a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTest.java
+++ b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTest.java
@@ -201,7 +201,7 @@ public class RemoteConfigurationRegistryClientServiceTest {
String registryConfigXML =
RemoteRegistryConfigTestUtils.createRemoteConfigRegistriesXML(Collections.singleton(registryConfigProps));
tmpRegConfigFile = File.createTempFile("myRemoteRegistryConfig", "xml");
- FileUtils.writeStringToFile(tmpRegConfigFile, registryConfigXML);
+ FileUtils.writeStringToFile(tmpRegConfigFile, registryConfigXML, StandardCharsets.UTF_8);
System.setProperty("org.apache.knox.gateway.remote.registry.config.file", tmpRegConfigFile.getAbsolutePath());
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
index c290ccb..6780ccd 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -78,7 +79,7 @@ public class AmbariServiceDefinitionTest {
setupGateway();
String topoStr = TestUtils.merge( DAT, "test-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
LOG_EXIT();
}
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
index 6aa0a65..c2a5acc 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
@@ -24,6 +24,7 @@ import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
@@ -1695,7 +1696,7 @@ public class GatewayAdminTopologyFuncTest {
// Manually write a file to the descriptors directory
File descriptorOneFile = new File(descriptorsDir, descriptorFileNames.get(0));
- FileUtils.write(descriptorOneFile, createDescriptor(clusterNames.get(0)));
+ FileUtils.write(descriptorOneFile, createDescriptor(clusterNames.get(0)), StandardCharsets.UTF_8);
// Request a listing of all the descriptors
responseBody = given()
@@ -1712,7 +1713,7 @@ public class GatewayAdminTopologyFuncTest {
// Manually write another file to the descriptors directory
File descriptorTwoFile = new File(descriptorsDir, descriptorFileNames.get(1));
- FileUtils.write(descriptorTwoFile, createDescriptor(clusterNames.get(1)));
+ FileUtils.write(descriptorTwoFile, createDescriptor(clusterNames.get(1)), StandardCharsets.UTF_8);
// Request a listing of all the descriptors
responseBody = given()
@@ -2053,11 +2054,11 @@ public class GatewayAdminTopologyFuncTest {
// Manually add two descriptor files to the descriptors directory
File descriptorOneFile = new File(descriptorsDir, "deleteme-one.json");
- FileUtils.writeStringToFile(descriptorOneFile, createDescriptor("clusterOne"));
+ FileUtils.writeStringToFile(descriptorOneFile, createDescriptor("clusterOne"), StandardCharsets.UTF_8);
assertTrue(descriptorOneFile.exists());
File descriptorTwoFile = new File(descriptorsDir, "deleteme-two.json");
- FileUtils.writeStringToFile(descriptorTwoFile, createDescriptor("clusterTwo"));
+ FileUtils.writeStringToFile(descriptorTwoFile, createDescriptor("clusterTwo"), StandardCharsets.UTF_8);
assertTrue(descriptorTwoFile.exists());
// Request a listing of all the descriptors
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
index c603336..d5f5954 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
@@ -20,6 +20,7 @@ package org.apache.knox.gateway;
import java.io.File;
import java.net.URL;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -170,7 +171,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-static-hello-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -227,7 +228,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-dynamic-app-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -262,7 +263,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-naked-app-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -283,7 +284,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-default-app-name-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -321,7 +322,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-multi-apps-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -400,7 +401,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-svcs-and-apps-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -489,7 +490,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-dynamic-app-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
File deployDir = new File( config.getGatewayDeploymentDir() );
@@ -559,7 +560,7 @@ public class GatewayAppFuncTest {
String topoStr = TestUtils.merge( DAT, "test-dynamic-app-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -589,7 +590,7 @@ public class GatewayAppFuncTest {
topoStr = TestUtils.merge( DAT, "test-dynamic-app-topology.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "test-topology-2.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
index 2fb6fd2..5fb94b3 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
@@ -170,7 +170,7 @@ public class GatewayMultiFuncTest {
String topoStr = TestUtils.merge( DAT, "topologies/test-knox678-utf8-chars-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "knox678.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -220,7 +220,7 @@ public class GatewayMultiFuncTest {
String topoStr = TestUtils.merge( DAT, "topologies/test-knox678-utf8-chars-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "knox681.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
@@ -313,7 +313,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-user-dn-template.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-1.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
@@ -335,7 +335,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-search-attribute.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-2.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
@@ -357,7 +357,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-search-filter.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-3.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
@@ -379,7 +379,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-search-scope-object.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-4.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
@@ -401,7 +401,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-search-scope-onelevel-positive.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-5.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
@@ -423,7 +423,7 @@ public class GatewayMultiFuncTest {
topoStr = TestUtils.merge( DAT, "topologies/test-knox694-principal-regex-search-scope-onelevel-negative.xml", params );
topoFile = new File( config.getGatewayTopologyDir(), "knox694-6.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8 );
topos.reloadTopologies();
given()
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
index f0256a0..52fc618 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
@@ -18,6 +18,7 @@
package org.apache.knox.gateway;
import java.io.File;
+import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@@ -194,7 +195,7 @@ public class GatewaySslFuncTest {
String topoStr = TestUtils.merge( DAT, "test-admin-topology.xml", params );
File topoFile = new File( config.getGatewayTopologyDir(), "test-topology.xml" );
- FileUtils.writeStringToFile( topoFile, topoStr );
+ FileUtils.writeStringToFile( topoFile, topoStr, StandardCharsets.UTF_8);
topos.reloadTopologies();
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java
index 88c52ce..7a6f82e 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java
@@ -35,6 +35,7 @@ import org.junit.Test;
import java.io.File;
import java.net.InetSocketAddress;
+import java.nio.charset.StandardCharsets;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.Collections;
@@ -131,7 +132,7 @@ public class SimpleDescriptorHandlerFuncTest {
// Write the externalized provider config to a temp file
File providerConfig = new File(testProvDir, "ambari-cluster-policy.xml");
- FileUtils.write(providerConfig, TEST_PROVIDER_CONFIG);
+ FileUtils.write(providerConfig, TEST_PROVIDER_CONFIG, StandardCharsets.UTF_8);
File topologyFile = null;
try {
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/gateway-test/src/test/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorTest.java
index 60f1fd4..3641fd4 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorTest.java
@@ -510,17 +510,17 @@ public class RemoteConfigurationMonitorTest {
client.create().withMode(CreateMode.PERSISTENT).forPath(pc_one_znode, TEST_PROVIDERS_CONFIG_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_one.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one));
+ assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(getProviderPath("providers-config2.xml"), TEST_PROVIDERS_CONFIG_2.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_two.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two));
+ assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two, StandardCharsets.UTF_8));
client.setData().forPath(pc_two_znode, TEST_PROVIDERS_CONFIG_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(pc_two.exists());
- assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two));
+ assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two, StandardCharsets.UTF_8));
client.delete().forPath(pc_two_znode);
Thread.sleep(100);
@@ -540,22 +540,22 @@ public class RemoteConfigurationMonitorTest {
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_one_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_one.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_two_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_two.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two, StandardCharsets.UTF_8));
client.setData().forPath(desc_two_znode, TEST_DESCRIPTOR_2.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_two.exists());
- assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two));
+ assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two, StandardCharsets.UTF_8));
client.create().withMode(CreateMode.PERSISTENT).forPath(desc_three_znode, TEST_DESCRIPTOR_1.getBytes(StandardCharsets.UTF_8));
Thread.sleep(100);
assertTrue(desc_three.exists());
- assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three));
+ assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three, StandardCharsets.UTF_8));
client.delete().forPath(desc_two_znode);
Thread.sleep(100);
http://git-wip-us.apache.org/repos/asf/knox/blob/4889be64/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4c4c3c6..b5bab46 100644
--- a/pom.xml
+++ b/pom.xml
@@ -444,6 +444,8 @@
<failOnViolation>true</failOnViolation>
<!-- if the used Java version is too new, don't fail, just do nothing: -->
<failOnUnsupportedJava>false</failOnUnsupportedJava>
+ <!-- prevent failing if a module doesn't have all signature dependencies like commons-io -->
+ <failOnUnresolvableSignatures>false</failOnUnresolvableSignatures>
<bundledSignatures>
<!--
This will automatically choose the right
@@ -453,6 +455,8 @@
<bundledSignature>jdk-deprecated</bundledSignature>
<!-- disallow undocumented classes like sun.misc.Unsafe: -->
<bundledSignature>jdk-non-portable</bundledSignature>
+ <!-- disallow unsafe commons-io classes -->
+ <bundledSignature>commons-io-unsafe-${commons-io.version}</bundledSignature>
</bundledSignatures>
</configuration>
<executions>