Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-07-04 13:28:00 -0400
committerEike Stepper2011-07-04 13:28:00 -0400
commit22e2e5aa618a465dc9f62ef09659680580e63145 (patch)
treebce30c27b6528af0706698e39c6c7b71ecc75527
parentd0d930b26f031ce1c214461a92eec886335067a6 (diff)
downloadcdo-22e2e5aa618a465dc9f62ef09659680580e63145.tar.gz
cdo-22e2e5aa618a465dc9f62ef09659680580e63145.tar.xz
cdo-22e2e5aa618a465dc9f62ef09659680580e63145.zip
[351096] [DB][Derby] Adding two blobs at the same time, derby throws exception
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351096
-rw-r--r--plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF54
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/LimitedInputStream.java112
2 files changed, 139 insertions, 27 deletions
diff --git a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
index 53a91cdc5f..955a58e1a9 100644
--- a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.util;singleton:=true
-Bundle-Version: 3.1.100.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -14,30 +14,30 @@ Import-Package: org.eclipse.osgi.service.debug;version="[1.0.0,2.0.0)";resolutio
org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.service.log;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.util.tracker;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.1.100";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
- org.eclipse.net4j.internal.util.container;version="3.1.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.factory;version="3.1.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om;version="3.1.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om.pref;version="3.1.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.util;version="3.1.100",
- org.eclipse.net4j.util.cache;version="3.1.100",
- org.eclipse.net4j.util.collection;version="3.1.100",
- org.eclipse.net4j.util.concurrent;version="3.1.100",
- org.eclipse.net4j.util.container;version="3.1.100",
- org.eclipse.net4j.util.container.delegate;version="3.1.100",
- org.eclipse.net4j.util.event;version="3.1.100",
- org.eclipse.net4j.util.factory;version="3.1.100",
- org.eclipse.net4j.util.fsm;version="3.1.100",
- org.eclipse.net4j.util.io;version="3.1.100",
- org.eclipse.net4j.util.lifecycle;version="3.1.100",
- org.eclipse.net4j.util.om;version="3.1.100",
- org.eclipse.net4j.util.om.log;version="3.1.100",
- org.eclipse.net4j.util.om.monitor;version="3.1.100",
- org.eclipse.net4j.util.om.pref;version="3.1.100",
- org.eclipse.net4j.util.om.trace;version="3.1.100",
- org.eclipse.net4j.util.options;version="3.1.100",
- org.eclipse.net4j.util.ref;version="3.1.100",
- org.eclipse.net4j.util.registry;version="3.1.100",
- org.eclipse.net4j.util.security;version="3.1.100",
- org.eclipse.net4j.util.transaction;version="3.1.100"
+Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.2.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
+ org.eclipse.net4j.internal.util.container;version="3.2.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.factory;version="3.2.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om;version="3.2.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om.pref;version="3.2.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.util;version="3.2.0",
+ org.eclipse.net4j.util.cache;version="3.2.0",
+ org.eclipse.net4j.util.collection;version="3.2.0",
+ org.eclipse.net4j.util.concurrent;version="3.2.0",
+ org.eclipse.net4j.util.container;version="3.2.0",
+ org.eclipse.net4j.util.container.delegate;version="3.2.0",
+ org.eclipse.net4j.util.event;version="3.2.0",
+ org.eclipse.net4j.util.factory;version="3.2.0",
+ org.eclipse.net4j.util.fsm;version="3.2.0",
+ org.eclipse.net4j.util.io;version="3.2.0",
+ org.eclipse.net4j.util.lifecycle;version="3.2.0",
+ org.eclipse.net4j.util.om;version="3.2.0",
+ org.eclipse.net4j.util.om.log;version="3.2.0",
+ org.eclipse.net4j.util.om.monitor;version="3.2.0",
+ org.eclipse.net4j.util.om.pref;version="3.2.0",
+ org.eclipse.net4j.util.om.trace;version="3.2.0",
+ org.eclipse.net4j.util.options;version="3.2.0",
+ org.eclipse.net4j.util.ref;version="3.2.0",
+ org.eclipse.net4j.util.registry;version="3.2.0",
+ org.eclipse.net4j.util.security;version="3.2.0",
+ org.eclipse.net4j.util.transaction;version="3.2.0"
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/LimitedInputStream.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/LimitedInputStream.java
new file mode 100644
index 0000000000..fa480f374f
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/LimitedInputStream.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.util.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Eike Stepper
+ * @since 3.2
+ */
+public class LimitedInputStream extends InputStream
+{
+ private InputStream in;
+
+ private long remaining;
+
+ private long remainingAtMark = 0;
+
+ public LimitedInputStream(InputStream in, long length)
+ {
+ this.in = in;
+ remaining = length;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ if ((remaining -= 1) < 0)
+ {
+ return -1;
+ }
+
+ return in.read();
+ }
+
+ @Override
+ public int read(byte[] cbuf, int off, int len) throws IOException
+ {
+ if (remaining <= 0)
+ {
+ return -1;
+ }
+
+ if (len > remaining)
+ {
+ len = (int)remaining;
+ }
+
+ len = in.read(cbuf, off, len);
+ if (len > 0)
+ {
+ remaining -= len;
+ }
+ else
+ {
+ remaining -= remaining;
+ }
+
+ return len;
+ }
+
+ @Override
+ public long skip(long n) throws IOException
+ {
+ if (n > remaining)
+ {
+ n = remaining;
+ }
+
+ remaining -= n = in.skip(n);
+ return n;
+ }
+
+ @Override
+ public boolean markSupported()
+ {
+ return in.markSupported();
+ }
+
+ @Override
+ public synchronized void mark(int readlimit)
+ {
+ if (markSupported())
+ {
+ in.mark(readlimit);
+ remainingAtMark = remaining;
+ }
+ }
+
+ @Override
+ public synchronized void reset() throws IOException
+ {
+ in.reset();
+ remaining = remainingAtMark;
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ remaining = 0;
+ in.close();
+ }
+}

Back to the top