Prevent NPE, throw meaningful runtime exception in it's place, FELIX-1438
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@800024 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryConfiguration.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryConfiguration.java
index 8f2aca7..e8a3aca 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryConfiguration.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryConfiguration.java
@@ -169,8 +169,12 @@
//int level = findLevel( key + LEVEL, type, prefs );
ArrayList<IRepositoryModel> reps = new ArrayList<IRepositoryModel>();
for ( String s : PrefsUtils.stringToArray( getPreferences().getString( REPOSITORY_DEFAULT_SET ) ) )
- {
- reps.add( findRepository( s ) );
+ {
+ IRepositoryModel rep = findRepository( s );
+ if ( rep == null ) {
+ throw new IllegalStateException( "Missing repository for " + s );
+ }
+ reps.add( rep );
}
return new RepositorySet( reps );
}
@@ -184,7 +188,11 @@
ArrayList<IRepositoryModel> reps = new ArrayList<IRepositoryModel>();
for ( String s : PrefsUtils.stringToArray( getPreferences().getString( key ) ) )
{
- reps.add( findRepository( s ) );
+ IRepositoryModel rep = findRepository( s );
+ if ( rep == null ) {
+ throw new IllegalStateException( "Missing repository for " + s );
+ }
+ reps.add( rep );
}
return new RepositorySet( reps );
}