summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2007-04-07 10:11:06 +0000
committerMark Wielaard <mark@klomp.org>2007-04-07 10:11:06 +0000
commit477807873aa209edc5a3b7746882e01e677eeee9 (patch)
treeb5bd0e60b9aa3c11a5bbd61c85cbc39d6663e657
parent6ff93d79151f4df08a43565269468542af8a1488 (diff)
downloadclasspath-477807873aa209edc5a3b7746882e01e677eeee9.tar.gz
2007-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/ObjectName.java (parse(String)): Fix parsing where the wildcard is juxtaposed between other pairs.
-rw-r--r--ChangeLog6
-rw-r--r--javax/management/ObjectName.java43
2 files changed, 24 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 37fef3b22..065c1b60d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * javax/management/ObjectName.java
+ (parse(String)): Fix parsing where the wildcard
+ is juxtaposed between other pairs.
+
2007-04-06 Mark Wielaard <mark@klomp.org>
* configure.ac (VERSION): Set to 0.95-rc.
diff --git a/javax/management/ObjectName.java b/javax/management/ObjectName.java
index 00a2a2875..f41740469 100644
--- a/javax/management/ObjectName.java
+++ b/javax/management/ObjectName.java
@@ -190,36 +190,29 @@ public class ObjectName
if (domainSep == -1)
throw new MalformedObjectNameException("No domain separator was found.");
domain = name.substring(0, domainSep);
- String rest = name.substring(domainSep + 1);
+ propertyListString = name.substring(domainSep + 1);
properties = new TreeMap<String,String>();
- if (rest.equals("*"))
- propertyPattern = true;
- else
+ String[] pairs = propertyListString.split(",");
+ if (pairs.length == 0 && !isPattern())
+ throw new MalformedObjectNameException("A name that is not a " +
+ "pattern must contain at " +
+ "least one key-value pair.");
+ for (int a = 0; a < pairs.length; ++a)
{
- if (rest.endsWith(",*"))
+ if (pairs[a].equals("*"))
{
propertyPattern = true;
- propertyListString = rest.substring(0, rest.length() - 2);
+ continue;
}
- else
- propertyListString = rest;
- String[] pairs = propertyListString.split(",");
- if (pairs.length == 0 && !isPattern())
- throw new MalformedObjectNameException("A name that is not a " +
- "pattern must contain at " +
- "least one key-value pair.");
- for (int a = 0; a < pairs.length; ++a)
- {
- int sep = pairs[a].indexOf('=');
- if (sep == -1)
- throw new MalformedObjectNameException("A key must be " +
- "followed by a value.");
- String key = pairs[a].substring(0, sep);
- if (properties.containsKey(key))
- throw new MalformedObjectNameException("The same key occurs " +
- "more than once.");
- properties.put(key, pairs[a].substring(sep + 1));
- }
+ int sep = pairs[a].indexOf('=');
+ if (sep == -1)
+ throw new MalformedObjectNameException("A key must be " +
+ "followed by a value.");
+ String key = pairs[a].substring(0, sep);
+ if (properties.containsKey(key))
+ throw new MalformedObjectNameException("The same key occurs " +
+ "more than once.");
+ properties.put(key, pairs[a].substring(sep + 1));
}
checkComponents();
}