tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1380386 - in /tomcat/trunk/java/org/apache/naming: ./ factory/webservices/ resources/
Date Mon, 03 Sep 2012 22:21:31 GMT
Author: markt
Date: Mon Sep  3 22:21:30 2012
New Revision: 1380386

URL: http://svn.apache.org/viewvc?rev=1380386&view=rev
Log:
Clean-up
- Java 7 <>

Modified:
    tomcat/trunk/java/org/apache/naming/ContextAccessController.java
    tomcat/trunk/java/org/apache/naming/ContextBindings.java
    tomcat/trunk/java/org/apache/naming/NamingContext.java
    tomcat/trunk/java/org/apache/naming/ServiceRef.java
    tomcat/trunk/java/org/apache/naming/StringManager.java
    tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java
    tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceRefFactory.java
    tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
    tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
    tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java
    tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java
    tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java
    tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java

Modified: tomcat/trunk/java/org/apache/naming/ContextAccessController.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ContextAccessController.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ContextAccessController.java (original)
+++ tomcat/trunk/java/org/apache/naming/ContextAccessController.java Mon Sep  3 22:21:30 2012
@@ -37,14 +37,14 @@ public class ContextAccessController {
      * Catalina context names on which writing is not allowed.
      */
     private static final Hashtable<Object,Object> readOnlyContexts =
-        new Hashtable<Object,Object>();
+            new Hashtable<>();
 
 
     /**
      * Security tokens repository.
      */
     private static final Hashtable<Object,Object> securityTokens =
-        new Hashtable<Object,Object>();
+            new Hashtable<>();
 
 
     // --------------------------------------------------------- Public Methods

Modified: tomcat/trunk/java/org/apache/naming/ContextBindings.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ContextBindings.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ContextBindings.java (original)
+++ tomcat/trunk/java/org/apache/naming/ContextBindings.java Mon Sep  3 22:21:30 2012
@@ -44,35 +44,35 @@ public class ContextBindings {
      * Bindings name - naming context. Keyed by name.
      */
     private static final Hashtable<Object,Context> contextNameBindings =
-        new Hashtable<Object,Context>();
+            new Hashtable<>();
 
 
     /**
      * Bindings thread - naming context. Keyed by thread id.
      */
     private static final Hashtable<Thread,Context> threadBindings =
-        new Hashtable<Thread,Context>();
+            new Hashtable<>();
 
 
     /**
      * Bindings thread - name. Keyed by thread id.
      */
     private static final Hashtable<Thread,Object> threadNameBindings =
-        new Hashtable<Thread,Object>();
+            new Hashtable<>();
 
 
     /**
      * Bindings class loader - naming context. Keyed by CL id.
      */
     private static final Hashtable<ClassLoader,Context> clBindings =
-        new Hashtable<ClassLoader,Context>();
+            new Hashtable<>();
 
 
     /**
      * Bindings class loader - name. Keyed by CL id.
      */
     private static final Hashtable<ClassLoader,Object> clNameBindings =
-        new Hashtable<ClassLoader,Object>();
+            new Hashtable<>();
 
 
     /**

Modified: tomcat/trunk/java/org/apache/naming/NamingContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContext.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContext.java Mon Sep  3 22:21:30 2012
@@ -70,8 +70,8 @@ public class NamingContext implements Co
      */
     public NamingContext(Hashtable<String,Object> env, String name)
         throws NamingException {
-        this.bindings = new HashMap<String,NamingEntry>();
-        this.env = new Hashtable<String,Object>();
+        this.bindings = new HashMap<>();
+        this.env = new Hashtable<>();
         // FIXME ? Could be put in the environment ?
         this.name = name;
         // Populating the environment hashtable

Modified: tomcat/trunk/java/org/apache/naming/ServiceRef.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ServiceRef.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ServiceRef.java (original)
+++ tomcat/trunk/java/org/apache/naming/ServiceRef.java Mon Sep  3 22:21:30 2012
@@ -86,7 +86,7 @@ public class ServiceRef extends Referenc
      * The vector to save the handler Reference objects, because they can't be
      * saved in the addrs vector.
      */
-    private final Vector<HandlerRef> handlers = new Vector<HandlerRef>();
+    private final Vector<HandlerRef> handlers = new Vector<>();
 
 
     // ----------------------------------------------------------- Constructors

Modified: tomcat/trunk/java/org/apache/naming/StringManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/StringManager.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/naming/StringManager.java Mon Sep  3 22:21:30 2012
@@ -154,7 +154,7 @@ public class StringManager {
     // --------------------------------------------------------------
 
     private static final Hashtable<String, StringManager> managers =
-        new Hashtable<String, StringManager>();
+            new Hashtable<>();
 
     /**
      * Get the StringManager for a particular package. If a manager for

Modified: tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java Mon Sep  3 22:21:30
2012
@@ -97,7 +97,6 @@ public class ServiceProxy implements Inv
      * @return Returns the correct Port
      * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL).
      */
-    @SuppressWarnings("unchecked")
     private Object getProxyPortQNameClass(Object[] args)
     throws ServiceException {
         QName name = (QName) args[0];

Modified: tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceRefFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceRefFactory.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceRefFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceRefFactory.java Mon Sep
 3 22:21:30 2012
@@ -92,8 +92,7 @@ public class ServiceRefFactory implement
                 wsdlRefAddr = (String) tmp.getContent();
 
             // PortComponent
-            Hashtable<String,QName> portComponentRef =
-                new Hashtable<String,QName>();
+            Hashtable<String,QName> portComponentRef = new Hashtable<>();
 
             // Create QName object
             QName serviceQname = null;
@@ -177,7 +176,6 @@ public class ServiceRefFactory implement
                     Definition def = reader.readWSDL((new URL(wsdlRefAddr)).toExternalForm());
 
                     javax.wsdl.Service wsdlservice = def.getService(serviceQname);
-                    @SuppressWarnings("unchecked") // Can't change the API
                     Map<String,?> ports = wsdlservice.getPorts();
                     Method m = serviceInterfaceClass.getMethod("setEndpointAddress",
                             new Class[] { java.lang.String.class,
@@ -244,7 +242,7 @@ public class ServiceRefFactory implement
             if (((ServiceRef) ref).getHandlersSize() > 0) {
 
                 HandlerRegistry handlerRegistry = service.getHandlerRegistry();
-                ArrayList<String> soaproles = new ArrayList<String>();
+                ArrayList<String> soaproles = new ArrayList<>();
 
                 while (((ServiceRef) ref).getHandlersSize() > 0) {
                     HandlerRef handlerRef = ((ServiceRef) ref).getHandler();
@@ -263,9 +261,9 @@ public class ServiceRefFactory implement
 
                     // Load all datas relative to the handler : SOAPHeaders, config init
element,
                     // portNames to be set on
-                    ArrayList<QName> headers = new ArrayList<QName>();
-                    Hashtable<String,String> config = new Hashtable<String,String>();
-                    ArrayList<String> portNames = new ArrayList<String>();
+                    ArrayList<QName> headers = new ArrayList<>();
+                    Hashtable<String,String> config = new Hashtable<>();
+                    ArrayList<String> portNames = new ArrayList<>();
                     for (int i = 0; i < handlerRef.size(); i++)
                         if (HandlerRef.HANDLER_LOCALPART.equals(handlerRef.get(i).getType()))
{
                             String localpart = "";
@@ -329,7 +327,6 @@ public class ServiceRefFactory implement
      */
     private String getSOAPLocation(Port port) {
         String endpoint = null;
-        @SuppressWarnings("unchecked") // Can't change the API
         List<ExtensibilityElement> extensions = port.getExtensibilityElements();
         for (Iterator<ExtensibilityElement> i = extensions.iterator();
                 i.hasNext();) {
@@ -346,7 +343,6 @@ public class ServiceRefFactory implement
     private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry,
             HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) {
         HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName);
-        @SuppressWarnings("unchecked") // Can't change the API
         Iterator<Handler> iter = handlerChain.iterator();
         while (iter.hasNext()) {
             Handler handler = iter.next();

Modified: tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java Mon Sep  3 22:21:30
2012
@@ -70,7 +70,7 @@ public abstract class BaseDirContext imp
      * Builds a base directory context.
      */
     public BaseDirContext() {
-        this.env = new Hashtable<String,Object>();
+        this.env = new Hashtable<>();
     }
 
 
@@ -130,8 +130,7 @@ public abstract class BaseDirContext imp
     /**
      * Aliases allow content to be included from other locations.
      */
-    protected final Map<String,BaseDirContext> aliases =
-        new HashMap<String,BaseDirContext>();
+    protected final Map<String,BaseDirContext> aliases = new HashMap<>();
 
 
     /**
@@ -139,7 +138,7 @@ public abstract class BaseDirContext imp
      * searched in the order they are added if the requested resource cannot be
      * found in the primary DirContext.
      */
-    protected final List<DirContext> altDirContexts = new ArrayList<DirContext>();
+    protected final List<DirContext> altDirContexts = new ArrayList<>();
 
 
     // ------------------------------------------------------------- Properties

Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Mon Sep  3
22:21:30 2012
@@ -270,7 +270,7 @@ public class DirContextURLConnection ext
           return (Collections.emptyMap());
 
       HashMap<String,List<String>> headerFields =
-          new HashMap<String,List<String>>(attributes.size());
+              new HashMap<>(attributes.size());
       NamingEnumeration<String> attributeEnum = attributes.getIDs();
       try {
           while (attributeEnum.hasMore()) {
@@ -278,7 +278,7 @@ public class DirContextURLConnection ext
               Attribute attribute = attributes.get(attributeID);
               if (attribute == null) continue;
               ArrayList<String> attributeValueList =
-                  new ArrayList<String>(attribute.size());
+                      new ArrayList<>(attribute.size());
               NamingEnumeration<?> attributeValues = attribute.getAll();
               while (attributeValues.hasMore()) {
                   Object attrValue = attributeValues.next();
@@ -360,7 +360,6 @@ public class DirContextURLConnection ext
     /**
      * Get object content.
      */
-    @SuppressWarnings("rawtypes") // overridden method uses raw type Class[]
     @Override
     public Object getContent(Class[] classes)
         throws IOException {
@@ -434,7 +433,7 @@ public class DirContextURLConnection ext
                     getURL() == null ? "null" : getURL().toString());
         }
 
-        Vector<String> result = new Vector<String>();
+        Vector<String> result = new Vector<>();
 
         if (collection != null) {
             try {

Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java Mon Sep
 3 22:21:30 2012
@@ -53,14 +53,14 @@ public class DirContextURLStreamHandler 
      * Bindings class loader - directory context. Keyed by CL id.
      */
     private static final Hashtable<ClassLoader,DirContext> clBindings =
-        new Hashtable<ClassLoader,DirContext>();
+            new Hashtable<>();
 
 
     /**
      * Bindings thread - directory context. Keyed by thread id.
      */
     private static final Hashtable<Thread,DirContext> threadBindings =
-        new Hashtable<Thread,DirContext>();
+            new Hashtable<>();
 
 
     // ----------------------------------------------------- Instance Variables

Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java Mon
Sep  3 22:21:30 2012
@@ -45,7 +45,7 @@ public class DirContextURLStreamHandlerF
 
 
     private final List<URLStreamHandlerFactory> userFactories =
-        new CopyOnWriteArrayList<URLStreamHandlerFactory>();
+            new CopyOnWriteArrayList<>();
 
     private DirContextURLStreamHandlerFactory() {
         // Hide the default constructor

Modified: tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java Mon Sep  3 22:21:30
2012
@@ -851,7 +851,7 @@ public class FileDirContext extends Base
      */
     protected List<NamingEntry> list(File file) {
 
-        List<NamingEntry> entries = new ArrayList<NamingEntry>();
+        List<NamingEntry> entries = new ArrayList<>();
         if (!file.isDirectory())
             return entries;
         String[] names = file.list();

Modified: tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java Mon Sep  3 22:21:30
2012
@@ -821,7 +821,7 @@ public class ResourceAttributes implemen
     @Override
     public NamingEnumeration<? extends Attribute> getAll() {
         if (attributes == null) {
-            Vector<BasicAttribute> attributes = new Vector<BasicAttribute>();
+            Vector<BasicAttribute> attributes = new Vector<>();
             Date creationDate = getCreationDate();
             if (creationDate != null) {
                 attributes.addElement(new BasicAttribute
@@ -856,7 +856,7 @@ public class ResourceAttributes implemen
                 attributes.addElement(new BasicAttribute(ETAG, etag));
                 attributes.addElement(new BasicAttribute(ALTERNATE_ETAG, etag));
             }
-            return new RecyclableNamingEnumeration<BasicAttribute>(attributes);
+            return new RecyclableNamingEnumeration<>(attributes);
         } else {
             return attributes.getAll();
         }
@@ -869,7 +869,7 @@ public class ResourceAttributes implemen
     @Override
     public NamingEnumeration<String> getIDs() {
         if (attributes == null) {
-            Vector<String> attributeIDs = new Vector<String>();
+            Vector<String> attributeIDs = new Vector<>();
             Date creationDate = getCreationDate();
             if (creationDate != null) {
                 attributeIDs.addElement(CREATION_DATE);
@@ -898,7 +898,7 @@ public class ResourceAttributes implemen
                 attributeIDs.addElement(ETAG);
                 attributeIDs.addElement(ALTERNATE_ETAG);
             }
-            return new RecyclableNamingEnumeration<String>(attributeIDs);
+            return new RecyclableNamingEnumeration<>(attributeIDs);
         } else {
             return attributes.getIDs();
         }

Modified: tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java Mon Sep  3 22:21:30 2012
@@ -57,8 +57,7 @@ public class ResourceCache {
     /**
      * Not found cache.
      */
-    protected final HashMap<String,CacheEntry> notFoundCache =
-        new HashMap<String,CacheEntry>();
+    protected final HashMap<String,CacheEntry> notFoundCache = new HashMap<>();
 
 
     /**

Modified: tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java Mon Sep  3 22:21:30
2012
@@ -90,7 +90,7 @@ public class VirtualDirContext extends F
     public void allocate() {
         super.allocate();
 
-        mappedResourcePaths = new HashMap<String, List<String>>();
+        mappedResourcePaths = new HashMap<>();
         StringTokenizer tkn = new StringTokenizer(extraResourcePaths, ",");
         while (tkn.hasMoreTokens()) {
             String resSpec = tkn.nextToken();
@@ -110,7 +110,7 @@ public class VirtualDirContext extends F
                 String dir = resSpec.substring(idx + 1);
                 List<String> resourcePaths = mappedResourcePaths.get(path);
                 if (resourcePaths == null) {
-                    resourcePaths = new ArrayList<String>();
+                    resourcePaths = new ArrayList<>();
                     mappedResourcePaths.put(path, resourcePaths);
                 }
                 resourcePaths.add(dir);
@@ -209,7 +209,7 @@ public class VirtualDirContext extends F
         List<NamingEntry> entries = super.list(file);
 
         if (mappedResourcePaths != null && !mappedResourcePaths.isEmpty()) {
-            Set<String> entryNames = new HashSet<String>(entries.size());
+            Set<String> entryNames = new HashSet<>(entries.size());
             for (NamingEntry entry : entries) {
                 entryNames.add(entry.name);
             }

Modified: tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java?rev=1380386&r1=1380385&r2=1380386&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java Mon Sep  3 22:21:30 2012
@@ -838,7 +838,7 @@ public class WARDirContext extends BaseD
      */
     protected ArrayList<NamingEntry> list(Entry entry) {
 
-        ArrayList<NamingEntry> entries = new ArrayList<NamingEntry>();
+        ArrayList<NamingEntry> entries = new ArrayList<>();
         Entry[] children = entry.getChildren();
         Arrays.sort(children);
         NamingEntry namingEntry = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message