Mercurial > octave-nkf
changeset 20601:5d31cd795c21 stable
methods.m: try Java class names if getMethods fails on Java objects (bug #46010)
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Fri, 02 Oct 2015 17:44:53 +0200 |
parents | 1d6ab08edcde |
children | af5591ef9790 |
files | scripts/general/methods.m |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/methods.m Thu Oct 01 22:38:34 2015 +0200 +++ b/scripts/general/methods.m Fri Oct 02 17:44:53 2015 +0200 @@ -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");