PanelConsoles.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2020.
3
 * This program and the accompanying materials
4
 * are made available under no term at all, use it like
5
 * you want, but share and discuss about it
6
 * every time possible with every body.
7
 *
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 *******************************************************************************/
11
package com.jsql.view.swing.panel;
12
13
import com.jsql.model.InjectionModel;
14
import com.jsql.util.LogLevelUtil;
15
import com.jsql.view.swing.console.JTextPaneAppender;
16
import com.jsql.view.swing.console.JavaConsoleAdapter;
17
import com.jsql.view.swing.console.SimpleConsoleAdapter;
18
import com.jsql.view.swing.panel.consoles.NetworkTable;
19
import com.jsql.view.swing.panel.consoles.TabbedPaneNetworkTab;
20
import com.jsql.view.swing.panel.split.SplitHorizontalTopBottom;
21
import com.jsql.view.swing.scrollpane.JScrollIndicator;
22
import com.jsql.view.swing.scrollpane.LightScrollPane;
23
import com.jsql.view.swing.splitpane.JSplitPaneWithZeroSizeDivider;
24
import com.jsql.view.swing.tab.TabConsoles;
25
import com.jsql.view.swing.text.JPopupTextArea;
26
import com.jsql.view.swing.text.JTextAreaPlaceholderConsole;
27
import com.jsql.view.swing.text.JToolTipI18n;
28
import com.jsql.view.swing.ui.CustomMetalTabbedPaneUI;
29
import com.jsql.view.swing.util.I18nViewUtil;
30
import com.jsql.view.swing.util.MediatorHelper;
31
import com.jsql.view.swing.util.UiUtil;
32
import org.apache.commons.lang3.StringUtils;
33
import org.apache.logging.log4j.LogManager;
34
import org.apache.logging.log4j.Logger;
35
36
import javax.swing.*;
37
import javax.swing.plaf.basic.BasicArrowButton;
38
import javax.swing.table.DefaultTableModel;
39
import java.awt.*;
40
import java.awt.event.AdjustmentEvent;
41
import java.awt.event.AdjustmentListener;
42
import java.awt.event.MouseAdapter;
43
import java.awt.event.MouseEvent;
44
import java.util.prefs.Preferences;
45
46
/**
47
 * A panel with different consoles displayed on the bottom.
48
 */
49
public class PanelConsoles extends JPanel {
50
    
51
    /**
52
     * Log4j logger sent to view.
53
     */
54
    private static final Logger LOGGER = LogManager.getRootLogger();
55
56
    /**
57
     * Console for java exception messages.
58
     */
59
    private final JavaConsoleAdapter javaTextPane = new JavaConsoleAdapter("Java", "Java unhandled exception");
60
    
61
    /**
62
     * Console for raw SQL results.
63
     */
64
    private JTextArea chunkTextArea;
65
66
    /**
67
     * Panel displaying table of HTTP requests and responses.
68
     */
69
    private JSplitPaneWithZeroSizeDivider networkSplitPane;
70
71
    /**
72
     * Console for binary representation of characters found with blind/time injection.
73
     */
74
    private JTextArea binaryTextArea;
75
76
    private final TabConsoles tabConsoles = new TabConsoles();
77
    private TabbedPaneNetworkTab tabbedPaneNetworkTab;
78
    private NetworkTable networkTable;
79
    
80
    private final BasicArrowButton buttonShowNorth = new BasicArrowButton(SwingConstants.NORTH);
81
    private int location = 0;
82
    
83
    /**
84
     * Create panel at the bottom with different consoles to report injection process.
85
     */
86
    public PanelConsoles() {
87
        
88 1 1. <init> : removed call to javax/swing/JTextPane::setEditable → NO_COVERAGE
        this.javaTextPane.getProxy().setEditable(false);
89 1 1. <init> : removed call to com/jsql/view/swing/console/JTextPaneAppender::register → NO_COVERAGE
        JTextPaneAppender.register(this.javaTextPane);
90
        
91 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelConsoles::initializeSplit → NO_COVERAGE
        this.initializeSplit();
92
93 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(this.tabConsoles);
94 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelConsoles::initializeTabsConsoles → NO_COVERAGE
        this.initializeTabsConsoles();
95
96 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelConsoles::setLayout → NO_COVERAGE
        this.setLayout(new OverlayLayout(this));
97
98
        JPanel expandPanel = this.initializeExpandPanel();
99
        
100
        this.add(expandPanel);
101
        this.add(this.tabConsoles);
102
103
        // Do Overlay
104 1 1. <init> : removed call to javax/swing/JPanel::setAlignmentX → NO_COVERAGE
        expandPanel.setAlignmentX(FlowLayout.TRAILING);
105 1 1. <init> : removed call to javax/swing/JPanel::setAlignmentY → NO_COVERAGE
        expandPanel.setAlignmentY(Component.TOP_ALIGNMENT);
106 1 1. <init> : removed call to com/jsql/view/swing/tab/TabConsoles::setAlignmentX → NO_COVERAGE
        this.tabConsoles.setAlignmentX(FlowLayout.LEADING);
107 1 1. <init> : removed call to com/jsql/view/swing/tab/TabConsoles::setAlignmentY → NO_COVERAGE
        this.tabConsoles.setAlignmentY(Component.TOP_ALIGNMENT);
108
    }
109
110
    private void initializeSplit() {
111
        
112
        this.networkSplitPane = new JSplitPaneWithZeroSizeDivider(JSplitPane.HORIZONTAL_SPLIT);
113
        
114 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setResizeWeight → NO_COVERAGE
        this.networkSplitPane.setResizeWeight(1);
115 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerSize → NO_COVERAGE
        this.networkSplitPane.setDividerSize(0);
116 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerLocation → NO_COVERAGE
        this.networkSplitPane.setDividerLocation(600);
117 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setBorder → NO_COVERAGE
        this.networkSplitPane.setBorder(BorderFactory.createEmptyBorder());
118
        
119
        this.tabbedPaneNetworkTab = new TabbedPaneNetworkTab();
120
        
121 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setRightComponent → NO_COVERAGE
        this.networkSplitPane.setRightComponent(this.tabbedPaneNetworkTab);
122
        
123
        this.networkTable = new NetworkTable(this.tabbedPaneNetworkTab);
124
        
125
        JScrollIndicator scrollerNetwork = this.initializeScrollerTable();
126 1 1. initializeSplit : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setLeftComponent → NO_COVERAGE
        this.networkSplitPane.setLeftComponent(scrollerNetwork);
127
    }
128
129
    private JScrollIndicator initializeScrollerTable() {
130
        
131
        var scrollerNetwork = new JScrollIndicator(this.networkTable, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
132 1 1. initializeScrollerTable : removed call to javax/swing/JScrollPane::setBorder → NO_COVERAGE
        scrollerNetwork.getScrollPane().setBorder(BorderFactory.createEmptyBorder(0, 0, -1, -1));
133 1 1. initializeScrollerTable : removed call to javax/swing/JScrollPane::setViewportBorder → NO_COVERAGE
        scrollerNetwork.getScrollPane().setViewportBorder(BorderFactory.createEmptyBorder(0, 0, -1, -1));
134
        
135
        AdjustmentListener singleItemScroll = adjustmentEvent -> {
136
            
137
            // The user scrolled the List (using the bar, mouse wheel or something else):
138 1 1. lambda$initializeScrollerTable$0 : negated conditional → NO_COVERAGE
            if (adjustmentEvent.getAdjustmentType() == AdjustmentEvent.TRACK) {
139
                
140
                // Jump to the next "block" (which is a row".
141 1 1. lambda$initializeScrollerTable$0 : removed call to java/awt/Adjustable::setBlockIncrement → NO_COVERAGE
                adjustmentEvent.getAdjustable().setBlockIncrement(100);
142 1 1. lambda$initializeScrollerTable$0 : removed call to java/awt/Adjustable::setUnitIncrement → NO_COVERAGE
                adjustmentEvent.getAdjustable().setUnitIncrement(100);
143
            }
144
        };
145
146 1 1. initializeScrollerTable : removed call to javax/swing/JScrollBar::addAdjustmentListener → NO_COVERAGE
        scrollerNetwork.getScrollPane().getVerticalScrollBar().addAdjustmentListener(singleItemScroll);
147 1 1. initializeScrollerTable : removed call to javax/swing/JScrollBar::addAdjustmentListener → NO_COVERAGE
        scrollerNetwork.getScrollPane().getHorizontalScrollBar().addAdjustmentListener(singleItemScroll);
148
        
149 1 1. initializeScrollerTable : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::initializeScrollerTable → NO_COVERAGE
        return scrollerNetwork;
150
    }
151
152
    private void initializeTabsConsoles() {
153
        
154
        this.chunkTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Raw data extracted during injection")).getProxy();
155 1 1. initializeTabsConsoles : removed call to javax/swing/JTextArea::setEditable → NO_COVERAGE
        this.chunkTextArea.setEditable(false);
156
        
157
        this.binaryTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Characters extracted during blind or time injection")).getProxy();
158 1 1. initializeTabsConsoles : removed call to javax/swing/JTextArea::setEditable → NO_COVERAGE
        this.binaryTextArea.setEditable(false);
159
160 1 1. initializeTabsConsoles : removed call to javax/swing/JTextArea::setLineWrap → NO_COVERAGE
        this.chunkTextArea.setLineWrap(true);
161 1 1. initializeTabsConsoles : removed call to javax/swing/JTextArea::setLineWrap → NO_COVERAGE
        this.binaryTextArea.setLineWrap(true);
162
        
163
        var consoleTextPane = new SimpleConsoleAdapter("Console", "Event logging");
164
        
165
        // Object creation after customization
166 1 1. initializeTabsConsoles : removed call to javax/swing/JTextPane::setEditable → NO_COVERAGE
        consoleTextPane.getProxy().setEditable(false);
167
168 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/console/JTextPaneAppender::register → NO_COVERAGE
        JTextPaneAppender.register(consoleTextPane);
169
        
170 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/tab/TabConsoles::setUI → NO_COVERAGE
        this.tabConsoles.setUI(new CustomMetalTabbedPaneUI() {
171
            
172
            @Override protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
173 1 1. calculateTabWidth : replaced int return with 0 for com/jsql/view/swing/panel/PanelConsoles$1::calculateTabWidth → NO_COVERAGE
                return Math.max(80, super.calculateTabWidth(tabPlacement, tabIndex, metrics));
174
            }
175
        });
176
        
177 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/tab/TabConsoles::setBorder → NO_COVERAGE
        this.tabConsoles.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
178
179 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE
        this.buildI18nTab(
180
            "CONSOLE_MAIN_LABEL",
181
            "CONSOLE_MAIN_TOOLTIP",
182
            UiUtil.ICON_CONSOLE,
183
            new LightScrollPane(1, 0, 0, 0, consoleTextPane.getProxy()),
184
            0
185
        );
186
187
        // Order is important
188
        var preferences = Preferences.userRoot().node(InjectionModel.class.getName());
189 1 1. initializeTabsConsoles : negated conditional → NO_COVERAGE
        if (preferences.getBoolean(UiUtil.JAVA_VISIBLE, false)) {
190 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/panel/PanelConsoles::insertJavaTab → NO_COVERAGE
            this.insertJavaTab();
191
        }
192
        
193 1 1. initializeTabsConsoles : negated conditional → NO_COVERAGE
        if (preferences.getBoolean(UiUtil.NETWORK_VISIBLE, true)) {
194 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/panel/PanelConsoles::insertNetworkTab → NO_COVERAGE
            this.insertNetworkTab();
195
        }
196
        
197 1 1. initializeTabsConsoles : negated conditional → NO_COVERAGE
        if (preferences.getBoolean(UiUtil.CHUNK_VISIBLE, true)) {
198 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/panel/PanelConsoles::insertChunkTab → NO_COVERAGE
            this.insertChunkTab();
199
        }
200
        
201 1 1. initializeTabsConsoles : negated conditional → NO_COVERAGE
        if (preferences.getBoolean(UiUtil.BINARY_VISIBLE, true)) {
202 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/panel/PanelConsoles::insertBooleanTab → NO_COVERAGE
            this.insertBooleanTab();
203
        }
204
205
        // Reset Font when tab is selected
206 1 1. initializeTabsConsoles : removed call to com/jsql/view/swing/tab/TabConsoles::addChangeListener → NO_COVERAGE
        this.tabConsoles.addChangeListener(changeEvent -> {
207
            
208
            JTabbedPane tabs = this.tabConsoles;
209
            
210 2 1. lambda$initializeTabsConsoles$1 : negated conditional → NO_COVERAGE
2. lambda$initializeTabsConsoles$1 : changed conditional boundary → NO_COVERAGE
            if (tabs.getSelectedIndex() > -1) {
211
                
212
                var currentTabHeader = tabs.getTabComponentAt(tabs.getSelectedIndex());
213
                
214 1 1. lambda$initializeTabsConsoles$1 : negated conditional → NO_COVERAGE
                if (currentTabHeader != null) {
215
                    
216 1 1. lambda$initializeTabsConsoles$1 : removed call to java/awt/Component::setFont → NO_COVERAGE
                    currentTabHeader.setFont(currentTabHeader.getFont().deriveFont(Font.PLAIN));
217 1 1. lambda$initializeTabsConsoles$1 : removed call to java/awt/Component::setForeground → NO_COVERAGE
                    currentTabHeader.setForeground(Color.BLACK);
218
                }
219
            }
220
        });
221
    }
222
223
    private JPanel initializeExpandPanel() {
224
225
        var buttonShowSouth = new BasicArrowButton(SwingConstants.SOUTH);
226 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setName → NO_COVERAGE
        buttonShowSouth.setName("buttonShowSouth");
227
228 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setBorderPainted → NO_COVERAGE
        buttonShowSouth.setBorderPainted(false);
229 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setPreferredSize → NO_COVERAGE
        buttonShowSouth.setPreferredSize(new Dimension(buttonShowSouth.getPreferredSize().width, buttonShowSouth.getPreferredSize().height));
230 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setMaximumSize → NO_COVERAGE
        buttonShowSouth.setMaximumSize(buttonShowSouth.getPreferredSize());
231 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setOpaque → NO_COVERAGE
        buttonShowSouth.setOpaque(false);
232 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setBorder → NO_COVERAGE
        buttonShowSouth.setBorder(BorderFactory.createEmptyBorder());
233 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::addActionListener → NO_COVERAGE
        buttonShowSouth.addActionListener(SplitHorizontalTopBottom.getActionHideShowConsole());
234
        
235 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setBorderPainted → NO_COVERAGE
        this.buttonShowNorth.setBorderPainted(false);
236 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setPreferredSize → NO_COVERAGE
        this.buttonShowNorth.setPreferredSize(new Dimension(this.buttonShowNorth.getPreferredSize().width, this.buttonShowNorth.getPreferredSize().height));
237 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setMaximumSize → NO_COVERAGE
        this.buttonShowNorth.setMaximumSize(this.buttonShowNorth.getPreferredSize());
238 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setOpaque → NO_COVERAGE
        this.buttonShowNorth.setOpaque(false);
239 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setBorder → NO_COVERAGE
        this.buttonShowNorth.setBorder(BorderFactory.createEmptyBorder());
240 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::addActionListener → NO_COVERAGE
        this.buttonShowNorth.addActionListener(SplitHorizontalTopBottom.getActionHideShowResult());
241 1 1. initializeExpandPanel : removed call to javax/swing/plaf/basic/BasicArrowButton::setName → NO_COVERAGE
        this.buttonShowNorth.setName("buttonShowNorth");
242
243
        var arrowDownPanel = new JPanel();
244 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        arrowDownPanel.setLayout(new BorderLayout());
245 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setOpaque → NO_COVERAGE
        arrowDownPanel.setOpaque(false);
246
        
247
        // Disable overlap with zerosizesplitter
248 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        arrowDownPanel.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
249 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setPreferredSize → NO_COVERAGE
        arrowDownPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 26));
250 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        arrowDownPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 26));
251
252
        var panelExpander = new JPanel(new BorderLayout());
253 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        panelExpander.setBorder(BorderFactory.createEmptyBorder());
254 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::add → NO_COVERAGE
        panelExpander.add(buttonShowSouth, BorderLayout.LINE_END);
255 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::add → NO_COVERAGE
        panelExpander.add(this.buttonShowNorth, BorderLayout.LINE_START);
256 1 1. initializeExpandPanel : removed call to javax/swing/JPanel::add → NO_COVERAGE
        arrowDownPanel.add(panelExpander, BorderLayout.LINE_END);
257
        
258 1 1. initializeExpandPanel : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::initializeExpandPanel → NO_COVERAGE
        return arrowDownPanel;
259
    }
260
261
    public void reset() {
262
        
263 1 1. reset : removed call to java/util/List::clear → NO_COVERAGE
        this.networkTable.getListHttpHeader().clear();
264
        
265
        // Empty infos tabs
266 1 1. reset : removed call to javax/swing/JTextArea::setText → NO_COVERAGE
        this.getChunkTab().setText(StringUtils.EMPTY);
267 1 1. reset : removed call to javax/swing/JTextArea::setText → NO_COVERAGE
        this.getBinaryTab().setText(StringUtils.EMPTY);
268
        
269
        // Fix #4657, Fix #1860: Multiple Exceptions on setRowCount()
270
        try {
271 1 1. reset : removed call to javax/swing/table/DefaultTableModel::setRowCount → NO_COVERAGE
            ((DefaultTableModel) this.networkTable.getModel()).setRowCount(0);
272
        } catch(NullPointerException | ArrayIndexOutOfBoundsException e) {
273
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
274
        }
275
        
276 1 1. reset : removed call to javax/swing/JTextPane::setText → NO_COVERAGE
        this.javaTextPane.getProxy().setText(StringUtils.EMPTY);
277
        
278 1 1. reset : removed call to com/jsql/view/swing/panel/consoles/TabbedPaneNetworkTab::reset → NO_COVERAGE
        this.tabbedPaneNetworkTab.reset();
279
    }
280
281
    /**
282
     * Add Chunk console to bottom panel.
283
     */
284
    public void insertChunkTab() {
285 1 1. insertChunkTab : removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE
        this.buildI18nTab(
286
            "CONSOLE_CHUNK_LABEL",
287
            "CONSOLE_CHUNK_TOOLTIP",
288
            UiUtil.ICON_CHUNK,
289
            new LightScrollPane(1, 0, 0, 0, PanelConsoles.this.chunkTextArea),
290
            1
291
        );
292
    }
293
294
    /**
295
     * Add Binary console to bottom panel.
296
     */
297
    public void insertBooleanTab() {
298 1 1. insertBooleanTab : removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE
        this.buildI18nTab(
299
            "CONSOLE_BINARY_LABEL",
300
            "CONSOLE_BINARY_TOOLTIP",
301
            UiUtil.ICON_BINARY,
302
            new LightScrollPane(1, 0, 0, 0, PanelConsoles.this.binaryTextArea),
303 2 1. insertBooleanTab : negated conditional → NO_COVERAGE
2. insertBooleanTab : Replaced integer addition with subtraction → NO_COVERAGE
            1 + (MediatorHelper.menubar().getChunkMenu().isSelected() ? 1 : 0)
304
        );
305
    }
306
307
    /**
308
     * Add Network tab to bottom panel.
309
     */
310
    public void insertNetworkTab() {
311 1 1. insertNetworkTab : removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE
        this.buildI18nTab(
312
            "CONSOLE_NETWORK_LABEL",
313
            "CONSOLE_NETWORK_TOOLTIP",
314
            UiUtil.ICON_HEADER,
315
            new LightScrollPane(1, 0, 0, 0, PanelConsoles.this.networkSplitPane),
316 2 1. insertNetworkTab : negated conditional → NO_COVERAGE
2. insertNetworkTab : Replaced integer subtraction with addition → NO_COVERAGE
            this.tabConsoles.getTabCount() - (MediatorHelper.menubar().getJavaDebugMenu().isSelected() ? 1 : 0)
317
        );
318
    }
319
320
    /**
321
     * Add Java console to bottom panel.
322
     */
323
    public void insertJavaTab() {
324 1 1. insertJavaTab : removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE
        this.buildI18nTab(
325
            "CONSOLE_JAVA_LABEL",
326
            "CONSOLE_JAVA_TOOLTIP",
327
            UiUtil.ICON_CUP,
328
            new LightScrollPane(1, 0, 0, 0, this.javaTextPane.getProxy()),
329
            this.tabConsoles.getTabCount()
330
        );
331
    }
332
    
333
    private void buildI18nTab(String keyLabel, String keyTooltip, Icon icon, Component manager, int position) {
334
        
335
        final var refJToolTipI18n = new JToolTipI18n[]{ new JToolTipI18n(I18nViewUtil.valueByKey(keyTooltip)) };
336
        
337
        var labelTab = new JLabel(I18nViewUtil.valueByKey(keyLabel), icon, SwingConstants.CENTER) {
338
            @Override
339
            public JToolTip createToolTip() {
340
                
341
                JToolTipI18n tipI18n = new JToolTipI18n(I18nViewUtil.valueByKey(keyTooltip));
342
                refJToolTipI18n[0] = tipI18n;
343
                
344 1 1. createToolTip : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles$2::createToolTip → NO_COVERAGE
                return tipI18n;
345
            }
346
        };
347
        
348 1 1. buildI18nTab : removed call to com/jsql/view/swing/panel/PanelConsoles$2::setName → NO_COVERAGE
        labelTab.setName(keyLabel);
349 1 1. buildI18nTab : removed call to com/jsql/view/swing/panel/PanelConsoles$2::addMouseListener → NO_COVERAGE
        labelTab.addMouseListener(new MouseAdapter() {
350
            @Override
351
            public void mousePressed(MouseEvent event) {
352
                
353
                // Fix #90428: IllegalArgumentException in setSelectedComponent()
354
                // ArrayIndexOutOfBoundsException #92973 on setSelectedComponent()
355
                try {
356 1 1. mousePressed : removed call to com/jsql/view/swing/tab/TabConsoles::setSelectedComponent → NO_COVERAGE
                    PanelConsoles.this.tabConsoles.setSelectedComponent(manager);
357
                } catch (IllegalArgumentException e) {
358
                    LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
359
                }
360
                
361 1 1. mousePressed : removed call to java/awt/event/MouseAdapter::mousePressed → NO_COVERAGE
                super.mousePressed(event);
362
            }
363
        });
364
        
365 1 1. buildI18nTab : removed call to com/jsql/view/swing/tab/TabConsoles::insertTab → NO_COVERAGE
        this.tabConsoles.insertTab(I18nViewUtil.valueByKey(keyLabel), icon, manager, null, position);
366 1 1. buildI18nTab : removed call to com/jsql/view/swing/tab/TabConsoles::setTabComponentAt → NO_COVERAGE
        this.tabConsoles.setTabComponentAt(
367
            this.tabConsoles.indexOfTab(I18nViewUtil.valueByKey(keyLabel)),
368
            labelTab
369
        );
370
        
371 1 1. buildI18nTab : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(keyLabel, labelTab);
372 1 1. buildI18nTab : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(keyTooltip, refJToolTipI18n[0]);
373 1 1. buildI18nTab : removed call to com/jsql/view/swing/panel/PanelConsoles$2::setToolTipText → NO_COVERAGE
        labelTab.setToolTipText(I18nViewUtil.valueByKey(keyTooltip));
374
    }
375
    
376
    public void messageChunk(String text) {
377
        try {
378 1 1. messageChunk : removed call to javax/swing/JTextArea::append → NO_COVERAGE
            this.chunkTextArea.append(text +"\n");
379 1 1. messageChunk : removed call to javax/swing/JTextArea::setCaretPosition → NO_COVERAGE
            this.chunkTextArea.setCaretPosition(this.chunkTextArea.getDocument().getLength());
380
            
381
        } catch (NullPointerException | ArrayIndexOutOfBoundsException e) {
382
            // Fix #67063: NullPointerException on chunkTab.append()
383
            // Fix #4770 on chunkTab.append()
384
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e.getMessage(), e);
385
        }
386
    }
387
    
388
    public void messageBinary(String text) {
389
        try {
390 1 1. messageBinary : removed call to javax/swing/JTextArea::append → NO_COVERAGE
            this.binaryTextArea.append(
391
                String.format("\t%s", text)
392
            );
393 1 1. messageBinary : removed call to javax/swing/JTextArea::setCaretPosition → NO_COVERAGE
            this.binaryTextArea.setCaretPosition(this.binaryTextArea.getDocument().getLength());
394
        
395
        } catch (NullPointerException | ArrayIndexOutOfBoundsException e) {
396
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e.getMessage(), e);
397
        }
398
    }
399
    
400
    
401
    // Getter and setter
402
403
    public JTextArea getChunkTab() {
404 1 1. getChunkTab : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getChunkTab → NO_COVERAGE
        return this.chunkTextArea;
405
    }
406
407
    public JSplitPaneWithZeroSizeDivider getNetworkSplitPane() {
408 1 1. getNetworkSplitPane : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getNetworkSplitPane → NO_COVERAGE
        return this.networkSplitPane;
409
    }
410
411
    public JTextArea getBinaryTab() {
412 1 1. getBinaryTab : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getBinaryTab → NO_COVERAGE
        return this.binaryTextArea;
413
    }
414
415
    public int getDividerLocation() {
416 1 1. getDividerLocation : replaced int return with 0 for com/jsql/view/swing/panel/PanelConsoles::getDividerLocation → NO_COVERAGE
        return this.location;
417
    }
418
419
    public void setDividerLocation(int location) {
420
        this.location = location;
421
    }
422
423
    public BasicArrowButton getButtonShowNorth() {
424 1 1. getButtonShowNorth : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getButtonShowNorth → NO_COVERAGE
        return this.buttonShowNorth;
425
    }
426
427
    public NetworkTable getNetworkTable() {
428 1 1. getNetworkTable : replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getNetworkTable → NO_COVERAGE
        return this.networkTable;
429
    }
430
}

Mutations

88

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextPane::setEditable → NO_COVERAGE

89

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/console/JTextPaneAppender::register → NO_COVERAGE

91

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::initializeSplit → NO_COVERAGE

93

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

94

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::initializeTabsConsoles → NO_COVERAGE

96

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::setLayout → NO_COVERAGE

104

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setAlignmentX → NO_COVERAGE

105

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPanel::setAlignmentY → NO_COVERAGE

106

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setAlignmentX → NO_COVERAGE

107

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setAlignmentY → NO_COVERAGE

114

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setResizeWeight → NO_COVERAGE

115

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerSize → NO_COVERAGE

116

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerLocation → NO_COVERAGE

117

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setBorder → NO_COVERAGE

121

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setRightComponent → NO_COVERAGE

126

1.1
Location : initializeSplit
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setLeftComponent → NO_COVERAGE

132

1.1
Location : initializeScrollerTable
Killed by : none
removed call to javax/swing/JScrollPane::setBorder → NO_COVERAGE

133

1.1
Location : initializeScrollerTable
Killed by : none
removed call to javax/swing/JScrollPane::setViewportBorder → NO_COVERAGE

138

1.1
Location : lambda$initializeScrollerTable$0
Killed by : none
negated conditional → NO_COVERAGE

141

1.1
Location : lambda$initializeScrollerTable$0
Killed by : none
removed call to java/awt/Adjustable::setBlockIncrement → NO_COVERAGE

142

1.1
Location : lambda$initializeScrollerTable$0
Killed by : none
removed call to java/awt/Adjustable::setUnitIncrement → NO_COVERAGE

146

1.1
Location : initializeScrollerTable
Killed by : none
removed call to javax/swing/JScrollBar::addAdjustmentListener → NO_COVERAGE

147

1.1
Location : initializeScrollerTable
Killed by : none
removed call to javax/swing/JScrollBar::addAdjustmentListener → NO_COVERAGE

149

1.1
Location : initializeScrollerTable
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::initializeScrollerTable → NO_COVERAGE

155

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to javax/swing/JTextArea::setEditable → NO_COVERAGE

158

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to javax/swing/JTextArea::setEditable → NO_COVERAGE

160

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to javax/swing/JTextArea::setLineWrap → NO_COVERAGE

161

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to javax/swing/JTextArea::setLineWrap → NO_COVERAGE

166

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to javax/swing/JTextPane::setEditable → NO_COVERAGE

168

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/console/JTextPaneAppender::register → NO_COVERAGE

170

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setUI → NO_COVERAGE

173

1.1
Location : calculateTabWidth
Killed by : none
replaced int return with 0 for com/jsql/view/swing/panel/PanelConsoles$1::calculateTabWidth → NO_COVERAGE

177

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setBorder → NO_COVERAGE

179

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE

189

1.1
Location : initializeTabsConsoles
Killed by : none
negated conditional → NO_COVERAGE

190

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertJavaTab → NO_COVERAGE

193

1.1
Location : initializeTabsConsoles
Killed by : none
negated conditional → NO_COVERAGE

194

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertNetworkTab → NO_COVERAGE

197

1.1
Location : initializeTabsConsoles
Killed by : none
negated conditional → NO_COVERAGE

198

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertChunkTab → NO_COVERAGE

201

1.1
Location : initializeTabsConsoles
Killed by : none
negated conditional → NO_COVERAGE

202

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertBooleanTab → NO_COVERAGE

206

1.1
Location : initializeTabsConsoles
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::addChangeListener → NO_COVERAGE

210

1.1
Location : lambda$initializeTabsConsoles$1
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$initializeTabsConsoles$1
Killed by : none
changed conditional boundary → NO_COVERAGE

214

1.1
Location : lambda$initializeTabsConsoles$1
Killed by : none
negated conditional → NO_COVERAGE

216

1.1
Location : lambda$initializeTabsConsoles$1
Killed by : none
removed call to java/awt/Component::setFont → NO_COVERAGE

217

1.1
Location : lambda$initializeTabsConsoles$1
Killed by : none
removed call to java/awt/Component::setForeground → NO_COVERAGE

226

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setName → NO_COVERAGE

228

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setBorderPainted → NO_COVERAGE

229

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setPreferredSize → NO_COVERAGE

230

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setMaximumSize → NO_COVERAGE

231

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setOpaque → NO_COVERAGE

232

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setBorder → NO_COVERAGE

233

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::addActionListener → NO_COVERAGE

235

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setBorderPainted → NO_COVERAGE

236

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setPreferredSize → NO_COVERAGE

237

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setMaximumSize → NO_COVERAGE

238

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setOpaque → NO_COVERAGE

239

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setBorder → NO_COVERAGE

240

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::addActionListener → NO_COVERAGE

241

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/plaf/basic/BasicArrowButton::setName → NO_COVERAGE

244

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setLayout → NO_COVERAGE

245

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setOpaque → NO_COVERAGE

248

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setBorder → NO_COVERAGE

249

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setPreferredSize → NO_COVERAGE

250

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE

253

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::setBorder → NO_COVERAGE

254

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::add → NO_COVERAGE

255

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::add → NO_COVERAGE

256

1.1
Location : initializeExpandPanel
Killed by : none
removed call to javax/swing/JPanel::add → NO_COVERAGE

258

1.1
Location : initializeExpandPanel
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::initializeExpandPanel → NO_COVERAGE

263

1.1
Location : reset
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

266

1.1
Location : reset
Killed by : none
removed call to javax/swing/JTextArea::setText → NO_COVERAGE

267

1.1
Location : reset
Killed by : none
removed call to javax/swing/JTextArea::setText → NO_COVERAGE

271

1.1
Location : reset
Killed by : none
removed call to javax/swing/table/DefaultTableModel::setRowCount → NO_COVERAGE

276

1.1
Location : reset
Killed by : none
removed call to javax/swing/JTextPane::setText → NO_COVERAGE

278

1.1
Location : reset
Killed by : none
removed call to com/jsql/view/swing/panel/consoles/TabbedPaneNetworkTab::reset → NO_COVERAGE

285

1.1
Location : insertChunkTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE

298

1.1
Location : insertBooleanTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE

303

1.1
Location : insertBooleanTab
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : insertBooleanTab
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

311

1.1
Location : insertNetworkTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE

316

1.1
Location : insertNetworkTab
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : insertNetworkTab
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

324

1.1
Location : insertJavaTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::buildI18nTab → NO_COVERAGE

344

1.1
Location : createToolTip
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles$2::createToolTip → NO_COVERAGE

348

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles$2::setName → NO_COVERAGE

349

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles$2::addMouseListener → NO_COVERAGE

356

1.1
Location : mousePressed
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setSelectedComponent → NO_COVERAGE

361

1.1
Location : mousePressed
Killed by : none
removed call to java/awt/event/MouseAdapter::mousePressed → NO_COVERAGE

365

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::insertTab → NO_COVERAGE

366

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabConsoles::setTabComponentAt → NO_COVERAGE

371

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

372

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

373

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles$2::setToolTipText → NO_COVERAGE

378

1.1
Location : messageChunk
Killed by : none
removed call to javax/swing/JTextArea::append → NO_COVERAGE

379

1.1
Location : messageChunk
Killed by : none
removed call to javax/swing/JTextArea::setCaretPosition → NO_COVERAGE

390

1.1
Location : messageBinary
Killed by : none
removed call to javax/swing/JTextArea::append → NO_COVERAGE

393

1.1
Location : messageBinary
Killed by : none
removed call to javax/swing/JTextArea::setCaretPosition → NO_COVERAGE

404

1.1
Location : getChunkTab
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getChunkTab → NO_COVERAGE

408

1.1
Location : getNetworkSplitPane
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getNetworkSplitPane → NO_COVERAGE

412

1.1
Location : getBinaryTab
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getBinaryTab → NO_COVERAGE

416

1.1
Location : getDividerLocation
Killed by : none
replaced int return with 0 for com/jsql/view/swing/panel/PanelConsoles::getDividerLocation → NO_COVERAGE

424

1.1
Location : getButtonShowNorth
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getButtonShowNorth → NO_COVERAGE

428

1.1
Location : getNetworkTable
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/PanelConsoles::getNetworkTable → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1