Skip to content

Commit

Permalink
fix: can't delete conf file when drop graph (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo authored Mar 21, 2022
1 parent 88d2f89 commit d0e5971
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions hugegraph-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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());
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
2 changes: 1 addition & 1 deletion hugegraph-rpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit d0e5971

Please sign in to comment.