PanelTrailingAddress.java

1
package com.jsql.view.swing.panel.address;
2
3
import com.jsql.model.injection.strategy.AbstractStrategy;
4
import com.jsql.model.injection.strategy.StrategyError;
5
import com.jsql.model.injection.engine.model.Engine;
6
import com.jsql.model.injection.engine.model.yaml.Method;
7
import com.jsql.util.I18nUtil;
8
import com.jsql.util.LogLevelUtil;
9
import com.jsql.view.swing.panel.PanelAddressBar;
10
import com.jsql.view.swing.text.JToolTipI18n;
11
import com.jsql.view.swing.util.I18nViewUtil;
12
import com.jsql.view.swing.util.MediatorHelper;
13
import com.jsql.view.swing.util.UiUtil;
14
import org.apache.logging.log4j.LogManager;
15
import org.apache.logging.log4j.Logger;
16
17
import javax.swing.*;
18
import java.awt.*;
19
import java.awt.event.MouseAdapter;
20
import java.awt.event.MouseEvent;
21
import java.util.Arrays;
22
import java.util.Locale;
23
import java.util.concurrent.atomic.AtomicReference;
24
import java.util.stream.StreamSupport;
25
26
public class PanelTrailingAddress extends JPanel {
27
28
    private static final Logger LOGGER = LogManager.getRootLogger();
29
30
    public static final String MENU_STRATEGY = "menuStrategy";
31
    public static final String ITEM_RADIO_STRATEGY_ERROR = "itemRadioStrategyError";
32
    public static final String MENU_VENDOR = "menuVendor";
33
    public static final String ITEM_RADIO_VENDOR = "itemRadioVendor";
34
35
    private JMenu itemRadioStrategyError;
36
37
    private final JLabel labelEngine = new JLabel(UiUtil.ARROW_DOWN.getIcon(), SwingConstants.LEFT);
38
    private final JLabel labelStrategy = new JLabel(UiUtil.ARROW_DOWN.getIcon(), SwingConstants.LEFT);
39
    private final JPopupMenu popupMenuEngines = new JPopupMenu();
40
    private final JPopupMenu popupMenuStrategies = new JPopupMenu();
41
42
    private final ButtonGroup groupStrategy = new ButtonGroup();
43
    public static final String PREFIX_NAME_ERROR = "itemRadioError";
44
    private static final String I18N_TOOLTIP_STRATEGY = "STRATEGY_%s_TOOLTIP";
45
46
    /**
47
     * Loader displayed during injection.
48
     */
49
    private final JProgressBar loader;
50
51
    /**
52
     * Connection button.
53
     */
54
    public final ButtonStart buttonStart = new ButtonStart();
55
    
56
    public PanelTrailingAddress(PanelAddressBar panelAddressBar) {
57 1 1. <init> : removed call to com/jsql/view/swing/panel/address/ButtonStart::addActionListener → NO_COVERAGE
        this.buttonStart.addActionListener(new ActionStart(panelAddressBar));
58 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setOpaque → NO_COVERAGE
        this.setOpaque(false);
59 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setBorder → NO_COVERAGE
        this.setBorder(null);
60 1 1. <init> : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelStrategy.setText("Strategy auto");
61 1 1. <init> : removed call to javax/swing/JLabel::setName → NO_COVERAGE
        this.labelStrategy.setName(PanelTrailingAddress.MENU_STRATEGY);
62
63
        for (final AbstractStrategy strategy: MediatorHelper.model().getMediatorStrategy().getStrategies()) {
64
            var nameStrategy = strategy.getName().toUpperCase(Locale.ROOT);
65
            JMenuItem itemRadioStrategy;
66 1 1. <init> : negated conditional → NO_COVERAGE
            if (strategy == MediatorHelper.model().getMediatorStrategy().getError()) {
67
                itemRadioStrategy = new JMenu(strategy.toString());
68
                this.itemRadioStrategyError = (JMenu) itemRadioStrategy;
69 1 1. <init> : removed call to java/awt/Component::setName → NO_COVERAGE
                itemRadioStrategy.getComponent().setName(PanelTrailingAddress.ITEM_RADIO_STRATEGY_ERROR);
70
            } else {
71
                var atomicTooltip = new AtomicReference<>(new JToolTipI18n(
72
                    I18nUtil.valueByKey(String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy))
73
                ));
74
                itemRadioStrategy = new JRadioButtonMenuItem(strategy.toString()) {
75
                    @Override
76
                    public JToolTip createToolTip() {
77 1 1. createToolTip : removed call to java/util/concurrent/atomic/AtomicReference::set → NO_COVERAGE
                        atomicTooltip.set(new JToolTipI18n(
78
                            I18nUtil.valueByKey(
79
                                String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy)
80
                            )
81
                        ));
82 1 1. createToolTip : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress$1::createToolTip → NO_COVERAGE
                        return atomicTooltip.get();
83
                    }
84
                };
85 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
                I18nViewUtil.addComponentForKey(
86
                    String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy),
87
                    atomicTooltip.get()
88
                );
89 1 1. <init> : removed call to java/awt/Component::setName → NO_COVERAGE
                itemRadioStrategy.getComponent().setName("itemRadioStrategy" + strategy);
90 1 1. <init> : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
                itemRadioStrategy.addActionListener(actionEvent -> {
91 1 1. lambda$new$0 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(strategy.toString());
92 1 1. lambda$new$0 : removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().setStrategy(strategy);
93
                });
94 1 1. <init> : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
                this.groupStrategy.add(itemRadioStrategy);
95
            }
96
97
            this.popupMenuStrategies.add(itemRadioStrategy);
98 1 1. <init> : removed call to javax/swing/JMenuItem::setToolTipText → NO_COVERAGE
            itemRadioStrategy.setToolTipText(
99
                I18nUtil.valueByKey(String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy))
100
            );
101 1 1. <init> : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            itemRadioStrategy.setEnabled(false);
102
        }
103
104 1 1. <init> : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelEngine.setText(MediatorHelper.model().getMediatorEngine().getAuto().toString());
105 1 1. <init> : removed call to javax/swing/JLabel::setName → NO_COVERAGE
        this.labelEngine.setName(PanelTrailingAddress.MENU_VENDOR);
106 1 1. <init> : removed call to javax/swing/JPopupMenu::setLayout → NO_COVERAGE
        this.popupMenuEngines.setLayout(UiUtil.getColumnLayout(MediatorHelper.model().getMediatorEngine().getEngines().size()));
107
        var groupEngine = new ButtonGroup();
108
        for (final Engine engine : MediatorHelper.model().getMediatorEngine().getEngines()) {
109 1 1. <init> : negated conditional → NO_COVERAGE
            JMenuItem itemRadioEngine = new JRadioButtonMenuItem(engine.toString(), engine == MediatorHelper.model().getMediatorEngine().getAuto());
110 1 1. <init> : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
            itemRadioEngine.setName(PanelTrailingAddress.ITEM_RADIO_VENDOR + engine);
111 1 1. <init> : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
            itemRadioEngine.addActionListener(actionEvent -> {
112 1 1. lambda$new$1 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                this.labelEngine.setText(engine.toString());
113 1 1. lambda$new$1 : removed call to com/jsql/model/injection/engine/MediatorEngine::setEngineByUser → NO_COVERAGE
                MediatorHelper.model().getMediatorEngine().setEngineByUser(engine);
114
            });
115
            this.popupMenuEngines.add(itemRadioEngine);
116 1 1. <init> : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
            groupEngine.add(itemRadioEngine);
117
        }
118
119
        this.loader = new JProgressBar();
120
        var dimension = UIManager.getDimension("ProgressBar.horizontalSize");
121 1 1. <init> : removed call to javax/swing/JProgressBar::setPreferredSize → NO_COVERAGE
        this.loader.setPreferredSize(new Dimension(32, dimension.height));
122 1 1. <init> : removed call to javax/swing/JProgressBar::setIndeterminate → NO_COVERAGE
        this.loader.setIndeterminate(true);
123
        this.add(this.loader);
124
125 1 1. <init> : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        this.labelEngine.addMouseListener(new MouseAdapter() {
126
            @Override
127
            public void mousePressed(MouseEvent e) {
128
                Arrays.stream(PanelTrailingAddress.this.popupMenuEngines.getComponents())
129
                    .map(JComponent.class::cast)
130 1 1. mousePressed : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                    .forEach(JComponent::updateUI);  // required: incorrect when dark/light mode switch
131 1 1. mousePressed : removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE
                PanelTrailingAddress.this.popupMenuEngines.updateUI();  // required: incorrect when dark/light mode switch
132 1 1. mousePressed : removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE
                SwingUtilities.invokeLater(() -> {  // reduce flickering on linux
133 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::show → NO_COVERAGE
3. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuEngines.show(e.getComponent(), e.getComponent().getX(),5 + e.getComponent().getY() + e.getComponent().getHeight());
134 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
3. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuEngines.setLocation(e.getComponent().getLocationOnScreen().x,5 + e.getComponent().getLocationOnScreen().y + e.getComponent().getHeight());
135
                });
136
            }
137
        });
138 1 1. <init> : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        this.labelStrategy.addMouseListener(new MouseAdapter() {
139
            @Override
140
            public void mousePressed(MouseEvent e) {
141 2 1. lambda$mousePressed$0 : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress$3::lambda$mousePressed$0 → NO_COVERAGE
2. mousePressed : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                Arrays.stream(PanelTrailingAddress.this.popupMenuStrategies.getComponents()).map(a -> (JComponent) a).forEach(JComponent::updateUI);  // required: incorrect when dark/light mode switch
142 2 1. mousePressed : negated conditional → NO_COVERAGE
2. mousePressed : changed conditional boundary → NO_COVERAGE
                for (var i = 0 ; i < PanelTrailingAddress.this.getMenuError().getItemCount() ; i++) {
143 1 1. mousePressed : removed call to javax/swing/JMenuItem::updateUI → NO_COVERAGE
                    PanelTrailingAddress.this.getMenuError().getItem(i).updateUI();  // required: incorrect when dark/light mode switch
144
                }
145 1 1. mousePressed : removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE
                PanelTrailingAddress.this.popupMenuStrategies.updateUI();  // required: incorrect when dark/light mode switch
146 1 1. mousePressed : removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE
                SwingUtilities.invokeLater(() -> {  // reduce flickering on linux
147 3 1. lambda$mousePressed$1 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$1 : removed call to javax/swing/JPopupMenu::show → NO_COVERAGE
3. lambda$mousePressed$1 : Replaced integer addition with subtraction → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuStrategies.show(e.getComponent(), e.getComponent().getX(),5 + e.getComponent().getY() + e.getComponent().getHeight());
148 3 1. lambda$mousePressed$1 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$1 : removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE
3. lambda$mousePressed$1 : Replaced integer addition with subtraction → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuStrategies.setLocation(e.getComponent().getLocationOnScreen().x,5 + e.getComponent().getLocationOnScreen().y + e.getComponent().getHeight());
149
                });
150
            }
151
        });
152
153
        this.add(this.labelEngine);
154
        this.add(this.labelStrategy);
155
        this.add(this.buttonStart);
156 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setCursor → NO_COVERAGE
        this.setCursor(Cursor.getDefaultCursor());
157 1 1. <init> : removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE
        this.loader.setVisible(false);
158
    }
159
160
    public void endPreparation() {
161 1 1. endPreparation : removed call to com/jsql/view/swing/panel/address/ButtonStart::setToolTipText → NO_COVERAGE
        this.buttonStart.setToolTipText(I18nUtil.valueByKey("BUTTON_START_TOOLTIP"));
162 1 1. endPreparation : removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionReady → NO_COVERAGE
        this.buttonStart.setInjectionReady();
163 1 1. endPreparation : removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE
        this.loader.setVisible(false);
164
    }
165
    
166
    public void reset() {
167 1 1. reset : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelStrategy.setText("Strategy auto");
168 1 1. reset : negated conditional → NO_COVERAGE
        if (MediatorHelper.model().getMediatorEngine().getEngineByUser() == MediatorHelper.model().getMediatorEngine().getAuto()) {
169 1 1. reset : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelEngine.setText(MediatorHelper.model().getMediatorEngine().getAuto().toString());
170
        }
171
        Arrays.stream(this.popupMenuStrategies.getComponents())
172 2 1. reset : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$reset$2 : removed call to java/awt/Component::setEnabled → NO_COVERAGE
            .forEach(component -> component.setEnabled(false));
173 1 1. reset : removed call to javax/swing/JMenu::removeAll → NO_COVERAGE
        this.getMenuError().removeAll();
174
175 1 1. reset : removed call to javax/swing/ButtonGroup::clearSelection → NO_COVERAGE
        this.groupStrategy.clearSelection();
176 1 1. lambda$reset$3 : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$3 → NO_COVERAGE
        Iterable<AbstractButton> iterable = () -> this.groupStrategy.getElements().asIterator();
177
        StreamSupport.stream(iterable.spliterator(), false)
178 2 1. lambda$reset$4 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE
2. lambda$reset$4 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE
            .filter(abstractButton -> abstractButton.getName().startsWith(PanelTrailingAddress.PREFIX_NAME_ERROR))
179 1 1. reset : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(this.groupStrategy::remove);
180
    }
181
    
182
    public void setEngine(Engine engine) {
183 1 1. setEngine : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelEngine.setText(engine.toString());
184 1 1. setEngine : removed call to javax/swing/JMenu::removeAll → NO_COVERAGE
        this.itemRadioStrategyError.removeAll();
185
        var indexError = 0;
186
        if (
187 1 1. setEngine : negated conditional → NO_COVERAGE
            engine != MediatorHelper.model().getMediatorEngine().getAuto()
188 1 1. setEngine : negated conditional → NO_COVERAGE
            && engine.instance().getModelYaml().getStrategy().getError() != null
189
        ) {
190
            for (Method methodError: engine.instance().getModelYaml().getStrategy().getError().getMethod()) {
191
                JMenuItem itemRadioError = new JRadioButtonMenuItem(methodError.getName());
192 1 1. setEngine : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
                itemRadioError.setEnabled(false);
193 1 1. setEngine : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
                itemRadioError.setName(PanelTrailingAddress.PREFIX_NAME_ERROR + methodError.getName());
194
                this.itemRadioStrategyError.add(itemRadioError);
195 1 1. setEngine : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
                this.groupStrategy.add(itemRadioError);
196
                int indexErrorFinal = indexError;
197 1 1. setEngine : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
                itemRadioError.addActionListener(actionEvent -> {
198 1 1. lambda$setEngine$5 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(methodError.getName());
199 1 1. lambda$setEngine$5 : removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().setStrategy(MediatorHelper.model().getMediatorStrategy().getError());
200 1 1. lambda$setEngine$5 : removed call to com/jsql/model/injection/strategy/StrategyError::setIndexErrorStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().getError().setIndexErrorStrategy(indexErrorFinal);
201
                });
202 1 1. setEngine : Changed increment from 1 to -1 → NO_COVERAGE
                indexError++;
203
            }
204
        }
205
    }
206
    
207
    public void activateStrategy(AbstractStrategy strategy) {
208 1 1. activateStrategy : negated conditional → NO_COVERAGE
        if (strategy instanceof StrategyError strategyError) {
209 1 1. activateStrategy : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelStrategy.setText(strategyError.toString());
210
            int indexError = strategyError.getIndexErrorStrategy();
211
            String nameError = MediatorHelper.model().getMediatorEngine().getEngine().instance().getModelYaml().getStrategy().getError().getMethod().get(
212
                indexError
213
            ).getName();
214
215
            Arrays.stream(this.getMenuError().getMenuComponents())
216
                .map(JRadioButtonMenuItem.class::cast)
217 2 1. lambda$activateStrategy$6 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE
2. lambda$activateStrategy$6 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE
                .filter(component -> component.getText().equals(nameError))
218 1 1. activateStrategy : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jRadioButtonMenuItem -> {
219 1 1. lambda$activateStrategy$7 : removed call to javax/swing/JRadioButtonMenuItem::setSelected → NO_COVERAGE
                    jRadioButtonMenuItem.setSelected(true);
220 1 1. lambda$activateStrategy$7 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(nameError);
221
                });
222
        } else {
223 1 1. activateStrategy : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelStrategy.setText(strategy.toString());
224
            Arrays.stream(this.popupMenuStrategies.getComponents())
225
                .map(JMenuItem.class::cast)
226 2 1. lambda$activateStrategy$8 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE
2. lambda$activateStrategy$8 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
227 2 1. lambda$activateStrategy$9 : removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE
2. activateStrategy : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jMenuItem -> jMenuItem.setSelected(true));
228
        }
229
    }
230
231
    public void markInvulnerable(AbstractStrategy strategy) {
232
        Arrays.stream(this.popupMenuStrategies.getComponents())
233
            .map(JMenuItem.class::cast)
234 2 1. lambda$markInvulnerable$10 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE
2. lambda$markInvulnerable$10 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
235 2 1. markInvulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$markInvulnerable$11 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.setEnabled(false));
236
    }
237
    
238
    public void markInvulnerable(int indexMethodError, AbstractStrategy strategy) {
239
        Arrays.stream(this.popupMenuStrategies.getSubElements())
240
            .map(JMenuItem.class::cast)
241 2 1. lambda$markInvulnerable$12 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE
2. lambda$markInvulnerable$12 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
242
            .map(JMenu.class::cast)
243
            .filter(jMenuItem -> {
244
                var isNotNull = true;
245
                // Fix #36975: ArrayIndexOutOfBoundsException on getItem()
246
                // Fix #40352: NullPointerException on ?
247
                // Fix #95855: NPE on setEnabled()
248
                try {
249 1 1. lambda$markInvulnerable$13 : negated conditional → NO_COVERAGE
                    isNotNull = jMenuItem.getItem(indexMethodError) != null;
250
                } catch (ArrayIndexOutOfBoundsException e) {
251
                    LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
252 1 1. lambda$markInvulnerable$13 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
                    return false;
253
                }
254 2 1. lambda$markInvulnerable$13 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
2. lambda$markInvulnerable$13 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
                return isNotNull;
255
            })
256 2 1. lambda$markInvulnerable$14 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
2. markInvulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.getItem(indexMethodError).setEnabled(false));
257
    }
258
259
    private JMenu getMenuError() {
260
        var nameError = MediatorHelper.model().getMediatorStrategy().getError().getName();
261 1 1. getMenuError : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getMenuError → NO_COVERAGE
        return (JMenu) Arrays.stream(this.popupMenuStrategies.getComponents())
262
            .map(JMenuItem.class::cast)
263 2 1. lambda$getMenuError$15 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE
2. lambda$getMenuError$15 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equalsIgnoreCase(nameError))
264
            .findFirst()
265
            .orElse(new JMenuItem("Mock"));
266
    }
267
268
    public void markVulnerable(AbstractStrategy strategy) {
269
        Arrays.stream(this.popupMenuStrategies.getComponents())
270
            .map(JMenuItem.class::cast)
271 2 1. lambda$markVulnerable$16 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE
2. lambda$markVulnerable$16 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
272 2 1. lambda$markVulnerable$17 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
2. markVulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.setEnabled(true));
273
    }
274
275
    public void markVulnerable(int indexMethodError, AbstractStrategy strategy) {
276
        // Fix #46578: ArrayIndexOutOfBoundsException on getItem()
277
        try {
278
            Arrays.stream(this.popupMenuStrategies.getComponents())
279
                .map(JMenuItem.class::cast)
280 2 1. lambda$markVulnerable$18 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE
2. lambda$markVulnerable$18 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
281
                .map(JMenu.class::cast)
282 2 1. lambda$markVulnerable$19 : negated conditional → NO_COVERAGE
2. lambda$markVulnerable$19 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$19 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getItem(indexMethodError) != null)
283 1 1. markVulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jMenuItem -> {
284 1 1. lambda$markVulnerable$20 : removed call to javax/swing/JMenu::setEnabled → NO_COVERAGE
                    jMenuItem.setEnabled(true);
285 1 1. lambda$markVulnerable$20 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
                    jMenuItem.getItem(indexMethodError).setEnabled(true);
286
                });
287
        } catch (ArrayIndexOutOfBoundsException e) {
288
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
289
        }
290
    }
291
    
292
    
293
    // Getter and setter
294
295
    public JComponent getLoader() {
296 1 1. getLoader : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getLoader → NO_COVERAGE
        return this.loader;
297
    }
298
299
    public ButtonStart getButtonStart() {
300 1 1. getButtonStart : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getButtonStart → NO_COVERAGE
        return this.buttonStart;
301
    }
302
}

Mutations

57

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

58

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

59

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

60

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

61

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

66

1.1
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

69

1.1
Location : <init>
Killed by : none
removed call to java/awt/Component::setName → NO_COVERAGE

77

1.1
Location : createToolTip
Killed by : none
removed call to java/util/concurrent/atomic/AtomicReference::set → NO_COVERAGE

82

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

85

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

89

1.1
Location : <init>
Killed by : none
removed call to java/awt/Component::setName → NO_COVERAGE

90

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

91

1.1
Location : lambda$new$0
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

92

1.1
Location : lambda$new$0
Killed by : none
removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE

94

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

98

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

101

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

104

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

105

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

106

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

109

1.1
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

110

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

111

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

112

1.1
Location : lambda$new$1
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

113

1.1
Location : lambda$new$1
Killed by : none
removed call to com/jsql/model/injection/engine/MediatorEngine::setEngineByUser → NO_COVERAGE

116

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

121

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

122

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

125

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

130

1.1
Location : mousePressed
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

131

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE

132

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE

133

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::show → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

134

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE

138

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

141

1.1
Location : lambda$mousePressed$0
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress$3::lambda$mousePressed$0 → NO_COVERAGE

2.2
Location : mousePressed
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

142

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

2.2
Location : mousePressed
Killed by : none
changed conditional boundary → NO_COVERAGE

143

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JMenuItem::updateUI → NO_COVERAGE

145

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE

146

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE

147

1.1
Location : lambda$mousePressed$1
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$1
Killed by : none
removed call to javax/swing/JPopupMenu::show → NO_COVERAGE

3.3
Location : lambda$mousePressed$1
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

148

1.1
Location : lambda$mousePressed$1
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$1
Killed by : none
removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE

3.3
Location : lambda$mousePressed$1
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

156

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

157

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

161

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/panel/address/ButtonStart::setToolTipText → NO_COVERAGE

162

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionReady → NO_COVERAGE

163

1.1
Location : endPreparation
Killed by : none
removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE

167

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

168

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

169

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

172

1.1
Location : reset
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$reset$2
Killed by : none
removed call to java/awt/Component::setEnabled → NO_COVERAGE

173

1.1
Location : reset
Killed by : none
removed call to javax/swing/JMenu::removeAll → NO_COVERAGE

175

1.1
Location : reset
Killed by : none
removed call to javax/swing/ButtonGroup::clearSelection → NO_COVERAGE

176

1.1
Location : lambda$reset$3
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$3 → NO_COVERAGE

178

1.1
Location : lambda$reset$4
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE

2.2
Location : lambda$reset$4
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE

179

1.1
Location : reset
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

183

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

184

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenu::removeAll → NO_COVERAGE

187

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

188

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

192

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

193

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

195

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

197

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

198

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

199

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE

200

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to com/jsql/model/injection/strategy/StrategyError::setIndexErrorStrategy → NO_COVERAGE

202

1.1
Location : setEngine
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

208

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

209

1.1
Location : activateStrategy
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

217

1.1
Location : lambda$activateStrategy$6
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE

2.2
Location : lambda$activateStrategy$6
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE

218

1.1
Location : activateStrategy
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

219

1.1
Location : lambda$activateStrategy$7
Killed by : none
removed call to javax/swing/JRadioButtonMenuItem::setSelected → NO_COVERAGE

220

1.1
Location : lambda$activateStrategy$7
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

223

1.1
Location : activateStrategy
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

226

1.1
Location : lambda$activateStrategy$8
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE

2.2
Location : lambda$activateStrategy$8
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE

227

1.1
Location : lambda$activateStrategy$9
Killed by : none
removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE

2.2
Location : activateStrategy
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

234

1.1
Location : lambda$markInvulnerable$10
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$10
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE

235

1.1
Location : markInvulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$11
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

241

1.1
Location : lambda$markInvulnerable$12
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$12
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE

249

1.1
Location : lambda$markInvulnerable$13
Killed by : none
negated conditional → NO_COVERAGE

252

1.1
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

254

1.1
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

256

1.1
Location : lambda$markInvulnerable$14
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

2.2
Location : markInvulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

261

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

263

1.1
Location : lambda$getMenuError$15
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE

2.2
Location : lambda$getMenuError$15
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE

271

1.1
Location : lambda$markVulnerable$16
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE

2.2
Location : lambda$markVulnerable$16
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE

272

1.1
Location : lambda$markVulnerable$17
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

2.2
Location : markVulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

280

1.1
Location : lambda$markVulnerable$18
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE

2.2
Location : lambda$markVulnerable$18
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE

282

1.1
Location : lambda$markVulnerable$19
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$markVulnerable$19
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$19 → NO_COVERAGE

283

1.1
Location : markVulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

284

1.1
Location : lambda$markVulnerable$20
Killed by : none
removed call to javax/swing/JMenu::setEnabled → NO_COVERAGE

285

1.1
Location : lambda$markVulnerable$20
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

296

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

300

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

Active mutators

Tests examined


Report generated by PIT 1.22.1