Fix for undefined attribute names issue

23 views
Skip to first unread message

Mohan J

unread,
Feb 11, 2013, 6:15:24 AM2/11/13
to jminix...@googlegroups.com
Hi All,
 I got the same issue as listed in 6,7,8,10,15,16 not "able to handle special characters". It needed a small fix that I could figure : Encoding the $ref attribute in JSON response. This is some thing that is already there, but is not working. Below is the existing code. The first two "if clauses" never come true as item is comming an instance of String Class, so I added the url encode in the else clause. It worked for me, but we need to find out in which cases the first two cases will become true. 
 
 AbstractTemplateResource.java
 
 if (item instanceof MBeanAttributeInfo)
{
ref.put("$ref", encoderBean.encode(((MBeanAttributeInfo) item).getName()) + "/");
}
else if (item instanceof Map && ((Map) item).containsKey("declaration"))
{
ref.put("$ref", ((Map) item).get("declaration").toString());
}
else
{
ref.put("$ref",encoderBean.encode(item.toString()) + "/");    // This is the fix I added
 
 Please find the patch attached and the compiled jar for a quick test.
 I think the following defects   6,7,8,10,15,16 are refering to same issue. So all of them can tryout this fix I think
 
 Regards,
  Vamsi Mohan Jayanti
jminix-1.0.1_fix.jar
AbstractTemplateResource.patch
Reply all
Reply to author
Forward
0 new messages