public static String expandSystemId(String systemId, String baseSystemId) {   if (systemId == null || systemId.length() == 0) { return systemId; }  try { URI uri = new URI(systemId); if (uri != null) { return systemId; } } catch (URI.MalformedURIException e) {  }  String id = fixURI(systemId);   URI base = null; URI uri = null; try { if (baseSystemId == null || baseSystemId.length() == 0 || baseSystemId.equals(systemId)) { String dir; try { dir = fixURI(getUserDir()); } catch (SecurityException se) { dir = ""; } if (!dir.endsWith("/")) { dir = dir + "/"; } base = new URI("file", "", dir, null, null); } else { try { base = new URI(fixURI(baseSystemId)); } catch (URI.MalformedURIException e) { String dir; try { dir = fixURI(getUserDir()); } catch (SecurityException se) { dir = ""; } if (baseSystemId.indexOf(':') != -1) {   base = new URI("file", "", fixURI(baseSystemId), null, null); } else { if (!dir.endsWith("/")) { dir = dir + "/"; } dir = dir + fixURI(baseSystemId); base = new URI("file", "", dir, null, null); } } }  uri = new URI(base, id); } catch (Exception e) {   }  if (uri == null) { return systemId; } return uri.toString();  }
public static String expandSystemId(String systemId) { return expandSystemId(systemId, null); }
    public static String expandSystemId(String systemId, String baseSystemId) {        // check for bad parameters id        if (systemId == null || systemId.length() == 0) {            return systemId;        }        // if id already expanded, return        try {            URI uri = new URI(systemId);            if (uri != null) {                return systemId;            }        }        catch (URI.MalformedURIException e) {            // continue on...        }        // normalize id        String id = fixURI(systemId);        // normalize base        URI base = null;        URI uri = null;        try {            if (baseSystemId == null || baseSystemId.length() == 0 ||                baseSystemId.equals(systemId)) {                String dir;                try {                    dir = fixURI(getUserDir());                }                catch (SecurityException se) {                    dir = "";                }                if (!dir.endsWith("/")) {                    dir = dir + "/";                }                base = new URI("file", "", dir, null, null);            }            else {                try {                    base = new URI(fixURI(baseSystemId));                }                catch (URI.MalformedURIException e) {                    String dir;                    try {                        dir = fixURI(getUserDir());                    }                    catch (SecurityException se) {                        dir = "";                    }                    if (baseSystemId.indexOf(':') != -1) {                        // for xml schemas we might have baseURI with                        // a specified drive                        base = new URI("file", "", fixURI(baseSystemId), null, null);                    }                    else {                        if (!dir.endsWith("/")) {                            dir = dir + "/";                        }                        dir = dir + fixURI(baseSystemId);                        base = new URI("file", "", dir, null, null);                    }                }             }             // expand id             uri = new URI(base, id);        }        catch (Exception e) {            // let it go through        }        if (uri == null) {            return systemId;        }        return uri.toString();    } // expandSystemId(String,String):String