Author: theute
Date: 2011-09-14 04:49:35 -0400 (Wed, 14 Sep 2011)
New Revision: 7407
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java
Log:
Missing parts when porting to EPP
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java 2011-09-14
08:44:23 UTC (rev 7406)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java 2011-09-14
08:49:35 UTC (rev 7407)
@@ -41,12 +41,7 @@
}
InputStream is = scontext.getResourceAsStream(path);
-
- if(is == null)
- {
- throw new NullPointerException("There is no file specified by path :
" + path);
- }
- return IOUtils.toString(is, encoding);
+ return (is != null) ? IOUtils.toString(is, encoding) : null;
}
};
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java 2011-09-14
08:44:23 UTC (rev 7406)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java 2011-09-14
08:49:35 UTC (rev 7407)
@@ -239,12 +239,16 @@
try {
for (String entry : files) {
LOG.info("Reading container config: " + entry);
- //final ClassLoader contextCl = Thread.currentThread().getContextClassLoader();
- //InputStream resourceInputStream = contextCl.getResourceAsStream(entry);
- //String content = IOUtils.toString(resourceInputStream, "UTF-8");
-
GateInContainerConfigLoader currentLoader =
GateInGuiceServletContextListener.getCurrentLoader();
String content = currentLoader.loadContentAsString(entry, "UTF-8");
+
+ if(content == null) {
+ LOG.warning("There is no configuration file " + entry + " in
Gadget Server context");
+ content = ResourceLoader.getContent(entry);
+ if (content == null || content.length() == 0) {
+ throw new IOException("The file " + entry + " is
empty");
+ }
+ }
loadFromString(content, all);
}
} catch (IOException e) {
Show replies by date