Hi all,

I downloaded the latest shindig. I tried to create a sample feature called 
sample-0.1 which has two files namely feature.xml and sample.js.
I when I tried to use that feature in a gadget, I found that the javascript for 
that feature is not getting injected into the gadget.

I found the that the bug is in JsLibrary.java. It has a create() method which 
is responsible for getting the javasript library from the
required resource/location. If the feature does not have a *.opt.js file, then 
the javascript content returned was null. This was because one if statement
was missing in the method. Please find below the create() method. The text in 
the red color was missing and needs to be added.


 public static JsLibrary create(Type type, String content, String feature,
      HttpFetcher fetcher) throws GadgetException {
    String optimizedContent = null;
    String debugContent;
    switch (type) {
      case FILE:
      case RESOURCE:
        StringBuffer opt = new StringBuffer();
        StringBuffer dbg = new StringBuffer();
        loadOptimizedAndDebugData(content, type, opt, dbg);
        optimizedContent = opt.toString();
        debugContent = dbg.toString();

          /*
         * We need to check whether optimizedContent is null
         */

        if(optimizedContent == null) {
                optimizedContent = debugContent;
        }
        else if(optimizedContent.equalsIgnoreCase("null")) { // this is because 
null was returned as a String
                optimizedContent = debugContent;
        }
        else if(optimizedContent.length() == 0) {
                optimizedContent = debugContent;
        }


        break;
      case URL:
        if (fetcher == null) {
          debugContent = optimizedContent = content;
        } else {
          type = Type.FILE;
          debugContent = optimizedContent = loadDataFromUrl(content, fetcher);
        }
        break;
      default:
        debugContent = content;
        optimizedContent = content;
        break;
    }
        return new JsLibrary(feature, type, optimizedContent, debugContent);
  }



Thanks & Regards
Vinu Neelambaran I Wipro Technologies I Bangalore
vinu.neelamba...@wipro.com <blocked::mailto:vinu.neelamba...@wipro.com>  I 
Mobile # +91-9986021145


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

Reply via email to