Correcting getByte() sensitive to local file.encoding.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1357493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2012-07-05 08:49:17 +00:00
parent c92eb67f6d
commit e91e59af95
3 changed files with 4 additions and 4 deletions

View File

@ -51,8 +51,8 @@ public class TestDocument extends LuceneTestCase {
FieldType ft = new FieldType(); FieldType ft = new FieldType();
ft.setStored(true); ft.setStored(true);
IndexableField stringFld = new Field("string", binaryVal, ft); IndexableField stringFld = new Field("string", binaryVal, ft);
IndexableField binaryFld = new StoredField("binary", binaryVal.getBytes()); IndexableField binaryFld = new StoredField("binary", binaryVal.getBytes("UTF-8"));
IndexableField binaryFld2 = new StoredField("binary", binaryVal2.getBytes()); IndexableField binaryFld2 = new StoredField("binary", binaryVal2.getBytes("UTF-8"));
doc.add(stringFld); doc.add(stringFld);
doc.add(binaryFld); doc.add(binaryFld);

View File

@ -166,7 +166,7 @@ public class TestNumericRangeQueryBuilder extends LuceneTestCase {
private static Document getDocumentFromString(String str) private static Document getDocumentFromString(String str)
throws SAXException, IOException, ParserConfigurationException { throws SAXException, IOException, ParserConfigurationException {
InputStream is = new ByteArrayInputStream(str.getBytes()); InputStream is = new ByteArrayInputStream(str.getBytes("UTF-8"));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();

View File

@ -67,7 +67,7 @@ final class MockPayloadFilter extends TokenFilter {
@Override @Override
public boolean incrementToken() throws IOException { public boolean incrementToken() throws IOException {
if (input.incrementToken()) { if (input.incrementToken()) {
payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes())); payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes("UTF-8")));
int posIncr; int posIncr;
if (pos == 0 || i % 2 == 1) { if (pos == 0 || i % 2 == 1) {
posIncr = 1; posIncr = 1;