This is an automated email from the ASF dual-hosted git repository.

enorman pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git


The following commit(s) were added to refs/heads/master by this push:
     new a72f85f  SLING-12914 Update to Parent 62 and apply spotless formatting
a72f85f is described below

commit a72f85fa0602d1d11fba9ff4e4cd6606adb9bdac
Author: Eric Norman <[email protected]>
AuthorDate: Wed Aug 27 17:34:18 2025 -0700

    SLING-12914 Update to Parent 62 and apply spotless formatting
---
 pom.xml                                            |  87 ++++----
 .../org/apache/sling/commons/osgi/BSNRenamer.java  |  10 +-
 .../sling/commons/osgi/BundleFileProcessor.java    |  37 ++--
 .../apache/sling/commons/osgi/ManifestHeader.java  |  45 ++--
 .../java/org/apache/sling/commons/osgi/Order.java  |   4 +-
 .../org/apache/sling/commons/osgi/OsgiUtil.java    |  24 +--
 .../apache/sling/commons/osgi/PropertiesUtil.java  |  45 ++--
 .../apache/sling/commons/osgi/RankedServices.java  | 237 ++++++++++-----------
 .../org/apache/sling/commons/osgi/ServiceUtil.java |  29 ++-
 .../sling/commons/osgi/SortingServiceTracker.java  |  25 +--
 .../bundleversion/BundleBundleVersionInfo.java     |  15 +-
 .../osgi/bundleversion/BundleVersionInfo.java      |  58 +++--
 .../osgi/bundleversion/FileBundleVersionInfo.java  |   6 +-
 .../commons/osgi/BundleFileProcessorTest.java      |  81 ++++---
 .../sling/commons/osgi/ManifestHeaderTest.java     |   7 +-
 .../apache/sling/commons/osgi/OsgiUtilTest.java    |  19 +-
 .../sling/commons/osgi/PropertiesUtilTest.java     |  39 ++--
 .../sling/commons/osgi/RankedServicesTest.java     | 157 +++++++-------
 .../bundleversion/BundleBundleVersionInfoTest.java |  32 +--
 .../bundleversion/BundleVersionComparisonTest.java |  66 +++---
 .../bundleversion/FileBundleVersionInfoTest.java   |  18 +-
 .../osgi/bundleversion/MockBundleVersionInfo.java  |   8 +-
 22 files changed, 513 insertions(+), 536 deletions(-)

diff --git a/pom.xml b/pom.xml
index 90eeb01..d948294 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling-bundle-parent</artifactId>
-        <version>48</version>
+        <version>62</version>
         <relativePath />
     </parent>
 
@@ -36,56 +36,21 @@
     <scm>
         
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git</connection>
         
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git</developerConnection>
-        
<url>https://github.com/apache/sling-org-apache-sling-commons-osgi.git</url>
-      <tag>HEAD</tag>
-  </scm>
-    
+        <tag>HEAD</tag>
+        
<url>https://github.com/apache/sling-org-apache-sling-commons-osgi/tree/${project.scm.tag}</url>
+    </scm>
+
     <properties>
+        <sling.java.version>17</sling.java.version>
         
<test.jars.folder>${project.build.directory}/testjars</test.jars.folder>
     </properties>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-test-bundles</id>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            
<includeArtifactIds>org.apache.sling.api,jcr</includeArtifactIds>
-                            <excludeTransitive>true</excludeTransitive>
-                            
<outputDirectory>${test.jars.folder}</outputDirectory>
-                            <overWriteReleases>true</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <systemProperties>
-                        <property>
-                            <name>test.jars.folder</name>
-                            <value>${test.jars.folder}</value>
-                        </property>
-                    </systemProperties>
-                </configuration>
-            </plugin>                        
-        </plugins>
-    </build>
-
     <dependencies>
-       <dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.annotation.versioning</artifactId>
             <scope>provided</scope>
-       </dependency>
+        </dependency>
         <!-- OSGi Libraries -->
         <dependency>
             <groupId>org.osgi</groupId>
@@ -141,4 +106,40 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-test-bundles</id>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            
<includeArtifactIds>org.apache.sling.api,jcr</includeArtifactIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            
<outputDirectory>${test.jars.folder}</outputDirectory>
+                            <overWriteReleases>true</overWriteReleases>
+                            <overWriteSnapshots>true</overWriteSnapshots>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>test.jars.folder</name>
+                            <value>${test.jars.folder}</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/src/main/java/org/apache/sling/commons/osgi/BSNRenamer.java 
b/src/main/java/org/apache/sling/commons/osgi/BSNRenamer.java
index faf6730..d98d1a9 100644
--- a/src/main/java/org/apache/sling/commons/osgi/BSNRenamer.java
+++ b/src/main/java/org/apache/sling/commons/osgi/BSNRenamer.java
@@ -30,14 +30,14 @@ import java.util.jar.Manifest;
 public class BSNRenamer extends BundleFileProcessor {
     private final String newBSN;
     public static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName";
-    public static final String X_ORIG_BSN = "X-Original-Bundle-SymbolicName"; 
-    public static final String BUNDLE_VERSION = "Bundle-Version"; 
-    
+    public static final String X_ORIG_BSN = "X-Original-Bundle-SymbolicName";
+    public static final String BUNDLE_VERSION = "Bundle-Version";
+
     public BSNRenamer(File input, File outputFolder, String newBSN) {
         super(input, outputFolder);
         this.newBSN = newBSN;
     }
-    
+
     protected Manifest processManifest(Manifest inputMF) {
         Attributes inputAttrs = inputMF.getMainAttributes();
         String orgBSN = inputAttrs.getValue(BUNDLE_SYMBOLIC_NAME);
@@ -47,7 +47,7 @@ public class BSNRenamer extends BundleFileProcessor {
         outputAttrs.putValue(X_ORIG_BSN, orgBSN);
         return newMF;
     }
-    
+
     protected String getTargetFilename(Manifest inputJarManifest) {
         String bver = 
inputJarManifest.getMainAttributes().getValue(BUNDLE_VERSION);
         if (bver == null) {
diff --git 
a/src/main/java/org/apache/sling/commons/osgi/BundleFileProcessor.java 
b/src/main/java/org/apache/sling/commons/osgi/BundleFileProcessor.java
index 4f6143a..7ec43d8 100644
--- a/src/main/java/org/apache/sling/commons/osgi/BundleFileProcessor.java
+++ b/src/main/java/org/apache/sling/commons/osgi/BundleFileProcessor.java
@@ -31,20 +31,20 @@ import java.util.jar.Manifest;
 
 /**
  * The <code>BundleFileProcessor</code> can transform a bundle Manifest
- * by creating a modified copy of the bundle file. 
+ * by creating a modified copy of the bundle file.
  * @since 2.4
  */
 public abstract class BundleFileProcessor {
-    
+
     private final File input;
     private final File outputFolder;
-    
+
     public BundleFileProcessor(File input, File outputFolder) {
         this.input = input;
         this.outputFolder = outputFolder;
     }
-    
-    /** 
+
+    /**
      * Process the bundle Manifest. Can return the original
      * one if no changes are needed.
      * @param originalManifest The manifest to process
@@ -52,13 +52,13 @@ public abstract class BundleFileProcessor {
      */
     protected abstract Manifest processManifest(Manifest originalManifest);
 
-    /** 
-     * Return the filename to use for the newly created bundle file 
+    /**
+     * Return the filename to use for the newly created bundle file
      * @param inputJarManifest The manifest
      * @return The filename
      */
     protected abstract String getTargetFilename(Manifest inputJarManifest);
-    
+
     /**
      * Creates a new OSGi Bundle from a given bundle, processing its manifest
      * using the processManifest method.
@@ -66,37 +66,24 @@ public abstract class BundleFileProcessor {
      * @throws IOException If something goes wrong reading or writing.
      */
     public File process() throws IOException {
-        JarInputStream jis = null;
-        try {
-            jis = new JarInputStream(new FileInputStream(input));
+        try (JarInputStream jis = new JarInputStream(new 
FileInputStream(input))) {
             Manifest oldMF = jis.getManifest();
             Manifest newMF = processManifest(oldMF);
             File newBundle = new File(outputFolder, getTargetFilename(oldMF));
 
-            JarOutputStream jos = null;
-            try {
-                jos = new JarOutputStream(new FileOutputStream(newBundle), 
newMF);
+            try (JarOutputStream jos = new JarOutputStream(new 
FileOutputStream(newBundle), newMF)) {
                 JarEntry je = null;
                 while ((je = jis.getNextJarEntry()) != null) {
                     try {
                         jos.putNextEntry(je);
-                        if (!je.isDirectory())
-                            pumpStream(jis, jos);
+                        if (!je.isDirectory()) pumpStream(jis, jos);
                     } finally {
                         jos.closeEntry();
-                        jis.closeEntry();;
+                        jis.closeEntry();
                     }
                 }
-            } finally {
-                if(jos != null) {
-                    jos.close();
-                }
             }
             return newBundle;
-        } finally {
-            if(jis != null) {
-                jis.close();
-            }
         }
     }
 
diff --git a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java 
b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
index 385ccf1..c4390ae 100644
--- a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
+++ b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
@@ -60,7 +60,7 @@ public class ManifestHeader {
      * Add new entries from parsing.
      */
     private void add(Entry[] paths) {
-        if ( paths != null && paths.length > 0 ) {
+        if (paths != null && paths.length > 0) {
             final Entry[] copy = new Entry[this.entries.length + paths.length];
             System.arraycopy(this.entries, 0, copy, 0, this.entries.length);
             System.arraycopy(paths, 0, copy, this.entries.length, 
paths.length);
@@ -78,7 +78,7 @@ public class ManifestHeader {
     /**
      * Directives and attributes are simple name/value pairs.
      */
-    public final static class NameValuePair {
+    public static final class NameValuePair {
 
         private final String name;
         private final String value;
@@ -119,8 +119,8 @@ public class ManifestHeader {
             }
 
             final String[] clauseStrings = parseDelimitedString(header, 
CLASS_PATH_SEPARATOR);
-            if ( clauseStrings != null ) {
-                for(final String clause : clauseStrings) {
+            if (clauseStrings != null) {
+                for (final String clause : clauseStrings) {
                     entry.add(parseStandardHeaderClause(clause));
                 }
             }
@@ -134,7 +134,7 @@ public class ManifestHeader {
      * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; 
attr2=attrval2
      */
     private static ManifestHeader.Entry[] parseStandardHeaderClause(String 
clauseString)
-    throws IllegalArgumentException {
+            throws IllegalArgumentException {
         // Break string into semi-colon delimited pieces.
         String[] pieces = parseDelimitedString(clauseString, 
PACKAGE_SEPARATOR);
 
@@ -152,13 +152,12 @@ public class ManifestHeader {
 
         // Error if no paths were specified.
         if (pathCount == 0) {
-            throw new IllegalArgumentException(
-                "No paths specified in header: " + clauseString);
+            throw new IllegalArgumentException("No paths specified in header: 
" + clauseString);
         }
 
         // Create an array of paths.
         PathImpl[] paths = new PathImpl[pathCount];
-        for(int i=0;i<pathCount;i++) {
+        for (int i = 0; i < pathCount; i++) {
             paths[i] = new PathImpl(pieces[i]);
         }
 
@@ -166,10 +165,10 @@ public class ManifestHeader {
         // and keep the order
         // for simpliefied checking if a directive/attribute is used twice, we 
keep
         // two collections: one for the values and one for the names
-        final List<ManifestHeader.NameValuePair> dirsList = new 
ArrayList<ManifestHeader.NameValuePair>();
-        final Set<String> dirsNames = new HashSet<String>();
-        final List<ManifestHeader.NameValuePair> attrsList = new 
ArrayList<ManifestHeader.NameValuePair>();
-        final Set<String> attrsNames = new HashSet<String>();
+        final List<ManifestHeader.NameValuePair> dirsList = new ArrayList<>();
+        final Set<String> dirsNames = new HashSet<>();
+        final List<ManifestHeader.NameValuePair> attrsList = new ArrayList<>();
+        final Set<String> attrsNames = new HashSet<>();
 
         int idx = -1;
         String sep = null;
@@ -209,15 +208,13 @@ public class ManifestHeader {
             }
         }
         // Create directive array.
-        ManifestHeader.NameValuePair[] dirs =
-            dirsList.toArray(new 
ManifestHeader.NameValuePair[dirsList.size()]);
+        ManifestHeader.NameValuePair[] dirs = dirsList.toArray(new 
ManifestHeader.NameValuePair[dirsList.size()]);
 
         // Create attribute array.
-        ManifestHeader.NameValuePair[] attrs =
-            attrsList.toArray(new 
ManifestHeader.NameValuePair[attrsList.size()]);
+        ManifestHeader.NameValuePair[] attrs = attrsList.toArray(new 
ManifestHeader.NameValuePair[attrsList.size()]);
 
         // now set attributes and directives for each path
-        for(int i=0;i<pathCount;i++) {
+        for (int i = 0; i < pathCount; i++) {
             paths[i].init(dirs, attrs);
         }
 
@@ -240,10 +237,10 @@ public class ManifestHeader {
      **/
     private static String[] parseDelimitedString(String value, String delim) {
         if (value == null) {
-           value = "";
+            value = "";
         }
 
-        final List<String> list = new ArrayList<String>();
+        final List<String> list = new ArrayList<>();
 
         final StringBuilder sb = new StringBuilder();
 
@@ -276,7 +273,7 @@ public class ManifestHeader {
             list.add(sb.toString().trim());
         }
 
-        if ( list.size() == 0 ) {
+        if (list.isEmpty()) {
             return null;
         }
         return list.toArray(new String[list.size()]);
@@ -322,8 +319,8 @@ public class ManifestHeader {
         public String getAttributeValue(String name) {
             String v = null;
             int index = 0;
-            while ( v == null && index < attributes.length ) {
-                if ( attributes[index].getName().equals(name) ) {
+            while (v == null && index < attributes.length) {
+                if (attributes[index].getName().equals(name)) {
                     v = attributes[index].getValue();
                 }
                 index++;
@@ -334,8 +331,8 @@ public class ManifestHeader {
         public String getDirectiveValue(String name) {
             String v = null;
             int index = 0;
-            while ( v == null && index < directives.length ) {
-                if ( directives[index].getName().equals(name) ) {
+            while (v == null && index < directives.length) {
+                if (directives[index].getName().equals(name)) {
                     v = directives[index].getValue();
                 }
                 index++;
diff --git a/src/main/java/org/apache/sling/commons/osgi/Order.java 
b/src/main/java/org/apache/sling/commons/osgi/Order.java
index d247230..40ec65e 100644
--- a/src/main/java/org/apache/sling/commons/osgi/Order.java
+++ b/src/main/java/org/apache/sling/commons/osgi/Order.java
@@ -20,7 +20,7 @@ package org.apache.sling.commons.osgi;
 
 /**
  * Order for services being sorted by {@link 
ServiceUtil#getComparableForServiceRanking(java.util.Map, Order)}
- * or {@link RankedServices}. Either {@link #ASCENDING} meaning services with 
lowest service ranking first or 
+ * or {@link RankedServices}. Either {@link #ASCENDING} meaning services with 
lowest service ranking first or
  * {@link #DESCENDING} meaning services with highest service ranking first.
  */
 public enum Order {
@@ -34,4 +34,4 @@ public enum Order {
         this.lessThan = lessThan;
         this.greaterThan = greaterThan;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java 
b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index 1c076cd..42ebd7e 100644
--- a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -161,7 +161,6 @@ public class OsgiUtil {
      */
     public static String[] toStringArray(final Object propValue, final 
String[] defaultArray) {
         return PropertiesUtil.toStringArray(propValue, defaultArray);
-
     }
 
     /**
@@ -176,39 +175,36 @@ public class OsgiUtil {
      * @param props A non-null map of properties for the event.
      * @return The OSGi event.
      */
-    public static Event createEvent(final Bundle sourceBundle,
+    public static Event createEvent(
+            final Bundle sourceBundle,
             final ServiceReference sourceService,
             final String topic,
             final Map<String, Object> props) {
 
         // get a private copy of the properties
-        Dictionary<String, Object> table = new Hashtable<String, 
Object>(props);
+        Dictionary<String, Object> table = new Hashtable<>(props);
 
         // service information of the provide service reference
         if (sourceService != null) {
             table.put(EventConstants.SERVICE, sourceService);
+            table.put(EventConstants.SERVICE_ID, 
sourceService.getProperty(org.osgi.framework.Constants.SERVICE_ID));
             table.put(
-                EventConstants.SERVICE_ID,
-                
sourceService.getProperty(org.osgi.framework.Constants.SERVICE_ID));
-            table.put(
-                EventConstants.SERVICE_OBJECTCLASS,
-                
sourceService.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
+                    EventConstants.SERVICE_OBJECTCLASS,
+                    
sourceService.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
             if 
(sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID) != null) {
                 table.put(
-                    EventConstants.SERVICE_PID,
-                    
sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID));
+                        EventConstants.SERVICE_PID,
+                        
sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID));
             }
         }
 
         // source bundle information (if available)
         if (sourceBundle != null) {
-            table.put(EventConstants.BUNDLE_SYMBOLICNAME,
-                sourceBundle.getSymbolicName());
+            table.put(EventConstants.BUNDLE_SYMBOLICNAME, 
sourceBundle.getSymbolicName());
         }
 
         // timestamp the event
-        table.put(EventConstants.TIMESTAMP,
-            new Long(System.currentTimeMillis()));
+        table.put(EventConstants.TIMESTAMP, System.currentTimeMillis());
 
         // create the event
         return new Event(topic, table);
diff --git a/src/main/java/org/apache/sling/commons/osgi/PropertiesUtil.java 
b/src/main/java/org/apache/sling/commons/osgi/PropertiesUtil.java
index b94d76c..43a7787 100644
--- a/src/main/java/org/apache/sling/commons/osgi/PropertiesUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/PropertiesUtil.java
@@ -46,8 +46,8 @@ public class PropertiesUtil {
      */
     public static boolean toBoolean(Object propValue, boolean defaultValue) {
         propValue = toObject(propValue);
-        if (propValue instanceof Boolean) {
-            return (Boolean) propValue;
+        if (propValue instanceof Boolean b) {
+            return b;
         } else if (propValue != null) {
             return Boolean.parseBoolean(String.valueOf(propValue));
         }
@@ -78,8 +78,8 @@ public class PropertiesUtil {
      */
     public static long toLong(Object propValue, long defaultValue) {
         propValue = toObject(propValue);
-        if (propValue instanceof Long) {
-            return (Long) propValue;
+        if (propValue instanceof Long l) {
+            return l;
         } else if (propValue != null) {
             try {
                 return Long.parseLong(String.valueOf(propValue));
@@ -102,8 +102,8 @@ public class PropertiesUtil {
      */
     public static int toInteger(Object propValue, int defaultValue) {
         propValue = toObject(propValue);
-        if (propValue instanceof Integer) {
-            return (Integer) propValue;
+        if (propValue instanceof Integer i) {
+            return i;
         } else if (propValue != null) {
             try {
                 return Integer.parseInt(String.valueOf(propValue));
@@ -126,8 +126,8 @@ public class PropertiesUtil {
      */
     public static double toDouble(Object propValue, double defaultValue) {
         propValue = toObject(propValue);
-        if (propValue instanceof Double) {
-            return (Double) propValue;
+        if (propValue instanceof Double dbl) {
+            return dbl;
         } else if (propValue != null) {
             try {
                 return Double.parseDouble(String.valueOf(propValue));
@@ -155,8 +155,7 @@ public class PropertiesUtil {
         } else if (propValue.getClass().isArray()) {
             Object[] prop = (Object[]) propValue;
             return prop.length > 0 ? prop[0] : null;
-        } else if (propValue instanceof Collection<?>) {
-            Collection<?> prop = (Collection<?>) propValue;
+        } else if (propValue instanceof Collection<?> prop) {
             return prop.isEmpty() ? null : prop.iterator().next();
         } else {
             return propValue;
@@ -195,18 +194,18 @@ public class PropertiesUtil {
             // no value at all
             return defaultArray;
 
-        } else if (propValue instanceof String) {
+        } else if (propValue instanceof String str) {
             // single string
-            return new String[] { (String) propValue };
+            return new String[] {str};
 
-        } else if (propValue instanceof String[]) {
+        } else if (propValue instanceof String[] strArray) {
             // String[]
-            return (String[]) propValue;
+            return strArray;
 
         } else if (propValue.getClass().isArray()) {
             // other array
             Object[] valueArray = (Object[]) propValue;
-            List<String> values = new ArrayList<String>(valueArray.length);
+            List<String> values = new ArrayList<>(valueArray.length);
             for (Object value : valueArray) {
                 if (value != null) {
                     values.add(value.toString());
@@ -214,10 +213,9 @@ public class PropertiesUtil {
             }
             return values.toArray(new String[values.size()]);
 
-        } else if (propValue instanceof Collection<?>) {
+        } else if (propValue instanceof Collection<?> valueCollection) {
             // collection
-            Collection<?> valueCollection = (Collection<?>) propValue;
-            List<String> valueList = new 
ArrayList<String>(valueCollection.size());
+            List<String> valueList = new ArrayList<>(valueCollection.size());
             for (Object value : valueCollection) {
                 if (value != null) {
                     valueList.add(value.toString());
@@ -255,8 +253,8 @@ public class PropertiesUtil {
             return null;
         }
 
-        //in property values
-        Map<String, String> result = new LinkedHashMap<String, String>();
+        // in property values
+        Map<String, String> result = new LinkedHashMap<>();
         for (String kv : arrayValue) {
             int indexOfEqual = kv.indexOf('=');
             if (indexOfEqual > 0) {
@@ -270,17 +268,16 @@ public class PropertiesUtil {
         return result;
     }
 
-    private static String trimToNull(String str)    {
+    private static String trimToNull(String str) {
         String ts = trim(str);
         return isEmpty(ts) ? null : ts;
     }
 
-    private static String trim(String str){
+    private static String trim(String str) {
         return str == null ? null : str.trim();
     }
 
-    private static boolean isEmpty(String str){
+    private static boolean isEmpty(String str) {
         return str == null || str.length() == 0;
     }
-
 }
diff --git a/src/main/java/org/apache/sling/commons/osgi/RankedServices.java 
b/src/main/java/org/apache/sling/commons/osgi/RankedServices.java
index a828713..6a61d82 100644
--- a/src/main/java/org/apache/sling/commons/osgi/RankedServices.java
+++ b/src/main/java/org/apache/sling/commons/osgi/RankedServices.java
@@ -71,131 +71,130 @@ import org.osgi.framework.ServiceReference;
 @ProviderType
 public final class RankedServices<T> implements Iterable<T> {
 
-  private final ChangeListener changeListener;
-  private final SortedMap<Comparable<Object>, T> serviceMap = new 
TreeMap<Comparable<Object>, T>();
-  private volatile List<T> sortedServices = Collections.emptyList();
-  private final Order order;
-
-  /**
-   * Instantiate without change listener in ascending order (lowest service 
ranking first).
-   * @deprecated Use {@link #RankedServices(Order)} to explicitly give the 
order.
-   */
-  @Deprecated
-  public RankedServices() {
-    this(Order.ASCENDING, null);
-  }
-  
-  /**
-   * Instantiate with change listener in ascending order (lowest service 
ranking first).
-   * @param changeListener Change listener
-   * @deprecated Use {@link #RankedServices(Order order, ChangeListener 
changeListener)} instead 
-   */
-  @Deprecated
-  public RankedServices(ChangeListener changeListener) {
-    this(Order.ASCENDING, changeListener);
-  }
-  
-  /**
-   * Instantiate without change listener but with a given order.
-   * @param order the order in which the services should be returned in {@link 
#iterator()} and {@link #get()}. 
-   *              Either {@link Order#ASCENDING} or {@link Order#DESCENDING}.
-   *              Use {@link Order#DESCENDING} if you want to have the service 
with the highest ranking returned first
-   *              (this is the service which would also be chosen by {@link 
BundleContext#getServiceReference(String)}).
-   * @since 2.4
-   */
-  public RankedServices(Order order) {
-    this(order, null);
-  }
-
-  /**
-   * Instantiate with change listener.
-   * @param order the order in which the services should be returned in {@link 
#iterator()} and {@link #get()}. 
-   *              Either {@link Order#ASCENDING} or {@link Order#DESCENDING}.
-   *              Use {@link Order#DESCENDING} if you want to have the service 
with the highest ranking returned first
-   *              (this is the service which would also be chosen by {@link 
BundleContext#getServiceReference(String)}).
-   * @param changeListener Change listener
-   * @since 2.4
-   */
-  public RankedServices(Order order, ChangeListener changeListener) {
-    this.order = order;
-    this.changeListener = changeListener;
-  }
-
-  /**
-   * Handle bind service event.
-   * @param service Service instance
-   * @param props Service reference properties
-   */
-  public void bind(T service, Map<String, Object> props) {
-    synchronized (serviceMap) {
-      serviceMap.put(ServiceUtil.getComparableForServiceRanking(props, order), 
service);
-      updateSortedServices();
+    private final ChangeListener changeListener;
+    private final SortedMap<Comparable<Object>, T> serviceMap = new 
TreeMap<>();
+    private volatile List<T> sortedServices = Collections.emptyList();
+    private final Order order;
+
+    /**
+     * Instantiate without change listener in ascending order (lowest service 
ranking first).
+     * @deprecated Use {@link #RankedServices(Order)} to explicitly give the 
order.
+     */
+    @Deprecated
+    public RankedServices() {
+        this(Order.ASCENDING, null);
     }
-  }
-
-  /**
-   * Handle unbind service event.
-   * @param service Service instance
-   * @param props Service reference properties
-   */
-  public void unbind(T service, Map<String, Object> props) {
-    synchronized (serviceMap) {
-      serviceMap.remove(ServiceUtil.getComparableForServiceRanking(props, 
order));
-      updateSortedServices();
+
+    /**
+     * Instantiate with change listener in ascending order (lowest service 
ranking first).
+     * @param changeListener Change listener
+     * @deprecated Use {@link #RankedServices(Order order, ChangeListener 
changeListener)} instead
+     */
+    @Deprecated
+    public RankedServices(ChangeListener changeListener) {
+        this(Order.ASCENDING, changeListener);
     }
-  }
-
-  /**
-   * Update list of sorted services by copying it from the array and making it 
unmodifiable.
-   */
-  private void updateSortedServices() {
-    List<T> copiedList = new ArrayList<T>(serviceMap.values());
-    sortedServices = Collections.unmodifiableList(copiedList);
-    if (changeListener != null) {
-      changeListener.changed();
+
+    /**
+     * Instantiate without change listener but with a given order.
+     * @param order the order in which the services should be returned in 
{@link #iterator()} and {@link #get()}.
+     *              Either {@link Order#ASCENDING} or {@link Order#DESCENDING}.
+     *              Use {@link Order#DESCENDING} if you want to have the 
service with the highest ranking returned first
+     *              (this is the service which would also be chosen by {@link 
BundleContext#getServiceReference(String)}).
+     * @since 2.4
+     */
+    public RankedServices(Order order) {
+        this(order, null);
     }
-  }
-
-  /**
-   * Lists all services registered in OSGi, sorted by service ranking
-   * (either ascending or descending depending on the order given in the 
constructor).
-   * @return Collection of service instances
-   * @deprecated Use {@link #getList()} instead
-   */
-  public Collection<T> get() {
-    return sortedServices;
-  }
-  
-  /**
-   * Lists all services registered in OSGi, sorted by service ranking
-   * (either ascending or descending depending on the order given in the 
constructor).
-   * @return List of service instances
-   */
-  public List<T> getList() {
-    return sortedServices;
-  }
-
-  /**
-   * Iterates all services registered in OSGi, sorted by service ranking
-   * (either ascending or descending depending on the order given in the 
constructor).
-   * @return Iterator with service instances.
-   */
-  public Iterator<T> iterator() {
-    return sortedServices.iterator();
-  }
-
-  /**
-   * Notification for changes on services list.
-   */
-  @ConsumerType
-  public interface ChangeListener {
 
     /**
-     * Is called when the list of ranked services was changed due to bundle 
bindings/unbindings.
-     * This method is called within a synchronized block, so it's code should 
be kept as efficient as possible.
+     * Instantiate with change listener.
+     * @param order the order in which the services should be returned in 
{@link #iterator()} and {@link #get()}.
+     *              Either {@link Order#ASCENDING} or {@link Order#DESCENDING}.
+     *              Use {@link Order#DESCENDING} if you want to have the 
service with the highest ranking returned first
+     *              (this is the service which would also be chosen by {@link 
BundleContext#getServiceReference(String)}).
+     * @param changeListener Change listener
+     * @since 2.4
      */
-    void changed();
+    public RankedServices(Order order, ChangeListener changeListener) {
+        this.order = order;
+        this.changeListener = changeListener;
+    }
 
-  }
+    /**
+     * Handle bind service event.
+     * @param service Service instance
+     * @param props Service reference properties
+     */
+    public void bind(T service, Map<String, Object> props) {
+        synchronized (serviceMap) {
+            serviceMap.put(ServiceUtil.getComparableForServiceRanking(props, 
order), service);
+            updateSortedServices();
+        }
+    }
 
+    /**
+     * Handle unbind service event.
+     * @param service Service instance
+     * @param props Service reference properties
+     */
+    public void unbind(T service, Map<String, Object> props) {
+        synchronized (serviceMap) {
+            
serviceMap.remove(ServiceUtil.getComparableForServiceRanking(props, order));
+            updateSortedServices();
+        }
+    }
+
+    /**
+     * Update list of sorted services by copying it from the array and making 
it unmodifiable.
+     */
+    private void updateSortedServices() {
+        List<T> copiedList = new ArrayList<>(serviceMap.values());
+        sortedServices = Collections.unmodifiableList(copiedList);
+        if (changeListener != null) {
+            changeListener.changed();
+        }
+    }
+
+    /**
+     * Lists all services registered in OSGi, sorted by service ranking
+     * (either ascending or descending depending on the order given in the 
constructor).
+     * @return Collection of service instances
+     * @deprecated Use {@link #getList()} instead
+     */
+    @Deprecated
+    public Collection<T> get() {
+        return sortedServices;
+    }
+
+    /**
+     * Lists all services registered in OSGi, sorted by service ranking
+     * (either ascending or descending depending on the order given in the 
constructor).
+     * @return List of service instances
+     */
+    public List<T> getList() {
+        return sortedServices;
+    }
+
+    /**
+     * Iterates all services registered in OSGi, sorted by service ranking
+     * (either ascending or descending depending on the order given in the 
constructor).
+     * @return Iterator with service instances.
+     */
+    public Iterator<T> iterator() {
+        return sortedServices.iterator();
+    }
+
+    /**
+     * Notification for changes on services list.
+     */
+    @ConsumerType
+    public interface ChangeListener {
+
+        /**
+         * Is called when the list of ranked services was changed due to 
bundle bindings/unbindings.
+         * This method is called within a synchronized block, so it's code 
should be kept as efficient as possible.
+         */
+        void changed();
+    }
 }
diff --git a/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java 
b/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java
index 7fa9e43..d44c04e 100644
--- a/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java
@@ -46,9 +46,9 @@ public class ServiceUtil {
      * Create a comparable object out of the service properties. With the 
result
      * it is possible to compare service properties based on the service 
ranking
      * of a service. This object acts like {@link 
ServiceReference#compareTo(Object)}.
-     * The comparator will return the services in the given order. In 
ascending order the 
-     * service with the lowest ranking comes first, in descending order the 
service with the 
-     * highest ranking comes first. The latter is useful if you want to have 
the service 
+     * The comparator will return the services in the given order. In 
ascending order the
+     * service with the lowest ranking comes first, in descending order the 
service with the
+     * highest ranking comes first. The latter is useful if you want to have 
the service
      * returned first which is also chosen by {@link 
BundleContext#getServiceReference(String)}.
      * @param props The service properties.
      * @param order The order (either ascending or descending).
@@ -73,16 +73,15 @@ public class ServiceUtil {
         public int compareTo(Object reference) {
             final Long otherId;
             Object otherRankObj;
-            if ( reference instanceof ServiceReference ) {
-                final ServiceReference other = (ServiceReference) reference;
+            if (reference instanceof ServiceReference<?> other) {
                 otherId = (Long) other.getProperty(Constants.SERVICE_ID);
                 otherRankObj = other.getProperty(Constants.SERVICE_RANKING);
-            } else if (reference instanceof Map){
-                final Map<String, Object> otherProps = (Map<String, 
Object>)reference;
+            } else if (reference instanceof Map) {
+                final Map<String, Object> otherProps = (Map<String, Object>) 
reference;
                 otherId = (Long) otherProps.get(Constants.SERVICE_ID);
                 otherRankObj = otherProps.get(Constants.SERVICE_RANKING);
             } else {
-                final ComparableImplementation other = 
(ComparableImplementation)reference;
+                final ComparableImplementation other = 
(ComparableImplementation) reference;
                 otherId = (Long) other.props.get(Constants.SERVICE_ID);
                 otherRankObj = other.props.get(Constants.SERVICE_RANKING);
             }
@@ -94,14 +93,12 @@ public class ServiceUtil {
             Object rankObj = props.get(Constants.SERVICE_RANKING);
 
             // If no rank, then spec says it defaults to zero.
-            rankObj = (rankObj == null) ? new Integer(0) : rankObj;
-            otherRankObj = (otherRankObj == null) ? new Integer(0) : 
otherRankObj;
+            rankObj = (rankObj == null) ? 0 : rankObj;
+            otherRankObj = (otherRankObj == null) ? 0 : otherRankObj;
 
             // If rank is not Integer, then spec says it defaults to zero.
-            Integer rank = (rankObj instanceof Integer)
-                ? (Integer) rankObj : new Integer(0);
-            Integer otherRank = (otherRankObj instanceof Integer)
-                ? (Integer) otherRankObj : new Integer(0);
+            Integer rank = (rankObj instanceof Integer rankObjInt) ? 
rankObjInt : 0;
+            Integer otherRank = (otherRankObj instanceof Integer 
otherRankObjInt) ? otherRankObjInt : 0;
 
             // Sort by rank.
             if (rank.compareTo(otherRank) < 0) {
@@ -116,8 +113,8 @@ public class ServiceUtil {
 
         @Override
         public boolean equals(Object obj) {
-            if ( obj instanceof ComparableImplementation ) {
-                return 
this.props.equals(((ComparableImplementation)obj).props);
+            if (obj instanceof ComparableImplementation comp) {
+                return this.props.equals(comp.props);
             }
             return false;
         }
diff --git 
a/src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java 
b/src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java
index 3d3eff1..ed33a05 100644
--- a/src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java
+++ b/src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java
@@ -31,8 +31,7 @@ import org.osgi.util.tracker.ServiceTracker;
  * Implementation providing a sorted list of services
  * by service ranking.
  */
-public class SortingServiceTracker<T>
-    extends ServiceTracker<T, T>  {
+public class SortingServiceTracker<T> extends ServiceTracker<T, T> {
 
     private int lastCount = -1;
 
@@ -47,8 +46,7 @@ public class SortingServiceTracker<T>
      * @param context Bundle context
      * @param clazz Class
      */
-    public SortingServiceTracker(final BundleContext context,
-            final String clazz) {
+    public SortingServiceTracker(final BundleContext context, final String 
clazz) {
         super(context, clazz, null);
     }
 
@@ -87,18 +85,17 @@ public class SortingServiceTracker<T>
      */
     public List<T> getSortedServices() {
         List<T> result = this.sortedServiceCache;
-        if ( result == null || this.lastCount < this.getTrackingCount() ) {
+        if (result == null || this.lastCount < this.getTrackingCount()) {
             this.lastCount = this.getTrackingCount();
             final ServiceReference<T>[] references = 
this.getServiceReferences();
-            if ( references == null || references.length == 0 ) {
+            if (references == null || references.length == 0) {
                 result = Collections.emptyList();
             } else {
                 Arrays.sort(references);
-                result = new ArrayList<T>();
-                for(int i=0;i<references.length;i++) {
-                    @SuppressWarnings("unchecked")
+                result = new ArrayList<>();
+                for (int i = 0; i < references.length; i++) {
                     final T service = 
this.getService(references[references.length - 1 - i]);
-                    if ( service != null ) {
+                    if (service != null) {
                         result.add(service);
                     }
                 }
@@ -114,15 +111,15 @@ public class SortingServiceTracker<T>
      */
     public List<ServiceReference<T>> getSortedServiceReferences() {
         List<ServiceReference<T>> result = this.sortedReferences;
-        if ( result == null || this.lastRefCount < this.getTrackingCount() ) {
+        if (result == null || this.lastRefCount < this.getTrackingCount()) {
             this.lastRefCount = this.getTrackingCount();
             final ServiceReference<T>[] references = 
this.getServiceReferences();
-            if ( references == null || references.length == 0 ) {
+            if (references == null || references.length == 0) {
                 result = Collections.emptyList();
             } else {
                 Arrays.sort(references);
-                result = new ArrayList<ServiceReference<T>>();
-                for(int i=0;i<references.length;i++) {
+                result = new ArrayList<>();
+                for (int i = 0; i < references.length; i++) {
                     result.add(references[references.length - 1 - i]);
                 }
             }
diff --git 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
index 930b17e..a50eb4b 100644
--- 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
+++ 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
@@ -27,21 +27,22 @@ public class BundleBundleVersionInfo extends 
BundleVersionInfo<Bundle> {
 
     private Bundle source;
     private final long lastModified;
-    
+
     public BundleBundleVersionInfo(Bundle b) {
         source = b;
-        
+
         long lastMod = BND_LAST_MODIFIED_MISSING;
-        final String mod = (String)source.getHeaders().get(BND_LAST_MODIFIED);
-        if(mod != null) {
+        final String mod = source.getHeaders().get(BND_LAST_MODIFIED);
+        if (mod != null) {
             try {
                 lastMod = Long.parseLong(mod);
-            } catch(NumberFormatException ignore) {
+            } catch (NumberFormatException ignore) {
+                // Intentionally empty
             }
         }
         lastModified = lastMod;
     }
-    
+
     public long getBundleLastModified() {
         return lastModified;
     }
@@ -55,7 +56,7 @@ public class BundleBundleVersionInfo extends 
BundleVersionInfo<Bundle> {
     }
 
     public Version getVersion() {
-        final String versionInfo = 
(String)source.getHeaders().get(Constants.BUNDLE_VERSION);
+        final String versionInfo = 
source.getHeaders().get(Constants.BUNDLE_VERSION);
         return (versionInfo == null ? null : new Version(versionInfo));
     }
 
diff --git 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionInfo.java
 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionInfo.java
index 106191e..cec1774 100644
--- 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionInfo.java
+++ 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionInfo.java
@@ -24,91 +24,89 @@ import org.osgi.framework.Version;
  *  extracted from bundle files or Bundle objects.
  */
 public abstract class BundleVersionInfo<T> implements 
Comparable<BundleVersionInfo<?>> {
-    
-    private static final int A_GREATER = 1; 
+
+    private static final int A_GREATER = 1;
     private static final int B_GREATER = -1;
     private static final int EQUAL = 0;
-    
+
     /** Marker used by Maven to identify snapshots */
     public static final String SNAPSHOT_MARKER = "SNAPSHOT";
-    
+
     /** Name of the BND attribute that provides the bundle's last modified 
timestamp */
     public static final String BND_LAST_MODIFIED = "Bnd-LastModified";
-    
+
     /** Value for {@link #getBundleLastModified} if corresponding header
      *  is not present
      */
     public static final long BND_LAST_MODIFIED_MISSING = -1L;
-    
+
     /** @return Return the source of information: underlying File or Bundle */
     public abstract T getSource();
-    
+
     /** @return True if the provided data is a valid bundle */
     public abstract boolean isBundle();
-    
+
     /** @return Return the bundle symbolic name, null if not available */
     public abstract String getBundleSymbolicName();
-    
+
     /** @return Return the bundle version, null if not available */
     public abstract Version getVersion();
-    
+
     /** @return True if the bundle version indicates a snapshot */
     public abstract boolean isSnapshot();
-    
-    /** Return the bundle last modification time, based on the 
BND_LAST_MODIFIED 
+
+    /** Return the bundle last modification time, based on the 
BND_LAST_MODIFIED
      *  manifest header, if available. This is *not* the 
Bundle.getLastModified()
      *  value, which refers to actions in the OSGi framework.
      *  @return BND_LAST_MODIFIED_MISSING if header not supplied */
     public abstract long getBundleLastModified();
-    
-    
+
     /** Compare based on bundle version info, and for snapshots
      *  based on {@link #getBundleLastModified}
      */
     public int compareTo(BundleVersionInfo<?> other) {
         // Handle null values
-        if(other == null) {
+        if (other == null) {
             throw new IllegalArgumentException("b is null, cannot compare");
         }
-        
+
         // Handle non-bundles: we don't want them!
-        if(!isBundle()) {
+        if (!isBundle()) {
             throw new IllegalArgumentException("Not a bundle, cannot compare: 
" + this);
         }
-        if(!other.isBundle()) {
+        if (!other.isBundle()) {
             throw new IllegalArgumentException("Not a bundle, cannot compare:" 
+ other);
         }
-        
+
         // First compare symbolic names
         int result = 
getBundleSymbolicName().compareTo(other.getBundleSymbolicName());
-        
+
         // Then compare versions
-        if(result == EQUAL) {
+        if (result == EQUAL) {
             final Version va = getVersion();
             final Version vb = other.getVersion();
-            if(va == null && vb == null) {
+            if (va == null && vb == null) {
                 // result = EQUAL
-            } else if(vb == null) {
+            } else if (vb == null) {
                 result = A_GREATER;
-            } else if(va == null) {
+            } else if (va == null) {
                 result = B_GREATER;
             } else {
                 result = va.compareTo(vb);
             }
         }
-        
+
         // Then, if snapshots, compare modification times, more recent comes 
first
-        if(result == EQUAL && isSnapshot()) {
+        if (result == EQUAL && isSnapshot()) {
             final long ma = getBundleLastModified();
             final long mb = other.getBundleLastModified();
-            if(ma > mb) {
+            if (ma > mb) {
                 result = A_GREATER;
-            } else if(mb > ma) {
+            } else if (mb > ma) {
                 result = B_GREATER;
             }
         }
-        
+
         return result;
     }
-
 }
diff --git 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java
 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java
index 119ae7c..500dab0 100644
--- 
a/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java
+++ 
b/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java
@@ -40,7 +40,7 @@ public class FileBundleVersionInfo extends 
BundleVersionInfo<File> {
         final JarFile f = new JarFile(bundle);
         try {
             final Manifest m = f.getManifest();
-            if(m == null) {
+            if (m == null) {
                 symbolicName = null;
                 version = null;
                 isSnapshot = false;
@@ -52,10 +52,10 @@ public class FileBundleVersionInfo extends 
BundleVersionInfo<File> {
                 isSnapshot = v != null && v.contains(SNAPSHOT_MARKER);
                 final String last = 
m.getMainAttributes().getValue(BND_LAST_MODIFIED);
                 long lastMod = BND_LAST_MODIFIED_MISSING;
-                if(last != null) {
+                if (last != null) {
                     try {
                         lastMod = Long.parseLong(last);
-                    } catch(NumberFormatException ignore) {
+                    } catch (NumberFormatException ignore) {
                     }
                 }
                 lastModified = lastMod;
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/BundleFileProcessorTest.java 
b/src/test/java/org/apache/sling/commons/osgi/BundleFileProcessorTest.java
index 09822b9..0602eba 100644
--- a/src/test/java/org/apache/sling/commons/osgi/BundleFileProcessorTest.java
+++ b/src/test/java/org/apache/sling/commons/osgi/BundleFileProcessorTest.java
@@ -18,10 +18,6 @@
  */
 package org.apache.sling.commons.osgi;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
 import java.io.File;
@@ -37,15 +33,19 @@ import java.util.jar.Manifest;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 public class BundleFileProcessorTest {
-    
+
     private static void closeQuietly(Closeable c) {
         try {
             c.close();
-        } catch(IOException ignore) {
+        } catch (IOException ignore) {
         }
     }
-    
+
     @Test
     public void testBSNRenaming() throws IOException {
         File tempDir = new File(System.getProperty("java.io.tmpdir"));
@@ -61,30 +61,32 @@ public class BundleFileProcessorTest {
             JarFile jfOrg = null;
             JarFile jfNew = null;
             try {
-                    jfOrg = new JarFile(originalFile);
-                    jfNew = new JarFile(generatedFile);
-                    Manifest mfOrg = jfOrg.getManifest();
-                    Manifest mfNew = jfNew.getManifest();
-
-                    Attributes orgAttrs = mfOrg.getMainAttributes();
-                    Attributes newAttrs = mfNew.getMainAttributes();
-                    for (Object key : orgAttrs.keySet()) {
-                        String orgVal = orgAttrs.getValue(key.toString());
-                        String newVal = newAttrs.getValue(key.toString());
-
-                        if ("Bundle-SymbolicName".equals(key.toString())) {
-                            assertEquals("Should have recorded the original 
Bundle-SymbolicName",
-                                    orgVal, 
newAttrs.getValue("X-Original-Bundle-SymbolicName"));
-
-                            assertEquals("org.acme.baklava.guava", newVal);
-                        } else {
-                            assertEquals("Different keys: " + key, orgVal, 
newVal);
-                        }
+                jfOrg = new JarFile(originalFile);
+                jfNew = new JarFile(generatedFile);
+                Manifest mfOrg = jfOrg.getManifest();
+                Manifest mfNew = jfNew.getManifest();
+
+                Attributes orgAttrs = mfOrg.getMainAttributes();
+                Attributes newAttrs = mfNew.getMainAttributes();
+                for (Object key : orgAttrs.keySet()) {
+                    String orgVal = orgAttrs.getValue(key.toString());
+                    String newVal = newAttrs.getValue(key.toString());
+
+                    if ("Bundle-SymbolicName".equals(key.toString())) {
+                        assertEquals(
+                                "Should have recorded the original 
Bundle-SymbolicName",
+                                orgVal,
+                                
newAttrs.getValue("X-Original-Bundle-SymbolicName"));
+
+                        assertEquals("org.acme.baklava.guava", newVal);
+                    } else {
+                        assertEquals("Different keys: " + key, orgVal, newVal);
                     }
-                } finally {
-                    closeQuietly(jfOrg);
-                    closeQuietly(jfNew);
                 }
+            } finally {
+                closeQuietly(jfOrg);
+                closeQuietly(jfNew);
+            }
 
         } finally {
             assertTrue("Unable to delete temporary file", 
generatedFile.delete());
@@ -99,13 +101,11 @@ public class BundleFileProcessorTest {
             jis2 = new JarInputStream(new FileInputStream(actualJar));
             JarEntry je1 = null;
             while ((je1 = jis1.getNextJarEntry()) != null) {
-                if (je1.isDirectory())
-                    continue;
+                if (je1.isDirectory()) continue;
 
                 JarEntry je2 = null;
-                while((je2 = jis2.getNextJarEntry()) != null) {
-                    if (!je2.isDirectory())
-                        break;
+                while ((je2 = jis2.getNextJarEntry()) != null) {
+                    if (!je2.isDirectory()) break;
                 }
 
                 assertEquals(je1.getName(), je2.getName());
@@ -127,7 +127,7 @@ public class BundleFileProcessorTest {
         }
     }
 
-    private static byte [] streamToByteArray(InputStream is) throws 
IOException {
+    private static byte[] streamToByteArray(InputStream is) throws IOException 
{
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BundleFileProcessor.pumpStream(is, baos);
         return baos.toByteArray();
@@ -138,16 +138,15 @@ public class BundleFileProcessorTest {
     }
 
     private static File getMavenRepoRoot() throws IOException {
-        URL res = BundleFileProcessorTest.class.getClassLoader().getResource(
-                Test.class.getName().replace('.', '/') + ".class");
+        URL res = BundleFileProcessorTest.class
+                .getClassLoader()
+                .getResource(Test.class.getName().replace('.', '/') + 
".class");
 
         String u = res.toExternalForm();
-        if (u.startsWith("jar:"))
-            u = u.substring(4);
+        if (u.startsWith("jar:")) u = u.substring(4);
 
         int idx = u.indexOf("junit");
-        if (idx < 0)
-            throw new IllegalStateException("Cannot infer maven repo root: " + 
res);
+        if (idx < 0) throw new IllegalStateException("Cannot infer maven repo 
root: " + res);
 
         return new File(new URL(u.substring(0, idx)).getFile());
     }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java 
b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
index f1b0d5b..626cdf2 100644
--- a/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
+++ b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
@@ -99,7 +99,8 @@ public class ManifestHeaderTest extends TestCase {
     }
 
     public void testQuoting2() {
-        String header = 
"CQ-INF/content/apps/xyz/docroot;overwrite:=true;path:=/apps/xyz/docroot;ignoreImportProviders:=\"json,xml\"";
+        String header =
+                
"CQ-INF/content/apps/xyz/docroot;overwrite:=true;path:=/apps/xyz/docroot;ignoreImportProviders:=\"json,xml\"";
         final ManifestHeader entry = ManifestHeader.parse(header);
         assertEquals(1, entry.getEntries().length);
         assertEquals("CQ-INF/content/apps/xyz/docroot", 
entry.getEntries()[0].getValue());
@@ -113,9 +114,9 @@ public class ManifestHeaderTest extends TestCase {
         assertEquals("json,xml", 
entry.getEntries()[0].getDirectives()[2].getValue());
     }
 
-
     public void testMultipleEntries() {
-        String header = 
"SLING-INF/content/etc;checkin:=true;path:=/etc,\nSLING-INF/content/libs;overwrite:=true;path:=/libs";
+        String header =
+                
"SLING-INF/content/etc;checkin:=true;path:=/etc,\nSLING-INF/content/libs;overwrite:=true;path:=/libs";
         final ManifestHeader entry = ManifestHeader.parse(header);
         assertEquals(2, entry.getEntries().length);
         assertEquals("SLING-INF/content/etc", 
entry.getEntries()[0].getValue());
diff --git a/src/test/java/org/apache/sling/commons/osgi/OsgiUtilTest.java 
b/src/test/java/org/apache/sling/commons/osgi/OsgiUtilTest.java
index a33e624..05c7adc 100644
--- a/src/test/java/org/apache/sling/commons/osgi/OsgiUtilTest.java
+++ b/src/test/java/org/apache/sling/commons/osgi/OsgiUtilTest.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 
 import junit.framework.TestCase;
-
 import org.osgi.framework.Constants;
 
 @SuppressWarnings("deprecation")
@@ -113,20 +112,20 @@ public class OsgiUtilTest extends TestCase {
     }
 
     private void equals(final String[] a, final String[] b) {
-        if ( a == null && b == null ) {
+        if (a == null && b == null) {
             return;
         }
-        if ( a == null ) {
+        if (a == null) {
             fail("Array is not null: " + b);
         }
-        if ( b == null ) {
+        if (b == null) {
             fail("Array is null, expected is: " + a);
         }
-        if ( a.length != b.length ) {
-            fail("Length differs: expect " + a .length + ", received " + 
b.length);
+        if (a.length != b.length) {
+            fail("Length differs: expect " + a.length + ", received " + 
b.length);
         }
-        for(int i=0; i < a.length; i++) {
-            if ( ! a[i].equals(b[i])) {
+        for (int i = 0; i < a.length; i++) {
+            if (!a[i].equals(b[i])) {
                 fail("Expected " + a[i] + " at index " + i + ", but is " + 
b[i]);
             }
         }
@@ -151,6 +150,8 @@ public class OsgiUtilTest extends TestCase {
         map1.put(Constants.SERVICE_RANKING, "hello");
         assertEquals(-1, 
OsgiUtil.getComparableForServiceRanking(map1).compareTo(map2));
         assertEquals(1, 
OsgiUtil.getComparableForServiceRanking(map2).compareTo(map1));
-        assertEquals(1, 
OsgiUtil.getComparableForServiceRanking(map2).compareTo(OsgiUtil.getComparableForServiceRanking(map1)));
+        assertEquals(
+                1,
+                
OsgiUtil.getComparableForServiceRanking(map2).compareTo(OsgiUtil.getComparableForServiceRanking(map1)));
     }
 }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/PropertiesUtilTest.java 
b/src/test/java/org/apache/sling/commons/osgi/PropertiesUtilTest.java
index 8c5c3d8..f37d50f 100644
--- a/src/test/java/org/apache/sling/commons/osgi/PropertiesUtilTest.java
+++ b/src/test/java/org/apache/sling/commons/osgi/PropertiesUtilTest.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.sling.commons.osgi;
 
 import java.util.LinkedHashMap;
@@ -24,29 +23,29 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
-public class PropertiesUtilTest extends TestCase{
+public class PropertiesUtilTest extends TestCase {
 
     public void testToMap() {
-        final String[] defaultValue = new String[] {"a1=b1","a2=b2"};
-        Map<String,String> expected = asMap("a1","b1","a2","b2");
-        assertEquals(expected,PropertiesUtil.toMap(new String[] 
{"a1=b1","a2=b2"},null));
-        assertEquals(null,PropertiesUtil.toMap(null,null));
-        assertEquals(expected,PropertiesUtil.toMap(null,defaultValue));
-
-        //Trimming
-        assertEquals(expected,PropertiesUtil.toMap(new String[] {"a1 = b1 "," 
a2 = b2 "},null));
-
-        //Malformed handling
-        assertEquals(expected,PropertiesUtil.toMap(new String[] {"a1 = b1 "," 
a2 = b2 ","a3"},null));
-        assertEquals(asMap("a1","b1","a2","b2","a4",null),
-                PropertiesUtil.toMap(new String[] {"a1 = b1 "," a2 = b2 
","a3","a4="},null));
+        final String[] defaultValue = new String[] {"a1=b1", "a2=b2"};
+        Map<String, String> expected = asMap("a1", "b1", "a2", "b2");
+        assertEquals(expected, PropertiesUtil.toMap(new String[] {"a1=b1", 
"a2=b2"}, null));
+        assertEquals(null, PropertiesUtil.toMap(null, null));
+        assertEquals(expected, PropertiesUtil.toMap(null, defaultValue));
+
+        // Trimming
+        assertEquals(expected, PropertiesUtil.toMap(new String[] {"a1 = b1 ", 
" a2 = b2 "}, null));
+
+        // Malformed handling
+        assertEquals(expected, PropertiesUtil.toMap(new String[] {"a1 = b1 ", 
" a2 = b2 ", "a3"}, null));
+        assertEquals(
+                asMap("a1", "b1", "a2", "b2", "a4", null),
+                PropertiesUtil.toMap(new String[] {"a1 = b1 ", " a2 = b2 ", 
"a3", "a4="}, null));
     }
 
-
-    private static Map<String,String> asMap(String ... entries){
-        Map<String,String> m = new LinkedHashMap<String, String>();
-        for(int i = 0; i < entries.length; i+=2){
-            m.put(entries[i],entries[i+1]);
+    private static Map<String, String> asMap(String... entries) {
+        Map<String, String> m = new LinkedHashMap<String, String>();
+        for (int i = 0; i < entries.length; i += 2) {
+            m.put(entries[i], entries[i + 1]);
         }
         return m;
     }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/RankedServicesTest.java 
b/src/test/java/org/apache/sling/commons/osgi/RankedServicesTest.java
index 22ad6e4..3b6055c 100644
--- a/src/test/java/org/apache/sling/commons/osgi/RankedServicesTest.java
+++ b/src/test/java/org/apache/sling/commons/osgi/RankedServicesTest.java
@@ -18,90 +18,93 @@
  */
 package org.apache.sling.commons.osgi;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
 import java.util.Map;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterators;
 import org.apache.sling.commons.osgi.RankedServices.ChangeListener;
 import org.junit.Test;
 import org.osgi.framework.Constants;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterators;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 public class RankedServicesTest {
 
-  private static final String SERVICE_1 = "service1";
-  private static final Map<String, Object> SERVICE_1_PROPS = 
ImmutableMap.<String, Object>builder()
-      .put(Constants.SERVICE_RANKING, 50).put(Constants.SERVICE_ID, 
1L).build();
-  private static final String SERVICE_2 = "service2";
-  private static final Map<String, Object> SERVICE_2_PROPS = 
ImmutableMap.<String, Object>builder()
-      .put(Constants.SERVICE_RANKING, 10).put(Constants.SERVICE_ID, 
2L).build();
-  private static final String SERVICE_3 = "service3";
-  private static final Map<String, Object> SERVICE_3_PROPS = 
ImmutableMap.<String, Object>builder()
-      .put(Constants.SERVICE_RANKING, 100).put(Constants.SERVICE_ID, 
3L).build();
-
-  @Test
-  public void testSortedServicesAscending() {
-    RankedServices<Comparable> underTest = new RankedServices<Comparable>();
-    assertEquals(0, underTest.get().size());
-
-    underTest.bind(SERVICE_1, SERVICE_1_PROPS);
-    assertEquals(1, underTest.get().size());
-    Comparable[] services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
-    assertSame(SERVICE_1, services[0]);
-
-    underTest.bind(SERVICE_2, SERVICE_2_PROPS);
-    underTest.bind(SERVICE_3, SERVICE_3_PROPS);
-    assertEquals(3, underTest.get().size());
-    services = Iterators.toArray(underTest.get().iterator(), Comparable.class);
-    assertSame(SERVICE_2, services[0]);
-    assertSame(SERVICE_1, services[1]);
-    assertSame(SERVICE_3, services[2]);
-
-    underTest.unbind(SERVICE_2, SERVICE_2_PROPS);
-    assertEquals(2, underTest.get().size());
-    services = Iterators.toArray(underTest.get().iterator(), Comparable.class);
-    assertSame(SERVICE_1, services[0]);
-    assertSame(SERVICE_3, services[1]);
-  }
-
-
-  @Test
-  public void testSortedServicesDescending() {
-    RankedServices<Comparable> underTest = new 
RankedServices<Comparable>(Order.DESCENDING);
-    assertEquals(0, underTest.get().size());
-
-    underTest.bind(SERVICE_1, SERVICE_1_PROPS);
-    assertEquals(1, underTest.get().size());
-    Comparable[] services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
-    assertSame(SERVICE_1, services[0]);
-
-    underTest.bind(SERVICE_2, SERVICE_2_PROPS);
-    underTest.bind(SERVICE_3, SERVICE_3_PROPS);
-    assertEquals(3, underTest.get().size());
-    services = Iterators.toArray(underTest.get().iterator(), Comparable.class);
-    assertSame(SERVICE_3, services[0]);
-    assertSame(SERVICE_1, services[1]);
-    assertSame(SERVICE_2, services[2]);
-
-    underTest.unbind(SERVICE_2, SERVICE_2_PROPS);
-    assertEquals(2, underTest.get().size());
-    services = Iterators.toArray(underTest.get().iterator(), Comparable.class);
-    assertSame(SERVICE_3, services[0]);
-    assertSame(SERVICE_1, services[1]);
-  }
-
-  @Test
-  public void testChangeListener() {
-    ChangeListener changeListener = mock(ChangeListener.class);
-
-    RankedServices<Comparable> underTest = new 
RankedServices<Comparable>(changeListener);
-    underTest.bind(SERVICE_1, SERVICE_1_PROPS);
-    verify(changeListener).changed();
-  }
-
+    private static final String SERVICE_1 = "service1";
+    private static final Map<String, Object> SERVICE_1_PROPS = 
ImmutableMap.<String, Object>builder()
+            .put(Constants.SERVICE_RANKING, 50)
+            .put(Constants.SERVICE_ID, 1L)
+            .build();
+    private static final String SERVICE_2 = "service2";
+    private static final Map<String, Object> SERVICE_2_PROPS = 
ImmutableMap.<String, Object>builder()
+            .put(Constants.SERVICE_RANKING, 10)
+            .put(Constants.SERVICE_ID, 2L)
+            .build();
+    private static final String SERVICE_3 = "service3";
+    private static final Map<String, Object> SERVICE_3_PROPS = 
ImmutableMap.<String, Object>builder()
+            .put(Constants.SERVICE_RANKING, 100)
+            .put(Constants.SERVICE_ID, 3L)
+            .build();
+
+    @Test
+    public void testSortedServicesAscending() {
+        RankedServices<Comparable> underTest = new 
RankedServices<Comparable>();
+        assertEquals(0, underTest.get().size());
+
+        underTest.bind(SERVICE_1, SERVICE_1_PROPS);
+        assertEquals(1, underTest.get().size());
+        Comparable[] services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_1, services[0]);
+
+        underTest.bind(SERVICE_2, SERVICE_2_PROPS);
+        underTest.bind(SERVICE_3, SERVICE_3_PROPS);
+        assertEquals(3, underTest.get().size());
+        services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_2, services[0]);
+        assertSame(SERVICE_1, services[1]);
+        assertSame(SERVICE_3, services[2]);
+
+        underTest.unbind(SERVICE_2, SERVICE_2_PROPS);
+        assertEquals(2, underTest.get().size());
+        services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_1, services[0]);
+        assertSame(SERVICE_3, services[1]);
+    }
+
+    @Test
+    public void testSortedServicesDescending() {
+        RankedServices<Comparable> underTest = new 
RankedServices<Comparable>(Order.DESCENDING);
+        assertEquals(0, underTest.get().size());
+
+        underTest.bind(SERVICE_1, SERVICE_1_PROPS);
+        assertEquals(1, underTest.get().size());
+        Comparable[] services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_1, services[0]);
+
+        underTest.bind(SERVICE_2, SERVICE_2_PROPS);
+        underTest.bind(SERVICE_3, SERVICE_3_PROPS);
+        assertEquals(3, underTest.get().size());
+        services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_3, services[0]);
+        assertSame(SERVICE_1, services[1]);
+        assertSame(SERVICE_2, services[2]);
+
+        underTest.unbind(SERVICE_2, SERVICE_2_PROPS);
+        assertEquals(2, underTest.get().size());
+        services = Iterators.toArray(underTest.get().iterator(), 
Comparable.class);
+        assertSame(SERVICE_3, services[0]);
+        assertSame(SERVICE_1, services[1]);
+    }
+
+    @Test
+    public void testChangeListener() {
+        ChangeListener changeListener = mock(ChangeListener.class);
+
+        RankedServices<Comparable> underTest = new 
RankedServices<Comparable>(changeListener);
+        underTest.bind(SERVICE_1, SERVICE_1_PROPS);
+        verify(changeListener).changed();
+    }
 }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
index 4240695..ac8286f 100644
--- 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
+++ 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
@@ -18,10 +18,6 @@
  */
 package org.apache.sling.commons.osgi.bundleversion;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -34,6 +30,10 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 /** Test the BundleBundleVersionInfo class - not extremely
  *  valid is we're testing with mock Bundles, but should
  *  at least catch regressions.
@@ -49,19 +49,21 @@ public class BundleBundleVersionInfoTest {
     private Bundle getMockBundle(final String symbolicName, final Version v, 
final long lastModified) {
         final Dictionary<String, Object> h = new Hashtable<String, Object>();
         h.put(Constants.BUNDLE_VERSION, v.toString());
-        if(lastModified > 0) {
+        if (lastModified > 0) {
             h.put(BundleVersionInfo.BND_LAST_MODIFIED, 
String.valueOf(lastModified));
         }
 
         final Bundle b = context.mock(Bundle.class);
-        context.checking(new Expectations() {{
-            allowing(b).getHeaders();
-            will(returnValue(h));
-            allowing(b).getSymbolicName();
-            will(returnValue(symbolicName));
-            allowing(b).getLastModified();
-            will(returnValue(lastModified));
-        }});
+        context.checking(new Expectations() {
+            {
+                allowing(b).getHeaders();
+                will(returnValue(h));
+                allowing(b).getSymbolicName();
+                will(returnValue(symbolicName));
+                allowing(b).getLastModified();
+                will(returnValue(lastModified));
+            }
+        });
         return b;
     }
 
@@ -95,5 +97,5 @@ public class BundleBundleVersionInfoTest {
         assertTrue("Bundle is a snapshot", vi.isSnapshot());
         assertEquals("Last-Modified matches", 
BundleVersionInfo.BND_LAST_MODIFIED_MISSING, vi.getBundleLastModified());
         assertTrue("Bundle is stored as source", vi.getSource() == b);
-   }
-}
\ No newline at end of file
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionComparisonTest.java
 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionComparisonTest.java
index 37da592..75996a9 100644
--- 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionComparisonTest.java
+++ 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleVersionComparisonTest.java
@@ -18,18 +18,18 @@
  */
 package org.apache.sling.commons.osgi.bundleversion;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
 public class BundleVersionComparisonTest {
-    
+
     @Test
     public void testSimpleCompare() {
         // We want more recent bundles to be "greater" than older ones
@@ -44,72 +44,74 @@ public class BundleVersionComparisonTest {
             assertEquals("SNAPSHOT a is more recent than b", 1, 
a.compareTo(b));
         }
     }
-    
+
     @Test
     public void testSortBundles() {
         // The comparator sorts bundles in ascending order
         // of their symbolic names and versions
-        final MockBundleVersionInfo [] sorted = {
-                new MockBundleVersionInfo("a.name", "1.0", 1),
-                new MockBundleVersionInfo("a.name", "1.1", 1),
-                new MockBundleVersionInfo("b", "0.8.1", 1),
-                new MockBundleVersionInfo("b", "0.9", 1),
-                new MockBundleVersionInfo("b", "1.0", 1),
-                new MockBundleVersionInfo("b", "1.0.1.SNAPSHOT", 1),
-                new MockBundleVersionInfo("b", "1.0.1.SNAPSHOT", 2),
-                new MockBundleVersionInfo("b", "1.1", 1),
-                new MockBundleVersionInfo("b", "1.2.0.SNAPSHOT", 1),
-                new MockBundleVersionInfo("b", "1.2.0.SNAPSHOT", 2),
+        final MockBundleVersionInfo[] sorted = {
+            new MockBundleVersionInfo("a.name", "1.0", 1),
+            new MockBundleVersionInfo("a.name", "1.1", 1),
+            new MockBundleVersionInfo("b", "0.8.1", 1),
+            new MockBundleVersionInfo("b", "0.9", 1),
+            new MockBundleVersionInfo("b", "1.0", 1),
+            new MockBundleVersionInfo("b", "1.0.1.SNAPSHOT", 1),
+            new MockBundleVersionInfo("b", "1.0.1.SNAPSHOT", 2),
+            new MockBundleVersionInfo("b", "1.1", 1),
+            new MockBundleVersionInfo("b", "1.2.0.SNAPSHOT", 1),
+            new MockBundleVersionInfo("b", "1.2.0.SNAPSHOT", 2),
         };
-        
+
         final List<BundleVersionInfo<?>> list = new 
ArrayList<BundleVersionInfo<?>>();
-        for(int i = sorted.length - 1 ; i >= 0; i--) {
+        for (int i = sorted.length - 1; i >= 0; i--) {
             list.add(sorted[i]);
         }
-        
+
         final String firstBeforeSort = list.get(0).toString();
         Collections.sort(list);
         final String newFirstItem = list.get(0).toString();
-        assertFalse("First item (" + newFirstItem + ") must have changed 
during sort", firstBeforeSort.equals(newFirstItem));
-        
+        assertFalse(
+                "First item (" + newFirstItem + ") must have changed during 
sort",
+                firstBeforeSort.equals(newFirstItem));
+
         int i = 0;
-        for(BundleVersionInfo<?> vi : list) {
+        for (BundleVersionInfo<?> vi : list) {
             assertEquals("Item sorted as expected at index " + i, 
sorted[i].toString(), vi.toString());
             i++;
         }
     }
-    
+
     @Test
     public void testEqual() {
         final MockBundleVersionInfo a = new MockBundleVersionInfo("a", "1.0", 
2);
         final MockBundleVersionInfo b = new MockBundleVersionInfo("a", "1.0", 
1);
         assertEquals("Last-modified must not be relevant for non-snapshot 
bundles", 0, a.compareTo(b));
     }
-    
+
     public void testExceptionsOnNull() {
         final MockBundleVersionInfo a = new MockBundleVersionInfo("a", "1.0", 
2);
-        
+
         try {
             a.compareTo(null);
             fail("Expected an IllegalArgumentException");
-        } catch(IllegalArgumentException asExpected) {
+        } catch (IllegalArgumentException asExpected) {
         }
     }
-    
+
     public void testExceptionOnNonBundle() {
         final MockBundleVersionInfo a = new MockBundleVersionInfo("a", "1.0", 
2);
         final MockBundleVersionInfo nonBundle = new MockBundleVersionInfo();
-        
+
         try {
             a.compareTo(nonBundle);
             fail("Expected an IllegalArgumentException");
-        } catch(IllegalArgumentException asExpected) {
+        } catch (IllegalArgumentException asExpected) {
         }
-        
+
         try {
             nonBundle.compareTo(a);
             fail("Expected an IllegalArgumentException");
-        } catch(IllegalArgumentException asExpected) {
+        } catch (IllegalArgumentException asExpected) {
         }
     }
 }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfoTest.java
 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfoTest.java
index 9f8ea09..bc2d26c 100644
--- 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfoTest.java
+++ 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfoTest.java
@@ -18,27 +18,27 @@
  */
 package org.apache.sling.commons.osgi.bundleversion;
 
-import static org.junit.Assert.*;
-
 import java.io.File;
 import java.io.IOException;
 
 import org.junit.Test;
 import org.osgi.framework.Version;
 
+import static org.junit.Assert.*;
+
 public class FileBundleVersionInfoTest {
-    
+
     private File getTestJar(String namePrefix) {
         final File testJarsFolder = new 
File(System.getProperty("test.jars.folder"));
-        for(String jar : testJarsFolder.list()) {
-            if(jar.startsWith(namePrefix)) {
+        for (String jar : testJarsFolder.list()) {
+            if (jar.startsWith(namePrefix)) {
                 return new File(testJarsFolder, jar);
             }
         }
         fail("No test jar found with prefix " + namePrefix + " in " + 
testJarsFolder.getAbsolutePath());
         return null;
     }
-    
+
     @Test
     public void testSlingApiJar() throws IOException {
         final File testJar = getTestJar("org.apache.sling.api");
@@ -50,9 +50,9 @@ public class FileBundleVersionInfoTest {
         assertTrue(vi.isBundle());
         final Object src = vi.getSource();
         assertTrue(src instanceof File);
-        assertEquals(testJar.getAbsolutePath(), ((File)src).getAbsolutePath());
+        assertEquals(testJar.getAbsolutePath(), ((File) 
src).getAbsolutePath());
     }
-    
+
     @Test
     public void testSlf4jJar() throws IOException {
         final File testJar = getTestJar("jcr");
@@ -63,6 +63,6 @@ public class FileBundleVersionInfoTest {
         assertEquals(BundleVersionInfo.BND_LAST_MODIFIED_MISSING, 
vi.getBundleLastModified());
         final Object src = vi.getSource();
         assertTrue(src instanceof File);
-        assertEquals(testJar.getAbsolutePath(), ((File)src).getAbsolutePath());
+        assertEquals(testJar.getAbsolutePath(), ((File) 
src).getAbsolutePath());
     }
 }
diff --git 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/MockBundleVersionInfo.java
 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/MockBundleVersionInfo.java
index a31a3b3..7fd4de5 100644
--- 
a/src/test/java/org/apache/sling/commons/osgi/bundleversion/MockBundleVersionInfo.java
+++ 
b/src/test/java/org/apache/sling/commons/osgi/bundleversion/MockBundleVersionInfo.java
@@ -26,26 +26,26 @@ class MockBundleVersionInfo extends 
BundleVersionInfo<String> {
     private final String symbolicName;
     private final Version version;
     private final long lastModified;
-    
+
     MockBundleVersionInfo() {
         source = null;
         symbolicName = null;
         version = null;
         lastModified = BundleVersionInfo.BND_LAST_MODIFIED_MISSING;
     }
-    
+
     MockBundleVersionInfo(String symbolicName, String version, long 
lastModified) {
         this.symbolicName = symbolicName;
         this.version = new Version(version);
         this.source = symbolicName + "." + version + "." + lastModified;
         this.lastModified = lastModified;
     }
-    
+
     @Override
     public String toString() {
         return source;
     }
-    
+
     public long getBundleLastModified() {
         return lastModified;
     }

Reply via email to