aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-02-24 07:56:55 -0800
committerTor Norbye <tnorbye@google.com>2012-02-24 09:14:33 -0800
commit0fe590d956435c3c6a2d4c802108f627b173a573 (patch)
treef99ed167eee6edcfbda48109cbd06c5a7d12dae8 /eclipse
parent9e36cb7689bf68ceafff3385e95dc24b756c34d5 (diff)
downloadsdk-0fe590d956435c3c6a2d4c802108f627b173a573.zip
sdk-0fe590d956435c3c6a2d4c802108f627b173a573.tar.gz
sdk-0fe590d956435c3c6a2d4c802108f627b173a573.tar.bz2
Lint bug fixes
This changeset fixes a couple of Lint bugs: (1) Handle BOMs (byte order marks) in Java files. We already handle this for XML files (where it's common) but these can be present in other file types as well, such as Java. See http://code.google.com/p/android/issues/detail?id=25952 (2) Fix a bug (false positive) in the FloatMath detector; the visitor approach can get confused; do simple ASM node iteration instead (which is how all the other detectors work; this detector was written before we had the ASM DOM model) Change-Id: I65b4e6cd8d8e6c7e591433d8eb5aedf273e2caad
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
index 3da3fc2..000abd9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java
@@ -36,6 +36,7 @@ import com.android.tools.lint.detector.api.DefaultPosition;
import com.android.tools.lint.detector.api.Detector;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.JavaContext;
+import com.android.tools.lint.detector.api.LintUtils;
import com.android.tools.lint.detector.api.Location;
import com.android.tools.lint.detector.api.Location.Handle;
import com.android.tools.lint.detector.api.Position;
@@ -43,8 +44,6 @@ import com.android.tools.lint.detector.api.Project;
import com.android.tools.lint.detector.api.Severity;
import com.android.tools.lint.detector.api.XmlContext;
import com.android.util.Pair;
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -572,7 +571,7 @@ public class EclipseLintClient extends LintClient implements IDomParser {
private String readPlainFile(File file) {
try {
- return Files.toString(file, Charsets.UTF_8);
+ return LintUtils.getEncodedString(file);
} catch (IOException e) {
return ""; //$NON-NLS-1$
}