use of com.ibm.dtfj.image.CorruptDataException in project openj9 by eclipse.
the class DTFJHeapUnitTest method generateXML.
@SuppressWarnings("unchecked")
public void generateXML(File path, JavaRuntime rt) throws Exception {
createWriter(path);
startTag("<heaps>\n");
for (Iterator heaps = rt.getHeaps(); heaps.hasNext(); ) {
JavaHeap heap = (JavaHeap) heaps.next();
writeIndent();
startTag("<heap name=\"" + heap.getName() + "\">\n");
long count = 0;
for (Iterator objects = heap.getObjects(); objects.hasNext(); count++) {
try {
JavaObject obj = (JavaObject) objects.next();
if (((count % 100) == 0) || (obj.isArray())) {
writeObject(obj, count);
}
} catch (CorruptDataException e) {
write("<!-- corrupt object @ " + e.getCorruptData().getAddress() + " -->");
}
}
startTag("<objects count=\"" + count + "\">\n");
endTag("</objects>\n");
endTag("</heap>\n");
}
endTag("</heaps>\n");
closeWriter();
}
use of com.ibm.dtfj.image.CorruptDataException in project openj9 by eclipse.
the class JavaThreadTest method getImageThreadTest.
@Test
public // JEXTRACT: only EVER throws DataUnavailableException with TCK core. We do better.
void getImageThreadTest() {
for (int i = 0; i < jextractTestObjects.size(); i++) {
JavaThread t1 = (JavaThread) jextractTestObjects.get(i);
ImageThread i1;
try {
i1 = (ImageThread) t1.getImageThread();
// System.out.println(i1.getID());
} catch (CorruptDataException e) {
System.out.println("CDE on thread: " + i);
} catch (DataUnavailable e) {
System.out.println("DUA on thread: " + i);
}
}
imageThreadComparator.testComparatorEquals(ddrTestObjects, jextractTestObjects, "getImageThread");
}
use of com.ibm.dtfj.image.CorruptDataException in project openj9 by eclipse.
the class JCImageProcess method getCurrentThread.
/**
*/
public ImageThread getCurrentThread() throws CorruptDataException {
ImageThread currentThread = null;
if (fCurrentThreadID != IBuilderData.NOT_AVAILABLE) {
// Return the indicated thread
ImagePointer ip = fImageAddressSpace.getPointer(fCurrentThreadID);
currentThread = getImageThread(ip);
if (currentThread == null) {
throw new CorruptDataException(new JCCorruptData("Bad native thread ID", ip));
}
}
return currentThread;
}
use of com.ibm.dtfj.image.CorruptDataException in project openj9 by eclipse.
the class ImageProcess method getCurrentThread.
/* (non-Javadoc)
* @see com.ibm.dtfj.image.ImageProcess#getCurrentThread()
*/
public com.ibm.dtfj.image.ImageThread getCurrentThread() throws CorruptDataException {
ImageThread current = _currentThread;
if (0 != _faultingNativeID) {
// look up this thread
Iterator threads = getThreads();
while (threads.hasNext()) {
Object next = threads.next();
if (next instanceof CorruptData)
continue;
ImageThread thread = (ImageThread) next;
if (Long.decode(thread.getID()).longValue() == _faultingNativeID) {
current = thread;
break;
}
}
}
// ensure that this is sane
if ((0 != _faultingNativeID) && (null == current)) {
throw new CorruptDataException(new CorruptData("no current thread", null));
}
return current;
}
use of com.ibm.dtfj.image.CorruptDataException in project openj9 by eclipse.
the class JavaAbstractClass method addSuperclassReference.
protected void addSuperclassReference(Collection coll) {
JavaReference jRef = null;
try {
com.ibm.dtfj.java.JavaClass superClass = this.getSuperclass();
if (null != superClass) {
jRef = new JavaReference(_javaVM, this, superClass, "Superclass", JavaReference.REFERENCE_SUPERCLASS, JavaReference.HEAP_ROOT_UNKNOWN, JavaReference.REACHABILITY_STRONG);
coll.add(jRef);
}
} catch (CorruptDataException e) {
coll.add(e.getCorruptData());
}
}
Aggregations