diff --git a/src/kx/K4AccessException.java b/src/kx/K4AccessException.java index 4e337c6e..fb62b3db 100644 --- a/src/kx/K4AccessException.java +++ b/src/kx/K4AccessException.java @@ -1,7 +1,7 @@ package kx; public class K4AccessException extends K4Exception { - K4AccessException() { + public K4AccessException() { super("Authentication failed"); } } diff --git a/src/studio/ui/TabPanel.java b/src/studio/ui/TabPanel.java index 168528b3..792c17c5 100755 --- a/src/studio/ui/TabPanel.java +++ b/src/studio/ui/TabPanel.java @@ -33,7 +33,7 @@ public class TabPanel extends JPanel { public TabPanel(StudioWindow studioWindow, QueryResult queryResult) { this.studioWindow = studioWindow; this.queryResult = queryResult; - if (queryResult != null) { + if (queryResult != null && queryResult.getError() == null ) { this.result = queryResult.getResult(); } initComponents(); diff --git a/test-integration/studio/ui/ResultTest.java b/test-integration/studio/ui/ResultTest.java index 2d5aaf0c..0f4ff855 100644 --- a/test-integration/studio/ui/ResultTest.java +++ b/test-integration/studio/ui/ResultTest.java @@ -1,5 +1,6 @@ package studio.ui; +import kx.K4AccessException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.assertj.swing.data.TableCell; @@ -13,6 +14,7 @@ import java.awt.*; import java.util.Arrays; +import java.util.regex.Pattern; public class ResultTest extends StudioTest { @@ -99,7 +101,16 @@ public void testTableConnExtractor() { String[] labels = popupMenu.menuLabels(); log.info("Got the following menu items {}", Arrays.toString(labels)); Assert.assertEquals("Open b:3", labels[0]); + } + @Test + public void testAuthenticationException() { + MockQSession.setResponse(new K4AccessException()); + execute(); + + JTextComponentFixture textArea = frameFixture.panel("resultPanel0").textBox(); + textArea.requireText(Pattern.compile(".*error.*Authentication failed.*", Pattern.DOTALL)); } + }