Author: johnh
Date: Tue Dec 14 20:01:42 2010
New Revision: 1049239
URL: http://svn.apache.org/viewvc?rev=1049239&view=rev
Log:
Allow either resource in a DualModeStaticResource to be null. Errors occur
downstream. This fixes the build.
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java?rev=1049239&r1=1049238&r2=1049239&view=diff
==============================================================================
---
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
(original)
+++
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
Tue Dec 14 20:01:42 2010
@@ -108,8 +108,18 @@ public class FeatureResourceLoader {
protected FeatureResource loadResource(
String path, Map<String, String> attribs) throws IOException {
- return new DualModeStaticResource(path,
getResourceContent(getOptPath(path)),
- getResourceContent(path));
+ String optContent = null, debugContent = null;
+ try {
+ optContent = getResourceContent(getOptPath(path));
+ } catch (IOException e) {
+ // OK - optContent can be null. Error thrown downstream if both are null.
+ }
+ try {
+ debugContent = getResourceContent(path);
+ } catch (IOException e) {
+ // See above; OK for debugContent to be null.
+ }
+ return new DualModeStaticResource(path, optContent, debugContent);
}
public String getResourceContent(String resource) throws IOException {