Examples of MemInspectorException


Examples of net.sf.joafip.meminspector.service.MemInspectorException

    super(fatherNode);
    if (fatherNode != null) {
      fatherNodeSet.add(fatherNode);
    }
    if (weakObject == null) {
      throw new MemInspectorException("weak object must be defined");
    }
    final Object object = weakObject.getObject();
    if (object == null) {
      throw new MemInspectorException("weak object must reference object");
    }
    this.weakObject = weakObject;
    identityHashCode = weakObject.hashCode();
    objectClassName = object.getClass().getName();
    leafNode = false;
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

  }

  public void addFather(final NodeForObject fatherNode)
      throws MemInspectorException {
    if (fatherNode == null) {
      throw new MemInspectorException("father node must be defined");
    }
    fatherNodeSet.add(fatherNode);
  }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

      throws MemInspectorException {
    if (!childNode.getFatherNodeSet().contains(this)) {
      final boolean thisIsMainFatherOfChild = childNode
          .getMainFatherNode() == this;
      if (thisIsMainFatherOfChild) {
        throw new MemInspectorException("child node \"" + childNode
            + " has this as main father, but not in father set");
      } else {
        throw new MemInspectorException("child node \"" + childNode
            + "\" is not child of this \"" + this
            + "\"\nchild node fathers:\n"
            + childNode.getFatherNodeSet());
      }
    }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

  public void accept(final ITreeNodeForObjectVisitor visitor,
      final Set<NodeForObject> visitedSet, final int depth)
      throws MemInspectorException {
    if (isDeleted()) {
      throw new MemInspectorException("deleted node " + this
          + " must not be attached to object graph");
    }

    /*
     * check if this node attached to root and there is no cycle
     */
    final Set<NodeForObject> set = new LinkedHashSet<NodeForObject>();
    NodeForObject current = this;
    while (!current.rootNode) {
      if (!set.add(current)) {
        final StringBuilder builder = new StringBuilder();// NOPMD
        builder.append("cycle detected\n");
        for (NodeForObject nodeForObject : set) {
          builder.append(nodeForObject);
          builder.append('\n');
        }
        throw new MemInspectorException(builder.toString());
      }
      current = current.getMainFatherNode();
      if (current == null) {
        throw new MemInspectorException(
            "main father node must be defined");
      }
    }

    final boolean firstVisit = visitedSet.add(this);
    visitor.beginVisit(this, firstVisit);
    if (firstVisit) {
      for (NodeForObject childNode : childNodeMap.values()) {

        // has a main father node
        if (!childNode.rootNode
            && childNode.getMainFatherNode() == null) {
          throw new MemInspectorException(
              "main father node must be defined, has father="
                  + (!childNode.fatherNodeSet.isEmpty()),
              childNode.mainFatherNodeNullerTrace);
        }
        // child node has this as father
        if (!childNode.getFatherNodeSet().contains(this)) {
          throw new MemInspectorException(childNode + " must have "
              + this + " as father");
        }
        // visit child
        childNode.accept(visitor, visitedSet, depth + 1);
      }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

    final RedBlackTreeIntegrityChecker<ILinkedListSupportNode<Integer>> checker = new RedBlackTreeIntegrityChecker<ILinkedListSupportNode<Integer>>(
        tree);
    try {
      checker.checkTree();
    } catch (RBTException exception) {
      throw new MemInspectorException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

      }
      if (useCache != null && useCache.booleanValue()) {
        final List<Object> list = memInspector
            .getInstanceOfClass("net.sf.joafip.file.service.RandomAccessFileReadWriteCache");
        if (list.size() != 1) {
          throw new MemInspectorException(
              "bad number of RandomAccessFileReadWriteCache instance: "
                  + list.size());
        }
        final Object fileCache = list.get(0);
        Field field = RandomAccessFileReadWriteCache.class
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

    FileOutputStream outputStream = null;
    try {
      outputStream = new FileOutputStream(outputFile);
      stream.toXML(currentMemoryImage.getRootNode(), outputStream);
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    } finally {
      if (outputStream != null) {
        try {
          outputStream.close();
        } catch (IOException exception) {// NOPMD
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

      final OutputStream out = new FileOutputStream(outputFile);
      final XMLEncoder xmlEncoder = new XMLEncoder(out);
      xmlEncoder.writeObject(currentMemoryImage.getRootNode());
      xmlEncoder.close();
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

              out.write((length >> 8) & 0xff);
              out.write((length >> 16) & 0xff);
              out.write((length >> 24) & 0xff);
              out.write(byteArray);
            } catch (IOException exception) {
              throw new MemInspectorException(exception);
            }
          }
        }

        public void endVisit(final NodeForObject object) {
          // no implementation
        }
      };
      visitCurrent(visitor);
      out.flush();
      out.close();
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    } catch (IOException exception) {
      throw new MemInspectorException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.meminspector.service.MemInspectorException

      final List<ReferencingReferencedCouple> childList)
      throws MemInspectorException {
    final Object fatherObject = inVisit.getReferencedObject();
    if (inVisit.getReferencingObject() == null) {
      if (rootNode != null) {
        throw new MemInspectorException("root node already defined");
      }
      final WeakObjectIdentityKey weakObject = new WeakObjectIdentityKey(
          fatherObject);
      rootNode = new NodeForObject(null, weakObject);
      memorizeNewObject(weakObject, rootNode);
      rootNode.setIsRootNode();
    } else if (rootNode == null) {
      throw new MemInspectorException(
          "root must be defined. referencing is "
              + inVisit.getReferencingObject().getClass());
    }
    addChild(fatherObject, childList);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.