nIndex can only be -1 or < sSystemPath.getLength()

from

sal_Int32 nIndex = sSystemPath.lastIndexOf('.');

so

OUString sConnPartURL = sSystemPath.copy( 0, ::std::max< sal_Int32 >( nIndex, sSystemPath.getLength() )

is equivalent to

OUString sConnPartURL = sSystemPath.copy( 0, sSystemPath.getLength() )

which is

OUString sConnPartURL = sSystemPath;

so drop sConnPartURL and replace with sSystemPath

Change-Id: I3fc8e88a4b3e474c3dccd08cf356e4663503ae02