X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Frserv%2FAcceptor.java;fp=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Frserv%2FAcceptor.java;h=0e70e25e7a2a820d7b5fe956b07fd0744c3a2957;hb=7e966914050e66219689001ff4ab601a49eef0ac;hp=30924dd5d7d7f04e853a9267cf6964d865273318;hpb=ead32f193586e39b59bb366bddf70e665173a52d;p=aaf%2Fauthz.git diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java index 30924dd5..0e70e25e 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java @@ -46,16 +46,16 @@ class Acceptor { private boolean eval(HttpCode code, String str, List props) { // int plus = str.indexOf('+'); -// if(plus<0) { +// if (plus<0) { boolean ok = false; boolean any = false; - for(Pair, List>>> type : types) { + for (Pair, List>>> type : types) { ok = true; - if(type.x.equals(str)) { - for(Iterator iter = props.iterator();ok && iter.hasNext();) { + if (type.x.equals(str)) { + for (Iterator iter = props.iterator();ok && iter.hasNext();) { ok = props(type,iter.next(),iter.next()); } - if(ok) { + if (ok) { any = true; acceptable.add(type); } @@ -65,11 +65,11 @@ class Acceptor { // int prev = str.indexOf('/')+1; // String first = str.substring(0,prev); // String nstr; -// while(prev!=0) { +// while (prev!=0) { // nstr = first + (plus<0?str.substring(prev):str.substring(prev,plus)); // -// for(Pair, List>>> type : types) { -// if(type.x.equals(nstr)) { +// for (Pair, List>>> type : types) { +// if (type.x.equals(nstr)) { // acceptable.add(type); // return type; // } @@ -90,14 +90,14 @@ class Acceptor { */ private boolean props(Pair, List>>> type, String tag, String value) { boolean rv = false; - if(type.y!=null) { - for(Pair prop : type.y.y){ - if(tag.equals(prop.x)) { - if(tag.equals("charset")) { + if (type.y!=null) { + for (Pair prop : type.y.y){ + if (tag.equals(prop.x)) { + if (tag.equals("charset")) { return prop.x==null?false:prop.y.equals(value.toLowerCase()); // return True if Matched - } else if(tag.equals("version")) { + } else if (tag.equals("version")) { return prop.y.equals(new Version(value)); // Note: Version Class knows Minor Version encoding - } else if(tag.equals(Content.Q)) { // replace Q value + } else if (tag.equals(Content.Q)) { // replace Q value try { type.y.y.get(0).y=Float.parseFloat(value); } catch (NumberFormatException e) { @@ -135,34 +135,34 @@ class Acceptor { name=null; cis = cie+1; // find comma start - while(ciscis && Character.isSpaceChar(bytes[cend-1]))--cend; + while (cend>cis && Character.isSpaceChar(bytes[cend-1]))--cend; // Start SEMIS sie=cis-1; do { sis = sie+1; // semi start is one after previous end - while(siscend || sie<0?cend:sie; // if the Semicolon is after the comma, or non-existent, use comma end, else keep - while(send>sis && Character.isSpaceChar(bytes[send-1]))--send; - if(name==null) { // first entry in Comma set is the name, not a property + while (send>sis && Character.isSpaceChar(bytes[send-1]))--send; + if (name==null) { // first entry in Comma set is the name, not a property name = new String(bytes,sis,send-sis); } else { // We've looped past the first Semi, now process as properties // If there are additional elements (more entities within Semi Colons) // apply Properties int eq = cntnt.indexOf('=',sis); - if(eq>sis && eqsis && eq=cis); // End SEMI processing + } while (sie<=cend && sie>=cis); // End SEMI processing // Now evaluate Comma set and return if true - if(eval(code,name,props))return true; // else loop again to check next comma - } while(cie>=0); // loop to next comma + if (eval(code,name,props))return true; // else loop again to check next comma + } while (cie>=0); // loop to next comma return false; // didn't get even one match }