cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [34/50] [abbrv] git commit: CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace
Date Wed, 22 Jan 2014 19:38:45 GMT
CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/91729b30
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/91729b30
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/91729b30

Branch: refs/heads/master
Commit: 91729b302fef43668de8f72193093a27fdf2bd7a
Parents: 6fee8d8
Author: HÃ¥kon Nilsen <hnilsen@gmail.com>
Authored: Wed Dec 4 21:06:15 2013 +0100
Committer: Joe Bowser <bowserj@apache.org>
Committed: Wed Jan 22 11:37:21 2014 -0800

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Config.java        | 11 ++++++++---
 framework/src/org/apache/cordova/PluginManager.java | 14 ++++++++++----
 2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/91729b30/framework/src/org/apache/cordova/Config.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Config.java b/framework/src/org/apache/cordova/Config.java
index 6e2a29c..63374f6 100644
--- a/framework/src/org/apache/cordova/Config.java
+++ b/framework/src/org/apache/cordova/Config.java
@@ -68,10 +68,15 @@ public class Config {
             return;
         }
 
-        int id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
+        // First checking the class namespace for config.xml
+        int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
         if (id == 0) {
-            LOG.i("CordovaLog", "config.xml missing. Ignoring...");
-            return;
+            // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
+            id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
+            if (id == 0) {
+                LOG.i("CordovaLog", "config.xml missing. Ignoring...");
+                return;
+            }
         }
 
         // Add implicitly allowed URLs

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/91729b30/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index 08f7a12..732f4f6 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -110,11 +110,17 @@ public class PluginManager {
      * Load plugins from res/xml/config.xml
      */
     public void loadPlugins() {
-        int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
+
+        // First checking the class namespace for config.xml
+        int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getClass().getPackage().getName());
         if (id == 0) {
-            this.pluginConfigurationMissing();
-            //We have the error, we need to exit without crashing!
-            return;
+            // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
+            id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
+            if (id == 0) {
+                this.pluginConfigurationMissing();
+                //We have the error, we need to exit without crashing!
+                return;
+            }
         }
         XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
         int eventType = -1;


Mime
View raw message