Package com.caucho.quercus

Examples of com.caucho.quercus.QuercusException


            is.close();
        } catch (IOException e) {
        }
      }
    } catch (Exception e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here


    // XXX: temp for memory issues
    if (msg != null && msg.length() > 4096) {
      msg = msg.substring(0, 4096);
    }

    _compileException = new QuercusException(msg);
  }
View Full Code Here

  public Value addFunction(String name, AbstractFunction fun)
  {
    AbstractFunction oldFun = findFunction(name);

    if (oldFun != null) {
      throw new QuercusException(L.l("can't redefine function {0}", name));
    }

    copyOnWrite();
    _funMap.put(name, fun);
    _crc = Crc64.generate(_crc, name);
View Full Code Here

  {
    try {
      if (_os != null)
  _os.flush();
    } catch (IOException e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

        return null;
      }

      return (Set) _entrySet.invoke(obj);
    } catch (Exception e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

        Env.getCurrent().addCleanup(new EnvCloseable(is));

        return is;
      } catch (IOException e) {
        throw new QuercusException(e);
      }
    }
    else
      return super.toInputStream();
  }
View Full Code Here

      throw e;
    } catch (InvocationTargetException e) {
      if (e.getCause() instanceof RuntimeException)
        throw (RuntimeException) e.getCause();
      else
        throw new QuercusException(e.getCause());
    } catch (Exception e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

        throw (QuercusException) e1;
     
      String methodName = (_method.getDeclaringClass().getName() + "."
                           + _method.getName());

      throw new QuercusException(methodName + ": " + e1.getMessage(), e1);
    } catch (Exception e) {
      String methodName = (_method.getDeclaringClass().getName() + "."
         + _method.getName());
     
      throw new QuercusException(methodName + ": " + e.getMessage(), e);
    }
  }
View Full Code Here

                _defaultExprs[i] = QuercusParser.parseDefault(exprFactory, opt.value());
              }
            } else if (Reference.class.isAssignableFrom(ann.annotationType())) {
              if (! Value.class.equals(argType)
                  && ! Var.class.equals(argType)) {
                throw new QuercusException(L.l("reference must be Value or Var for {0}",
                                               _name));
              }
             
              isReference = true;
            } else if (PassThru.class.isAssignableFrom(ann.annotationType())) {
              if (! Value.class.equals(argType)) {
                throw new QuercusException(L.l("pass thru must be Value for {0}",
                                               _name));
              }
             
              isPassThru = true;
            } else if (NotNull.class.isAssignableFrom(ann.annotationType())) {
              isNotNull = true;
            } else if (Expect.class.isAssignableFrom(ann.annotationType())) {
              if (! Value.class.equals(argType)) {
                throw new QuercusException(L.l("Expect type must be Value for {0}",
                                               _name));
              }
             
              Expect.Type type = ((Expect) ann).type();
             
View Full Code Here

    else if (delim == '(')
      delim = ')';
    else if (delim == '<')
      delim = '>';
    else if (delim == '\\' || Character.isLetterOrDigit(delim)) {
      throw new QuercusException(L.l(
          "Delimiter {0} in regexp '{1}' must not be backslash or alphanumeric.",
          String.valueOf(delim),
          rawRegexp));
    }

    int tail = rawRegexp.lastIndexOf(delim);

    if (tail <= 0)
      throw new QuercusException(L.l(
          "Can't find second {0} in regexp '{1}'.",
          String.valueOf(delim),
          rawRegexp));

    StringValue sflags = rawRegexp.substring(tail);
    StringValue pattern = rawRegexp.substring(head + 1, tail);
   
    _pattern = pattern;
   
    int flags = 0;
   
    for (int i = 0; sflags != null && i < sflags.length(); i++) {
      switch (sflags.charAt(i)) {
        case 'm': flags |= Regcomp.MULTILINE; break;
        case 's': flags |= Regcomp.SINGLE_LINE; break;
        case 'i': flags |= Regcomp.IGNORE_CASE; break;
        case 'x': flags |= Regcomp.IGNORE_WS; break;
        case 'g': flags |= Regcomp.GLOBAL; break;
       
        case 'A': flags |= Regcomp.ANCHORED; break;
        case 'D': flags |= Regcomp.END_ONLY; break;
        case 'U': flags |= Regcomp.UNGREEDY; break;
        case 'X': flags |= Regcomp.STRICT; break;
       
        case 'u': flags |= Regcomp.UTF8; break;
        case 'e': _isEval = true; break;
      }
    }
   
    _flags = flags;

    // XXX: what if unicode.semantics='true'?
   
    if ((flags & Regcomp.UTF8) != 0) {
      _pattern = fromUtf8(pattern);
     
      if (pattern == null)
        throw new QuercusException(L.l("Regexp: error converting subject to utf8"));
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.quercus.QuercusException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.