Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 73949CA1B for ; Sun, 3 Mar 2013 23:58:48 +0000 (UTC) Received: (qmail 20494 invoked by uid 500); 3 Mar 2013 23:58:47 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 20436 invoked by uid 500); 3 Mar 2013 23:58:47 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 20429 invoked by uid 99); 3 Mar 2013 23:58:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Mar 2013 23:58:47 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_FRT_PROFILE2 X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of erickerickson@gmail.com designates 209.85.128.51 as permitted sender) Received: from [209.85.128.51] (HELO mail-qe0-f51.google.com) (209.85.128.51) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Mar 2013 23:58:40 +0000 Received: by mail-qe0-f51.google.com with SMTP id nd7so3486772qeb.24 for ; Sun, 03 Mar 2013 15:58:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=gMl7s5Yu/HVG+8Mxmlo9hjIMm6Vl+yUcZX2AkCyi4FY=; b=jXRF7rT8R8iO7TEgcw7KfEpopoWUuf9OM/LxvlWeVVw4KdKXzQbLsv+BYMRfaz4m6l +/3Ozr5dUdwZ88j2z4ctDC+JaWaOlkpYXZ1DBFvvRGvccbvX6cI9EhT8k7W/BmCxE3fF Eu6oqTVJxLVTKq2kI7SFglBDfFcWLkO83Um//PQ+95xdd7TdWGYvrmpimOT2mUQjNc8Q dh3FrF6TWptGVQAeTaNpORm8BQuUPthGKt7TR4ODVbUCJcbGJcayUV3szVAwqIg7Ixwx vp1qyxA5NBZ54JXgv0l0X7xpT3olyap9fkJGtf997TcuzKa10RHuIgxITjQ3Zrs7ujVX 3lwA== MIME-Version: 1.0 X-Received: by 10.224.185.148 with SMTP id co20mr31188417qab.94.1362355099357; Sun, 03 Mar 2013 15:58:19 -0800 (PST) Received: by 10.49.53.41 with HTTP; Sun, 3 Mar 2013 15:58:19 -0800 (PST) In-Reply-To: <005f01ce185b$1740db20$45c29160$@thetaphi.de> References: <20130303195113.244E8238889B@eris.apache.org> <005e01ce1859$9023bbe0$b06b33a0$@thetaphi.de> <005f01ce185b$1740db20$45c29160$@thetaphi.de> Date: Sun, 3 Mar 2013 18:58:19 -0500 Message-ID: Subject: Re: svn commit: r1452115 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDiscoveryProperties.java From: Erick Erickson To: dev@lucene.apache.org Content-Type: multipart/alternative; boundary=485b397dd697c1794304d70e031b X-Virus-Checked: Checked by ClamAV on apache.org --485b397dd697c1794304d70e031b Content-Type: text/plain; charset=ISO-8859-1 Thanks, that'll teach me to pay attention to the Javadocs for FileOutputStream..... On Sun, Mar 3, 2013 at 5:04 PM, Uwe Schindler wrote: > I fixed it. > > In addition, not using InputStream/OutputStream would make it > inconsistent, as SolrProperties.java and the other methods are using > streams and not charstreams to read/write. So the format would not fit > otherwise. > > Uwe > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: uwe@thetaphi.de > > > > -----Original Message----- > > From: Uwe Schindler [mailto:uwe@thetaphi.de] > > Sent: Sunday, March 03, 2013 10:54 PM > > To: dev@lucene.apache.org > > Subject: RE: svn commit: r1452115 - > > /lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDiscove > > ryProperties.java > > > > For properties files, FileWriter is wrong. Properties should always be > written > > by OutputStream, as the format is defined to be binary (see javadocs). > > > > Uwe > > > > ----- > > Uwe Schindler > > H.-H.-Meier-Allee 63, D-28213 Bremen > > http://www.thetaphi.de > > eMail: uwe@thetaphi.de > > > > > -----Original Message----- > > > From: erick@apache.org [mailto:erick@apache.org] > > > Sent: Sunday, March 03, 2013 8:51 PM > > > To: commits@lucene.apache.org > > > Subject: svn commit: r1452115 - > > > /lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDisc > > > ove > > > ryProperties.java > > > > > > Author: erick > > > Date: Sun Mar 3 19:51:12 2013 > > > New Revision: 1452115 > > > > > > URL: http://svn.apache.org/r1452115 > > > Log: > > > Part of SOLR-4525. Need to close some file streams in the test case. > > > > > > Modified: > > > > > > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDisco > > > ver > > > yProperties.java > > > > > > Modified: > > > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDisco > > > ver > > > yProperties.java > > > URL: > > > http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/a > > > pa > > > > > che/solr/core/TestSolrDiscoveryProperties.java?rev=1452115&r1=1452114& > > > r > > > 2=1452115&view=diff > > > > > ========================================================== > > > ==================== > > > --- > > > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDisco > > > ver > > > yProperties.java (original) > > > +++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrD > > > +++ is coveryProperties.java Sun Mar 3 19:51:12 2013 > > > @@ -12,7 +12,7 @@ package org.apache.solr.core; > > > * > > > * Unless required by applicable law or agreed to in writing, software > > > * distributed under the License is distributed on an "AS IS" BASIS, > > > - * WITHOUT WARRANTIES OR CONDITIONS F ANY KIND, either express or > > > implied. > > > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express > > or > > > implied. > > > * See the License for the specific language governing permissions and > > > * limitations under the License. > > > */ > > > @@ -26,7 +26,7 @@ import org.junit.Test; > > > > > > import java.io.File; > > > import java.io.FileInputStream; > > > -import java.io.FileOutputStream; > > > +import java.io.FileWriter; > > > import java.io.StringReader; > > > import java.util.Properties; > > > import java.util.Set; > > > @@ -39,7 +39,7 @@ public class TestSolrDiscoveryProperties > > > initCore(); > > > } > > > > > > - private final File solrHomeDirectory = new File(TEMP_DIR, > > > "org.apache.solr.core.TestSolrProperties" + File.separator + > > > "solrHome"); > > > + private final File solrHomeDirectory = new File(TEMP_DIR, > > > + "org.apache.solr.core.TestSolrDiscoveryProperties" + File.separator > > > + + "solrHome"); > > > > > > private void setMeUp() throws Exception { > > > if (solrHomeDirectory.exists()) { @@ -57,7 +57,9 @@ public class > > > TestSolrDiscoveryProperties > > > String[] parts = extra.split("="); > > > props.put(parts[0], parts[1]); > > > } > > > - props.store(new FileOutputStream(solrProps.getAbsolutePath()), > null); > > > + FileWriter writer = new FileWriter(solrProps.getAbsolutePath()); > > > + props.store(writer, null); > > > + writer.close(); > > > } > > > > > > private void addSolrXml() throws Exception { @@ -88,7 +90,11 @@ > > > public class TestSolrDiscoveryProperties > > > stockProps.getProperty(CoreDescriptor.CORE_NAME) + > > > File.separator + SolrProperties.CORE_PROP_FILE); > > > File parent = propFile.getParentFile(); > > > assertTrue("Failed to mkdirs for " + parent.getAbsolutePath(), > > > parent.mkdirs()); > > > - stockProps.store(new FileOutputStream(propFile), null); > > > + > > > + FileWriter writer = new FileWriter(propFile); > > > + stockProps.store(writer, null); > > > + writer.close(); > > > + > > > addConfFiles(new File(parent, "conf")); > > > } > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional > > commands, e-mail: dev-help@lucene.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: dev-help@lucene.apache.org > > --485b397dd697c1794304d70e031b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks, that'll teach me to pay attention to the Javad= ocs for FileOutputStream.....


On Sun, Mar 3, 2013 at 5:04 PM, Uwe Schindler <uwe@the= taphi.de> wrote:
I fixed it.

In addition, not using InputStream/OutputStream would make it inconsistent,= as SolrProperties.java and the other methods are using streams and not cha= rstreams to read/write. So the format would not fit otherwise.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de=
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Uwe Schindler [mailto:uwe@thetaphi.de]
> Sent: Sunday, March 03, 2013 10:54 PM
> To: dev@lucene.apache.org=
> Subject: RE: svn commit: r1452115 -
> /lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrDisc= ove
> ryProperties.java
>
> For properties files, FileWriter is wrong. Properties should always be= written
> by OutputStream, as the format is defined to be binary (see javadocs).=
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetap= hi.de
> eMail: uwe@thetaphi.de
>
> > -----Original Message-----
> > From: erick@apache.org [m= ailto:erick@apache.org]
> > Sent: Sunday, March 03, 2013 8:51 PM
> > To: commits@lucene.a= pache.org
> > Subject: svn commit: r1452115 -
> > /lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSol= rDisc
> > ove
> > ryProperties.java
> >
> > Author: erick
> > Date: Sun Mar =A03 19:51:12 2013
> > New Revision: 1452115
> >
> > URL: http://svn.apache.org/r1452115
> > Log:
> > Part of SOLR-4525. Need to close some file streams in the test ca= se.
> >
> > Modified:
> >
> > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolr= Disco
> > ver
> > yProperties.java
> >
> > Modified:
> > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolr= Disco
> > ver
> > yProperties.java
> > URL:
> > http://svn.apache.org/viewvc/lucene/dev= /trunk/solr/core/src/test/org/a
> > pa
> >
> che/solr/core/TestSolrDiscoveryProperties.java?rev=3D1452115&r1=3D= 1452114&
> > r
> > 2=3D1452115&view=3Ddiff
> >
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > ---
> > lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolr= Disco
> > ver
> > yProperties.java (original)
> > +++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/Test= SolrD
> > +++ is coveryProperties.java Sun Mar =A03 19:51:12 20= 13
> > @@ -12,7 +12,7 @@ package= org.apache.solr.core;
> > =A0 *
> > =A0 * Unless required by applicable law or agreed to in writing, = software
> > =A0 * distributed under the License is distributed on an "AS= IS" BASIS,
> > - * WITHOUT WARRANTIES OR CONDITIONS F ANY KIND, either express o= r
> > implied.
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express<= br> > or
> > implied.
> > =A0 * See the License for the specific language governing permiss= ions and
> > =A0 * limitations under the License.
> > =A0 */
> > @@ -26,7 +26,7 @@ import org.junit.Test;
> >
> > =A0import java.io.File;
> > =A0import java.io.FileInputStream;
> > -import java.io.FileOutputStream;
> > +import java.io.FileWriter;
> > =A0import java.io.StringReader;
> > =A0import java.util.Properties;
> > =A0import java.util.Set;
> > @@ -39,7 +39,7 @@ public class TestSolrDiscoveryProperties
> > =A0 =A0 =A0initCore();
> > =A0 =A0}
> >
> > - =A0private final File solrHomeDirectory =3D new File(TEMP_DIR,<= br> > > "org.apache.solr.core.TestSolrProperties" + File.separa= tor +
> > "solrHome");
> > + =A0private final File solrHomeDirectory =3D new File(TEMP_DIR,<= br> > > + "org.apache.solr.core.TestSolrDiscoveryProperties" + = File.separator
> > + + "solrHome");
> >
> > =A0 =A0private void setMeUp() throws Exception {
> > =A0 =A0 =A0if (solrHomeDirectory.exists()) { @@ -57,7 +57,9 @@ pu= blic class
> > TestSolrDiscoveryProperties
> > =A0 =A0 =A0 =A0String[] parts =3D extra.split("=3D"); > > =A0 =A0 =A0 =A0props.put(parts[0], parts[1]);
> > =A0 =A0 =A0}
> > - =A0 =A0props.store(new FileOutputStream(solrProps.getAbsolutePa= th()), null);
> > + =A0 =A0FileWriter writer =3D new FileWriter(solrProps.getAbsolu= tePath());
> > + =A0 =A0props.store(writer, null);
> > + =A0 =A0writer.close();
> > =A0 =A0}
> >
> > =A0 =A0private void addSolrXml() throws Exception { @@ -88,7 +90,= 11 @@
> > public class TestSolrDiscoveryProperties
> > =A0 =A0 =A0 =A0 =A0stockProps.getProperty(CoreDescriptor.CORE_NAM= E) +
> > File.separator + SolrProperties.CORE_PROP_FILE);
> > =A0 =A0 =A0File parent =3D propFile.getParentFile();
> > =A0 =A0 =A0assertTrue("Failed to mkdirs for " + parent.= getAbsolutePath(),
> > parent.mkdirs());
> > - =A0 =A0stockProps.store(new FileOutputStream(propFile), null);<= br> > > +
> > + =A0 =A0FileWriter writer =3D new FileWriter(propFile);
> > + =A0 =A0stockProps.store(writer, null);
> > + =A0 =A0writer.close();
> > +
> > =A0 =A0 =A0addConfFiles(new File(parent, "conf"));
> > =A0 =A0}
> >
>
>
>
> ---------------------------------------------------------------------<= br> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-he= lp@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


--485b397dd697c1794304d70e031b--