LUCENE-5347: Upgrade forbidden-apis checker to version 1.4. Fix Zookeeper bug with default encoding.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1544370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-11-21 23:27:19 +00:00
parent 21afda7b22
commit 0971bc8f21
10 changed files with 19 additions and 11 deletions

View File

@ -159,7 +159,7 @@
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>1.3</version>
<version>1.4</version>
<configuration>
<!--
This is the default setting, we don't support too new Java versions.

View File

@ -78,6 +78,9 @@ Build
* LUCENE-5322: Clean up / simplify Maven-related Ant targets.
(Steve Rowe)
* LUCENE-5347: Upgrade forbidden-apis checker to version 1.4.
(Uwe Schindler)
======================= Lucene 4.6.0 =======================
New Features

View File

@ -2182,7 +2182,7 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}
<property name="forbidden-sysout-excludes" value=""/>
<target name="-install-forbidden-apis" unless="forbidden-apis.loaded" depends="ivy-availability-check,ivy-configure">
<ivy:cachepath organisation="de.thetaphi" module="forbiddenapis" revision="1.3"
<ivy:cachepath organisation="de.thetaphi" module="forbiddenapis" revision="1.4"
inline="true" conf="default" transitive="true" pathid="forbidden-apis.classpath"/>
<taskdef name="forbidden-apis" classname="de.thetaphi.forbiddenapis.AntTask" classpathref="forbidden-apis.classpath"/>
<property name="forbidden-apis.loaded" value="true"/>

View File

@ -130,6 +130,11 @@ Bug Fixes
* SOLR-4709: The core reload after replication if config files have changed
can fail due to a race condition. (Mark Miller, Hossman))
* LUCENE-5347: Fixed Solr's Zookeeper Client to copy files to Zookeeper using
binary transfer. Previously data was read with default encoding and stored
in zookeeper as UTF-8. This bug was found after upgrading to forbidden-apis
1.4. (Uwe Schindler)
Optimizations
----------------------

View File

@ -423,7 +423,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
File home = null;
try {
home = new File(FileUtils.getTempDirectory(), "SOLR_5459"); // Unlikely to name a core or collection this!
FileUtils.writeStringToFile(new File(home, "solr.xml"), "<solr></solr>"); // Use auto-discovery
FileUtils.writeStringToFile(new File(home, "solr.xml"), "<solr></solr>", "UTF-8"); // Use auto-discovery
File coll = new File(home, "SOLR_5459");
SolrCore core = req.getCore();
@ -447,7 +447,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
new File(coll, "conf"));
}
FileUtils.writeStringToFile(new File(coll, "core.properties"), "name=SOLR_5459");
FileUtils.writeStringToFile(new File(coll, "core.properties"), "name=SOLR_5459", "UTF-8");
FileUtils.copyInputStreamToFile(stream.getStream(),
new File(new File(coll, "conf"), req.getParams().get("file", null)));

View File

@ -121,7 +121,7 @@ public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 {
String configDir = core.getResourceLoader().getConfigDir();
FileUtils.moveFile(new File(configDir, "stopwords.txt"), new File(configDir, "stopwords.txt.bak"));
File file = new File(configDir, "stopwords.txt");
FileUtils.writeStringToFile(file, stopwords);
FileUtils.writeStringToFile(file, stopwords, "UTF-8");
} finally {
core.close();

View File

@ -579,7 +579,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
System.getProperty("line.separator") + "transient=true" +
System.getProperty("line.separator") + "loadOnStartup=true", Charsets.UTF_8.toString());
FileUtils.writeStringToFile(new File(subHome, "solrconfig.snippet.randomindexconfig.xml"), rand_snip);
FileUtils.writeStringToFile(new File(subHome, "solrconfig.snippet.randomindexconfig.xml"), rand_snip, Charsets.UTF_8.toString());
FileUtils.writeStringToFile(new File(subHome, "solrconfig.xml"), config, Charsets.UTF_8.toString());

View File

@ -100,7 +100,7 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
makeRequest(handler, req("action", "enable"));
assertTrue(healthcheckFile.exists());
assertNotNull(FileUtils.readFileToString(healthcheckFile), "UTF-8");
assertNotNull(FileUtils.readFileToString(healthcheckFile, "UTF-8"));
// now verify that the handler response with success

View File

@ -94,7 +94,7 @@ public class ModifyConfFileTest extends SolrTestCaseJ4 {
assertTrue("Schema should have caused core reload to fail!",
rsp.getException().getMessage().indexOf("SAXParseException") != -1);
String contents = FileUtils.readFileToString(new File(core.getCoreDescriptor().getInstanceDir(), "conf/schema.xml"));
String contents = FileUtils.readFileToString(new File(core.getCoreDescriptor().getInstanceDir(), "conf/schema.xml"), Charsets.UTF_8.toString());
assertFalse("Schema contents should NOT have changed!", contents.contains("Testing rewrite of schema.xml file."));
streams.add(new ContentStreamBase.StringStream("This should barf"));
@ -110,7 +110,7 @@ public class ModifyConfFileTest extends SolrTestCaseJ4 {
locReq.setContentStreams(streams);
core.execute(handler, locReq, rsp);
contents = FileUtils.readFileToString(new File(core.getCoreDescriptor().getInstanceDir(),
"conf/velocity/test.vm"));
"conf/velocity/test.vm"), Charsets.UTF_8.toString());
assertEquals("Schema contents should have changed!", "Some bogus stuff for a test.", contents);
streams.clear();

View File

@ -481,8 +481,8 @@ public class SolrZkClient {
log.info("Write to ZooKeepeer " + file.getAbsolutePath() + " to " + path);
}
String data = FileUtils.readFileToString(file);
return setData(path, data.getBytes("UTF-8"), retryOnConnLoss);
byte[] data = FileUtils.readFileToByteArray(file);
return setData(path, data, retryOnConnLoss);
}
/**