lkishalmi commented on code in PR #6660:
URL: https://github.com/apache/netbeans/pull/6660#discussion_r1382679117
##########
platform/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java:
##########
@@ -583,27 +578,21 @@ private void initPreview() {
}
previewInputOutput.getOut().close();
previewInputOutput.getErr().close();
- outputOptions.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if
(!evt.getPropertyName().equals(OutputOptions.PROP_INITIALIZED)
- && outputOptions.isInitialized()) {
- controller.changed(outputOptions.isChanged());
- }
- updateControlsByModel();
+ outputOptions.addPropertyChangeListener((PropertyChangeEvent evt) -> {
+ if (!evt.getPropertyName().equals(OutputOptions.PROP_INITIALIZED)
+ && outputOptions.isInitialized()) {
+ controller.changed(outputOptions.isChanged());
}
+ updateControlsByModel();
});
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- Component component = previewPanel.getComponent(0);
- if (component instanceof AbstractOutputTab) {
- ((AbstractOutputTab) component).inputSent("Input from
keyboard");
- }
- try {
- in.close();
- } catch (IOException ex) {}
+ SwingUtilities.invokeLater(() -> {
+ Component component1 = previewPanel.getComponent(0);
+ if (component1 instanceof AbstractOutputTab) {
+ ((AbstractOutputTab) component1).inputSent("Input from
keyboard");
}
+ try {
+ in.close();
Review Comment:
Just a nuance, caught my attention to get a reader closed in AWT, made me
worry if we do write on that stream on a different thread.
Removing the otherwise unused `in` variable and use
`previewInputOutput.getIn().close()` would make this more clear.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists