Issue #5870 Windows URI case comparison fails (#5873)

* Issue #5870 Windows URI case comparison fails

Signed-off-by: Jan Bartel <janb@webtide.com>

* Issue #5870 - Updating Windows tests

+ Eliminating OS.MAC (as it doesn't support drive letters)
+ Adding alt URI syntax version as well

Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Jan Bartel 2021-01-12 11:44:56 +01:00 committed by GitHub
parent 1a7c3deb09
commit e1e16ae54b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 2 deletions

View File

@ -704,13 +704,12 @@ public class AnnotationConfiguration extends AbstractConfiguration
}
//Check if it is excluded by an ordering
URI loadingJarURI = sciResource.getURI();
boolean found = false;
Iterator<Resource> itor = orderedJars.iterator();
while (!found && itor.hasNext())
{
Resource r = itor.next();
found = r.getURI().equals(loadingJarURI);
found = r.equals(sciResource);
}
if (LOG.isDebugEnabled())

View File

@ -34,6 +34,7 @@ import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@ -42,6 +43,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class ResourceTest
@ -297,4 +299,30 @@ public class ResourceTest
Resource globResource = Resource.newResource(globReference);
assertNotNull(globResource, "Should have produced a Resource");
}
@Test
@EnabledOnOs(OS.WINDOWS)
public void testEqualsWindowsAltUriSyntax() throws Exception
{
URI a = new URI("file:/C:/foo/bar");
URI b = new URI("file:///C:/foo/bar");
Resource ra = Resource.newResource(a);
Resource rb = Resource.newResource(b);
assertEquals(rb, ra);
}
@Test
@EnabledOnOs(OS.WINDOWS)
public void testEqualsWindowsCaseInsensitiveDrive() throws Exception
{
URI a = new URI("file:///c:/foo/bar");
URI b = new URI("file:///C:/foo/bar");
Resource ra = Resource.newResource(a);
Resource rb = Resource.newResource(b);
assertEquals(rb, ra);
}
}