Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NeqModPlus
de.hft-stuttgart.cityunits
Commits
03fcbc89
Commit
03fcbc89
authored
3 years ago
by
Kai-Holger Brassel
Browse files
Options
Download
Email Patches
Plain Diff
Simplify Eclipse logging using Platform.getLog()
parent
5d4723b9
master
housekeeping
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java
+2
-9
...src/de/hftstuttgart/cityunits/model/NullableQuantity.java
with
2 additions
and
9 deletions
+2
-9
de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java
+
2
-
9
View file @
03fcbc89
...
@@ -27,8 +27,6 @@ import tech.units.indriya.quantity.Quantities;
...
@@ -27,8 +27,6 @@ import tech.units.indriya.quantity.Quantities;
* of the quantity is always defined.
* of the quantity is always defined.
*/
*/
public
class
NullableQuantity
{
public
class
NullableQuantity
{
private
static
final
Bundle
BUNDLE
=
FrameworkUtil
.
getBundle
(
NullableQuantity
.
class
);
private
static
final
ILog
LOGGER
=
Platform
.
getLog
(
BUNDLE
);
static
{
static
{
// TODO Implement specific QuantityFormat to enable custom number format?
// TODO Implement specific QuantityFormat to enable custom number format?
...
@@ -43,22 +41,17 @@ public class NullableQuantity {
...
@@ -43,22 +41,17 @@ public class NullableQuantity {
public
static
NullableQuantity
create
(
String
str
)
{
public
static
NullableQuantity
create
(
String
str
)
{
NullableQuantity
newNullableQuantity
=
null
;
NullableQuantity
newNullableQuantity
=
null
;
try
{
try
{
LOGGER
.
log
(
new
Status
(
Status
.
INFO
,
BUNDLE
.
getSymbolicName
(),
"Create Quantity from "
+
str
));
NumberFormat
.
getInstance
().
parse
(
str
);
NumberFormat
.
getInstance
().
parse
(
str
);
newNullableQuantity
=
new
NullableQuantity
(
str
);
newNullableQuantity
=
new
NullableQuantity
(
str
);
}
catch
(
final
ParseException
ex
)
{
// no number value present: create NullQuantity just with unit
}
catch
(
final
ParseException
ex
)
{
// no number value present: create NullQuantity just with unit
try
{
try
{
NullableQuantity
dummy
=
new
NullableQuantity
(
"1 "
+
str
);
//$NON-NLS-1$
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
());
newNullableQuantity
=
new
NullQuantity
(
dummy
.
getUnit
());
}
catch
(
final
IllegalArgumentException
ex1
)
{
// Unit could not be parsed
}
catch
(
final
IllegalArgumentException
ex1
)
{
// Unit could not be parsed
LOGGER
.
log
(
new
Status
(
Status
.
WARNING
,
BUNDLE
.
getSymbolicName
(),
Platform
.
getLog
(
NullableQuantity
.
class
).
warn
(
"Unit '"
+
str
+
"' could not be parsed!"
,
ex
);
"Unit '"
+
str
+
"' could not be parsed!"
,
ex
));
}
}
}
catch
(
final
IllegalArgumentException
ex
)
{
// Quantity could not be parsed
}
catch
(
final
IllegalArgumentException
ex
)
{
// Quantity could not be parsed
LOGGER
.
log
(
new
Status
(
Status
.
WARNING
,
BUNDLE
.
getSymbolicName
(),
Platform
.
getLog
(
NullableQuantity
.
class
).
warn
(
"Quantity '"
+
str
+
"' could not be parsed!"
,
ex
);
"Quantity '"
+
str
+
"' could not be parsed!"
,
ex
));
}
}
return
newNullableQuantity
;
return
newNullableQuantity
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets