FELIX-4060 : Make sure all projects work with Java 6, except the Jetty one

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1685041 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/api/pom.xml b/http/api/pom.xml
index 01ea61f..962a7c7 100644
--- a/http/api/pom.xml
+++ b/http/api/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/base/pom.xml b/http/base/pom.xml
index b579905..61c8df8 100644
--- a/http/base/pom.xml
+++ b/http/base/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/EventListenerRegistry.java b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/EventListenerRegistry.java
index ea28874..825ac44 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/EventListenerRegistry.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/EventListenerRegistry.java
@@ -72,7 +72,7 @@
     /** Request attribute listeners. */
     private final ListenerMap<ServletRequestAttributeListener> requestAttributeListeners = new ListenerMap<ServletRequestAttributeListener>();
 
-    public synchronized void cleanup()
+    public void cleanup()
     {
         this.contextListeners.cleanup();
         this.contextAttributeListeners.cleanup();
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ListenerMap.java b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ListenerMap.java
index d438ba3..a434f92 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ListenerMap.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ListenerMap.java
@@ -75,7 +75,7 @@
         }
     }
 
-    public void cleanup()
+    public synchronized void cleanup()
     {
         this.handlers = Collections.emptyList();
     }
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
index d94ac38..a4c1a33 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
@@ -105,16 +105,16 @@
     @Override
     public int compareTo(@Nonnull final PerContextHandlerRegistry other)
     {
-        final int result = Integer.compare(other.path.length(), this.path.length());
+        final int result = new Integer(other.path.length()).compareTo(this.path.length());
         if ( result == 0 ) {
             if (this.ranking == other.ranking)
             {
                 // Service id's can be negative. Negative id's follow the reverse natural ordering of integers.
                 int reverseOrder = ( this.serviceId <= 0 && other.serviceId <= 0 ) ? -1 : 1;
-                return reverseOrder * Long.compare(this.serviceId, other.serviceId);
+                return reverseOrder * new Long(this.serviceId).compareTo(other.serviceId);
             }
 
-            return Integer.compare(other.ranking, this.ranking);
+            return new Integer(other.ranking).compareTo(this.ranking);
         }
         return result;
     }
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ServletRegistry.java b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ServletRegistry.java
index d13878b..ac59dfe 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ServletRegistry.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/registry/ServletRegistry.java
@@ -101,7 +101,7 @@
      *
      * @param handler The servlet handler
      */
-    public void addServlet(@Nonnull final ServletHandler handler)
+    public synchronized void addServlet(@Nonnull final ServletHandler handler)
     {
         // we have to check for every pattern in the info
         // Can be null in case of error-handling servlets...
@@ -196,7 +196,7 @@
         }
     }
 
-    private synchronized void removeFromNameMapping(final String servletName, final ServletHandler handler)
+    private void removeFromNameMapping(final String servletName, final ServletHandler handler)
     {
         if ( !handler.getServletInfo().isResource() )
         {
@@ -269,23 +269,21 @@
                             final ServletHandler h = inactiveList.remove(0);
                             boolean activate = h.getServlet() == null;
                             final RegistrationStatus oldStatus = newMap.get(h.getServletInfo());
-                            final RegistrationStatus newOldStatus = new RegistrationStatus();
-                            newOldStatus.handler = oldStatus.handler;
-                            newOldStatus.statusToPath = new HashMap<Integer, String[]>(oldStatus.statusToPath);
-                            newMap.put(h.getServletInfo(), newOldStatus);
-                            removePattern(newOldStatus, DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, pattern);
-                            done = this.tryToActivate(resolvers, pattern, h, newOldStatus, regHandler);
+                            if ( oldStatus != null ) {
+                                final RegistrationStatus newOldStatus = new RegistrationStatus();
+                                newOldStatus.handler = oldStatus.handler;
+                                newOldStatus.statusToPath = new HashMap<Integer, String[]>(oldStatus.statusToPath);
+                                removePattern(newOldStatus, DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, pattern);
+                                newMap.put(h.getServletInfo(), newOldStatus);
+                                done = this.tryToActivate(resolvers, pattern, h, newOldStatus, regHandler);
+                                if ( done && activate ) {
+                                    this.addToNameMapping(h);
+                                }
+                            }
                             if ( !done )
                             {
                                 done = inactiveList.isEmpty();
                             }
-                            else
-                            {
-                                if ( activate )
-                                {
-                                    this.addToNameMapping(h);
-                                }
-                            }
                         }
                         if ( inactiveList.isEmpty() )
                         {
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/AbstractInfo.java b/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/AbstractInfo.java
index fa9e829..fd0a944 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/AbstractInfo.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/AbstractInfo.java
@@ -84,10 +84,10 @@
         {
             // Service id's can be negative. Negative id's follow the reverse natural ordering of integers.
             int reverseOrder = ( this.serviceId >= 0 && other.serviceId >= 0 ) ? 1 : -1;
-            return reverseOrder * Long.compare(this.serviceId, other.serviceId);
+            return reverseOrder * new Long(this.serviceId).compareTo(other.serviceId);
         }
 
-        return Integer.compare(other.ranking, this.ranking);
+        return new Integer(other.ranking).compareTo(this.ranking);
     }
 
     protected boolean isEmpty(final String value)
diff --git a/http/bridge/pom.xml b/http/bridge/pom.xml
index 11721c2..c25afde 100644
--- a/http/bridge/pom.xml
+++ b/http/bridge/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/bundle/pom.xml b/http/bundle/pom.xml
index e73b008..4c93b71 100644
--- a/http/bundle/pom.xml
+++ b/http/bundle/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/cometd/pom.xml b/http/cometd/pom.xml
index 9cb6b19..c806924 100644
--- a/http/cometd/pom.xml
+++ b/http/cometd/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/itest/pom.xml b/http/itest/pom.xml
index 77f630d..4ca6b87 100644
--- a/http/itest/pom.xml
+++ b/http/itest/pom.xml
@@ -15,7 +15,7 @@
 	<parent>
 		<groupId>org.apache.felix</groupId>
 		<artifactId>org.apache.felix.http.parent</artifactId>
-		<version>6</version>
+		<version>7-SNAPSHOT</version>
 		<relativePath>../parent/pom.xml</relativePath>
 	</parent>
 
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 4599fa0..9798462 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/parent/pom.xml b/http/parent/pom.xml
index 79636d0..c6ed0db 100755
--- a/http/parent/pom.xml
+++ b/http/parent/pom.xml
@@ -103,6 +103,25 @@
                     <compilerVersion>1.${http.java.version}</compilerVersion>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>animal-sniffer-maven-plugin</artifactId>
+                <configuration>
+                    <signature>
+                        <groupId>org.codehaus.mojo.signature</groupId>
+                        <artifactId>java1${http.java.version}</artifactId>
+                        <version>1.0</version>
+                    </signature>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
         <pluginManagement>
             <plugins>
@@ -132,7 +151,12 @@
                             <Bundle-RequiredExecutionEnvironment>${http.bree}</Bundle-RequiredExecutionEnvironment>
                         </instructions>                        
                     </configuration>
-                 </plugin>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>animal-sniffer-maven-plugin</artifactId>
+                    <version>1.14</version>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>
diff --git a/http/proxy/pom.xml b/http/proxy/pom.xml
index 2363453..ea74712 100644
--- a/http/proxy/pom.xml
+++ b/http/proxy/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/samples/bridge/pom.xml b/http/samples/bridge/pom.xml
index ed98c3f..85ed8a2 100644
--- a/http/samples/bridge/pom.xml
+++ b/http/samples/bridge/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
@@ -124,7 +124,7 @@
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>org.apache.felix.http.proxy</artifactId>
-            <version>[2.3,2.4)</version>
+            <version>2.3.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
diff --git a/http/samples/cometd/pom.xml b/http/samples/cometd/pom.xml
index fedc9a0..ec8b233 100644
--- a/http/samples/cometd/pom.xml
+++ b/http/samples/cometd/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/samples/filter/pom.xml b/http/samples/filter/pom.xml
index 65693c1..bbdbc87 100644
--- a/http/samples/filter/pom.xml
+++ b/http/samples/filter/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/samples/whiteboard/pom.xml b/http/samples/whiteboard/pom.xml
index 05892c6..38e4c09 100644
--- a/http/samples/whiteboard/pom.xml
+++ b/http/samples/whiteboard/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/servlet-api/pom.xml b/http/servlet-api/pom.xml
index bd055af..4ce8527 100644
--- a/http/servlet-api/pom.xml
+++ b/http/servlet-api/pom.xml
@@ -14,7 +14,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/sslfilter/pom.xml b/http/sslfilter/pom.xml
index 88dca46..ee9bdbf 100644
--- a/http/sslfilter/pom.xml
+++ b/http/sslfilter/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
diff --git a/http/whiteboard/pom.xml b/http/whiteboard/pom.xml
index 9a2b49c..2a8d92f 100644
--- a/http/whiteboard/pom.xml
+++ b/http/whiteboard/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>