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