forked from hugegraph/hugegraph-sync
disable delimiter parsing when construct from MapConfiguration (#74)
This commit is contained in:
parent
f72fac400f
commit
74b954acf2
4
pom.xml
4
pom.xml
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>com.baidu.hugegraph</groupId>
|
||||
<artifactId>hugegraph-common</artifactId>
|
||||
<version>1.8.7</version>
|
||||
<version>1.8.8</version>
|
||||
|
||||
<name>hugegraph-common</name>
|
||||
<url>https://github.com/hugegraph/hugegraph-common</url>
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
<manifestEntries>
|
||||
<!-- Must be on one line, otherwise the automatic
|
||||
upgrade script cannot replace the version number -->
|
||||
<Implementation-Version>1.8.7.0</Implementation-Version>
|
||||
<Implementation-Version>1.8.8.0</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.configuration.AbstractConfiguration;
|
||||
import org.apache.commons.configuration.AbstractFileConfiguration;
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
|
|
@ -42,7 +43,6 @@ public class HugeConfig extends PropertiesConfiguration {
|
|||
if (config == null) {
|
||||
throw new ConfigException("The config object is null");
|
||||
}
|
||||
|
||||
this.reloadIfNeed(config);
|
||||
this.setLayoutIfNeeded(config);
|
||||
|
||||
|
|
@ -60,9 +60,12 @@ public class HugeConfig extends PropertiesConfiguration {
|
|||
|
||||
private void reloadIfNeed(Configuration conf) {
|
||||
if (!(conf instanceof AbstractFileConfiguration)) {
|
||||
if (conf instanceof AbstractConfiguration) {
|
||||
AbstractConfiguration config = (AbstractConfiguration) conf;
|
||||
config.setDelimiterParsingDisabled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractFileConfiguration fileConfig = (AbstractFileConfiguration) conf;
|
||||
|
||||
File file = fileConfig.getFile();
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ public class CommonVersion {
|
|||
|
||||
// The second parameter of Version.of() is for all-in-one JAR
|
||||
public static final Version VERSION = Version.of(CommonVersion.class,
|
||||
"1.8.7");
|
||||
"1.8.8");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,14 @@ import static com.baidu.hugegraph.config.OptionChecker.rangeInt;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.MapConfiguration;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
@ -409,6 +412,18 @@ public class HugeConfigTest extends BaseUnitTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFromMapConfigurationWithList() {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put(TestOptions.list.name(), "[a, b]");
|
||||
MapConfiguration mapConfiguration = new MapConfiguration(options);
|
||||
HugeConfig hugeConfig = new HugeConfig(mapConfiguration);
|
||||
List<String> values = hugeConfig.get(TestOptions.list);
|
||||
Assert.assertEquals(2, values.size());
|
||||
Assert.assertTrue(values.contains("a"));
|
||||
Assert.assertTrue(values.contains("b"));
|
||||
}
|
||||
|
||||
public static class TestOptions extends OptionHolder {
|
||||
|
||||
private static volatile TestOptions instance;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class VersionUtilTest extends BaseUnitTest {
|
|||
//Mockito.when(clazz.getResource("fake.class")).thenReturn(manifest);
|
||||
|
||||
String manifestPath = "file:./src/test/resources";
|
||||
Assert.assertEquals("1.8.7.0",
|
||||
Assert.assertEquals("1.8.8.0",
|
||||
VersionUtil.getImplementationVersion(manifestPath));
|
||||
|
||||
manifestPath = "file:./src/test/resources2";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Manifest-Version: 1.0
|
||||
Implementation-Version: 1.8.7.0
|
||||
Implementation-Version: 1.8.8.0
|
||||
Archiver-Version: Plexus Archiver
|
||||
Built-By: jermy
|
||||
Specification-Title: hugegraph-common
|
||||
Created-By: Apache Maven 3.3.9
|
||||
Build-Jdk: 1.8.0_111
|
||||
Specification-Version: 1.8.7
|
||||
Specification-Version: 1.8.8
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue