cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject android commit: CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace
Date Thu, 05 Dec 2013 17:46:35 GMT
Updated Branches:
  refs/heads/master e646a0840 -> 28c10dba0


CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/28c10dba
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/28c10dba
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/28c10dba

Branch: refs/heads/master
Commit: 28c10dba092df566611ef8f70787b6db2cff4d2e
Parents: e646a08
Author: HÃ¥kon Nilsen <hnilsen@gmail.com>
Authored: Wed Dec 4 21:06:15 2013 +0100
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Dec 5 12:45:34 2013 -0500

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Config.java        |  9 +++++++--
 framework/src/org/apache/cordova/PluginManager.java | 11 ++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/28c10dba/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 e560961..eeedaf2 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;
         }
 
+        // 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-android/blob/28c10dba/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 0b9ecc7..e9795e8 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -110,11 +110,16 @@ public class PluginManager {
      * Load plugins from res/xml/config.xml
      */
     public void loadPlugins() {
+        // 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