Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
riseclipse-metamodel-scl2003
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RiseClipseGroup
riseclipse-metamodel-scl2003
Compare revisions
8594ebb09fc4c23cacf0f31b7dcb8119865f900d to 56ebb322d4c1f447f64580ad7be499989f49b796
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
RiseClipseGroup/riseclipse-metamodel-scl2003
Select target project
No results found
56ebb322d4c1f447f64580ad7be499989f49b796
Select Git revision
Swap
Target
RiseClipseGroup/riseclipse-metamodel-scl2003
Select target project
RiseClipseGroup/riseclipse-metamodel-scl2003
1 result
8594ebb09fc4c23cacf0f31b7dcb8119865f900d
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
protect SclUtilities.getAnyLN() against NPE
· cf0e7f88
Dominique Marcadet
authored
5 years ago
cf0e7f88
avoid other potential NPE
· 56ebb322
Dominique Marcadet
authored
5 years ago
56ebb322
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/util/SclUtilities.java
+22
-4
22 additions, 4 deletions
...upelec/edf/riseclipse/iec61850/scl/util/SclUtilities.java
with
22 additions
and
4 deletions
fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/util/SclUtilities.java
View file @
56ebb322
...
...
@@ -21,6 +21,7 @@
package
fr.centralesupelec.edf.riseclipse.iec61850.scl.util
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.tuple.Pair
;
...
...
@@ -59,6 +60,9 @@ public class SclUtilities {
}
public
static
Pair
<
IED
,
Integer
>
getIED
(
@NonNull
SCL
scl
,
@NonNull
String
iedName
)
{
// protect against NPE
if
(
scl
==
null
)
return
Pair
.
of
(
null
,
0
);
List
<
IED
>
res
=
scl
.
getIED
()
...
...
@@ -73,6 +77,9 @@ public class SclUtilities {
}
public
static
Pair
<
AccessPoint
,
Integer
>
getAccessPoint
(
@NonNull
IED
ied
,
@NonNull
String
apName
)
{
// protect against NPE
if
(
ied
==
null
)
return
Pair
.
of
(
null
,
0
);
List
<
AccessPoint
>
res
=
ied
.
getAccessPoint
()
...
...
@@ -87,9 +94,11 @@ public class SclUtilities {
}
public
static
Pair
<
LDevice
,
Integer
>
getLDevice
(
@NonNull
AccessPoint
accessPoint
,
@NonNull
String
ldInst
)
{
if
(
accessPoint
.
getServer
()
==
null
)
{
return
Pair
.
of
(
null
,
0
);
}
// protect against NPE
if
(
ldInst
==
null
)
return
Pair
.
of
(
null
,
0
);
if
(
accessPoint
==
null
)
return
Pair
.
of
(
null
,
0
);
if
(
accessPoint
.
getServer
()
==
null
)
return
Pair
.
of
(
null
,
0
);
List
<
LDevice
>
res
=
accessPoint
.
getServer
()
...
...
@@ -105,6 +114,10 @@ public class SclUtilities {
}
public
static
Pair
<
LDevice
,
Integer
>
getLDevice
(
@NonNull
IED
ied
,
@NonNull
String
ldInst
)
{
// protect against NPE
if
(
ldInst
==
null
)
return
Pair
.
of
(
null
,
0
);
if
(
ied
==
null
)
return
Pair
.
of
(
null
,
0
);
List
<
LDevice
>
res
=
ied
.
getAccessPoint
()
...
...
@@ -127,11 +140,16 @@ public class SclUtilities {
if
(
"LLN0"
.
equals
(
lnClass
))
{
return
Pair
.
of
(
lDevice
.
getLN0
(),
(
lDevice
.
getLN0
()
==
null
)
?
0
:
1
);
}
// Null checks must be done as annotation-based null analysis is not enabled (issue #64)
if
(
lnClass
==
null
)
return
Pair
.
of
(
null
,
0
);
if
(
lnInst
==
null
)
return
Pair
.
of
(
null
,
0
);
List
<
LN
>
res
=
lDevice
.
getLN
()
.
stream
()
.
filter
(
ln
->
lnClass
.
equals
(
ln
.
getLnClass
()
)
&&
lnInst
.
equals
(
ln
.
getInst
()
)
&&
prefix
.
equals
(
ln
.
getPrefix
()
))
.
filter
(
ln
->
lnClass
.
equals
(
ln
.
getLnClass
()
)
&&
lnInst
.
equals
(
ln
.
getInst
()
)
&&
Objects
.
equals
(
prefix
,
ln
.
getPrefix
()
))
.
collect
(
Collectors
.
toList
()
);
if
(
res
.
size
()
!=
1
)
{
return
Pair
.
of
(
null
,
res
.
size
()
);
...
...
This diff is collapsed.
Click to expand it.