Author: kien_nguyen
Date: 2011-09-14 03:11:15 -0400 (Wed, 14 Sep 2011)
New Revision: 7401
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetImporter.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
Log:
GTNPORTAL-2077 javax.jcr.nodetype.ConstraintViolationException when a remote gadget file
cannot be processed
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetImporter.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetImporter.java 2011-09-14
07:00:17 UTC (rev 7400)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetImporter.java 2011-09-14
07:11:15 UTC (rev 7401)
@@ -90,7 +90,7 @@
if (bytes == null)
{
log.error("Cannot import gadget " + gadgetURI + " because its
data could not be found");
- return;
+ throw new IOException();
}
//
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2011-09-14
07:00:17 UTC (rev 7400)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2011-09-14
07:11:15 UTC (rev 7401)
@@ -343,25 +343,28 @@
public Boolean call() throws Exception
{
chromatticLifeCycle.openContext();
+ boolean done = true;
try
- {
- boolean done = false;
+ {
if (getRegistry().getGadget(importer.getGadgetName()) == null)
{
GadgetDefinition def = getRegistry().addGadget(importer.getGadgetName());
importer.doImport(def);
- done = true;
}
else
{
log.debug("Will not import existing gagdet " +
importer.getGadgetName());
}
- return done;
}
+ catch (Exception e)
+ {
+ done = false;
+ }
finally
{
- chromatticLifeCycle.closeContext(true);
+ chromatticLifeCycle.closeContext(done);
}
+ return done;
}
}
}
Show replies by date