Skip to content
Permalink
Browse files
fix: can't delete conf file when drop graph (#93)
  • Loading branch information
zyxxoo committed Mar 21, 2022
1 parent 88d2f89 commit d0e5971c7e49077411dd6c4f933c830b0a5fba4f
Showing 5 changed files with 25 additions and 21 deletions.
@@ -6,7 +6,7 @@
<parent>
<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-commons</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

@@ -247,7 +247,7 @@
<manifestEntries>
<!-- Must be on one line, otherwise the automatic
upgrade script cannot replace the version number -->
<Implementation-Version>2.1.0.0</Implementation-Version>
<Implementation-Version>2.1.1.0</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
@@ -45,16 +45,16 @@ public class HugeConfig extends PropertiesConfiguration {

private static final Logger LOG = Log.logger(HugeConfig.class);

private final String path;
private String configPath;

public HugeConfig(Configuration config) {
loadConfig(config);
this.path = null;
this.configPath = null;
}

public HugeConfig(String configFile) {
loadConfig(loadConfigFile(configFile));
this.path = configFile;
this.configPath = configFile;
}

private void loadConfig(Configuration config) {
@@ -75,15 +75,6 @@ private void setLayoutIfNeeded(Configuration conf) {
this.setLayout(propConf.getLayout());
}

private static Configuration loadConfigFile(String path) {
E.checkNotNull(path, "config path");
E.checkArgument(!path.isEmpty(),
"The config path can't be empty");

File file = new File(path);
return loadConfigFile(file);
}

@SuppressWarnings("unchecked")
public <T, R> R get(TypedOption<T, R> option) {
Object value = this.getProperty(option.name());
@@ -156,12 +147,25 @@ public void save(File copiedFile) throws ConfigurationException {
}

@Nullable
public File getFile() {
if (StringUtils.isEmpty(this.path)) {
public File file() {
if (StringUtils.isEmpty(this.configPath)) {
return null;
}

return new File(this.path);
return new File(this.configPath);
}

public void file(String path) {
this.configPath = path;
}

private static Configuration loadConfigFile(String path) {
E.checkNotNull(path, "config path");
E.checkArgument(!path.isEmpty(),
"The config path can't be empty");

File file = new File(path);
return loadConfigFile(file);
}

private static Configuration loadConfigFile(File configFile) {
@@ -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,
"2.1.0");
"2.1.1");
}
@@ -6,7 +6,7 @@
<parent>
<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-commons</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

@@ -6,7 +6,7 @@

<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-commons</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<packaging>pom</packaging>

<name>hugegraph-commons</name>
@@ -138,7 +138,7 @@
<manifestEntries>
<!-- Must be on one line, otherwise the automatic
upgrade script cannot replace the version number -->
<Implementation-Version>2.1.0.0</Implementation-Version>
<Implementation-Version>2.1.1.0</Implementation-Version>
</manifestEntries>
</archive>
</configuration>

0 comments on commit d0e5971

Please sign in to comment.