Example usage for java.io NotSerializableException printStackTrace

List of usage examples for java.io NotSerializableException printStackTrace

Introduction

In this page you can find the example usage for java.io NotSerializableException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:io.smartspaces.scheduling.quartz.orientdb.internal.util.SerialUtils.java

public static Map<String, ?> deserialize(JobDataMap jobDataMap, String clob) throws IOException {
    try {/*w w  w.  j  av  a2  s  . c om*/
        byte[] bytes = Base64.decodeBase64(clob);
        return stringMapFromBytes(bytes);
    } catch (NotSerializableException e) {
        rethrowEnhanced(jobDataMap, e);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return Collections.emptyMap();
}

From source file:net.javacoding.queue.DiskQueue.java

/**
 * @see org.archive.queue.Queue#enqueue(java.lang.Object)
 *//*  w  ww.ja  va  2s  .  c o  m*/
public void enqueue(Object o) {
    try {
        if (!isInitialized) {
            lazyInitialize();
        }
        try {
            tailStream.writeObject(o);
        } catch (NotSerializableException e) {
            // TODO rewind stream to recoverable point?
            e.printStackTrace();
            throw e;
        }
        tailStream.reset(); // forget state with each enqueue
        length++;
    } catch (NullPointerException npe) {
        // temporarily here for debugging/breakpoint purposes
        System.err.println("NPE");
        throw npe;
    } catch (IOException e) {
        // TODO convert to runtime exception?
        logger.error("enqueue(" + o + ")" + e);
    }
}

From source file:com.adjust.sdk.PackageHandler.java

private void writePackageQueue() {
    if (dropOfflineActivities) {
        return; // don't write packages when offline tracking is disabled
    }// w  w w.j a  v a  2  s.co  m

    try {
        FileOutputStream outputStream = context.openFileOutput(PACKAGE_QUEUE_FILENAME, Context.MODE_PRIVATE);
        BufferedOutputStream bufferedStream = new BufferedOutputStream(outputStream);
        ObjectOutputStream objectStream = new ObjectOutputStream(bufferedStream);

        try {
            objectStream.writeObject(packageQueue);
            logger.debug("Package handler wrote %d packages", packageQueue.size());
        } catch (NotSerializableException e) {
            logger.error("Failed to serialize packages");
        } finally {
            objectStream.close();
        }
    } catch (Exception e) {
        logger.error("Failed to write packages (%s)", e.getLocalizedMessage());
        e.printStackTrace();
    }
}

From source file:org.trianacode.taskgraph.service.RunnableTask.java

/**
 * b Outputs the data from the unit. This passses the given data set to the first output node and then makes copies
 * for any other output nodes./*w  ww.  j av  a 2 s . co m*/
 *
 * @param data the data to be sent
 */
public void output(Object data) {
    try {
        Object toOutput;
        RunnableNode node;

        packetsLeft = 0; // number of packets to output

        for (int i = 0; i < this.getDataOutputNodeCount(); ++i) {
            if (this.getDataOutputNode(i).isConnected()) {
                ++packetsLeft;
            }
        }

        boolean clonemultiple = ((data instanceof Serializable) && !isParameterName(OUTPUT_POLICY))
                || (getParameter(OUTPUT_POLICY).equals(CLONE_MULTIPLE_OUTPUT));
        boolean cloneall = ((data instanceof Serializable) && isParameterName(OUTPUT_POLICY))
                && (getParameter(OUTPUT_POLICY).equals(CLONE_ALL_OUTPUT));

        for (int i = 0; i < this.getDataOutputNodeCount(); ++i) {
            node = (RunnableNode) this.getDataOutputNode(i);
            if (node.isConnected()) {
                // check output policy
                if (clonemultiple) {
                    if (i != this.getDataOutputNodeCount() - 1) {
                        toOutput = copyData(data);
                    } else {
                        toOutput = data;
                    }
                } else if (cloneall) {
                    toOutput = copyData(data);
                } else {
                    toOutput = data;
                }
                output(node, toOutput, true);
            }
        }
    } catch (NotSerializableException except) {
        System.out.println("Object " + data.getClass().getCanonicalName() + " is not serializable.");
        // TODO
        except.printStackTrace();
        //throw(new RuntimeException(Env.getString("serializeError") + ": " + except.getMessage()));
    } catch (IOException except) {
        // TODO
        except.printStackTrace();
        //throw(new RuntimeException(Env.getString("outputError") + ": " + except.getMessage()));
    } catch (ClassNotFoundException except) {
        // TODO
        except.printStackTrace();
        //throw(new RuntimeException(Env.getString("outputError") + ": " + except.getMessage()));
    }
}

From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java

protected void jobDataMapFromString(JobDataMap jobDataMap, String clob) throws IOException {

    try {// www.  ja v a2s. c  om
        byte[] bytes = Base64.decodeBase64(clob);

        Map<String, ?> map = (Map<String, ?>) stringMapFromBytes(bytes);

        jobDataMap.putAll(map);
        jobDataMap.clearDirtyFlag();

    } catch (NotSerializableException e) {
        throw new NotSerializableException("Unable to serialize JobDataMap for insertion into "
                + "database because the value of property '"
                + getKeyOfNonSerializableStringMapEntry(jobDataMap.getWrappedMap()) + "' is not serializable: "
                + e.getMessage());
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}