Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/scitequest/martin/view/ExportGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,34 @@
public final class ExportGui extends JDialog {

/** The logger for this class. */
private static final Logger log = Logger.getLogger("com.scitequest.martin.view.ExportGui");

Check warning on line 59 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck

Name 'log' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.

private final Controlable control;

Check notice on line 61 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final Settings settings;

Check notice on line 62 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.

private final ZonedDateTime datetime;

Check notice on line 64 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final Parameters parameters;

Check notice on line 65 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final Data data;

Check notice on line 66 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final DataStatistics dataStatistics;

Check notice on line 67 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.

private final JComboBox<String> projectDropdown;

Check notice on line 69 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.

private final JTextField sampleId = new JTextField();

Check notice on line 71 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final JTextField name = new JTextField();

Check notice on line 72 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final TimestampInput timestampInput;

Check notice on line 73 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final TagSelection sampleTags = TagSelection.empty();

Check notice on line 74 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final IncubationInput incubationInput = new IncubationInput();

Check notice on line 75 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final JTextField imager = new JTextField();

Check notice on line 76 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final SpinnerNumberModel exposureTime;

Check notice on line 77 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.
private final SpinnerNumberModel pixelBinning;

Check notice on line 78 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck

Missing a Javadoc comment.

public ExportGui(Frame owner, Controlable control, Settings settings,

Check notice on line 80 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.

Check notice on line 80 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.MethodLengthCheck

Method ExportGui length is 388 lines (max allowed is 150).

Check notice on line 80 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck

More than 7 parameters (found 8).
ZonedDateTime datetime, Optional<LocalDateTime> assayDatetime,
Parameters parameters,
Data data, DataStatistics dataStatistics) {
super(owner, "Enter Export Metadata", false);

this.control = control;

Check warning on line 86 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

EI_EXPOSE_REP2

new com.scitequest.martin.view.ExportGui(Frame, Controlable, Settings, ZonedDateTime, Optional, Parameters, Data, DataStatistics) may expose internal representation by storing an externally mutable object into ExportGui.control
Raw output
This code stores a reference to an externally mutable object into the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.
this.settings = settings;
this.datetime = datetime;
this.parameters = parameters;
Expand Down Expand Up @@ -129,7 +129,7 @@
// ---- projectDropdown ----
projectDropdown = new JComboBox<>();
updateProjectDropdownList();
projectDropdown.setSelectedIndex(settings.getProjectSettings().getLastUsedProjectIndex() + 1);

Check notice on line 132 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 102).
projectDropdown.addActionListener(e -> loadProject(projectDropdown.getSelectedIndex()));

// ---- projectManagerButton ----
Expand All @@ -141,9 +141,9 @@
projectManagerButton.addActionListener(e -> openProjectManager());

JPanel projectPanel = new JPanel();
projectPanel.setBorder(new EmptyBorder(5, 200, 5, 200));

Check warning on line 144 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 144 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'200' is a magic number.

Check warning on line 144 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 144 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'200' is a magic number.
projectPanel.setBackground(UIManager.getColor("MenuBar.background"));
projectPanel.setLayout(new GridLayout(1, 0, 5, 0));

Check warning on line 146 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
projectPanel.add(projectDropdown);
projectPanel.add(projectManagerButton);

Expand All @@ -151,17 +151,17 @@

// ======== mainMetadata ========
JPanel mainMetadata = new JPanel();
mainMetadata.setBorder(new EmptyBorder(5, 5, 5, 5));

Check warning on line 154 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 154 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 154 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 154 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
mainMetadata.setLayout(new GridBagLayout());
((GridBagLayout) mainMetadata.getLayout()).columnWidths = new int[] {
205, 200, 0 };

Check warning on line 157 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'205' is a magic number.

Check warning on line 157 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'200' is a magic number.
((GridBagLayout) mainMetadata.getLayout()).rowHeights = new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0 };

Check warning on line 159 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'95' is a magic number.
((GridBagLayout) mainMetadata.getLayout()).columnWeights = new double[] {
1.0, 1.0, 1.0E-4 };

Check warning on line 161 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.
((GridBagLayout) mainMetadata.getLayout()).rowWeights = new double[] {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };

Check warning on line 164 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.

// ---- sampleHeader ----
JLabel sampleHeader = new JLabel();
Expand All @@ -169,7 +169,7 @@
sampleHeader.putClientProperty("FlatLaf.styleClass", "h2");
mainMetadata.add(sampleHeader, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));

Check warning on line 172 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.

// ---- sampleIdLabel ----
JLabel sampleIdLabel = new JLabel();
Expand All @@ -178,14 +178,14 @@
sampleIdLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(sampleIdLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 5), 0, 0));

Check warning on line 181 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 181 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- sampleId ----
sampleId.putClientProperty("JTextField.showClearButton", true);
sampleId.putClientProperty("JTextField.placeholderText", "CS001");
mainMetadata.add(sampleId, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 5), 0, 0));

Check warning on line 188 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 188 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- sampleIdDescription ----
JTextArea sampleIdDescription = new JTextArea(2, 1);
Expand All @@ -195,9 +195,9 @@
sampleIdDescription.setEditable(false);
sampleIdDescription.setEnabled(false);
sampleIdDescription.setOpaque(false);
mainMetadata.add(sampleIdDescription, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,

Check warning on line 198 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'3' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 5, 0), 0, 0));

Check warning on line 200 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.

Check warning on line 200 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- nameLabel ----
JLabel nameLabel = new JLabel();
Expand All @@ -205,14 +205,14 @@
nameLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(nameLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 208 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- name ----
name.putClientProperty("JTextField.placeholderText", "control sample 1");
name.putClientProperty("JTextField.showClearButton", true);
mainMetadata.add(name, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 215 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- nameDescription ----
JTextArea nameDescription = new JTextArea(2, 1);
Expand All @@ -222,23 +222,23 @@
nameDescription.setEditable(false);
nameDescription.setEnabled(false);
nameDescription.setOpaque(false);
mainMetadata.add(nameDescription, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,

Check warning on line 225 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'3' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 5, 0), 0, 0));

Check warning on line 227 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.

Check warning on line 227 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- assayDateLabel ----
JLabel assayDateTimeLabel = new JLabel();
assayDateTimeLabel.setText(Const.bundle.getString("exportGui.assayDateTimeLabel.text"));
assayDateTimeLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(assayDateTimeLabel, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0,

Check warning on line 233 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'4' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 235 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- assayTimestampInput
timestampInput = TimestampInput.of(assayDatetime);
mainMetadata.add(timestampInput, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0,

Check warning on line 239 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 241 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- assayDateTimeDescription ----
JTextArea assayDateDescription = new JTextArea();
Expand All @@ -249,46 +249,46 @@
assayDateDescription.setEditable(false);
assayDateDescription.setEnabled(false);
assayDateDescription.setOpaque(false);
mainMetadata.add(assayDateDescription, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0,

Check warning on line 252 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'6' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 5, 0), 0, 0));

Check warning on line 254 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.

Check warning on line 254 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- tagsLabel ----
JLabel tagsLabel = new JLabel();
tagsLabel.setText(Const.bundle.getString("exportGui.tagsLabel.text"));
tagsLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(tagsLabel, new GridBagConstraints(0, 7, 2, 1, 0.0, 0.0,

Check warning on line 260 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'7' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 262 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- tag selection ----
mainMetadata.add(sampleTags, new GridBagConstraints(0, 8, 2, 1, 0.0, 0.0,

Check warning on line 265 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'8' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 267 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- imageHeader ----
JLabel imageHeader = new JLabel();
imageHeader.setText(Const.bundle.getString("exportGui.imageHeader.text"));
imageHeader.putClientProperty("FlatLaf.styleClass", "h2");
mainMetadata.add(imageHeader, new GridBagConstraints(0, 9, 2, 1, 0.0, 0.0,

Check warning on line 273 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'9' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(10, 0, 10, 0), 0, 0));

Check warning on line 275 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.

Check warning on line 275 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.

// ---- imagerLabel ----
JLabel imagerLabel = new JLabel();
imagerLabel.setText(Const.bundle.getString("exportGui.imagerLabel.text"));
imagerLabel.setLabelFor(imager);
imagerLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(imagerLabel, new GridBagConstraints(0, 10, 2, 1, 0.0, 0.0,

Check warning on line 282 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 284 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- imager ----
imager.putClientProperty("JTextField.placeholderText", "Azure 300");
imager.putClientProperty("JTextField.placeholderText", "Imager");
imager.putClientProperty("JTextField.showClearButton", true);
mainMetadata.add(imager, new GridBagConstraints(0, 11, 2, 1, 0.0, 0.0,

Check warning on line 289 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'11' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 291 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- imagerDescription ----
JTextArea imagerDescription = new JTextArea();
Expand All @@ -298,30 +298,30 @@
imagerDescription.setEditable(false);
imagerDescription.setEnabled(false);
imagerDescription.setOpaque(false);
mainMetadata.add(imagerDescription, new GridBagConstraints(0, 12, 2, 1, 0.0, 0.0,

Check warning on line 301 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'12' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 5, 0), 0, 0));

Check warning on line 303 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.

Check warning on line 303 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- exposureTimeLabel ----
JLabel exposureTimeLabel = new JLabel();
exposureTimeLabel.setText(Const.bundle.getString("exportGui.exposureTimeLabel.text"));
exposureTimeLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(exposureTimeLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0,

Check warning on line 309 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'13' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 5), 0, 0));

Check warning on line 311 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 311 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- exposureTime ---
exposureTime = new SpinnerNumberModel(15, 0, Integer.MAX_VALUE, 10);

Check warning on line 314 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'15' is a magic number.

Check warning on line 314 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.
JSpinner exposureTimeSpinner = new JSpinner(exposureTime);
((JSpinner.DefaultEditor) exposureTimeSpinner.getEditor())
.getTextField()
.setColumns(2);
mainMetadata.add(exposureTimeSpinner, new GridBagConstraints(0, 14, 1, 1, 0.0, 0.0,

Check warning on line 319 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'14' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 5), 0, 0));

Check warning on line 321 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 321 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- exposureTimeDescription ----
JTextArea exposureTimeDescription = new JTextArea(3, 1);

Check warning on line 324 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'3' is a magic number.
exposureTimeDescription.setText(
Const.bundle.getString("exportGui.exposureTimeDescription.text"));
exposureTimeDescription.setLineWrap(true);
Expand All @@ -329,17 +329,17 @@
exposureTimeDescription.setEditable(false);
exposureTimeDescription.setEnabled(false);
exposureTimeDescription.setOpaque(false);
mainMetadata.add(exposureTimeDescription, new GridBagConstraints(0, 15, 1, 1, 0.0, 0.0,

Check warning on line 332 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'15' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 5, 0), 0, 0));

Check warning on line 334 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.

Check warning on line 334 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- pixelBinningLabel ----
JLabel pixelBinningLabel = new JLabel();
pixelBinningLabel.setText(Const.bundle.getString("exportGui.pixelBinningLabel.text"));
pixelBinningLabel.putClientProperty("FlatLaf.styleClass", "h4");
mainMetadata.add(pixelBinningLabel, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0,

Check warning on line 340 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'13' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 342 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- pixelBinning
pixelBinning = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
Expand All @@ -347,12 +347,12 @@
((JSpinner.DefaultEditor) pixelBinningSpinner.getEditor())
.getTextField()
.setColumns(2);
mainMetadata.add(pixelBinningSpinner, new GridBagConstraints(1, 14, 1, 1, 0.0, 0.0,

Check warning on line 350 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'14' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0));

Check warning on line 352 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- pixelBinningDescription ----
JTextArea pixelBinningDescription = new JTextArea(3, 1);

Check warning on line 355 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'3' is a magic number.
pixelBinningDescription.setText(
Const.bundle.getString("exportGui.pixelBinningDescription.text"));
pixelBinningDescription.setLineWrap(true);
Expand All @@ -360,20 +360,20 @@
pixelBinningDescription.setEditable(false);
pixelBinningDescription.setEnabled(false);
pixelBinningDescription.setOpaque(false);
mainMetadata.add(pixelBinningDescription, new GridBagConstraints(1, 15, 1, 1, 0.0, 0.0,

Check warning on line 363 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'15' is a magic number.
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, -5, 0, 0), 0, 0));

Check warning on line 365 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'-5' is a magic number.
add(mainMetadata, BorderLayout.CENTER);

// ======== incubations ========
JPanel incubationPanel = new JPanel();
incubationPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

Check warning on line 370 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 370 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 370 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 370 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
incubationPanel.setLayout(new GridBagLayout());
((GridBagLayout) incubationPanel.getLayout()).columnWidths = new int[] { 0, 0 };
((GridBagLayout) incubationPanel.getLayout()).rowHeights = new int[] { 0, 0, 0 };
((GridBagLayout) incubationPanel.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 };

Check warning on line 374 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.
((GridBagLayout) incubationPanel.getLayout()).rowWeights = new double[] {
0.0, 1.0, 1.0E-4 };

Check warning on line 376 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.

// ---- incubationsHeader ----
JLabel incubationsHeader = new JLabel();
Expand All @@ -381,7 +381,7 @@
incubationsHeader.putClientProperty("FlatLaf.styleClass", "h2");
incubationPanel.add(incubationsHeader, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));

Check warning on line 384 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.

// ---- incubationInput
incubationPanel.add(incubationInput, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
Expand All @@ -395,9 +395,9 @@
actionPanel.setLayout(new GridBagLayout());
((GridBagLayout) actionPanel.getLayout()).columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 };
((GridBagLayout) actionPanel.getLayout()).rowHeights = new int[] { 0, 0 };
((GridBagLayout) actionPanel.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0,

Check notice on line 398 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 110).
1.0E-4 };

Check warning on line 399 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.
((GridBagLayout) actionPanel.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 };

Check warning on line 400 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'1.0E-4' is a magic number.

// ---- showResultTableButton ----
JButton showResultTableButton = new JButton();
Expand All @@ -406,7 +406,7 @@
showResultTableButton.addActionListener(e -> handleShowResultTable());
actionPanel.add(showResultTableButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 5, 5, 0), 0, 0));

Check warning on line 409 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 409 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 409 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- showAnalysisTableButton ----
JButton showAnalysisTableButton = new JButton();
Expand All @@ -415,7 +415,7 @@
showAnalysisTableButton.addActionListener(e -> handleShowAnalysisTable());
actionPanel.add(showAnalysisTableButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 5, 5, 0), 0, 0));

Check warning on line 418 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 418 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 418 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- showGriddedImageButton ----
JButton showGriddedImageButton = new JButton();
Expand All @@ -424,7 +424,7 @@
showGriddedImageButton.addActionListener(e -> handleShowGriddedImage());
actionPanel.add(showGriddedImageButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 5, 5, 5), 0, 0));

Check warning on line 427 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 427 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 427 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 427 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- exportButton ----
JButton exportButton = new JButton();
Expand All @@ -433,9 +433,9 @@
exportButton.setBackground(UIManager.getColor("Actions.Green"));
exportButton.setForeground(SystemColor.text);
exportButton.addActionListener(e -> handleExportButtonPressed());
actionPanel.add(exportButton, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0,

Check warning on line 436 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'4' is a magic number.
GridBagConstraints.EAST, GridBagConstraints.VERTICAL,
new Insets(5, 5, 5, 0), 0, 0));

Check warning on line 438 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 438 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 438 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

// ---- cancelButton ----
JButton cancelButton = new JButton();
Expand All @@ -444,13 +444,13 @@
cancelButton.setBackground(UIManager.getColor("Actions.Red"));
cancelButton.setForeground(SystemColor.text);
cancelButton.addActionListener(e -> closeExportGui());
actionPanel.add(cancelButton, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0,

Check warning on line 447 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
GridBagConstraints.EAST, GridBagConstraints.VERTICAL,
new Insets(5, 5, 5, 5), 0, 0));

Check warning on line 449 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 449 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 449 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.

Check warning on line 449 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'5' is a magic number.
add(actionPanel, BorderLayout.SOUTH);

// Load a dummy incubation for the layouting.
Quantity dummyQty = Quantity.of(100., Unit.PERCENT);

Check warning on line 453 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'100.' is a magic number.
incubationInput.setIncubations(List.of(
Incubation.of("solution", dummyQty, dummyQty, Duration.ZERO)));

Expand Down Expand Up @@ -482,7 +482,7 @@
private void openProjectManager() {
ProjectGui.open(this, control, settings);
updateProjectDropdownList();
projectDropdown.setSelectedIndex(settings.getProjectSettings().getLastUsedProjectIndex() + 1);

Check notice on line 485 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 102).
// Maybe unneccessary if actionListener behaves like changeListener
loadProject(projectDropdown.getSelectedIndex());
}
Expand All @@ -502,7 +502,7 @@
Patient patient = Patient.of(this.sampleId.getText(), this.name.getText(),
this.sampleTags.getSelectedTags());
// Get the image metadata
Duration exposureTime = Duration.ofSeconds(this.exposureTime.getNumber().intValue());

Check warning on line 505 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck

'exposureTime' hides a field.
int pixBinning = this.pixelBinning.getNumber().intValue();
ZonedDateTime created = timestampInput.getDateTime();
Image image = Image.of(created, this.imager.getText(), pixBinning, exposureTime);
Expand Down Expand Up @@ -566,14 +566,14 @@
table.setVisible(true);
}

public void loadProject(int projectIndex) {

Check notice on line 569 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
ProjectSettings projectSettings = settings.getProjectSettings();
if (projectIndex == 0) {
sampleTags.clearTags();
incubationInput.emptyIncubationInput();
imager.setText(null);
pixelBinning.setValue(1);
exposureTime.setValue(10);

Check warning on line 576 in src/main/java/com/scitequest/martin/view/ExportGui.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck

'10' is a magic number.
projectSettings.setLastUsedProjectIndex(-1);
} else {
int settingsProjIdx = projectIndex - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/scitequest/martin/view/ProjectGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
new Insets(0, 0, 5, 0), 0, 0));

// ---- imager ----
imager.putClientProperty("JTextField.placeholderText", "Azure 300");
imager.putClientProperty("JTextField.placeholderText", "Imager");
imager.putClientProperty("JTextField.showClearButton", true);
mainMetadata.add(imager, new GridBagConstraints(0, 9, 2, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
Expand Down Expand Up @@ -489,16 +489,16 @@
private Optional<ProjectExt> validateInputs() {
ProjectExt proj;
try {
proj = getProjectFromInputsUnchecked();
} catch (IllegalArgumentException e) {
JOptionPane.showMessageDialog(this,
Const.bundle.getString("messageDialog.invalidInput.text") + " "
+ e.getMessage(),
Const.bundle.getString("messageDialog.invalidInput.title"),
JOptionPane.ERROR_MESSAGE);
return Optional.empty();
}
return Optional.of(proj);

Check warning on line 501 in src/main/java/com/scitequest/martin/view/ProjectGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

UPM_UNCALLED_PRIVATE_METHOD

Private method com.scitequest.martin.view.ProjectGui.validateInputs() is never called
Raw output
This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed.
}

/**
Expand Down Expand Up @@ -603,7 +603,7 @@

@Override
public void handleExport(int index, Path path) {
log.finer(String.format("Exporting project with index %d as path %s", index, path));

Check warning on line 606 in src/main/java/com/scitequest/martin/view/ProjectGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

CRLF_INJECTION_LOGS

This use of java/util/logging/Logger.finer(Ljava/lang/String;)V might be used to include CRLF characters into log messages
Raw output
When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Inserted false entries could be used to skew statistics, distract the administrator or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may also inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility (e.g. command injection or XSS).


Code at risk:


String val = request.getParameter("user");
String metadata = request.getParameter("metadata");
[...]
if(authenticated) {
    log.info("User " + val + " (" + metadata + ") was authenticated successfully");
}
else {
    log.info("User " + val + " (" + metadata + ") was not authenticated");
}


A malicious user could send the metadata parameter with the value: "Firefox) was authenticated successfully\r\n[INFO] User bbb (Internet Explorer".



Solution:


You can manually sanitize each parameter.


log.info("User " + val.replaceAll("[\r\n]","") + " (" + userAgent.replaceAll("[\r\n]","") + ") was not authenticated");




You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack using the replace function [https://logback.qos.ch/manual/layouts.html#replace].


<pattern>%-5level - %replace(%msg){'[\r\n]', ''}%n</pattern>




Finally, you can use a logger implementation that replace new line by spaces. The project OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging] has an implementation for Logback and Log4j.


References
CWE-117: Improper Output Neutralization for Logs [https://cwe.mitre.org/data/definitions/117.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://cwe.mitre.org/data/definitions/93.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://logback.qos.ch/manual/layouts.html#replace]
OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging]
Optional<ProjectExt> maybeProject = validateInputsInternal();

if (!maybeProject.isEmpty()) {
Expand All @@ -613,7 +613,7 @@

@Override
public void handleImport(Path path) {
log.finer(String.format("Importing a mask from path", path));

Check warning on line 616 in src/main/java/com/scitequest/martin/view/ProjectGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

CRLF_INJECTION_LOGS

This use of java/util/logging/Logger.finer(Ljava/lang/String;)V might be used to include CRLF characters into log messages
Raw output
When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Inserted false entries could be used to skew statistics, distract the administrator or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may also inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility (e.g. command injection or XSS).


Code at risk:


String val = request.getParameter("user");
String metadata = request.getParameter("metadata");
[...]
if(authenticated) {
    log.info("User " + val + " (" + metadata + ") was authenticated successfully");
}
else {
    log.info("User " + val + " (" + metadata + ") was not authenticated");
}


A malicious user could send the metadata parameter with the value: "Firefox) was authenticated successfully\r\n[INFO] User bbb (Internet Explorer".



Solution:


You can manually sanitize each parameter.


log.info("User " + val.replaceAll("[\r\n]","") + " (" + userAgent.replaceAll("[\r\n]","") + ") was not authenticated");




You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack using the replace function [https://logback.qos.ch/manual/layouts.html#replace].


<pattern>%-5level - %replace(%msg){'[\r\n]', ''}%n</pattern>




Finally, you can use a logger implementation that replace new line by spaces. The project OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging] has an implementation for Logback and Log4j.


References
CWE-117: Improper Output Neutralization for Logs [https://cwe.mitre.org/data/definitions/117.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://cwe.mitre.org/data/definitions/93.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://logback.qos.ch/manual/layouts.html#replace]
OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging]

try {
control.importProject(path);
Expand All @@ -625,7 +625,7 @@
return;
}

log.info(String.format("Project file '%s' has been imported", path));

Check warning on line 628 in src/main/java/com/scitequest/martin/view/ProjectGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

CRLF_INJECTION_LOGS

This use of java/util/logging/Logger.info(Ljava/lang/String;)V might be used to include CRLF characters into log messages
Raw output
When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Inserted false entries could be used to skew statistics, distract the administrator or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may also inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility (e.g. command injection or XSS).


Code at risk:


String val = request.getParameter("user");
String metadata = request.getParameter("metadata");
[...]
if(authenticated) {
    log.info("User " + val + " (" + metadata + ") was authenticated successfully");
}
else {
    log.info("User " + val + " (" + metadata + ") was not authenticated");
}


A malicious user could send the metadata parameter with the value: "Firefox) was authenticated successfully\r\n[INFO] User bbb (Internet Explorer".



Solution:


You can manually sanitize each parameter.


log.info("User " + val.replaceAll("[\r\n]","") + " (" + userAgent.replaceAll("[\r\n]","") + ") was not authenticated");




You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack using the replace function [https://logback.qos.ch/manual/layouts.html#replace].


<pattern>%-5level - %replace(%msg){'[\r\n]', ''}%n</pattern>




Finally, you can use a logger implementation that replace new line by spaces. The project OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging] has an implementation for Logback and Log4j.


References
CWE-117: Improper Output Neutralization for Logs [https://cwe.mitre.org/data/definitions/117.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://cwe.mitre.org/data/definitions/93.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://logback.qos.ch/manual/layouts.html#replace]
OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging]
}

@Override
Expand All @@ -642,7 +642,7 @@

@Override
public void addCopyOfElement(int index, String name) {
log.finer(String.format("Copying project with index %d and new name %s", index, name));

Check warning on line 645 in src/main/java/com/scitequest/martin/view/ProjectGui.java

View workflow job for this annotation

GitHub Actions / spotbugs

CRLF_INJECTION_LOGS

This use of java/util/logging/Logger.finer(Ljava/lang/String;)V might be used to include CRLF characters into log messages
Raw output
When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Inserted false entries could be used to skew statistics, distract the administrator or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may also inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility (e.g. command injection or XSS).


Code at risk:


String val = request.getParameter("user");
String metadata = request.getParameter("metadata");
[...]
if(authenticated) {
    log.info("User " + val + " (" + metadata + ") was authenticated successfully");
}
else {
    log.info("User " + val + " (" + metadata + ") was not authenticated");
}


A malicious user could send the metadata parameter with the value: "Firefox) was authenticated successfully\r\n[INFO] User bbb (Internet Explorer".



Solution:


You can manually sanitize each parameter.


log.info("User " + val.replaceAll("[\r\n]","") + " (" + userAgent.replaceAll("[\r\n]","") + ") was not authenticated");




You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack using the replace function [https://logback.qos.ch/manual/layouts.html#replace].


<pattern>%-5level - %replace(%msg){'[\r\n]', ''}%n</pattern>




Finally, you can use a logger implementation that replace new line by spaces. The project OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging] has an implementation for Logback and Log4j.


References
CWE-117: Improper Output Neutralization for Logs [https://cwe.mitre.org/data/definitions/117.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://cwe.mitre.org/data/definitions/93.html]
CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') [https://logback.qos.ch/manual/layouts.html#replace]
OWASP Security Logging [https://github.com/javabeanz/owasp-security-logging]
ProjectExt maskCopy = projectSettings.getProject(index).withName(name);
projectSettings.addProject(maskCopy);
}
Expand Down
Loading