diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx index bb0b16bc0220..b4c6331e6113 100644 --- a/jvmaccess/source/classpath.cxx +++ b/jvmaccess/source/classpath.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -79,7 +80,21 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( } css::uno::Reference< css::uri::XUriReference > uriRef( css::uri::UriReferenceFactory::create(context)->parse(url)); - if (!uriRef.is() || !uriRef->getScheme().equalsIgnoreAsciiCase("file")) + bool bLocal = uriRef.is() && uriRef->getScheme().equalsIgnoreAsciiCase("file"); + if (bLocal && uriRef->hasAuthority()) + { + OUString aAuthority(uriRef->getAuthority()); + bLocal = aAuthority.isEmpty() || aAuthority.equalsIgnoreAsciiCase("localhost"); + } + if (bLocal) + { + // Java reads a path that starts with two separators as a network share name. + OUString aPath(rtl::Uri::decode(uriRef->getPath(), rtl_UriDecodeWithCharset, + RTL_TEXTENCODING_UTF8)); + bLocal = aPath.getLength() >= 2 && aPath[0] == '/' && aPath[1] != '/' + && aPath[1] != '\\'; + } + if (!bLocal) { throw css::lang::IllegalArgumentException( "non-local Java class path entry: " + url,