You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2003/10/20 10:17:17 UTC

cvs commit: james-server/src/java/org/apache/james/nntpserver/repository ArticleIDRepository.java

noel        2003/10/20 01:17:17

  Modified:    src/java/org/apache/james/nntpserver/repository Tag:
                        branch_2_1_fcs ArticleIDRepository.java
  Log:
  Simple fix for bug #13388.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.10.4.3  +17 -1     james-server/src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
  
  Index: ArticleIDRepository.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java,v
  retrieving revision 1.10.4.2
  retrieving revision 1.10.4.3
  diff -u -r1.10.4.2 -r1.10.4.3
  --- ArticleIDRepository.java	8 Mar 2003 21:54:05 -0000	1.10.4.2
  +++ ArticleIDRepository.java	20 Oct 2003 08:17:17 -0000	1.10.4.3
  @@ -155,11 +155,27 @@
       File getFileFromID(String articleID) {
           String b64Id;
           try {
  -            b64Id = Base64.encodeAsString(articleID);
  +            b64Id = removeCRLF(Base64.encodeAsString(articleID));
           } catch (Exception e) {
               throw new RuntimeException("This shouldn't happen: " + e);
           }
           return new File(root, b64Id);
  +    }
  +
  +    /**
  +     * the base64 encode from javax.mail.internet.MimeUtility adds line
  +     * feeds to the encoded stream.  This removes them, since we will
  +     * use the String as a filename.
  +     */
  +    private static String removeCRLF(String str) {
  +        StringBuffer buffer = new StringBuffer();
  +        for (int i = 0; i < str.length(); i++) {
  +            char c = str.charAt(i);
  +            if (c != '\r' && c != '\n') {
  +                buffer.append(c);
  +            }
  +        }
  +        return buffer.toString();
       }
   
       /**
  
  
  

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