diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:23 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:26 -0500 |
commit | 7e966914050e66219689001ff4ab601a49eef0ac (patch) | |
tree | b1bf643f2d191207adc7d9f6b41ac20f56083e76 /misc/env | |
parent | ead32f193586e39b59bb366bddf70e665173a52d (diff) |
Mass whitespace changes (Style Warnings)
Issue-ID: AAF-473
Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/env')
17 files changed, 141 insertions, 141 deletions
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java b/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java index d72222e8..a8f0951e 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java @@ -71,13 +71,13 @@ public class BaseDataFactory { env.staticSlot(EnvFactory.SCHEMA_DIR),
EnvFactory.DEFAULT_SCHEMA_DIR);
File dir = new File(schemaDir);
- if(!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exist. You can set this with " + EnvFactory.SCHEMA_DIR + " property");
+ if (!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exist. You can set this with " + EnvFactory.SCHEMA_DIR + " property");
FileInputStream[] fis = new FileInputStream[filenames.length];
Source[] sources = new Source[filenames.length];
File f;
- for(int i=0; i<filenames.length; ++i) {
- if(!(f=new File(schemaDir + File.separatorChar + filenames[i])).exists()) {
- if(!f.exists()) throw new APIException("Cannot find " + f.getName() + " for schema validation");
+ for (int i=0; i<filenames.length; ++i) {
+ if (!(f=new File(schemaDir + File.separatorChar + filenames[i])).exists()) {
+ if (!f.exists()) throw new APIException("Cannot find " + f.getName() + " for schema validation");
}
try {
fis[i]=new FileInputStream(f);
@@ -95,7 +95,7 @@ public class BaseDataFactory { } catch (SAXException e) {
throw new APIException(e);
} finally {
- for(FileInputStream d : fis) {
+ for (FileInputStream d : fis) {
try {
d.close();
} catch (IOException e) {
@@ -109,10 +109,10 @@ public class BaseDataFactory { public static QName getQName(Class<?> clss) throws APIException {
// Obtain the Necessary info for QName from Requirement
XmlRootElement xre = clss.getAnnotation(XmlRootElement.class);
- if(xre==null)throw new APIException(clss.getName() + " does not have an XmlRootElement annotation");
+ if (xre==null)throw new APIException(clss.getName() + " does not have an XmlRootElement annotation");
Package pkg = clss.getPackage();
XmlSchema xs = pkg.getAnnotation(XmlSchema.class);
- if(xs==null) throw new APIException(clss.getName() + " package-info does not have an XmlSchema annotation");
+ if (xs==null) throw new APIException(clss.getName() + " package-info does not have an XmlSchema annotation");
return new QName(xs.namespace(),xre.name());
}
@@ -367,7 +367,7 @@ public class BaseDataFactory { // */
// public Character objectify(Env env, String input) throws APIException {
// int length = input.length();
-// if(length<1 || length>1) {
+// if (length<1 || length>1) {
// throw new APIException("String [" + input + "] does not represent a single Character");
// }
// return input.charAt(0);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java index aa74edc9..f2b539a3 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java @@ -68,8 +68,8 @@ public interface LogTarget { PrintStream out = System.out;
out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
- if(str!=null) {
+ for (Object str : msgs) {
+ if (str!=null) {
out.print(str.toString());
out.print(' ');
} else {
@@ -83,7 +83,7 @@ public interface LogTarget { PrintStream out = System.out;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
@@ -108,7 +108,7 @@ public interface LogTarget { PrintStream out = System.err;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
@@ -120,7 +120,7 @@ public interface LogTarget { PrintStream out = System.err;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java b/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java index b8a8e03a..6848be09 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java @@ -81,15 +81,15 @@ public class StoreImpl implements Store { staticMap = new HashMap<>();
localMap = new HashMap<>();
- if(tag!=null) {
+ if (tag!=null) {
String tequals = tag + '=';
- for(String arg : args) {
- if(arg.startsWith(tequals) && !arg.equals(tequals)) { // needs to have something after =
+ for (String arg : args) {
+ if (arg.startsWith(tequals) && !arg.equals(tequals)) { // needs to have something after =
Properties props = new Properties();
- for(String f : Split.split(File.pathSeparatorChar,arg.substring(tequals.length()))) {
+ for (String f : Split.split(File.pathSeparatorChar,arg.substring(tequals.length()))) {
moreProps(new File(f),props);
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
}
@@ -105,29 +105,29 @@ public class StoreImpl implements Store { staticMap = new HashMap<>();
localMap = new HashMap<>();
- if(tag!=null) {
+ if (tag!=null) {
String fname = props.getProperty(tag);
- if(fname!=null) {
- for(String f : Split.split(File.pathSeparatorChar,fname)) {
- if(!moreProps(new File(f),props)) {
+ if (fname!=null) {
+ for (String f : Split.split(File.pathSeparatorChar,fname)) {
+ if (!moreProps(new File(f),props)) {
System.err.println("Unable to load Properties from " + f);
}
}
}
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
}
public void propsFromArgs(String tag, String[] args) {
- if(tag!=null) {
- for(String arg : args) {
+ if (tag!=null) {
+ for (String arg : args) {
String sarg[] = Split.split('=',arg);
- if(sarg.length==2) {
- if(tag.equals(sarg[0])) {
- for(String fname : Split.split(File.pathSeparatorChar,sarg[1])) {
+ if (sarg.length==2) {
+ if (tag.equals(sarg[0])) {
+ for (String fname : Split.split(File.pathSeparatorChar,sarg[1])) {
moreProps(new File(fname),null /* no target */);
}
}
@@ -138,22 +138,22 @@ public class StoreImpl implements Store { }
private boolean moreProps(File f, Properties target) {
- if(f.exists()) {
+ if (f.exists()) {
Properties props = new Properties();
try {
FileInputStream fis = new FileInputStream(f);
try {
props.load(fis);
- if(target!=null) {
+ if (target!=null) {
target.load(fis);
}
} finally {
fis.close();
}
- } catch(IOException e) {
+ } catch (IOException e) {
System.err.println(e);
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
return true;
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java index b86b4fbb..c0e7bde7 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java @@ -124,7 +124,7 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore { Metric metric = new Metric();
int last = (metric.entries = trail.size()) -1;
metric.buckets = flags.length==0?EMPTYF:new float[flags.length];
- if(last>=0) {
+ if (last>=0) {
TimeTaken first = trail.get(0);
// If first entry is sub, then it's actually the last "end" as well
// otherwise, check end
@@ -133,48 +133,48 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore { metric.total = (end - first.start) / 1000000f;
}
- if(sb==null) {
- for(TimeTaken tt : trail) {
+ if (sb==null) {
+ for (TimeTaken tt : trail) {
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
}
- } else if(!lt.isLoggable()) {
+ } else if (!lt.isLoggable()) {
boolean first = true;
- for(TimeTaken tt : trail) {
+ for (TimeTaken tt : trail) {
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
- if((tt.flag&ALWAYS)==ALWAYS) {
- if(first) first = false;
+ if ((tt.flag&ALWAYS)==ALWAYS) {
+ if (first) first = false;
else sb.append('/');
sb.append(tt.name);
}
}
} else {
Stack<Long> stack = new Stack<Long>();
- for(TimeTaken tt : trail) {
+ for (TimeTaken tt : trail) {
// Create Indentation based on SUB
- while(!stack.isEmpty() && tt.end()>stack.peek()) {
+ while (!stack.isEmpty() && tt.end()>stack.peek()) {
--indent;
stack.pop();
}
- for(int i=0;i<indent;++i) {
+ for (int i=0;i<indent;++i) {
sb.append(" ");
}
tt.output(sb);
sb.append('\n');
- if((tt.flag&SUB)==SUB) {
+ if ((tt.flag&SUB)==SUB) {
stack.push(tt.end());
++indent;
}
// Add time values to Metric
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
}
}
@@ -200,7 +200,7 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore { Object o;
try {
o = slot.get(state);
- } catch(ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
// Env State Size has changed because of dynamic Object creation... Rare event, but needs to be covered
Object[] temp = ((StoreImpl) delegate).newTransState();
System.arraycopy(state, 0, temp, 0, state.length);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java index 94f7d47b..6fbfacdb 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java @@ -86,9 +86,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX super(null, tags);
// props = new HashMap<>();
// String value;
-// for(int i=0;i<tags.length;++i) {
+// for (int i=0;i<tags.length;++i) {
// value = applet.getParameter(tags[i]);
-// if(value!=null) {
+// if (value!=null) {
// props.put(tags[i], value);
// }
// }
@@ -164,11 +164,11 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX case Env.REMOTE: sb.append("REMOTE "); break;
}
sb.append(name);
- if(flag != Env.CHECKPOINT) {
+ if (flag != Env.CHECKPOINT) {
sb.append(' ');
sb.append((end-start)/1000000f);
sb.append("ms");
- if(size>=0) {
+ if (size>=0) {
sb.append(" size: ");
sb.append(Long.toString(size));
}
@@ -185,11 +185,11 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX public Properties getProperties(String ... filter) {
Properties props = new Properties();
boolean yes;
- for(String key : existingStaticSlotNames()) {
- if(filter.length>0) {
+ for (String key : existingStaticSlotNames()) {
+ if (filter.length>0) {
yes = false;
- for(String f : filter) {
- if(key.startsWith(f)) {
+ for (String f : filter) {
+ if (key.startsWith(f)) {
yes = true;
break;
}
@@ -197,9 +197,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX } else {
yes = true;
}
- if(yes) {
+ if (yes) {
String value = getProperty(key);
- if(value!=null) {
+ if (value!=null) {
props.put(key, value);
}
}
@@ -242,7 +242,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX // @SuppressWarnings("unchecked")
// @Override
public <T> DataFactory<T> newDataFactory(Class<?>... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this,classes);
}
@@ -250,7 +250,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX // @SuppressWarnings("unchecked")
// @Override
public <T> DataFactory<T> newDataFactory(Schema schema, Class<?>... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this, schema, classes);
}
@@ -258,7 +258,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX // @SuppressWarnings("unchecked")
// @Override
public<T> DataFactory<T> newDataFactory(QName qName, Class<?> ... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this, qName, classes);
}
@@ -274,9 +274,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX }
public void loadFromSystemPropsStartsWith(String ... str) {
- for(String name : System.getProperties().stringPropertyNames()) {
- for(String s : str) {
- if(name.startsWith(s)) {
+ for (String name : System.getProperties().stringPropertyNames()) {
+ for (String s : str) {
+ if (name.startsWith(s)) {
setProperty(name, System.getProperty(name));
}
}
@@ -289,10 +289,10 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX */
public void loadToSystemPropsStartsWith(String ... str) {
String value;
- for(String name : existingStaticSlotNames()) {
- for(String s : str) {
- if(name.startsWith(s)) {
- if((value = getProperty(name))!=null)
+ for (String name : existingStaticSlotNames()) {
+ for (String s : str) {
+ if (name.startsWith(s)) {
+ if ((value = getProperty(name))!=null)
System.setProperty(name,value);
}
}
@@ -301,24 +301,24 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX public void loadPropFiles(String tag, ClassLoader classloader) throws IOException {
String propfiles = getProperty(tag);
- if(propfiles!=null) {
- for(String pf : Split.splitTrim(File.pathSeparatorChar, propfiles)) {
+ if (propfiles!=null) {
+ for (String pf : Split.splitTrim(File.pathSeparatorChar, propfiles)) {
InputStream is = classloader==null?null:classloader.getResourceAsStream(pf);
- if(is==null) {
+ if (is==null) {
File f = new File(pf);
- if(f.exists()) {
+ if (f.exists()) {
is = new FileInputStream(f);
}
}
- if(is!=null) {
+ if (is!=null) {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
String line;
- while((line=br.readLine())!=null) {
+ while ((line=br.readLine())!=null) {
line = line.trim();
- if(!line.startsWith("#")) {
+ if (!line.startsWith("#")) {
String[] tv = Split.splitTrim('=', line);
- if(tv.length==2) {
+ if (tv.length==2) {
setProperty(tv[0],tv[1]);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java index c8adfc78..3fcbcf9e 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java @@ -49,16 +49,16 @@ public class JavaUtilLogTarget implements LogTarget { }
public void log(Object ... msgs) {
- if(log.isLoggable(level)) {
+ if (log.isLoggable(level)) {
StringBuilder sb = new StringBuilder();
String msg;
- for(int i=0;i<msgs.length;++i) {
+ for (int i=0;i<msgs.length;++i) {
msg = msgs[i].toString();
- if(msg!=null && msg.length()>0) {
+ if (msg!=null && msg.length()>0) {
int sbl = sb.length();
- if(sbl>0) {
+ if (sbl>0) {
char last = sb.charAt(sbl-1);
- if(" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');
+ if (" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');
}
sb.append(msg);
}
@@ -69,10 +69,10 @@ public class JavaUtilLogTarget implements LogTarget { public void log(Throwable e, Object ... msgs) {
String str = e.getLocalizedMessage();
- if(str==null) {
+ if (str==null) {
str = e.getMessage();
}
- if(str==null) {
+ if (str==null) {
str = e.getClass().getName();
}
log.log(level,str,msgs);
@@ -83,7 +83,7 @@ public class JavaUtilLogTarget implements LogTarget { */
@Override
public void printf(String fmt, Object ... vars) {
- if(log.isLoggable(level)) {
+ if (log.isLoggable(level)) {
log.log(level,String.format(fmt,vars));
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java index 81d9c1b2..b144852a 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java @@ -61,7 +61,7 @@ public class Log4JLogTarget implements LogTarget { // @Override
public void log(Throwable e, Object... msgs) {
- if (log.isEnabledFor(level)) {
+ if (log.isEnabledFor (level)) {
StringBuilder sb = new StringBuilder();
String msg;
@@ -69,7 +69,7 @@ public class Log4JLogTarget implements LogTarget { e.printStackTrace(new PrintWriter(new StringBuilderWriter(sb)));
}
for (int i = 0; i < msgs.length; ++i) {
- if(msgs[i]!=null) {
+ if (msgs[i]!=null) {
msg = msgs[i].toString();
if (msg != null && msg.length() > 0) {
int sbl = sb.length();
@@ -92,7 +92,7 @@ public class Log4JLogTarget implements LogTarget { */
@Override
public void printf(String fmt, Object ... vars) {
- if(log.isEnabledFor(level)) {
+ if (log.isEnabledFor (level)) {
log.log(level,String.format(fmt,vars));
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java index dc7ee192..d140a6b8 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java @@ -152,7 +152,7 @@ public class JAXBDF<T> extends BaseDataFactory implements OldDataFactory<T>,IOOb try {
T t = jumar.unmarshal(env.debug(), input);
return new JAXBData<T>(primaryEnv, this, new JAXBStringifier<T>(jmar), new JAXBObjectifier<T>(jumar),t);
- } catch(JAXBException e) {
+ } catch (JAXBException e) {
throw new APIException(e);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java index 38977a35..6d83aca4 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java @@ -114,7 +114,7 @@ public final class JAXBData<T> implements Data<T>{ * @throws APIException
*/
public String asString(EnvJAXB env) throws APIException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
return dataAsString = stringifier.stringify(env, dataAsObject);
@@ -131,7 +131,7 @@ public final class JAXBData<T> implements Data<T>{ */
// @Override
public String asString() throws APIException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
return dataAsString = stringifier.stringify(creatingEnv, dataAsObject,options);
@@ -139,7 +139,7 @@ public final class JAXBData<T> implements Data<T>{ }
public Data<T> to(OutputStream os) throws APIException, IOException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
os.write(dataAsString.getBytes());
} else if (stringifier instanceof IOStringifier){
((IOStringifier<T>)stringifier).stringify(creatingEnv, dataAsObject, os, options);
@@ -153,7 +153,7 @@ public final class JAXBData<T> implements Data<T>{ // @Override
public JAXBData<T> to(Writer writer) throws APIException, IOException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
writer.write(dataAsString);
} else if (stringifier instanceof IOStringifier){
((IOStringifier<T>)stringifier).stringify(creatingEnv, dataAsObject, writer, options);
@@ -166,7 +166,7 @@ public final class JAXBData<T> implements Data<T>{ public InputStream getInputStream() throws APIException {
- if(dataAsString==null) {
+ if (dataAsString==null) {
dataAsString = stringifier.stringify(creatingEnv,dataAsObject,options);
}
return new ByteArrayInputStream(dataAsString.getBytes());
@@ -184,7 +184,7 @@ public final class JAXBData<T> implements Data<T>{ */
public T asObject(EnvJAXB env) throws APIException {
- if(dataAsObject !=null) {
+ if (dataAsObject !=null) {
return dataAsObject;
} else {
// Some Java compilers need two statements here
@@ -204,7 +204,7 @@ public final class JAXBData<T> implements Data<T>{ */
// @Override
public T asObject() throws APIException {
- if(dataAsObject !=null) {
+ if (dataAsObject !=null) {
return dataAsObject;
} else {
// Some Java compilers need two statements here
@@ -239,7 +239,7 @@ public final class JAXBData<T> implements Data<T>{ */
// @Override
public String toString() {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
try {
@@ -292,8 +292,8 @@ public final class JAXBData<T> implements Data<T>{ int count;
do {
count = input.read(b);
- if(count>0)output.write(b, 0, count);
- } while(count>=0);
+ if (count>0)output.write(b, 0, count);
+ } while (count>=0);
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java index 46c40ebb..524fc668 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java @@ -80,10 +80,10 @@ public class JAXBmar { }
public Marshaller get(boolean pretty, boolean fragment) throws JAXBException {
- if(pretty != p) {
+ if (pretty != p) {
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, p = pretty);
}
- if(fragment != f) {
+ if (fragment != f) {
m.setProperty(Marshaller.JAXB_FRAGMENT, f = fragment);
}
return m;
@@ -139,7 +139,7 @@ public class JAXBmar { Pool<PMarshaller> mp;
synchronized(pools) {
mp = pools.get(classes);
- if(mp==null) {
+ if (mp==null) {
pools.put(classes,mp = new Pool<PMarshaller>(new Creator(classes)));
}
}
@@ -165,7 +165,7 @@ public class JAXBmar { fragment = options.length>1?options[1]:this.fragment;
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, writer);
} else {
m.content.get(pretty,fragment).marshal(
@@ -185,7 +185,7 @@ public class JAXBmar { fragment = options.length>1?options[1]:this.fragment;
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, os);
} else {
m.content.get(pretty,fragment).marshal(
@@ -200,7 +200,7 @@ public class JAXBmar { public<O> O marshal(LogTarget lt, O o, Writer writer, Class<O> clss) throws JAXBException, APIException {
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, writer);
} else {
m.content.get(pretty,fragment).marshal(
@@ -216,7 +216,7 @@ public class JAXBmar { public<O> O marshal(LogTarget lt, O o, OutputStream os, Class<O> clss) throws JAXBException, APIException {
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, os);
} else {
m.content.get(pretty,fragment).marshal(
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java index fe3f0145..30345e7c 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java @@ -85,7 +85,7 @@ public class JAXBumar { }
public Unmarshaller get(Schema schema) throws JAXBException {
- if(s != schema) {
+ if (s != schema) {
u.setSchema(s = schema);
}
return u;
@@ -135,7 +135,7 @@ public class JAXBumar { Pool<SUnmarshaller> mp;
synchronized(pools) {
mp = pools.get(classes);
- if(mp==null) {
+ if (mp==null) {
pools.put(classes,mp = new Pool<SUnmarshaller>(new Creator(classes)));
}
}
@@ -174,7 +174,7 @@ public class JAXBumar { @SuppressWarnings("unchecked")
public<O> O unmarshal(LogTarget env, String xml) throws JAXBException, APIException {
- if(xml==null) throw new JAXBException("Null Input for String unmarshal");
+ if (xml==null) throw new JAXBException("Null Input for String unmarshal");
Pooled<SUnmarshaller> s = mpool.get(env);
try {
return (O)s.content.get(schema).unmarshal(
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 ae78918c..553d7ade 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 @@ -107,17 +107,17 @@ public class Chrono { }
public static String utcStamp(Date date) {
- if(date==null)return "";
+ if (date==null)return "";
return utcFmt.format(date);
}
public static String utcStamp(GregorianCalendar gc) {
- if(gc==null)return "";
+ if (gc==null)return "";
return utcFmt.format(gc.getTime());
}
public static String utcStamp(XMLGregorianCalendar xgc) {
- if(xgc==null)return "";
+ if (xgc==null)return "";
return utcFmt.format(xgc.toGregorianCalendar().getTime());
}
@@ -126,17 +126,17 @@ public class Chrono { }
public static String dateStamp(GregorianCalendar gc) {
- if(gc == null)return "";
+ if (gc == null)return "";
return dateFmt.format(gc.getTime());
}
public static String dateStamp(Date date) {
- if(date == null)return "";
+ if (date == null)return "";
return dateFmt.format(date);
}
public static String dateStamp(XMLGregorianCalendar xgc) {
- if(xgc==null)return "";
+ if (xgc==null)return "";
return dateFmt.format(xgc.toGregorianCalendar().getTime());
}
@@ -172,7 +172,7 @@ public class Chrono { * @return
*/
public static String dateTime(GregorianCalendar gc) {
- if(gc == null)return "";
+ if (gc == null)return "";
TimeZone tz = gc.getTimeZone();
int tz1 = (tz.getRawOffset()+tz.getDSTSavings())/0x8CA0;
int tz1abs = Math.abs(tz1);
@@ -251,7 +251,7 @@ public class Chrono { }
public static GregorianCalendar firstMomentOfDay(GregorianCalendar begin) {
- if(begin==null)begin = new GregorianCalendar();
+ if (begin==null)begin = new GregorianCalendar();
begin.set(GregorianCalendar.HOUR, 0);
begin.set(GregorianCalendar.AM_PM, GregorianCalendar.AM);
begin.set(GregorianCalendar.MINUTE, 0);
@@ -261,7 +261,7 @@ public class Chrono { }
public static GregorianCalendar lastMomentOfDay(GregorianCalendar end) {
- if(end==null)end = new GregorianCalendar();
+ if (end==null)end = new GregorianCalendar();
end.set(GregorianCalendar.HOUR, 11);
end.set(GregorianCalendar.MINUTE, 59);
end.set(GregorianCalendar.SECOND, 59);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java index 97d9de99..b9191c00 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java @@ -43,7 +43,7 @@ public class DoubleOutputStream extends OutputStream { */
@Override
public void write(int c) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(c);
}
}
@@ -58,14 +58,14 @@ public class DoubleOutputStream extends OutputStream { */
@Override
public void write(byte bbuf[], int off, int len) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(bbuf,off,len);
}
}
@Override
public void write(byte[] b) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(b);
}
}
@@ -75,8 +75,8 @@ public class DoubleOutputStream extends OutputStream { */
@Override
public void close() throws IOException {
- for(int i=0;i<oss.length;++i) {
- if(close[i]) {
+ for (int i=0;i<oss.length;++i) {
+ if (close[i]) {
oss[i].close();
}
}
@@ -87,7 +87,7 @@ public class DoubleOutputStream extends OutputStream { */
@Override
public void flush() throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.flush();
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java index 759a8c8b..3d6416cd 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java @@ -87,7 +87,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> { public T get(Env env) throws APIException {
Thread t = Thread.currentThread();
T obj = objs.get(t);
- if(obj==null || refreshed>obj.created()) {
+ if (obj==null || refreshed>obj.created()) {
try {
obj = cnst.newInstance(new Object[]{env});
} catch (InvocationTargetException e) {
@@ -96,7 +96,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> { throw new APIException(e);
}
T destroyMe = objs.put(t,obj);
- if(destroyMe!=null) {
+ if (destroyMe!=null) {
destroyMe.destroy(env);
}
}
@@ -118,7 +118,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> { */
public void remove(Env env) {
T obj = objs.remove(Thread.currentThread());
- if(obj!=null)
+ if (obj!=null)
obj.destroy(env);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java index 4069c329..b0da8ba2 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java @@ -33,20 +33,20 @@ public class Split { private static final String[] BLANK = new String[0];
public static String[] split(char c, String value) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
// Count items to preallocate Array (memory alloc is more expensive than counting twice)
int count,idx;
- for(count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
+ for (count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
String[] rv = new String[count];
- if(count==1) {
+ if (count==1) {
rv[0]=value;
} else {
int last=0;
count=-1;
- for(idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx);
last = ++idx;
}
@@ -56,19 +56,19 @@ public class Split { }
public static String[] splitTrim(char c, String value) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
// Count items to preallocate Array (memory alloc is more expensive than counting twice)
int count,idx;
- for(count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
+ for (count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
String[] rv = new String[count];
- if(count==1) {
+ if (count==1) {
rv[0]=value.trim();
} else {
int last=0;
count=-1;
- for(idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx).trim();
last = ++idx;
}
@@ -78,19 +78,19 @@ public class Split { }
public static String[] splitTrim(char c, String value, int size) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
int idx;
String[] rv = new String[size];
- if(size==1) {
+ if (size==1) {
rv[0]=value.trim();
} else {
int last=0;
int count=-1;
size-=2;
- for(idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx).trim();
last = ++idx;
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java index c512b09a..31d4bf3c 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java @@ -114,7 +114,7 @@ public class StringBuilderOutputStream extends OutputStream { if (csq == null) {
write("null");
} else {
- for(int i = 0;i<csq.length();++i) {
+ for (int i = 0;i<csq.length();++i) {
buf.append(csq.charAt(i));
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java index 914a01b0..9feaf3ef 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java @@ -48,7 +48,7 @@ public class JU_Log4JLogTargetTest { MockitoAnnotations.initMocks(this);
PowerMockito.mockStatic(Logger.class);
when(Logger.getLogger("Info")).thenReturn(log);
- when(log.isEnabledFor(Level.DEBUG)).thenReturn(false);
+ when(log.isEnabledFor (Level.DEBUG)).thenReturn(false);
}
@Test
|