Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ics-software
phoebus
Commits
57a04648
Unverified
Commit
57a04648
authored
May 20, 2022
by
Georg Weiss
Committed by
GitHub
May 20, 2022
Browse files
Merge pull request #2266 from ControlSystemStudio/log_properties_fix
Added null pointer check for classpath case
parents
5ed0ed56
0f8ff203
Pipeline
#113185
passed with stage
in 16 minutes and 7 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/LogPropertiesController.java
View file @
57a04648
...
...
@@ -28,6 +28,7 @@ import java.net.URI;
import
java.net.URL
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.stream.Collectors
;
...
...
@@ -61,21 +62,26 @@ public class LogPropertiesController {
}
else
if
(
url
.
startsWith
(
"classpath:"
)){
final
URL
resource
=
getClass
().
getResource
(
url
.
substring
(
"classpath:"
.
length
()));
url
=
resource
.
toExternalForm
();
// Null pointer check here as the path may be incorrect
if
(
resource
==
null
){
logger
.
log
(
Level
.
WARNING
,
"Log properties attribute URL "
+
url
+
" is invalid"
);
}
else
{
url
=
resource
.
toExternalForm
();
}
}
try
(
InputStream
input
=
new
URL
(
url
).
openStream
()
)
{
Properties
prop
=
new
Properties
();
prop
.
load
(
input
);
prop
.
stringPropertyNames
().
stream
().
forEach
((
p
)
->
{
attributeTypes
.
put
(
p
.
toLowerCase
(),
prop
.
getProperty
(
p
).
toLowerCase
());
}
attributeTypes
.
put
(
p
.
toLowerCase
(),
prop
.
getProperty
(
p
).
toLowerCase
());
}
);
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
(
);
logger
.
log
(
Level
.
WARNING
,
"Unable to load log properties attribute mapping"
);
}
// create the property trees
name
.
setMaxWidth
(
1
f
*
Integer
.
MAX_VALUE
*
40
);
name
.
setCellValueFactory
(
...
...
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