# HG changeset patch # User Philip Nienhuis # Date 1443800693 -7200 # Node ID 5d31cd795c213dd754d7cc8d3e684931bc877a38 # Parent 1d6ab08edcde8a92c5c2aed27e8c59a3c9949cfe methods.m: try Java class names if getMethods fails on Java objects (bug #46010) diff --git a/scripts/general/methods.m b/scripts/general/methods.m --- a/scripts/general/methods.m +++ b/scripts/general/methods.m @@ -47,10 +47,14 @@ mtds_list = ostrsplit (mtds_str, ';'); endif elseif (isjava (obj)) - ## FIXME: Function prototype that excepts java obj exists, but doesn't - ## work if obj is java.lang.String. Convert obj to classname. - obj = class (obj); - mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + ## FIXME: Function prototype accepts java obj, but doesn't work if obj + ## is e.g., java.lang.String. Convert obj to classname then. + try + mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + catch + obj = class (obj); + mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); + end_try_catch mtds_list = strsplit (mtds_str, ';'); else error ("methods: Invalid input argument");