[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Illegal tokens

alesj do-not-reply at jboss.com
Fri Nov 7 10:46:28 EST 2008


"scott.stark at jboss.org" wrote : I don't see that we are helping as '.*x' is a valid file name. We just need to handle the distinct names '.' and '..' as relative paths and anything else is just another name, however strange it might be.
  | 
OK, I'll disable it by default:

  | +   /** Catch some suspicious tokens */
  | +   private static boolean errorOnSuspiciousTokens;
  | +
  |     /**
  |      * Utility class
  |      */
  | @@ -124,7 +127,13 @@
  |              else if (specialToken == CURRENT_PATH && bufferLength == 0)
  |                 specialToken = REVERSE_PATH;
  |              else if (specialToken == REVERSE_PATH && bufferLength == 0)
  | -               throw new IllegalArgumentException("Illegal token (" + specialToken + ch + ") in path: " + path);
  | +            {
  | +               if (errorOnSuspiciousTokens)
  | +                  throw new IllegalArgumentException("Illegal token (" + specialToken + ch + ") in path: " + path);
  | +
  | +               buffer.append(specialToken).append(ch);
  | +               specialToken = null;
  | +            }
  |              else
  |                 buffer.append(ch);
  |           }
  | @@ -134,7 +143,7 @@
  |              if (specialToken != null)
  |              {
  |                 // we don't allow tokens after '..'
  | -               if (specialToken == REVERSE_PATH)
  | +               if (errorOnSuspiciousTokens && specialToken == REVERSE_PATH)
  |                    throw new IllegalArgumentException("Illegal token (" + specialToken + ch + ") in path: " + path);
  | 
  |                 // after '.' more path is legal == unix hidden directories
  | @@ -222,4 +231,14 @@
  |     {
  |        return REVERSE_PATH == token;
  |     }
  | +
  | +   /**
  | +    * Set errorOnSuspiciousTokens flag.
  | +    *
  | +    * @param errorOnSuspiciousTokens the errorOnSuspiciousTokens flag
  | +    */
  | +   public static void setErrorOnSuspiciousTokens(boolean errorOnSuspiciousTokens)
  | +   {
  | +      PathTokenizer.errorOnSuspiciousTokens = errorOnSuspiciousTokens;
  | +   }
  | 
But advanced user can still turn it on.
e.g. initialize.xml in JBossAS



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187756#4187756

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187756



More information about the jboss-dev-forums mailing list