You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Paul Lindner (JIRA)" <ji...@apache.org> on 2009/06/27 08:20:47 UTC
[jira] Resolved: (SHINDIG-1102) JsLibraray.java has a bug
[ https://issues.apache.org/jira/browse/SHINDIG-1102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Lindner resolved SHINDIG-1102.
-----------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.0)
trunk
Thanks for the patch! I modified it slightly and added a test.
> JsLibraray.java has a bug
> -------------------------
>
> Key: SHINDIG-1102
> URL: https://issues.apache.org/jira/browse/SHINDIG-1102
> Project: Shindig
> Issue Type: Bug
> Components: Java
> Affects Versions: 1.0
> Reporter: Vinu Neelambaran
> Priority: Critical
> Fix For: trunk
>
> Original Estimate: 0.08h
> Remaining Estimate: 0.08h
>
> 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 modified create() method.
> 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();
>
> /*
> * the foolowing conditional statements are to be added to check wheter optimizedContent =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);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.