Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0
    • Component/s: James Core
    • Labels:
      None
    • Environment:
      James CVS, J2 1.5

      Description

      As of J2 1.5 'enum' is a keyword, several files affected in a lot of modules.

        Activity

        Hide
        fiveside Stuart Roe added a comment -

        Here is a patch that changes the 'enum' variables to 'enumeration', thus allowing the code to compile with the JDK1.5.

        — src/java/org/apache/james/fetchmail/MessageProcessor.java (revision 123091)
        +++ src/java/org/apache/james/fetchmail/MessageProcessor.java (working copy)
        @@ -842,13 +842,13 @@
        */
        protected boolean isBouncing() throws MessagingException
        {

        • Enumeration enum =
          + Enumeration enumeration =
          getMessageIn().getMatchingHeaderLines(
          new String[] { "X-fetched-from" }

          );
          int count = 0;

        • while (enum.hasMoreElements())
          + while (enumeration.hasMoreElements()) { - String header = (String) enum.nextElement(); + String header = (String) enumeration.nextElement(); if (header.equals(getFetchTaskName())) count++; }

          @@ -901,11 +901,11 @@
          {
          try
          {

        • Enumeration enum =
          + Enumeration enumeration =
          msg.getMatchingHeaderLines(new String[] { "Received" }

          );

        • while (enum.hasMoreElements())
          + while (enumeration.hasMoreElements())
          { - String received = (String) enum.nextElement(); + String received = (String) enumeration.nextElement(); int nextSearchAt = 0; int i = 0; --- src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java (revision 123091) +++ src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java (working copy) @@ -153,10 +153,10 @@ }

          finally

          { IOUtil.shutdownStream(fin); }
        • Enumeration enum = prop.keys();
          + Enumeration enumeration = prop.keys();
          NNTPArticle article = null;
        • while ( article == null && enum.hasMoreElements() ) {
        • String groupName = (String)enum.nextElement();
          + while ( article == null && enumeration.hasMoreElements() )
          Unknown macro: {+ String groupName = (String)enumeration.nextElement(); int number = Integer.parseInt(prop.getProperty(groupName)); NNTPGroup group = repo.getGroup(groupName); if ( group != null ) { --- src/java/org/apache/james/fetchpop/FetchPOP.java (revision 123091) +++ src/java/org/apache/james/fetchpop/FetchPOP.java (working copy) @@ -102,9 +102,9 @@ getLogger().error("can't create message out of fetched message "+messages[i].identifier); } }
        • Enumeration enum = received.elements();
        • while (enum.hasMoreElements()) {
        • POP3MessageInfo element = (POP3MessageInfo) enum.nextElement();
          + Enumeration enumeration = received.elements();
          + while (enumeration.hasMoreElements()) {
          + POP3MessageInfo element = (POP3MessageInfo) enumeration.nextElement();
          pop.deleteMessage(element.number);
          if (getLogger().isDebugEnabled()) {
          getLogger().debug("Delete:" + pop.getReplyString());

        — src/java/org/apache/james/userrepository/UsersLDAPRepository.java (revision 123091)
        +++ src/java/org/apache/james/userrepository/UsersLDAPRepository.java (working copy)
        @@ -248,9 +248,9 @@
        Attribute members
        = ctx.getAttributes("", attrIDs).get(membersAttr);
        if (members != null) {

        • NamingEnumeration enum = members.getAll();
        • while (enum.hasMore()) {
        • result.add((String)enum.next());
          + NamingEnumeration enumeration = members.getAll();
          + while (enumeration.hasMore()) { + result.add((String)enumeration.next()); }

          }
          } catch (NamingException e) {
          @@ -388,10 +388,10 @@
          .append(usersDomain);
          String filter = filterBuffer.toString();

        • NamingEnumeration enum = rootCtx.search("", filter, ctls);
          + NamingEnumeration enumeration = rootCtx.search("", filter, ctls);
        • if (enum.hasMore()) { // ie User is in Directory
        • SearchResult newSr = (SearchResult)enum.next();
          + if (enumeration.hasMore()) { // ie User is in Directory
          + SearchResult newSr = (SearchResult)enumeration.next();
          String userDN = newSr.getName();
          Attribute servers = rootCtx.getAttributes(userDN, returnAttrs).get(groupAttr);

        @@ -515,10 +515,10 @@
        .append(usersDomain);
        String filter = filterBuffer.toString();

        • NamingEnumeration enum = rootCtx.search("", filter, ctls);
          + NamingEnumeration enumeration = rootCtx.search("", filter, ctls);
        • if (enum.hasMore()) { // ie User is in Directory
        • SearchResult newSr = (SearchResult)enum.next();
          + if (enumeration.hasMore()) { // ie User is in Directory
          + SearchResult newSr = (SearchResult)enumeration.next();
          String userDN = newSr.getName();

        System.out.println("Found user entry: " + userDN);
        @@ -639,9 +639,9 @@
        try {
        rootCtx = new InitialDirContext(env);

        • NamingEnumeration enum = rootCtx.search("", filter, ctls);
        • if (enum.hasMore()) { // ie User is in Directory
        • SearchResult sr = (SearchResult)enum.next();
          + NamingEnumeration enumeration = rootCtx.search("", filter, ctls);
          + if (enumeration.hasMore()) { // ie User is in Directory
          + SearchResult sr = (SearchResult)enumeration.next();
          String userRDN = sr.getName();
          StringBuffer userDNBuffer =
          new StringBuffer(128)
        Show
        fiveside Stuart Roe added a comment - Here is a patch that changes the 'enum' variables to 'enumeration', thus allowing the code to compile with the JDK1.5. — src/java/org/apache/james/fetchmail/MessageProcessor.java (revision 123091) +++ src/java/org/apache/james/fetchmail/MessageProcessor.java (working copy) @@ -842,13 +842,13 @@ */ protected boolean isBouncing() throws MessagingException { Enumeration enum = + Enumeration enumeration = getMessageIn().getMatchingHeaderLines( new String[] { "X-fetched-from" } ); int count = 0; while (enum.hasMoreElements()) + while (enumeration.hasMoreElements()) { - String header = (String) enum.nextElement(); + String header = (String) enumeration.nextElement(); if (header.equals(getFetchTaskName())) count++; } @@ -901,11 +901,11 @@ { try { Enumeration enum = + Enumeration enumeration = msg.getMatchingHeaderLines(new String[] { "Received" } ); while (enum.hasMoreElements()) + while (enumeration.hasMoreElements()) { - String received = (String) enum.nextElement(); + String received = (String) enumeration.nextElement(); int nextSearchAt = 0; int i = 0; --- src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java (revision 123091) +++ src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java (working copy) @@ -153,10 +153,10 @@ } finally { IOUtil.shutdownStream(fin); } Enumeration enum = prop.keys(); + Enumeration enumeration = prop.keys(); NNTPArticle article = null; while ( article == null && enum.hasMoreElements() ) { String groupName = (String)enum.nextElement(); + while ( article == null && enumeration.hasMoreElements() ) Unknown macro: {+ String groupName = (String)enumeration.nextElement(); int number = Integer.parseInt(prop.getProperty(groupName)); NNTPGroup group = repo.getGroup(groupName); if ( group != null ) { --- src/java/org/apache/james/fetchpop/FetchPOP.java (revision 123091) +++ src/java/org/apache/james/fetchpop/FetchPOP.java (working copy) @@ -102,9 +102,9 @@ getLogger().error("can't create message out of fetched message "+messages[i].identifier); } } Enumeration enum = received.elements(); while (enum.hasMoreElements()) { POP3MessageInfo element = (POP3MessageInfo) enum.nextElement(); + Enumeration enumeration = received.elements(); + while (enumeration.hasMoreElements()) { + POP3MessageInfo element = (POP3MessageInfo) enumeration.nextElement(); pop.deleteMessage(element.number); if (getLogger().isDebugEnabled()) { getLogger().debug("Delete:" + pop.getReplyString()); — src/java/org/apache/james/userrepository/UsersLDAPRepository.java (revision 123091) +++ src/java/org/apache/james/userrepository/UsersLDAPRepository.java (working copy) @@ -248,9 +248,9 @@ Attribute members = ctx.getAttributes("", attrIDs).get(membersAttr); if (members != null) { NamingEnumeration enum = members.getAll(); while (enum.hasMore()) { result.add((String)enum.next()); + NamingEnumeration enumeration = members.getAll(); + while (enumeration.hasMore()) { + result.add((String)enumeration.next()); } } } catch (NamingException e) { @@ -388,10 +388,10 @@ .append(usersDomain); String filter = filterBuffer.toString(); NamingEnumeration enum = rootCtx.search("", filter, ctls); + NamingEnumeration enumeration = rootCtx.search("", filter, ctls); if (enum.hasMore()) { // ie User is in Directory SearchResult newSr = (SearchResult)enum.next(); + if (enumeration.hasMore()) { // ie User is in Directory + SearchResult newSr = (SearchResult)enumeration.next(); String userDN = newSr.getName(); Attribute servers = rootCtx.getAttributes(userDN, returnAttrs).get(groupAttr); @@ -515,10 +515,10 @@ .append(usersDomain); String filter = filterBuffer.toString(); NamingEnumeration enum = rootCtx.search("", filter, ctls); + NamingEnumeration enumeration = rootCtx.search("", filter, ctls); if (enum.hasMore()) { // ie User is in Directory SearchResult newSr = (SearchResult)enum.next(); + if (enumeration.hasMore()) { // ie User is in Directory + SearchResult newSr = (SearchResult)enumeration.next(); String userDN = newSr.getName(); System.out.println("Found user entry: " + userDN); @@ -639,9 +639,9 @@ try { rootCtx = new InitialDirContext(env); NamingEnumeration enum = rootCtx.search("", filter, ctls); if (enum.hasMore()) { // ie User is in Directory SearchResult sr = (SearchResult)enum.next(); + NamingEnumeration enumeration = rootCtx.search("", filter, ctls); + if (enumeration.hasMore()) { // ie User is in Directory + SearchResult sr = (SearchResult)enumeration.next(); String userRDN = sr.getName(); StringBuffer userDNBuffer = new StringBuffer(128)
        Hide
        danny@apache.org Danny Angus added a comment -

        Closing issue fixed in released version.

        Show
        danny@apache.org Danny Angus added a comment - Closing issue fixed in released version.

          People

          • Assignee:
            bago Stefano Bagnara
            Reporter:
            fhedberg Fredrik Hedberg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development