diff --git a/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmConfigProducerDemo.java b/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmConfigProducerDemo.java index 8ba8c6b972..de036b890a 100644 --- a/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmConfigProducerDemo.java +++ b/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmConfigProducerDemo.java @@ -185,7 +185,7 @@ private void sendConfigHierarchy(final Producer> produc } // Place all keys (alarm tree paths) in the same partition - private static final Integer partition = Integer.valueOf(0); + private static final Integer partition = 0; private void sendItemConfig(final Producer> producer, final String topic, final AlarmTreeItem item) diff --git a/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmStateProducerDemo.java b/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmStateProducerDemo.java index daea2ffca4..f3aad1e594 100644 --- a/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmStateProducerDemo.java +++ b/app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmStateProducerDemo.java @@ -92,7 +92,7 @@ public void close() @SuppressWarnings("resource") Producer producer = new KafkaProducer<>(props, key_serializer, value_serializer); // Place all keys (alarm tree paths) in the same partition - Integer partition = Integer.valueOf(0); + Integer partition = 0; while (true) { diff --git a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeConfigView.java b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeConfigView.java index 45b99ff4e5..5d985e4ebb 100644 --- a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeConfigView.java +++ b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeConfigView.java @@ -189,7 +189,7 @@ private void startup() // expand tree item if is matches item name if (tree_config_view.getRoot() != null && itemName != null) { for (TreeItem treeItem : tree_config_view.getRoot().getChildren()) { - if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) { + if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) { expandAlarms(treeItem); break; } diff --git a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeView.java b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeView.java index 2d4bfa7184..dac36bff57 100644 --- a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeView.java +++ b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeView.java @@ -218,7 +218,7 @@ private void startup() // expand tree item if is matches item name if (tree_view.getRoot() != null && itemName != null) { for (TreeItem treeItem : tree_view.getRoot().getChildren()) { - if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) { + if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) { expandAlarms(treeItem); break; } diff --git a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java index 8c61f88fa2..0b4a98f9b3 100644 --- a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java +++ b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java @@ -153,7 +153,7 @@ public String getDisplayValue() private String formatVType(VType value ) { Alarm alarm = Alarm.alarmOf(value); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(FormatOptionHandler.format(value, FormatOption.DEFAULT, -1, true)); if (!alarm.getSeverity().equals(AlarmSeverity.NONE)) { diff --git a/app/databrowser-json/src/main/java/org/phoebus/archive/reader/json/internal/JsonVTypeReader.java b/app/databrowser-json/src/main/java/org/phoebus/archive/reader/json/internal/JsonVTypeReader.java index 499f947610..0b692b19b1 100644 --- a/app/databrowser-json/src/main/java/org/phoebus/archive/reader/json/internal/JsonVTypeReader.java +++ b/app/databrowser-json/src/main/java/org/phoebus/archive/reader/json/internal/JsonVTypeReader.java @@ -293,8 +293,7 @@ public static VType readValue( // Ensure that we have labels for all indices. int min_value = Integer.MAX_VALUE; int max_value = Integer.MIN_VALUE; - for (var i = 0; i < enum_value.size(); ++i) { - final var value = enum_value.get(i); + for (final Integer value : enum_value) { min_value = Math.min(min_value, value); max_value = Math.max(max_value, value); } diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/export/ExcelExportJob.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/export/ExcelExportJob.java index ec0c5e7e65..11a8c78f59 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/export/ExcelExportJob.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/export/ExcelExportJob.java @@ -313,8 +313,7 @@ private void exportTable(final JobMonitor monitor) throws Exception final VType line[] = iter.next(); cell = createTimeCell(row = sheet.createRow(row.getRowNum() + 1), time); - for (int i=0; i(name, displayNameTextField)); } else { - nameAndDisplayNames.add(new Pair(name, name)); + nameAndDisplayNames.add(new Pair<>(name, name)); } if (! formula) diff --git a/app/diag/src/main/java/org/phoebus/app/diag/ui/FormulaTreeCategoryNode.java b/app/diag/src/main/java/org/phoebus/app/diag/ui/FormulaTreeCategoryNode.java index df87ccec3c..fa8ea2d7eb 100644 --- a/app/diag/src/main/java/org/phoebus/app/diag/ui/FormulaTreeCategoryNode.java +++ b/app/diag/src/main/java/org/phoebus/app/diag/ui/FormulaTreeCategoryNode.java @@ -26,6 +26,6 @@ public FormulaTreeCategoryNode(FormulaFunction firstChild) { */ public void addChild(FormulaFunction child) { FormulaTreeByCategoryNode leafNode = new FormulaTreeByCategoryNode(child.getSignature(), child.getDescription()); - getChildren().add(new TreeItem(leafNode)); + getChildren().add(new TreeItem<>(leafNode)); } } diff --git a/app/display/adapters/src/main/java/org/csstudio/display/builder/util/DisplayBuilderAdapterFactory.java b/app/display/adapters/src/main/java/org/csstudio/display/builder/util/DisplayBuilderAdapterFactory.java index c0cb178614..7588885a4e 100644 --- a/app/display/adapters/src/main/java/org/csstudio/display/builder/util/DisplayBuilderAdapterFactory.java +++ b/app/display/adapters/src/main/java/org/csstudio/display/builder/util/DisplayBuilderAdapterFactory.java @@ -46,7 +46,7 @@ public Optional adapt(Object adaptableObject, Class adapterType) { EmailEntry emailEntry = new EmailEntry(); - StringBuffer title = new StringBuffer(); + StringBuilder title = new StringBuilder(); title.append("Display Screenshot for : " + selectionInfo.getName()); emailEntry.setSubject(title.toString()); emailEntry.setBody(getBody(selectionInfo)); @@ -81,7 +81,7 @@ else if (adapterType.isAssignableFrom(LogEntry.class)) private String getBody(SelectionInfo selectionInfo) { - StringBuffer body = new StringBuffer(); + StringBuilder body = new StringBuilder(); body.append("Display Screenshot for the resource :" + System.lineSeparator()); body.append(selectionInfo.toURI()); body.append(System.lineSeparator()); diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmAttribute.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmAttribute.java index b54f41b1f3..6b78b53378 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmAttribute.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmAttribute.java @@ -119,7 +119,7 @@ public boolean isExistInEDL(){ @Override public String toString() { - StringBuffer concatenatedValues = new StringBuffer(); + StringBuilder concatenatedValues = new StringBuilder(); Iterator iterator = values.iterator(); while (iterator.hasNext()) { diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColor.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColor.java index 6d08ef5b10..07a054fc39 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColor.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColor.java @@ -109,16 +109,16 @@ private void parseStaticColorListDefinition() throws EdmException { try { String[] color = getValue(2).split(" "); - red = Integer.valueOf(color[0]).intValue(); - green = Integer.valueOf(color[1]).intValue(); - blue = Integer.valueOf(color[2]).intValue(); + red = Integer.valueOf(color[0]); + green = Integer.valueOf(color[1]); + blue = Integer.valueOf(color[2]); if (getValueCount() == 4) { blinking = true; color = getValue(3).split(" "); - blinkRed = Integer.valueOf(color[0]).intValue(); - blinkGreen = Integer.valueOf(color[1]).intValue(); - blinkBlue = Integer.valueOf(color[2]).intValue(); + blinkRed = Integer.valueOf(color[0]); + blinkGreen = Integer.valueOf(color[1]); + blinkBlue = Integer.valueOf(color[2]); } else { blinking = false; @@ -172,9 +172,9 @@ private void parseRGBColor() throws EdmException { try { name = null; - red = Integer.valueOf(m.group(2)).intValue(); - green = Integer.valueOf(m.group(3)).intValue(); - blue = Integer.valueOf(m.group(4)).intValue(); + red = Integer.valueOf(m.group(2)); + green = Integer.valueOf(m.group(3)); + blue = Integer.valueOf(m.group(4)); blinking = false; log.config("Parsed RGB color."); diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColorsList.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColorsList.java index 118ba2c31c..16c044094f 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColorsList.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmColorsList.java @@ -9,7 +9,6 @@ import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.logging.Logger; @@ -89,9 +88,8 @@ private void populateMenuColorsMap(EdmEntity colorsData) throws EdmException { if (!nonMenuColors.isEmpty()) { log.fine("Color definitions exist that are not in menumap. Adding them at the end."); - Iterator iterator = nonMenuColors.iterator(); - while (iterator.hasNext()) { - menuColorsMap.put(menuInd, iterator.next()); + for (EdmColor nonMenuColor : nonMenuColors) { + menuColorsMap.put(menuInd, nonMenuColor); menuInd++; } } diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmFont.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmFont.java index a37343b2b7..61d0640c50 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmFont.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmFont.java @@ -95,7 +95,7 @@ public EdmFont(EdmAttribute genericAttribute, boolean required) throws EdmExcept } try { - size = Double.valueOf(sizeStr).doubleValue(); + size = Double.valueOf(sizeStr); } catch (Exception e) { throw new EdmException(EdmException.COLOR_FORMAT_ERROR, "Invalid RGB color format.", e); } diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmMultilineText.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmMultilineText.java index 8420d739c1..48ce4fca32 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmMultilineText.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/model/EdmMultilineText.java @@ -45,7 +45,7 @@ public EdmMultilineText(EdmAttribute genericAtrtibute, boolean required) throws } } - StringBuffer textBuffer = new StringBuffer(); + StringBuilder textBuffer = new StringBuilder(); for (int valueIndex = 0; valueIndex < getValueCount(); valueIndex++) { textBuffer.append(getValue(valueIndex)); diff --git a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/parser/EdmDisplayParser.java b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/parser/EdmDisplayParser.java index bef04ea1fa..100bba32cb 100644 --- a/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/parser/EdmDisplayParser.java +++ b/app/display/convert-edm/src/main/java/org/csstudio/opibuilder/converter/parser/EdmDisplayParser.java @@ -114,8 +114,8 @@ private void parseCompoundProperty(Matcher m, EdmAttribute a) throws EdmExceptio } boolean nestError = false; - for (int c = 0; c < reservedWords.length; c ++) { - if (line.contains(reservedWords[c])) { + for (String reservedWord : reservedWords) { + if (line.contains(reservedWord)) { nestError = true; break; } @@ -247,16 +247,16 @@ private int[] getClosingPosition(Vector begins, int level = 0; int end = 0; int endIndex = 0; - for (int x = 0; x < all.size(); x++) { - if (begins.contains(all.get(x))) + for (Integer integer : all) { + if (begins.contains(integer)) level = level + 1; - if (ends.contains(all.get(x))) { + if (ends.contains(integer)) { level = level - 1; endIndex = endIndex + 1; } if (level == 0) { - end = all.get(x); + end = integer; break; } } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/opibuilder/adl2boy/translator/AbstractADL2Model.java b/app/display/convert-medm/src/main/java/org/csstudio/opibuilder/adl2boy/translator/AbstractADL2Model.java index 2325991fcb..893c98167a 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/opibuilder/adl2boy/translator/AbstractADL2Model.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/opibuilder/adl2boy/translator/AbstractADL2Model.java @@ -422,29 +422,24 @@ public Macros makeMacros(String args) */ public String removeParentMacros(String args) { String[] argList = args.split(","); - StringBuffer strBuff = new StringBuffer(); - for (int ii = 0; ii < argList.length; ii++) { - String[] argParts = argList[ii].split("="); - if (argParts.length == 1) - { - if (! argParts[0].isEmpty()) - { // Pass X="" + StringBuilder strBuff = new StringBuilder(); + for (String s : argList) { + String[] argParts = s.split("="); + if (argParts.length == 1) { + if (!argParts[0].isEmpty()) { // Pass X="" if (strBuff.length() != 0) strBuff.append(", "); strBuff.append(argParts[0]).append("=\"\""); } // else: Empty - } - else if (argParts.length == 2) - { + } else if (argParts.length == 2) { if (!argParts[1].replaceAll(" ", "").equals( - "$(" + argParts[0].trim() + ")")) { + "$(" + argParts[0].trim() + ")")) { if (strBuff.length() != 0) strBuff.append(", "); - strBuff.append(argList[ii]); + strBuff.append(s); } - } - else + } else logger.log(Level.WARNING, "Erroneous macro setting in " + args); } String resArgs = strBuff.toString(); diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLBasicAttribute.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLBasicAttribute.java index b2759023bd..9c6b9d1f43 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLBasicAttribute.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLBasicAttribute.java @@ -149,8 +149,8 @@ public final String getFill() { @Override public Object[] getChildren(){ Object[] ret = new Object[4]; - ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr)); - ret[1] = new ADLResource(ADLResource.LINE_WIDTH, Integer.valueOf(_width)); + ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr); + ret[1] = new ADLResource(ADLResource.LINE_WIDTH, _width); ret[2] = new ADLResource(ADLResource.STYLE, _style); ret[3] = new ADLResource(ADLResource.FILL, _fill); diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLConnected.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLConnected.java index 060a2da7c6..56eef4c1ee 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLConnected.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLConnected.java @@ -67,8 +67,8 @@ protected final void parseWidgetPart(final ADLWidget adlWidget) @Override public Object[] getChildren() { Object[] ret = new Object[3]; - ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr)); - ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr)); + ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr); + ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr); ret[2] = new ADLResource(ADLResource.CHANNEL, _chan); return ret; } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLLimits.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLLimits.java index f8e449c0e7..c97d3a38d3 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLLimits.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLLimits.java @@ -35,11 +35,11 @@ public ADLLimits(){ public Object[] getChildren() { Object[] ret = new Object[6]; ret[0] = new ADLResource(ADLResource.LOPR_SRC, new String(loprSrc)); - ret[1] = new ADLResource(ADLResource.LOPR_DEFAULT, Float.valueOf(loprDefault)); + ret[1] = new ADLResource(ADLResource.LOPR_DEFAULT, loprDefault); ret[2] = new ADLResource(ADLResource.HOPR_SRC, new String(hoprSrc)); - ret[3] = new ADLResource(ADLResource.HOPR_DEFAULT, Float.valueOf(hoprDefault)); + ret[3] = new ADLResource(ADLResource.HOPR_DEFAULT, hoprDefault); ret[4] = new ADLResource(ADLResource.PREC_SRC, new String(precSrc)); - ret[5] = new ADLResource(ADLResource.PREC_DEFAULT, Float.valueOf(precDefault)); + ret[5] = new ADLResource(ADLResource.PREC_DEFAULT, (float) precDefault); return ret; } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLObject.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLObject.java index d7e90ea1eb..f855d0f05d 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLObject.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLObject.java @@ -215,10 +215,10 @@ public final int getHeight() { @Override public Object[] getChildren(){ Object[] ret = new Object[4]; - ret[0] = new ADLResource(ADLResource.X, Integer.valueOf(_x)); - ret[1] = new ADLResource(ADLResource.Y, Integer.valueOf(_y)); - ret[2] = new ADLResource(ADLResource.WIDTH, Integer.valueOf(_width)); - ret[3] = new ADLResource(ADLResource.HEIGHT, Integer.valueOf(_height)); + ret[0] = new ADLResource(ADLResource.X, _x); + ret[1] = new ADLResource(ADLResource.Y, _y); + ret[2] = new ADLResource(ADLResource.WIDTH, _width); + ret[3] = new ADLResource(ADLResource.HEIGHT, _height); return ret; } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPen.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPen.java index 546fd645c3..2a3009435e 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPen.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPen.java @@ -32,7 +32,7 @@ public Object[] getChildren() { else { ret = new Object[2]; } - ret[0] = new ADLResource(ADLResource.PEN_COLOR, Integer.valueOf(lineColor)); + ret[0] = new ADLResource(ADLResource.PEN_COLOR, lineColor); ret[1] = new ADLResource(ADLResource.CHANNEL, channel); if (_hasLimits){ ret[2] = new ADLResource(ADLResource.ADL_LIMITS, _adlLimit); diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotData.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotData.java index 5173569ceb..aac1bc6882 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotData.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotData.java @@ -39,8 +39,8 @@ public Object[] getChildren() { ArrayList ret = new ArrayList<>(); ret.add(new ADLResource(ADLResource.PLOT_AXIS_STYLE, axisStyle)); ret.add(new ADLResource(ADLResource.PLOT_RANGE_STYLE, rangeStyle)); - ret.add(new ADLResource(ADLResource.PLOT_RANGE_MIN, Float.valueOf(minRange))); - ret.add(new ADLResource(ADLResource.PLOT_RANGE_MAX, Float.valueOf(maxRange))); + ret.add(new ADLResource(ADLResource.PLOT_RANGE_MIN, minRange)); + ret.add(new ADLResource(ADLResource.PLOT_RANGE_MAX, maxRange)); return ret.toArray(); } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotTrace.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotTrace.java index e32806db4a..670d158e41 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotTrace.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotTrace.java @@ -29,7 +29,7 @@ public Object[] getChildren() { ArrayList ret = new ArrayList<>(); if (!xData.equals(""))ret.add(new ADLResource(ADLResource.PLOT_XDATA, xData)); if (!yData.equals(""))ret.add(new ADLResource(ADLResource.PLOT_YDATA, yData)); - ret.add(new ADLResource(ADLResource.PLOT_DATA_COLOR, Integer.valueOf(dataColor))); + ret.add(new ADLResource(ADLResource.PLOT_DATA_COLOR, dataColor)); return ret.toArray(); } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotcom.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotcom.java index 0ca74d9bf9..2ae81e1f94 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotcom.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgetParts/ADLPlotcom.java @@ -41,8 +41,8 @@ public ADLPlotcom(){ @Override public Object[] getChildren() { Object[] ret = new Object[5]; - ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr)); - ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr)); + ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr); + ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr); ret[2] = new ADLResource(ADLResource.CHANNEL, title); ret[3] = new ADLResource(ADLResource.PLOT_XLABEL, xLabel); ret[4] = new ADLResource(ADLResource.PLOT_YLABEL, yLabel); diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ADLDisplay.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ADLDisplay.java index 3d96411c90..59f536762d 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ADLDisplay.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ADLDisplay.java @@ -184,11 +184,11 @@ public boolean isForeColorDefined() { public Object[] getChildren() { ArrayList ret = new ArrayList<>(); if (_hasObject) ret.add( _adlObject); - if (_isBackColorDefined) ret.add(new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr)) ); - if (_isForeColorDefined) ret.add(new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_bclr)) ); - ret.add(new ADLResource(ADLResource.SNAP_TO_GRID, Boolean.valueOf(_snapToGrid)) ); - ret.add(new ADLResource(ADLResource.GRID_ON, Boolean.valueOf(_gridOn))); - ret.add(new ADLResource(ADLResource.GRID_SPACING, Integer.valueOf(_gridSpacing))); + if (_isBackColorDefined) ret.add(new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr) ); + if (_isForeColorDefined) ret.add(new ADLResource(ADLResource.FOREGROUND_COLOR, _bclr) ); + ret.add(new ADLResource(ADLResource.SNAP_TO_GRID, _snapToGrid) ); + ret.add(new ADLResource(ADLResource.GRID_ON, _gridOn)); + ret.add(new ADLResource(ADLResource.GRID_SPACING, _gridSpacing)); return ret.toArray(); } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/Arc.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/Arc.java index a5208f80b6..f9585d1291 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/Arc.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/Arc.java @@ -103,8 +103,8 @@ public Object[] getChildren() { if (_hasObject) ret.add( _adlObject); if (_hasBasicAttribute) ret.add( _adlBasicAttribute); if (_hasDynamicAttribute) ret.add( _adlDynamicAttribute); - ret.add(new ADLResource(ADLResource.ARC_BEGIN_ANGLE, Integer.valueOf(_begin))); - ret.add(new ADLResource(ADLResource.ARC_PATH_ANGLE, Integer.valueOf(_path))); + ret.add(new ADLResource(ADLResource.ARC_BEGIN_ANGLE, _begin)); + ret.add(new ADLResource(ADLResource.ARC_PATH_ANGLE, _path)); return ret.toArray(); } diff --git a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ByteMonitor.java b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ByteMonitor.java index 5d8b3f1e2e..077878bea8 100644 --- a/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ByteMonitor.java +++ b/app/display/convert-medm/src/main/java/org/csstudio/utility/adlparser/fileParser/widgets/ByteMonitor.java @@ -120,8 +120,8 @@ public Object[] getChildren() { if (_hasMonitor) ret.add( _adlMonitor); ret.add(new ADLResource(ADLResource.DIRECTION, direction)); ret.add(new ADLResource(ADLResource.COLOR_MODE, color_mode)); - ret.add(new ADLResource(ADLResource.BYTE_START_BIT, Integer.valueOf(startBit))); - ret.add(new ADLResource(ADLResource.BYTE_END_BIT, Integer.valueOf(endBit))); + ret.add(new ADLResource(ADLResource.BYTE_START_BIT, startBit)); + ret.add(new ADLResource(ADLResource.BYTE_END_BIT, endBit)); return ret.toArray(); } diff --git a/app/display/editor/src/main/java/org/csstudio/display/builder/editor/actions/ActionDescription.java b/app/display/editor/src/main/java/org/csstudio/display/builder/editor/actions/ActionDescription.java index 30416e01b4..35296da320 100644 --- a/app/display/editor/src/main/java/org/csstudio/display/builder/editor/actions/ActionDescription.java +++ b/app/display/editor/src/main/java/org/csstudio/display/builder/editor/actions/ActionDescription.java @@ -510,10 +510,10 @@ public void run(final DisplayEditor editor, final boolean selected) final List sortedWidgets = widgets.stream() .sorted(( w1, w2 ) -> { - final int w1x = w1.propX().getValue().intValue(); - final int w1w = w1.propWidth().getValue().intValue(); - final int w2x = w2.propX().getValue().intValue(); - final int w2w = w2.propWidth().getValue().intValue(); + final int w1x = w1.propX().getValue(); + final int w1w = w1.propWidth().getValue(); + final int w2x = w2.propX().getValue(); + final int w2w = w2.propWidth().getValue(); if ( w1x <= w2x && w1x + w1w <= w2x + w2w ) { // +------+ | +------+ @@ -624,10 +624,10 @@ public void run(final DisplayEditor editor, final boolean selected) final List sortedWidgets = widgets.stream() .sorted(( w1, w2 ) -> { - final int w1y = w1.propY().getValue().intValue(); - final int w1h = w1.propHeight().getValue().intValue(); - final int w2y = w2.propY().getValue().intValue(); - final int w2h = w2.propHeight().getValue().intValue(); + final int w1y = w1.propY().getValue(); + final int w1h = w1.propHeight().getValue(); + final int w2y = w2.propY().getValue(); + final int w2h = w2.propHeight().getValue(); if ( w1y <= w2y && w1y + w1h <= w2y + w2h ) { // +----+ | +----+ @@ -752,10 +752,10 @@ public void run(final DisplayEditor editor, final boolean selected) final List sortedWidgets = widgets.stream() .sorted(( w1, w2 ) -> { - final int w1x = w1.propX().getValue().intValue(); - final int w1w = w1.propWidth().getValue().intValue(); - final int w2x = w2.propX().getValue().intValue(); - final int w2w = w2.propWidth().getValue().intValue(); + final int w1x = w1.propX().getValue(); + final int w1w = w1.propWidth().getValue(); + final int w2x = w2.propX().getValue(); + final int w2w = w2.propWidth().getValue(); // Description see DIST_HORIZ above if ( w1x <= w2x && w1x + w1w <= w2x + w2w ) return -1; @@ -812,10 +812,10 @@ public void run(final DisplayEditor editor, final boolean selected) final List sortedWidgets = widgets.stream() .sorted(( w1, w2 ) -> { - final int w1y = w1.propY().getValue().intValue(); - final int w1h = w1.propHeight().getValue().intValue(); - final int w2y = w2.propY().getValue().intValue(); - final int w2h = w2.propHeight().getValue().intValue(); + final int w1y = w1.propY().getValue(); + final int w1h = w1.propHeight().getValue(); + final int w2y = w2.propY().getValue(); + final int w2h = w2.propHeight().getValue(); // Description see DIST_VERT above if ( w1y <= w2y && w1y + w1h <= w2y + w2h ) return -1; diff --git a/app/display/editor/src/main/java/org/csstudio/display/builder/editor/util/WidgetTransfer.java b/app/display/editor/src/main/java/org/csstudio/display/builder/editor/util/WidgetTransfer.java index e1f6d17d81..b21a660149 100644 --- a/app/display/editor/src/main/java/org/csstudio/display/builder/editor/util/WidgetTransfer.java +++ b/app/display/editor/src/main/java/org/csstudio/display/builder/editor/util/WidgetTransfer.java @@ -519,14 +519,14 @@ private static void installWidgetsFromFiles ( installSymbolWidgetFromImageFiles(fileNames, selection_tracker, widgets, updates); } else { - for ( int i = 0; i < files.size(); i++ ) { + for (File file : files) { - final String fileName = resolveFile(files.get(i), selection_tracker.getModel()); + final String fileName = resolveFile(file, selection_tracker.getModel()); final String extension = getExtension(fileName).toUpperCase(); - if ( IMAGE_FILE_EXTENSIONS.contains(extension) ) { + if (IMAGE_FILE_EXTENSIONS.contains(extension)) { installPictureWidgetFromFile(fileName, selection_tracker, widgets, updates); - } else if ( EMBEDDED_FILE_EXTENSIONS.contains(extension) ) { + } else if (EMBEDDED_FILE_EXTENSIONS.contains(extension)) { installEmbeddedDisplayWidgetFromFile(fileName, selection_tracker, widgets, updates); } diff --git a/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterRepresentation.java b/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterRepresentation.java index 0f664440c6..594378df1e 100644 --- a/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterRepresentation.java +++ b/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterRepresentation.java @@ -91,11 +91,11 @@ public Pane createJFXNode() Deque> widgetPropertiesWithWidgetPropertyListeners = new ArrayDeque<>(); private void addWidgetPropertyListener(WidgetProperty widgetProperty, WidgetPropertyListener widgetPropertyListener) { widgetProperty.addPropertyListener(widgetPropertyListener); - widgetPropertiesWithWidgetPropertyListeners.push(new Pair(widgetProperty, widgetPropertyListener)); + widgetPropertiesWithWidgetPropertyListeners.push(new Pair<>(widgetProperty, widgetPropertyListener)); } private void addUntypedWidgetPropertyListener(WidgetProperty widgetProperty, UntypedWidgetPropertyListener widgetPropertyListener) { widgetProperty.addUntypedPropertyListener(widgetPropertyListener); - widgetPropertiesWithWidgetPropertyListeners.push(new Pair(widgetProperty, widgetPropertyListener)); + widgetPropertiesWithWidgetPropertyListeners.push(new Pair<>(widgetProperty, widgetPropertyListener)); } @Override diff --git a/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterWidget.java b/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterWidget.java index 51be909537..2a8613b37b 100644 --- a/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterWidget.java +++ b/app/display/linearmeter/src/main/java/org/csstudio/display/extra/widgets/linearmeter/LinearMeterWidget.java @@ -131,7 +131,7 @@ public String toString() { new WidgetPropertyDescriptor<>(WidgetPropertyCategory.BEHAVIOR, "limits_from_pv", Messages.WidgetProperties_LimitsFromPV) { @Override public EnumWidgetProperty createProperty(final Widget widget, LimitsFromPV default_value) { - EnumWidgetProperty widgetProperty = new EnumWidgetProperty<>(this, widget, LimitsFromPV.LimitsFromPV) { + EnumWidgetProperty widgetProperty = new EnumWidgetProperty<>(this, widget, LimitsFromPV.LimitsFromPV) { @Override public void setSpecification(final String specification) { // Backwards compatibility to previous version of the Linear Meter, where diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/AdvancedConverter.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/AdvancedConverter.java index 5946fe0e30..f2b389b7d1 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/AdvancedConverter.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/AdvancedConverter.java @@ -320,7 +320,7 @@ private void updateScriptsAndBobFiles(File outputFolderFile) { String search = "]*>"; Pattern pattern = Pattern.compile(search); Matcher matcher = pattern.matcher(newContains); - StringBuffer next = new StringBuffer(); + StringBuilder next = new StringBuilder(); while (matcher.find()) { String hit = matcher.group(); if (!hit.contains("&&")) { @@ -335,7 +335,7 @@ private void updateScriptsAndBobFiles(File outputFolderFile) { // convert | to || Pattern pattern2 = Pattern.compile(search); Matcher matcher2 = pattern2.matcher(newContains); - StringBuffer next2 = new StringBuffer(); + StringBuilder next2 = new StringBuilder(); while (matcher2.find()) { String hit = matcher2.group(); if (!hit.contains("||")) { diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/BrowserConverter.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/BrowserConverter.java index 72e2f5d96b..a1cfde2118 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/BrowserConverter.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/BrowserConverter.java @@ -334,14 +334,14 @@ public void override(File input, File output) throws IOException { ArrayList folder1 = getInputFile(input); ArrayList folder2 = getOutputFile(output); - for (int i = 0; i < folder1.size(); i++) { - for (int j = 0; j < folder2.size(); j++) { - if (folder2.get(j).getName().substring(0, folder2.get(j).getName().length() - 4) - .equals(folder1.get(i).getName().substring(0, folder1.get(i).getName().length() - 4))) { - over.add(folder2.get(j)); - } - } - } + for (File value : folder1) { + for (File file : folder2) { + if (file.getName().substring(0, file.getName().length() - 4) + .equals(value.getName().substring(0, value.getName().length() - 4))) { + over.add(file); + } + } + } } diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/ChildrenProperty.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/ChildrenProperty.java index 6afd08ae0c..46703a7027 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/ChildrenProperty.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/ChildrenProperty.java @@ -265,7 +265,7 @@ public int moveChildTo(int index, final Widget child) Collections.rotate(list.subList(java.lang.Math.min(index, current_index), java.lang.Math.max(index, current_index) + 1), index_diff); } } - final List change = Arrays.asList(child); + final List change = Arrays.asList(child); firePropertyChange(change, change, true); return index; } diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/DisplayModel.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/DisplayModel.java index 28804b996d..438fdaf449 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/DisplayModel.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/DisplayModel.java @@ -206,10 +206,10 @@ public final void setReaderResult(final ModelReader modelReader) /* * setConfiguratorResult() might have already set it to true */ - if (this.clean != null && this.clean.booleanValue() == false) + if (this.clean != null && this.clean == false) throw new RuntimeException("Cannot change cleanliness of DisplayModel"); - this.clean = Boolean.valueOf(modelReader.getNumberOfWidgetErrors() == 0); + this.clean = modelReader.getNumberOfWidgetErrors() == 0; } /** @return true if this display was loaded without errors, @@ -223,7 +223,7 @@ public final boolean isClean() if (safe == null) return true; - if (safe.booleanValue() == false) + if (safe == false) return false; // Check embedded displays and navigation tabs too @@ -235,7 +235,7 @@ public final boolean isClean() final DisplayModel child_dm = child_dm_prop.get().getValue(); if (child_dm != null && child_dm.isClean() == false) { - clean = Boolean.valueOf(false); + clean = Boolean.FALSE; return false; } } diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/Widget.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/Widget.java index 25d3ef7869..7714b53ec3 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/Widget.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/Widget.java @@ -384,7 +384,7 @@ public final void setConfiguratorResult(final WidgetConfigurator configurator) { // Only set it if not clean; DisplayModel needs to update it when all the children are loaded if (!configurator.isClean()) - this.clean = Boolean.valueOf(configurator.isClean()); + this.clean = configurator.isClean(); } /** @@ -394,14 +394,14 @@ public final void setConfiguratorResult(final WidgetConfigurator configurator) { public boolean isClean() { Boolean safe = clean; - if (safe != null && !safe.booleanValue()) + if (safe != null && !safe) return false; java.util.Optional> child_dm_prop = checkProperty(EmbeddedDisplayWidget.runtimeModel.getName()); if (child_dm_prop.isPresent()) { final DisplayModel child_dm = child_dm_prop.get().getValue(); if (child_dm != null && !child_dm.isClean()) { - clean = Boolean.valueOf(false); + clean = Boolean.FALSE; return false; } } diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/persist/PositionalXMLReader.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/persist/PositionalXMLReader.java index 282018a555..9149396638 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/persist/PositionalXMLReader.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/persist/PositionalXMLReader.java @@ -91,7 +91,7 @@ public void startElement(final String uri, final String localName, attributes.getValue(i)); } el.setUserData(LINE_NUMBER, - Integer.valueOf(this.locator.getLineNumber()), null); + this.locator.getLineNumber(), null); elementStack.push(el); } diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ColorMapWidgetProperty.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ColorMapWidgetProperty.java index f15a221ede..d9dd31aaa9 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ColorMapWidgetProperty.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ColorMapWidgetProperty.java @@ -65,13 +65,12 @@ public void writeToXML(final ModelWriter model_writer, final XMLStreamWriter wri else { final int[][] sections = value.getSections(); - for (int i=0; i2 switch (legacy_map) { diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ScriptsWidgetProperty.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ScriptsWidgetProperty.java index 5ed46b5733..6b25723c1b 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ScriptsWidgetProperty.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/ScriptsWidgetProperty.java @@ -125,7 +125,7 @@ public void readFromXML(final ModelReader model_reader, final Element property_x tag = xml.getAttribute("checkConnect"); final boolean check_connections = tag.isEmpty() ? true - : Boolean.valueOf(tag); + : Boolean.parseBoolean(tag); // Script content embedded in XML? Element text_xml = XMLUtil.getChildElement(xml, XMLTags.TEXT); diff --git a/app/display/model/src/main/java/org/csstudio/display/builder/model/util/VTypeUtil.java b/app/display/model/src/main/java/org/csstudio/display/builder/model/util/VTypeUtil.java index 77fa2a9631..e63c5002a8 100644 --- a/app/display/model/src/main/java/org/csstudio/display/builder/model/util/VTypeUtil.java +++ b/app/display/model/src/main/java/org/csstudio/display/builder/model/util/VTypeUtil.java @@ -68,6 +68,6 @@ public static Number getValueNumber(final VType value) if (array.size() > 0) return array.getInt(0); } - return Double.valueOf(Double.NaN); + return Double.NaN; } } diff --git a/app/display/model/src/test/java/org/csstudio/display/builder/model/macros/MacroHierarchyUnitTest.java b/app/display/model/src/test/java/org/csstudio/display/builder/model/macros/MacroHierarchyUnitTest.java index 2004134f03..40f6cd6c00 100644 --- a/app/display/model/src/test/java/org/csstudio/display/builder/model/macros/MacroHierarchyUnitTest.java +++ b/app/display/model/src/test/java/org/csstudio/display/builder/model/macros/MacroHierarchyUnitTest.java @@ -99,7 +99,7 @@ public void testPropertiesAndEnvironment() // Check fall back to environment variables value = macros.getValue("HOME"); System.out.println("Environment variable $HOME: " + value); - if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) + if (System.getProperty("os.name").toLowerCase().contains("win")) assertThat(value, nullValue()); else assertThat(value, not(nullValue())); diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetFontPopOverController.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetFontPopOverController.java index b654a2adb3..62eb8dfa8f 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetFontPopOverController.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetFontPopOverController.java @@ -269,7 +269,7 @@ public void initialize ( URL location, ResourceBundle resources ) { sizes.setConverter(new FormatStringConverter(new DecimalFormat("##0.0#")) { @Override public Double fromString ( String value ) { - return Double.valueOf(((Number) super.fromString(value)).doubleValue()); + return ((Number) super.fromString(value)).doubleValue(); } }); sizes.getItems().addAll(DEFAULT_SIZES); diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/GroupRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/GroupRepresentation.java index a3bf9c02c7..04e1cd8cc9 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/GroupRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/GroupRepresentation.java @@ -47,7 +47,7 @@ public class GroupRepresentation extends JFXBaseRepresentation plot_axis, final AxisWidgetProp plot_axis.setScaleFont(JFXUtil.convert(model_axis.scaleFont().getValue())); plot_axis.setVisible(model_axis.visible().getValue()); if(plot_axis instanceof YAxisImpl) { - ((YAxisImpl)plot_axis).setGridColor( + ((YAxisImpl)plot_axis).setGridColor( GraphicsUtils.convert( JFXUtil.convert( ((YAxisWidgetProperty) model_axis).color().getValue() diff --git a/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/ValueUtil.java b/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/ValueUtil.java index 789d61d12c..46f767c7b3 100644 --- a/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/ValueUtil.java +++ b/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/ValueUtil.java @@ -476,8 +476,7 @@ public static VTable createStringTableFromRows(final List headers, final { final ArrayList column = new ArrayList<>(); columns.add(column); - for (int row=0; row strings : rows) column.add(strings.get(col)); } return createStringTableFromColumns(headers, columns); } diff --git a/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/internal/RuntimeScriptHandler.java b/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/internal/RuntimeScriptHandler.java index cc4f2cc94a..8ddb35bfc5 100644 --- a/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/internal/RuntimeScriptHandler.java +++ b/app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/script/internal/RuntimeScriptHandler.java @@ -179,8 +179,7 @@ private void createPVs() throws Exception } // Subscribe to all PVs. // Will later unsubscribe from non-trigger PVs - for (int i=0; i DEFAULT_TIMESPAN = new Pair(10, TimespanUnit.MINUTES); + private final Pair DEFAULT_TIMESPAN = new Pair<>(10, TimespanUnit.MINUTES); private Pair timespan = DEFAULT_TIMESPAN; private DefaultNumericAxis zAxis = new DefaultNumericAxis("Z-Axis"); @@ -631,9 +631,9 @@ public static Optional> parseTimespanString(String t String stringContainingUnit = timespanString.substring(i).trim().toLowerCase(); if (stringContainingUnit.equals("") || stringContainingUnit.equals("s") || stringContainingUnit.equals("sec") || stringContainingUnit.equals("secs") || stringContainingUnit.equals("second") || stringContainingUnit.equals("seconds")) { - return Optional.of(new Pair(parsedNumber, TimespanUnit.SECONDS)); + return Optional.of(new Pair<>(parsedNumber, TimespanUnit.SECONDS)); } else if (stringContainingUnit.equals("m") || stringContainingUnit.equals("min") || stringContainingUnit.equals("mins") || stringContainingUnit.equals("minute") || stringContainingUnit.equals("minutes")) { - return Optional.of(new Pair(parsedNumber, TimespanUnit.MINUTES)); + return Optional.of(new Pair<>(parsedNumber, TimespanUnit.MINUTES)); } else if (stringContainingUnit.equals("h") || stringContainingUnit.equals("hour") || stringContainingUnit.equals("hours")) { return Optional.of(new Pair<>(parsedNumber, TimespanUnit.HOURS)); } else if (stringContainingUnit.equals("d") || stringContainingUnit.equals("day") || stringContainingUnit.equals("days")) { diff --git a/app/display/waterfallplot/src/main/java/org/phoebus/applications/waterfallplotwidget/WaterfallPlotRuntime.java b/app/display/waterfallplot/src/main/java/org/phoebus/applications/waterfallplotwidget/WaterfallPlotRuntime.java index e21e3eee42..c582fa6067 100644 --- a/app/display/waterfallplot/src/main/java/org/phoebus/applications/waterfallplotwidget/WaterfallPlotRuntime.java +++ b/app/display/waterfallplot/src/main/java/org/phoebus/applications/waterfallplotwidget/WaterfallPlotRuntime.java @@ -88,7 +88,7 @@ public void start() { RuntimePV runtimePV = PVFactory.getPV(pvName); super.addPV(runtimePV, false); ConcurrentSkipListMap instantToValue = new ConcurrentSkipListMap<>(); - scalarPVsData.pvNameToInstantToValue.add(new Pair(pvName, instantToValue)); + scalarPVsData.pvNameToInstantToValue.add(new Pair<>(pvName, instantToValue)); runtimePV.addListener((pv, vType) -> { if (vType instanceof VNumber vnumber) { instantToValue.put(vnumber.getTime().getTimestamp(), vnumber.getValue().doubleValue()); diff --git a/app/email/ui/src/main/java/org/phoebus/applications/email/adapters/AppSelectionAdapterFactory.java b/app/email/ui/src/main/java/org/phoebus/applications/email/adapters/AppSelectionAdapterFactory.java index 1dadc4af6b..12db237380 100644 --- a/app/email/ui/src/main/java/org/phoebus/applications/email/adapters/AppSelectionAdapterFactory.java +++ b/app/email/ui/src/main/java/org/phoebus/applications/email/adapters/AppSelectionAdapterFactory.java @@ -35,7 +35,7 @@ public Optional adapt(Object adaptableObject, Class adapterType) { EmailEntry emailEntry = new EmailEntry(); - StringBuffer title = new StringBuffer(); + StringBuilder title = new StringBuilder(); title.append("Display Screenshot for : " + selectionInfo.getTitle()); emailEntry.setSubject(title.toString()); emailEntry.setBody(selectionInfo.getBody()); diff --git a/app/eslog/src/main/java/org/phoebus/applications/eslog/model/EventLogMessage.java b/app/eslog/src/main/java/org/phoebus/applications/eslog/model/EventLogMessage.java index 87a4ff3463..ea3f6687ec 100644 --- a/app/eslog/src/main/java/org/phoebus/applications/eslog/model/EventLogMessage.java +++ b/app/eslog/src/main/java/org/phoebus/applications/eslog/model/EventLogMessage.java @@ -52,7 +52,7 @@ public static EventLogMessage fromElasticsearch(Hit hit) { final var msg = new EventLogMessage(); msg.date = Instant.ofEpochMilli( - Long.valueOf(hit.fields().get(EventLogMessage.DATE).toJson() + Long.parseLong(hit.fields().get(EventLogMessage.DATE).toJson() .asJsonArray().getString(0))); for (String name : EventLogMessage.PROPERTY_NAMES) { diff --git a/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserController.java b/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserController.java index eb8256a8a1..28b5646379 100644 --- a/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserController.java +++ b/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserController.java @@ -603,8 +603,8 @@ public ExpandedCountChangeListener(File fileToHighlight){ } @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { - TreeItem root = treeView.getRoot(); - List children = root.getChildren(); + TreeItem root = treeView.getRoot(); + List> children = root.getChildren(); for (TreeItem child : children) { if (((FileInfo) child.getValue()).file.equals(fileToHighlight)) { treeView.getSelectionModel().select(child); diff --git a/app/logbook/inmemory/src/main/java/org/phoebus/applications/logbook/InMemoryLogClient.java b/app/logbook/inmemory/src/main/java/org/phoebus/applications/logbook/InMemoryLogClient.java index 3dfce4258c..e43797de70 100644 --- a/app/logbook/inmemory/src/main/java/org/phoebus/applications/logbook/InMemoryLogClient.java +++ b/app/logbook/inmemory/src/main/java/org/phoebus/applications/logbook/InMemoryLogClient.java @@ -158,12 +158,12 @@ public List findLogs(Map map) { Stream searchStream = logEntries.values().stream(); if (map.containsKey("start")) { searchStream = searchStream.filter(log -> { - return log.getCreatedDate().isAfter(Instant.ofEpochSecond(Long.valueOf(map.get("start")))); + return log.getCreatedDate().isAfter(Instant.ofEpochSecond(Long.parseLong(map.get("start")))); }); } if (map.containsKey("end")) { searchStream = searchStream.filter(log -> { - return log.getCreatedDate().isBefore(Instant.ofEpochSecond(Long.valueOf(map.get("end")))); + return log.getCreatedDate().isBefore(Instant.ofEpochSecond(Long.parseLong(map.get("end")))); }); } if (map.containsKey("search")) { diff --git a/app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/model/UnixTimestampDeserializer.java b/app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/model/UnixTimestampDeserializer.java index fea3664dd8..064476fdd3 100644 --- a/app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/model/UnixTimestampDeserializer.java +++ b/app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/model/UnixTimestampDeserializer.java @@ -16,7 +16,7 @@ class UnixTimestampDeserializer extends JsonDeserializer { public Instant deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { String timestamp = jp.getText().trim(); try { - return Instant.ofEpochMilli(Long.valueOf(timestamp)); + return Instant.ofEpochMilli(Long.parseLong(timestamp)); } catch (NumberFormatException e) { logger.log(Level.WARNING, "Unable to deserialize timestamp: " + timestamp, e); return null; diff --git a/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/OlogClient.java b/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/OlogClient.java index 5fb775a397..306211679d 100644 --- a/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/OlogClient.java +++ b/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/OlogClient.java @@ -666,9 +666,7 @@ public FindLogs(MultivaluedMap map) { public FindLogs(Map map) { MultivaluedMap mMap = new MultivaluedHashMap<>(); - Iterator> itr = map.entrySet().iterator(); - while (itr.hasNext()) { - Map.Entry entry = itr.next(); + for (Map.Entry entry : map.entrySet()) { mMap.put(entry.getKey(), Arrays.asList(entry.getValue().split(","))); } this.map = mMap; diff --git a/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/UnixTimestampDeserializer.java b/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/UnixTimestampDeserializer.java index ff0fadab76..50d224787a 100644 --- a/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/UnixTimestampDeserializer.java +++ b/app/logbook/olog/client/src/main/java/org/phoebus/olog/api/UnixTimestampDeserializer.java @@ -16,7 +16,7 @@ class UnixTimestampDeserializer extends JsonDeserializer { public Instant deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { String timestamp = jp.getText().trim(); try { - return Instant.ofEpochMilli(Long.valueOf(timestamp)); + return Instant.ofEpochMilli(Long.parseLong(timestamp)); } catch (NumberFormatException e) { logger.log(Level.WARNING, "Unable to deserialize timestamp: " + timestamp, e); return null; diff --git a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/PreviewViewer.java b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/PreviewViewer.java index d633f8eb63..aab6a23f6c 100644 --- a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/PreviewViewer.java +++ b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/PreviewViewer.java @@ -60,7 +60,7 @@ public PreviewViewer(String entryDescription, List attachments) { setScene(scene); } private String getFullHtml(String commonmarkString){ - StringBuffer stringBuffer = new StringBuffer(); + StringBuilder stringBuffer = new StringBuilder(); stringBuffer.append("
"); stringBuffer.append(htmlAware.toHtml(commonmarkString)); stringBuffer.append("
"); diff --git a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/write/LogPropertiesEditorController.java b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/write/LogPropertiesEditorController.java index cb520e094e..399b77815e 100644 --- a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/write/LogPropertiesEditorController.java +++ b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/write/LogPropertiesEditorController.java @@ -374,7 +374,7 @@ private class PropertyValueTreeTableCell extends TextFieldTreeTableCell row = getTableRow(); PropertyTreeNode parent = (PropertyTreeNode) row.getTreeItem().getParent().getValue(); String propertyName = parent.getName(); String attributeName = ((PropertyTreeNode) row.getTreeItem().getValue()).getName(); diff --git a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryDisplayDemo.java b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryDisplayDemo.java index 810884af70..c0fc41fe3f 100644 --- a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryDisplayDemo.java +++ b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryDisplayDemo.java @@ -149,8 +149,8 @@ public void start(Stage primaryStage) throws Exception { ologLog.setCreatedDate(Instant.now()); ologLog.setTitle("A report on the orbit studies"); ologLog.setDescription("Fast correctors for the vertical orbit have glitched to near saturation. Archiver shows there have been several episodes the past 24 hrs. Appears that FOFB in vertical plane might have momentary bad BPM reading."); - ologLog.setTags(new HashSet(Arrays.asList(TagImpl.of("Orbit", "active"), TagImpl.of("Studies", "active")))); - ologLog.setLogbooks(new HashSet(Arrays.asList(LogbookImpl.of("Operations", "active")))); + ologLog.setTags(new HashSet<>(Arrays.asList(TagImpl.of("Orbit", "active"), TagImpl.of("Studies", "active")))); + ologLog.setLogbooks(new HashSet<>(Arrays.asList(LogbookImpl.of("Operations", "active")))); ologLog.setProperties(Arrays.asList(track, experimentProperty)); List attachments = new ArrayList<>(); OlogAttachment attachment1 = new OlogAttachment("image_1.png"); diff --git a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntrySearchDemo.java b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntrySearchDemo.java index 3f892c5948..3e1ed5f1ed 100644 --- a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntrySearchDemo.java +++ b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntrySearchDemo.java @@ -109,7 +109,7 @@ public void start(Stage primaryStage) throws Exception { .description("First line for log " + i) .createdDate(Instant.now()) .inLogbooks(logbooks) - .id(Long.valueOf(i)) + .id((long) i) .withTags(tags); StringBuilder sb = new StringBuilder(); for (int j = 0; j < i; j++) { diff --git a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryTableDemo.java b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryTableDemo.java index 7f04f9bed9..24b0d3093f 100644 --- a/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryTableDemo.java +++ b/app/logbook/olog/ui/src/test/java/org/phoebus/logbook/olog/ui/LogEntryTableDemo.java @@ -126,7 +126,7 @@ public void start(Stage primaryStage) throws Exception { .description("First line for log " + i) .createdDate(Instant.now()) .inLogbooks(logbooks) - .id(Long.valueOf(i)) + .id((long) i) .withTags(tags); StringBuilder sb = new StringBuilder(); for (int j = 0; j < i; j++) { diff --git a/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/LogEntryTableViewController.java b/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/LogEntryTableViewController.java index 9f0cbee731..194048de86 100644 --- a/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/LogEntryTableViewController.java +++ b/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/LogEntryTableViewController.java @@ -130,7 +130,7 @@ public void initialize() { metaCol = new TableColumn<>("Logbook/Tags"); timeOwnerCol.setMaxWidth(1f * Integer.MAX_VALUE * 25); - timeOwnerCol.setCellValueFactory(col -> new SimpleObjectProperty(col.getValue())); + timeOwnerCol.setCellValueFactory(col -> new SimpleObjectProperty<>(col.getValue())); timeOwnerCol.setCellFactory(col -> { final GridPane pane = new GridPane(); final Label timeText = new Label(); @@ -156,7 +156,7 @@ public void updateItem(LogEntry logEntry, boolean empty) { }); descriptionCol.setMaxWidth(1f * Integer.MAX_VALUE * 50); - descriptionCol.setCellValueFactory(col -> new SimpleObjectProperty(col.getValue())); + descriptionCol.setCellValueFactory(col -> new SimpleObjectProperty<>(col.getValue())); descriptionCol.setCellFactory(col -> { final GridPane pane = new GridPane(); final Label titleText = new Label(); @@ -219,7 +219,7 @@ public void updateItem(LogEntry logEntry, boolean empty) { }); metaCol.setMaxWidth(1f * Integer.MAX_VALUE * 25); - metaCol.setCellValueFactory(col -> new SimpleObjectProperty(col.getValue())); + metaCol.setCellValueFactory(col -> new SimpleObjectProperty<>(col.getValue())); metaCol.setCellFactory(col -> { final GridPane pane = new GridPane(); final Label logbooks = new Label(); diff --git a/app/logbook/ui/src/test/java/org/phoebus/logbook/ui/QueryParserTest.java b/app/logbook/ui/src/test/java/org/phoebus/logbook/ui/QueryParserTest.java index 4450b56433..b3cb0c1bd8 100644 --- a/app/logbook/ui/src/test/java/org/phoebus/logbook/ui/QueryParserTest.java +++ b/app/logbook/ui/src/test/java/org/phoebus/logbook/ui/QueryParserTest.java @@ -36,8 +36,8 @@ public void timeParsing() { Map queryParameters = LogbookQueryUtil.parseQueryURI(uri); assertEquals("*Fault*Motor*", queryParameters.get(Keys.SEARCH.getName())); assertEquals("operation", queryParameters.get(Keys.TAGS.getName())); - assertEquals(now/1000, Double.valueOf(queryParameters.get(Keys.ENDTIME.getName())), 60); - assertEquals((now-(8*60*60*1000))/1000, Double.valueOf(queryParameters.get(Keys.STARTTIME.getName())), 60); + assertEquals(now/1000, Double.parseDouble(queryParameters.get(Keys.ENDTIME.getName())), 60); + assertEquals((now-(8*60*60*1000))/1000, Double.parseDouble(queryParameters.get(Keys.STARTTIME.getName())), 60); } /** diff --git a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/FieldParser.java b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/FieldParser.java index 3473db706d..0e6a3cc510 100644 --- a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/FieldParser.java +++ b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/FieldParser.java @@ -63,8 +63,8 @@ public static Map> parse(final String field_configuration) final String start_txt = field_spec.substring(range_sep-range_width, range_sep); if (start_txt.matches("[0-9]+")) { - final int start = Integer.valueOf(start_txt); - final int end = Integer.valueOf(field_spec.substring(range_sep+1, range_sep+1+range_width)); + final int start = Integer.parseInt(start_txt); + final int end = Integer.parseInt(field_spec.substring(range_sep+1, range_sep+1+range_width)); final String format = "%0" + range_width + "d"; for (int i=start; i<=end; i++) fields.add(base + String.format(format, i)); diff --git a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/model/TreeModelItem.java b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/model/TreeModelItem.java index 76fcb28346..124c4a3b8b 100644 --- a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/model/TreeModelItem.java +++ b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/model/TreeModelItem.java @@ -420,7 +420,7 @@ void dispose() @Override public String toString() { - final StringBuffer b = new StringBuffer(); + final StringBuilder b = new StringBuilder(); b.append(info).append(" '").append(pv_name).append("'"); if (type == CONSTANT_TYPE) b.append(' ').append(CONSTANT_TYPE); diff --git a/app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/LinearTicks.java b/app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/LinearTicks.java index db7c6c6c61..6703336ff7 100644 --- a/app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/LinearTicks.java +++ b/app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/LinearTicks.java @@ -334,9 +334,9 @@ public static double selectNiceStep(final double min_distance) { final double log = Math.log10(min_distance); final double order_of_magnitude = Math.pow(10, Math.floor(log)); - for (int i=0; i= min_distance) - return NICE_STEPS[i] * order_of_magnitude; + for (double niceStep : NICE_STEPS) + if (niceStep * order_of_magnitude >= min_distance) + return niceStep * order_of_magnitude; return min_distance; } diff --git a/app/rtplot/src/test/java/org/csstudio/javafx/rtplot/ValuePlotDemo.java b/app/rtplot/src/test/java/org/csstudio/javafx/rtplot/ValuePlotDemo.java index 3587f7e71c..826f7946a8 100644 --- a/app/rtplot/src/test/java/org/csstudio/javafx/rtplot/ValuePlotDemo.java +++ b/app/rtplot/src/test/java/org/csstudio/javafx/rtplot/ValuePlotDemo.java @@ -74,12 +74,12 @@ public void update() for (i=0; i(Double.valueOf(i), value)); + data.add(new SimpleDataItem<>((double) i, value)); } for (/* */; i(Double.valueOf(i), value)); + data.add(new SimpleDataItem<>((double) i, value)); } } else @@ -88,7 +88,7 @@ public void update() for (int i=0; i(Double.valueOf(i), value)); + data.add(new SimpleDataItem<>((double) i, value)); } } } @@ -109,7 +109,7 @@ public void start(final Stage stage) throws Exception final RTValuePlot plot = new RTValuePlot(true); - plot.getXAxis().setValueRange(0.0, Double.valueOf(MAX_SIZE)); + plot.getXAxis().setValueRange(0.0, (double) MAX_SIZE); plot.getXAxis().setGridVisible(true); plot.getYAxes().get(0).setGridVisible(true); diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/datamigration/git/FileUtilities.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/datamigration/git/FileUtilities.java index 8041838254..a897512fe2 100644 --- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/datamigration/git/FileUtilities.java +++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/datamigration/git/FileUtilities.java @@ -439,7 +439,7 @@ public static ConfigurationContent readFromConfiguration(InputStream stream) thr delta = trim(split[deltaIndex]); } if (readOnlyIndex != -1) { - readOnly = Boolean.valueOf(trim(split[readOnlyIndex])); + readOnly = Boolean.parseBoolean(trim(split[readOnlyIndex])); } entries.add(new ConfigurationEntry(name, readback, delta, readOnly)); } diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/VTypeCellEditor.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/VTypeCellEditor.java index ff10c3a32e..844370678a 100644 --- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/VTypeCellEditor.java +++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/VTypeCellEditor.java @@ -19,11 +19,8 @@ package org.phoebus.applications.saveandrestore.ui.snapshot; -import javafx.beans.binding.Bindings; import javafx.scene.control.TableRow; import javafx.scene.control.Tooltip; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; import javafx.util.StringConverter; import org.epics.vtype.Alarm; import org.epics.vtype.EnumDisplay; @@ -37,7 +34,6 @@ import org.phoebus.saveandrestore.util.VNoData; import org.phoebus.applications.saveandrestore.ui.VTypePair; import org.phoebus.core.vtypes.VDisconnectedData; -import org.phoebus.ui.javafx.JFXUtil; import java.util.ArrayList; import java.util.List; @@ -183,7 +179,7 @@ public void updateItem(T item, boolean empty) { setTooltip(tooltip); } } - TableRow tableRow = getTableRow(); + TableRow tableRow = getTableRow(); // If this is a TableEntry row and read-only it should not be editable. if (tableRow != null) { if (tableRow.getItem() != null && tableRow.getItem() instanceof TableEntry tableEntry) { diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/compare/ColumnEntry.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/compare/ColumnEntry.java index 6246262ab3..05df7f18c1 100644 --- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/compare/ColumnEntry.java +++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/compare/ColumnEntry.java @@ -11,7 +11,6 @@ import org.phoebus.applications.saveandrestore.SafeMultiply; import org.phoebus.applications.saveandrestore.ui.VTypePair; import org.phoebus.saveandrestore.util.Threshold; -import org.phoebus.saveandrestore.util.Utilities; import org.phoebus.saveandrestore.util.VNoData; import java.util.Optional; @@ -68,7 +67,7 @@ public void setThreshold(double ratio) { if (storedValue.get() instanceof VNumber) { VNumber vNumber = SafeMultiply.multiply((VNumber) storedValue.get(), ratio); boolean isNegative = vNumber.getValue().doubleValue() < 0; - Threshold t = new Threshold<>(isNegative ? SafeMultiply.multiply(vNumber.getValue(), -1.0) : vNumber.getValue()); + Threshold t = new Threshold<>(isNegative ? SafeMultiply.multiply(vNumber.getValue(), -1.0) : vNumber.getValue()); this.delta.set(new VTypePair(liveValue.get(), storedValue.get(), Optional.of(t))); } } diff --git a/app/save-and-restore/model/src/test/java/org/phoebus/applications/saveandrestore/model/json/JsonSerializationTest.java b/app/save-and-restore/model/src/test/java/org/phoebus/applications/saveandrestore/model/json/JsonSerializationTest.java index a0a3d8db5d..322e244377 100644 --- a/app/save-and-restore/model/src/test/java/org/phoebus/applications/saveandrestore/model/json/JsonSerializationTest.java +++ b/app/save-and-restore/model/src/test/java/org/phoebus/applications/saveandrestore/model/json/JsonSerializationTest.java @@ -74,9 +74,9 @@ public void testSerializationAndDeserialzation() throws Exception { SnapshotItem item = objectMapper.readValue(json, SnapshotItem.class); VType vType = item.getValue(); assertTrue(vType instanceof VDouble); - assertEquals(7.7, ((VDouble)vType).getValue().doubleValue(), 0.01); + assertEquals(7.7, ((VDouble) vType).getValue(), 0.01); vType = item.getReadbackValue(); - assertEquals(7.7, ((VDouble)vType).getValue().doubleValue(), 0.01); + assertEquals(7.7, ((VDouble) vType).getValue(), 0.01); snapshotItem = SnapshotItem.builder().configPv(ConfigPv.builder().pvName("a") .build()) diff --git a/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Threshold.java b/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Threshold.java index dd094fb9c4..e82cdffaf3 100644 --- a/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Threshold.java +++ b/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Threshold.java @@ -144,7 +144,7 @@ public Threshold(String thresholdDefinition) { this.negativeThreshold = null; } this.function = thresholdDefinition; - this.isBooleanFunction = this.function.indexOf("base") > -1 && this.function.indexOf("value") > -1; + this.isBooleanFunction = this.function.contains("base") && this.function.contains("value"); } } diff --git a/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Utilities.java b/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Utilities.java index 8329b7c09a..fba08d6679 100644 --- a/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Utilities.java +++ b/app/save-and-restore/util/src/main/java/org/phoebus/saveandrestore/util/Utilities.java @@ -149,7 +149,7 @@ public double getAbsoluteDelta() { private static final char COMMA = ','; // All formats use thread locals, to avoid problems if any of the static methods are invoked concurrently - private static final ThreadLocal FORMAT = ThreadLocal.withInitial(() -> { + private static final ThreadLocal FORMAT = ThreadLocal.withInitial(() -> { ValueFormat vf = new SimpleValueFormat(3); vf.setNumberFormat(NumberFormats.toStringFormat()); return vf; diff --git a/app/scan/model/src/main/java/org/csstudio/ndarray/NDArray.java b/app/scan/model/src/main/java/org/csstudio/ndarray/NDArray.java index 15de4af49c..09c49ef1b1 100644 --- a/app/scan/model/src/main/java/org/csstudio/ndarray/NDArray.java +++ b/app/scan/model/src/main/java/org/csstudio/ndarray/NDArray.java @@ -305,8 +305,7 @@ private static int fillFlatArray(final ListNumber flat, int index, final Object if (data instanceof List) { final List list = (List)data; - for (int i=0; i Optional adapt(Object adaptableObject, Class adapterType) { EmailEntry emailEntry = new EmailEntry(); - StringBuffer title = new StringBuffer(); + StringBuilder title = new StringBuilder(); title.append("Databrowser Plot"); databrowserSelection.getPlotTitle().ifPresent(title::append); emailEntry.setSubject(title.toString()); @@ -103,7 +103,7 @@ else if (adapterType.isAssignableFrom(LogEntry.class)) */ private String getBody(DatabrowserSelection databrowserSelection) { - StringBuffer body = new StringBuffer(); + StringBuilder body = new StringBuilder(); databrowserSelection.getPlotTitle().ifPresent(body::append); body.append("databrowser plot for the following pvs: " + System.lineSeparator()); body.append(databrowserSelection.getPlotPVs().stream().collect(Collectors.joining(" " + System.lineSeparator()))); diff --git a/core/formula/src/main/java/org/csstudio/apputil/formula/Formula.java b/core/formula/src/main/java/org/csstudio/apputil/formula/Formula.java index e515e7aeb6..de3d41538c 100644 --- a/core/formula/src/main/java/org/csstudio/apputil/formula/Formula.java +++ b/core/formula/src/main/java/org/csstudio/apputil/formula/Formula.java @@ -200,7 +200,7 @@ public boolean hasSubnode(final String name) private Node parseConstant(final Scanner s) throws Exception { final String digits = "0123456789."; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); boolean negative = false; if (s.isDone()) diff --git a/core/formula/src/main/java/org/csstudio/apputil/formula/Scanner.java b/core/formula/src/main/java/org/csstudio/apputil/formula/Scanner.java index 0c2faef50d..81e6666ea0 100644 --- a/core/formula/src/main/java/org/csstudio/apputil/formula/Scanner.java +++ b/core/formula/src/main/java/org/csstudio/apputil/formula/Scanner.java @@ -76,7 +76,7 @@ public boolean isDone() /** @return Returns the remaining string from the current char on. */ public String rest() throws Exception { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); while (!isDone()) { buf.append(get()); diff --git a/core/formula/src/main/java/org/csstudio/apputil/formula/node/MaxNode.java b/core/formula/src/main/java/org/csstudio/apputil/formula/node/MaxNode.java index e4f56c91c6..331b3b9031 100644 --- a/core/formula/src/main/java/org/csstudio/apputil/formula/node/MaxNode.java +++ b/core/formula/src/main/java/org/csstudio/apputil/formula/node/MaxNode.java @@ -70,7 +70,7 @@ public boolean hasSubnode(final String name) @Override public String toString() { - final StringBuffer b = new StringBuffer("max("); + final StringBuilder b = new StringBuilder("max("); for (int i = 0; i < args.length; i++) { if (i>0) diff --git a/core/formula/src/main/java/org/csstudio/apputil/formula/node/MinNode.java b/core/formula/src/main/java/org/csstudio/apputil/formula/node/MinNode.java index d0991d8433..718b8e237b 100644 --- a/core/formula/src/main/java/org/csstudio/apputil/formula/node/MinNode.java +++ b/core/formula/src/main/java/org/csstudio/apputil/formula/node/MinNode.java @@ -70,7 +70,7 @@ public boolean hasSubnode(final String name) @Override public String toString() { - final StringBuffer b = new StringBuffer("min("); + final StringBuilder b = new StringBuilder("min("); for (int i = 0; i < args.length; i++) { if (i>0) diff --git a/core/formula/src/main/java/org/csstudio/apputil/formula/node/SPIFuncNode.java b/core/formula/src/main/java/org/csstudio/apputil/formula/node/SPIFuncNode.java index 058144e746..728dc9d483 100644 --- a/core/formula/src/main/java/org/csstudio/apputil/formula/node/SPIFuncNode.java +++ b/core/formula/src/main/java/org/csstudio/apputil/formula/node/SPIFuncNode.java @@ -83,7 +83,7 @@ public boolean hasSubnode(final String name) @Override public String toString() { - final StringBuffer b = new StringBuffer(function.getName()); + final StringBuilder b = new StringBuilder(function.getName()); b.append("("); for (int i = 0; i < args.length; i++) { diff --git a/core/framework/src/main/java/org/phoebus/framework/autocomplete/LocProposal.java b/core/framework/src/main/java/org/phoebus/framework/autocomplete/LocProposal.java index 25ca4e7dc4..b5ae46597a 100644 --- a/core/framework/src/main/java/org/phoebus/framework/autocomplete/LocProposal.java +++ b/core/framework/src/main/java/org/phoebus/framework/autocomplete/LocProposal.java @@ -172,7 +172,7 @@ public List getMatch(final String text) // No type provided? if (split.get(1) == null) segs.add(MatchSegment.comment("")); - else if (type.toLowerCase().indexOf(split.get(1).toLowerCase()) >= 0) + else if (type.toLowerCase().contains(split.get(1).toLowerCase())) // Recognize piece of type, accept for full type segs.add(MatchSegment.match("<" + type + ">")); else diff --git a/core/framework/src/main/java/org/phoebus/framework/autocomplete/MqttProposal.java b/core/framework/src/main/java/org/phoebus/framework/autocomplete/MqttProposal.java index e74f382b4e..a7d78ced6a 100644 --- a/core/framework/src/main/java/org/phoebus/framework/autocomplete/MqttProposal.java +++ b/core/framework/src/main/java/org/phoebus/framework/autocomplete/MqttProposal.java @@ -97,7 +97,7 @@ public List getMatch(final String text) // No type provided? if (split.get(1) == null) segs.add(MatchSegment.comment("")); - else if (type.toLowerCase().indexOf(split.get(1).toLowerCase()) >= 0) + else if (type.toLowerCase().contains(split.get(1).toLowerCase())) // Recognize piece of type, accept for full type segs.add(MatchSegment.match("<" + type + ">")); else diff --git a/core/framework/src/main/java/org/phoebus/framework/persistence/PositionalXMLReader.java b/core/framework/src/main/java/org/phoebus/framework/persistence/PositionalXMLReader.java index 62e353cc0b..d7b73c3dcc 100644 --- a/core/framework/src/main/java/org/phoebus/framework/persistence/PositionalXMLReader.java +++ b/core/framework/src/main/java/org/phoebus/framework/persistence/PositionalXMLReader.java @@ -91,7 +91,7 @@ public void startElement(final String uri, final String localName, attributes.getValue(i)); } el.setUserData(LINE_NUMBER, - Integer.valueOf(this.locator.getLineNumber()), null); + this.locator.getLineNumber(), null); elementStack.push(el); } diff --git a/core/framework/src/test/java/org/phoebus/framework/util/ResourceParserTest.java b/core/framework/src/test/java/org/phoebus/framework/util/ResourceParserTest.java index 3140692486..97682e600c 100644 --- a/core/framework/src/test/java/org/phoebus/framework/util/ResourceParserTest.java +++ b/core/framework/src/test/java/org/phoebus/framework/util/ResourceParserTest.java @@ -101,7 +101,7 @@ public void checkFileToURI() throws Exception { assertThat(uri, not(nullValue())); assertThat(new File(uri).getCanonicalFile(), equalTo(spacey.getCanonicalFile())); assertThat(uri.getScheme(), equalTo("file")); - if (OS.indexOf("win") >= 0) { + if (OS.contains("win")) { assertTrue(uri.toString().matches("file:/[a-zA-Z]:/some/dir%20with%20space/file.abc")); } else { assertThat(uri.toString(), equalTo("file:/some/dir%20with%20space/file.abc")); diff --git a/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCAContext.java b/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCAContext.java index 61aa464723..a15c494575 100644 --- a/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCAContext.java +++ b/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCAContext.java @@ -67,7 +67,7 @@ private JCAContext() throws Exception version.getMaintenanceVersion() <=9); } else - supported = JCA_Preferences.getInstance().isVarArraySupported().booleanValue(); + supported = JCA_Preferences.getInstance().isVarArraySupported(); is_var_array_supported = supported; } diff --git a/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCA_PV.java b/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCA_PV.java index a43480db21..78c929f968 100644 --- a/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCA_PV.java +++ b/core/pv-ca/src/main/java/org/phoebus/pv/ca/JCA_PV.java @@ -486,7 +486,7 @@ private void performWrite(final Object new_value, final PutListener put_listener } else if (new_value instanceof Double) { - final double val = ((Double)new_value).doubleValue(); + final double val = (Double) new_value; if (put_listener != null) channel.put(val, put_listener); else @@ -497,7 +497,7 @@ else if (new_value instanceof Double []) final Double dbl[] = (Double [])new_value; final double val[] = new double[dbl.length]; for (int i=0; i -1 ? Short.valueOf(index) : null; + return index > -1 ? index : null; } /** diff --git a/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoDeviceHelper.java b/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoDeviceHelper.java index 8835bf03a6..63c2e3aa4f 100644 --- a/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoDeviceHelper.java +++ b/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoDeviceHelper.java @@ -300,7 +300,7 @@ public static int getTimeOutInMilliseconds(String device) { timeOut = DEFAULT_TIMEOUT; } else { Integer tmp = TIME_OUT_MAP.get(device); - timeOut = tmp == null ? DEFAULT_TIMEOUT : tmp.intValue(); + timeOut = tmp == null ? DEFAULT_TIMEOUT : tmp; } return timeOut; } @@ -317,7 +317,7 @@ public static void setTimeOutInMilliseconds(String device, int timeOut) { if (timeOut < 1) { timeOut = DEFAULT_TIMEOUT; } - TIME_OUT_MAP.put(device, Integer.valueOf(timeOut)); + TIME_OUT_MAP.put(device, timeOut); getDeviceProxy(device, false); } } diff --git a/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoExceptionHelper.java b/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoExceptionHelper.java index 386668a836..2dc2a3a7ee 100644 --- a/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoExceptionHelper.java +++ b/core/pv-tango/src/main/java/org/phoebus/pv/tango/TangoExceptionHelper.java @@ -87,7 +87,7 @@ public static String getErrorMessage(Throwable t) { // - Or it contains a not user friendly message with "IDL...", // which means expected message is in description message = t.getMessage(); - if (message.indexOf(IDL) > -1) { + if (message.contains(IDL)) { // 2nd case: search in description message = DevFailedUtils.toString((DevFailed) t); int index = message.indexOf(DESC); diff --git a/core/pv/src/main/java/org/phoebus/pv/sys/TimeOffsetPV.java b/core/pv/src/main/java/org/phoebus/pv/sys/TimeOffsetPV.java index ac649f971c..a56a0e00e0 100644 --- a/core/pv/src/main/java/org/phoebus/pv/sys/TimeOffsetPV.java +++ b/core/pv/src/main/java/org/phoebus/pv/sys/TimeOffsetPV.java @@ -38,7 +38,7 @@ public static TimeOffsetPV forParameters(final String name, final List p if(parameters.size() == 1) { return new TimeOffsetPV(name, parameters.get(0), TimestampFormats.SECONDS_FORMAT, 1.0); } else if (parameters.size() == 2) { - return new TimeOffsetPV(name, parameters.get(0), TimestampFormats.SECONDS_FORMAT, Double.valueOf(parameters.get(1))); + return new TimeOffsetPV(name, parameters.get(0), TimestampFormats.SECONDS_FORMAT, Double.parseDouble(parameters.get(1))); } else if (parameters.size() == 3) { DateTimeFormatter formatter; switch (parameters.get(1).toLowerCase()) { @@ -64,7 +64,7 @@ public static TimeOffsetPV forParameters(final String name, final List p formatter = TimestampFormats.SECONDS_FORMAT; break; } - return new TimeOffsetPV(name, parameters.get(0), formatter, Double.valueOf(parameters.get(2))); + return new TimeOffsetPV(name, parameters.get(0), formatter, Double.parseDouble(parameters.get(2))); } } else { return new TimeOffsetPV(name, "now", TimestampFormats.SECONDS_FORMAT, 1.0); diff --git a/core/pva/src/main/java/org/epics/pva/client/PutRequest.java b/core/pva/src/main/java/org/epics/pva/client/PutRequest.java index 0acbde9548..a758823623 100644 --- a/core/pva/src/main/java/org/epics/pva/client/PutRequest.java +++ b/core/pva/src/main/java/org/epics/pva/client/PutRequest.java @@ -154,8 +154,8 @@ public void encodeRequest(final byte version, final ByteBuffer buffer) throws Ex // Must also set bits for the elements of the structure List elements = struct.get(); if(elements != null){ - for(int i = 0; i < elements.size(); i++){ - changed.set(data.getIndex(elements.get(i))); + for (PVAData element : elements) { + changed.set(data.getIndex(element)); } } } diff --git a/core/pva/src/main/java/org/epics/pva/data/PVABoolArray.java b/core/pva/src/main/java/org/epics/pva/data/PVABoolArray.java index 2c906f2e25..15b1df5fc0 100644 --- a/core/pva/src/main/java/org/epics/pva/data/PVABoolArray.java +++ b/core/pva/src/main/java/org/epics/pva/data/PVABoolArray.java @@ -106,8 +106,7 @@ public void encode(final ByteBuffer buffer) throws Exception { final boolean[] copy = value; PVASize.encodeSize(copy.length, buffer); - for (int i=0; i { try { return PVAScalar.doubleArrayScalarBuilder( - dArray.stream().mapToDouble((d) -> d.doubleValue()).toArray()) + dArray.stream().mapToDouble((d) -> d).toArray()) .name(pvName) .build(); } catch (PVAScalarValueNameException | PVAScalarDescriptionNameException e) { diff --git a/core/ui/src/main/java/org/phoebus/ui/javafx/StringTable.java b/core/ui/src/main/java/org/phoebus/ui/javafx/StringTable.java index 9618757721..6c48a2f35f 100644 --- a/core/ui/src/main/java/org/phoebus/ui/javafx/StringTable.java +++ b/core/ui/src/main/java/org/phoebus/ui/javafx/StringTable.java @@ -1192,9 +1192,7 @@ private void addColumn() // Add new column createTableColumn(column, name); // Add empty col. to data - for (int r=0; r row = data.get(r); + for (final List row : data) { if (row == MAGIC_LAST_ROW) break; row.add(column, new ObservableCellValue("")); @@ -1238,9 +1236,7 @@ private void moveColumn(final int column, final int target) table.getColumns().add(target, col); // Move column in data - for (int r=0; r data_row = data.get(r); + for (final List data_row : data) { if (data_row == MAGIC_LAST_ROW) break; data_row.add(target, data_row.remove(column)); @@ -1266,9 +1262,7 @@ private void deleteColumn() // Update table columns table.getColumns().remove(column); // Remove that column from data - for (int r=0; r row = data.get(r); + for (final List row : data) { if (row == MAGIC_LAST_ROW) break; if (column < row.size()) diff --git a/core/ui/src/main/java/org/phoebus/ui/vtype/SexagesimalFormat.java b/core/ui/src/main/java/org/phoebus/ui/vtype/SexagesimalFormat.java index 680cfee506..df262bdaba 100644 --- a/core/ui/src/main/java/org/phoebus/ui/vtype/SexagesimalFormat.java +++ b/core/ui/src/main/java/org/phoebus/ui/vtype/SexagesimalFormat.java @@ -89,7 +89,7 @@ else if (precision == 4) private static double parseDouble(final String text) throws NumberFormatException { - return Double.valueOf(text.replace('e', 'E')); + return Double.parseDouble(text.replace('e', 'E')); } /** Parse sexagesimal text diff --git a/core/util/src/main/java/org/phoebus/util/time/TimeParser.java b/core/util/src/main/java/org/phoebus/util/time/TimeParser.java index 63da4f0662..4e551ed5d4 100644 --- a/core/util/src/main/java/org/phoebus/util/time/TimeParser.java +++ b/core/util/src/main/java/org/phoebus/util/time/TimeParser.java @@ -110,7 +110,7 @@ public static Duration parseDuration(String string) { Map timeQuantities = new HashMap<>(); while (timeQunatityUnitsMatcher.find()) { quantity = "".equals(timeQunatityUnitsMatcher.group(1)) ? 1 - : Integer.valueOf(timeQunatityUnitsMatcher.group(1)); + : Integer.parseInt(timeQunatityUnitsMatcher.group(1)); unit = timeQunatityUnitsMatcher.group(2).toLowerCase(); switch (unit) { case "ms": @@ -180,7 +180,7 @@ public static TemporalAmount parseTemporalAmount(final String string) { final double quantity = "".equals(timeQuantityUnitsMatcher.group(1)) ? 1.0 - : Double.valueOf(timeQuantityUnitsMatcher.group(1)); + : Double.parseDouble(timeQuantityUnitsMatcher.group(1)); final int full = (int) quantity; final double fraction = quantity - full; final String unit = timeQuantityUnitsMatcher.group(2).toLowerCase(); diff --git a/core/vtype/src/main/java/org/phoebus/core/vtypes/VTypeHelper.java b/core/vtype/src/main/java/org/phoebus/core/vtypes/VTypeHelper.java index 6011f7bc21..e6b2cc5db3 100644 --- a/core/vtype/src/main/java/org/phoebus/core/vtypes/VTypeHelper.java +++ b/core/vtype/src/main/java/org/phoebus/core/vtypes/VTypeHelper.java @@ -331,7 +331,7 @@ public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; - return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); + return VDouble.of(number.getValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber number = (VNumber) value; diff --git a/services/alarm-logger/src/main/java/org/phoebus/alarm/logging/AlarmLoggingService.java b/services/alarm-logger/src/main/java/org/phoebus/alarm/logging/AlarmLoggingService.java index da2d866639..de0667aeb4 100644 --- a/services/alarm-logger/src/main/java/org/phoebus/alarm/logging/AlarmLoggingService.java +++ b/services/alarm-logger/src/main/java/org/phoebus/alarm/logging/AlarmLoggingService.java @@ -254,7 +254,7 @@ else if (cmd.equals("-logging")) int threadPoolSize = topicNames.size() * 2; // default to 2 threads per topic Scheduler = Executors.newScheduledThreadPool(threadPoolSize); - final boolean standalone = Boolean.valueOf(properties.getProperty("standalone")); + final boolean standalone = Boolean.parseBoolean(properties.getProperty("standalone")); // If the standalone is true, ignore the Schedulers for AlarmMessageLogger and AlarmCmdLogger // otherwise run the Alarm Logger service as is. diff --git a/services/archive-engine/src/main/java/org/csstudio/archive/engine/model/SampleBuffer.java b/services/archive-engine/src/main/java/org/csstudio/archive/engine/model/SampleBuffer.java index 63e354ea9a..bc36693127 100644 --- a/services/archive-engine/src/main/java/org/csstudio/archive/engine/model/SampleBuffer.java +++ b/services/archive-engine/src/main/java/org/csstudio/archive/engine/model/SampleBuffer.java @@ -120,7 +120,7 @@ void add(final VType value) if (samples.isFull()) { // Note start of overruns, then drop older sample if (start_of_overruns == null) - start_of_overruns = Integer.valueOf(stats.getOverruns()); + start_of_overruns = stats.getOverruns(); stats.addOverrun(); } else if (start_of_overruns != null) diff --git a/services/archive-engine/src/main/java/org/csstudio/archive/writer/rdb/PGCopyPreparedStatement.java b/services/archive-engine/src/main/java/org/csstudio/archive/writer/rdb/PGCopyPreparedStatement.java index 1c3722c28f..eea6bac938 100644 --- a/services/archive-engine/src/main/java/org/csstudio/archive/writer/rdb/PGCopyPreparedStatement.java +++ b/services/archive-engine/src/main/java/org/csstudio/archive/writer/rdb/PGCopyPreparedStatement.java @@ -86,14 +86,14 @@ public PGCopyPreparedStatement(Connection connection, String insertSqlQuery) throw new SQLException("Unable to find column " + columnName + " in table " + tableName); } - columnOrderMapping[i + 1] = postgresColumnOrder.intValue() - 1; + columnOrderMapping[i + 1] = postgresColumnOrder - 1; } } @Override public void addBatch() throws SQLException { - for (int i = 0; i < rowValues.length; i++) { - if (rowValues[i] != null) { + for (String rowValue : rowValues) { + if (rowValue != null) { // If the value contains the delimiter char, the QUOTE char, // the NULL string, a carriage return, or line feed char, // then the whole value is prefixed and suffixed by the QUOTE char, @@ -101,13 +101,13 @@ public void addBatch() throws SQLException { // ESCAPE char is preceded by the escape char // ESCAPE defaults to QUOTE which defaults to " double quote // delimiter char defaults to , comma - final String[] metaCharacters = {",","\"","NULL","\\n","\\r"}; - String inputRow = rowValues[i]; - if(rowValues[i].contains("\"")) - inputRow = inputRow.replace("\"","\"\""); - for (int j = 0 ; j < metaCharacters.length ; j++){ - if(rowValues[i].toLowerCase(). - contains(metaCharacters[j].toLowerCase())){ + final String[] metaCharacters = {",", "\"", "NULL", "\\n", "\\r"}; + String inputRow = rowValue; + if (rowValue.contains("\"")) + inputRow = inputRow.replace("\"", "\"\""); + for (String metaCharacter : metaCharacters) { + if (rowValue.toLowerCase(). + contains(metaCharacter.toLowerCase())) { inputRow = "\"" + inputRow + "\""; break; } @@ -543,8 +543,8 @@ public void setBytes(int parameterIndex, byte[] x) throws SQLException { public static String bytesToByteA(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length * 4); int v; - for (int j = 0; j < bytes.length; j++) { - v = bytes[j] & 0xFF; + for (byte aByte : bytes) { + v = aByte & 0xFF; sb.append("\\"); String octal = Integer.toString(v, 8); int nbHeadingZeroToadd = 3 - octal.length(); diff --git a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/CompositeSnapshotController.java b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/CompositeSnapshotController.java index 2d23143353..e88e3b39ca 100644 --- a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/CompositeSnapshotController.java +++ b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/CompositeSnapshotController.java @@ -94,7 +94,7 @@ public CompositeSnapshot updateCompositeSnapshot(@RequestBody CompositeSnapshot } compositeSnapshot.getCompositeSnapshotNode().setUserName(principal.getName()); CompositeSnapshot updatedCompositeSnapshot = nodeDAO.updateCompositeSnapshot(compositeSnapshot); - webSocketService.sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_UPDATED, updatedCompositeSnapshot.getCompositeSnapshotNode())); + webSocketService.sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_UPDATED, updatedCompositeSnapshot.getCompositeSnapshotNode())); return updatedCompositeSnapshot; } diff --git a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/ConfigurationController.java b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/ConfigurationController.java index 671fde1032..8194a083e7 100644 --- a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/ConfigurationController.java +++ b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/ConfigurationController.java @@ -109,7 +109,7 @@ public Configuration updateConfiguration(@RequestBody Configuration configuratio Principal principal) { configuration.getConfigurationNode().setUserName(principal.getName()); Configuration updatedConfiguration = nodeDAO.updateConfiguration(configuration); - webSocketService.sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_UPDATED, updatedConfiguration.getConfigurationNode())); + webSocketService.sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_UPDATED, updatedConfiguration.getConfigurationNode())); return updatedConfiguration; } } diff --git a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/FilterController.java b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/FilterController.java index c99b96ec28..48643207f2 100644 --- a/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/FilterController.java +++ b/services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/web/controllers/FilterController.java @@ -87,6 +87,6 @@ public List getAllFilters() { @PreAuthorize("@authorizationHelper.maySaveOrDeleteFilter(#name, #root)") public void deleteFilter(@PathVariable final String name, Principal principal) { nodeDAO.deleteFilter(name); - webSocketService.sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.FILTER_REMOVED, name)); + webSocketService.sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.FILTER_REMOVED, name)); } } diff --git a/services/save-and-restore/src/test/java/org/phoebus/service/saveandrestore/web/controllers/NodeControllerTest.java b/services/save-and-restore/src/test/java/org/phoebus/service/saveandrestore/web/controllers/NodeControllerTest.java index 6d78e9442b..65619d5142 100644 --- a/services/save-and-restore/src/test/java/org/phoebus/service/saveandrestore/web/controllers/NodeControllerTest.java +++ b/services/save-and-restore/src/test/java/org/phoebus/service/saveandrestore/web/controllers/NodeControllerTest.java @@ -469,12 +469,12 @@ public void testDeleteForbiddenAccess2() throws Exception { .header(HttpHeaders.AUTHORIZATION, readOnlyAuthorization); mockMvc.perform(request).andExpect(status().isForbidden()); - verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_REMOVED, "b")); + verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_REMOVED, "b")); when(nodeDAO.getNode("a")).thenReturn(Node.builder().uniqueId("a").nodeType(NodeType.CONFIGURATION).userName(demoUser).build()); when(nodeDAO.getChildNodes("a")).thenReturn(Collections.emptyList()); - verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_REMOVED, "b")); + verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_REMOVED, "b")); } @@ -523,7 +523,7 @@ public void testDeleteForbidden3() throws Exception { .header(HttpHeaders.AUTHORIZATION, userAuthorization); mockMvc.perform(request).andExpect(status().isForbidden()); - verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_REMOVED, "b")); + verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_REMOVED, "b")); } @Test @@ -538,7 +538,7 @@ public void testDeleteForbidden4() throws Exception { .header(HttpHeaders.AUTHORIZATION, userAuthorization); mockMvc.perform(request).andExpect(status().isForbidden()); - verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage(SaveAndRestoreMessageType.NODE_REMOVED, "b")); + verify(webSocketService, times(0)).sendMessageToClients(new WebSocketMessage<>(SaveAndRestoreMessageType.NODE_REMOVED, "b")); } diff --git a/services/scan-server/src/main/java/org/csstudio/scan/server/internal/ExecutableScan.java b/services/scan-server/src/main/java/org/csstudio/scan/server/internal/ExecutableScan.java index 0b64550218..096cfcf271 100644 --- a/services/scan-server/src/main/java/org/csstudio/scan/server/internal/ExecutableScan.java +++ b/services/scan-server/src/main/java/org/csstudio/scan/server/internal/ExecutableScan.java @@ -571,8 +571,8 @@ private void executeOrDieTrying() throws Exception { getDevice(device_status.get()).write(getName()); ScanCommandUtil.write(this, device_state.get(), getScanState().ordinal()); - ScanCommandUtil.write(this, device_active.get(), Double.valueOf(1.0)); - ScanCommandUtil.write(this, device_progress.get(), Double.valueOf(0.0)); + ScanCommandUtil.write(this, device_active.get(), 1.0); + ScanCommandUtil.write(this, device_progress.get(), 0.0); getDevice(device_finish.get()).write("Starting ..."); logger.log(Level.INFO, this + " sets " + device_active.get() + " = 1.0"); } @@ -652,7 +652,7 @@ else if (state.get() == ScanState.Aborted) ScanCommandUtil.write(this, device_state.get(), getScanState().ordinal(), true, true, device_state.get(), 0.1, state_pv_update_timeout); logger.log(Level.INFO, this + " sets " + device_state.get() + " = " + getScanState()); getDevice(device_finish.get()).write(TimestampFormats.MILLI_FORMAT.format(Instant.now())); - ScanCommandUtil.write(this, device_progress.get(), Double.valueOf(100.0)); + ScanCommandUtil.write(this, device_progress.get(), 100.0); // Update to "anything else running?" final int active = engine.hasPendingScans() ? 1 : 0; ScanCommandUtil.write(this, device_active.get(), active); @@ -706,7 +706,7 @@ public void execute(final ScanCommandImpl command) throws Exception final ScanInfo info = getScanInfo(); try { - ScanCommandUtil.write(this, device_progress.get(), Double.valueOf(info.getPercentage())); + ScanCommandUtil.write(this, device_progress.get(), (double) info.getPercentage()); getDevice(device_finish.get()).write(TimestampFormats.formatCompactDateTime(info.getFinishTime())); } catch (Exception ex)