Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2012-05-08 13:50:58 +0000
committerStefan Winkler2012-05-08 13:50:58 +0000
commita57960d211698a2d8c5ed0f2abb3b23a87fd197a (patch)
tree4285e056d7b990bc0c45f8e487303445d0fa64f0 /plugins/org.eclipse.net4j.db
parentd61e20f7123a4bc1c2905701dc1eab3ba8839641 (diff)
downloadcdo-a57960d211698a2d8c5ed0f2abb3b23a87fd197a.tar.gz
cdo-a57960d211698a2d8c5ed0f2abb3b23a87fd197a.tar.xz
cdo-a57960d211698a2d8c5ed0f2abb3b23a87fd197a.zip
[377727] [DB] rawReplication of BLOB in mySQL wrong
https://bugs.eclipse.org/bugs/show_bug.cgi?id=377727 Refitted old reader logic into the new code.
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
index aecf5d94fe..2e4ef12037 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
@@ -17,6 +17,7 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.io.TMPUtil;
import java.io.ByteArrayInputStream;
+import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -24,7 +25,6 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Reader;
import java.sql.Blob;
import java.sql.Clob;
@@ -552,7 +552,37 @@ public enum DBType
tempFile.deleteOnExit();
fw = new FileWriter(tempFile);
- IOUtil.copyCharacter(new InputStreamReader(new ExtendedDataInput.Stream(in)), fw, length);
+
+ Reader reader = new Reader()
+ {
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException
+ {
+ int read = 0;
+
+ try
+ {
+ while (read < len)
+ {
+ cbuf[off++] = in.readChar();
+ read++;
+ }
+ }
+ catch (EOFException ex)
+ {
+ read = -1;
+ }
+
+ return read;
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ }
+ };
+
+ IOUtil.copyCharacter(reader, fw, length);
return new FileReader(tempFile)
{

Back to the top