Change Sonar flagged code
[aaf/authz.git] / auth / auth-batch / src / main / java / org / onap / aaf / auth / batch / Batch.java
index 543564d..d51ec60 100644 (file)
@@ -90,7 +90,10 @@ public abstract class Batch {
     public static final String GUI_URL="GUI_URL";
     
     protected final Organization org;
-    
+       protected String version;
+       protected static final Date now = new Date();
+       protected static final Date never = new Date(0);
+       
     protected Batch(AuthzEnv env) throws APIException, IOException, OrganizationException {
         if (batchEnv != null) {
             env.info().log("Redirecting to ",batchEnv,"environment");
@@ -143,10 +146,12 @@ public abstract class Batch {
                 }
             }
         }
+        
+        version = env.getProperty(VERSION,Config.AAF_DEFAULT_API_VERSION);
     }
 
     protected abstract void run(AuthzTrans trans);
-    protected abstract void _close(AuthzTrans trans);
+    protected void _close(AuthzTrans trans) {}
     
     public String[] args() {
         return env.get(ssargs);
@@ -360,7 +365,12 @@ public abstract class Batch {
 
     public final void close(AuthzTrans trans) {
         _close(trans);
-        cluster.close();
+        if(session!=null) {
+               session.close();
+        }
+        if(cluster!=null) {
+            cluster.close();
+        }
     }
 
     public static void main(String[] args) {