Example usage for java.lang SecurityException getMessage

List of usage examples for java.lang SecurityException getMessage

Introduction

In this page you can find the example usage for java.lang SecurityException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:gov.nih.nci.caarray.util.CaArrayAuditLogInterceptor.java

private boolean collectionNeedsAuditing(Object auditableObj, Object newValue, Object oldValue,
        String property) {/*ww w.j  a v  a2 s  . c om*/

    try {
        String cn = CGLIBUtils.unEnhanceCBLIBClassName(auditableObj.getClass());
        Method getter = getHibernateHelper().getConfiguration().getClassMapping(cn).getProperty(property)
                .getGetter(auditableObj.getClass()).getMethod();
        if (getter.getAnnotation(MapKey.class) != null
                || getter.getAnnotation(MapKeyManyToMany.class) != null) {
            //  this is some sort of map
            Map<?, ?> oldMap = (Map<?, ?>) oldValue;
            Map<?, ?> newMap = (Map<?, ?>) newValue;
            oldMap = oldMap == null ? Collections.emptyMap() : oldMap;
            newMap = newMap == null ? Collections.emptyMap() : newMap;
            return !equalsMap(oldMap, newMap);
        } else if (getter.getAnnotation(JoinTable.class) != null
                || getter.getAnnotation(JoinColumn.class) != null) {
            Collection<?> oldSet = (Collection<?>) oldValue;
            Collection<?> newSet = (Collection<?>) newValue;
            return !CollectionUtils.isEqualCollection((oldSet == null) ? Collections.emptySet() : oldSet,
                    (newSet == null) ? Collections.emptySet() : newSet);

        }
    } catch (SecurityException e) {
        LOG.error(e.getMessage(), e);
    }

    return false;
}

From source file:org.siyapath.gossip.GossipImpl.java

/**
 * Initiates gossiping of member set. Select a random member form the known member
 * list and gossip current member list by calling memberDiscovery service &
 * update the current list with the response
 *//*from  w ww .  java2 s  . c om*/
public void memberGossiper() {

    NodeInfo randomMember = nodeContext.getRandomMember();
    log.info("Getting a random member to gossip:" + randomMember);
    if (randomMember != null) {
        TTransport transport = new TSocket(randomMember.getIp(), randomMember.getPort());
        //TTransport transport = new TFramedTransport(new TSocket("localhost",  randomMember.getPort()));
        try {
            transport.open();
            TProtocol protocol = new TBinaryProtocol(transport);
            Siyapath.Client client = new Siyapath.Client(protocol);
            Set<NodeInfo> nodesToGossip = getDiff(randomMember);
            Set<NodeInfo> discoveredNodes = CommonUtils.deSerialize(client.memberDiscovery(
                    CommonUtils.serialize(nodeContext.getNodeInfo()), CommonUtils.serialize(nodesToGossip)));
            Set<NodeInfo> newSet = mergeSets(nodeContext.getMemberSet(), discoveredNodes);
            nodeContext.updateMemberSet(newSet);
            nodeContext.addMemNodeSet(randomMember, discoveredNodes);
            log.info("Members fetched " + discoveredNodes.size());
        } catch (SecurityException e) {
            log.error("Could not member gossip due to Security Exception");
        } catch (TTransportException e) {
            if (e.getCause() instanceof ConnectException) {
                log.error("Could not connect to the member node for member gossiping");
                nodeContext.removeMember(randomMember);
                nodeContext.removeMemNodeSet(randomMember);
            } else {
                log.error("Member Gossip failed :" + randomMember.getNodeId() + e.getMessage());
            }
        } catch (TException e) {
            log.error("Member Gossip failed :" + randomMember.getNodeId() + e.getMessage());
        } finally {
            transport.close();
        }
    }
}

From source file:jef.tools.reflect.ClassEx.java

/**
 * //from  w  w  w.j av a  2s.co  m
 * 
 * @param name
 * @param params
 * @return
 */
public Method getPublicMethod(String name, Class<?>... params) {
    try {
        return cls.getMethod(name, params);
    } catch (SecurityException e) {
        throw new IllegalArgumentException(e.getMessage());
    } catch (NoSuchMethodException e) {
        return null;
    }
}

From source file:org.siyapath.gossip.GossipImpl.java

/**
 * Initiates gossiping of node resource. Select a random member form the known member
 * list and gossip current statistics of node resource list by calling resourcesGossip service &
 * update the current list of node with resource with the response
 *///  w  ww  .jav  a 2s  .  c  om
public void resourceGossiper() {

    NodeInfo randomMember = nodeContext.getRandomMember();
    log.info("Getting a random member to gossip resources:" + randomMember);
    if (randomMember != null) {
        TTransport transport = new TSocket(randomMember.getIp(), randomMember.getPort());
        //TTransport transport = new TFramedTransport(new TSocket("localhost",  randomMember.getPort()));
        try {
            transport.open();
            TProtocol protocol = new TBinaryProtocol(transport);
            Siyapath.Client client = new Siyapath.Client(protocol);
            Map<Integer, NodeResource> discoveredNodesResource = CommonUtils.deSerialize(
                    client.resourceGossip(CommonUtils.serialize(nodeContext.getPartialResourceNodes())));
            Map<Integer, NodeResource> newSet = mergeNewNodeResource(nodeContext.getMemberResourceMap(),
                    discoveredNodesResource);
            nodeContext.updateMemberResourceSet(newSet);
            log.info("Node Resource Fetched:" + discoveredNodesResource.size());

        } catch (SecurityException e) {
            log.error("Could not resource gossip due to Security Exception");
        } catch (TTransportException e) {
            if (e.getCause() instanceof ConnectException) {
                log.error("Could not connect to the member node for resource gossiping");
                nodeContext.removeMember(randomMember);
                nodeContext.removeFromMemResourceMap(randomMember.getNodeId());
            } else {
                log.error("Resource Gossip failed with :" + randomMember.getNodeId() + e.getMessage());
            }
        } catch (TException e) {
            log.error("Resource Gossip failed with :" + randomMember.getNodeId() + e.getMessage());

        } finally {
            transport.close();
        }
    }
}

From source file:com.cws.esolutions.core.processors.impl.DNSServiceRequestProcessorImpl.java

/**
 * @see com.cws.esolutions.core.processors.interfaces.IDNSServiceRequestProcessor#addRecordToEntry(DNSServiceRequest)
 *//*w w  w  . ja v  a  2  s  . c  o m*/
public DNSServiceResponse addRecordToEntry(final DNSServiceRequest request) throws DNSServiceException {
    final String methodName = IDNSServiceRequestProcessor.CNAME
            + "#addRecordToEntry(final DNSServiceRequest request) throws DNSServiceException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("DNSServiceRequest: {}", request);
    }

    final DNSServiceResponse response = new DNSServiceResponse();
    final DNSEntry dnsEntry = request.getDnsEntry();
    final UserAccount userAccount = request.getUserAccount();
    final RequestHostInfo reqInfo = request.getRequestInfo();

    if (DEBUG) {
        DEBUGGER.debug("DNSEntry: {}", dnsEntry);
        DEBUGGER.debug("UserAccount: {}", userAccount);
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
    }

    try {
        // this will require admin and service authorization
        AccessControlServiceRequest accessRequest = new AccessControlServiceRequest();
        accessRequest.setUserAccount(userAccount);
        accessRequest.setServiceGuid(request.getServiceId());

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceRequest: {}", accessRequest);
        }

        AccessControlServiceResponse accessResponse = accessControl.isUserAuthorized(accessRequest);

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceResponse accessResponse: {}", accessResponse);
        }

        if (!(accessResponse.getIsUserAuthorized())) {
            // unauthorized
            response.setRequestStatus(CoreServicesStatus.UNAUTHORIZED);

            // audit
            try {
                AuditEntry auditEntry = new AuditEntry();
                auditEntry.setHostInfo(reqInfo);
                auditEntry.setAuditType(AuditType.CREATEDNSRECORD);
                auditEntry.setAuthorized(Boolean.FALSE);
                auditEntry.setUserAccount(userAccount);
                auditEntry.setApplicationId(request.getApplicationId());
                auditEntry.setApplicationName(request.getApplicationName());

                if (DEBUG) {
                    DEBUGGER.debug("AuditEntry: {}", auditEntry);
                }

                AuditRequest auditRequest = new AuditRequest();
                auditRequest.setAuditEntry(auditEntry);

                if (DEBUG) {
                    DEBUGGER.debug("AuditRequest: {}", auditRequest);
                }

                auditor.auditRequest(auditRequest);
            } catch (AuditServiceException asx) {
                ERROR_RECORDER.error(asx.getMessage(), asx);
            }

            return response;
        }

        // build me
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new DNSServiceException(sx.getMessage(), sx);
    } catch (AccessControlServiceException acsx) {
        ERROR_RECORDER.error(acsx.getMessage(), acsx);

        throw new DNSServiceException(acsx.getMessage(), acsx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.CREATEDNSRECORD);
            auditEntry.setUserAccount(userAccount);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:com.cws.esolutions.core.processors.impl.DNSServiceRequestProcessorImpl.java

/**
 * @see com.cws.esolutions.core.processors.interfaces.IDNSServiceRequestProcessor#pushNewService(com.cws.esolutions.core.processors.dto.DNSServiceRequest)
 *///from  www.  java 2 s. c  om
public DNSServiceResponse pushNewService(final DNSServiceRequest request) throws DNSServiceException {
    final String methodName = IDNSServiceRequestProcessor.CNAME
            + "#pushNewService(final DNSServiceRequest request) throws DNSServiceException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("DNSServiceRequest: {}" + request);
    }

    DNSServiceResponse response = new DNSServiceResponse();

    final DNSEntry entry = request.getDnsEntry();
    final UserAccount userAccount = request.getUserAccount();
    final RequestHostInfo reqInfo = request.getRequestInfo();

    if (DEBUG) {
        DEBUGGER.debug("DNSEntry: {}", entry);
        DEBUGGER.debug("UserAccount: {}", userAccount);
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
    }

    try {
        // this will require admin and service authorization
        AccessControlServiceRequest accessRequest = new AccessControlServiceRequest();
        accessRequest.setUserAccount(userAccount);
        accessRequest.setServiceGuid(request.getServiceId());

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceRequest: {}", accessRequest);
        }

        AccessControlServiceResponse accessResponse = accessControl.isUserAuthorized(accessRequest);

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceResponse: {}", accessResponse);
        }

        if (!(accessResponse.getIsUserAuthorized())) {
            // unauthorized
            response.setRequestStatus(CoreServicesStatus.UNAUTHORIZED);

            // audit
            try {
                AuditEntry auditEntry = new AuditEntry();
                auditEntry.setHostInfo(reqInfo);
                auditEntry.setAuditType(AuditType.CREATEDNSRECORD);
                auditEntry.setAuthorized(Boolean.FALSE);
                auditEntry.setUserAccount(userAccount);
                auditEntry.setApplicationId(request.getApplicationId());
                auditEntry.setApplicationName(request.getApplicationName());

                if (DEBUG) {
                    DEBUGGER.debug("AuditEntry: {}", auditEntry);
                }

                AuditRequest auditRequest = new AuditRequest();
                auditRequest.setAuditEntry(auditEntry);

                if (DEBUG) {
                    DEBUGGER.debug("AuditRequest: {}", auditRequest);
                }

                auditor.auditRequest(auditRequest);
            } catch (AuditServiceException asx) {
                ERROR_RECORDER.error(asx.getMessage(), asx);
            }

            return response;
        }

        // build me
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new DNSServiceException(sx.getMessage(), sx);
    } catch (AccessControlServiceException acsx) {
        ERROR_RECORDER.error(acsx.getMessage(), acsx);

        throw new DNSServiceException(acsx.getMessage(), acsx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.PUSHDNSRECORD);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setUserAccount(userAccount);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:com.cws.esolutions.core.processors.impl.DNSServiceRequestProcessorImpl.java

/**
 * @see com.cws.esolutions.core.processors.interfaces.IDNSServiceRequestProcessor#performSiteTransfer(com.cws.esolutions.core.processors.dto.DNSServiceRequest)
 *///ww  w .j av a2 s .  c  o  m
public DNSServiceResponse performSiteTransfer(final DNSServiceRequest request) throws DNSServiceException {
    final String methodName = IDNSServiceRequestProcessor.CNAME
            + "#performSiteTransfer(final DNSServiceRequest request) throws DNSServiceException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("DNSServiceRequest: {}" + request);
    }

    DNSServiceResponse response = new DNSServiceResponse();

    final UserAccount userAccount = request.getUserAccount();
    final RequestHostInfo reqInfo = request.getRequestInfo();

    if (DEBUG) {
        DEBUGGER.debug("UserAccount: {}", userAccount);
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
    }

    try {
        // this will require admin and service authorization
        AccessControlServiceRequest accessRequest = new AccessControlServiceRequest();
        accessRequest.setUserAccount(userAccount);
        accessRequest.setServiceGuid(request.getServiceId());

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceRequest: {}", accessRequest);
        }

        AccessControlServiceResponse accessResponse = accessControl.isUserAuthorized(accessRequest);

        if (DEBUG) {
            DEBUGGER.debug("AccessControlServiceResponse accessResponse: {}", accessResponse);
        }

        if (!(accessResponse.getIsUserAuthorized())) {
            // unauthorized
            response.setRequestStatus(CoreServicesStatus.UNAUTHORIZED);

            // audit
            try {
                AuditEntry auditEntry = new AuditEntry();
                auditEntry.setHostInfo(reqInfo);
                auditEntry.setAuditType(AuditType.CREATEDNSRECORD);
                auditEntry.setUserAccount(userAccount);
                auditEntry.setAuthorized(Boolean.FALSE);
                auditEntry.setApplicationId(request.getApplicationId());
                auditEntry.setApplicationName(request.getApplicationName());

                if (DEBUG) {
                    DEBUGGER.debug("AuditEntry: {}", auditEntry);
                }

                AuditRequest auditRequest = new AuditRequest();
                auditRequest.setAuditEntry(auditEntry);

                if (DEBUG) {
                    DEBUGGER.debug("AuditRequest: {}", auditRequest);
                }

                auditor.auditRequest(auditRequest);
            } catch (AuditServiceException asx) {
                ERROR_RECORDER.error(asx.getMessage(), asx);
            }

            return response;
        }

        // TODO: build
        // this will take the IP address in the "masters" clause and 
        // change it to whatever the new one is. then it pushes the file
        // out to the associated servers and continues from there to the
        // slaves
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new DNSServiceException(sx.getMessage(), sx);
    } catch (AccessControlServiceException acsx) {
        ERROR_RECORDER.error(acsx.getMessage(), acsx);

        throw new DNSServiceException(acsx.getMessage(), acsx);
    } finally {
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.SITETXFR);
            auditEntry.setUserAccount(userAccount);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:org.talend.commons.utils.threading.Locker.java

/**
 * /*from  w  ww. j a v a2  s. c  o m*/
 * @deprecated use instead {@link org.talend.commons.utils.threading.lockerbykey.LockerByKey}
 */
@Deprecated
public synchronized void shutdown() {
    Object[] values = waitingThreadsByKey.values().toArray(new Object[0]);
    for (Object object : values) {
        if (object instanceof List) {
            List<Thread> list = (List<Thread>) object;
            for (Thread thread : list) {
                try {
                    thread.interrupt();
                } catch (SecurityException e) {
                    log.warn(e.getMessage(), e);
                }
            }
        } else {
            try {
                ((Thread) object).interrupt();
            } catch (SecurityException e) {
                log.warn(e.getMessage(), e);
            }
        }
    }
}

From source file:org.plasma.sdo.helper.PlasmaTypeHelper.java

/**
 * Return the Type for this interfaceClass or null if not found. The interfaceClass 
 * is the Java interface that follows the SDO code generation pattern.
 * @param interfaceClass is the interface for the DataObject's Type -  
 * type.getInstanceClass(); //  ww w . j a va2 s .c  o  m
 * @return the Type for this interfaceClass or null if not found.
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */
public Type getType(Class interfaceClass) {
    String uri = null;
    try {
        Field uriField = interfaceClass.getDeclaredField(PlasmaDataObjectConstants.NAMESPACE_URI_FIELD_NAME);
        uri = (String) uriField.get(null);
    } catch (SecurityException e) {
        throw new PlasmaDataObjectException(e);
    } catch (NoSuchFieldException e) {
        throw new PlasmaDataObjectException(e);
    } catch (IllegalArgumentException e) {
        throw new PlasmaDataObjectException(e);
    } catch (IllegalAccessException e) {
        throw new PlasmaDataObjectException(e);
    }

    String qualifiedName = uri + "#" + interfaceClass.getSimpleName();
    Type result = namespaceQualifiedNameToTypeMap.get(qualifiedName);
    if (result == null) {
        try {
            result = new CoreType(uri, interfaceClass.getSimpleName());
        } catch (InvalidClassifierNameException e) {
            log.warn(e.getMessage(), e);
            return null;
        }
        namespaceQualifiedNameToTypeMap.put(qualifiedName, result);
        List<Type> namespaceTypes = namespaceToTypesMap.get(uri);
        if (namespaceTypes == null)
            namespaceTypes = new ArrayList<Type>();
        namespaceTypes.add(result);
    }
    return result;
}

From source file:org.apache.directory.fortress.core.AuditMgrConsole.java

/**
 *
 *//*  w w  w .  j a va 2  s  .  c  o m*/
void findBinds() {
    ReaderUtil.clearScreen();
    try {
        System.out.println("Enter userId value to search Audit Binds with or null to retrieve all:");
        String val = ReaderUtil.readLn();
        UserAudit uAudit = new UserAudit();
        uAudit.setUserId(val);
        List<Bind> list = am.searchBinds(uAudit);
        printAuthNs(list);
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("findBinds caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}