myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svieu...@apache.org
Subject cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor HtmlEditor.java
Date Mon, 03 Jan 2005 03:49:31 GMT
svieujot    2005/01/02 19:49:31

  Modified:    src/components/org/apache/myfaces/custom/htmlEditor
                        HtmlEditor.java
  Log:
  trim returned text
  
  Revision  Changes    Path
  1.15      +12 -6     incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditor.java
  
  Index: HtmlEditor.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- HtmlEditor.java	2 Jan 2005 20:39:16 -0000	1.14
  +++ HtmlEditor.java	3 Jan 2005 03:49:31 -0000	1.15
  @@ -30,6 +30,9 @@
    * @author Sylvain Vieujot (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.15  2005/01/03 03:49:31  svieujot
  + * trim returned text
  + *
    * Revision 1.14  2005/01/02 20:39:16  svieujot
    * HtmlEditor can now process HTML documents and HTML fragments.
    *
  @@ -301,11 +304,14 @@
       }
       
       public String getValueFromDocument(String text){
  +        if( text == null )
  +            return "";
  +        
           if( isTypeDocument() )
  -            return text;
  +            return text.trim();
           
           if( !isHtmlDocument(text) )
  -            return text;
  +            return text.trim();
           
           // Extract the fragment from the document.
           String lcText = text.toLowerCase();
  @@ -335,9 +341,9 @@
              || bodyStartIndex > bodyEndIndex
              || bodyStartIndex>=textLength || bodyEndIndex>=textLength ){
               log.warn("Couldn't extract HTML body from :\n"+text);
  -            return text;
  +            return text.trim();
           }
           
  -        return text.substring(bodyStartIndex, bodyEndIndex+1);
  +        return text.substring(bodyStartIndex, bodyEndIndex+1).trim();
       }
   }
  
  
  

Mime
View raw message