diff options
18 files changed, 70 insertions, 73 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java index b5ff59b1..d2695a35 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java @@ -264,8 +264,7 @@ public abstract class Batch { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { - e.printStackTrace(); - env.warn().log("Unable to get hostname"); + env.warn().log("Unable to get hostname : "+e.getMessage()); return (0); } @@ -545,7 +544,7 @@ public abstract class Batch { if(cluster!=null && !cluster.isClosed()) { cluster.close(); } - e.printStackTrace(System.err); + env.warn().log(System.err); } } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java index 49309004..4c14f0fd 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java @@ -316,7 +316,7 @@ public class Cred { } public static void batchDelete(StringBuilder sb, List<String> row) { - Long l = Long.parseLong(row.get(5)); + long l = Long.parseLong(row.get(5)); String date = Chrono.batchFmt.format(new Date(l)); sb.append("DELETE from authz.cred WHERE id='"); sb.append(row.get(1)); @@ -326,9 +326,6 @@ public class Cred { sb.append(" AND expires='"); sb.append(date); sb.append("';\n"); -// sb.append(" AND expires=dateof(maxtimeuuid("); -// sb.append(row.get(5)); -// sb.append("));\n"); } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java index 04814e01..b002dd8b 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java @@ -80,7 +80,6 @@ public abstract class NotifyBody { if(row.size()>3) { escalation = Integer.parseInt(row.get(3)); } - return; } else if(type.equals(row.get(0))) { String user = user(row); if(user!=null) { @@ -180,42 +179,46 @@ public abstract class NotifyBody { String path = pkg.getName().replace('.', '/'); URL url = cl.getResource(path); List<String> classNames = new ArrayList<>(); - String urlString = url.toString(); - if(urlString.startsWith("jar:file:")) { - int exclam = urlString.lastIndexOf('!'); - JarFile jf = new JarFile(urlString.substring(9,exclam)); - try { - Enumeration<JarEntry> jfe = jf.entries(); - while(jfe.hasMoreElements()) { - String name = jfe.nextElement().getName(); - if(name.startsWith(path) && name.endsWith(".class")) { - classNames.add(name.substring(0,name.length()-6).replace('/', '.')); + String urlString; + if (url != null) { + urlString = url.toString(); + if (urlString.startsWith("jar:file:")) { + int exclam = urlString.lastIndexOf('!'); + JarFile jf = new JarFile(urlString.substring(9, exclam)); + try { + Enumeration<JarEntry> jfe = jf.entries(); + while (jfe.hasMoreElements()) { + String name = jfe.nextElement().getName(); + if (name.startsWith(path) && name.endsWith(".class")) { + classNames.add(name.substring(0, name.length() - 6).replace('/', '.')); + } } + } finally { + jf.close(); } - } finally { - jf.close(); - } - } else { - File dir = new File(url.getFile()); - for( String f : dir.list()) { - if(f.endsWith(".class")) { - classNames.add(pkg.getName() + '.' + f.substring(0,f.length() - 6)); + } else { + File dir = new File(url.getFile()); + String[] dirs = dir.list(); + if (dirs != null) { + for (String f : dirs) { + if (f.endsWith(".class")) { + classNames.add(pkg.getName() + '.' + f.substring(0, f.length() - 6)); + } + } } } - } - for(String cls : classNames) { - try { - Class<?> c = cl.loadClass(cls); - if((c!=null)&&(!Modifier.isAbstract(c.getModifiers()))) { - Constructor<?> cst = c.getConstructor(Access.class); - NotifyBody nb = (NotifyBody)cst.newInstance(access); - if(nb!=null) { - bodyMap.put("info|" + nb.name, nb); - bodyMap.put(nb.type+'|' + nb.name, nb); - } + for (String cls : classNames) { + try { + Class<?> c = cl.loadClass(cls); + if ((c != null) && (!Modifier.isAbstract(c.getModifiers()))) { + Constructor<?> cst = c.getConstructor(Access.class); + NotifyBody nb = (NotifyBody) cst.newInstance(access); + bodyMap.put("info|" + nb.name, nb); + bodyMap.put(nb.type + '|' + nb.name, nb); + } + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); } - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); } } } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java index 087ab952..3d26ce99 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java @@ -94,7 +94,14 @@ public class Remove extends Batch { remove.add(new File(logDir, args()[i])); } } else { - remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv")); + final String ending = Chrono.dateOnlyStamp()+".csv"; + for (File file : logDir.listFiles(f -> { + String name = f.getName(); + return name.endsWith(ending) && ( + name.startsWith("Delete") || name.startsWith("Clean.")); + })) { + remove.add(file); + }; } for(File f : remove) { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java index 7ea7dd75..28b8c4b4 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java @@ -40,6 +40,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { public Result<List<Data>> readNS(AuthzTrans trans, final String ns) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readNS(trans, ns); } @@ -51,14 +52,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { } else { } -// if (getter.result==null) { -// if (lurd==null) { - return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details); -// } else { -// return Result.ok(lurd); -// } -// } -// return getter.result; + return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details); } public Result<List<Data>> readChildren(AuthzTrans trans, final String ns, final String type) { @@ -74,6 +68,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { */ public Result<List<Data>> readByType(AuthzTrans trans, final String ns, final String type) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readByType(trans, ns, type); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java index b90c3579..0c1fa4cc 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java @@ -39,6 +39,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> { public Result<List<Data>> readNS(AuthzTrans trans, final String ns) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readNS(trans, ns); } @@ -53,6 +54,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> { public Result<List<Data>> readName(AuthzTrans trans, final String name) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao().readName(trans, name); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java index c994dd53..6dd0fdd2 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java @@ -117,7 +117,6 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { obj[++idx]=data.target; obj[++idx]=data.subject; obj[++idx]=data.memo; -// obj[++idx]=data.detail; obj[++idx]=data.reconstruct; } }; @@ -139,9 +138,8 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { } },writeConsistency) ); -// disable(CRUD.Create); - replace(CRUD.read, new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + + replace(CRUD.read, new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM history WHERE id = ?", defLoader,readConsistency) // new HistLoader(2) { // @Override @@ -227,7 +225,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { private class YYYYMM implements Accept<Data> { private int[] yyyymm; - public YYYYMM(int yyyymm[]) { + public YYYYMM(int[] yyyymm) { this.yyyymm = yyyymm; } @Override diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java index fde94b42..32fd906b 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java @@ -34,7 +34,6 @@ import org.onap.aaf.cadi.configure.Factory; public class X509ChainWithIssuer extends X509andChain { private String issuerDN; - public X509Certificate caX509; public X509ChainWithIssuer(X509ChainWithIssuer orig, X509Certificate x509) { super(x509,orig.trustChain); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java index 9de4e34c..bf4193e4 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java @@ -264,7 +264,8 @@ public class AAFcli { } else if ("set".equalsIgnoreCase(largs[idx])) { while (largs.length > ++idx) { int equals = largs[idx].indexOf('='); - String tag, value; + String tag; + String value; if (equals < 0) { tag = largs[idx]; value = access.getProperty(Config.AAF_APPPASS,null); diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java index b36ed4b9..d35ac4af 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java @@ -75,7 +75,8 @@ public class TextIndex { long lhash; int curr; while ((max-min)>100) { - ttok.pos((curr=(min+(max-min)/2))*REC_SIZE); + curr=(min+(max-min)/2); + ttok.pos(curr*REC_SIZE); tib.rewind(); lhash = hashToLong(tib.get()); if (lhash<hash) { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java index bcef6de9..899850d0 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java @@ -47,7 +47,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named private final String[] columns; private final Rows rows; private Code<HTMLGen> other; -// private DynamicCode<HTMLGen, AuthGUI, AuthzTrans> prefix,postfix; + public Table(String title, TRANS trans, Data<S,TRANS> data, Code<HTMLGen> other, String name, String ... attrs) { this(title,trans,data,name, attrs); @@ -56,7 +56,6 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named public Table(String title, TRANS trans, Data<S,TRANS> data, String name, String ... attrs) { super(true,name); -// prefix=postfix=null; for (String a : attrs) { addAttr(false, a); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java index 07aa99a6..4ad7893a 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java @@ -188,7 +188,8 @@ public class CredDetail extends Page { } lmu = users.get(u.getId()); if (lmu==null) { - users.put(u.getId(),lmu=new ArrayList<>()); + lmu=new ArrayList<>(); + users.put(u.getId(),lmu); } mu=null; for (Map<Integer,List<User>> xmu : lmu) { @@ -198,12 +199,14 @@ public class CredDetail extends Page { } if (mu==null) { - lmu.add(mu=new HashMap<>()); + mu=new HashMap<>(); + lmu.add(mu); } lu = mu.get(u.getType()); if (lu==null) { - mu.put(u.getType(),lu = new ArrayList<>()); + lu = new ArrayList<>(); + mu.put(u.getType(),lu); } lu.add(u); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java index ac9cdf1e..4a6e1f49 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java @@ -77,7 +77,6 @@ public class PermGrantForm extends Page { hgen.js(copyRoleJS); hgen.text("function copyRole(role) {"); hgen.text("var txtRole = document.querySelector(\"#role\");"); -// hgen.text("if (role==;"); hgen.text("txtRole.value=role;"); hgen.text("}"); hgen.end(copyRoleJS); diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java index e5366ac6..49ac8b13 100644 --- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java +++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java @@ -26,7 +26,6 @@ import java.util.Map; import javax.servlet.Filter; -import org.onap.aaf.auth.cache.Cache.Dated; import org.onap.aaf.auth.env.AuthzEnv; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.env.AuthzTransFilter; @@ -49,7 +48,6 @@ import org.onap.aaf.misc.env.Env; public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> { public enum API{TOKEN_REQ, TOKEN,INTROSPECT, ERROR,VOID}; - public Map<String, Dated> cacheUser; public AAFAuthn<?> aafAuthn; public AAFLurPerm aafLurPerm; @@ -57,9 +55,6 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> { * Construct AuthzAPI with all the Context Supporting Routes that Authz needs * * @param env - * @param si - * @param dm - * @param decryptor * @throws APIException */ public AAF_Hello(final AuthzEnv env) throws Exception { diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java index 6f04ed5f..e28e2ff0 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java @@ -79,9 +79,6 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> { * Construct AuthzAPI with all the Context Supporting Routes that Authz needs * * @param env - * @param si - * @param dm - * @param decryptor * @throws APIException */ public AAF_OAuth(final AuthzEnv env) throws Exception { diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java index 3127ba18..10830efa 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java @@ -24,6 +24,7 @@ package org.onap.aaf.auth.oauth.facade; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; +@FunctionalInterface public interface DirectIntrospect<INTROSPECT> { Result<INTROSPECT> mappedIntrospect(AuthzTrans trans, String token); } diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java index 5b092740..3e8d6f97 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java @@ -30,7 +30,6 @@ public class PermEval { public static final char ALT_START_INST_KEY_CHAR='/'; public static final char LIST_SEP = ','; - public static final String INST_KEY_REGEX = new StringBuilder().append(START_INST_KEY_CHAR).toString(); public static final String ASTERIX = "*"; /** @@ -47,7 +46,7 @@ public class PermEval { if (sInst == null || pInst == null) { return false; } - if (sInst == "" || pInst == "") { + if (sInst.equals("") || pInst.equals("")) { return false; } if (ASTERIX.equals(sInst)) { @@ -137,8 +136,8 @@ public class PermEval { * Action is not quite as complex. But we write it in this function so it can be consistent */ public static boolean evalAction(String sAction,String pAction) { - if (ASTERIX.equals(sAction))return true; // If Server's String is "*", then it accepts every Action - if (pAction == "") return false; + if (ASTERIX.equals(sAction)) return true; // If Server's String is "*", then it accepts every Action + if (pAction.equals("")) return false; for (String sItem : Split.split(LIST_SEP,sAction)) { // allow for "," definition in Action if (pAction.charAt(0)==START_REGEX_CHAR? // First char sItem.matches(pAction.substring(1)): // Evaluate as Regular Expression diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java index e6c95db8..aa20dfae 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java @@ -63,6 +63,8 @@ public class Chrono { niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
batchFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
+ // Note: DB and thus Batch conversions should always be in UTC Time
+ batchFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
}
|