Package com.caucho.quercus

Examples of com.caucho.quercus.QuercusException


   
    if (isSecure) {
      try {
        _socket = createSSLSocket(host, port);
      } catch (KeyManagementException e) {
        throw new QuercusException(e);
      } catch (NoSuchAlgorithmException e) {
        throw new QuercusException(e);
      }
  }
    else
      _socket = SocketFactory.getDefault().createSocket(host, port);
   
View Full Code Here


  {
    try {
      subject = _regexp.convertSubject(env, subject);

      if (subject == null)
        throw new QuercusException(L.l("error converting subject to utf8"));

      _subject = subject;
      _subjectLength = subject != null ? subject.length() : 0;
      _first = 0;
View Full Code Here

        log.finest(this + " find(" + subject + ")");

      subject = _regexp.convertSubject(env, subject);

      if (subject == null)
        throw new QuercusException(L.l("error converting subject to utf8"));

      _subject = subject;
      _subjectLength = subject != null ? subject.length() : 0;

      _first = first;
View Full Code Here

      Iterator it = ImageIO.getImageReaders(file.openRead());
      if (!it.hasNext())
  return BooleanValue.FALSE;
      ImageReader imageReader = (ImageReader)it.next();
      if (it.hasNext())
  throw new QuercusException("ImageIO returned two ImageReaders:\n  "+
           imageReader+"\n  "+it.next());
      String formatName = imageReader.getFormatName();
      if (formatName.equals("jpeg") || formatName.equals("jpg"))
  return LongValue.create(ImageModule.IMAGETYPE_JPG);
      if (formatName.equals("gif"))
  return LongValue.create(ImageModule.IMAGETYPE_GIF);
      if (formatName.equals("png"))
  return LongValue.create(ImageModule.IMAGETYPE_PNG);
      if (formatName.equals("swf"))
  return LongValue.create(ImageModule.IMAGETYPE_SWF);
      if (formatName.equals("psd"))
  return LongValue.create(ImageModule.IMAGETYPE_PSD);
      if (formatName.equals("bmp"))
  return LongValue.create(ImageModule.IMAGETYPE_BMP);
      if (formatName.equals("tiff"))
  return LongValue.create(ImageModule.IMAGETYPE_TIFF_II);
      /*
      // XXX: check byte order
      if (formatName.equals("tiff"))
      return ImageModule.IMAGETYPE_TIFF_MM;
      */
      if (formatName.equals("jpc"))
  return LongValue.create(ImageModule.IMAGETYPE_JPC);
      if (formatName.equals("jp2"))
  return LongValue.create(ImageModule.IMAGETYPE_JP2);
      if (formatName.equals("jpf"))
  return LongValue.create(ImageModule.IMAGETYPE_JPX);
      if (formatName.equals("jb2"))
  return LongValue.create(ImageModule.IMAGETYPE_JB2);
      if (formatName.equals("swc"))
  return LongValue.create(ImageModule.IMAGETYPE_SWC);
      if (formatName.equals("iff"))
  return LongValue.create(ImageModule.IMAGETYPE_IFF);
      if (formatName.equals("wbmp"))
  return LongValue.create(ImageModule.IMAGETYPE_WBMP);
      if (formatName.equals("xbm"))
  return LongValue.create(ImageModule.IMAGETYPE_XBM);
      env.warning(L.l("ImageIO returned unknown image type: " + formatName));
      return BooleanValue.FALSE;
    }
    catch (IOException e)
      {
  throw new QuercusException(e);
      }
  }
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 + 1);
    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 'S': /* speedup */; break;
       
      case 'u': flags |= Regcomp.UTF8; break;
      case 'e': _isEval = true; break;

      default:
        throw new QuercusException(L.l("'{0}' is an unknown regexp flag in {1}",
                                       (char) sflags.charAt(i), rawRegexp));
      }
    }
   
    _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

      if (value == null)
        value = NullValue.NULL;

      return value;
    } catch (IOException e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

    _resultSetMetaData = metaData;
   
    try {
      _columnEncodings = new String[metaData.getColumnCount()];
    } catch (SQLException e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

      Object result = method.invoke(_resultSetMetaData, column);
     
      return (String) result;
     
    } catch (NoSuchMethodException e) {
      throw new QuercusException(e);
    } catch (InvocationTargetException e) {
      throw new QuercusException(e);
    } catch (IllegalAccessException e) {
      throw new QuercusException(e);
    }
  }
View Full Code Here

    if (target instanceof ObjectValue) {
      return target.getIterator(env);
    }
    else
      throw new QuercusException(L.l("'{0}' is not a valid Traversable",
             qThis));
  }
View Full Code Here

    Value target = getTarget(env, qThis);
   
    if (target instanceof ObjectValue)
      return _iteratorDelegate.getKeyIterator(env, (ObjectValue) target);
    else
      throw new QuercusException(L.l("'{0}' is not a valid Traversable",
             qThis));
  }
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.