From 03fcbc89eeb0c198be507fe48a70ebce1a759843 Mon Sep 17 00:00:00 2001 From: Kai Brassel <mail@khbrassel.de> Date: Thu, 10 Jun 2021 12:06:06 +0200 Subject: [PATCH] Simplify Eclipse logging using Platform.getLog() --- .../cityunits/model/NullableQuantity.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java b/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java index 3c8ad9d..f85f1a5 100644 --- a/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java +++ b/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java @@ -27,8 +27,6 @@ import tech.units.indriya.quantity.Quantities; * of the quantity is always defined. */ public class NullableQuantity { - private static final Bundle BUNDLE = FrameworkUtil.getBundle(NullableQuantity.class); - private static final ILog LOGGER = Platform.getLog(BUNDLE); static { // TODO Implement specific QuantityFormat to enable custom number format? @@ -43,22 +41,17 @@ public class NullableQuantity { public static NullableQuantity create(String str) { NullableQuantity newNullableQuantity = null; try { - LOGGER.log(new Status(Status.INFO, BUNDLE.getSymbolicName(), "Create Quantity from " + str)); NumberFormat.getInstance().parse(str); newNullableQuantity = new NullableQuantity(str); } catch (final ParseException ex) { // no number value present: create NullQuantity just with unit try { NullableQuantity dummy = new NullableQuantity("1 " + str); //$NON-NLS-1$ - LOGGER.log(new Status(Status.INFO, BUNDLE.getSymbolicName(), - "Create Quantity just with unit from " + str)); newNullableQuantity = new NullQuantity(dummy.getUnit()); } catch (final IllegalArgumentException ex1) { // Unit could not be parsed - LOGGER.log(new Status(Status.WARNING, BUNDLE.getSymbolicName(), - "Unit '" + str + "' could not be parsed!", ex)); + Platform.getLog(NullableQuantity.class).warn("Unit '" + str + "' could not be parsed!", ex); } } catch (final IllegalArgumentException ex) { // Quantity could not be parsed - LOGGER.log(new Status(Status.WARNING, BUNDLE.getSymbolicName(), - "Quantity '" + str + "' could not be parsed!", ex)); + Platform.getLog(NullableQuantity.class).warn("Quantity '" + str + "' could not be parsed!", ex); } return newNullableQuantity; } -- GitLab