WI-11384 SVN: can't commit file (correct encoding for input stream passed into SAX parser of command-line svn output)

This commit is contained in:
irengrig
2012-05-30 14:23:43 +04:00
parent 63c8c3aa8a
commit 0f4e0d0e3f
2 changed files with 5 additions and 4 deletions
@@ -18,6 +18,7 @@ package org.jetbrains.idea.svn.commandLine;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.Consumer;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.portable.SvnExceptionWrapper;
@@ -32,6 +33,7 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.StringBufferInputStream;
@@ -106,9 +108,8 @@ public class SvnCommandLineInfoClient extends SvnkitSvnWcClient {
try {
final String result = command.run();
// todo not synchronized wrapper stream!
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new StringBufferInputStream(result), infoHandler[0]);
parser.parse(new ByteArrayInputStream(result.getBytes(CharsetToolkit.UTF8_CHARSET)), infoHandler[0]);
}
catch (SvnExceptionWrapper e) {
@@ -18,6 +18,7 @@ package org.jetbrains.idea.svn.commandLine;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.containers.Convertor;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.portable.PortableStatus;
@@ -156,9 +157,8 @@ public class SvnCommandLineStatusClient implements SvnStatusClientI {
try {
final String result = command.run();
// todo not synchronized wrapper stream!
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new StringBufferInputStream(result), svnHandl[0]);
parser.parse(new ByteArrayInputStream(result.getBytes(CharsetToolkit.UTF8_CHARSET)), svnHandl[0]);
if (! svnHandl[0].isAnythingReported()) {
if (! SvnUtil.isSvnVersioned(myProject, path)) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY));