axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From R J Scheuerle Jr <sc...@us.ibm.com>
Subject Re: [VOTE] Import order (was: Re: cvs commit: xml-axis/java/test/utils TestMessages.java)
Date Thu, 29 Aug 2002 14:31:23 GMT

I don't care which rule is used.  I guess I prefer 2.

I agree with Glyn that the IDEs should be configured to avoid reordering of
imports.  The import re-ordering (and trailing blanks problems) are making
it difficult to review committed code.


Rich Scheuerle
IBM WebSphere & Axis Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                         
                                       
                      "Glyn Normington"                                                  
                                       
                      <glyn_normington@        To:       axis-dev@xml.apache.org      
                                          
                      uk.ibm.com>              cc:                                    
                                          
                                               Subject:  Re: [VOTE] Import order (was: Re:
cvs commit: xml-axis/java/test/utils  
                      08/29/2002 09:21          TestMessages.java)                       
                                       
                      AM                                                                 
                                       
                      Please respond to                                                  
                                       
                      axis-dev                                                           
                                       
                                                                                         
                                       
                                                                                         
                                       




 -0

Can't the relevant IDEs be configured to avoid this behaviour?

Unless we document and enforce a convention, newcomers (at least) are bound
to break it. If we document it, we end up with two sets of coding
standards: Sun's and our Axis-specific extras. If we enforce it, we'll have
even more build breaks.

Glyn



                      Russell

                      Butek/Austin/IBM@        To:       axis-dev@xml.
apache.org
                      IBMUS                    cc:

                                               Subject:  [VOTE] Import
order (was: Re: cvs commit: xml-axis/java/test/utils
                      29/08/02 14:35            TestMessages.java)

                      Please respond to

                      axis-dev






Some folks would probably treat this issue as a nit, but it irritates me.
We do not have a consistent view of how imports should be ordered.  And
various people's IDE's are constantly changing the order.  It's a royal
nuisance to look at a change log and see that most of its content has
nothing to do with the real change.  There are various reasons for this
(like stripping off trailing white space) but I'll stick with import order
in this note.  Unless we all decide on an order, we're going to continually
see them flip fop and clutter change logs.

Let's vote for one and stick to it.
1.  java and javax appear alphabetically at the bottom of the imports list,
all other imports appear alphabetically at the top.
2.  all imports appear alphabetically.
3.  others?

I vote for 2.

Russell Butek
butek@us.ibm.com


rsitze@apache.org on 08/28/2002 02:45:09 PM

Please respond to axis-dev@xml.apache.org

To:    xml-axis-cvs@apache.org
cc:
Subject:    cvs commit: xml-axis/java/test/utils TestMessages.java



rsitze      2002/08/28 12:45:09

  Modified:    java/src/org/apache/axis/utils JavaUtils.java
               java/test/utils TestMessages.java
  Log:
  Hook to extend messages (ResourceBundles)

  Revision  Changes    Path
  1.75      +77 -35    xml-axis/java/src/org/apache/axis/utils/JavaUtils.
  java

  Index: JavaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.
  java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- JavaUtils.java    26 Aug 2002 13:10:22 -0000    1.74
  +++ JavaUtils.java    28 Aug 2002 19:45:09 -0000    1.75
  @@ -55,17 +55,6 @@

   package org.apache.axis.utils;

  -import org.apache.axis.attachments.AttachmentPart;
  -import org.apache.axis.components.image.ImageIO;
  -import org.apache.axis.components.image.ImageIOFactory;
  -import org.apache.axis.components.logger.LogFactory;
  -import org.apache.axis.types.HexBinary;
  -import org.apache.commons.logging.Log;
  -
  -import javax.activation.DataHandler;
  -import javax.xml.soap.SOAPException;
  -import javax.xml.transform.Source;
  -import javax.xml.transform.stream.StreamSource;
   import java.awt.Image;
   import java.beans.Introspector;
   import java.io.IOException;
  @@ -89,6 +78,18 @@
   import java.util.MissingResourceException;
   import java.util.ResourceBundle;
   import java.util.Set;
  +import java.util.Vector;
  +
  +import javax.activation.DataHandler;
  +import javax.xml.soap.SOAPException;
  +import javax.xml.transform.Source;
  +import javax.xml.transform.stream.StreamSource;
  +import org.apache.axis.attachments.AttachmentPart;
  +import org.apache.axis.components.image.ImageIO;
  +import org.apache.axis.components.image.ImageIOFactory;
  +import org.apache.axis.components.logger.LogFactory;
  +import org.apache.axis.types.HexBinary;
  +import org.apache.commons.logging.Log;

   /** Utility class to deal with Java language related issues, such
    * as type conversions.
  @@ -786,33 +787,47 @@
               || '\u06DE' == c;
       } // isPunctuation

  +
  +
  /********************************************************************/
  +    /*********************** i18n Message Support
  ***********************/
  +
       // Message resource bundle.
  -    private static ResourceBundle messages = null;
  +    private static Vector bundleNames = null;        // String
  +    private static Vector messageBundles = null;     // ResourceBundle
  +

       /**
  -     * Get the resource bundle that contains all of the AXIS
  translatable messages.
  +     * Get the resource bundle that contains all
  +     * of the AXIS translatable messages.
        */
  -    public static ResourceBundle getMessageResourceBundle() {
  -        if (messages == null) {
  -            initializeMessages();
  +    public static ResourceBundle getFirstMessageResourceBundle() {
  +        if (messageBundles == null) {
  +            initializeMessageBundles();
           }
  -        return messages;
  +        return (ResourceBundle)messageBundles.get(0);
       } // getMessageResourceBundle

       /**
  -     * Get the message with the given key.  There are no arguments for
  this message.
  +     * Get the message with the given key.
  +     * There are no arguments for this message.
        */
       public static String getMessage(String key)
               throws MissingResourceException {
  -        if (messages == null) {
  -            initializeMessages();
  +        if (messageBundles == null) {
  +            initializeMessageBundles();
  +        }
  +
  +        String msg = null;
  +        for (int i = 0; msg == null  &&  i < messageBundles.size(); i++)
  {
  +            msg = ((ResourceBundle)messageBundles.get(i)).
  getString(key);
           }
  -        return messages.getString(key);
  +        return msg;
       } // getMessage

       /**
  -     * Get the message with the given key.  If an argument is specified
  in the message (in the
  -     * format of "{0}") then fill in that argument with the value of
  var.
  +     * Get the message with the given key.  If an argument is specified
  +     * in the message (in the format of "{0}") then fill in that
  argument
  +     * with the value of var.
        */
       public static String getMessage(String key, String var)
               throws MissingResourceException {
  @@ -821,8 +836,9 @@
       } // getMessage

       /**
  -     * Get the message with the given key.  If arguments are specified
  in the message (in the
  -     * format of "{0} {1}") then fill them in with the values of var1
  and var2, respectively.
  +     * Get the message with the given key.  If arguments are specified
  +     * in the message (in the format of "{0} {1}") then fill them in
  +     * with the values of var1 and var2, respectively.
        */
       public static String getMessage(String key, String var1, String
       var2)
               throws MissingResourceException {
  @@ -831,8 +847,9 @@
       } // getMessage

       /**
  -     * Get the message with the given key.  If arguments are specified
  in the message (in the
  -     * format of "{0} {1}") then fill them in with the values of var1
  and var2, respectively.
  +     * Get the message with the given key.  If arguments are specified
  +     * in the message (in the format of "{0} {1}") then fill them in
  +     * with the values of var1 and var2, respectively.
        */
       public static String getMessage(String key, String var1, String
       var2, String var3)
               throws MissingResourceException {
  @@ -840,9 +857,11 @@
       } // getMessage

       /**
  -     * Get the message with the given key.  Replace each "{X}" in the
  message with vars[X].  If
  -     * there are more vars than {X}'s, then the extra vars are ignored.
  If there are more {X}'s
  -     * than vars, then a java.text.ParseException (subclass of
  RuntimeException) is thrown.
  +     * Get the message with the given key.  Replace each "{X}" in the
  +     * message with vars[X].  If there are more vars than {X}'s, then
  +     * the extra vars are ignored.  If there are more {X}'s than vars,
  +     * then a java.text.ParseException (subclass of RuntimeException)
  +     * is thrown.
        */
       public static String getMessage(String key, String[] vars)
               throws MissingResourceException {
  @@ -850,13 +869,36 @@
       } // getMessage

       /**
  -     * Load the resource bundle messages from the properties file.  This
  is ONLY done when it is
  -     * needed.  If no messages are printed (for example, only Wsdl2java
  is being run in non-
  +     * Add a ResourceBundle to list.
  +     * ResourceBundle is not opened until needed.
  +     */
  +    public static void addMessages(String resourceBundleName) {
  +    }
  +
  +    /**
  +     * Load the resource bundle messages from the properties file.
  +     * This is ONLY done when it is needed.  If no messages are
  +     * printed (for example, only Wsdl2java is being run in non-
        * verbose mode) then there is no need to read the properties file.
        */
  -    private static void initializeMessages() {
  -        messages = ResourceBundle.getBundle("org.apache.axis.utils.
  axisNLS");
  -    } // initializeMessages
  +    private static void initializeMessageBundles() {
  +        if (bundleNames == null) {
  +            initializeBundleNames();
  +        }
  +        messageBundles = new Vector();
  +        for (int i = 0; i < bundleNames.size(); i++) {
  +            messageBundles.add(ResourceBundle.getBundle((String)
  bundleNames.get(i)));
  +        }
  +    } // initializeMessageBundles
  +
  +    private static void initializeBundleNames() {
  +        bundleNames = new Vector();
  +        bundleNames.add("org.apache.axis.utils.axisNLS");
  +    }
  +
  +    /********************* END i18n Message Support
  *********************/
  +
  /********************************************************************/
  +

       /**
        * replace:



  1.9       +1 -1      xml-axis/java/test/utils/TestMessages.java

  Index: TestMessages.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/utils/TestMessages.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestMessages.java 22 May 2002 17:39:40 -0000    1.8
  +++ TestMessages.java 28 Aug 2002 19:45:09 -0000    1.9
  @@ -37,7 +37,7 @@
           String arg0 = "arg0";
           String arg1 = "arg1";
           String[] args = {arg0, arg1, "arg2"};
  -        Enumeration keys = JavaUtils.getMessageResourceBundle().
  getKeys();
  +        Enumeration keys = JavaUtils.getFirstMessageResourceBundle().
  getKeys();
           while (keys.hasMoreElements()) {
               String key = (String) keys.nextElement();
               try {














Mime
View raw message