summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2007-04-07 09:20:09 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2007-04-07 09:20:09 +0000
commit8d519a36a6c541b1d1d46b4a8773059aabd5ab2b (patch)
tree04e16f0a9d4209379c70fd77af1ecb8da7b98cd4
parentaf51216a7d181b05cd07c2e1dd974a137d452ff5 (diff)
downloadclasspath-8d519a36a6c541b1d1d46b4a8773059aabd5ab2b.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 2704b7d00..2d91073bc 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.96-pre.
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();
}