We need to check to see if we have additional native library
extensions before accessing them. (FELIX-1580)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@813853 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
index a28c34c..c256a36 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
@@ -109,10 +109,15 @@
                 return true;
             }
 
-            int idx = libname.lastIndexOf(".");
-            libname = (idx < 0)
-                ? libname + "." + exts[extIdx++]
-                : libname.substring(0, idx) + "." + exts[extIdx++];
+            // If we have other native library extensions to try, then
+            // calculate the new native library name.
+            if (extIdx < exts.length)
+            {
+                int idx = libname.lastIndexOf(".");
+                libname = (idx < 0)
+                    ? libname + "." + exts[extIdx++]
+                    : libname.substring(0, idx) + "." + exts[extIdx++];
+            }
         }
         while ((exts != null) && (extIdx < exts.length));