java类javax.management.OperationsException的实例源码

JMXProxyServlet.java 文件源码 项目:tomcat7 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
JMXProxyServlet.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
JMXProxyServlet.java 文件源码 项目:lazycat 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * 
 * @param onameStr
 *            The name of the MBean.
 * @param operation
 *            The name of the operation to invoke.
 * @param parameters
 *            An array of Strings containing the parameters to the
 *            operation. They will be converted to the appropriate types to
 *            call the requested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr, String operation, String[] parameters)
        throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname = new ObjectName(onameStr);
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname, operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
        MBeanParameterInfo pi = signature[i];
        signatureTypes[i] = pi.getType();
        values[i] = registry.convertValue(pi.getType(), parameters[i]);
    }

    return mBeanServer.invoke(oname, operation, values, signatureTypes);
}
Consumer.java 文件源码 项目:amq-kahadb-tool 阅读 27 收藏 0 点赞 0 评论 0
void setConnection(ActiveMQConnection connection) throws OperationsException, JMSException {
    this.session = (ActiveMQSession)connection.createSession(getUseTransaction(), Session.AUTO_ACKNOWLEDGE);

    if(destinationType == KahaDestination.DestinationType.TOPIC) {
        Topic topic = session.createTopic(java.lang.String.valueOf(destinationName));

        if(hasSubscription()) {
            consumer = (ActiveMQMessageConsumer)session.createDurableSubscriber(topic, subscription.getSubscriptionName(), subscription.getMessageSelector(), subscription.getNoLocal());
            showSubscribeAdded();
        }
        else {
            consumer = (ActiveMQMessageConsumer)session.createConsumer(topic);
        }
    }
    else {
        Queue queue = session.createQueue(destinationName);
        consumer = (ActiveMQMessageConsumer)session.createConsumer(queue);
    }
}
KahaDBJournalsStatistics.java 文件源码 项目:amq-kahadb-tool 阅读 29 收藏 0 点赞 0 评论 0
private void showJournalDestinationStatistics(JournalStatistic journalStatistic) throws OperationsException {
    showSeparator();
    System.out.printf("Destination statistics:\r\n");
    System.out.printf("- Topics: %s.\r\n", journalStatistic.getTopicCount());
    System.out.printf("- Queues: %s.\r\n", journalStatistic.getQueueCount());

    showCommandStatistics(journalStatistic.getTopicsDestinationStatistics());
    showCommandStatistics(journalStatistic.getQueueDestinationStatistics());

    DestinationStatistic[] otherDestinationStatistics = journalStatistic.getOtherDestinationStatistics();
    if(otherDestinationStatistics.length != 0) {
        System.out.println();
        System.out.printf("Commands without destination:\r\n");
        showCommandStatistics(otherDestinationStatistics);
    }
}
MemberInfoWithStatsMBeanDUnitTest.java 文件源码 项目:gemfirexd-oss 阅读 17 收藏 0 点赞 0 评论 0
@SuppressWarnings("rawtypes")
private void verifyGetMemberDetails(ObjectName wrapper, String memberId, 
    boolean verifyGatewayDetails) throws AdminException, OperationsException, 
                                         MBeanException, ReflectionException, 
                                         IOException {
  logWriter.fine("Entered MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
  Map memberDetailsJMX    = getMemberDetailsJMX(wrapper, memberId);
  Map memberDetailsDirect = getMemberDetailsDirect(memberId);

  verifyMemberDetails(memberDetailsJMX, memberDetailsDirect);
  if (verifyGatewayDetails) {
    verifyGatewayDetails(memberDetailsJMX, memberDetailsDirect);
  } else {
    verifyClientsDetails(memberDetailsJMX, memberDetailsDirect);
    verifyRegionsDetails(memberDetailsJMX, memberDetailsDirect);
  }
  logWriter.fine("Exited MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
}
MemberInfoWithStatsMBeanDUnitTest.java 文件源码 项目:gemfirexd-oss 阅读 15 收藏 0 点赞 0 评论 0
@SuppressWarnings("rawtypes")
private void verifyGetMemberDetails(ObjectName wrapper, String memberId, 
    boolean verifyGatewayDetails) throws AdminException, OperationsException, 
                                         MBeanException, ReflectionException, 
                                         IOException {
  logWriter.fine("Entered MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
  Map memberDetailsJMX    = getMemberDetailsJMX(wrapper, memberId);
  Map memberDetailsDirect = getMemberDetailsDirect(memberId);

  verifyMemberDetails(memberDetailsJMX, memberDetailsDirect);
  if (verifyGatewayDetails) {
    verifyGatewayDetails(memberDetailsJMX, memberDetailsDirect);
  } else {
    verifyClientsDetails(memberDetailsJMX, memberDetailsDirect);
    verifyRegionsDetails(memberDetailsJMX, memberDetailsDirect);
  }
  logWriter.fine("Exited MemberInfoWithStatsMBeanDUnitTest.verifyGetMemberDetails() ...");
}
JMXProxyServlet.java 文件源码 项目:class-guard 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
JMXProxyServlet.java 文件源码 项目:apache-tomcat-7.0.57 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
JMXProxyServlet.java 文件源码 项目:apache-tomcat-7.0.57 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Invokes an operation on an MBean.
 * @param onameStr The name of the MBean.
 * @param operation The name of the operation to invoke.
 * @param parameters An array of Strings containing the parameters to the
 *                   operation. They will be converted to the appropriate
 *                   types to call the reuested operation.
 * @return The value returned by the requested operation.
 */
private Object invokeOperationInternal(String onameStr,
                                       String operation,
                                       String[] parameters)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,operation);
    MBeanParameterInfo[] signature = methodInfo.getSignature();
    String[] signatureTypes = new String[signature.length];
    Object[] values = new Object[signature.length];
    for (int i = 0; i < signature.length; i++) {
       MBeanParameterInfo pi = signature[i];
       signatureTypes[i] = pi.getType();
       values[i] = registry.convertValue(pi.getType(), parameters[i] );
     }

    return mBeanServer.invoke(oname,operation,values,signatureTypes);
}
PluggableMBeanServerImpl.java 文件源码 项目:wildfly-core 阅读 21 收藏 0 点赞 0 评论 0
@Override
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data) throws OperationsException {
    Throwable error = null;
    MBeanServerPlugin delegate = null;
    final boolean readOnly = true;
    try {
        delegate = findDelegate(name);
        //Special authorization
        authorizeClassloadingOperation(delegate, name, DESERIALIZE);
        return delegate.deserialize(name, data);
    } catch (Exception e) {
        error = e;
        if (e instanceof OperationsException) throw (OperationsException)e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(name, data);
        }
    }
}
PluggableMBeanServerImpl.java 文件源码 项目:wildfly-core 阅读 24 收藏 0 点赞 0 评论 0
@Override
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, ReflectionException {
    Throwable error = null;
    MBeanServerPlugin delegate = rootMBeanServer;
    final boolean readOnly = true;
    try {
        //Special authorization
        authorizeClassloadingOperation(delegate, DESERIALIZE);
        return delegate.deserialize(className, data);
    } catch (Exception e) {
        error = e;
        if (e instanceof OperationsException) throw (OperationsException)e;
        if (e instanceof ReflectionException) throw (ReflectionException)e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(className, data);
        }
    }
}
PluggableMBeanServerImpl.java 文件源码 项目:wildfly-core 阅读 23 收藏 0 点赞 0 评论 0
@Override
@Deprecated
public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws OperationsException, ReflectionException {
    Throwable error = null;
    MBeanServerPlugin delegate = rootMBeanServer;
    final boolean readOnly = true;
    try {
        //Special authorization
        authorizeClassloadingOperation(delegate, loaderName, DESERIALIZE);
        return delegate.deserialize(className, loaderName, data);
    } catch (Exception e) {
        error = e;
        if (e instanceof OperationsException) throw (OperationsException)e;
        if (e instanceof ReflectionException) throw (ReflectionException)e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(className, loaderName, data);
        }
    }
}
PogamutMBeanServer.java 文件源码 项目:Pogamut3 阅读 19 收藏 0 点赞 0 评论 0
@Deprecated
@Override
public ObjectInputStream deserialize(String className,
        ObjectName loaderName, byte[] data)
        throws InstanceNotFoundException, OperationsException,
        ReflectionException {
    return mbs.deserialize(className, loaderName, data);
}
JMXProxyServlet.java 文件源码 项目:tomcat7 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr,
                                  String attributeName,
                                  String value)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, attributeName);
    Object valueObj=registry.convertValue(type, value );
    mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}
JmxMBeanServer.java 文件源码 项目:OpenJSharp 阅读 19 收藏 0 点赞 0 评论 0
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data)
    throws InstanceNotFoundException, OperationsException {
    checkRead();
    return getMBeanServer().deserialize(name, data);
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, data);
}
MBeanServerAccessController.java 文件源码 项目:OpenJSharp 阅读 44 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className,
                                     ObjectName loaderName,
                                     byte[] data)
    throws
    InstanceNotFoundException,
    OperationsException,
    ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, loaderName, data);
}
JMXProxyServlet.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr,
                                  String attributeName,
                                  String value)
    throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, attributeName);
    Object valueObj=registry.convertValue(type, value );
    mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}
JmxMBeanServer.java 文件源码 项目:jdk8u-jdk 阅读 47 收藏 0 点赞 0 评论 0
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
MBeanServerAccessController.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data)
    throws InstanceNotFoundException, OperationsException {
    checkRead();
    return getMBeanServer().deserialize(name, data);
}
MBeanServerAccessController.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, data);
}
MBeanServerAccessController.java 文件源码 项目:jdk8u-jdk 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className,
                                     ObjectName loaderName,
                                     byte[] data)
    throws
    InstanceNotFoundException,
    OperationsException,
    ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, loaderName, data);
}
JmxMBeanServer.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
MBeanServerAccessController.java 文件源码 项目:openjdk-jdk10 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(ObjectName name, byte[] data)
    throws InstanceNotFoundException, OperationsException {
    checkRead();
    return getMBeanServer().deserialize(name, data);
}
MBeanServerAccessController.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, data);
}
MBeanServerAccessController.java 文件源码 项目:openjdk-jdk10 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
@Deprecated
public ObjectInputStream deserialize(String className,
                                     ObjectName loaderName,
                                     byte[] data)
    throws
    InstanceNotFoundException,
    OperationsException,
    ReflectionException {
    checkRead();
    return getMBeanServer().deserialize(className, loaderName, data);
}
JMXProxyServlet.java 文件源码 项目:lazycat 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr, String attributeName, String value)
        throws OperationsException, MBeanException, ReflectionException {
    ObjectName oname = new ObjectName(onameStr);
    String type = registry.getType(oname, attributeName);
    Object valueObj = registry.convertValue(type, value);
    mBeanServer.setAttribute(oname, new Attribute(attributeName, valueObj));
}
MBeanInstantiator.java 文件源码 项目:openjdk9 阅读 22 收藏 0 点赞 0 评论 0
/**
 * De-serializes a byte array in the context of a classloader.
 *
 * @param loader the classloader to use for de-serialization
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output related
 * exceptions.
 */
public ObjectInputStream deserialize(ClassLoader loader, byte[] data)
    throws OperationsException {

    // Check parameter validity
    if (data == null) {
        throw new  RuntimeOperationsException(new
            IllegalArgumentException(), "Null data passed in parameter");
    }
    if (data.length == 0) {
        throw new  RuntimeOperationsException(new
            IllegalArgumentException(), "Empty data passed in parameter");
    }

    // Object deserialization
    ByteArrayInputStream bIn;
    ObjectInputStream    objIn;

    bIn   = new ByteArrayInputStream(data);
    try {
        objIn = new ObjectInputStreamWithLoader(bIn,loader);
    } catch (IOException e) {
        throw new OperationsException(
                 "An IOException occurred trying to de-serialize the data");
    }

    return objIn;
}


问题


面经


文章

微信
公众号

扫码关注公众号