Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.helpers.ProximityHelper;
import com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.layouters.ZyGraphLayouter;
import com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -309,15 +310,15 @@ private void adoptSuperGraphLayout(final GraphLayout superLayout) {
// internal layout threads!
private void cancelLayoutCalculation() {
if (superLayoutThread != null && superLayoutThread.isAlive()) {
superLayoutThread.stop();
threadStop(superLayoutThread);
superLayoutThread = null;

doneLatch.countDown();
}

if (combinedLayoutThread != null && combinedLayoutThread.isAlive()) {

combinedLayoutThread.stop();
threadStop(combinedLayoutThread);
combinedLayoutThread = null;

doneLatch.countDown();
Expand All @@ -326,6 +327,22 @@ private void cancelLayoutCalculation() {
setCanceled();
}

private static void threadStop(Thread thread) {
// TODO: b/447223240 - clean up obsolete references to Thread.stop.
// Thread#stop has been deprecated since JDK 1.2. Starting in JDK 20 it always throws
// UnsupportedOperationException, and in JDK 26 the method has been removed.
try {
Thread.class.getMethod("stop").invoke(thread);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof UnsupportedOperationException) {
throw (UnsupportedOperationException) e.getCause();
}
throw new UnsupportedOperationException(e);
} catch (ReflectiveOperationException e) {
throw new UnsupportedOperationException(e);
}
}

private CanonicMultiStageLayouter createSecondThreadLayouter(
final CanonicMultiStageLayouter layouter, final GraphLayoutSettings settings) {
if (layouter instanceof CircularLayouter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.security.zynamics.zylib.gui.ProgressDialogs;

import com.google.security.zynamics.zylib.general.ListenerProvider;
import java.lang.reflect.InvocationTargetException;

/**
* This class is a helper thread to use with the CEndlessProgressDialog class. To use this class do
Expand Down Expand Up @@ -48,7 +49,23 @@ protected void finish() {
// within
// the threads
// run routine, and when true, return from thread function)
stop();
threadStop(this);
}

private static void threadStop(Thread thread) {
// TODO: b/447223240 - clean up obsolete references to Thread.stop.
// Thread#stop has been deprecated since JDK 1.2. Starting in JDK 20 it always throws
// UnsupportedOperationException, and in JDK 26 the method has been removed.
try {
Thread.class.getMethod("stop").invoke(thread);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof UnsupportedOperationException) {
throw (UnsupportedOperationException) e.getCause();
}
throw new UnsupportedOperationException(e);
} catch (ReflectiveOperationException e) {
throw new UnsupportedOperationException(e);
}
}

protected abstract void runExpensiveCommand() throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.security.zynamics.zylib.gui.ProgressDialogs;

import com.google.security.zynamics.zylib.general.ListenerProvider;
import java.lang.reflect.InvocationTargetException;

/**
* This class is a helper thread to use with the CEndlessProgressDialog class. To use this class do
Expand Down Expand Up @@ -42,7 +43,23 @@ private void notifyListeners() {
protected void finish() {
notifyListeners();

stop();
threadStop(this);
}

private static void threadStop(Thread thread) {
// TODO: b/447223240 - clean up obsolete references to Thread.stop.
// Thread#stop has been deprecated since JDK 1.2. Starting in JDK 20 it always throws
// UnsupportedOperationException, and in JDK 26 the method has been removed.
try {
Thread.class.getMethod("stop").invoke(thread);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof UnsupportedOperationException) {
throw (UnsupportedOperationException) e.getCause();
}
throw new UnsupportedOperationException(e);
} catch (ReflectiveOperationException e) {
throw new UnsupportedOperationException(e);
}
}

protected abstract void runExpensiveCommand() throws Exception;
Expand Down
Loading