Fix special characters in JCR logging
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 9 Feb 2012 09:41:25 +0000 (09:41 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 9 Feb 2012 09:41:25 +0000 (09:41 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5025 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java

index b2fa33395b51d8bf8a586acbfb39642eb88d3267..83b442fbf77c1f6462f88a8e1bfbb1de9e1b69e8 100644 (file)
@@ -88,6 +88,11 @@ public class JcrExecutionProcess implements ExecutionProcess, SlcNames {
                                String relPath = SLC_LOG + '/' + step.getThread() + '/'
                                                + step.getLocation().replace('.', '/');
                                String path = node.getPath() + '/' + relPath;
+                               // clean special character
+                               // TODO factorize in JcrUtils
+                               path = path.replace('@', '_').replace('/', '_')
+                                               .replace(':', '_');
+
                                Node location = JcrUtils.mkdirs(node.getSession(), path);
                                Node logEntry = location.addNode(Long.toString(nextLogLine),
                                                type);
@@ -106,7 +111,7 @@ public class JcrExecutionProcess implements ExecutionProcess, SlcNames {
                        JcrUtils.updateLastModified(node);
 
                        node.getSession().save();
-               } catch (RepositoryException e) {
+               } catch (Exception e) {
                        JcrUtils.discardUnderlyingSessionQuietly(node);
                        e.printStackTrace();
                }