>From 104c6db3cf4ca77c766161e9614b6938d4a12979 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Thu, 12 Jul 2012 11:07:26 -0400
Subject: [PATCH] Fixes for comments on Patch 22

---
 .../cms/publish/publishers/FileBasedPublisher.java |   44 +++++---------------
 .../src/com/netscape/cmscore/apps/CMSEngine.java   |    8 +---
 2 files changed, 13 insertions(+), 39 deletions(-)

diff --git a/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java b/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java
index 0cc73981d165bc93adaee3f367141f471cf471bf..c48aa2db44163850d34f99e146ba6505926d2389 100644
--- a/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java
+++ b/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java
@@ -254,27 +254,19 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo {
         if (com.netscape.cmsutil.util.Utils.exec(cmd)) {
             File oldLink = new File(linkName + ".old");
             if (oldLink.exists()) { // remove old link if exists
-                if (!oldLink.delete()) {
-                    CMS.debug("FileBasedPublisher : createLink: Could not delete old link.");
-                }
+                oldLink.delete();
             }
             File link = new File(linkName);
             if (link.exists()) { // current link becomes an old link
-                if (!link.renameTo(new File(linkName + ".old"))) {
-                    CMS.debug("FileBasedPublisher : createLink: Could not rename current link to old link.");
-                }
+                link.renameTo(new File(linkName + ".old"));
             }
             File newLink = new File(linkName + ".new");
             if (newLink.exists()) { // new link becomes current link
-                if (!newLink.renameTo(new File(linkName))) {
-                    CMS.debug("FileBasedPublisher : createLink: Could not rename new link as current link.");
-                }
+                newLink.renameTo(new File(linkName));
             }
             oldLink = new File(linkName + ".old");
             if (oldLink.exists()) { // remove a new old link
-                if (oldLink.delete()) {
-                    CMS.debug("FileBasedPublisher : createLink: Could not delete old link.");
-                }
+                oldLink.delete();
             }
         } else {
             CMS.debug("FileBasedPublisher:  createLink: '" + cmd + "' --- failed");
@@ -375,14 +367,10 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo {
                     destFile = new File(destName);
 
                     if (destFile.exists()) {
-                        if (!destFile.delete()) {
-                            CMS.debug("FileBasedPublisher : publish:mDerAttr=true: Could not delete file :" + destName);
-                        }
+                        destFile.delete();
                     }
                     renameFile = new File(tempFile);
-                    if (!renameFile.renameTo(destFile)) {
-                        CMS.debug("FileBasedPublisher : publish:mDerAttr=true: Could not create :" + destName);
-                    }
+                    renameFile.renameTo(destFile);
 
                     if (mLatestCRL) {
                         String linkExt = ".";
@@ -416,14 +404,10 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo {
                     destFile = new File(destName);
 
                     if (destFile.exists()) {
-                        if (!destFile.delete()) {
-                            CMS.debug("FileBasedPublisher : publish:mB64Attr=true: Could not delete file :" + destName);
-                        }
+                        destFile.delete();
                     }
                     renameFile = new File(tempFile);
-                    if (!renameFile.renameTo(destFile)) {
-                        CMS.debug("FileBasedPublisher : publish:mB64Attr=true: Could not create :" + destName);
-                    }
+                    renameFile.renameTo(destFile);
                 }
             }
         } catch (IOException e) {
@@ -465,21 +449,15 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo {
 
             fileName = name + ".zip";
             File f = new File(fileName);
-            if (!f.delete()) {
-                CMS.debug("FileBasedPublisher : unpublish: Could not delete " + fileName);
-            }
+            f.delete();
         }
         fileName = name + ".der";
         File f = new File(fileName);
-        if (!f.delete()) {
-            CMS.debug("FileBasedPublisher : unpublish: Could not delete " + fileName);
-        }
+        f.delete();
 
         fileName = name + ".b64";
         f = new File(fileName);
-        if (!f.delete()) {
-            CMS.debug("FileBasedPublisher : unpublish: Could not delete " + fileName);
-        }
+        f.delete();
     }
 
     /**
diff --git a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
index 29c065160ded5fa760b01b067d5d2a5bd905da85..84afb847413df20b36ec5f371445009eda691322 100644
--- a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
+++ b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
@@ -657,15 +657,11 @@ public class CMSEngine implements ICMSEngine {
         try {
             /* if the file is not there, create one */
             File f = new File(path);
-            if (!f.exists()) {
-                if (!f.createNewFile()) {
-                    CMS.debug("CMSEngine : Cannot create File : " + path);
-                }
-            }
+            f.createNewFile();
         } catch (IOException e) {
             CMS.debug("Cannot create file: " + path + " ." + e.toString());
+            throw new EBaseException("Cannot create file: " + path + " ." + e.toString());
         }
-
         return new FileConfigStore(path);
     }
 
-- 
1.7.10.2

