Changeset 12

Show
Ignore:
Timestamp:
07/04/05 12:55:19 (3 years ago)
Author:
schst
Message:

Add namespace to exception message, added support for interface-based signatures

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/net/schst/XJConf/TagDefinition.java

    r10 r12  
    254254                } else { 
    255255                    Class childParamTypes[] = {childValue.getClass()}; 
     256                    Method childMethod = null; 
    256257                     
    257                     Method childMethod = cl.getMethod(methodName, childParamTypes); 
     258                    try { 
     259                        childMethod = cl.getMethod(methodName, childParamTypes); 
     260                    } catch (NoSuchMethodException e) { 
     261                        Class interfaces[] = childValue.getClass().getInterfaces(); 
     262                        for (int j = 0; j < interfaces.length; j++) { 
     263                            try { 
     264                                Class childParamTypes2[] = {interfaces[j]}; 
     265                                childMethod = cl.getMethod(methodName, childParamTypes2); 
     266                            } catch (Exception ex) { 
     267                                continue; 
     268                            } 
     269                            break; 
     270                        } 
     271                    } 
     272                    if (childMethod == null) { 
     273                        throw new ValueConversionException("Could not add child " + child.getKey() + " to " + this.getType() + " using "+methodName+"()."); 
     274                    } 
    258275                    childMethod.invoke(instance, childParams); 
    259276                } 
  • trunk/src/net/schst/XJConf/XmlReader.java

    r10 r12  
    204204            } 
    205205            if (!this.tagDefs.isTagDefined(namespaceURI, sName)) { 
    206                 throw new UnknownTagException("Unknown tag " + sName); 
     206                throw new UnknownTagException("Unknown tag " + sName + " in namespace " + namespaceURI); 
    207207            } 
    208208        }