Slight improvement to signature validation, fixes @gabizou

This commit is contained in:
Mumfrey committed 2015-12-21 23:27:27 +00:00
1 parent 12d76f72e3
commit 752e5e8a3e
1 file changed
+11 -2
@@ -282,8 +282,17 @@ public class MemberInfo {
*/
public MemberInfo validate() throws InvalidMemberDescriptorException {
// Extremely naive class name validation, just to spot really egregious errors
if (this.owner != null && !this.owner.matches("(?i)^[\\w\\p{Sc}/]+$")) {
throw new InvalidMemberDescriptorException("Invalid owner: " + this.owner);
if (this.owner != null) {
if (!this.owner.matches("(?i)^[\\w\\p{Sc}/]+$")) {
throw new InvalidMemberDescriptorException("Invalid owner: " + this.owner);
}
try {
if (!this.owner.equals(Type.getType(this.owner).getDescriptor())) {
throw new InvalidMemberDescriptorException("Invalid owner type specified: " + this.owner);
}
} catch (Exception ex) {
throw new InvalidMemberDescriptorException("Invalid owner type specified: " + this.owner);
}
}
// Also naive validation, we're looking for stupid errors here