From 0dc9b9d74ffb9167da960b566c4cbfcc9fa3d0a8 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Fri, 14 Oct 2016 10:01:06 +0300 Subject: [PATCH] File system can be case insensitive, so we can't invoke String#endsWith --- .../intellij/openapi/vfs/impl/FilePointerPartNode.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/FilePointerPartNode.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/FilePointerPartNode.java index a44a0bf8f380..da83b63f407d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/FilePointerPartNode.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/FilePointerPartNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -153,7 +153,7 @@ class FilePointerPartNode { Pair fileAndUrl = myFileAndUrl; if (fileAndUrl != null && fileAndUrl.second != null) { String url = fileAndUrl.second; - assert url.endsWith(part) : "part is: '"+part +"' but url is: '"+url+"'"; + assert endsWith(url, part) : "part is: '" + part + "' but url is: '" + url + "'"; } boolean hasFile = fileAndUrl != null && fileAndUrl.first != null; @@ -244,6 +244,10 @@ class FilePointerPartNode { return indexOfFirstDifferentChar(path, start, part, 0); } + private static boolean endsWith(@NotNull String string, @NotNull String end) { + return indexOfFirstDifferentChar(string, string.length() - end.length(), end, 0) == string.length(); + } + @NotNull // returns pair.second != null always Pair update() {