: you somehow committed an older patch (the crazy chmod on) together with 
: this merge (<macrodef name="force-test-file-perms">). Can you revert 
: this please?

yeah .. shit ... sorry ... on it.


: 
: Uwe
: 
: -----
: Uwe Schindler
: H.-H.-Meier-Allee 63, D-28213 Bremen
: http://www.thetaphi.de
: eMail: [email protected]
: 
: 
: > -----Original Message-----
: > From: [email protected] [mailto:[email protected]]
: > Sent: Friday, December 21, 2012 12:44 AM
: > To: [email protected]
: > Subject: svn commit: r1424762 - in /lucene/dev/branches/branch_4x: ./ dev-
: > tools/ lucene/ lucene/analysis/
: > lucene/analysis/icu/src/java/org/apache/lucene/collation/
: > lucene/backwards/ lucene/benchmark/ lucene/codecs/ lucene/core/
: > lucene/core/src/test/org/apache/l...
: > 
: > Author: hossman
: > Date: Thu Dec 20 23:43:47 2012
: > New Revision: 1424762
: > 
: > URL: http://svn.apache.org/viewvc?rev=1424762&view=rev
: > Log:
: > SOLR-4136: followup: fix getBaseUrlForNodeName to never including trailing
: > slash when using the root context, and harden generateNodeName to not
: > trust the caller as far as leading/trailing slashes (merge r1424755)
: > 
: > Modified:
: >     lucene/dev/branches/branch_4x/   (props changed)
: >     lucene/dev/branches/branch_4x/dev-tools/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/BUILD.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/lucene/LICENSE.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/MIGRATE.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/NOTICE.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/README.txt   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/l
: > ucene/collation/ICUCollationKeyFilterFactory.java   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/backwards/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/benchmark/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/build.xml   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/codecs/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/common-build.xml   (props
: > changed)
: >     lucene/dev/branches/branch_4x/lucene/core/   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/i
: > ndex/TestBackwardsCompatibility.java   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/i
: > ndex/index.40.cfs.zip   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/i
: > ndex/index.40.nocfs.zip   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/i
: > ndex/index.40.optimized.cfs.zip   (props changed)
: > 
: > lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/i
: > ndex/index.40.optimized.nocfs.zip   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/demo/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/grouping/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/highlighter/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/ivy-settings.xml   (props
: > changed)
: >     lucene/dev/branches/branch_4x/lucene/join/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/licenses/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/memory/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/misc/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/module-build.xml   (props
: > changed)
: >     lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/queryparser/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/sandbox/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/site/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/suggest/   (props changed)
: >     lucene/dev/branches/branch_4x/lucene/test-framework/   (props
: > changed)
: >     lucene/dev/branches/branch_4x/lucene/tools/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/CHANGES.txt   (props changed)
: >     lucene/dev/branches/branch_4x/solr/LICENSE.txt   (props changed)
: >     lucene/dev/branches/branch_4x/solr/NOTICE.txt   (props changed)
: >     lucene/dev/branches/branch_4x/solr/README.txt   (props changed)
: >     lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/build.xml   (contents, props
: > changed)
: >     lucene/dev/branches/branch_4x/solr/cloud-dev/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/common-build.xml   (contents,
: > props changed)
: >     lucene/dev/branches/branch_4x/solr/contrib/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/core/   (props changed)
: > 
: > lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/
: > ZkController.java
: > 
: > lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/
: > ZkControllerTest.java
: >     lucene/dev/branches/branch_4x/solr/example/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt
: > (props changed)
: >     lucene/dev/branches/branch_4x/solr/scripts/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/site/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
: > 
: > lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/comm
: > on/cloud/SolrZkClient.java
: >     lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
: >     lucene/dev/branches/branch_4x/solr/testlogging.properties   (props
: > changed)
: >     lucene/dev/branches/branch_4x/solr/webapp/   (props changed)
: > 
: > Modified: lucene/dev/branches/branch_4x/solr/build.xml
: > URL:
: > http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/build.x
: > ml?rev=1424762&r1=1424761&r2=1424762&view=diff
: > ==========================================================
: > ====================
: > --- lucene/dev/branches/branch_4x/solr/build.xml (original)
: > +++ lucene/dev/branches/branch_4x/solr/build.xml Thu Dec 20 23:43:47
: > +++ 2012
: > @@ -282,6 +282,8 @@
: > 
: >    <!-- Clean targets -->
: >    <target name="clean" description="Cleans compiled files and other
: > temporary artifacts.">
: > +    <!-- need to fix up the perms before we try to delete -->
: > +    <force-test-file-perms build.dir="build" perms="u+w" />
: >      <delete dir="build" />
: >      <delete dir="dist" />
: >      <delete dir="package" />
: > 
: > Modified: lucene/dev/branches/branch_4x/solr/common-build.xml
: > URL:
: > http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/comm
: > on-build.xml?rev=1424762&r1=1424761&r2=1424762&view=diff
: > ==========================================================
: > ====================
: > --- lucene/dev/branches/branch_4x/solr/common-build.xml (original)
: > +++ lucene/dev/branches/branch_4x/solr/common-build.xml Thu Dec 20
: > +++ 23:43:47 2012
: > @@ -109,6 +109,19 @@
: > 
: >    <path id="test.classpath" refid="solr.test.base.classpath"/>
: > 
: > +  <macrodef name="force-test-file-perms">
: > +    <attribute name="build.dir" />
: > +    <attribute name="perms" />
: > +    <sequential>
: > +      <chmod perm="@{perms}" type="both">
: > +        <fileset dir="@{build.dir}" erroronmissingdir="false">
: > +          <include name="**/test-files" />
: > +          <include name="**/test-files/**" />
: > +        </fileset>
: > +      </chmod>
: > +    </sequential>
: > +  </macrodef>
: > +
: >    <macrodef name="solr-contrib-uptodate">
: >      <attribute name="name"/>
: >      <attribute name="property" default="@{name}.uptodate"/> @@ -381,6
: > +394,8 @@
: >      <sync todir="${build.dir}/test-files">
: >        <fileset dir="${tests.userdir}"/>
: >      </sync>
: > +    <!-- don't let tests muck with this -->
: > +    <force-test-file-perms build.dir="${build.dir}" perms="ugo-w" />
: >    </target>
: > 
: >    <!-- Solr test-framework targets -->
: > @@ -433,6 +448,14 @@
: >      <contrib-crawl target="add-to-war"/>
: >    </target>
: > 
: > +  <target name="clean"
: > +          description="Removes contents of build and dist directories"
: > +          depends="-make-test-files-writable, common.clean" />  <target
: > + name="-make-test-files-writable">
: > +    <force-test-file-perms build.dir="${build.dir}" perms="u+w" />
: > + </target>
: > +
: > +
: >    <!-- hack for now to disable *all* Solr tests on Jenkins when 
"tests.disable-
: > solr" property is set -->
: >    <target name="test" unless="tests.disable-solr">
: >      <antcall target="common.test" inheritrefs="true" inheritall="true"/>
: > 
: > Modified:
: > lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/
: > ZkController.java
: > URL:
: > http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/sr
: > c/java/org/apache/solr/cloud/ZkController.java?rev=1424762&r1=1424761&r
: > 2=1424762&view=diff
: > ==========================================================
: > ====================
: > ---
: > lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/
: > ZkController.java (original)
: > +++
: > lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/clo
: > +++ ud/ZkController.java Thu Dec 20 23:43:47 2012
: > @@ -142,17 +142,12 @@ public final class ZkController {
: >        TimeoutException, IOException {
: >      if (cc == null) throw new IllegalArgumentException("CoreContainer 
cannot
: > be null.");
: >      this.cc = cc;
: > -    if (localHostContext.startsWith("/")) {
: > -      // be forgiving and strip this off
: > -      // this allows us to support users specifying hostContext="/" in
: > -      // solr.xml to indicate the root context, instead of hostContext=""
: > -      // which means the default of "solr"
: > -      localHostContext = localHostContext.substring(1);
: > -    }
: > -    if (localHostContext.endsWith("/")) {
: > -      // be extra nice
: > -      localHostContext =
: > localHostContext.substring(0,localHostContext.length()-1);
: > -    }
: > +
: > +    // be forgiving and strip this off leading/trailing slashes
: > +    // this allows us to support users specifying hostContext="/" in
: > +    // solr.xml to indicate the root context, instead of hostContext=""
: > +    // which means the default of "solr"
: > +    localHostContext = trimLeadingAndTrailingSlashes(localHostContext);
: > 
: >      updateShardHandler = new
: > UpdateShardHandler(distribUpdateConnTimeout, distribUpdateSoTimeout);
: > 
: > @@ -1313,9 +1308,9 @@ public final class ZkController {
: >    /**
: >     * Returns the nodeName that should be used based on the specified
: > properties.
: >     *
: > -   * @param hostName - must not be the empty string
: > -   * @param hostPort - must consist only of digits, must not be the empty
: > string
: > -   * @param hostContext - should not begin or end with a slash, may be the
: > empty string to denote the root context
: > +   * @param hostName - must not be null or the empty string
: > +   * @param hostPort - must consist only of digits, must not be null or the
: > empty string
: > +   * @param hostContext - should not begin or end with a slash
: > + (leading/trailin slashes will be ignored), must not be null, may be
: > + the empty string to denote the root context
: >     * @lucene.experimental
: >     * @see SolrZkClient#getBaseUrlForNodeName
: >     */
: > @@ -1324,9 +1319,27 @@ public final class ZkController {
: >                                   final String hostContext) {
: >      try {
: >        return hostName + ':' + hostPort + '_' +
: > -        URLEncoder.encode(hostContext, "UTF-8");
: > +        URLEncoder.encode(trimLeadingAndTrailingSlashes(hostContext),
: > + "UTF-8");
: >      } catch (UnsupportedEncodingException e) {
: >        throw new IllegalStateException("JVM Does not seem to support UTF-8",
: > e);
: >      }
: >    }
: > +
: > +  /**
: > +   * utilitiy method fro trimming and leading and/or trailing slashes from
: > +   * it's input.  May return the empty string.  May return null if and only
: > +   * if the input is null.
: > +   */
: > +  private static String trimLeadingAndTrailingSlashes(final String in) {
: > +    if (null == in) return in;
: > +
: > +    String out = in;
: > +    if (out.startsWith("/")) {
: > +      out = out.substring(1);
: > +    }
: > +    if (out.endsWith("/")) {
: > +      out = out.substring(0,out.length()-1);
: > +    }
: > +    return out;
: > +  }
: >  }
: > 
: > Modified:
: > lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/
: > ZkControllerTest.java
: > URL:
: > http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/sr
: > c/test/org/apache/solr/cloud/ZkControllerTest.java?rev=1424762&r1=14247
: > 61&r2=1424762&view=diff
: > ==========================================================
: > ====================
: > ---
: > lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/
: > ZkControllerTest.java (original)
: > +++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/clo
: > +++ ud/ZkControllerTest.java Thu Dec 20 23:43:47 2012
: > @@ -53,10 +53,22 @@ public class ZkControllerTest extends So
: >      // nodeName from parts
: >      assertEquals("localhost:8888_solr",
: >                   ZkController.generateNodeName("localhost", "8888", 
"solr"));
: > -    assertEquals("localhost:8888_", // root context
: > +    assertEquals("localhost:8888_solr",
: > +                 ZkController.generateNodeName("localhost", "8888", 
"/solr"));
: > +    assertEquals("localhost:8888_solr",
: > +                 ZkController.generateNodeName("localhost", "8888", 
"/solr/"));
: > +    // root context
: > +    assertEquals("localhost:8888_",
: >                   ZkController.generateNodeName("localhost", "8888", ""));
: > +    assertEquals("localhost:8888_",
: > +                 ZkController.generateNodeName("localhost", "8888", "/"));
: > +    // subdir
: >      assertEquals("foo-bar:77_solr%2Fsub_dir",
: >                   ZkController.generateNodeName("foo-bar", "77", 
"solr/sub_dir"));
: > +    assertEquals("foo-bar:77_solr%2Fsub_dir",
: > +                 ZkController.generateNodeName("foo-bar", "77",
: > "/solr/sub_dir"));
: > +    assertEquals("foo-bar:77_solr%2Fsub_dir",
: > +                 ZkController.generateNodeName("foo-bar", "77",
: > + "/solr/sub_dir/"));
: > 
: >      // setup a SolrZkClient to do some getBaseUrlForNodeName testing
: >      String zkDir = dataDir.getAbsolutePath() + File.separator @@ -75,27 
+87,41
: > @@ public class ZkControllerTest extends So
: >          // getBaseUrlForNodeName
: >          assertEquals("http://zzz.xxx:1234/solr";,
: >                       zkClient.getBaseUrlForNodeName("zzz.xxx:1234_solr"));
: > -        assertEquals("http://xxx:99/";,
: > +        assertEquals("http://xxx:99";,
: >                       zkClient.getBaseUrlForNodeName("xxx:99_"));
: >          assertEquals("http://foo-bar.baz.org:9999/some_dir";,
: >                       zkClient.getBaseUrlForNodeName("foo-
: > bar.baz.org:9999_some_dir"));
: >          assertEquals("http://foo-bar.baz.org:9999/solr/sub_dir";,
: >                       zkClient.getBaseUrlForNodeName("foo-
: > bar.baz.org:9999_solr%2Fsub_dir"));
: > 
: > -
: >          // generateNodeName + getBaseUrlForNodeName
: >          assertEquals("http://foo:9876/solr";,
: >                       zkClient.getBaseUrlForNodeName
: >                       (ZkController.generateNodeName("foo","9876","solr")));
: > +        assertEquals("http://foo:9876/solr";,
: > +                     zkClient.getBaseUrlForNodeName
: > +                     
(ZkController.generateNodeName("foo","9876","/solr")));
: > +        assertEquals("http://foo:9876/solr";,
: > +                     zkClient.getBaseUrlForNodeName
: > +
: > + (ZkController.generateNodeName("foo","9876","/solr/")));
: >          assertEquals("http://foo.bar.com:9876/solr/sub_dir";,
: >                       zkClient.getBaseUrlForNodeName
: > 
: > (ZkController.generateNodeName("foo.bar.com","9876","solr/sub_dir")));
: > -        assertEquals("http://foo-bar:9876/";,
: > +        assertEquals("http://foo.bar.com:9876/solr/sub_dir";,
: > +                     zkClient.getBaseUrlForNodeName
: > +
: > (ZkController.generateNodeName("foo.bar.com","9876","/solr/sub_dir/")));
: > +        assertEquals("http://foo-bar:9876";,
: >                       zkClient.getBaseUrlForNodeName
: >                       (ZkController.generateNodeName("foo-bar","9876","")));
: > +        assertEquals("http://foo-bar:9876";,
: > +                     zkClient.getBaseUrlForNodeName
: > +
: > + (ZkController.generateNodeName("foo-bar","9876","/")));
: >          assertEquals("http://foo-bar.com:80/some_dir";,
: >                       zkClient.getBaseUrlForNodeName
: >                       (ZkController.generateNodeName("foo-
: > bar.com","80","some_dir")));
: > +        assertEquals("http://foo-bar.com:80/some_dir";,
: > +                     zkClient.getBaseUrlForNodeName
: > +
: > + (ZkController.generateNodeName("foo-bar.com","80","/some_dir")));
: >        } finally {
: >          zkClient.close();
: >        }
: > 
: > Modified:
: > lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/comm
: > on/cloud/SolrZkClient.java
: > URL:
: > http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/sr
: > c/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1424762&r1=1
: > 424761&r2=1424762&view=diff
: > ==========================================================
: > ====================
: > ---
: > lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/comm
: > on/cloud/SolrZkClient.java (original)
: > +++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/co
: > +++ mmon/cloud/SolrZkClient.java Thu Dec 20 23:43:47 2012
: > @@ -484,7 +484,7 @@ public class SolrZkClient {
: >      try {
: >        final String path = URLDecoder.decode(nodeName.substring(1+_offset),
: >                                              "UTF-8");
: > -      return "http://"; + hostAndPort + "/" + path;
: > +      return "http://"; + hostAndPort + (path.isEmpty() ? "" : ("/" +
: > + path));
: >      } catch (UnsupportedEncodingException e) {
: >        throw new IllegalStateException("JVM Does not seem to support UTF-8",
: > e);
: >      }
: 
: 
: 
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [email protected]
: For additional commands, e-mail: [email protected]
: 
: 

-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to