Example usage for java.lang Thread dumpStack

List of usage examples for java.lang Thread dumpStack

Introduction

In this page you can find the example usage for java.lang Thread dumpStack.

Prototype

public static void dumpStack() 

Source Link

Document

Prints a stack trace of the current thread to the standard error stream.

Usage

From source file:l2next.gameserver.model.Player.java

/**
 * Set the template of the L2Player.// w  ww  .  j  a  va 2s  .c om
 *
 * @param id The Identifier of the L2PlayerTemplate to set to the L2Player
 */
public synchronized void setClassId(final int id, boolean noban, boolean fromQuest) {
    ClassId classId = ClassId.VALUES[id];
    if (!noban && !(ClassId.VALUES[id].equalsOrChildOf(ClassId.VALUES[getActiveClassId()])
            || getPlayerAccess().CanChangeClass || Config.EVERYBODY_HAS_ADMIN_RIGHTS)) {
        Thread.dumpStack();
        return;
    }

    ClassId oldClassId = getClassId();
    //   ID   ? ?   ? 
    if (!_subClassList.containsClassId(id)) {
        final SubClass cclass = getActiveSubClass();
        final int oldClass = cclass.getClassId();
        _subClassList.changeSubClassId(oldClass, id);
        changeClassInDb(oldClass, id);
        if (cclass.isBase()) {
            if (getClassId().isOfLevel(ClassLevel.Awaking) && getVar("wasInAcademy") == null) {
                addClanPointsOnProfession(id); //? ,   ,    .
                setVar("wasInAcademy", "true", -1L);
            }
        }

        //  Holy Pomander
        switch (classId) {
        case CARDINAL:
            ItemFunctions.addItem(this, 15307, 7, true);
            break;
        case EVAS_SAINT:
            ItemFunctions.addItem(this, 15308, 7, true);
            break;
        case SHILLIEN_SAINT:
            ItemFunctions.addItem(this, 15309, 7, true);
            break;
        default:
            break;
        }

        rewardSkills(true);
        storeCharSubClasses();
        if (fromQuest) {
            broadcastPacket(new MagicSkillUse(this, this, 5103, 1, 1000, 0));
            broadcastPacket(new SocialAction(getObjectId(), 3));
            sendPacket(new PlaySound("ItemSound.quest_fanfare_2"));
        }
        broadcastCharInfo();
    }

    if (oldClassId == null || !oldClassId.isOfRace(getClassId().getRace())
            || !oldClassId.isOfType(getClassId().getType())) {
        PlayerTemplate t = PlayerTemplateHolder.getInstance().getPlayerTemplate(getRace(), classId,
                Sex.VALUES[getSex()]);
        if (t == null) {
            _log.error("Missing template for classId: " + id);
            return;
        }
        _template = t;
    }

    // Update class icon in party and clan
    if (isInParty()) {
        getParty().broadCast(new PartySmallWindowUpdate(this));
    }
    if (getClan() != null) {
        getClan().broadcastToOnlineMembers(new PledgeShowMemberListUpdate(this));
    }
    if (_matchingRoom != null) {
        _matchingRoom.broadcastPlayerUpdate(this);
    }

    sendPacket(new ExSubjobInfo(this, true));
}

From source file:com.kodemore.utility.Kmu.java

/**
 * A convenience method to print the current stack trace.
 */
public static void printStackTrace() {
    Thread.dumpStack();
}

From source file:com.kodemore.utility.Kmu.java

/**
 * A convenience method to print the current stack trace.
 *//* ww w .  j a  va2 s .co  m*/
public static void printStackTrace(String title) {
    System.out.println(title);
    Thread.dumpStack();
}

From source file:nl.luminis.test.util.annotations.HierarchyDiscovery.java

private void init() {
    types = new HashMap<Type, Class<?>>();
    try {//from  ww w. j  a va2  s .  c  om
        discoverTypes(type);
    } catch (StackOverflowError e) {
        Logger logger = Logger.getLogger(HierarchyDiscovery.class.getName());

        logger.log(Level.WARNING, "type: " + type.toString(), e);
        Thread.dumpStack();
        throw e;
    }
}

From source file:org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon.java

/**
 * Check for RM read/*from   www .ja va2 s .co m*/
 *
 * @param nodeRef
 * @param allowDMRead
 * @return
 */
public int checkRead(NodeRef nodeRef, boolean allowDMRead) {
    int result = AccessDecisionVoter.ACCESS_ABSTAIN;

    if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) {
        result = checkRmRead(nodeRef);
    } else if (allowDMRead) {
        // Check DM read for copy etc
        // DM does not grant - it can only deny
        if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED) {
            if (logger.isDebugEnabled()) {
                logger.debug("\t\tPermission is denied");
                Thread.dumpStack();
            }
            result = AccessDecisionVoter.ACCESS_DENIED;
        } else {
            result = AccessDecisionVoter.ACCESS_GRANTED;
        }
    }

    return result;
}

From source file:org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoter.java

public int vote(Authentication authentication, Object object, ConfigAttributeDefinition config) {
    if (log.isDebugEnabled()) {
        MethodInvocation mi = (MethodInvocation) object;
        log.debug("Method: " + mi.getMethod().toString());
    }//from ww w .  ja va  2  s. c  o m
    if (AuthenticationUtil.isRunAsUserTheSystemUser()) {
        if (log.isDebugEnabled()) {
            log.debug("Access granted for the system user");
        }
        return AccessDecisionVoter.ACCESS_GRANTED;
    }

    List<ConfigAttributeDefintion> supportedDefinitions = extractSupportedDefinitions(config);

    if (supportedDefinitions.size() == 0) {
        return AccessDecisionVoter.ACCESS_ABSTAIN;
    }

    MethodInvocation invocation = (MethodInvocation) object;

    Method method = invocation.getMethod();
    Class<?>[] params = method.getParameterTypes();

    Boolean hasMethodEntry = null;

    for (ConfigAttributeDefintion cad : supportedDefinitions) {
        NodeRef testNodeRef = null;

        if (cad.typeString.equals(ACL_DENY)) {
            return AccessDecisionVoter.ACCESS_DENIED;
        } else if (cad.typeString.equals(ACL_ALLOW)) {
            return AccessDecisionVoter.ACCESS_GRANTED;
        } else if (cad.typeString.equals(ACL_METHOD)) {
            if (hasMethodEntry == null) {
                hasMethodEntry = Boolean.FALSE;
            }

            if (cad.authority.equals(AuthenticationUtil.getRunAsUser())) {
                hasMethodEntry = Boolean.TRUE;
            } else if (authorityService.getAuthorities().contains(cad.authority)) {
                hasMethodEntry = Boolean.TRUE;
            }
        } else if (cad.typeString.equals(ACL_PRI_CHILD_ASSOC_ON_CHILD)) {
            if (cad.parameter.length == 2 && NodeRef.class.isAssignableFrom(params[cad.parameter[0]])
                    && NodeRef.class.isAssignableFrom(params[cad.parameter[1]])) {
                testNodeRef = getArgument(invocation, cad.parameter[1]);
                if (testNodeRef != null) {
                    if (nodeService.exists(testNodeRef)) {
                        if (log.isDebugEnabled()) {
                            log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                        }
                        ChildAssociationRef primaryParent = nodeService.getPrimaryParent(testNodeRef);
                        NodeRef testParentNodeRef = getArgument(invocation, cad.parameter[0]);
                        if (primaryParent == null || testParentNodeRef == null
                                || !testParentNodeRef.equals(primaryParent.getParentRef())) {
                            if (log.isDebugEnabled()) {
                                log.debug("\tPermission test ignoring secondary parent association to "
                                        + testParentNodeRef);
                            }
                            testNodeRef = null;
                        }
                    } else if (log.isDebugEnabled()) {
                        log.debug("\tPermission test on non-existing node " + testNodeRef);
                    }
                }
            } else if (cad.parameter.length == 1
                    && ChildAssociationRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                ChildAssociationRef testParentRef = getArgument(invocation, cad.parameter[0]);
                if (testParentRef != null) {
                    if (testParentRef.isPrimary()) {
                        testNodeRef = testParentRef.getChildRef();
                        if (log.isDebugEnabled()) {
                            if (nodeService.exists(testNodeRef)) {
                                log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                            } else {
                                log.debug("\tPermission test on non-existing node " + testNodeRef);
                            }
                        }
                    } else if (log.isDebugEnabled()) {
                        log.debug("\tPermission test ignoring secondary parent association to "
                                + testParentRef.getParentRef());
                    }
                }
            } else {
                throw new ACLEntryVoterException(
                        "The specified parameter is not a NodeRef or ChildAssociationRef");
            }
        } else if (cad.typeString.equals(ACL_NODE)) {
            if (cad.parameter.length != 1) {
                throw new ACLEntryVoterException(
                        "The specified parameter is not a NodeRef or ChildAssociationRef");
            } else if (StoreRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                StoreRef storeRef = getArgument(invocation, cad.parameter[0]);
                if (storeRef != null) {
                    if (log.isDebugEnabled()) {
                        log.debug("\tPermission test against the store - using permissions on the root node");
                    }
                    if (nodeService.exists(storeRef)) {
                        testNodeRef = nodeService.getRootNode(storeRef);
                    }
                }
            } else if (NodeRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                testNodeRef = getArgument(invocation, cad.parameter[0]);
                if (log.isDebugEnabled()) {
                    if (testNodeRef != null) {
                        if (nodeService.exists(testNodeRef)) {
                            log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                        } else {
                            log.debug("\tPermission test on non-existing node " + testNodeRef);
                        }
                    }
                }
            } else if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                ChildAssociationRef testChildRef = getArgument(invocation, cad.parameter[0]);
                if (testChildRef != null) {
                    testNodeRef = testChildRef.getChildRef();
                    if (log.isDebugEnabled()) {
                        if (nodeService.exists(testNodeRef)) {
                            log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                        } else {
                            log.debug("\tPermission test on non-existing node " + testNodeRef);
                        }
                    }
                }
            } else {
                throw new ACLEntryVoterException(
                        "The specified parameter is not a NodeRef or ChildAssociationRef");
            }
        } else if (cad.typeString.equals(ACL_ITEM)) {
            if (NodeRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                if (Map.class.isAssignableFrom(params[1]) || Map.class.isAssignableFrom(params[2])) {
                    Map<QName, Serializable> properties = (Map<QName, Serializable>) (Map.class
                            .isAssignableFrom(params[1]) ? getArgument(invocation, 1)
                                    : getArgument(invocation, 2));
                    if (properties != null && properties.containsKey(ContentModel.PROP_OWNER)) {
                        testNodeRef = getArgument(invocation, cad.parameter[0]);

                        boolean isChanged = !properties.get(ContentModel.PROP_OWNER).toString()
                                .equals(ownableService.getOwner(testNodeRef));

                        if (!isChanged) {
                            testNodeRef = null;
                        }

                        if (log.isDebugEnabled()) {
                            if (testNodeRef != null) {
                                if (nodeService.exists(testNodeRef)) {
                                    log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                                } else {
                                    log.debug("\tPermission test on non-existing node " + testNodeRef);
                                }
                            }
                        }
                    }
                } else if (QName.class.isAssignableFrom(params[1]) && params[2] != null) {
                    testNodeRef = getArgument(invocation, cad.parameter[0]);
                    QName arg1 = getArgument(invocation, 1);
                    boolean isOwnerProperty = ContentModel.PROP_OWNER.equals(arg1);
                    if (isOwnerProperty) {
                        Object arg2 = getArgument(invocation, 2);
                        boolean isChanged = (arg2 != null
                                && !arg2.toString().equals(ownableService.getOwner(testNodeRef)));

                        if (!isChanged) {
                            testNodeRef = null;
                        }
                    } else {
                        testNodeRef = null;
                    }

                    if (log.isDebugEnabled()) {
                        if (testNodeRef != null) {
                            if (nodeService.exists(testNodeRef)) {
                                log.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
                            } else {
                                log.debug("\tPermission test on non-existing node " + testNodeRef);
                            }
                        }
                    }
                }
            } else {
                throw new ACLEntryVoterException("The specified parameter is not a Item");
            }
        } else if (cad.typeString.equals(ACL_PARENT)) {
            // There is no point having parent permissions for store
            // refs
            if (cad.parameter.length != 1) {
                throw new ACLEntryVoterException(
                        "The specified parameter is not a NodeRef or ChildAssociationRef");
            } else if (NodeRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                NodeRef child = getArgument(invocation, cad.parameter[0]);
                if (child != null) {
                    testNodeRef = nodeService.getPrimaryParent(child).getParentRef();
                    if (log.isDebugEnabled()) {
                        if (nodeService.exists(testNodeRef)) {
                            log.debug(
                                    "\tPermission test for parent on node " + nodeService.getPath(testNodeRef));
                        } else {
                            log.debug("\tPermission test for parent on non-existing node " + testNodeRef);
                        }
                        log.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef));
                    }
                }
            } else if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter[0]])) {
                ChildAssociationRef testParentRef = getArgument(invocation, cad.parameter[0]);
                if (testParentRef != null) {
                    testNodeRef = testParentRef.getParentRef();
                    if (log.isDebugEnabled()) {
                        if (nodeService.exists(testNodeRef)) {
                            log.debug("\tPermission test for parent on child assoc ref for node "
                                    + nodeService.getPath(testNodeRef));
                        } else {
                            log.debug("\tPermission test for parent on child assoc ref for non existing node "
                                    + testNodeRef);
                        }

                    }
                }

            } else {
                throw new ACLEntryVoterException("The specified parameter is not a ChildAssociationRef");
            }
        }

        if (testNodeRef != null) {
            // now we know the node - we can abstain for certain types and aspects (eg. RM)
            if (abstainForClassQNames.size() > 0) {
                // check node exists
                if (nodeService.exists(testNodeRef)) {
                    QName typeQName = nodeService.getType(testNodeRef);
                    if (abstainForClassQNames.contains(typeQName)) {
                        return AccessDecisionVoter.ACCESS_ABSTAIN;
                    }

                    Set<QName> aspectQNames = nodeService.getAspects(testNodeRef);
                    for (QName abstain : abstainForClassQNames) {
                        if (aspectQNames.contains(abstain)) {
                            return AccessDecisionVoter.ACCESS_ABSTAIN;
                        }
                    }
                }
            }

            if (log.isDebugEnabled()) {
                log.debug("\t\tNode ref is not null");
            }
            if (permissionService.hasPermission(testNodeRef, cad.required.toString()) == AccessStatus.DENIED) {
                if (log.isDebugEnabled()) {
                    log.debug("\t\tPermission is denied");
                    Thread.dumpStack();
                }
                return AccessDecisionVoter.ACCESS_DENIED;
            }
        }
    }

    if ((hasMethodEntry == null) || (hasMethodEntry.booleanValue())) {
        return AccessDecisionVoter.ACCESS_GRANTED;
    } else {
        return AccessDecisionVoter.ACCESS_DENIED;
    }
}

From source file:org.apache.juddi.v3.tck.UDDI_090_HttpMavenIntegrationTest.java

@Override
public boolean verifyDelivery(String findMe) {
    for (int i = 0; i < TckPublisher.getSubscriptionTimeout(); i++) {
        try {/*ww  w . j  a  v a  2 s . com*/
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }
        System.out.println(".");
        //if (UDDISubscriptionListenerImpl.notificationCount > 0) {                        }
    }
    logger.info("RX " + UDDISubscriptionListenerImpl.notificationCount + " notifications");
    Iterator<String> it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator();
    boolean found = false;

    while (it.hasNext()) {
        String test = it.next();
        if (TckCommon.isDebug()) {
            logger.info("Notification: " + test);
        }
        if (test.toLowerCase().contains(findMe.toLowerCase())) {
            found = true;
        }
    }
    if (!found) {
        logger.error("_________________________________________________the test failed!!!");
        it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator();
        Thread.dumpStack();
        while (it.hasNext()) {
            logger.info("Notification: " + it.next());
        }
    }
    return found;
}

From source file:org.apache.juddi.v3.tck.UDDI_090_RMIIntegrationTest.java

@Override
public boolean verifyDelivery(String findMe) {
    for (int i = 0; i < TckPublisher.getSubscriptionTimeout(); i++) {
        try {/*from ww  w .  java2  s. co  m*/
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }
        System.out.println(".");
        //if (UDDISubscriptionListenerImpl.notificationCount > 0) {                        }
    }
    logger.info("RX " + UDDISubscriptionListenerImpl.notificationCount + " notifications");
    Iterator<String> it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator();
    boolean found = false;

    while (it.hasNext()) {
        String test = it.next();
        if (TckCommon.isDebug()) {
            logger.info("Notification: " + test);
        }
        if (test.toLowerCase().contains(findMe.toLowerCase())) {
            found = true;
        }
    }

    if (!found) {
        it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator();
        Thread.dumpStack();
        while (it.hasNext()) {
            logger.info("Notification: " + it.next());
        }
    }
    return found;
}

From source file:org.cellprofiler.preferences.CellProfilerPreferences.java

/**
 * @return the system root preferences to use in the CellProfilerPreferencesFactory 
 *///from  w  ww  . j  ava2 s . c om
static Preferences getSystemRoot() {
    synchronized (systemMap) {
        if (!systemMap.containsKey("/")) {
            System.err.println("Accessing system root.");
            Thread.dumpStack();
            systemRoot = new CellProfilerPreferences(null, getJREPreferencesFactory().systemRoot(), systemMap);
            systemMap.put("/", systemRoot);
        }
    }
    return systemRoot;
}

From source file:org.cellprofiler.preferences.CellProfilerPreferences.java

/**
 * @return the user root preferences to use in the CellProfilerPreferencesFactory
 *///from   w  ww  .  j  a  v a 2s  .  c o m
static Preferences getUserRoot() {
    synchronized (userMap) {
        if (!userMap.containsKey("/")) {
            System.err.println("Accessing user root.");
            Thread.dumpStack();
            userRoot = new CellProfilerPreferences(null, getJREPreferencesFactory().userRoot(), userMap);
            System.err.println("Got user root.");
            assert userRoot.isUserNode();
            userMap.put("/", userRoot);
        }
    }
    return userRoot;
}