package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util;
import com.google.common.io.ByteStreams;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-
import java.io.InputStream;
import java.io.PrintStream;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
/**
* Wrapper class for static method calls to core or core libraries.
* the classes that uses static calls.
*/
public class SystemFunctions {
- private static SystemFunctions INSTANCE;
+ private static SystemFunctions singletonInstance;
/**
* @return singleton instance
*/
public static SystemFunctions systemFunctions() {
- if (INSTANCE != null) {
- return INSTANCE;
+ if (singletonInstance != null) {
+ return singletonInstance;
} else {
synchronized (SystemFunctions.class) {
- INSTANCE = new SystemFunctions();
+ singletonInstance = new SystemFunctions();
}
- return INSTANCE;
+ return singletonInstance;
}
}
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
- throw new RuntimeException(e);
+ Thread.currentThread().interrupt();
+ throw new UserInvisibleError("Interrupted while sleep", e);
}
}
InputStream stream = SystemFunctions.class.getClassLoader().getResourceAsStream(url);
return ByteStreams.toByteArray(stream);
} catch (Exception e) {
- throw new RuntimeException("Unable to load " + url, e);
+ throw new UserVisibleError("Unable to load " + url, e);
}
}
* variable <code>out</code>, has been redirected to a file or other
* destination that is typically not continuously monitored.
*/
+ @SuppressWarnings("squid:S106") // (intentional wrapping of system err)
public PrintStream err() {
return System.err;
}
* @see java.io.PrintStream#println(java.lang.Object)
* @see java.io.PrintStream#println(java.lang.String)
*/
+ @SuppressWarnings("squid:S106") // (intentional wrapping of system err)
public PrintStream out() {
return System.out;
}
* the host environment or user.
*/
public InputStream in() {
- return System.in;
+ return System.in; //NO SONAR (intentional wrapping of system in)
}
/**
public CloseableHttpClient getHttpClient() {
return HttpClients.createDefault();
}
-}
+}
\ No newline at end of file