Skip to content

Commit

Permalink
Don't fail the build when an editor fails to close in closeAllPanels.
Browse files Browse the repository at this point in the history
  • Loading branch information
pabender committed Jun 20, 2020
1 parent 31e2864 commit 0642128
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion java/test/jmri/util/JUnitUtil.java
Expand Up @@ -17,6 +17,7 @@
import org.junit.Assert;
import org.netbeans.jemmy.FrameWaiter;
import org.netbeans.jemmy.TestOut;
import org.netbeans.jemmy.TimeoutExpiredException;
import org.netbeans.jemmy.operators.AbstractButtonOperator;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
Expand Down Expand Up @@ -1468,7 +1469,19 @@ static void handleThreads() {
public static void closeAllPanels() {
InstanceManager.getOptionalDefault(EditorManager.class)
.ifPresent(m -> m.getAll()
.forEach(e -> new EditorFrameOperator(e).closeFrameWithConfirmations()));
.forEach(e -> {
if(e.isVisible()){
e.requestFocus();
try {
EditorFrameOperator editorFrameOperator = new EditorFrameOperator(e);
editorFrameOperator.closeFrameWithConfirmations();
} catch (TimeoutExpiredException timeoutException ) {
log.warn("Failed to close panel {} with exception {}",e.getTitle(),
timeoutException.getMessage(),
Log4JUtil.shortenStacktrace(timeoutException));
}
}
}));
}

/* GraphicsEnvironment utility methods */
Expand Down

0 comments on commit 0642128

Please sign in to comment.