CPD Results

The following document contains the results of PMD's CPD 4.2.2.

Duplications

File Line
org/webmacro/engine/Block.java 172
org/webmacro/engine/Block.java 197
            b = bcontent[i];
            out.write(b, 0, b.length);
            teC._lineNo = this.getLineNo(i);
            teC._columnNo = this.getColNo(i);
            _macros[i++].write(out, context);
            b = bcontent[i];
            out.write(b, 0, b.length);
            teC._lineNo = this.getLineNo(i);
            teC._columnNo = this.getColNo(i);
            _macros[i++].write(out, context);
            b = bcontent[i];
            out.write(b, 0, b.length);
            teC._lineNo = this.getLineNo(i);
            teC._columnNo = this.getColNo(i);
            _macros[i++].write(out, context);
            b = bcontent[i];
            out.write(b, 0, b.length);
            teC._lineNo = this.getLineNo(i);
            teC._columnNo = this.getColNo(i);
            _macros[i++].write(out, context);
            b = bcontent[i];
            out.write(b, 0, b.length);
            teC._lineNo = this.getLineNo(i);
            teC._columnNo = this.getColNo(i);
            _macros[i++].write(out, context);

File Line
org/webmacro/parser/ASCII_CharStream.java 13
org/webmacro/parser/BackupCharStream.java 14
{

    private static final class Buffer
    {

        int size;
        int dataLen, curPos;
        char[] buffer;
        int[] bufline, bufcolumn;

        public Buffer (int n)
        {
            size = n;
            dataLen = 0;
            curPos = -1;
            buffer = new char[n];
            bufline = new int[n];
            bufcolumn = new int[n];
        }

        public void expand (int n)
        {
            char[] newbuffer = new char[size + n];
            int newbufline[] = new int[size + n];
            int newbufcolumn[] = new int[size + n];

            try
            {
                System.arraycopy(buffer, 0, newbuffer, 0, size);
                buffer = newbuffer;
                System.arraycopy(bufline, 0, newbufline, 0, size);
                bufline = newbufline;
                System.arraycopy(bufcolumn, 0, newbufcolumn, 0, size);
                bufcolumn = newbufcolumn;
            }
            catch (Throwable t)
            {
                throw new Error(t.getMessage());
            }

            size += n;
        }
    }

    private Buffer bufA, bufB, curBuf, otherBuf, tokenBeginBuf;
    private int tokenBeginPos;
    private int backupChars;

    public static final boolean staticFlag = false;

    private int column = 0;
    private int line = 1;
    private boolean prevCharIsCR = false;
    private boolean prevCharIsLF = false;

    private java.io.Reader inputStream;
    private boolean inputStreamClosed = false;

File Line
org/webmacro/parser/ParseException.java 172
org/webmacro/parser/TokenMgrError.java 44
   protected static final String addEscapes(String str) {
      StringBuffer retval = new StringBuffer();
      char ch;
      for (int i = 0; i < str.length(); i++) {
        switch (str.charAt(i))
        {
           case 0 :
              continue;
           case '\b':
              retval.append("\\b");
              continue;
           case '\t':
              retval.append("\\t");
              continue;
           case '\n':
              retval.append("\\n");
              continue;
           case '\f':
              retval.append("\\f");
              continue;
           case '\r':
              retval.append("\\r");
              continue;
           case '\"':
              retval.append("\\\"");
              continue;
           case '\'':
              retval.append("\\\'");
              continue;
           case '\\':
              retval.append("\\\\");
              continue;
           default:
              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
                 String s = "0000" + Integer.toString(ch, 16);
                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
              } else {
                 retval.append(ch);
              }
              continue;
        }
      }
      return retval.toString();
   }

File Line
org/webmacro/parser/ASCII_CharStream.java 124
org/webmacro/parser/BackupCharStream.java 134
            }
            throw e;
        }
    }

    public final char BeginToken () throws java.io.IOException
    {
        tokenBeginPos = -1;
        char c = readChar();
        tokenBeginBuf = curBuf;
        tokenBeginPos = curBuf.curPos;

        return c;
    }

    private final void UpdateLineColumn (char c)
    {
        column++;

        if (prevCharIsLF)
        {
            prevCharIsLF = false;
            line += (column = 1);
        }
        else if (prevCharIsCR)
        {
            prevCharIsCR = false;
            if (c == '\n')
            {
                prevCharIsLF = true;
            }
            else
                line += (column = 1);
        }

        switch (c)
        {
            case '\r':
                prevCharIsCR = true;
                break;
            case '\n':
                prevCharIsLF = true;
                break;
            case '\t':
                column--;
                column += (8 - (column & 07));
                break;
            default :
                break;
        }

        curBuf.bufline[curBuf.curPos] = line;
        curBuf.bufcolumn[curBuf.curPos] = column;
    }

    public final char readChar () throws java.io.IOException
    {
        // When we hit the end of the buffer, if we're backing up, we just
        // swap, if we're not, we fill.
        if (++curBuf.curPos >= curBuf.dataLen)
        {
            if (backupChars > 0)
            {
                --curBuf.curPos;
                swapBuf();
            }
            else
                FillBuff();
        }
        ;

        // Don't mask off the high byte
        char c = curBuf.buffer[curBuf.curPos];

File Line
org/webmacro/parser/ASCII_CharStream.java 336
org/webmacro/parser/BackupCharStream.java 367
    }

    public final char[] GetSuffix (int len)
    {
        char[] ret = new char[len];

        if ((curBuf.curPos + 1) >= len)
            System.arraycopy(curBuf.buffer, curBuf.curPos - len + 1, ret, 0, len);
        else
        {
            if (otherBuf.dataLen >= len - curBuf.curPos - 1)
                System.arraycopy(otherBuf.buffer,
                        otherBuf.dataLen - (len - curBuf.curPos - 1), ret, 0,
                        len - curBuf.curPos - 1);
            System.arraycopy(curBuf.buffer, 0, ret, len - curBuf.curPos - 1,
                    curBuf.curPos + 1);
        }

        return null;
    }

    public void Done ()
    {
        bufA = bufB = curBuf = otherBuf = null;
    }

}

File Line
org/webmacro/RethrowableException.java 67
org/webmacro/RethrowableRuntimeException.java 71
    }

    public void printStackTrace ()
    {
        super.printStackTrace();
        if (cause != null)
        {
            System.err.println(RETHROW_MESSAGE);
            cause.printStackTrace();
        }
    }

    public void printStackTrace (java.io.PrintStream ps)
    {
        super.printStackTrace(ps);
        if (cause != null)
        {
            ps.println(RETHROW_MESSAGE);
            cause.printStackTrace(ps);
        }
    }

    public void printStackTrace (java.io.PrintWriter pw)
    {
        super.printStackTrace(pw);
        if (cause != null)
        {
            pw.println(RETHROW_MESSAGE);
            cause.printStackTrace(pw);
        }
    }

    /**
     * allow access to underlying exception
     * @deprecated you should use <code>getCause</code> instead
     */
    public Throwable getCaught ()
    {
        return getCause();
    }

    /**
     * Return the underlying exception provided at construction time
     * or null if none was provided.
     * @return underlying cause
     * @since 1.1
     */
    public Throwable getCause ()
    {
        return cause;
    }

    /**
     * Return the original exception cause. This will recursively
     * extract the cause if cause is a subclass of
     * <code>RethrowableException</code>.
     * @return underlying root cause
     * @since 1.1
     */
    public Throwable getRootCause ()
    {
        Throwable t = cause;
        while (t != null && t instanceof RethrowableRuntimeException)

File Line
org/webmacro/parser/ASCII_CharStream.java 198
org/webmacro/parser/BackupCharStream.java 209
        if (backupChars > 0)
            --backupChars;
        else
            UpdateLineColumn(c);

        return (c);
    }

    /**
     * @deprecated
     * @see #getEndColumn
     */

    public final int getColumn ()
    {
        return curBuf.bufcolumn[curBuf.curPos];
    }

    /**
     * @deprecated
     * @see #getEndLine
     */

    public final int getLine ()
    {
        return curBuf.bufline[curBuf.curPos];
    }

    public final int getEndColumn ()
    {
        return curBuf.bufcolumn[curBuf.curPos];
    }

    public final int getEndLine ()
    {
        return curBuf.bufline[curBuf.curPos];
    }

    public final int getBeginColumn ()
    {
        return tokenBeginBuf.bufcolumn[tokenBeginPos];
    }

    public final int getBeginLine ()
    {
        return tokenBeginBuf.bufline[tokenBeginPos];
    }

    public final void backup (int amount)
    {
        backupChars += amount;
        if (curBuf.curPos - amount < 0)
        {
            int addlChars = amount - (inputStreamClosed ? 0 : 1) - curBuf.curPos;

File Line
org/webmacro/parser/WMParser_implTokenManager.java 385
org/webmacro/parser/WMParser_implTokenManager.java 1232
                  jjCheckNAdd(4);
                  break;
               default : break;
            }
         } while(i != startsAt);
      }
      else
      {
         int hiByte = (int)(curChar >> 8);
         int i1 = hiByte >> 6;
         long l1 = 1L << (hiByte & 077);
         int i2 = (curChar & 0xff) >> 6;
         long l2 = 1L << (curChar & 077);
         do
         {
            switch(jjstateSet[--i])
            {
               case 1:
                  if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 21)
                     kind = 21;
                  break;
               case 0:
               case 4:
                  if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
                     break;
                  if (kind > 58)

File Line
org/webmacro/parser/ASCII_CharStream.java 70
org/webmacro/parser/BackupCharStream.java 72
    private final void swapBuf ()
    {
        Buffer tmp = curBuf;
        curBuf = otherBuf;
        otherBuf = tmp;
    }

    private final void FillBuff () throws java.io.IOException
    {
        // Buffer fill logic:
        // If there is at least 2K left in this buffer, just read some more
        // Otherwise, if we're processing a token and it either
        // (a) starts in the other buffer (meaning it's filled both part of
        //     the other buffer and some of this one, or
        // (b) starts in the first 2K of this buffer (meaning its taken up
        //     most of this buffer
        // we expand this buffer.  Otherwise, we swap buffers.
        // This guarantees we will be able to back up at least 2K characters.
        if (curBuf.size - curBuf.dataLen < 2048)
        {
            if (tokenBeginPos >= 0
                    && ((tokenBeginBuf == curBuf && tokenBeginPos < 2048)
                    || tokenBeginBuf != curBuf))
            {
                curBuf.expand(2048);
            }
            else
            {
                swapBuf();
                curBuf.curPos = curBuf.dataLen = 0;
            }
        }

        try
        {
            int i = inputStream.read(curBuf.buffer, curBuf.dataLen,
                    curBuf.size - curBuf.dataLen);
            if (i == -1)
            {
                inputStream.close();

File Line
org/webmacro/engine/IntrospectionUtils.java 98
org/webmacro/util/Instantiator.java 190
      if (args == null)
      {
         o = c.newInstance();
      }
      else
      {
         java.lang.reflect.Constructor[] cons = c.getConstructors();
         for (int i = 0; i < cons.length; i++)
         {
            if (cons[i].getParameterTypes().length == args.length)
            {
               // try to instantiate using this constructor
               try
               {
                  o = cons[i].newInstance(args);
                  break; // if successful, we're done!
               }
               catch (Exception e)
               {
                  // ignore
               }
            }
         }
         if (o == null)
         {
            throw new InstantiationException(
                     "Unable to construct object of type " + c.getName()
                              + " using the supplied arguments: "
                              + java.util.Arrays.asList(args).toString());
         }
      }
      return o;
   }

File Line
org/webmacro/parser/WMParser_implTokenManager.java 345
org/webmacro/parser/WMParser_implTokenManager.java 1192
                  jjCheckNAdd(4);
                  break;
               case 2:
                  if (curChar == 10 && kind > 21)
                     kind = 21;
                  break;
               case 3:
                  if (curChar == 13)
                     jjstateSet[jjnewStateCnt++] = 2;
                  break;
               default : break;
            }
         } while(i != startsAt);
      }
      else if (curChar < 128)
      {
         long l = 1L << (curChar & 077);
         do
         {
            switch(jjstateSet[--i])
            {
               case 1:
                  if ((0xf8000001f8000001L & l) != 0L && kind > 21)
                     kind = 21;
                  break;
               case 0:
                  if ((0xffffffffefffffffL & l) != 0L)
                  {
                     if (kind > 58)

File Line
org/webmacro/parser/ASCII_CharStream.java 278
org/webmacro/parser/BackupCharStream.java 295
        line = startline;
        column = startcolumn - 1;

        if (bufA == null || bufA.size != buffersize)
            bufA = new Buffer(buffersize);
        if (bufB == null || bufB.size != buffersize)
            bufB = new Buffer(buffersize);
        curBuf = bufA;
        otherBuf = bufB;
        curBuf.curPos = otherBuf.dataLen = -1;
        curBuf.dataLen = otherBuf.dataLen = 0;

        prevCharIsLF = prevCharIsCR = false;
        tokenBeginPos = -1;
        tokenBeginBuf = null;
        backupChars = 0;
    }

    public void ReInit (java.io.Reader dstream, int startline,
                        int startcolumn)
    {
        ReInit(dstream, startline, startcolumn, 4096);
    }

    public void ReInit (java.io.Reader dstream)

File Line
org/webmacro/parser/WMParser_implTokenManager.java 312
org/webmacro/parser/WMParser_implTokenManager.java 1159
private int jjMoveNfa_0(int startState, int curPos)
{
   int startsAt = 0;
   jjnewStateCnt = 5;
   int i = 1;
   jjstateSet[0] = startState;
   int kind = 0x7fffffff;
   for (;;)
   {
      if (++jjround == 0x7fffffff)
         ReInitRounds();
      if (curChar < 64)
      {
         long l = 1L << curChar;
         do
         {
            switch(jjstateSet[--i])
            {
               case 1:
                  if ((0xfc00ffffffffffffL & l) != 0L)
                  {
                     if (kind > 21)
                        kind = 21;
                  }
                  if (curChar == 13)
                     jjstateSet[jjnewStateCnt++] = 2;
                  break;
               case 0:
               case 4:
                  if ((0xffffff6fffffdbffL & l) == 0L)

File Line
org/webmacro/parser/ASCII_CharStream.java 308
org/webmacro/parser/BackupCharStream.java 330
    public BackupCharStream (java.io.InputStream dstream, int startline,
                             int startcolumn)
    {
        this(dstream, startline, startcolumn, 4096);
    }

    public void ReInit (java.io.InputStream dstream, int startline,
                        int startcolumn, int buffersize)
    {
        ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn,
                4096);
    }

    public void ReInit (java.io.InputStream dstream, int startline,
                        int startcolumn)
    {
        ReInit(dstream, startline, startcolumn, 4096);
    }

    public final String GetImage ()
    {