You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2018/05/06 13:54:50 UTC
[1/2] lucene-solr:master: SOLR-12316: Fix test to work on linux and
test also windows in a better way
Repository: lucene-solr
Updated Branches:
refs/heads/master beaf3a47e -> 0922e58c2
SOLR-12316: Fix test to work on linux and test also windows in a better way
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fb5b42a0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fb5b42a0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fb5b42a0
Branch: refs/heads/master
Commit: fb5b42a0e4bb55f82985282a68fff01015c9693f
Parents: 1b76011
Author: Uwe Schindler <us...@apache.org>
Authored: Sun May 6 15:53:07 2018 +0200
Committer: Uwe Schindler <us...@apache.org>
Committed: Sun May 6 15:53:07 2018 +0200
----------------------------------------------------------------------
.../apache/solr/util/TestSystemIdResolver.java | 30 +++++++++++++-------
1 file changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb5b42a0/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
index 4c2677d..f87eeb4 100644
--- a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
+++ b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
@@ -19,6 +19,7 @@ package org.apache.solr.util;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
+import java.util.Arrays;
import org.apache.commons.io.IOUtils;
import org.apache.lucene.analysis.util.ResourceLoader;
@@ -29,11 +30,6 @@ import org.xml.sax.InputSource;
public class TestSystemIdResolver extends LuceneTestCase {
- public void setUp() throws Exception {
- super.setUp();
- System.setProperty("solr.allow.unsafe.resourceloading", "true");
- }
-
public void tearDown() throws Exception {
System.clearProperty("solr.allow.unsafe.resourceloading");
super.tearDown();
@@ -74,8 +70,6 @@ public class TestSystemIdResolver extends LuceneTestCase {
"solrres:/org/apache/solr/util/RTimer.class", "TestSystemIdResolver.class");
assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(testHome+"/collection1/conf/schema.xml"),
SystemIdResolver.createSystemIdFromResourceName(testHome+"/collection1/conf/solrconfig.xml"), "schema.xml");
- assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(testHome+"/crazy-path-to-schema.xml"),
- SystemIdResolver.createSystemIdFromResourceName(testHome+"/crazy-path-to-config.xml"), "crazy-path-to-schema.xml");
// if somebody uses an absolute uri (e.g., file://) we should fail resolving:
IOException ioe = expectThrows(IOException.class, () -> {
@@ -89,10 +83,24 @@ public class TestSystemIdResolver extends LuceneTestCase {
assertTrue(ioe.getMessage().startsWith("Cannot resolve absolute"));
// check that we can't escape with absolute file paths:
- ioe = expectThrows(IOException.class, () -> {
- resolver.resolveEntity(null, null, "solrres:/solrconfig.xml", "/etc/passwd");
- });
- assertTrue(ioe.getMessage().startsWith("Can't find resource '/etc/passwd' in classpath or"));
+ for (String path : Arrays.asList("/etc/passwd", "/windows/notepad.exe")) {
+ ioe = expectThrows(IOException.class, () -> {
+ resolver.resolveEntity(null, null, "solrres:/solrconfig.xml", path);
+ });
+ assertTrue(ioe.getMessage().startsWith("Can't find resource")
+ || ioe.getMessage().contains("is outside resource loader dir"));
+ }
+ }
+
+ public void testUnsafeResolving() throws Exception {
+ System.setProperty("solr.allow.unsafe.resourceloading", "true");
+
+ final Path testHome = SolrTestCaseJ4.getFile("solr/collection1").getParentFile().toPath();
+ final ResourceLoader loader = new SolrResourceLoader(testHome.resolve("collection1"), this.getClass().getClassLoader());
+ final SystemIdResolver resolver = new SystemIdResolver(loader);
+
+ assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(testHome+"/crazy-path-to-schema.xml"),
+ SystemIdResolver.createSystemIdFromResourceName(testHome+"/crazy-path-to-config.xml"), "crazy-path-to-schema.xml");
}
}
[2/2] lucene-solr:master: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/lucene-solr
Posted by us...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/0922e58c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/0922e58c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/0922e58c
Branch: refs/heads/master
Commit: 0922e58c2c0867815d34c887b182754764cfaa4f
Parents: fb5b42a beaf3a4
Author: Uwe Schindler <us...@apache.org>
Authored: Sun May 6 15:54:04 2018 +0200
Committer: Uwe Schindler <us...@apache.org>
Committed: Sun May 6 15:54:04 2018 +0200
----------------------------------------------------------------------
solr/solr-ref-guide/src/blockjoin-faceting.adoc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------