use of edu.columbia.cs.psl.phosphor.struct.TaintedLongWithObjTag in project phosphor by gmu-swe.
the class RuntimeReflectionPropogator method get.
public static Object get(Field f, Object obj, boolean isObjTags) throws IllegalArgumentException, IllegalAccessException {
f.setAccessible(true);
Object ret;
if (f.getType().isPrimitive()) {
if (f.getType() == Boolean.TYPE)
if (isObjTags)
ret = getBoolean$$PHOSPHORTAGGED(f, obj, new TaintedBooleanWithObjTag());
else
ret = getBoolean$$PHOSPHORTAGGED(f, obj, new TaintedBooleanWithIntTag());
else if (f.getType() == Byte.TYPE)
if (isObjTags)
ret = getByte$$PHOSPHORTAGGED(f, obj, new TaintedByteWithObjTag());
else
ret = getByte$$PHOSPHORTAGGED(f, obj, new TaintedByteWithIntTag());
else if (f.getType() == Character.TYPE)
if (isObjTags)
ret = getChar$$PHOSPHORTAGGED(f, obj, new TaintedCharWithObjTag());
else
ret = getChar$$PHOSPHORTAGGED(f, obj, new TaintedCharWithIntTag());
else if (f.getType() == Double.TYPE)
if (isObjTags)
ret = getDouble$$PHOSPHORTAGGED(f, obj, new TaintedDoubleWithObjTag());
else
ret = getDouble$$PHOSPHORTAGGED(f, obj, new TaintedDoubleWithIntTag());
else if (f.getType() == Float.TYPE)
if (isObjTags)
ret = getFloat$$PHOSPHORTAGGED(f, obj, new TaintedFloatWithObjTag());
else
ret = getFloat$$PHOSPHORTAGGED(f, obj, new TaintedFloatWithIntTag());
else if (f.getType() == Long.TYPE)
if (isObjTags)
ret = getLong$$PHOSPHORTAGGED(f, obj, new TaintedLongWithObjTag());
else
ret = getLong$$PHOSPHORTAGGED(f, obj, new TaintedLongWithIntTag());
else if (f.getType() == Integer.TYPE)
if (isObjTags)
ret = getInt$$PHOSPHORTAGGED(f, obj, new TaintedIntWithObjTag());
else
ret = getInt$$PHOSPHORTAGGED(f, obj, new TaintedIntWithIntTag());
else if (f.getType() == Short.TYPE)
if (isObjTags)
ret = getShort$$PHOSPHORTAGGED(f, obj, new TaintedShortWithObjTag());
else
ret = getShort$$PHOSPHORTAGGED(f, obj, new TaintedShortWithIntTag());
else
throw new IllegalArgumentException();
} else
ret = f.get(obj);
if (f.getType().isArray() && f.getType().getComponentType().isPrimitive()) {
Object taint = null;
try {
try {
if (ret instanceof LazyArrayIntTags && ((LazyArrayIntTags) ret).taints != null) {
return ret;
} else if (ret instanceof LazyArrayObjTags && ((LazyArrayObjTags) ret).taints != null) {
return ret;
} else {
Field taintField;
if (fieldToField.containsKey(f))
taintField = fieldToField.get(f);
else {
taintField = f.getDeclaringClass().getDeclaredField(f.getName() + TaintUtils.TAINT_FIELD);
taintField.setAccessible(true);
fieldToField.put(f, taintField);
}
taint = taintField.get(obj);
return taint;
}
} catch (NoSuchFieldException t) {
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (ret instanceof TaintedPrimitiveWithIntTag) {
return ((TaintedPrimitiveWithIntTag) ret).toPrimitiveType();
}
if (ret instanceof TaintedPrimitiveWithObjTag) {
return ((TaintedPrimitiveWithObjTag) ret).toPrimitiveType();
}
return ret;
}
Aggregations