mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
Added logging to CRC factory for fallback cases
GitOrigin-RevId: 61b897798946ca4ab848f01b120afc010b8d9916
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d9870fb68f
commit
19b7725ecf
+18
-2
@@ -6,6 +6,7 @@ import com.intellij.lang.cacheBuilder.CacheBuilderRegistry;
|
||||
import com.intellij.lang.cacheBuilder.WordOccurrence;
|
||||
import com.intellij.lang.cacheBuilder.WordsScanner;
|
||||
import com.intellij.lang.findUsages.LanguageFindUsages;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
@@ -22,6 +23,9 @@ import java.util.zip.CRC32;
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public class ConfigurationFileCrcFactory {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(ConfigurationFileCrcFactory.class);
|
||||
|
||||
private final VirtualFile myFile;
|
||||
|
||||
@Deprecated // left for plugin compatibility
|
||||
@@ -34,10 +38,16 @@ public class ConfigurationFileCrcFactory {
|
||||
}
|
||||
|
||||
public long create() {
|
||||
if (myFile.isDirectory()) return myFile.getModificationStamp();
|
||||
if (myFile.isDirectory()) {
|
||||
debug("Cannot calculate CRC for directory '" + myFile.getPath() + "'");
|
||||
return myFile.getModificationStamp();
|
||||
}
|
||||
|
||||
WordsScanner wordsScanner = getScanner(myFile);
|
||||
if (wordsScanner == null) return myFile.getModificationStamp();
|
||||
if (wordsScanner == null) {
|
||||
debug("WordsScanner not found for file '" + myFile.getPath() + "'");
|
||||
return myFile.getModificationStamp();
|
||||
}
|
||||
|
||||
CRC32 crc32 = new CRC32();
|
||||
Document document = FileDocumentManager.getInstance().getCachedDocument(myFile);
|
||||
@@ -68,4 +78,10 @@ public class ConfigurationFileCrcFactory {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void debug(@NotNull String message) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user