From 7e966914050e66219689001ff4ab601a49eef0ac Mon Sep 17 00:00:00 2001 From: Instrumental Date: Fri, 7 Sep 2018 13:43:23 -0500 Subject: Mass whitespace changes (Style Warnings) Issue-ID: AAF-473 Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8 Signed-off-by: Instrumental --- .../java/org/onap/aaf/auth/locate/AAF_Locate.java | 10 +++---- .../org/onap/aaf/auth/locate/BasicAuthCode.java | 8 +++--- .../onap/aaf/auth/locate/api/API_AAFAccess.java | 12 ++++---- .../org/onap/aaf/auth/locate/api/API_Find.java | 2 +- .../org/onap/aaf/auth/locate/api/API_Proxy.java | 4 +-- .../aaf/auth/locate/facade/LocateFacadeImpl.java | 30 ++++++++++---------- .../onap/aaf/auth/locate/mapper/Mapper_1_1.java | 22 +++++++-------- .../aaf/auth/locate/service/LocateServiceImpl.java | 24 ++++++++-------- .../auth/locate/validation/LocateValidator.java | 32 +++++++++++----------- 9 files changed, 72 insertions(+), 72 deletions(-) (limited to 'auth/auth-locate/src/main') diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java index 545b6b47..bd44dfce 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java @@ -120,7 +120,7 @@ public class AAF_Locate extends AbsService { facade_1_1_XML = LocateFacadeFactory.v1_1(env,this,trans,Data.TYPE.XML); synchronized(env) { - if(cacheUser == null) { + if (cacheUser == null) { cacheUser = Cache.obtain(USER_PERMS); Cache.startCleansing(env, USER_PERMS); } @@ -163,7 +163,7 @@ public class AAF_Locate extends AbsService { String version = "1.0"; // Get Correct API Class from Mapper Class respCls = facade.mapper().getClass(api); - if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name()); + if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name()); // setup Application API HTML ContentTypes for JSON and Route String application = applicationJSON(respCls, version); route(env,meth,path,code,application,"application/json;version="+version,"*/*","*"); @@ -186,7 +186,7 @@ public class AAF_Locate extends AbsService { @Override protected AAFConHttp _newAAFConHttp() throws CadiException { try { - if(dal==null) { + if (dal==null) { dal = AbsAAFLocator.create(aaf_service_name,Config.AAF_DEFAULT_VERSION); } // utilize pre-constructed DirectAAFLocator @@ -197,7 +197,7 @@ public class AAF_Locate extends AbsService { } public Locator getGUILocator() throws LocatorException { - if(gui_locator==null) { + if (gui_locator==null) { gui_locator = AbsAAFLocator.create(aaf_gui_name,Config.AAF_DEFAULT_VERSION); } return gui_locator; @@ -228,7 +228,7 @@ public class AAF_Locate extends AbsService { @Override public void destroy() { Cache.stopTimer(); - if(cluster!=null) { + if (cluster!=null) { cluster.close(); } super.destroy(); diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java index c5239a5a..30258d80 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java @@ -45,7 +45,7 @@ public class BasicAuthCode extends LocateCode { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Principal p = trans.getUserPrincipal(); - if(p == null) { + if (p == null) { trans.error().log("Transaction not Authenticated... no Principal"); } else if (p instanceof BasicPrincipal) { // the idea is that if call is made with this credential, and it's a BasicPrincipal, it's ok @@ -55,12 +55,12 @@ public class BasicAuthCode extends LocateCode { } else if (p instanceof X509Principal) { // Since X509Principal has priority, BasicAuth Info might be there, but not validated. String ba; - if((ba=req.getHeader("Authorization"))!=null && ba.startsWith("Basic ")) { + if ((ba=req.getHeader("Authorization"))!=null && ba.startsWith("Basic ")) { ba = Symm.base64noSplit.decode(ba.substring(6)); int colon = ba.indexOf(':'); - if(colon>=0) { + if (colon>=0) { String err; - if((err=authn.validate(ba.substring(0, colon), ba.substring(colon+1),trans))==null) { + if ((err=authn.validate(ba.substring(0, colon), ba.substring(colon+1),trans))==null) { resp.setStatus(HttpStatus.OK_200); } else { trans.audit().log(ba.substring(0,colon),": ",err); diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java index 85cee82f..b5ab4351 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java @@ -78,7 +78,7 @@ public class API_AAFAccess { try { final String accept = req.getHeader("ACCEPT"); final String user = pathParam(req,":user"); - if(!user.contains("@")) { + if (!user.contains("@")) { context.error(trans,resp,Result.ERR_BadData,"User [%s] must be fully qualified with domain",user); return; } @@ -91,14 +91,14 @@ public class API_AAFAccess { tt2.done(); } - if(d==null || d.data.isEmpty()) { + if (d==null || d.data.isEmpty()) { tt2 = trans.start("AAF Service Call",Env.REMOTE); try { gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable() { @Override public Void code(Rcli client) throws CadiException, ConnectException, APIException { Future fp = client.read("/authz/perms/user/"+user,accept); - if(fp.get(5000)) { + if (fp.get(5000)) { gwAPI.cacheUser.put(key, new Dated(new User(fp.code(),fp.body()),gwAPI.expireIn)); resp.setStatus(HttpStatus.OK_200); ServletOutputStream sos; @@ -159,7 +159,7 @@ public class API_AAFAccess { pathParam(req,":instance"), pathParam(req,":action")))); resp.setStatus(HttpStatus.OK_200); - } catch(Exception e) { + } catch (Exception e) { context.error(trans, resp, Result.ERR_General, e.getMessage()); } } @@ -258,14 +258,14 @@ public class API_AAFAccess { private static void redirect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, LocateFacade context, Locator loc, String path) throws IOException { try { - if(loc.hasItems()) { + if (loc.hasItems()) { Item item = loc.best(); URI uri = loc.get(item); StringBuilder redirectURL = new StringBuilder(uri.toString()); redirectURL.append('/'); redirectURL.append(path); String str = req.getQueryString(); - if(str!=null) { + if (str!=null) { redirectURL.append('?'); redirectURL.append(str); } diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java index 7ff1fceb..88fcc079 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java @@ -62,7 +62,7 @@ public class API_Find { String service = pathParam(req, ":service"); String version = pathParam(req, ":version"); String other = pathParam(req, ":other"); - if(service.indexOf(':')>=0) { + if (service.indexOf(':')>=0) { String split[] = Split.split(':', service); switch(split.length) { case 3: diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java index 8bdf479f..19c09ff0 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java @@ -62,7 +62,7 @@ public class API_Proxy { public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception { String aafurl = gwAPI.access.getProperty(Config.AAF_URL,null); - if(aafurl==null) { + if (aafurl==null) { } else { //////// // Transferring APIs @@ -73,7 +73,7 @@ public class API_Proxy { gwAPI.routeAll(HttpMethods.GET,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy GET", true) { @Override public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception { - if("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) { + if ("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) { bac.handle(trans, req, resp); } else { TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE); diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java index f41fcd91..fc73047c 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java @@ -119,7 +119,7 @@ public abstract class LocateFacadeImpl result) { String msg = result.details==null?"":result.details.trim(); String[] detail; - if(result.variables==null) { + if (result.variables==null) { detail = new String[1]; } else { int l = result.variables.length; @@ -132,7 +132,7 @@ public abstract class LocateFacadeImpl reps = this.service.getEndPoints(trans,service,version,other); - if(reps.notOK()) { + if (reps.notOK()) { return Result.err(reps); } else { output = epDF.newData(trans).load(reps.value).asString(); @@ -334,7 +334,7 @@ public abstract class LocateFacadeImpl data = mepDF.newData().load(req.getInputStream()); rreq = data.asObject(); - } catch(APIException e) { + } catch (APIException e) { trans.error().log("Invalid Input",IN,PUT_MGMT_ENDPOINTS); return Result.err(Status.ERR_BadData,"Invalid Input"); @@ -370,7 +370,7 @@ public abstract class LocateFacadeImpl data = mepDF.newData().load(req.getInputStream()); rreq = data.asObject(); - } catch(APIException e) { + } catch (APIException e) { trans.error().log("Invalid Input",IN,DELETE_MGMT_ENDPOINTS); return Result.err(Status.ERR_BadData,"Invalid Input"); diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java index d2eeb632..0d50f5d2 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java @@ -75,7 +75,7 @@ public class Mapper_1_1 implements Mapper endpoints(Result> resultDB, String version, String other) { - if(resultDB.notOK()) { + if (resultDB.notOK()) { return Result.err(resultDB); } int major=-1, minor=-1, patch=-1, pkg=-1; - if(version!=null) { + if (version!=null) { try { String[] v = Split.split('.',version); - if(v.length>0) {major = Integer.parseInt(v[0]);} - if(v.length>1) {minor = Integer.parseInt(v[1]);} - if(v.length>2) {patch = Integer.parseInt(v[2]);} - if(v.length>3) {pkg = Integer.parseInt(v[3]);} + if (v.length>0) {major = Integer.parseInt(v[0]);} + if (v.length>1) {minor = Integer.parseInt(v[1]);} + if (v.length>2) {patch = Integer.parseInt(v[2]);} + if (v.length>3) {pkg = Integer.parseInt(v[3]);} } catch (NumberFormatException e) { return Result.err(Result.ERR_BadData,"Invalid Version String " + version); } } Endpoints eps = new Endpoints(); List leps = eps.getEndpoint(); - for(Data d : resultDB.value) { - if((major<0 || major==d.major) && + for (Data d : resultDB.value) { + if ((major<0 || major==d.major) && (minor<0 || minor<=d.minor) && (patch<0 || patch==d.patch) && (pkg<0 || pkg ==d.pkg)) { @@ -119,7 +119,7 @@ public class Mapper_1_1 implements Mapper @Override public Result putMgmtEndPoints(AuthzTrans trans, MgmtEndpoints meps) { LocateValidator v = new LocateValidator().mgmt_endpoints(meps, false); - if(v.err()) { + if (v.err()) { return Result.err(Result.ERR_BadData,v.errs()); } int count = 0; - for(MgmtEndpoint me : meps.getMgmtEndpoint()) { - if(permToRegister) { + for (MgmtEndpoint me : meps.getMgmtEndpoint()) { + if (permToRegister) { int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName() AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getName(),"write"); - if(trans.fish(p)) { + if (trans.fish(p)) { LocateDAO.Data data = mapper.locateData(me); locateDAO.update(trans, data, true); ++count; } else { return Result.err(Result.ERR_Denied,"May not register service (needs " + p.getKey() + ')'); } - } else { //TODO if(MechID is part of Namespace) { + } else { //TODO if (MechID is part of Namespace) { LocateDAO.Data data = mapper.locateData(me); locateDAO.update(trans, data, true); ++count; } } - if(count>0) { + if (count>0) { return Result.ok(); } else { return Result.err(Result.ERR_NotFound, "No endpoints found"); @@ -102,14 +102,14 @@ public class LocateServiceImpl @Override public Result removeMgmtEndPoints(AuthzTrans trans, MgmtEndpoints meps) { LocateValidator v = new LocateValidator().mgmt_endpoint_key(meps); - if(v.err()) { + if (v.err()) { return Result.err(Result.ERR_BadData,v.errs()); } int count = 0; - for(MgmtEndpoint me : meps.getMgmtEndpoint()) { + for (MgmtEndpoint me : meps.getMgmtEndpoint()) { int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName() AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write"); - if(trans.fish(p)) { + if (trans.fish(p)) { LocateDAO.Data data = mapper.locateData(me); data.port_key = UUID.randomUUID(); locateDAO.delete(trans, data, false); @@ -118,7 +118,7 @@ public class LocateServiceImpl return Result.err(Result.ERR_Denied,"May not register service (needs " + p.getKey() + ')'); } } - if(count>0) { + if (count>0) { return Result.ok(); } else { return Result.err(Result.ERR_NotFound, "No endpoints found"); @@ -136,8 +136,8 @@ public class LocateServiceImpl c.setName(type); Props p; - if(dr.isOKhasData()) { - for(ConfigDAO.Data data : dr.value) { + if (dr.isOKhasData()) { + for (ConfigDAO.Data data : dr.value) { p = new Props(); p.setTag(data.tag); p.setValue(data.value); diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java index 6dd3d92a..4f3884d2 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java @@ -40,13 +40,13 @@ import locate.v1_0.MgmtEndpoints; */ public class LocateValidator extends Validator { private LocateValidator endpoint_key(Endpoint e) { - if(e==null) { + if (e==null) { msg("Endpoint Data is null."); } else { nullOrBlank("Endpoint Name", e.getName()); - if(e.getName()!=null) { + if (e.getName()!=null) { int idx = e.getName().indexOf('.'); - if(idx<=0) { + if (idx<=0) { msg("Endpoint Name must prefixed by Namespace"); } } @@ -59,7 +59,7 @@ public class LocateValidator extends Validator { public LocateValidator endpoint(Endpoint e) { endpoint_key(e); - if(e!=null) { + if (e!=null) { intRange("Endpoint Major Version",e.getMajor(),0,2000); intRange("Endpoint Minor Version",e.getMinor(),0,2000); intRange("Endpoint Patch Version",e.getPatch(),0,2000); @@ -67,7 +67,7 @@ public class LocateValidator extends Validator { floatRange("Endpoint Latitude",e.getLatitude(),-90f,90f); floatRange("Endpoint Longitude",e.getLongitude(),-180f,180f); nullOrBlank("Endpoint Protocol", e.getProtocol()); - for(String s : e.getSubprotocol()) { + for (String s : e.getSubprotocol()) { nullOrBlank("Endpoint Subprotocol", s); } } @@ -75,13 +75,13 @@ public class LocateValidator extends Validator { } public LocateValidator endpoints(Endpoints e, boolean emptyNotOK) { - if(e==null) { + if (e==null) { msg("Endpoints Data is null."); } else { - if(emptyNotOK && e.getEndpoint().size()==0) { + if (emptyNotOK && e.getEndpoint().size()==0) { msg("Endpoints contains no endpoints"); } else { - for(Endpoint ep : e.getEndpoint()) { + for (Endpoint ep : e.getEndpoint()) { endpoint(ep); } } @@ -90,10 +90,10 @@ public class LocateValidator extends Validator { } public LocateValidator mgmt_endpoint_key(MgmtEndpoints meps) { - if(meps==null) { + if (meps==null) { msg("MgmtEndpoints Data is null."); } else { - for(MgmtEndpoint ep : meps.getMgmtEndpoint()) { + for (MgmtEndpoint ep : meps.getMgmtEndpoint()) { endpoint_key(ep); } } @@ -101,13 +101,13 @@ public class LocateValidator extends Validator { } public LocateValidator mgmt_endpoints(MgmtEndpoints me, boolean emptyOK) { - if(me==null) { + if (me==null) { msg("MgmtEndpoints Data is null."); } else { - if(!emptyOK && me.getMgmtEndpoint().size()==0) { + if (!emptyOK && me.getMgmtEndpoint().size()==0) { msg("MgmtEndpoints contains no data"); } else { - for(MgmtEndpoint ep : me.getMgmtEndpoint()) { + for (MgmtEndpoint ep : me.getMgmtEndpoint()) { mgmt_endpoint(ep); } } @@ -117,21 +117,21 @@ public class LocateValidator extends Validator { private LocateValidator mgmt_endpoint(MgmtEndpoint ep) { endpoint(ep); - for(SpecialPorts sp : ep.getSpecialPorts()) { + for (SpecialPorts sp : ep.getSpecialPorts()) { specialPorts(sp); } return this; } private LocateValidator specialPorts(SpecialPorts sp) { - if(sp==null) { + if (sp==null) { msg("Special Ports is null."); } else { nullOrBlank("Special Port Name",sp.getName()); nullOrBlank("Special Port Protocol",sp.getProtocol()); intRange("Special Port",sp.getPort(),0,1000000); - for(String s : sp.getProtocolVersions()) { + for (String s : sp.getProtocolVersions()) { nullOrBlank("Special Port Protocol Version", s); } } -- cgit 1.2.3-korg