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: [email protected] > -----Original Message----- > From: Uwe Schindler [mailto:[email protected]] > Sent: Sunday, March 03, 2013 10:54 PM > To: [email protected] > 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: [email protected] > > > -----Original Message----- > > From: [email protected] [mailto:[email protected]] > > Sent: Sunday, March 03, 2013 8:51 PM > > To: [email protected] > > 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: [email protected] For additional > commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
