Package com.gentics.cr

Examples of com.gentics.cr.CRError


        objstream.close();

        if (responseObject instanceof Collection<?>) {
          result = this.toCRResolvableBeanCollection(responseObject);
        } else if (responseObject instanceof CRError) {
          CRError ex = (CRError) responseObject;
          throw new CRException(ex);
        } else {
          log.error("COULD NOT CAST RESULT. Perhaps remote agent does not work properly");
        }
View Full Code Here


   * @param ex
   * @param isDebug
   */
  public void respondWithError(OutputStream stream, CRException ex, boolean isDebug) {

    CRError e = new CRError(ex);
    if (!isDebug) {
      e.setStringStackTrace(null);
    }

    serialize(e, stream);

  }
View Full Code Here

   * @param ex
   * @param isDebug
   */
  public void respondWithError(OutputStream stream, CRException ex, boolean isDebug) {

    CRError e = new CRError(ex);
    if (!isDebug) {
      e.setStringStackTrace(null);
    }

    XMLEncoder enc = new XMLEncoder(new BufferedOutputStream(stream));

    enc.writeObject(e);
View Full Code Here

   * @param isDebug
   *
   */
  public final void respondWithError(final OutputStream stream, final CRException ex, final boolean isDebug) {

    CRError e = new CRError(ex);
    if (!isDebug) {
      e.setStringStackTrace(null);
    }
    PrintWriter pw = new PrintWriter(stream);

    pw.write(e.getMessage() + " - " + e.getStringStackTrace());
    pw.flush();
    pw.close();
  }
View Full Code Here

              idAttribute);
        } else {
          log.error("IndexLocation is not created for Lucene. " + "Using the " + CRLuceneIndexJob.class.getName()
              + " requires that you use the " + LuceneIndexLocation.class.getName()
              + ". You can configure another Job by setting the " + IndexLocation.UPDATEJOBCLASS_KEY + " key in your config.");
          throw new CRException(new CRError("Error", "IndexLocation is not created for Lucene."));
        }
        Collection<CRResolvableBean> objectsToIndex = null;
        //Clear Index and remove stale Documents
        //if (!create) {
        log.debug("Will do differential index.");
        try {
          CRRequest req = new CRRequest();
          req.setRequestFilter(rule);
          req.set(CR_FIELD_KEY, crid);
          status.setCurrentStatusString("Get objects to update " + "in the index ...");
          objectsToIndex = getObjectsToUpdate(req, rp, false, luceneIndexUpdateChecker);
        } catch (Exception e) {
          log.error("ERROR while cleaning index", e);
        }
        //}
        //Obtain accessor and writer after clean
        if (indexLocation instanceof LuceneIndexLocation) {
          indexAccessor = ((LuceneIndexLocation) indexLocation).getAccessor();
          indexWriter = indexAccessor.getWriter();
          indexReader = indexAccessor.getReader(false);
          useFacets = ((LuceneIndexLocation) indexLocation).useFacets();
          if (useFacets) {
            taxonomyAccessor = ((LuceneIndexLocation) indexLocation).getTaxonomyAccessor();
            taxonomyWriter = taxonomyAccessor.getTaxonomyWriter();
          }
        } else {
          log.error("IndexLocation is not created for Lucene. " + "Using the " + CRLuceneIndexJob.class.getName()
              + " requires that you use the " + LuceneIndexLocation.class.getName()
              + ". You can configure another Job by setting the " + IndexLocation.UPDATEJOBCLASS_KEY + " key in your config.");
          throw new CRException(new CRError("Error", "IndexLocation is not created for Lucene."));
        }
        log.debug("Using rule: " + rule);
        // prepare the map of indexed/stored attributes
        Map<String, Boolean> attributes = new HashMap<String, Boolean>();
        List<String> containedAttributes = IndexerUtil.getListFromString(config.getString(CONTAINED_ATTRIBUTES_KEY), ",");
View Full Code Here

    if (count <= 0) {
      String message = "Default count is lower or equal to 0! This will "
          + "result in an error. Overthink your config (insert rp."
          + "<number>.searchcount=<value> in your properties file)!";
      LOGGER.error(message);
      throw new CRException(new CRError("Error", message));
    }
    return count;
  }
View Full Code Here

  private int getStart(final CRRequest request) throws CRException {
    int start = request.getStart();
    if (start < 0) {
      String message = "Bad request: start is lower than 0!";
      LOGGER.error(message);
      throw new CRException(new CRError("Error", message));
    }
    return start;
  }
View Full Code Here

      } catch (Exception e) {
        log.error("Failed to load velocity template from " + template, e);
      }
    }
    if (template == null && !loadErrorTemplate) {
      throw new CRException(new CRError("ERROR", "The template " + template + " cannot be found."));
    }
    if (errorTemplate == null && loadErrorTemplate) {
      throw new CRException(new CRError("ERROR", "The template " + template + " cannot be found."));
    }
  }
View Full Code Here

TOP

Related Classes of com.gentics.cr.CRError

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.