SF.net SVN: mx4j: [2266] trunk/mx4j/jsr003/src/main/java/mx4j/loading/ MLetParser.java

[email protected] Wed, 21 Mar 2007 03:31:53 -0700
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Revision: 2266
          http://svn.sourceforge.net/mx4j/?rev=2266&view=rev
Author:   simonebordet
Date:     2007-03-21 03:31:48 -0700 (Wed, 21 Mar 2007)

Log Message:
-----------
Improved exception messages.

Modified Paths:
--------------
    trunk/mx4j/jsr003/src/main/java/mx4j/loading/MLetParser.java

Modified: trunk/mx4j/jsr003/src/main/java/mx4j/loading/MLetParser.java
===================================================================
--- trunk/mx4j/jsr003/src/main/java/mx4j/loading/MLetParser.java	2007-03-21 09:53:30 UTC (rev 2265)
+++ trunk/mx4j/jsr003/src/main/java/mx4j/loading/MLetParser.java	2007-03-21 10:31:48 UTC (rev 2266)
@@ -11,6 +11,7 @@
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.loading.MLet;
@@ -202,10 +203,11 @@
    private String findAttributeValue(String content, int start, String attribute) throws MLetParseException
    {
       int equal = content.indexOf('=', start);
-      if (equal < 0) throw new MLetParseException("Missing '=' for attribute");
+      if (equal < 0) throw new MLetParseException("Missing '=' for attribute " + attribute);
 
       // Ensure no garbage
-      if (!attribute.equals(content.substring(start, equal).trim())) throw new MLetParseException("Invalid attribute");
+       String attributeName = content.substring(start, equal).trim();
+       if (!attribute.equals(attributeName)) throw new MLetParseException("Invalid attribute " +  attributeName);
 
       int begin = content.indexOf('"', equal + 1);
       String value;
@@ -227,7 +229,7 @@
          value = content.substring(begin+1, end);
       }
       value = value.trim();
-      if (value.length() == 0) throw new MLetParseException("Invalid attribute value");
+      if (value.length() == 0) throw new MLetParseException("Missing attribute value of attribute " + attribute);
 
       return value;
    }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV