mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull, cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -88,7 +88,7 @@ public class SPIFileType extends LanguageFileType implements FileTypeIdentifiabl
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,7 +73,7 @@ public class JavaClassFileType implements FileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,7 +69,7 @@ public class ArchiveFileType implements FileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ public interface FileType extends Scheme {
|
||||
* Returns the name of the file type. The name must be unique among all file types registered in the system.
|
||||
* @return The file type name.
|
||||
*/
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
@@ -82,12 +81,11 @@ public interface FileType extends Scheme {
|
||||
/**
|
||||
* Returns the character set for the specified file.
|
||||
* @param file The file for which the character set is requested.
|
||||
* @param content
|
||||
* @return The character set name, in the format supported by {@link java.nio.charset.Charset} class.
|
||||
*/
|
||||
|
||||
@Nullable
|
||||
@NonNls
|
||||
String getCharset(@NotNull VirtualFile file, final byte[] content);
|
||||
String getCharset(@NotNull VirtualFile file, @NotNull byte[] content);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,7 +58,7 @@ public abstract class LanguageFileType implements FileType{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class UnknownFileType implements FileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,7 +81,7 @@ public class SubstitutedFileType extends LanguageFileType{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return myFileType.getCharset(file, content);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -854,7 +854,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,7 +91,7 @@ public class EnforcedPlainTextFileTypeFactory extends FileTypeFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class UiScriptFileType implements FileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -15,8 +30,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
class TaskQueue {
|
||||
private final AtomicInteger myDoWorkRequest = new AtomicInteger();
|
||||
private final AtomicInteger myUpdatesCount = new AtomicInteger();
|
||||
private final LinkedBlockingQueue<Runnable> myPendingWriteRequestsQueue = new LinkedBlockingQueue<Runnable>();
|
||||
private final LinkedBlockingQueue<Runnable> myTimestampUpdates = new LinkedBlockingQueue<Runnable>();
|
||||
private final BlockingQueue<Runnable> myPendingWriteRequestsQueue = new LinkedBlockingQueue<Runnable>();
|
||||
private final BlockingQueue<Runnable> myTimestampUpdates = new LinkedBlockingQueue<Runnable>();
|
||||
private final int myLimit;
|
||||
private final int myStealLimit;
|
||||
private final int myTimeStampUpdateSizeLimit;
|
||||
@@ -27,7 +42,7 @@ class TaskQueue {
|
||||
myTimeStampUpdateSizeLimit = 32;
|
||||
}
|
||||
|
||||
void submit(final Computable<Boolean> update, final Runnable successRunnable) {
|
||||
void submit(@NotNull final Computable<Boolean> update, @NotNull final Runnable successRunnable) {
|
||||
int currentTasksCount = myUpdatesCount.incrementAndGet();
|
||||
|
||||
myPendingWriteRequestsQueue.add(new Runnable() {
|
||||
@@ -61,20 +76,19 @@ class TaskQueue {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTimeStamps(int max) {
|
||||
Runnable runnable = myTimestampUpdates.poll();
|
||||
private void applyTimeStamps(final int max) {
|
||||
final Runnable runnable = myTimestampUpdates.poll();
|
||||
if (runnable == null) return;
|
||||
int updates = 0;
|
||||
AccessToken accessToken = ReadAction.start();
|
||||
try {
|
||||
while(runnable != null) {
|
||||
runnable.run();
|
||||
if (++updates == max) break;
|
||||
runnable = myTimestampUpdates.poll();
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int updates = 0;
|
||||
for (Runnable r = runnable; r != null; r = myTimestampUpdates.poll()) {
|
||||
r.run();
|
||||
if (++updates == max) break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
accessToken.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void ensureUpToDate() {
|
||||
@@ -84,7 +98,8 @@ class TaskQueue {
|
||||
if (runnable != null) runnable.run();
|
||||
}
|
||||
applyTimeStamps(Integer.MAX_VALUE);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class WorkspaceFileType implements InternalFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,9 +27,9 @@ public interface FileTypeConsumer {
|
||||
|
||||
void consume(@NotNull FileType fileType);
|
||||
|
||||
void consume(@NotNull FileType fileType, @NonNls final String extensions);
|
||||
void consume(@NotNull FileType fileType, @NonNls String extensions);
|
||||
|
||||
void consume(@NotNull FileType fileType, final FileNameMatcher... matchers);
|
||||
void consume(@NotNull FileType fileType, @NotNull FileNameMatcher... matchers);
|
||||
|
||||
@Nullable
|
||||
FileType getStandardFileTypeByName(@NonNls @NotNull String name);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class NativeFileType implements INativeFileType {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,7 +69,7 @@ public abstract class UserFileType <T extends UserFileType> implements FileType,
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,7 +55,7 @@ public class FileAttribute {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DataInputStream readAttribute(VirtualFile file) {
|
||||
public DataInputStream readAttribute(@NotNull VirtualFile file) {
|
||||
DataInputStream stream = ManagingFS.getInstance().readAttribute(file, this);
|
||||
if (stream != null) {
|
||||
try {
|
||||
@@ -72,7 +72,8 @@ public class FileAttribute {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public DataOutputStream writeAttribute(VirtualFile file) {
|
||||
@NotNull
|
||||
public DataOutputStream writeAttribute(@NotNull VirtualFile file) {
|
||||
final DataOutputStream stream = ManagingFS.getInstance().writeAttribute(file, this);
|
||||
try {
|
||||
DataInputOutputUtil.writeINT(stream, myVersion);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,7 +46,7 @@ public abstract class FakeFileType implements FileTypeIdentifiableByVirtualFile
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class ModuleFileType implements InternalFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class ProjectFileType implements InternalFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ public class PatchFileType implements FileType {
|
||||
|
||||
@Nullable
|
||||
@NonNls
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class EclipseFileType implements FileType {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCharset(@NotNull final VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull final VirtualFile file, @NotNull final byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,7 @@ public class PropertiesFileType extends LanguageFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
Charset charset = EncodingRegistry.getInstance().getDefaultCharsetForPropertiesFiles(file);
|
||||
if (charset == null) {
|
||||
charset = CharsetToolkit.getDefaultSystemCharset();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,7 +59,7 @@ public class GuiFormFileType implements /*UIBased*/FileType {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,7 +78,7 @@ public class PythonFileType extends LanguageFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
if (CharsetToolkit.hasUTF8Bom(content)) {
|
||||
return CharsetToolkit.UTF8;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -85,7 +85,7 @@ public abstract class QtFileType implements FileType, INativeFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,7 +69,7 @@ public class HtmlFileType extends XmlLikeFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull final VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull final VirtualFile file, @NotNull final byte[] content) {
|
||||
String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content);
|
||||
if (charset != null) return charset;
|
||||
@NonNls String strContent;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ public abstract class XmlLikeFileType extends LanguageFileType {
|
||||
super(language);
|
||||
}
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
|
||||
String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content);
|
||||
return charset == null ? CharsetToolkit.UTF8 : charset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user