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 2014/04/01 00:22:30 UTC
svn commit: r1583477 - in /lucene/dev/branches/branch_4x: ./ solr/
solr/contrib/ solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/
solr/core/ solr/core/src/java/org/apache/solr/core/
solr/core/src/test/org/apache/solr/cloud/ solr/core/src/test/o...
Author: uschindler
Date: Mon Mar 31 22:22:30 2014
New Revision: 1583477
URL: http://svn.apache.org/r1583477
Log:
Merged revision(s) 1583476 from lucene/dev/trunk:
LUCENE-5560: Replace com.google.common.base.Charsets by Java7 StandardCharsets
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/contrib/ (props changed)
lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/MapReduceIndexerTool.java
lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/TreeMergeOutputFormat.java
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
Modified: lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/MapReduceIndexerTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/MapReduceIndexerTool.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/MapReduceIndexerTool.java (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/MapReduceIndexerTool.java Mon Mar 31 22:22:30 2014
@@ -83,7 +83,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kitesdk.morphline.base.Fields;
-import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.io.ByteStreams;
@@ -1264,7 +1263,7 @@ public class MapReduceIndexerTool extend
byte[] bytes = ByteStreams.toByteArray(in);
in.close();
Preconditions.checkArgument(bytes.length > 0);
- int solrShard = Integer.parseInt(new String(bytes, Charsets.UTF_8));
+ int solrShard = Integer.parseInt(new String(bytes, StandardCharsets.UTF_8));
if (!delete(solrShardNumberFile, false, fs)) {
return false;
}
Modified: lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/TreeMergeOutputFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/TreeMergeOutputFormat.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/TreeMergeOutputFormat.java (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/TreeMergeOutputFormat.java Mon Mar 31 22:22:30 2014
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -43,7 +44,6 @@ import org.apache.solr.store.hdfs.HdfsDi
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
/**
@@ -188,7 +188,7 @@ public class TreeMergeOutputFormat exten
LOG.debug("Merging into outputShardNum: " + outputShardNum + " from taskId: " + taskId);
Path shardNumberFile = new Path(workDir.getParent().getParent(), TreeMergeMapper.SOLR_SHARD_NUMBER);
OutputStream out = shardNumberFile.getFileSystem(context.getConfiguration()).create(shardNumberFile);
- Writer writer = new OutputStreamWriter(out, Charsets.UTF_8);
+ Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
writer.write(String.valueOf(outputShardNum));
writer.flush();
writer.close();
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java Mon Mar 31 22:22:30 2014
@@ -17,7 +17,6 @@ package org.apache.solr.core;
* limitations under the License.
*/
-import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams;
import org.apache.commons.io.IOUtils;
@@ -66,7 +65,7 @@ public abstract class ConfigSolr {
"solr.xml does not exist in " + configFile.getAbsolutePath() + " cannot start Solr");
}
log.info("{} does not exist, using default configuration", configFile.getAbsolutePath());
- inputStream = new ByteArrayInputStream(ConfigSolrXmlOld.DEF_SOLR_XML.getBytes(Charsets.UTF_8));
+ inputStream = new ByteArrayInputStream(ConfigSolrXmlOld.DEF_SOLR_XML.getBytes(StandardCharsets.UTF_8));
} else {
inputStream = new FileInputStream(configFile);
}
@@ -82,7 +81,7 @@ public abstract class ConfigSolr {
}
public static ConfigSolr fromString(SolrResourceLoader loader, String xml) {
- return fromInputStream(loader, new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8)));
+ return fromInputStream(loader, new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
}
public static ConfigSolr fromInputStream(SolrResourceLoader loader, InputStream is) {
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java Mon Mar 31 22:22:30 2014
@@ -17,7 +17,6 @@ package org.apache.solr.core;
* limitations under the License.
*/
-import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import org.apache.solr.common.SolrException;
import org.apache.solr.util.IOUtils;
@@ -31,6 +30,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;
@@ -79,7 +79,7 @@ public class CorePropertiesLocator imple
Writer os = null;
try {
propfile.getParentFile().mkdirs();
- os = new OutputStreamWriter(new FileOutputStream(propfile), Charsets.UTF_8);
+ os = new OutputStreamWriter(new FileOutputStream(propfile), StandardCharsets.UTF_8);
p.store(os, "Written by CorePropertiesLocator");
}
catch (IOException e) {
@@ -147,7 +147,7 @@ public class CorePropertiesLocator imple
File instanceDir = propertiesFile.getParentFile();
Properties coreProperties = new Properties();
fis = new FileInputStream(propertiesFile);
- coreProperties.load(new InputStreamReader(fis, Charsets.UTF_8));
+ coreProperties.load(new InputStreamReader(fis, StandardCharsets.UTF_8));
String name = createName(coreProperties, instanceDir);
return new CoreDescriptor(cc, name, instanceDir.getAbsolutePath(), coreProperties);
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java Mon Mar 31 22:22:30 2014
@@ -17,7 +17,6 @@ package org.apache.solr.core;
* limitations under the License.
*/
-import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -29,6 +28,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -157,7 +157,7 @@ public class SolrXMLCoresLocator impleme
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
- writer = new OutputStreamWriter(fos, Charsets.UTF_8);
+ writer = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
writer.write(xml);
writer.close();
logger.info("Persisted core descriptions to {}", file.getAbsolutePath());
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java Mon Mar 31 22:22:30 2014
@@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.apache.solr.SolrTestCaseJ4;
@@ -36,7 +37,6 @@ import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-import com.google.common.base.Charsets;
public class SolrXmlInZkTest extends SolrTestCaseJ4 {
@@ -86,7 +86,7 @@ public class SolrXmlInZkTest extends Sol
zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);
if (toZk) {
- zkClient.makePath("solr.xml", XML_FOR_ZK.getBytes(Charsets.UTF_8), true);
+ zkClient.makePath("solr.xml", XML_FOR_ZK.getBytes(StandardCharsets.UTF_8), true);
}
zkClient.close();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java Mon Mar 31 22:22:30 2014
@@ -18,7 +18,6 @@
package org.apache.solr.core;
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-import com.google.common.base.Charsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.util.IOUtils;
@@ -45,6 +44,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -404,7 +404,7 @@ public class TestSolrXmlPersistence exte
String defXml = FileUtils.readFileToString(
new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"),
- Charsets.UTF_8.toString());
+ StandardCharsets.UTF_8.name());
final CoreContainer cores = init(defXml, "collection1");
SolrXMLCoresLocator.NonPersistingLocator locator
= (SolrXMLCoresLocator.NonPersistingLocator) cores.getCoresLocator();
@@ -507,7 +507,7 @@ public class TestSolrXmlPersistence exte
}
private String[] getAllNodes(String xmlString) throws ParserConfigurationException, IOException, SAXException {
- return getAllNodes(new ByteArrayInputStream(xmlString.getBytes(Charsets.UTF_8)));
+ return getAllNodes(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
}
/*
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Mon Mar 31 22:22:30 2014
@@ -28,6 +28,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -1472,8 +1473,8 @@ public class TestReplicationHandler exte
* character copy of file using UTF-8. If port is non-null, will be substituted any time "TEST_PORT" is found.
*/
private static void copyFile(File src, File dst, Integer port, boolean internalCompression) throws IOException {
- BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(src), "UTF-8"));
- Writer out = new OutputStreamWriter(new FileOutputStream(dst), "UTF-8");
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(src), StandardCharsets.UTF_8));
+ Writer out = new OutputStreamWriter(new FileOutputStream(dst), StandardCharsets.UTF_8);
for (String line = in.readLine(); null != line; line = in.readLine()) {
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1583477&r1=1583476&r2=1583477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Mon Mar 31 22:22:30 2014
@@ -20,6 +20,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Date;
@@ -33,8 +34,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import com.google.common.base.Charsets;
-
/**
* A test case for the several HTTP cache headers emitted by Solr
*/
@@ -248,7 +247,7 @@ public class CacheHeaderTest extends Cac
}
protected File makeFile(String contents) {
- return makeFile(contents, Charsets.UTF_8.toString());
+ return makeFile(contents, StandardCharsets.UTF_8.name());
}
protected File makeFile(String contents, String charset) {