ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs AntStructure.java
Date Sat, 26 Jan 2002 19:40:12 GMT
sbailliez    02/01/26 11:40:12

  Modified:    src/main/org/apache/tools/ant/taskdefs AntStructure.java
  Log:
  Fix violations
  
  Revision  Changes    Path
  1.18      +10 -7     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  
  Index: AntStructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/AntStructure.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AntStructure.java	10 Jan 2002 13:59:31 -0000	1.17
  +++ AntStructure.java	26 Jan 2002 19:40:12 -0000	1.18
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -77,7 +77,7 @@
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    *
  - * @version $Revision: 1.17 $
  + * @version $Revision: 1.18 $
    */
   
   public class AntStructure extends Task {
  @@ -253,21 +253,22 @@
   
           Enumeration enum = ih.getNestedElements();
           while (enum.hasMoreElements()) {
  -            v.addElement((String) enum.nextElement());
  +            v.addElement(enum.nextElement());
           }
   
           if (v.isEmpty()) {
               sb.append("EMPTY");
           } else {
               sb.append("(");
  -            for (int i=0; i<v.size(); i++) {
  +            final int count = v.size();
  +            for (int i = 0; i < count; i++) {
                   if (i != 0) {
                       sb.append(" | ");
                   }
                   sb.append(v.elementAt(i));
               }
               sb.append(")");
  -            if (v.size() > 1 || !v.elementAt(0).equals("#PCDATA")) {
  +            if (count > 1 || !v.elementAt(0).equals("#PCDATA")) {
                   sb.append("*");
               }
           }
  @@ -324,7 +325,8 @@
           sb.append(">").append(lSep);
           out.println(sb);
   
  -        for (int i=0; i<v.size(); i++) {
  +        final int count = v.size();
  +        for (int i = 0; i < count; i++) {
               String nestedName = (String) v.elementAt(i);
               if (!"#PCDATA".equals(nestedName) &&
                   !TASKS.equals(nestedName) &&
  @@ -341,7 +343,8 @@
        * Does this String match the XML-NMTOKEN production?
        */
       protected boolean isNmtoken(String s) {
  -        for (int i = 0; i < s.length(); i++) {
  +        final int length = s.length();
  +        for (int i = 0; i < length; i++) {
               char c = s.charAt(i);
               // XXX - we are ommitting CombiningChar and Extender here
               if (!Character.isLetterOrDigit(c) &&
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message