Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void executeOnBundle(Bundle bundle) throws Exception {
}
}

private boolean isExported(String className, List<String> exports) {
private static boolean isExported(String className, List<String> exports) {
boolean exported = false;
int lastSlashIdx = className.lastIndexOf("/");
if (lastSlashIdx > -1) {
Expand All @@ -87,7 +87,7 @@ private boolean isExported(String className, List<String> exports) {
return exported;
}

private List<String> getExports(Bundle bundle) {
private static List<String> getExports(Bundle bundle) {
List<String> exports = new ArrayList<>();
BundleRevision rev = bundle.adapt(BundleRevision.class);
List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private boolean checkPackage(String packageName, String version) {
return false;
}

private String getAttribute(BundleCapability cap, String name) {
private static String getAttribute(BundleCapability cap, String name) {
Object obj = cap.getAttributes().get(name);
return obj != null ? obj.toString() : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void determineBundleLevelThreshold() {
}
}

private String printHosts(BundleInfo info) {
private static String printHosts(BundleInfo info) {
if (info.getFragmentHosts().size() <= 0) {
return "";
}
Expand All @@ -194,7 +194,7 @@ private String printHosts(BundleInfo info) {
return builder.toString();
}

private String printFragments(BundleInfo info) {
private static String printFragments(BundleInfo info) {
if (info.getFragments().size() <= 0) {
return "";
}
Expand All @@ -211,7 +211,7 @@ private String printFragments(BundleInfo info) {
return builder.toString();
}

private String getStateString(BundleState state) {
private static String getStateString(BundleState state) {
return (state == null) ? "" : state.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public Object execute() throws Exception {
return null;
}

private boolean confirm(Session session) throws IOException {
private static boolean confirm(Session session) throws IOException {
for (;;) {
String msg = "You are about to perform a start/stop/refresh load test on bundles.\nDo you wish to continue (yes/no): ";
String str = session.readLine(msg, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private boolean isCommandOrCompleter(String[] objectClasses) {
return false;
}

private void printProperties(ServiceReference<?> serviceRef) {
private static void printProperties(ServiceReference<?> serviceRef) {
for (String key : serviceRef.getPropertyKeys()) {
System.out.println(key + " = " + ShellUtil.getValueString(serviceRef.getProperty(key)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected Object doExecute(Bundle bundle) throws Exception {
/**
* Return a String representation of a bundle state
*/
private String getState(Bundle bundle) {
private static String getState(Bundle bundle) {
switch (bundle.getState()) {
case Bundle.UNINSTALLED : return "UNINSTALLED";
case Bundle.INSTALLED : return "INSTALLED";
Expand All @@ -91,7 +91,7 @@ private String getState(Bundle bundle) {
/*
* Print the header
*/
private void printHeader(Bundle bundle) {
private static void printHeader(Bundle bundle) {
System.out.printf("Bundle %s [%s] is currently %s%n",
bundle.getSymbolicName(),
bundle.getBundleId(),
Expand Down Expand Up @@ -121,7 +121,7 @@ private void printTree(Tree<Bundle> tree) {
* Check for bundles in the tree exporting the same package
* as a possible cause for 'Unresolved constraint...' on a uses-conflict
*/
private void printDuplicatePackages(Tree<Bundle> tree) {
private static void printDuplicatePackages(Tree<Bundle> tree) {
Set<Bundle> bundles = tree.flatten();
Map<String, Set<Bundle>> exports = new HashMap<>();

Expand Down Expand Up @@ -218,7 +218,7 @@ private void createNodeForImport(Node<Bundle> node, Bundle bundle, Clause i) {
}
}

private String getAttribute(BundleCapability capability, String name) {
private static String getAttribute(BundleCapability capability, String name) {
Object o = capability.getAttributes().get(name);
return o != null ? o.toString() : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected Object doExecute(Bundle bundle) throws Exception {
/**
* Return a String representation of a bundle state
*/
private String getState(Bundle bundle) {
private static String getState(Bundle bundle) {
switch (bundle.getState()) {
case Bundle.UNINSTALLED:
return "Uninstalled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private boolean hasNextSibling() {
/*
* Add an element to the end of the array
*/
private boolean[] concat(boolean[] array, boolean element) {
private static boolean[] concat(boolean[] array, boolean element) {
boolean[] result = new boolean[array.length + 1];
System.arraycopy(array, 0, result, 0, array.length);
result[array.length] = element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private void populateFragementInfos(Bundle bundle) {
}
}

private String populateRevisions(Bundle bundle) {
private static String populateRevisions(Bundle bundle) {
BundleRevisions revisions = bundle.adapt(BundleRevisions.class);
if (revisions == null) {
return "";
Expand Down Expand Up @@ -119,7 +119,7 @@ private void getFragmentHosts(BundleRevision revision) {
}
}

private BundleState getBundleState(Bundle bundle) {
private static BundleState getBundleState(Bundle bundle) {
BundleState state = bundleStateMap.get(bundle.getState());
return state == null ? BundleState.Unknown : state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void addMatchingBundles(String id, List<Bundle> bundles) {
}
}

private void addBundle(Bundle bundle, String id, List<Bundle> bundles) {
private static void addBundle(Bundle bundle, String id, List<Bundle> bundles) {
if (bundle == null) {
// if the bundle is null here, it's because we didn't find it
System.err.println("Bundle " + id + " is invalid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void disableDynamicImports(Bundle bundle) {
/*
* Explode a set of string values in to a ,-delimited string
*/
private String explode(Set<String> set) {
private static String explode(Set<String> set) {
StringBuilder result = new StringBuilder();
Iterator<String> it = set.iterator();
while (it.hasNext()) {
Expand Down Expand Up @@ -335,7 +335,7 @@ public String getStatus(String id) {
* @param bundle the bundle
* @return bundle state String
*/
private String getState(Bundle bundle) {
private static String getState(Bundle bundle) {
switch (bundle.getState()) {
case Bundle.UNINSTALLED:
return "Uninstalled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ public void run() {
}
}

private String getLocation(Bundle bundle) {
private static String getLocation(Bundle bundle) {
Comment thread
rovarga marked this conversation as resolved.
String location = bundle.getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
return location != null ? location : bundle.getLocation();
}

private boolean isMavenSnapshotUrl(String url) {
private static boolean isMavenSnapshotUrl(String url) {
return url.startsWith("mvn:") && url.contains("SNAPSHOT");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void setStartLevel(String bundleId, int bundleStartLevel) throws MBeanExc
}
}

private BundleStartLevel getBundleStartLevel(Bundle bundle) {
private static BundleStartLevel getBundleStartLevel(Bundle bundle) {
return bundle.adapt(BundleStartLevel.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ private Bundle[] createBundles() {
return new Bundle[] { bundle1, bundle2, bundle3 };
}

private void addUsedServices(Bundle bundle, ServiceReference<?> ... refs) {
private static void addUsedServices(Bundle bundle, ServiceReference<?> ... refs) {
expect(bundle.getServicesInUse()).andReturn(refs).anyTimes();
}

private void addRegisteredServices(Bundle bundle, ServiceReference<?> ... refs) {
private static void addRegisteredServices(Bundle bundle, ServiceReference<?> ... refs) {
expect(bundle.getRegisteredServices()).andReturn(refs).anyTimes();
for (ServiceReference<?> ref : refs) {
expect(ref.getBundle()).andReturn(bundle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void hasAncestor() throws IOException {
assertFalse(node.hasAncestor("child1"));
}

private BufferedReader read(Tree<String> tree) {
private static BufferedReader read(Tree<String> tree) {
StringWriter writer = new StringWriter();
tree.write(new PrintWriter(writer));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public int complete(final Session session, final CommandLine commandLine, final
* Retrieves the pid stored in the {@link Session} or passed as an argument.
* Argument takes precedence from pid stored in the {@link Session}.
*/
private String getPid(Session session, CommandLine commandLine) {
private static String getPid(Session session, CommandLine commandLine) {
String pid = (String) session.get(ConfigCommandSupport.PROPERTY_CONFIG_PID);
if (commandLine.getArguments().length > 0) {
List<String> arguments = Arrays.asList(commandLine.getArguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testupdateOnNewFactoryPid() throws Exception {
EasyMock.verify(configRepo);
}

private MockCommandSession createMockSessionForFactoryEdit(String pid, boolean isFactory,
private static MockCommandSession createMockSessionForFactoryEdit(String pid, boolean isFactory,
Dictionary<String, Object> props) {
MockCommandSession session = new MockCommandSession();
session.put(ConfigCommandSupport.PROPERTY_CONFIG_PID, pid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void destroy() {
bundleContext.removeBundleListener(this);
}

private boolean isKnownFeaturesURI(String uri){
private static boolean isKnownFeaturesURI(String uri){
if(uri == null){
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void createTestFiles() throws Exception {
badZipFile = badZipFileFile.toURI();
}

private void createJarFromFolder(Path sourceDir, File jarFile) throws Exception {
private static void createJarFromFolder(Path sourceDir, File jarFile) throws Exception {
try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile))) {
Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() {
@Override
Expand All @@ -115,7 +115,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
}
}

private void createZipFromFolder(Path sourceDir, File zipFile) throws Exception {
private static void createZipFromFolder(Path sourceDir, File zipFile) throws Exception {
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))) {
Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void stop(BundleContext context) throws Exception {
}
}

private boolean isWindows() {
private static boolean isWindows() {
return System.getProperty("os.name", "Unknown").startsWith("Win");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void writeDump(final OutputStreamWriter outputStream) throws Exception
dumpGCInformation(outPW);
}

private void dumpKarafInformation(final PrintWriter outPW) {
private static void dumpKarafInformation(final PrintWriter outPW) {
outPW.printf(KEY_VALUE_FORMAT, "Karaf", System.getProperty("karaf.name", "root") + ' ' + System.getProperty("karaf.version", "")).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "home", System.getProperty("karaf.home", "")).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "base", System.getProperty("karaf.base", "")).println();
Expand All @@ -117,7 +117,7 @@ private void dumpOSGiInformation(final PrintWriter outPW) {
bundleContext.getBundle(0).getVersion()).println();
}

private void dumpOSInformation(final PrintWriter outPW) {
private static void dumpOSInformation(final PrintWriter outPW) {
final OperatingSystemMXBean mxBean = ManagementFactory.getOperatingSystemMXBean();
if( null == mxBean) {
return;
Expand All @@ -128,8 +128,7 @@ private void dumpOSInformation(final PrintWriter outPW) {
// outPW.printf(INDENT_KEY_VALUE_FORMAT, "current system load average", mxBean.getSystemLoadAverage()).println();
}

private void dumpVMInformation(final PrintWriter outPW,
final DateFormat dateTimeFormatInstance) {
private static void dumpVMInformation(final PrintWriter outPW, final DateFormat dateTimeFormatInstance) {
final RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
if( mxBean == null ) {
return;
Expand Down Expand Up @@ -170,7 +169,7 @@ private void dumpVMInformation(final PrintWriter outPW,
}
}

private void dumpThreadsInformation(final PrintWriter outPW) {
private static void dumpThreadsInformation(final PrintWriter outPW) {
final ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
if( null == mxBean) {
return;
Expand All @@ -182,7 +181,7 @@ private void dumpThreadsInformation(final PrintWriter outPW) {
outPW.printf(INDENT_KEY_VALUE_FORMAT, "total", formatLong(mxBean.getTotalStartedThreadCount())).println();
}

private void dumpClassesInformation(final PrintWriter outPW) {
private static void dumpClassesInformation(final PrintWriter outPW) {
final ClassLoadingMXBean mxBean = ManagementFactory.getClassLoadingMXBean();
if( null == mxBean) {
return;
Expand All @@ -193,7 +192,7 @@ private void dumpClassesInformation(final PrintWriter outPW) {
outPW.printf(INDENT_KEY_VALUE_FORMAT, "unloaded", formatLong(mxBean.getUnloadedClassCount())).println();
}

private void dumpMemoryInformation(final PrintWriter outPW) {
private static void dumpMemoryInformation(final PrintWriter outPW) {
final MemoryMXBean mxBean = ManagementFactory.getMemoryMXBean();
if( null == mxBean) {
return;
Expand All @@ -216,7 +215,7 @@ private void dumpMemoryInformation(final PrintWriter outPW) {
}
}

private void dumpGCInformation(final PrintWriter outPW) {
private static void dumpGCInformation(final PrintWriter outPW) {
final List<GarbageCollectorMXBean> mxBeans = ManagementFactory.getGarbageCollectorMXBeans();
if( null == mxBeans || mxBeans.isEmpty()) {
return;
Expand All @@ -236,12 +235,12 @@ private void dumpGCInformation(final PrintWriter outPW) {
}


private String formatLong(final long longValue) {
private static String formatLong(final long longValue) {
final NumberFormat fmtI = new DecimalFormat("###,###", new DecimalFormatSymbols(Locale.ENGLISH));
return fmtI.format(longValue);
}

private String printMemory(final long bytes) {
private static String printMemory(final long bytes) {
if( bytes <= 1024) {
return formatLong(bytes)+" bytes";
}
Expand All @@ -254,7 +253,7 @@ private String printMemory(final long bytes) {
* @param uptime The uptime in millis.
* @return The time used for displaying on screen or in logs.
*/
private String printDuration(double uptime) {
private static String printDuration(double uptime) {
// Code based on code taken from Karaf
// https://svn.apache.org/repos/asf/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public List<Container> ps(boolean showAll) throws Exception {
return containers;
}

private void cleanName(Container container) throws Exception {
private static void cleanName(Container container) throws Exception {
List<String> cleanNames = new ArrayList<>();
for (String name : container.getNames()) {
if (name.startsWith("/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public void copy(final InputStream input, final OutputStream output) throws IOEx

}

private void makeFileExecutable(File serviceFile) throws IOException {
private static void makeFileExecutable(File serviceFile) throws IOException {
Set<PosixFilePermission> permissions = new HashSet<>();
permissions.add(PosixFilePermission.OWNER_EXECUTE);
permissions.add(PosixFilePermission.GROUP_EXECUTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void doExecute(final FeaturesService featuresService) throws Exception {
* Where we'll save the bundles
* @return true if it is valid, false otherwise
*/
private boolean prepareDestination(final File destination) {
private static boolean prepareDestination(final File destination) {
return (destination.isDirectory() || destination.mkdirs());
}

Expand Down
Loading
Loading