Example usage for java.io UTFDataFormatException toString

List of usage examples for java.io UTFDataFormatException toString

Introduction

In this page you can find the example usage for java.io UTFDataFormatException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:jetbrains.exodus.entitystore.PersistentEntityStoreImpl.java

@Nullable
public String getBlobString(@NotNull final PersistentStoreTransaction txn,
        @NotNull final PersistentEntity entity, @NotNull final String blobName) throws IOException {
    final int blobId = getPropertyId(txn, blobName, false);
    if (blobId < 0) {
        return null;
    }/*from w  ww .ja  v a  2s  . c  om*/
    String result = txn.getCachedBlobString(entity, blobId);
    if (result != null) {
        return result;
    }
    final Pair<Long, InputStream> blobStream = getInPlaceBlobStream(txn, entity, blobName);
    if (blobStream == null) {
        return null;
    }
    final long blobHandle = blobStream.getFirst();
    if (blobHandle == EMPTY_BLOB_HANDLE) {
        result = EMPTY_STRING;
    } else {
        try {
            final InputStream stream = blobStream.getSecond();
            if (stream == null) {
                return blobVault.getStringContent(blobHandle, txn.getEnvironmentTransaction());
            }
            result = UTFUtil.readUTF(stream);
        } catch (UTFDataFormatException e) {
            result = e.toString();
        }
    }
    if (result != null) {
        txn.cacheBlobString(entity, blobId, result);
    }
    return result;
}