Refactor monitor and exceptions
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / backup / OsCallBackup.java
index e588a0b2e7882aa307c1dbe82a60497b46f55977..ad8ffe86118b8cfe848029eef3d9d8db8bc00fc4 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.vfs2.FileContent;
 import org.apache.commons.vfs2.FileObject;
-import org.argeo.ArgeoException;
+import org.argeo.cms.CmsException;
 
 /**
  * Runs an OS command and save its standard output as a file. Typically used for
@@ -81,20 +81,17 @@ public class OsCallBackup extends AbstractAtomicBackup {
                        // stdout
                        FileContent targetContent = targetFo.getContent();
                        // stderr
-                       ExecuteStreamHandler streamHandler = new PumpStreamHandler(
-                                       targetContent.getOutputStream(), errBos);
+                       ExecuteStreamHandler streamHandler = new PumpStreamHandler(targetContent.getOutputStream(), errBos);
                        executor.setStreamHandler(streamHandler);
                        executor.execute(commandLine, environment);
                } catch (ExecuteException e) {
                        byte[] err = errBos.toByteArray();
                        String errStr = new String(err);
-                       throw new ArgeoException("Process " + commandLine + " failed ("
-                                       + e.getExitValue() + "): " + errStr, e);
+                       throw new CmsException("Process " + commandLine + " failed (" + e.getExitValue() + "): " + errStr, e);
                } catch (Exception e) {
                        byte[] err = errBos.toByteArray();
                        String errStr = new String(err);
-                       throw new ArgeoException("Process " + commandLine + " failed: "
-                                       + errStr, e);
+                       throw new CmsException("Process " + commandLine + " failed: " + errStr, e);
                } finally {
                        IOUtils.closeQuietly(errBos);
                }