jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r667246 - in /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki: parser/CreoleToJSPWikiTranslator.java ui/AbstractCommand.java ui/CommandResolver.java ui/EditorManager.java ui/TemplateManager.java ui/admin/AdminBeanManager.java
Date Thu, 12 Jun 2008 21:45:22 GMT
Author: jalkanen
Date: Thu Jun 12 14:45:22 2008
New Revision: 667246

URL: http://svn.apache.org/viewvc?rev=667246&view=rev
Log:
Java5 and other checkstyle issues fixed.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/AbstractCommand.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/CommandResolver.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/EditorManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java Thu
Jun 12 14:45:22 2008
@@ -163,9 +163,9 @@
 
     private static final String ESCAPE_PROTECTED = "~(\\*\\*|~|//|-|#|\\{\\{|}}|\\\\|~\\[~~[|]]|----|=|\\|)";
 
-    private static Map          c_protectionMap = new HashMap();
+    private static Map<String, String> c_protectionMap = new HashMap<String, String>();
 
-    private        ArrayList    m_hashList = new ArrayList();
+    private        ArrayList<String> m_hashList = new ArrayList<String>();
 
     public String translateSignature(Properties wikiProps, final String content, String username)
     {
@@ -334,7 +334,7 @@
         for (int i = it.length - 1; i >= 0; i--)
         {
             String hash = (String) it[i];
-            String protectedMarkup = (String) c_protectionMap.get(hash);
+            String protectedMarkup = c_protectionMap.get(hash);
             content = content.replace(hash, protectedMarkup);
             if ((protectedMarkup.length() < 3 || (protectedMarkup.length() > 2 &&
                 !protectedMarkup.substring(0, 3).equals("{{{")))&&replacePlugins)
@@ -362,7 +362,7 @@
     private String protectMarkup(String content)
     {
         c_protectionMap.clear();
-        this.m_hashList = new ArrayList();
+        m_hashList = new ArrayList<String>();
         content = protectMarkup(content, PREFORMATTED_PROTECTED, "", "");
         content = protectMarkup(content, URL_PROTECTED, "", "");
         content = protectMarkup(content, ESCAPE_PROTECTED, "", "");
@@ -377,18 +377,18 @@
     {
         Set keySet = wikiProps.keySet();
         Object[] keys = keySet.toArray();
-        ArrayList result = new ArrayList();
+        ArrayList<String[]> result = new ArrayList<String[]>();
 
-        for (int i = 0; i < keys.length; i++)
+        for( int i = 0; i < keys.length; i++ )
         {
             String key = keys[i] + "";
-            String value = wikiProps.getProperty(keys[i] + "");
-            if ((key).indexOf("creole.imagePlugin.para.%") > -1)
+            String value = wikiProps.getProperty( keys[i] + "" );
+            if( key.indexOf( "creole.imagePlugin.para.%" ) > -1 )
             {
                 String[] pair = new String[2];
-                pair[0] = key.replaceAll("creole.imagePlugin.para.%", "");
+                pair[0] = key.replaceAll( "creole.imagePlugin.para.%", "" );
                 pair[1] = value;
-                result.add(pair);
+                result.add( pair );
             }
         }
         return result;
@@ -497,7 +497,7 @@
                 String hash = bytesToHash(digest.digest());
                 matcher.appendReplacement(result, hash);
                 c_protectionMap.put(hash, protectedMarkup);
-                this.m_hashList.add(hash);
+                m_hashList.add(hash);
             }
             catch (NoSuchAlgorithmException e)
             {

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/AbstractCommand.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/AbstractCommand.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/AbstractCommand.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/AbstractCommand.java Thu Jun 12 14:45:22
2008
@@ -169,7 +169,7 @@
      */
     public static final Command[] allCommands()
     {
-        return (Command[])ALL_COMMANDS.clone();
+        return ALL_COMMANDS.clone();
     }
 
     /**

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/CommandResolver.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/CommandResolver.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/CommandResolver.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/CommandResolver.java Thu Jun 12 14:45:22
2008
@@ -77,16 +77,16 @@
     private static final String PROP_SPECIALPAGE = "jspwiki.specialPage.";
 
     /** Private map with request contexts as keys, Commands as values */
-    private static final Map    CONTEXTS;
+    private static final Map<String, Command>    CONTEXTS;
 
     /** Private map with JSPs as keys, Commands as values */
-    private static final Map    JSPS;
+    private static final Map<String, Command>    JSPS;
 
     /** Store the JSP-to-Command and context-to-Command mappings */
     static
     {
-        CONTEXTS = new HashMap();
-        JSPS = new HashMap();
+        CONTEXTS = new HashMap<String, Command>();
+        JSPS = new HashMap<String, Command>();
         Command[] commands = AbstractCommand.allCommands();
         for( int i = 0; i < commands.length; i++ )
         {
@@ -103,7 +103,7 @@
     private final boolean       m_matchEnglishPlurals;
 
     /** Stores special page names as keys, and Commands as values. */
-    private final Map           m_specialPages;
+    private final Map<String, Command> m_specialPages;
 
     /**
      * Constructs a CommandResolver for a given WikiEngine. This constructor
@@ -115,7 +115,7 @@
     public CommandResolver( WikiEngine engine, Properties properties )
     {
         m_engine = engine;
-        m_specialPages = new HashMap();
+        m_specialPages = new HashMap<String, Command>();
 
         // Skim through the properties and look for anything with
         // the "special page" prefix. Create maps that allow us
@@ -133,7 +133,7 @@
                 {
                     specialPage = specialPage.trim();
                     jsp = jsp.trim();
-                    Command command = (Command) JSPS.get( jsp );
+                    Command command = JSPS.get( jsp );
                     if ( command == null )
                     {
                         Command redirect = RedirectCommand.REDIRECT;
@@ -160,7 +160,7 @@
      */
     public static Command findCommand( String context )
     {
-        Command command = (Command) CONTEXTS.get( context );
+        Command command = CONTEXTS.get( context );
         if ( command == null )
         {
             throw new IllegalArgumentException( "Unsupported wiki context: " + context +
"." );
@@ -215,7 +215,7 @@
         // Can we find a special-page command matching the extracted page?
         if ( pageName != null )
         {
-            command = (AbstractCommand) m_specialPages.get( pageName );
+            command = m_specialPages.get( pageName );
         }
 
         // If we haven't found a matching command yet, extract the JSP path
@@ -227,7 +227,7 @@
             // Otherwise: use the default context
             if ( command == null )
             {
-                command = (AbstractCommand) CONTEXTS.get( defaultContext );
+                command = CONTEXTS.get( defaultContext );
                 if ( command == null )
                 {
                     throw new IllegalArgumentException( "Wiki context " + defaultContext
+ " is illegal." );
@@ -357,7 +357,7 @@
      */
     public final String getSpecialPageReference( String page )
     {
-        Command command = (Command) m_specialPages.get( page );
+        Command command = m_specialPages.get( page );
 
         if ( command != null )
         {
@@ -410,7 +410,7 @@
         // Ok, see if we match against our standard list of JSPs
         if ( jsp.length() > 0 && JSPS.containsKey( jsp ) )
         {
-            return (Command)JSPS.get( jsp );
+            return JSPS.get( jsp );
         }
 
         return null;

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/EditorManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/EditorManager.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/EditorManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/EditorManager.java Thu Jun 12 14:45:22
2008
@@ -83,7 +83,7 @@
     /** Known attribute name for storing the user edited text inside a session or a page
context */
     public static final String       ATTR_EDITEDTEXT = REQ_EDITEDTEXT;
 
-    private             Map          m_editors;
+    private             Map<String, WikiEditorInfo>  m_editors;
 
     private static      Logger       log             = Logger.getLogger( EditorManager.class
);
 
@@ -111,7 +111,7 @@
     {
         log.info( "Registering editor modules" );
 
-        m_editors = new HashMap();
+        m_editors = new HashMap<String, WikiEditorInfo>();
         SAXBuilder builder = new SAXBuilder();
 
         try
@@ -236,9 +236,9 @@
     {
         String[] editors = new String[m_editors.size()];
 
-        Set keys = m_editors.keySet();
+        Set<String> keys = m_editors.keySet();
 
-        return (String[]) keys.toArray( editors );
+        return keys.toArray( editors );
     }
 
     /**
@@ -253,7 +253,7 @@
 
         String editor = getEditorName( context );
 
-        WikiEditorInfo ed = (WikiEditorInfo)m_editors.get( editor );
+        WikiEditorInfo ed = m_editors.get( editor );
 
         if( ed != null )
         {
@@ -324,7 +324,7 @@
 
     public Collection modules()
     {
-        ArrayList ls = new ArrayList();
+        ArrayList<WikiModuleInfo> ls = new ArrayList<WikiModuleInfo>();
 
         ls.addAll( m_editors.values() );
 

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java Thu Jun 12 14:45:22
2008
@@ -378,14 +378,15 @@
      *   @return Set of Strings with the skin names.
      *   @since 2.3.26
      */
+    @SuppressWarnings("unchecked")
     public Set listSkins( PageContext pageContext, String template )
     {
         String place = makeFullJSPName( template, SKIN_DIRECTORY );
 
         ServletContext sContext = pageContext.getServletContext();
 
-        Set skinSet = sContext.getResourcePaths( place );
-        TreeSet resultSet = new TreeSet();
+        Set<String> skinSet = sContext.getResourcePaths( place );
+        TreeSet<String> resultSet = new TreeSet<String>();
 
         if( log.isDebugEnabled() ) log.debug( "Listings skins from "+place );
 
@@ -393,7 +394,7 @@
         {
             String[] skins = {};
 
-            skins = (String[]) skinSet.toArray(skins);
+            skins = skinSet.toArray(skins);
 
             for (int i = 0; i < skins.length; i++)
             {
@@ -421,7 +422,7 @@
      */
     public Map listLanguages(PageContext pageContext)
     {
-        LinkedHashMap resultMap = new LinkedHashMap();
+        LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
 
         String clientLanguage = ((HttpServletRequest) pageContext.getRequest()).getLocale().toString();
         JarInputStream jarStream = null;
@@ -486,8 +487,8 @@
     {
         WikiContext context = WikiContext.findContext( pageContext ); 
         Properties props = m_engine.getWikiProperties();
-        ArrayList tfArr = new ArrayList(40);
-        LinkedHashMap resultMap = new LinkedHashMap();
+        ArrayList<String> tfArr = new ArrayList<String>(40);
+        LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
 
         /* filter timeformat properties */
         for (Enumeration e = props.propertyNames(); e.hasMoreElements();)
@@ -516,7 +517,7 @@
 
             for (int i = 0; i < tfArr.size(); i++)
             {
-                tfArr.set(i, props.getProperty((String) tfArr.get(i)));
+                tfArr.set(i, props.getProperty(tfArr.get(i)));
             }
         }
 
@@ -542,7 +543,7 @@
             {
                 try
                 {
-                    String f = (String) tfArr.get(i);
+                    String f = tfArr.get(i);
                     fmt.applyPattern(f);
 
                     resultMap.put(f, fmt.format(d));
@@ -568,7 +569,7 @@
      */
     public Map listTimeZones(PageContext pageContext)
     {
-        LinkedHashMap resultMap = new LinkedHashMap();
+        LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
 
         String[][] tzs = { { "GMT-12", "Enitwetok, Kwajalien" },
                           { "GMT-11", "Nome, Midway Island, Samoa" }, 
@@ -736,20 +737,21 @@
      *  @param type What kind of a request should be added?
      *  @param resource The resource to add.
      */
+    @SuppressWarnings("unchecked")
     public static void addResourceRequest( WikiContext ctx, String type, String resource
)
     {
-        HashMap resourcemap = (HashMap) ctx.getVariable( RESOURCE_INCLUDES );
+        HashMap<String,Vector<String>> resourcemap = (HashMap<String,Vector<String>>)
ctx.getVariable( RESOURCE_INCLUDES );
 
         if( resourcemap == null )
         {
-            resourcemap = new HashMap();
+            resourcemap = new HashMap<String,Vector<String>>();
         }
 
-        Vector resources = (Vector) resourcemap.get( type );
+        Vector<String> resources = resourcemap.get( type );
 
         if( resources == null )
         {
-            resources = new Vector();
+            resources = new Vector<String>();
         }
 
         String resourceString = null;
@@ -795,19 +797,20 @@
      *  @return a String array for the resource requests
      */
 
+    @SuppressWarnings("unchecked")
     public static String[] getResourceRequests( WikiContext ctx, String type )
     {
-        HashMap hm = (HashMap) ctx.getVariable( RESOURCE_INCLUDES );
+        HashMap<String,Vector<String>> hm = (HashMap<String,Vector<String>>)
ctx.getVariable( RESOURCE_INCLUDES );
 
         if( hm == null ) return new String[0];
 
-        Vector resources = (Vector) hm.get( type );
+        Vector<String> resources = hm.get( type );
 
         if( resources == null ) return new String[0];
 
         String[] res = new String[resources.size()];
 
-        return (String[]) resources.toArray( res );
+        return resources.toArray( res );
     }
 
     /**
@@ -816,19 +819,20 @@
      * @param ctx the wiki context
      * @return the array of types requested
      */
+    @SuppressWarnings("unchecked")
     public static String[] getResourceTypes( WikiContext ctx )
     {
         String[] res = new String[0];
 
         if( ctx != null )
         {
-            HashMap hm = (HashMap) ctx.getVariable( RESOURCE_INCLUDES );
+            HashMap<String,String> hm = (HashMap<String,String>) ctx.getVariable(
RESOURCE_INCLUDES );
 
             if( hm != null )
             {
-                Set keys = hm.keySet();
+                Set<String> keys = hm.keySet();
 
-                res = (String[]) keys.toArray( res );
+                res = keys.toArray( res );
             }
         }
 

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java?rev=667246&r1=667245&r2=667246&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java Thu Jun 12
14:45:22 2008
@@ -50,7 +50,7 @@
 public class AdminBeanManager implements WikiEventListener
 {
     private WikiEngine m_engine;
-    private ArrayList  m_allBeans;
+    private ArrayList<AdminBean>  m_allBeans;
 
     private MBeanServer m_mbeanServer = null;
 
@@ -195,7 +195,7 @@
     // FIXME: Should unload the beans first.
     private void reload()
     {
-        m_allBeans = new ArrayList();
+        m_allBeans = new ArrayList<AdminBean>();
 
         try
         {
@@ -249,9 +249,6 @@
     /**
      *  Provides a JDK 1.5-compliant version of the MBeanServerFactory. This
      *  will simply bind to the platform MBeanServer.
-     *
-     *  @author Janne Jalkanen
-     *
      */
     private static final class MBeanServerFactory15
     {



Mime
View raw message