> On 18 Feb 2016, at 15:55, Vladimir Ivanov <vladimir.x.iva...@oracle.com> > wrote: > >> P.S.: You could improve the assertion with the Type class, so it would also >> fail on otherwise broken descriptor strings (missing "L" or missing ";"): > I like how it shapes out with Type. Thanks, Uwe! >
Me too! Paul. > Best regards, > Vladimir Ivanov > >> >> static boolean checkClassName(String cn) { >> Type tp = Type.getType(cn); >> // additional sanity so only valid "L;" descriptors work >> if (tp.getSort() != Type.OBJECT) { >> return false; >> } >> try { >> Class<?> c = Class.forName(tp.getClassName(), false, null); >> return true; >> } catch (ClassNotFoundException e) { >> return false; >> } >> } >> >> ----- >> Uwe Schindler >> uschind...@apache.org >> ASF Member, Apache Lucene PMC / Committer >> Bremen, Germany >> http://lucene.apache.org/