Example usage for java.io NotSerializableException getLocalizedMessage

List of usage examples for java.io NotSerializableException getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

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

private void writePackageQueue() {
    if (dropOfflineActivities) {
        return; // don't write packages when offline tracking is disabled
    }//ww  w  .  j  a v a  2  s  .c o  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();
    }
}