summaryrefslogtreecommitdiff
path: root/android/Bootstrap
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-11-17 10:32:26 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-12-04 23:04:26 +0100
commit4924ae7046cc6ea5a4eb9c06b1f76f1ae881d32b (patch)
treeafcd6c463c78e00288e227c045602fb45ade6f13 /android/Bootstrap
parenta703b3651b3d36a3abf8e0b7fa8b2fcd73c2b756 (diff)
android: improve error messages in DirectBufferAllocator
Change-Id: Iefab77e543606cfad937a79743fb3b9a68a0f2a2
Diffstat (limited to 'android/Bootstrap')
-rw-r--r--android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java b/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java
index 431ccad97182..f509030af0a7 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java
@@ -15,7 +15,7 @@ import android.util.Log;
import java.nio.ByteBuffer;
-public class DirectBufferAllocator {
+public final class DirectBufferAllocator {
private static final String LOGTAG = DirectBufferAllocator.class.getSimpleName();
@@ -27,7 +27,7 @@ public class DirectBufferAllocator {
private static native void freeDirectBufferNative(ByteBuffer aBuffer);
public static ByteBuffer allocate(int size) {
- Log.i(LOGTAG, "Buffer size: " + size);
+ Log.i(LOGTAG, "Allocating size: " + size);
return allocateVM(size);
}
@@ -37,7 +37,6 @@ public class DirectBufferAllocator {
private static ByteBuffer allocateJNI(int size) {
ByteBuffer directBuffer = allocateDirectBufferNative(size);
-
if (directBuffer == null) {
if (size <= 0) {
throw new IllegalArgumentException("Invalid allocation size: " + size);
@@ -47,17 +46,17 @@ public class DirectBufferAllocator {
} else if (!directBuffer.isDirect()) {
throw new AssertionError("allocateDirectBuffer() did not return a direct buffer");
}
-
return directBuffer;
}
private static ByteBuffer freeJNI(ByteBuffer buffer) {
if (buffer == null) {
+ Log.i(LOGTAG, "ByteBuffer is null");
return null;
}
if (!buffer.isDirect()) {
- throw new IllegalArgumentException("buffer must be direct");
+ throw new IllegalArgumentException("ByteBuffer must be direct");
}
freeDirectBufferNative(buffer);
@@ -81,13 +80,14 @@ public class DirectBufferAllocator {
private static ByteBuffer freeVM(ByteBuffer buffer) {
if (buffer == null) {
+ Log.i(LOGTAG, "ByteBuffer is null");
return null;
}
if (!buffer.isDirect()) {
- throw new IllegalArgumentException("buffer must be direct");
+ throw new IllegalArgumentException("ByteBuffer must be direct");
}
-
+ // can't free buffer - leave this to the VM
return null;
}
}