Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 37-correct-explicit-links-from-fcda
  • 58-add-some-information-in-readme-before-mirroring-on-github
  • 66-getnamespace-is-needed-for-most-elements
  • master
  • optimCompilOCLinEcore
  • optimCompileOclInEcore
  • optimOCLinEcore
  • v1.0.0
  • v1.0.1
9 results

Target

Select target project
  • RiseClipseGroup/riseclipse-metamodel-scl2003
1 result
Select Git revision
  • 37-correct-explicit-links-from-fcda
  • 58-add-some-information-in-readme-before-mirroring-on-github
  • 66-getnamespace-is-needed-for-most-elements
  • master
  • optimCompilOCLinEcore
  • optimCompileOclInEcore
  • optimOCLinEcore
  • v1.0.0
  • v1.0.1
9 results
Show changes
Commits on Source (2)
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package fr.centralesupelec.edf.riseclipse.iec61850.scl.util; package fr.centralesupelec.edf.riseclipse.iec61850.scl.util;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
...@@ -59,6 +60,9 @@ public class SclUtilities { ...@@ -59,6 +60,9 @@ public class SclUtilities {
} }
public static Pair< IED, Integer > getIED( @NonNull SCL scl, @NonNull String iedName ) { 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 = List< IED > res =
scl scl
.getIED() .getIED()
...@@ -73,6 +77,9 @@ public class SclUtilities { ...@@ -73,6 +77,9 @@ public class SclUtilities {
} }
public static Pair< AccessPoint, Integer > getAccessPoint( @NonNull IED ied, @NonNull String apName ) { 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 = List< AccessPoint > res =
ied ied
.getAccessPoint() .getAccessPoint()
...@@ -87,9 +94,11 @@ public class SclUtilities { ...@@ -87,9 +94,11 @@ public class SclUtilities {
} }
public static Pair< LDevice, Integer > getLDevice( @NonNull AccessPoint accessPoint, @NonNull String ldInst ) { public static Pair< LDevice, Integer > getLDevice( @NonNull AccessPoint accessPoint, @NonNull String ldInst ) {
if( accessPoint.getServer() == null ) { // protect against NPE
return Pair.of( null, 0 ); 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 = List< LDevice > res =
accessPoint accessPoint
.getServer() .getServer()
...@@ -105,6 +114,10 @@ public class SclUtilities { ...@@ -105,6 +114,10 @@ public class SclUtilities {
} }
public static Pair< LDevice, Integer > getLDevice( @NonNull IED ied, @NonNull String ldInst ) { 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 = List< LDevice > res =
ied ied
.getAccessPoint() .getAccessPoint()
...@@ -127,11 +140,16 @@ public class SclUtilities { ...@@ -127,11 +140,16 @@ public class SclUtilities {
if( "LLN0".equals( lnClass )) { if( "LLN0".equals( lnClass )) {
return Pair.of( lDevice.getLN0(), ( lDevice.getLN0() == null ) ? 0 : 1 ); 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 = List< LN > res =
lDevice lDevice
.getLN() .getLN()
.stream() .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() ); .collect( Collectors.toList() );
if( res.size() != 1 ) { if( res.size() != 1 ) {
return Pair.of( null, res.size() ); return Pair.of( null, res.size() );
......