This is an automated email from the ASF dual-hosted git repository.
rovarga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/main by this push:
new d19805d6a7 More static method conversions
d19805d6a7 is described below
commit d19805d6a72fb4d56c0151042ad6aa7ffa29d2d2
Author: Robert Varga <[email protected]>
AuthorDate: Sat May 2 09:31:28 2026 +0200
More static method conversions
This is another round of marking methods static, covering most of the
repository.
Signed-off-by: Robert Varga <[email protected]>
---
.../org/apache/karaf/bundle/command/Classes.java | 4 ++--
.../org/apache/karaf/bundle/command/Headers.java | 2 +-
.../java/org/apache/karaf/bundle/command/List.java | 6 ++---
.../org/apache/karaf/bundle/command/LoadTest.java | 2 +-
.../org/apache/karaf/bundle/command/Services.java | 2 +-
.../karaf/bundle/command/ShowBundleTree.java | 8 +++----
.../org/apache/karaf/bundle/command/Status.java | 2 +-
.../karaf/bundle/command/bundletree/Node.java | 2 +-
.../karaf/bundle/core/internal/BundleInfoImpl.java | 4 ++--
.../bundle/core/internal/BundleSelectorImpl.java | 2 +-
.../bundle/core/internal/BundleServiceImpl.java | 4 ++--
.../bundle/core/internal/BundleWatcherImpl.java | 4 ++--
.../bundle/core/internal/BundlesMBeanImpl.java | 2 +-
.../karaf/bundle/command/TestBundleFactory.java | 4 ++--
.../karaf/bundle/command/bundletree/TreeTest.java | 2 +-
.../completers/ConfigurationPropertyCompleter.java | 2 +-
.../karaf/config/command/UpdateCommandTest.java | 2 +-
.../features/FeatureDeploymentListener.java | 2 +-
.../deployer/kar/KarArtifactInstallerTest.java | 4 ++--
.../karaf/diagnostic/core/internal/Activator.java | 2 +-
.../core/providers/EnvironmentDumpProvider.java | 21 ++++++++--------
.../java/org/apache/karaf/docker/DockerClient.java | 2 +-
.../karaf/docker/internal/DockerServiceImpl.java | 2 +-
.../karaf/features/command/FeatureExport.java | 2 +-
.../karaf/features/command/InfoFeatureCommand.java | 12 +++++-----
.../features/command/ListFeaturesCommand.java | 2 +-
.../karaf/features/command/RepoListCommand.java | 2 +-
.../completers/FeatureVersionCompleter.java | 3 ++-
.../internal/download/impl/SimpleDownloadTask.java | 2 +-
.../internal/service/FeatureConfigInstaller.java | 6 ++---
.../java/org/apache/karaf/features/AppendTest.java | 2 +-
.../internal/repository/RepositoryTest.java | 2 +-
.../internal/service/FeaturesServiceImplTest.java | 8 +++----
.../instance/command/InstanceCommandSupport.java | 2 +-
.../core/internal/InstanceServiceImpl.java | 28 +++++++++++-----------
.../instance/core/internal/InstancesMBeanImpl.java | 2 +-
.../karaf/instance/core/InstanceSettingsTest.java | 2 +-
.../core/internal/InstanceServiceImplTest.java | 6 ++---
.../blueprint/jasypt/handler/NamespaceHandler.java | 2 +-
.../jaas/modules/encryption/EncryptionSupport.java | 2 +-
.../karaf/jaas/modules/ldap/LDAPOptions.java | 2 +-
.../jaas/modules/ldap/LDAPPubkeyLoginModule.java | 2 +-
.../jaas/modules/krb5/Krb5LoginModuleTest.java | 2 +-
.../modules/ldap/LDAPPubkeyLoginModuleTest.java | 2 +-
.../karaf/jaas/modules/ldap/LdapCacheTest.java | 2 +-
.../properties/PropertiesBackingEngineTest.java | 2 +-
.../properties/PropertiesLoginModuleTest.java | 2 +-
.../apache/karaf/kar/internal/KarServiceImpl.java | 12 +++++-----
.../org/apache/karaf/main/ConfigProperties.java | 2 +-
main/src/main/java/org/apache/karaf/main/Main.java | 2 +-
.../java/org/apache/karaf/main/ServerInfoImpl.java | 2 +-
.../org/apache/karaf/main/StartupListener.java | 2 +-
.../apache/karaf/main/lock/DefaultJDBCLock.java | 2 +-
.../karaf/main/util/BootstrapLogManagerTest.java | 4 ++--
.../karaf/management/KarafMBeanServerGuard.java | 8 +++----
.../management/internal/JMXSecurityMBeanImpl.java | 2 +-
.../management/KarafMBeanServerGuardTest.java | 6 ++---
.../org/apache/karaf/obr/command/ListCommand.java | 2 +-
.../karaf/obr/core/internal/ObrMBeanImpl.java | 4 ++--
.../karaf/profile/assembly/ArtifactInstaller.java | 2 +-
.../karaf/profile/assembly/ConfigInstaller.java | 2 +-
.../karaf/profile/assembly/FeatureSelector.java | 2 +-
.../apache/karaf/profile/command/ProfileEdit.java | 6 ++---
.../karaf/profile/impl/ProfileBuilderImpl.java | 6 ++---
.../org/apache/karaf/profile/impl/ProfileImpl.java | 2 +-
.../services/staticcm/StaticConfigAdminImpl.java | 2 +-
.../karaf/system/commands/SystemProperty.java | 2 +-
.../karaf/system/internal/SystemServiceImpl.java | 7 +++---
.../management/internal/SystemMBeanImpl.java | 4 ++--
.../org/apache/karaf/tooling/AssemblyMojo.java | 14 +++++------
70 files changed, 141 insertions(+), 142 deletions(-)
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
index d4a40850eb..987118ff53 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
@@ -75,7 +75,7 @@ public class Classes extends BundlesCommand {
}
}
- 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) {
@@ -87,7 +87,7 @@ public class Classes extends BundlesCommand {
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);
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
index a9d8c82c8c..0de5f14116 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
@@ -329,7 +329,7 @@ public class Headers extends BundlesCommand {
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;
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/List.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/List.java
index 9c530d1f74..55631a84d2 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/List.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/List.java
@@ -177,7 +177,7 @@ public class List extends BundlesCommand {
}
}
- private String printHosts(BundleInfo info) {
+ private static String printHosts(BundleInfo info) {
if (info.getFragmentHosts().size() <= 0) {
return "";
}
@@ -194,7 +194,7 @@ public class List extends BundlesCommand {
return builder.toString();
}
- private String printFragments(BundleInfo info) {
+ private static String printFragments(BundleInfo info) {
if (info.getFragments().size() <= 0) {
return "";
}
@@ -211,7 +211,7 @@ public class List extends BundlesCommand {
return builder.toString();
}
- private String getStateString(BundleState state) {
+ private static String getStateString(BundleState state) {
return (state == null) ? "" : state.toString();
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
index e04d66a664..3741f54eb7 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
@@ -168,7 +168,7 @@ public class LoadTest implements Action {
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);
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Services.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Services.java
index 06e6ad5042..0f54088698 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Services.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Services.java
@@ -100,7 +100,7 @@ public class Services extends BundlesCommand {
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)));
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
index 8a54821856..0885884502 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
@@ -76,7 +76,7 @@ public class ShowBundleTree extends BundleCommand {
/**
* 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";
@@ -91,7 +91,7 @@ public class ShowBundleTree extends BundleCommand {
/*
* 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(),
@@ -121,7 +121,7 @@ public class ShowBundleTree extends BundleCommand {
* 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<>();
@@ -218,7 +218,7 @@ public class ShowBundleTree extends BundleCommand {
}
}
- 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;
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Status.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Status.java
index 0b134c045e..a0a0b58ad0 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Status.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Status.java
@@ -33,7 +33,7 @@ public class Status extends BundleCommand {
/**
* 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";
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/bundletree/Node.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/bundletree/Node.java
index 03dbc8b5d0..f0442ca40c 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/bundletree/Node.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/bundletree/Node.java
@@ -153,7 +153,7 @@ public class Node<T> {
/*
* 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;
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleInfoImpl.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleInfoImpl.java
index 0590c7225c..543b87d91d 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleInfoImpl.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleInfoImpl.java
@@ -85,7 +85,7 @@ public class BundleInfoImpl implements BundleInfo {
}
}
- private String populateRevisions(Bundle bundle) {
+ private static String populateRevisions(Bundle bundle) {
BundleRevisions revisions = bundle.adapt(BundleRevisions.class);
if (revisions == null) {
return "";
@@ -119,7 +119,7 @@ public class BundleInfoImpl implements BundleInfo {
}
}
- private BundleState getBundleState(Bundle bundle) {
+ private static BundleState getBundleState(Bundle bundle) {
BundleState state = bundleStateMap.get(bundle.getState());
return state == null ? BundleState.Unknown : state;
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleSelectorImpl.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleSelectorImpl.java
index a352117450..08198b3a77 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleSelectorImpl.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleSelectorImpl.java
@@ -99,7 +99,7 @@ public class BundleSelectorImpl {
}
}
- 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");
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
index e20628820d..60c3ec4f23 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
@@ -279,7 +279,7 @@ public class BundleServiceImpl implements BundleService {
/*
* 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()) {
@@ -335,7 +335,7 @@ public class BundleServiceImpl implements BundleService {
* @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";
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java
index 77b045b187..bebc8dff01 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java
@@ -138,12 +138,12 @@ public class BundleWatcherImpl implements Runnable,
BundleListener, BundleWatche
}
}
- private String getLocation(Bundle bundle) {
+ private static String getLocation(Bundle bundle) {
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");
}
diff --git
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundlesMBeanImpl.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundlesMBeanImpl.java
index 2f56fa7bb9..bfc5edd69c 100644
---
a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundlesMBeanImpl.java
+++
b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundlesMBeanImpl.java
@@ -120,7 +120,7 @@ public class BundlesMBeanImpl extends StandardMBean
implements BundlesMBean {
}
}
- private BundleStartLevel getBundleStartLevel(Bundle bundle) {
+ private static BundleStartLevel getBundleStartLevel(Bundle bundle) {
return bundle.adapt(BundleStartLevel.class);
}
diff --git
a/bundle/core/src/test/java/org/apache/karaf/bundle/command/TestBundleFactory.java
b/bundle/core/src/test/java/org/apache/karaf/bundle/command/TestBundleFactory.java
index 121d857be9..cae7c9f859 100644
---
a/bundle/core/src/test/java/org/apache/karaf/bundle/command/TestBundleFactory.java
+++
b/bundle/core/src/test/java/org/apache/karaf/bundle/command/TestBundleFactory.java
@@ -89,11 +89,11 @@ public class TestBundleFactory {
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);
diff --git
a/bundle/core/src/test/java/org/apache/karaf/bundle/command/bundletree/TreeTest.java
b/bundle/core/src/test/java/org/apache/karaf/bundle/command/bundletree/TreeTest.java
index 4388b63d66..34f21dda02 100644
---
a/bundle/core/src/test/java/org/apache/karaf/bundle/command/bundletree/TreeTest.java
+++
b/bundle/core/src/test/java/org/apache/karaf/bundle/command/bundletree/TreeTest.java
@@ -119,7 +119,7 @@ public class TreeTest {
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));
diff --git
a/config/command/src/main/java/org/apache/karaf/config/command/completers/ConfigurationPropertyCompleter.java
b/config/command/src/main/java/org/apache/karaf/config/command/completers/ConfigurationPropertyCompleter.java
index 9ae225158f..4eb62a09bd 100644
---
a/config/command/src/main/java/org/apache/karaf/config/command/completers/ConfigurationPropertyCompleter.java
+++
b/config/command/src/main/java/org/apache/karaf/config/command/completers/ConfigurationPropertyCompleter.java
@@ -80,7 +80,7 @@ public class ConfigurationPropertyCompleter implements
Completer {
* 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());
diff --git
a/config/command/src/test/java/org/apache/karaf/config/command/UpdateCommandTest.java
b/config/command/src/test/java/org/apache/karaf/config/command/UpdateCommandTest.java
index f24d301f96..ebc4086b2e 100644
---
a/config/command/src/test/java/org/apache/karaf/config/command/UpdateCommandTest.java
+++
b/config/command/src/test/java/org/apache/karaf/config/command/UpdateCommandTest.java
@@ -71,7 +71,7 @@ public class UpdateCommandTest extends TestCase {
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);
diff --git
a/deployer/features/src/main/java/org/apache/karaf/deployer/features/FeatureDeploymentListener.java
b/deployer/features/src/main/java/org/apache/karaf/deployer/features/FeatureDeploymentListener.java
index 7f78493891..2d743792b5 100644
---
a/deployer/features/src/main/java/org/apache/karaf/deployer/features/FeatureDeploymentListener.java
+++
b/deployer/features/src/main/java/org/apache/karaf/deployer/features/FeatureDeploymentListener.java
@@ -95,7 +95,7 @@ public class FeatureDeploymentListener implements
ArtifactUrlTransformer, Bundle
bundleContext.removeBundleListener(this);
}
- private boolean isKnownFeaturesURI(String uri){
+ private static boolean isKnownFeaturesURI(String uri){
if(uri == null){
return false;
}
diff --git
a/deployer/kar/src/test/java/org/apache/karaf/deployer/kar/KarArtifactInstallerTest.java
b/deployer/kar/src/test/java/org/apache/karaf/deployer/kar/KarArtifactInstallerTest.java
index 8c3a2a6b3e..13e5009e78 100644
---
a/deployer/kar/src/test/java/org/apache/karaf/deployer/kar/KarArtifactInstallerTest.java
+++
b/deployer/kar/src/test/java/org/apache/karaf/deployer/kar/KarArtifactInstallerTest.java
@@ -94,7 +94,7 @@ public class KarArtifactInstallerTest {
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
@@ -115,7 +115,7 @@ public class KarArtifactInstallerTest {
}
}
- 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
diff --git
a/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/internal/Activator.java
b/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/internal/Activator.java
index 57c287812c..4b84bb750a 100644
---
a/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/internal/Activator.java
+++
b/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/internal/Activator.java
@@ -42,7 +42,7 @@ public class Activator implements BundleActivator {
}
}
- private boolean isWindows() {
+ private static boolean isWindows() {
return System.getProperty("os.name", "Unknown").startsWith("Win");
}
diff --git
a/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/providers/EnvironmentDumpProvider.java
b/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/providers/EnvironmentDumpProvider.java
index 662c693564..7c8a4f7836 100644
---
a/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/providers/EnvironmentDumpProvider.java
+++
b/diagnostic/boot/src/main/java/org/apache/karaf/diagnostic/core/providers/EnvironmentDumpProvider.java
@@ -94,7 +94,7 @@ public class EnvironmentDumpProvider extends TextDumpProvider
{
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();
@@ -117,7 +117,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
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;
@@ -128,8 +128,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
// 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;
@@ -170,7 +169,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
}
}
- private void dumpThreadsInformation(final PrintWriter outPW) {
+ private static void dumpThreadsInformation(final PrintWriter outPW) {
final ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
if( null == mxBean) {
return;
@@ -182,7 +181,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
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;
@@ -193,7 +192,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
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;
@@ -216,7 +215,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
}
}
- 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;
@@ -236,12 +235,12 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
}
- 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";
}
@@ -254,7 +253,7 @@ public class EnvironmentDumpProvider extends
TextDumpProvider {
* @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
diff --git a/docker/src/main/java/org/apache/karaf/docker/DockerClient.java
b/docker/src/main/java/org/apache/karaf/docker/DockerClient.java
index 0856e1aaf8..8a8288fb45 100644
--- a/docker/src/main/java/org/apache/karaf/docker/DockerClient.java
+++ b/docker/src/main/java/org/apache/karaf/docker/DockerClient.java
@@ -80,7 +80,7 @@ public class DockerClient {
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("/")) {
diff --git
a/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
b/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
index 15b730dac8..e769eaf477 100644
---
a/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
+++
b/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
@@ -426,7 +426,7 @@ public class DockerServiceImpl implements DockerService {
}
- 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);
diff --git
a/features/command/src/main/java/org/apache/karaf/features/command/FeatureExport.java
b/features/command/src/main/java/org/apache/karaf/features/command/FeatureExport.java
index 4c7422f993..9085d99378 100644
---
a/features/command/src/main/java/org/apache/karaf/features/command/FeatureExport.java
+++
b/features/command/src/main/java/org/apache/karaf/features/command/FeatureExport.java
@@ -116,7 +116,7 @@ public class FeatureExport extends FeaturesCommandSupport {
* 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());
}
diff --git
a/features/command/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
b/features/command/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
index dd62f41b45..44b6862e4e 100644
---
a/features/command/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
+++
b/features/command/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
@@ -189,14 +189,14 @@ public class InfoFeatureCommand extends
FeaturesCommandSupport {
}
}
- private void printWithIndent(String details) {
+ private static void printWithIndent(String details) {
String[] lines = details.split("\r?\n");
for (String line : lines) {
System.out.println(INDENT + line);
}
}
- private void displayBundleInformation(Feature feature, String
contentType) {
+ private static void displayBundleInformation(Feature feature, String
contentType) {
List<BundleInfo> bundleInfos = feature.getBundles();
if (bundleInfos.isEmpty()) {
System.out.println(contentType + " has no bundles.");
@@ -217,7 +217,7 @@ public class InfoFeatureCommand extends
FeaturesCommandSupport {
}
}
- private void displayDependencyInformation(Feature feature, String
contentType) {
+ private static void displayDependencyInformation(Feature feature, String
contentType) {
List<Dependency> dependencies = feature.getDependencies();
if (dependencies.isEmpty()) {
System.out.println(contentType + " has no dependencies.");
@@ -229,7 +229,7 @@ public class InfoFeatureCommand extends
FeaturesCommandSupport {
}
}
- private void displayConfigInformation(Feature feature, String contentType)
{
+ private static void displayConfigInformation(Feature feature, String
contentType) {
List<ConfigInfo> configurations = feature.getConfigurations();
if (configurations.isEmpty()) {
System.out.println(contentType + " has no configuration");
@@ -241,7 +241,7 @@ public class InfoFeatureCommand extends
FeaturesCommandSupport {
}
}
- private void displayConfigFileInformation(Feature feature, String
contentType) {
+ private static void displayConfigFileInformation(Feature feature, String
contentType) {
List<ConfigFileInfo> configurationFiles =
feature.getConfigurationFiles();
if (configurationFiles.isEmpty()) {
System.out.println(contentType + " has no configuration files");
@@ -341,7 +341,7 @@ public class InfoFeatureCommand extends
FeaturesCommandSupport {
}
}
- private String getConditionDescription(Conditional cond) {
+ private static String getConditionDescription(Conditional cond) {
StringBuilder sb = new StringBuilder();
for (String dep : cond.getCondition()) {
if (sb.length() > 0) {
diff --git
a/features/command/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
b/features/command/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
index 6e8df0f2ed..383470416f 100644
---
a/features/command/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
+++
b/features/command/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
@@ -93,7 +93,7 @@ public class ListFeaturesCommand extends
FeaturesCommandSupport {
}
- private boolean isInstalledViaDeployDir(String st) {
+ private static boolean isInstalledViaDeployDir(String st) {
return st != null && st.length() > 1 && st.charAt(st.length() - 1) ==
'*';
}
diff --git
a/features/command/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
b/features/command/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
index 6c59da8e9a..af53ccae63 100644
---
a/features/command/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
+++
b/features/command/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
@@ -74,7 +74,7 @@ public class RepoListCommand extends FeaturesCommandSupport {
table.print(System.out, !noFormat);
}
- private void reloadAllRepos(FeaturesService featuresService) throws
Exception {
+ private static void reloadAllRepos(FeaturesService featuresService) throws
Exception {
System.out.println("Reloading all repositories from their urls");
System.out.println();
List<Exception> exceptions = new ArrayList<>();
diff --git
a/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureVersionCompleter.java
b/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureVersionCompleter.java
index 959dfe65d1..248885afcd 100644
---
a/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureVersionCompleter.java
+++
b/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureVersionCompleter.java
@@ -55,7 +55,8 @@ public class FeatureVersionCompleter implements Completer {
return delegate.complete(session, commandLine, candidates);
}
- private List<String> getAllVersionsOfFeature(String feature,
FeaturesService featuresService) throws Exception {
+ private static List<String> getAllVersionsOfFeature(String feature,
FeaturesService featuresService)
+ throws Exception {
List<String> versions = new ArrayList<>();
for (Repository repo : featuresService.listRepositories()) {
for (Feature f : repo.getFeatures()) {
diff --git
a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
index 5e07d2eea7..548c234d80 100644
---
a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
+++
b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
@@ -94,7 +94,7 @@ public class SimpleDownloadTask extends
AbstractRetryableDownloadTask {
}
// we only want the filename itself, not the whole path
- private String getFileName(URL urlObj) {
+ private static String getFileName(URL urlObj) {
String url = urlObj.getFile();
// ENTESB-1394: we do not want all these decorators from wrap: protocol
// or any inlined maven repos
diff --git
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
index e4ca871ed0..cafd76c96a 100644
---
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
+++
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
@@ -86,7 +86,7 @@ public class FeatureConfigInstaller {
}
}
- private Configuration findExistingConfiguration(ConfigurationAdmin
configurationAdmin, ConfigId cid)
+ private static Configuration findExistingConfiguration(ConfigurationAdmin
configurationAdmin, ConfigId cid)
throws IOException, InvalidSyntaxException {
String filter;
if (!cid.isFactoryPid) {
@@ -211,7 +211,7 @@ public class FeatureConfigInstaller {
}
}
- private Dictionary<String, Object> convertToDict(Map<String, Object>
props) {
+ private static Dictionary<String, Object> convertToDict(Map<String,
Object> props) {
Dictionary<String, Object> cfgProps = new Hashtable<>();
for (Map.Entry<String, Object> e : props.entrySet()) {
cfgProps.put(e.getKey(), e.getValue());
@@ -219,7 +219,7 @@ public class FeatureConfigInstaller {
return cfgProps;
}
- private TypedProperties convertToTypedProperties(Dictionary<String,
Object> dict) {
+ private static TypedProperties convertToTypedProperties(Dictionary<String,
Object> dict) {
TypedProperties typedProperties = new TypedProperties();
Enumeration<String> keys = dict.keys();
while (keys.hasMoreElements()) {
diff --git
a/features/core/src/test/java/org/apache/karaf/features/AppendTest.java
b/features/core/src/test/java/org/apache/karaf/features/AppendTest.java
index f2950ec3f9..a88d2fd01a 100644
--- a/features/core/src/test/java/org/apache/karaf/features/AppendTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/AppendTest.java
@@ -116,7 +116,7 @@ public class AppendTest {
return config;
}
- private void checkFeature(Feature feature) {
+ private static void checkFeature(Feature feature) {
ConfigInfo configInfo = feature.getConfigurations().get(0);
assertTrue(configInfo.isAppend());
diff --git
a/features/core/src/test/java/org/apache/karaf/features/internal/repository/RepositoryTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/repository/RepositoryTest.java
index 66374b6210..7a32569fc1 100644
---
a/features/core/src/test/java/org/apache/karaf/features/internal/repository/RepositoryTest.java
+++
b/features/core/src/test/java/org/apache/karaf/features/internal/repository/RepositoryTest.java
@@ -69,7 +69,7 @@ public class RepositoryTest {
verify(repo);
}
- private void verify(BaseRepository repo) {
+ private static void verify(BaseRepository repo) {
assertNotNull(repo.getResources());
assertEquals(1, repo.getResources().size());
Resource resource = repo.getResources().get(0);
diff --git
a/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
index c351ad7a82..c5bca449cc 100644
---
a/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
+++
b/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
@@ -276,23 +276,23 @@ public class FeaturesServiceImplTest extends TestBase {
installSupport, null, cfg);
}
- private void assertNotInstalled(FeaturesService featureService, Feature
feature) {
+ private static void assertNotInstalled(FeaturesService featureService,
Feature feature) {
assertFalse("Feature " + feature.getName() + " should not be installed
anymore after removal of repo",
featureService.isInstalled(feature));
}
- private void assertInstalled(FeaturesService featureService, Feature
feature) {
+ private static void assertInstalled(FeaturesService featureService,
Feature feature) {
assertTrue("Feature " + feature.getName() + " should still be
installed after removal of repo",
featureService.isInstalled(feature));
}
- private void installFeature(final FeaturesService featureService, Feature
feature)
+ private static void installFeature(final FeaturesService featureService,
Feature feature)
throws Exception {
featureService.installFeature(feature, EnumSet.noneOf(Option.class));
waitInstalled(featureService, feature);
}
- private void waitInstalled(final FeaturesService featureService, Feature
feature)
+ private static void waitInstalled(final FeaturesService featureService,
Feature feature)
throws InterruptedException {
int count = 40;
while (!featureService.isInstalled(feature) && count > 0) {
diff --git
a/instance/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
b/instance/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
index bb941a299b..1a9992bd90 100644
---
a/instance/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
+++
b/instance/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
@@ -76,7 +76,7 @@ public abstract class InstanceCommandSupport implements
Action {
return result;
}
- private boolean match(String name, List<String> patterns) {
+ private static boolean match(String name, List<String> patterns) {
for (String pattern : patterns) {
if (name.matches(pattern)) {
return true;
diff --git
a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
index 7671f4c8b9..e99d07c0e7 100644
---
a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
+++
b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
@@ -180,7 +180,7 @@ public class InstanceServiceImpl implements InstanceService
{
return state;
}
- private void saveData(State state, Properties storage) {
+ private static void saveData(State state, Properties storage) {
storage.put("ssh.port", Integer.toString(state.defaultSshPortStart));
storage.put("rmi.registry.port",
Integer.toString(state.defaultRmiRegistryPortStart));
storage.put("rmi.server.port",
Integer.toString(state.defaultRmiServerPortStart));
@@ -483,7 +483,7 @@ public class InstanceServiceImpl implements InstanceService
{
}, true);
}
- private void doStart(InstanceState instance, String name, String javaOpts)
throws IOException {
+ private static void doStart(InstanceState instance, String name, String
javaOpts) throws IOException {
String opts = javaOpts;
if (opts == null || opts.length() == 0) {
opts = instance.opts;
@@ -569,7 +569,7 @@ public class InstanceServiceImpl implements InstanceService
{
instance.pid = process.getPid();
}
- private StringBuilder classpathFromLibDir(File libDir) throws IOException {
+ private static StringBuilder classpathFromLibDir(File libDir) throws
IOException {
File[] jars = libDir.listFiles((dir, name) -> name.endsWith(".jar"));
StringBuilder classpath = new StringBuilder();
if (jars != null) {
@@ -583,7 +583,7 @@ public class InstanceServiceImpl implements InstanceService
{
return classpath;
}
- private void addJar(StringBuilder sb, String groupId, String artifactId) {
+ private static void addJar(StringBuilder sb, String groupId, String
artifactId) {
File artifactDir = new File(System.getProperty("karaf.home") +
File.separator +
"system" + File.separator +
groupId.replaceAll("\\.", File.separator)
+ File.separator +
@@ -825,7 +825,7 @@ public class InstanceServiceImpl implements InstanceService
{
}, true);
}
- private void checkPid(InstanceState instance) throws IOException {
+ private static void checkPid(InstanceState instance) throws IOException {
if (instance.pid != 0) {
Process process = new
ProcessBuilderFactoryImpl().newBuilder().attach(instance.pid);
if (!process.isRunning()) {
@@ -913,7 +913,7 @@ public class InstanceServiceImpl implements InstanceService
{
}
- private Integer getKarafPort(State state, String name, String path, final
String key) {
+ private static Integer getKarafPort(State state, String name, String path,
final String key) {
InstanceState instance = state.instances.get(name);
if (instance == null) {
throw new IllegalArgumentException("Instance " + name + " not
found");
@@ -948,10 +948,10 @@ public class InstanceServiceImpl implements
InstanceService {
}
private String getKarafHost(final String name, final String path, final
String key) {
- return execute(state -> InstanceServiceImpl.this.getKarafHost(state,
name, path, key), false);
+ return execute(state -> getKarafHost(state, name, path, key), false);
}
- private String getKarafHost(State state, String name, String path, final
String key) {
+ private static String getKarafHost(State state, String name, String path,
final String key) {
InstanceState instance = state.instances.get(name);
if (instance == null) {
throw new IllegalArgumentException("Instance " + name + " not
found");
@@ -1128,7 +1128,7 @@ public class InstanceServiceImpl implements
InstanceService {
* @param is
* @param os
*/
- private void copyStream(InputStream is, OutputStream os) {
+ private static void copyStream(InputStream is, OutputStream os) {
PrintStream out = new PrintStream(os);
Scanner scanner = new Scanner(is);
while (scanner.hasNextLine() ) {
@@ -1138,7 +1138,7 @@ public class InstanceServiceImpl implements
InstanceService {
scanner.close();
}
- private void filterResource(File basedir, String path, HashMap<String,
String> props) throws IOException {
+ private static void filterResource(File basedir, String path,
HashMap<String, String> props) throws IOException {
File file = new File(basedir, path);
File bak = new File(basedir, path + BACKUP_EXTENSION);
if (!file.exists()) {
@@ -1171,7 +1171,7 @@ public class InstanceServiceImpl implements
InstanceService {
}
}
- private void copyAndFilterResource(InputStream source, OutputStream
target, Map<String, String> props) throws IOException {
+ private static void copyAndFilterResource(InputStream source, OutputStream
target, Map<String, String> props) throws IOException {
// read it line at a time so that we can use the platform line ending
when we write it out.
PrintStream out = new PrintStream(target);
Scanner scanner = new Scanner(source);
@@ -1196,7 +1196,7 @@ public class InstanceServiceImpl implements
InstanceService {
}
}
- private String filter(String line, Map<String, String> props) {
+ private static String filter(String line, Map<String, String> props) {
for (Map.Entry<String, String> i : props.entrySet()) {
int p1 = line.indexOf(i.getKey());
if( p1 >= 0 ) {
@@ -1208,7 +1208,7 @@ public class InstanceServiceImpl implements
InstanceService {
return line;
}
- private void mkdir(File karafBase, String path, boolean printOutput) {
+ private static void mkdir(File karafBase, String path, boolean
printOutput) {
File file = new File(karafBase, path);
if( !file.exists() ) {
logDebug("Creating dir: %s", printOutput, file.getPath());
@@ -1216,7 +1216,7 @@ public class InstanceServiceImpl implements
InstanceService {
}
}
- private void makeFileExecutable(File serviceFile) throws IOException {
+ private static void makeFileExecutable(File serviceFile) throws
IOException {
try {
Set<PosixFilePermission> permissions = new HashSet<>();
permissions.add(PosixFilePermission.OWNER_EXECUTE);
diff --git
a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
index a2c59809a6..f3f0d314ca 100644
---
a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
+++
b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
@@ -236,7 +236,7 @@ public class InstancesMBeanImpl extends StandardMBean
implements InstancesMBean
return i;
}
- private List<String> parseStringList(String value) {
+ private static List<String> parseStringList(String value) {
List<String> list = new ArrayList<>();
if (value != null) {
for (String el : value.split(",")) {
diff --git
a/instance/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
b/instance/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
index 620ed3e951..e83a77c5dd 100644
---
a/instance/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
+++
b/instance/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
@@ -40,7 +40,7 @@ public class InstanceSettingsTest extends TestCase {
testEqualsHashCode(0, 0, 0, null, null, null, null);
}
- private void testEqualsHashCode(int sshPort, int rmiRegistryPort, int
rmiServerPort, String location, String javaOpts, List<String> featureURLs,
List<String> features) {
+ private static void testEqualsHashCode(int sshPort, int rmiRegistryPort,
int rmiServerPort, String location, String javaOpts, List<String> featureURLs,
List<String> features) {
InstanceSettings is = new InstanceSettings(sshPort, rmiRegistryPort,
rmiServerPort, location, javaOpts, featureURLs, features);
InstanceSettings is2 = new InstanceSettings(sshPort, rmiRegistryPort,
rmiServerPort, location, javaOpts, featureURLs, features);
assertEquals(is, is2);
diff --git
a/instance/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
b/instance/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
index 5cf547a8ba..e9cbaa1436 100644
---
a/instance/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
+++
b/instance/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
@@ -179,13 +179,13 @@ public class InstanceServiceImplTest {
return name.getMethodName();
}
- private void saveStorage(Properties props, File location, String comment)
throws IOException {
+ private static void saveStorage(Properties props, File location, String
comment) throws IOException {
try (OutputStream os = new FileOutputStream(location)) {
props.store(os, comment);
}
}
- private Properties loadStorage(File location) throws IOException {
+ private static Properties loadStorage(File location) throws IOException {
try (InputStream is = new FileInputStream(location)) {
Properties props = new Properties();
props.load(is);
@@ -193,7 +193,7 @@ public class InstanceServiceImplTest {
}
}
- private void assertFileExists(String path, String name) throws IOException
{
+ private static void assertFileExists(String path, String name) throws
IOException {
File file = new File(path, name);
assertTrue("Expected " + file.getCanonicalPath() + " to exist",
file.exists());
diff --git
a/jaas/blueprint/jasypt/src/main/java/org/apache/karaf/jaas/blueprint/jasypt/handler/NamespaceHandler.java
b/jaas/blueprint/jasypt/src/main/java/org/apache/karaf/jaas/blueprint/jasypt/handler/NamespaceHandler.java
index 5ad55e4345..b15f25a018 100644
---
a/jaas/blueprint/jasypt/src/main/java/org/apache/karaf/jaas/blueprint/jasypt/handler/NamespaceHandler.java
+++
b/jaas/blueprint/jasypt/src/main/java/org/apache/karaf/jaas/blueprint/jasypt/handler/NamespaceHandler.java
@@ -162,7 +162,7 @@ public class NamespaceHandler implements
org.apache.aries.blueprint.NamespaceHan
return m;
}
- private RefMetadata createRef(ParserContext context, String value) {
+ private static RefMetadata createRef(ParserContext context, String value) {
MutableRefMetadata r =
context.createMetadata(MutableRefMetadata.class);
r.setComponentId(value);
return r;
diff --git
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/encryption/EncryptionSupport.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/encryption/EncryptionSupport.java
index daada19c14..294845e555 100644
---
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/encryption/EncryptionSupport.java
+++
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/encryption/EncryptionSupport.java
@@ -97,7 +97,7 @@ public class EncryptionSupport {
}
}
- private String defaulIfNull(String value, String defaultValue) {
+ private static String defaulIfNull(String value, String defaultValue) {
return value == null ? defaultValue : value;
}
diff --git
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
index 0261f5e8dd..f1a4f64954 100644
---
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
+++
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
@@ -126,7 +126,7 @@ public class LDAPOptions {
return parseRoleMapping(JAASUtils.getString(options, ROLE_MAPPING));
}
- private Map<String, Set<String>> parseRoleMapping(String option) {
+ private static Map<String, Set<String>> parseRoleMapping(String option) {
Map<String, Set<String>> roleMapping = new HashMap<>();
if (option != null) {
LOGGER.debug("Parse role mapping {}", option);
diff --git
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModule.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModule.java
index 308763d8bc..189efbb958 100644
---
a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModule.java
+++
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModule.java
@@ -130,7 +130,7 @@ public class LDAPPubkeyLoginModule extends
AbstractKarafLoginModule {
return true;
}
- private void authenticatePubkey(String userDn, PublicKey key, LDAPCache
cache) throws FailedLoginException, NamingException {
+ private static void authenticatePubkey(String userDn, PublicKey key,
LDAPCache cache) throws FailedLoginException, NamingException {
if (key == null)
throw new FailedLoginException("no public key supplied by the
client");
String[] storedKeys = cache.getUserPubkeys(userDn);
diff --git
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/krb5/Krb5LoginModuleTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/krb5/Krb5LoginModuleTest.java
index 668278e7f9..4e0cd6d2a2 100644
---
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/krb5/Krb5LoginModuleTest.java
+++
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/krb5/Krb5LoginModuleTest.java
@@ -286,7 +286,7 @@ public class Krb5LoginModuleTest extends KarafKerberosITest
{
conn.add(entry);
}
- private KeytabEntry createKeytabEntry() throws ParseException {
+ private static KeytabEntry createKeytabEntry() throws ParseException {
String principalName = "[email protected]";
int principalType = 1;
diff --git
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModuleTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModuleTest.java
index aa1d0ac2d1..d6cf59f740 100644
---
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModuleTest.java
+++
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LDAPPubkeyLoginModuleTest.java
@@ -148,7 +148,7 @@ public class LDAPPubkeyLoginModuleTest extends
AbstractLdapTestUnit {
assertFalse(module.login());
}
- private Path srcTestResourcePath(String relativePath) throws IOException {
+ private static Path srcTestResourcePath(String relativePath) throws
IOException {
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
diff --git
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapCacheTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapCacheTest.java
index 1568ac532d..9d26d1dd5e 100644
---
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapCacheTest.java
+++
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapCacheTest.java
@@ -133,7 +133,7 @@ public class LdapCacheTest extends AbstractLdapTestUnit {
assertEquals(Long.valueOf(1),
Long.valueOf(cache2.getClearCacheCount()));
}
- private void addUserToGroup(DirContext context, String userCn, String
group) throws NamingException {
+ private static void addUserToGroup(DirContext context, String userCn,
String group) throws NamingException {
Attributes entry = new BasicAttributes();
entry.put(new BasicAttribute("cn", group));
Attribute oc = new BasicAttribute("objectClass");
diff --git
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngineTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngineTest.java
index 1cb6a28fa8..1855795f9d 100644
---
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngineTest.java
+++
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngineTest.java
@@ -107,7 +107,7 @@ public class PropertiesBackingEngineTest {
Assert.assertThat(names(engine.listRoles(upb_2)),
containsInAnyOrder("role2", "role3", "role4"));
}
- private UserPrincipal getUser(PropertiesBackingEngine engine, String name)
{
+ private static UserPrincipal getUser(PropertiesBackingEngine engine,
String name) {
List<UserPrincipal> matchingUsers = engine.listUsers().stream()
.filter(user->name.equals(user.getName())).collect(Collectors.toList());
Assert.assertFalse("User with name " + name + " was not found",
matchingUsers.isEmpty());
diff --git
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModuleTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModuleTest.java
index 9d43fbaa00..f1ae778d9f 100644
---
a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModuleTest.java
+++
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModuleTest.java
@@ -207,7 +207,7 @@ public class PropertiesLoginModuleTest {
}
}
- private void testWithUsersFile(String usersFilePath) throws LoginException
{
+ private static void testWithUsersFile(String usersFilePath) throws
LoginException {
PropertiesLoginModule module = new PropertiesLoginModule();
Subject sub = new Subject();
CallbackHandler handler = new NamePasswordHandler("test", "test");
diff --git
a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
index 16dc3b81d5..3ee5cadb24 100644
--- a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
+++ b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
@@ -188,7 +188,7 @@ public class KarServiceImpl implements KarService {
}
- private List<URI> readFromFile(File repoListFile) {
+ private static List<URI> readFromFile(File repoListFile) {
ArrayList<URI> uriList = new ArrayList<>();
FileReader fr = null;
try {
@@ -210,7 +210,7 @@ public class KarServiceImpl implements KarService {
return uriList;
}
- private void writeToFile(List<URI> featuresRepositoriesInKar, File
repoListFile) {
+ private static void writeToFile(List<URI> featuresRepositoriesInKar, File
repoListFile) {
FileOutputStream fos = null;
PrintStream ps = null;
try {
@@ -399,7 +399,7 @@ public class KarServiceImpl implements KarService {
return featureSet;
}
- private Manifest createNonAutoStartManifest(URI repoUri) throws
IOException {
+ private static Manifest createNonAutoStartManifest(URI repoUri) throws
IOException {
String manifestSt = "Manifest-Version: 1.0\n" +
Kar.MANIFEST_ATTR_KARAF_FEATURE_START +": false\n" +
Kar.MANIFEST_ATTR_KARAF_FEATURE_REPOS + ": " + repoUri.toString()
+ "\n";
@@ -408,7 +408,7 @@ public class KarServiceImpl implements KarService {
return manifest;
}
- private void closeStream(OutputStream os) {
+ private static void closeStream(OutputStream os) {
if (os != null) {
try {
os.close();
@@ -418,7 +418,7 @@ public class KarServiceImpl implements KarService {
}
}
- private void copyFeatureToJar(JarOutputStream jos, Feature feature,
Map<URI, Integer> locationMap)
+ private static void copyFeatureToJar(JarOutputStream jos, Feature feature,
Map<URI, Integer> locationMap)
throws URISyntaxException {
// add bundles
for (BundleInfo bundleInfo : feature.getBundles()) {
@@ -443,7 +443,7 @@ public class KarServiceImpl implements KarService {
}
}
- private void copyResourceToJar(JarOutputStream jos, URI location, Map<URI,
Integer> locationMap) {
+ private static void copyResourceToJar(JarOutputStream jos, URI location,
Map<URI, Integer> locationMap) {
if (locationMap.containsKey(location)) {
return;
}
diff --git a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
index cb186d79c2..db52b0a401 100644
--- a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
+++ b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
@@ -355,7 +355,7 @@ public class ConfigProperties {
return ibsl;
}
- private void configureSAAJForIBMJVM() {
+ private static void configureSAAJForIBMJVM() {
if (System.getProperty("java.vendor").equals("IBM Corporation")) {
System.setProperty("javax.xml.soap.MessageFactory",
"com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
diff --git a/main/src/main/java/org/apache/karaf/main/Main.java
b/main/src/main/java/org/apache/karaf/main/Main.java
index e96f1d31ec..8b8201e426 100644
--- a/main/src/main/java/org/apache/karaf/main/Main.java
+++ b/main/src/main/java/org/apache/karaf/main/Main.java
@@ -623,7 +623,7 @@ public class Main {
}
}
- private boolean isNotFragment(Bundle b) {
+ private static boolean isNotFragment(Bundle b) {
String fragmentHostHeader =
b.getHeaders().get(Constants.FRAGMENT_HOST);
return fragmentHostHeader == null ||
fragmentHostHeader.trim().length() == 0;
}
diff --git a/main/src/main/java/org/apache/karaf/main/ServerInfoImpl.java
b/main/src/main/java/org/apache/karaf/main/ServerInfoImpl.java
index 895d4c793a..8e2e352c39 100644
--- a/main/src/main/java/org/apache/karaf/main/ServerInfoImpl.java
+++ b/main/src/main/java/org/apache/karaf/main/ServerInfoImpl.java
@@ -88,7 +88,7 @@ public class ServerInfoImpl implements ServerInfo {
return args.clone();
}
- private File resolveWithBase(File baseDir, String filename) {
+ private static File resolveWithBase(File baseDir, String filename) {
File file = new File(filename);
if (file.isAbsolute()) {
return file;
diff --git a/main/src/main/java/org/apache/karaf/main/StartupListener.java
b/main/src/main/java/org/apache/karaf/main/StartupListener.java
index 4c00203610..44a595cc63 100644
--- a/main/src/main/java/org/apache/karaf/main/StartupListener.java
+++ b/main/src/main/java/org/apache/karaf/main/StartupListener.java
@@ -74,7 +74,7 @@ class StartupListener implements FrameworkListener,
SynchronousBundleListener {
}
}
- private boolean isConsoleStarted() {
+ private static boolean isConsoleStarted() {
return
Boolean.parseBoolean(System.getProperty(SYSTEM_PROP_KARAF_CONSOLE_STARTED,
"false"));
}
diff --git a/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
b/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
index d5d16c6037..f9ebedef4a 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
@@ -161,7 +161,7 @@ public class DefaultJDBCLock implements Lock {
}
}
- private boolean checkTableExists(String tableName, DatabaseMetaData
metadata) throws SQLException {
+ private static boolean checkTableExists(String tableName, DatabaseMetaData
metadata) throws SQLException {
try (ResultSet rs = metadata.getTables(null, null, tableName, new
String[] {"TABLE"})) {
return rs.next();
}
diff --git
a/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
b/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
index ca5df6c969..a92ed65312 100644
--- a/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
+++ b/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
public class BootstrapLogManagerTest {
- private Properties getConfigProperties() {
+ private static Properties getConfigProperties() {
Properties configProps = new Properties();
configProps.put("karaf.log", "target/log");
return configProps;
@@ -62,7 +62,7 @@ public class BootstrapLogManagerTest {
assertExists("target/test.log");
}
- private void assertExists(String path) {
+ private static void assertExists(String path) {
Assert.assertTrue("File should exist at " + path, new
File(path).exists());
}
}
diff --git
a/management/server/src/main/java/org/apache/karaf/management/KarafMBeanServerGuard.java
b/management/server/src/main/java/org/apache/karaf/management/KarafMBeanServerGuard.java
index d567f544a6..8ddf33a85c 100644
---
a/management/server/src/main/java/org/apache/karaf/management/KarafMBeanServerGuard.java
+++
b/management/server/src/main/java/org/apache/karaf/management/KarafMBeanServerGuard.java
@@ -318,7 +318,7 @@ public class KarafMBeanServerGuard implements
InvocationHandler {
}
}
- private boolean canBypassRBAC(BulkRequestContext context, ObjectName
objectName, String operationName) {
+ private static boolean canBypassRBAC(BulkRequestContext context,
ObjectName objectName, String operationName) {
List<String> allBypassObjectName = new ArrayList<>();
List<Dictionary<String, Object>> configs =
context.getWhitelistProperties();
@@ -459,7 +459,7 @@ public class KarafMBeanServerGuard implements
InvocationHandler {
return Collections.emptyList();
}
- private String getGeneralPid(List<String> allPids, String pid) {
+ private static String getGeneralPid(List<String> allPids, String pid) {
String[] pidStrArray = pid.split(Pattern.quote("."));
Set<String[]> rets = new TreeSet<>(WILDCARD_PID_COMPARATOR);
for (String id : allPids) {
@@ -496,7 +496,7 @@ public class KarafMBeanServerGuard implements
InvocationHandler {
}
}
- private List<String> getNameSegments(ObjectName objectName) {
+ private static List<String> getNameSegments(ObjectName objectName) {
List<String> segments = new ArrayList<>();
segments.add(objectName.getDomain());
// TODO can an ObjectName property contain a comma as key or value ?
@@ -530,7 +530,7 @@ public class KarafMBeanServerGuard implements
InvocationHandler {
* @param segments the ObjectName segments.
* @return the PIDs corresponding with the ObjectName in the above order.
*/
- private List<String> iterateDownPids(List<String> segments) {
+ private static List<String> iterateDownPids(List<String> segments) {
List<String> res = new ArrayList<>();
for (int i = segments.size(); i > 0; i--) {
StringBuilder sb = new StringBuilder();
diff --git
a/management/server/src/main/java/org/apache/karaf/management/internal/JMXSecurityMBeanImpl.java
b/management/server/src/main/java/org/apache/karaf/management/internal/JMXSecurityMBeanImpl.java
index 59d1b59ed0..c1c4fd2bf6 100644
---
a/management/server/src/main/java/org/apache/karaf/management/internal/JMXSecurityMBeanImpl.java
+++
b/management/server/src/main/java/org/apache/karaf/management/internal/JMXSecurityMBeanImpl.java
@@ -118,7 +118,7 @@ public class JMXSecurityMBeanImpl extends StandardMBean
implements JMXSecurityMB
return table;
}
- private String parseMethodName(String method, List<String> argTypes) {
+ private static String parseMethodName(String method, List<String>
argTypes) {
method = method.trim();
int index = method.indexOf('(');
if (index < 0)
diff --git
a/management/server/src/test/java/org/apache/karaf/management/KarafMBeanServerGuardTest.java
b/management/server/src/test/java/org/apache/karaf/management/KarafMBeanServerGuardTest.java
index 53d2e37f2a..0165ceba3e 100644
---
a/management/server/src/test/java/org/apache/karaf/management/KarafMBeanServerGuardTest.java
+++
b/management/server/src/test/java/org/apache/karaf/management/KarafMBeanServerGuardTest.java
@@ -432,12 +432,12 @@ public class KarafMBeanServerGuardTest extends TestCase {
}
@SuppressWarnings("unchecked")
- private ConfigurationAdmin getMockConfigAdmin(Dictionary<String, Object>
configuration) throws IOException, InvalidSyntaxException {
+ private static ConfigurationAdmin getMockConfigAdmin(Dictionary<String,
Object> configuration) throws IOException, InvalidSyntaxException {
configuration.put(Constants.SERVICE_PID, "jmx.acl.foo.bar.Test");
return getMockConfigAdmin2(configuration);
}
- private ConfigurationAdmin getMockConfigAdmin2(Dictionary<String,
Object>... configurations) throws IOException, InvalidSyntaxException {
+ private static ConfigurationAdmin getMockConfigAdmin2(Dictionary<String,
Object>... configurations) throws IOException, InvalidSyntaxException {
List<Configuration> allConfigs = new ArrayList<>();
for (Dictionary<String, Object> configuration : configurations) {
Configuration conf = EasyMock.createMock(Configuration.class);
@@ -1423,7 +1423,7 @@ public class KarafMBeanServerGuardTest extends TestCase {
});
}
- private Subject loginWithTestRoles(String... roles) throws LoginException {
+ private static Subject loginWithTestRoles(String... roles) throws
LoginException {
Subject subject = new Subject();
LoginModule lm = new TestLoginModule(roles);
lm.initialize(subject, null, null, null);
diff --git a/obr/src/main/java/org/apache/karaf/obr/command/ListCommand.java
b/obr/src/main/java/org/apache/karaf/obr/command/ListCommand.java
index f560992a04..1a853c7a5f 100644
--- a/obr/src/main/java/org/apache/karaf/obr/command/ListCommand.java
+++ b/obr/src/main/java/org/apache/karaf/obr/command/ListCommand.java
@@ -70,7 +70,7 @@ public class ListCommand extends ObrCommandSupport {
table.print(System.out, !noFormat);
}
- private String emptyIfNull(Object st) {
+ private static String emptyIfNull(Object st) {
return st == null ? "" : st.toString();
}
diff --git
a/obr/src/main/java/org/apache/karaf/obr/core/internal/ObrMBeanImpl.java
b/obr/src/main/java/org/apache/karaf/obr/core/internal/ObrMBeanImpl.java
index ba7eb12738..d6d6f2fe51 100644
--- a/obr/src/main/java/org/apache/karaf/obr/core/internal/ObrMBeanImpl.java
+++ b/obr/src/main/java/org/apache/karaf/obr/core/internal/ObrMBeanImpl.java
@@ -169,7 +169,7 @@ public class ObrMBeanImpl extends StandardMBean implements
ObrMBean {
return admin.discoverResources(sb.toString());
}
- private Resource selectNewestVersion(Resource[] resources) {
+ private static Resource selectNewestVersion(Resource[] resources) {
int idx = -1;
Version v = null;
for (int i = 0; (resources != null) && (i < resources.length); i++) {
@@ -187,7 +187,7 @@ public class ObrMBeanImpl extends StandardMBean implements
ObrMBean {
return (idx < 0) ? null : resources[idx];
}
- private String[] getTarget(String bundle) {
+ private static String[] getTarget(String bundle) {
String[] target;
int idx = bundle.indexOf(VERSION_DELIM);
if (idx > 0) {
diff --git
a/profile/src/main/java/org/apache/karaf/profile/assembly/ArtifactInstaller.java
b/profile/src/main/java/org/apache/karaf/profile/assembly/ArtifactInstaller.java
index f1b280fa9d..17b701af23 100644
---
a/profile/src/main/java/org/apache/karaf/profile/assembly/ArtifactInstaller.java
+++
b/profile/src/main/java/org/apache/karaf/profile/assembly/ArtifactInstaller.java
@@ -112,7 +112,7 @@ public class ArtifactInstaller {
/**
* for bad formed URL (like in Camel for mustache-compiler), we remove the
trailing /
*/
- private String removeTrailingSlash(String location) {
+ private static String removeTrailingSlash(String location) {
return location.endsWith("/") ? location.substring(0,
location.length() - 1) : location;
}
diff --git
a/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
b/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
index 4f7805962a..fb974a5a1b 100644
---
a/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
+++
b/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
@@ -120,7 +120,7 @@ public class ConfigInstaller {
return false;
}
- private String globToRegex(String pattern) {
+ private static String globToRegex(String pattern) {
StringBuilder sb = new StringBuilder(pattern.length());
int inGroup = 0;
int inClass = 0;
diff --git
a/profile/src/main/java/org/apache/karaf/profile/assembly/FeatureSelector.java
b/profile/src/main/java/org/apache/karaf/profile/assembly/FeatureSelector.java
index 3f45fa3f1f..10a456c220 100644
---
a/profile/src/main/java/org/apache/karaf/profile/assembly/FeatureSelector.java
+++
b/profile/src/main/java/org/apache/karaf/profile/assembly/FeatureSelector.java
@@ -117,7 +117,7 @@ public class FeatureSelector {
}
}
- private boolean isMandatory(Dependency dep) {
+ private static boolean isMandatory(Dependency dep) {
return !dep.isDependency() && !dep.isPrerequisite();
}
diff --git
a/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
b/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
index b4a884c7cd..6b5e0cfe94 100644
--- a/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
+++ b/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
@@ -439,7 +439,7 @@ public class ProfileEdit implements Action {
}
}
- private void updateConfig(Map<String, Object> map, String key, Object
value, boolean set, boolean delete) {
+ private static void updateConfig(Map<String, Object> map, String key,
Object value, boolean set, boolean delete) {
if (set) {
map.put(key, value);
} else if (delete) {
@@ -474,7 +474,7 @@ public class ProfileEdit implements Action {
* Extracts Key value pairs from a delimited string of key value pairs.
* Note: The value may contain commas.
*/
- private Map<String, String> extractConfigs(String configs) {
+ private static Map<String, String> extractConfigs(String configs) {
Map<String, String> configMap = new HashMap<>();
//If contains key values.
String key;
@@ -570,7 +570,7 @@ public class ProfileEdit implements Action {
}
*/
- private Map<String, Object> getConfigurationFromBuilder(ProfileBuilder
builder, String pid) {
+ private static Map<String, Object>
getConfigurationFromBuilder(ProfileBuilder builder, String pid) {
return builder.getConfiguration(pid);
}
diff --git
a/profile/src/main/java/org/apache/karaf/profile/impl/ProfileBuilderImpl.java
b/profile/src/main/java/org/apache/karaf/profile/impl/ProfileBuilderImpl.java
index 9c363c5bc2..7574313b9b 100644
---
a/profile/src/main/java/org/apache/karaf/profile/impl/ProfileBuilderImpl.java
+++
b/profile/src/main/java/org/apache/karaf/profile/impl/ProfileBuilderImpl.java
@@ -110,7 +110,7 @@ public final class ProfileBuilderImpl implements
ProfileBuilder {
addConfiguration(Profile.INTERNAL_PID, config);
}
- private String parentsAttributeValue(Collection<String> parentIds) {
+ private static String parentsAttributeValue(Collection<String> parentIds) {
return parentIds.isEmpty() ? "" : String.join(" ", parentIds);
}
@@ -435,7 +435,7 @@ public final class ProfileBuilderImpl implements
ProfileBuilder {
* @param properties
* @param values
*/
- private void addGroupOfProperties(String comment, TypedProperties
properties, Map<String, Object> values) {
+ private static void addGroupOfProperties(String comment, TypedProperties
properties, Map<String, Object> values) {
boolean first = true;
for (Entry<String, Object> entry : values.entrySet()) {
if (first) {
@@ -452,7 +452,7 @@ public final class ProfileBuilderImpl implements
ProfileBuilder {
* @param comment
* @return
*/
- private List<String> comment(String comment) {
+ private static List<String> comment(String comment) {
return Arrays.asList("", "# " + comment);
}
diff --git
a/profile/src/main/java/org/apache/karaf/profile/impl/ProfileImpl.java
b/profile/src/main/java/org/apache/karaf/profile/impl/ProfileImpl.java
index bfc4d7250e..1b72c89fb7 100644
--- a/profile/src/main/java/org/apache/karaf/profile/impl/ProfileImpl.java
+++ b/profile/src/main/java/org/apache/karaf/profile/impl/ProfileImpl.java
@@ -200,7 +200,7 @@ final class ProfileImpl implements Profile {
return parseBoolean(attributes.get(HIDDEN));
}
- private Boolean parseBoolean(Object obj) {
+ private static Boolean parseBoolean(Object obj) {
return obj instanceof Boolean ? (Boolean) obj : obj != null &&
Boolean.parseBoolean(obj.toString());
}
diff --git
a/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java
b/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java
index 2f6f8990eb..5927397070 100644
---
a/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java
+++
b/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java
@@ -109,7 +109,7 @@ public class StaticConfigAdminImpl implements
ConfigurationAdmin {
factoryTracker.open();
}
- private void invokeUpdate(ManagedService service, Configuration config) {
+ private static void invokeUpdate(ManagedService service, Configuration
config) {
try {
service.updated(config == null ? null :
config.getProcessedProperties(null));
} catch (final Exception e) {
diff --git
a/system/src/main/java/org/apache/karaf/system/commands/SystemProperty.java
b/system/src/main/java/org/apache/karaf/system/commands/SystemProperty.java
index 090a8ca5f7..efdc0fb81b 100644
--- a/system/src/main/java/org/apache/karaf/system/commands/SystemProperty.java
+++ b/system/src/main/java/org/apache/karaf/system/commands/SystemProperty.java
@@ -131,7 +131,7 @@ public class SystemProperty implements Action {
return null;
}
- private void printOrderedProperties(Properties props, PrintStream out) {
+ private static void printOrderedProperties(Properties props, PrintStream
out) {
Set<Object> keys = props.keySet();
List<String> order = new ArrayList<>(keys.size());
for (Object str : keys) {
diff --git
a/system/src/main/java/org/apache/karaf/system/internal/SystemServiceImpl.java
b/system/src/main/java/org/apache/karaf/system/internal/SystemServiceImpl.java
index 76b3914781..cc8dbce7e3 100644
---
a/system/src/main/java/org/apache/karaf/system/internal/SystemServiceImpl.java
+++
b/system/src/main/java/org/apache/karaf/system/internal/SystemServiceImpl.java
@@ -92,8 +92,7 @@ public class SystemServiceImpl implements SystemService {
}).start();
}
- private void sleepWithMsg(final long sleep, String msg)
- throws InterruptedException {
+ private static void sleepWithMsg(final long sleep, String msg) throws
InterruptedException {
if (sleep > 0) {
LOGGER.info(msg);
System.err.println(msg);
@@ -115,7 +114,7 @@ public class SystemServiceImpl implements SystemService {
* @param time the time string.
* @return the corresponding sleep period in millisecond.
*/
- private long timeToSleep(String time) throws Exception {
+ private static long timeToSleep(String time) throws Exception {
long sleep = 0;
if (time != null) {
if (!time.equals("now")) {
@@ -191,7 +190,7 @@ public class SystemServiceImpl implements SystemService {
}
}
- private Properties loadProps() throws IOException {
+ private static Properties loadProps() throws IOException {
return new Properties(new File(System.getProperty("karaf.etc"),
"config.properties"));
}
diff --git
a/system/src/main/java/org/apache/karaf/system/management/internal/SystemMBeanImpl.java
b/system/src/main/java/org/apache/karaf/system/management/internal/SystemMBeanImpl.java
index 4cf4ad1277..b5ec3be130 100644
---
a/system/src/main/java/org/apache/karaf/system/management/internal/SystemMBeanImpl.java
+++
b/system/src/main/java/org/apache/karaf/system/management/internal/SystemMBeanImpl.java
@@ -209,7 +209,7 @@ public class SystemMBeanImpl extends StandardMBean
implements SystemMBean {
}
}
- private void printOrderedProperties(Properties props, PrintStream out) {
+ private static void printOrderedProperties(Properties props, PrintStream
out) {
Set<Object> keys = props.keySet();
List<String> order = new ArrayList<>(keys.size());
for (Object str : keys) {
@@ -221,7 +221,7 @@ public class SystemMBeanImpl extends StandardMBean
implements SystemMBean {
}
}
- private void printOrderedProperties(Properties props, Map<String, String>
result) {
+ private static void printOrderedProperties(Properties props, Map<String,
String> result) {
Set<Object> keys = props.keySet();
List<String> order = new ArrayList<>(keys.size());
for (Object str : keys) {
diff --git
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
index f1824a3533..80cec22dde 100644
---
a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
+++
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/AssemblyMojo.java
@@ -697,7 +697,7 @@ public class AssemblyMojo extends MojoSupport {
}
}
- private void addUris(Builder.Stage stage, String uri, List<String>
startup, List<String> boot, List<String> installed) {
+ private static void addUris(Builder.Stage stage, String uri, List<String>
startup, List<String> boot, List<String> installed) {
switch (stage) {
case Startup:
startup.add(uri);
@@ -823,7 +823,7 @@ public class AssemblyMojo extends MojoSupport {
return urls;
}
- private String getType(Artifact artifact) {
+ private static String getType(Artifact artifact) {
// Identify kars
if ("kar".equals(artifact.getType())) {
return "kar";
@@ -878,7 +878,7 @@ public class AssemblyMojo extends MojoSupport {
return "unknown";
}
- private String artifactToMvn(Artifact artifact) {
+ private static String artifactToMvn(Artifact artifact) {
String uri;
String groupId = artifact.getGroupId();
@@ -899,7 +899,7 @@ public class AssemblyMojo extends MojoSupport {
return uri;
}
- private String[] toArray(List<String> strings) {
+ private static String[] toArray(List<String> strings) {
return strings.toArray(new String[strings.size()]);
}
@@ -932,16 +932,16 @@ public class AssemblyMojo extends MojoSupport {
translatedUrls = nonNullProps(translatedUrls);
}
- private List<String> nonNullList(List<String> list) {
+ private static List<String> nonNullList(List<String> list) {
final List<String> nonNullList = list == null ? new ArrayList<>() :
list;
return
nonNullList.stream().filter(Objects::nonNull).collect(Collectors.toList());
}
- private Map<String, String> nonNullMap(Map<String, String> map) {
+ private static Map<String, String> nonNullMap(Map<String, String> map) {
return map == null ? new LinkedHashMap<>() : map;
}
- private Properties nonNullProps(Properties props) {
+ private static Properties nonNullProps(Properties props) {
return props == null ? new Properties() : props;
}