HTRACE-220. htraced: should be able to set log.path to the empty string via "-Dlog.path=" on the command line (cmccabe)
diff --git a/htrace-htraced/go/src/org/apache/htrace/conf/config.go b/htrace-htraced/go/src/org/apache/htrace/conf/config.go
index 3302f4d..b8f6c84 100644
--- a/htrace-htraced/go/src/org/apache/htrace/conf/config.go
+++ b/htrace-htraced/go/src/org/apache/htrace/conf/config.go
@@ -178,11 +178,7 @@
str := bld.Argv[i]
key, val := parseAsConfigFlag(str)
if key != "" {
- if val == "" {
- cnf.settings[key] = "true"
- } else {
- cnf.settings[key] = val
- }
+ cnf.settings[key] = val
bld.Argv = append(bld.Argv[:i], bld.Argv[i+1:]...)
} else {
i++
diff --git a/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go b/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
index d3509b0..9059dad 100644
--- a/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
+++ b/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
@@ -29,7 +29,7 @@
// Test that parsing command-line arguments of the form -Dfoo=bar works.
func TestParseArgV(t *testing.T) {
t.Parallel()
- argv := []string{"-Dfoo=bar", "-Dbaz=123", "-DsillyMode"}
+ argv := []string{"-Dfoo=bar", "-Dbaz=123", "-DsillyMode", "-Dlog.path="}
bld := &Builder{Argv: argv}
cnf, err := bld.Build()
if err != nil {
@@ -47,6 +47,9 @@
if cnf.GetBool("otherSillyMode") {
t.Fatal()
}
+ if "" != cnf.Get("log.path") {
+ t.Fatal()
+ }
}
// Test that default values work.