Package net.sf.joafip.meminspector.service

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


        final StringBuilder stringBuilder=new StringBuilder();
        for(INodeForObject nodeOfList:list) {
          stringBuilder.append(nodeOfList.toString());
          stringBuilder.append('\n');
        }
        throw new MemInspectorException(
            "main father node infinite loop.\ncurrent:\n"+current+"\npath:\n"+stringBuilder.toString());
      } else {
        list.addFirst(current);
        current = current.getMainFatherNode();
      }
    } while (current != null);
    if (!rootNode.equals(list.peekFirst())) {
      throw new MemInspectorException("first node must be root node");
    }
    return list;
  }
View Full Code Here


        final StringBuilder stringBuilder=new StringBuilder();
        for(INodeForObject nodeOfList:list) {
          stringBuilder.append(nodeOfList.toString());
          stringBuilder.append('\n');
        }
        throw new MemInspectorException(
            "main father node infinite loop.\ncurrent:\n"+current+"\npath:\n"+stringBuilder.toString());
      } else {
        list.addFirst(current);
        current = current.getMainFatherNode();
      }
    } while (current != null);
    if (!rootNode.equals(list.peekFirst())) {
      throw new MemInspectorException("first node must be root node");
    }
    return list;
  }
View Full Code Here

              | (((lengthArray[3]) & 0xff) << 24);
          final byte[] data = new byte[length];// NOPMD
          final int read = bufferedInputStream.read(data);
          if (read != length) {
            bufferedInputStream.close();
            throw new MemInspectorException("read " + read
                + " for " + length + " expected");
          }
          final ByteArrayInputStream byteArrayInputStream =
          /**/new ByteArrayInputStream(data);// NOPMD
          final ObjectInputStream objectInputStream =
          /**/new ObjectInputStream(byteArrayInputStream);// NOPMD
          final NodeForObjectTO nodeForObjectTO = (NodeForObjectTO) objectInputStream
              .readObject();
          objectInputStream.close();
          add(map, nodeForObjectTO);
        }
      }
      bufferedInputStream.close();
      return createNodeForObjectModel(map, new NodeIdentifier(rootNodeId),readProgressFrame);
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    } catch (IOException exception) {
      throw new MemInspectorException(exception);
    } catch (ClassNotFoundException exception) {
      throw new MemInspectorException(exception);
    }
  }
View Full Code Here

    nodeInfo.nodeForObject = null;
    nodeInfo.childIdSet = nodeForObjectTO.getChildNodeSet();
    nodeInfo.fatherIdSet = nodeForObjectTO.getFatherNodeIdSet();
    final NodeIdentifier nodeId = nodeForObjectTO.getId();
    if (map.put(nodeId, nodeInfo) != null) {
      throw new MemInspectorException("duplicate id #" + nodeId);
    }
  }
View Full Code Here

            nodeForObjectTO.getFieldIsStaticMap(),
            nodeForObjectTO.getObjectSize());
        nodeInfo.nodeForObject = nodeForObject;
        nodeForObjectModel.add(nodeForObject);
      } else {
        throw new MemInspectorException("node object must not be set");
      }
    }

    // create father link
    for (NodeInfo nodeInfo : map.values()) {

      NodeForObject nodeForObject = nodeInfo.nodeForObject;
      if (nodeForObject == null) {
        throw new MemInspectorException("node object must be set");
      }
      final NodeForObjectTO nodeForObjectTO = nodeInfo.nodeForObjectTO;
      final NodeIdentifier mainFatherId = nodeForObjectTO
          .getMainFatherNodeId();
      final NodeForObject mainFatherNode;
      if (mainFatherId == null) {
        mainFatherNode = null;
      } else {
        final NodeInfo fatherNodeInfo = map.get(mainFatherId);
        if (fatherNodeInfo == null) {
          throw new MemInspectorException("node of id #"
              + mainFatherId + " must exist");
        }
        mainFatherNode = fatherNodeInfo.nodeForObject;
      }
      nodeForObject.setMainFatherNode(mainFatherNode);

      for (NodeIdentifier fatherId : nodeInfo.fatherIdSet) {
        final NodeInfo fatherNodeInfo = map.get(fatherId);
        if (fatherNodeInfo == null) {
          // throw new MemInspectorException(
          // "missing node info for node #" + fatherId);
          LOGGER.warn("missing node info for node #" + fatherId
              + " father of " + nodeInfo.nodeForObject);
        } else {
          final NodeForObject fatherNode = map.get(fatherId).nodeForObject;
          if (fatherNode == null) {
            throw new MemInspectorException("missing node #"
                + fatherId + ", fatherNodeInfo="
                + fatherNodeInfo + ", node="
                + nodeInfo.nodeForObject);
          }
          nodeForObject.addFather(fatherNode);
        }
      }
    }

    // create child link
    for (NodeInfo nodeInfo : map.values()) {
      NodeForObject nodeForObject = nodeInfo.nodeForObject;
      for (NodeIdentifier childId : nodeInfo.childIdSet) {
        final NodeInfo childNodeInfo = map.get(childId);
        if (childNodeInfo == null) {
          throw new MemInspectorException(
              "missing node info for node #" + childId);
        }
        final NodeForObject childNode = map.get(childId).nodeForObject;
        if (childNode == null) {
          throw new MemInspectorException("missing node #" + childId
              + ", childNodeInfo=" + childNodeInfo + ", node="
              + nodeInfo.nodeForObject);
        }
        nodeForObject.addChild(childNode);
      }
View Full Code Here

          stringBuilder.append("first fathers:\n");
          for(NodeForObject inSetElt:fatherNodeSet) {
            stringBuilder.append(inSetElt.toString());
            stringBuilder.append('\n');
          }
          throw new MemInspectorException("father infinite loop\n"+stringBuilder.toString());
        }
        path.addFirst(current);
        current=current.getMainFatherNode();
      }
    }
View Full Code Here

    try {
      final InputStream inputStream = new FileInputStream(fileName);
      final XMLDecoder xmlDecoder = new XMLDecoder(inputStream);
      return (INodeForObject) xmlDecoder.readObject();
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    }
  }
View Full Code Here

    final INodeForObject fromXML;
    try {
      inputStream = new FileInputStream(fileName);
      fromXML = (INodeForObject) stream.fromXML(inputStream);
    } catch (FileNotFoundException exception) {
      throw new MemInspectorException(exception);
    } finally {
      if (inputStream != null) {
        try {
          inputStream.close();
        } catch (IOException exception) {// NOPMD
View Full Code Here

                addChild(list, referencingObject,
                    referencedObject,
                    referencingDeclaringClassName,
                    fieldName, staticField);
              } catch (IllegalArgumentException exception) {
                throw new MemInspectorException(exception);
              } catch (IllegalAccessException exception) {
                throw new MemInspectorException(exception);
              }
              field.setAccessible(false);
            }
          }
        }
View Full Code Here

  }

  public boolean contains(final Object object) throws MemInspectorException {
    final boolean contains;
    if (object == null) {
      throw new MemInspectorException("object must not be null");
    }
    final WeakObjectIdentityKey key = new WeakObjectIdentityKey(object);
    contains = nodeForObjectByWeakMap.containsKey(key);

    return contains;
View Full Code Here

TOP

Related Classes of net.sf.joafip.meminspector.service.MemInspectorException

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.