You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/06/17 23:59:50 UTC
[1/4] lucene-solr:branch_5_5: SOLR-8866: UpdateLog now throws an
error if it can't serialize a field value (cherry picked from commit a22099a)
Repository: lucene-solr
Updated Branches:
refs/heads/branch_5_5 3ad19fece -> 8f64b63a0
refs/heads/branch_5x 3344d21dc -> e04c11f2a
refs/heads/branch_6_0 eb28958e1 -> 6c3974869
SOLR-8866: UpdateLog now throws an error if it can't serialize a field value
(cherry picked from commit a22099a)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8f64b63a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8f64b63a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8f64b63a
Branch: refs/heads/branch_5_5
Commit: 8f64b63a0a47ba6d28984555956465600d9cd416
Parents: 3ad19fe
Author: David Smiley <ds...@apache.org>
Authored: Thu Mar 17 13:22:16 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri Jun 17 19:58:02 2016 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +++
.../org/apache/solr/update/TransactionLog.java | 4 +++-
.../test/org/apache/solr/update/TestUpdate.java | 21 ++++++++++++++++++++
.../apache/solr/common/util/JavaBinCodec.java | 4 +++-
4 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8f64b63a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 49c0985..81bea09 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -101,6 +101,9 @@ Other Changes
* SOLR-9053: Upgrade commons-fileupload to 1.3.1, fixing a potential vulnerability (Jeff Field, Mike Drob via janhoy)
+* SOLR-8866: UpdateLog will now throw an exception if it doesn't know how to serialize a value.
+ (David Smiley)
+
======================= 5.5.1 =======================
Bug Fixes
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8f64b63a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
index 6954799..7f0b981 100644
--- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
+++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
@@ -95,7 +95,9 @@ public class TransactionLog implements Closeable {
codec.writeByteArray(br.bytes, br.offset, br.length);
return null;
}
- return o;
+ // Fallback: we have no idea how to serialize this. Be noisy to prevent insidious bugs
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "TransactionLog doesn't know how to serialize " + o.getClass() + "; try implementing ObjectResolver?");
}
};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8f64b63a/solr/core/src/test/org/apache/solr/update/TestUpdate.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/TestUpdate.java b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
index 381231f..13a2479 100644
--- a/solr/core/src/test/org/apache/solr/update/TestUpdate.java
+++ b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
@@ -18,9 +18,11 @@ package org.apache.solr.update;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.IOException;
import java.util.concurrent.Callable;
public class TestUpdate extends SolrTestCaseJ4 {
@@ -243,4 +245,23 @@ public class TestUpdate extends SolrTestCaseJ4 {
}
+ @Test // SOLR-8866
+ public void testUpdateLogThrowsForUnknownTypes() throws IOException {
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", "444");
+ doc.addField("text", new Object());//Object shouldn't be serialized later...
+
+ AddUpdateCommand cmd = new AddUpdateCommand(req());
+ cmd.solrDoc = doc;
+ try {
+ h.getCore().getUpdateHandler().addDoc(cmd); // should throw
+ } catch (SolrException e) {
+ if (e.getMessage().contains("serialize")) {
+ return;//passed test
+ }
+ throw e;
+ }
+ fail();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8f64b63a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 4fc6ea8..7197ed6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -207,7 +207,9 @@ public class JavaBinCodec {
if (writeKnownType(tmpVal)) return;
}
}
-
+ // Fallback to do *something*.
+ // note: if the user of this codec doesn't want this (e.g. UpdateLog) it can supply an ObjectResolver that does
+ // something else like throw an exception.
writeVal(val.getClass().getName() + ':' + val.toString());
}
[3/4] lucene-solr:branch_6_0: SOLR-8866: UpdateLog now throws an
error if it can't serialize a field value (cherry picked from commit a22099a)
Posted by sa...@apache.org.
SOLR-8866: UpdateLog now throws an error if it can't serialize a field value
(cherry picked from commit a22099a)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d2597eca
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d2597eca
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d2597eca
Branch: refs/heads/branch_6_0
Commit: d2597ecace3da64397c5417905d1b439dbb2f675
Parents: eb28958
Author: David Smiley <ds...@apache.org>
Authored: Thu Mar 17 13:22:16 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri Jun 17 19:58:43 2016 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +++
.../org/apache/solr/update/TransactionLog.java | 4 +++-
.../test/org/apache/solr/update/TestUpdate.java | 21 ++++++++++++++++++++
.../apache/solr/common/util/JavaBinCodec.java | 4 +++-
4 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2597eca/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0bff45f..e12ce8c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -125,6 +125,9 @@ Other Changes
test-framework jar so users subclassing SolrTestCaseJ4 don't need to preserve magic paths.
(hossman)
+* SOLR-8866: UpdateLog will now throw an exception if it doesn't know how to serialize a value.
+ (David Smiley)
+
================== 6.0.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2597eca/solr/core/src/java/org/apache/solr/update/TransactionLog.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
index 474bcaf..673d683 100644
--- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
+++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
@@ -95,7 +95,9 @@ public class TransactionLog implements Closeable {
codec.writeByteArray(br.bytes, br.offset, br.length);
return null;
}
- return o;
+ // Fallback: we have no idea how to serialize this. Be noisy to prevent insidious bugs
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "TransactionLog doesn't know how to serialize " + o.getClass() + "; try implementing ObjectResolver?");
}
};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2597eca/solr/core/src/test/org/apache/solr/update/TestUpdate.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/TestUpdate.java b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
index 381231f..13a2479 100644
--- a/solr/core/src/test/org/apache/solr/update/TestUpdate.java
+++ b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
@@ -18,9 +18,11 @@ package org.apache.solr.update;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.IOException;
import java.util.concurrent.Callable;
public class TestUpdate extends SolrTestCaseJ4 {
@@ -243,4 +245,23 @@ public class TestUpdate extends SolrTestCaseJ4 {
}
+ @Test // SOLR-8866
+ public void testUpdateLogThrowsForUnknownTypes() throws IOException {
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", "444");
+ doc.addField("text", new Object());//Object shouldn't be serialized later...
+
+ AddUpdateCommand cmd = new AddUpdateCommand(req());
+ cmd.solrDoc = doc;
+ try {
+ h.getCore().getUpdateHandler().addDoc(cmd); // should throw
+ } catch (SolrException e) {
+ if (e.getMessage().contains("serialize")) {
+ return;//passed test
+ }
+ throw e;
+ }
+ fail();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2597eca/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 63c1b28..fe9ad08 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -207,7 +207,9 @@ public class JavaBinCodec {
if (writeKnownType(tmpVal)) return;
}
}
-
+ // Fallback to do *something*.
+ // note: if the user of this codec doesn't want this (e.g. UpdateLog) it can supply an ObjectResolver that does
+ // something else like throw an exception.
writeVal(val.getClass().getName() + ':' + val.toString());
}
[2/4] lucene-solr:branch_5x: SOLR-8866: UpdateLog now throws an error
if it can't serialize a field value (cherry picked from commit a22099a)
Posted by sa...@apache.org.
SOLR-8866: UpdateLog now throws an error if it can't serialize a field value
(cherry picked from commit a22099a)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e04c11f2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e04c11f2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e04c11f2
Branch: refs/heads/branch_5x
Commit: e04c11f2af087eb2b321a34fa0dd5c4866c02fac
Parents: 3344d21
Author: David Smiley <ds...@apache.org>
Authored: Thu Mar 17 13:22:16 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri Jun 17 19:58:32 2016 -0400
----------------------------------------------------------------------
.../org/apache/solr/update/TransactionLog.java | 4 +++-
.../test/org/apache/solr/update/TestUpdate.java | 21 ++++++++++++++++++++
.../apache/solr/common/util/JavaBinCodec.java | 4 +++-
3 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e04c11f2/solr/core/src/java/org/apache/solr/update/TransactionLog.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
index 6954799..7f0b981 100644
--- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
+++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
@@ -95,7 +95,9 @@ public class TransactionLog implements Closeable {
codec.writeByteArray(br.bytes, br.offset, br.length);
return null;
}
- return o;
+ // Fallback: we have no idea how to serialize this. Be noisy to prevent insidious bugs
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "TransactionLog doesn't know how to serialize " + o.getClass() + "; try implementing ObjectResolver?");
}
};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e04c11f2/solr/core/src/test/org/apache/solr/update/TestUpdate.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/TestUpdate.java b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
index 381231f..13a2479 100644
--- a/solr/core/src/test/org/apache/solr/update/TestUpdate.java
+++ b/solr/core/src/test/org/apache/solr/update/TestUpdate.java
@@ -18,9 +18,11 @@ package org.apache.solr.update;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.IOException;
import java.util.concurrent.Callable;
public class TestUpdate extends SolrTestCaseJ4 {
@@ -243,4 +245,23 @@ public class TestUpdate extends SolrTestCaseJ4 {
}
+ @Test // SOLR-8866
+ public void testUpdateLogThrowsForUnknownTypes() throws IOException {
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", "444");
+ doc.addField("text", new Object());//Object shouldn't be serialized later...
+
+ AddUpdateCommand cmd = new AddUpdateCommand(req());
+ cmd.solrDoc = doc;
+ try {
+ h.getCore().getUpdateHandler().addDoc(cmd); // should throw
+ } catch (SolrException e) {
+ if (e.getMessage().contains("serialize")) {
+ return;//passed test
+ }
+ throw e;
+ }
+ fail();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e04c11f2/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 4fc6ea8..7197ed6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -207,7 +207,9 @@ public class JavaBinCodec {
if (writeKnownType(tmpVal)) return;
}
}
-
+ // Fallback to do *something*.
+ // note: if the user of this codec doesn't want this (e.g. UpdateLog) it can supply an ObjectResolver that does
+ // something else like throw an exception.
writeVal(val.getClass().getName() + ':' + val.toString());
}
[4/4] lucene-solr:branch_6_0: SOL:R-8866: Remove misplaced 6.0.2
CHANGES entry
Posted by sa...@apache.org.
SOL:R-8866: Remove misplaced 6.0.2 CHANGES entry
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6c397486
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6c397486
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6c397486
Branch: refs/heads/branch_6_0
Commit: 6c3974869c074ee0176249812ca7ce6da2f3bebd
Parents: d2597ec
Author: Steve Rowe <sa...@apache.org>
Authored: Fri Jun 17 19:59:35 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri Jun 17 19:59:35 2016 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6c397486/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e12ce8c..0bff45f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -125,9 +125,6 @@ Other Changes
test-framework jar so users subclassing SolrTestCaseJ4 don't need to preserve magic paths.
(hossman)
-* SOLR-8866: UpdateLog will now throw an exception if it doesn't know how to serialize a value.
- (David Smiley)
-
================== 6.0.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release