From c08d4fde5ccb722150fae8a7a4191ed54565c1c3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 25 Jun 2015 12:50:40 +0200 Subject: [PATCH] Using static import to reduce code bloat in Serial.java --- arduino-core/src/processing/app/Serial.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arduino-core/src/processing/app/Serial.java b/arduino-core/src/processing/app/Serial.java index c411d2594..8a678dbce 100644 --- a/arduino-core/src/processing/app/Serial.java +++ b/arduino-core/src/processing/app/Serial.java @@ -32,7 +32,7 @@ import java.util.Arrays; import java.util.List; import static processing.app.I18n._; - +import static processing.app.I18n.format; public class Serial implements SerialPortEventListener { @@ -84,7 +84,7 @@ public class Serial implements SerialPortEventListener { serialPort.closePort(); return true; } catch (SerialPortException e) { - throw new SerialException(I18n.format(_("Error touching serial port ''{0}''."), iname), e); + throw new SerialException(format(_("Error touching serial port ''{0}''."), iname), e); } finally { if (serialPort.isOpened()) { try { @@ -116,13 +116,13 @@ public class Serial implements SerialPortEventListener { port.addEventListener(this); } catch (SerialPortException e) { if (e.getPortName().startsWith("/dev") && SerialPortException.TYPE_PERMISSION_DENIED.equals(e.getExceptionType())) { - throw new SerialException(I18n.format(_("Error opening serial port ''{0}''. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission"), iname)); + throw new SerialException(format(_("Error opening serial port ''{0}''. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission"), iname)); } - throw new SerialException(I18n.format(_("Error opening serial port ''{0}''."), iname), e); + throw new SerialException(format(_("Error opening serial port ''{0}''."), iname), e); } if (port == null) { - throw new SerialNotFoundException(I18n.format(_("Serial port ''{0}'' not found. Did you select the right one from the Tools > Serial Port menu?"), iname)); + throw new SerialNotFoundException(format(_("Serial port ''{0}'' not found. Did you select the right one from the Tools > Serial Port menu?"), iname)); } } @@ -231,7 +231,7 @@ public class Serial implements SerialPortEventListener { * I think of something slightly more intelligent to do. */ private static void errorMessage(String where, Throwable e) { - System.err.println(I18n.format(_("Error inside Serial.{0}()"), where)); + System.err.println(format(_("Error inside Serial.{0}()"), where)); e.printStackTrace(); } }