Package org.structr.common.error

Examples of org.structr.common.error.FrameworkException


            // add to list of searchable keys
            searchKeys.add(key);

          } else if (!JsonRestServlet.commonRequestParameters.contains(name)) {

            throw new FrameworkException(400, "Search key " + name + " is not indexed.");
          }

        } else if (!JsonRestServlet.commonRequestParameters.contains(name)) {

          // exclude common request parameters here (should not throw exception)
          throw new FrameworkException(400, "Invalid search key " + name);
        }
      }

      // sort list of search keys according to their desired order
      // so that querying search attributes can use other attributes
View Full Code Here


        if (targetNode == null) {
          errorBuffer.add(entityClass.getSimpleName(), new EmptyPropertyToken(template.getTargetIdProperty()));
        }

        if (errorBuffer.hasError()) {
          throw new FrameworkException(422, errorBuffer);
        }

        newRelationship = app.create(sourceNode, targetNode, entityClass, properties);

        RestMethodResult result = new RestMethodResult(HttpServletResponse.SC_CREATED);
View Full Code Here

    final long abortTime = System.currentTimeMillis() + CloudService.DEFAULT_TIMEOUT;

    while (!authenticated) {

      if (errorMessage != null) {
        throw new FrameworkException(errorCode, errorMessage);
      }

      if (System.currentTimeMillis() > abortTime) {

        throw new FrameworkException(504, "Authentication failed.");
      }

      try {
        Thread.sleep(10);
      } catch (Throwable t) {
View Full Code Here

    transmissionAbortTime = System.currentTimeMillis() + CloudService.DEFAULT_TIMEOUT;

    while (context.getCurrentProgress() < context.getTotalSize()) {

      if (errorMessage != null) {
        throw new FrameworkException(errorCode, errorMessage);
      }

      if (System.currentTimeMillis() > transmissionAbortTime) {

        throw new FrameworkException(504, "Timeout while waiting for response.");
      }

      try {
        Thread.sleep(10);
      } catch (Throwable t) {
View Full Code Here

              logger.log(Level.INFO, "Unable to establish connection to {0}, trying again after {1} sec...", new Object[]{ newLocation, attempts*10 });
              attempts++;

              if (attempts > 3) {
                throw new FrameworkException(500, "Error while parsing content from " + newLocation + ", couldn't establish connections after " + attempts + " attempts");
              }

              try {
                Thread.sleep(attempts*10*1000);

              } catch (InterruptedException ex) {}

            }
          }
        }

        // Skip BOM to workaround this Jsoup bug: https://github.com/jhy/jsoup/issues/348
        code = IOUtils.toString(resp.getEntity().getContent(), "UTF-8");

        if (code.charAt(0) == 65279) {
          code = code.substring(1);
        }

        parsedDocument = Jsoup.parse(code);

      } catch (IOException ioe) {

        throw new FrameworkException(500, "Error while parsing content from " + address);

      }

    }

View Full Code Here

        }
      }
    }

    errorBuffer.add(SchemaNode.class.getSimpleName(), new InvalidPropertySchemaToken(source, "invalid_property_definition", "Unknow value type " + source + ", options are " + Arrays.asList(Type.values()) + "."));
    throw new FrameworkException(422, errorBuffer);
  }
View Full Code Here

        } catch (Throwable t) {

          logger.log(Level.WARNING, "Unable to convert {0} to Long.", source);

          throw new FrameworkException(declaringClass.getSimpleName(), new NumberToken(LongProperty.this));
        }
      }

      return null;
    }
View Full Code Here

    // when there are no child rels, this is an append operation
    if (rels.isEmpty()) {

      // we have no children, but the ref child is non-null => can't be ours.. :)
      if (refChild != null) {
        throw new FrameworkException(404, "Referenced child is not a child of parent node.");
      }

      treeAppendChild(newChild);
      return;
    }

    for (R rel : rels) {

      T node = rel.getTargetNode();
      if (node.equals(refChild)) {

        // will be used only once here..
        PropertyMap properties = new PropertyMap();
        properties.put(AbstractChildren.position, position);

        linkNodes(getChildLinkType(), (T) LinkedTreeNode.this, newChild, properties);

        found = true;

        position++;
      }

      rel.setProperty(AbstractChildren.position, position);

      position++;
    }

    // if child is not found, raise an exception
    if (!found) {
      throw new FrameworkException(404, "Referenced child is not a child of parent node.");
    }

    // insert new node in linked list
    LinkedTreeNode.super.listInsertBefore(refChild, newChild);
   
View Full Code Here

        // lock read-only properties again
        readOnlyPropertiesUnlocked = false;

      } else {

        throw new FrameworkException(getClass().getSimpleName(), new ReadOnlyPropertyToken(key));
      }

    }

    key.setProperty(securityContext, this, value);
View Full Code Here

    final Class relationType         = getClass();
    final PropertyMap _props         = getProperties();
    final String type                = this.getClass().getSimpleName();

    if (newStartNode == null) {
      throw new FrameworkException(type, new IdNotFoundToken(startNodeId));
    }

    // delete this as the new rel will be the container afterwards
    app.delete(this);
View Full Code Here

TOP

Related Classes of org.structr.common.error.FrameworkException

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.