You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/12/18 12:34:12 UTC

[GitHub] gubaojian commented on a change in pull request #1927: * [Android] Use JSON to find bundleType

gubaojian commented on a change in pull request #1927: * [Android] Use JSON to find bundleType
URL: https://github.com/apache/incubator-weex/pull/1927#discussion_r242519179
 
 

 ##########
 File path: android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
 ##########
 @@ -1560,33 +1584,22 @@ public BundType getBundleType(String url, String temp) {
         }
       }
       if (temp != null) {
-        if (temp.startsWith("// { \"framework\": \"Vue\" }") ||
-                temp.startsWith("// { \"framework\": \"vue\" }") ||
-                temp.startsWith("// {\"framework\" : \"Vue\"}") ||
-                temp.startsWith("// {\"framework\" : \"vue\"}")) {
+        final String FRAMEWORK="framework", VUE="vue", RAX="rax";
+
+        // Find the first line that starts with '//' and convert it to json
+        int bundleTypeStart = temp.indexOf("//");
+        int bundleTypeEnd = temp.indexOf("\n", bundleTypeStart);
+        JSONObject bundleType = JSONObject.parseObject(
+            temp.substring(bundleTypeStart+2, bundleTypeEnd));
 
 Review comment:
   非法数据会不会抛异常?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services