[exo-jcr-commits] exo-jcr SVN: r4667 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jul 20 02:30:28 EDT 2011
Author: tolusha
Date: 2011-07-20 02:30:28 -0400 (Wed, 20 Jul 2011)
New Revision: 4667
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
Log:
EXOJCR-1448: Some code in jcr-ext require to be privileged
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2011-07-19 14:55:34 UTC (rev 4666)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2011-07-20 06:30:28 UTC (rev 4667)
@@ -578,7 +578,34 @@
+ PrivilegedFileHelper.getCanonicalPath(getBackupConfig().getBackupDir()));
}
- IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ IBindingFactory factory;
+ try
+ {
+ factory = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<IBindingFactory>()
+ {
+ public IBindingFactory run() throws Exception
+ {
+ return BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof JiBXException)
+ {
+ throw (JiBXException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+
IUnmarshallingContext uctx = factory.createUnmarshallingContext();
RepositoryServiceConfiguration conf =
(RepositoryServiceConfiguration) uctx.unmarshalDocument(PrivilegedFileHelper
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-07-19 14:55:34 UTC (rev 4666)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-07-20 06:30:28 UTC (rev 4667)
@@ -357,7 +357,34 @@
+ PrivilegedFileHelper.getCanonicalPath(getBackupConfig().getBackupDir()));
}
- IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ IBindingFactory factory;
+ try
+ {
+ factory = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<IBindingFactory>()
+ {
+ public IBindingFactory run() throws Exception
+ {
+ return BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof JiBXException)
+ {
+ throw (JiBXException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+
IUnmarshallingContext uctx = factory.createUnmarshallingContext();
RepositoryServiceConfiguration conf =
(RepositoryServiceConfiguration) uctx.unmarshalDocument(PrivilegedFileHelper
More information about the exo-jcr-commits
mailing list