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