User: schaefera
  Date: 01/11/01 22:07:48

  Modified:    src/main/org/jboss/metadata MessageDrivenMetaData.java
  Log:
  Fixed the bug 441291 therefore that a message selector can have leading
  and trailing spaces as well as line breaks and still does not break
  (leading and trailing spaces are remoed, line breaks as converted to
  a space and an empty string is converted to null meaning not restrictions).
  
  Scheduler does not register at the JNDI server as well as supports named
  attributes instead of only constructors arguments.
  
  Abstract Verifier checks not for RemoteException compliant with the
  RMI spec.
  
  Revision  Changes    Path
  1.15      +42 -1     jboss/src/main/org/jboss/metadata/MessageDrivenMetaData.java
  
  Index: MessageDrivenMetaData.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/metadata/MessageDrivenMetaData.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MessageDrivenMetaData.java        2001/09/27 21:54:01     1.14
  +++ MessageDrivenMetaData.java        2001/11/02 06:07:48     1.15
  @@ -20,7 +20,17 @@
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>
  - * @version $Revision: 1.14 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  + *
  + * <p><b>Revisions:</b></p>
  + * <p><b>20011031: Andy</b>
  + * <ul>
  + * <li>Ensured that the <message-selector> value in the descriptor does not
  + *     be compromised by leading and trailing spaces as well as line-breaks</li>
  + * </ul>
  + * </p>
  + *
  + * @version $Revision: 1.15 $
    */
   public class MessageDrivenMetaData
      extends BeanMetaData
  @@ -174,6 +184,37 @@
         super.importEjbJarXml(element);
   
         messageSelector = getOptionalChildContent(element, "message-selector");
  +      if( messageSelector != null ) {
  +         //AS Check for Carriage Returns, remove them and trim the selector
  +         int i = -1;
  +         // Note this only works this way because the search and replace are 
distinct
  +         while( ( i = messageSelector.indexOf( "\r\n" ) ) >= 0 ) {
  +            // Replace \r\n by a space
  +            messageSelector = ( i == 0 ? "" : messageSelector.substring( 0, i ) ) +
  +                              " " +
  +                              ( i >= messageSelector.length() - 2 ? "" : 
messageSelector.substring( i + 2 ) );
  +         }
  +         i = -1;
  +         while( ( i = messageSelector.indexOf( "\r" ) ) >= 0 ) {
  +            // Replace \r by a space
  +            messageSelector = ( i == 0 ? "" : messageSelector.substring( 0, i ) ) +
  +                              " " +
  +                              ( i >= messageSelector.length() - 1 ? "" : 
messageSelector.substring( i + 1 ) );
  +         }
  +         i = -1;
  +         while( ( i = messageSelector.indexOf( "\n" ) ) >= 0 ) {
  +            // Replace \n by a space
  +            messageSelector = ( i == 0 ? "" : messageSelector.substring( 0, i ) ) +
  +                              " " +
  +                              ( i >= messageSelector.length() - 1 ? "" : 
messageSelector.substring( i + 1 ) );
  +         }
  +         // Finally trim it. This is here because only carriage returns and 
linefeeds are transformed
  +         // to spaces
  +         messageSelector = messageSelector.trim();
  +         if( "".equals( messageSelector ) ) {
  +            messageSelector = null;
  +         }
  +      }
   
         // destination is optional
         Element destination =
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to