use of jadx.plugins.input.java.data.code.trycatch.JavaTryData in project jadx by skylot.
the class JavaCodeReader method getTries.
@Override
public List<ITry> getTries() {
skipToTries();
int excTableLen = reader.readU2();
if (excTableLen == 0) {
return Collections.emptyList();
}
ConstPoolReader constPool = clsData.getConstPoolReader();
Map<JavaTryData, List<JavaSingleCatch>> tries = new HashMap<>(excTableLen);
for (int i = 0; i < excTableLen; i++) {
int start = reader.readU2();
int end = reader.readU2();
int handler = reader.readU2();
int type = reader.readU2();
JavaTryData tryData = new JavaTryData(start, end);
List<JavaSingleCatch> catches = tries.computeIfAbsent(tryData, k -> new ArrayList<>());
if (type == 0) {
catches.add(new JavaSingleCatch(handler, null));
} else {
catches.add(new JavaSingleCatch(handler, constPool.getClass(type)));
}
}
return tries.entrySet().stream().map(e -> {
JavaTryData tryData = e.getKey();
tryData.setCatch(convertSingleCatches(e.getValue()));
return tryData;
}).collect(Collectors.toList());
}
Aggregations