Source:
<code>private static String buildBundleURL(String bundle, boolean alwaysBundle) { String modulePrefix = "osgi|"; InputStream is; try { is = (new URL(bundle)).openStream(); } catch (Exception ex) { is = null; } String bundleUrl = bundle; if (is == null) { try { String bundlelocation = System.getProperty(VOLTDB_BUNDLE_LOCATION_PROPERTY_NAME); if (bundlelocation == null || bundlelocation.trim().length() == 0) { String rpath = CatalogUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); <START> if (CoreUtils.isJunitTest()) { <END> assert rpath.endsWith("obj/release/prod/"); rpath = rpath.substring(0, rpath.indexOf("/release/prod/")); bundlelocation = (new File(rpath)).getParent() + "/bundles/"; } else { bundlelocation = (new File(rpath)).getParent() + "/../bundles/"; } hostLog.info("Module base is: " + bundlelocation); String bpath = bundlelocation + bundleUrl; is = new FileInputStream(new File(bpath)); bundleUrl = "file:" + bpath; } else { String bpath = bundlelocation + "/" + bundleUrl; is = new FileInputStream(new File(bpath)); bundleUrl = "file:" + bpath; } } catch (URISyntaxException | FileNotFoundException ex) { is = null; } } if (is != null) { try { is.close(); } catch (IOException ex) { } } else if (!alwaysBundle) { try { CatalogUtil.class.getClassLoader().loadClass(bundleUrl); modulePrefix = "class|"; } catch (ClassNotFoundException ex2) { String msg = "Import failed to configure, failed to load module by URL or classname provided" + " import module: " + bundleUrl; hostLog.error(msg); throw new DeploymentCheckException(msg); } } else { String msg = "Import failed to configure, failed to load module by URL or classname provided" + " format module: " + bundleUrl; hostLog.error(msg); throw new DeploymentCheckException(msg); } return (alwaysBundle ? bundleUrl : modulePrefix + bundleUrl); }</code><technical_language>Ugh, this is gross. unit test set property couple product code tests</technical_language>

Target:
private static String buildBundleURL(String bundle, boolean alwaysBundle) { String modulePrefix = "osgi|"; InputStream is; try { is = (new URL(bundle)).openStream(); } catch (Exception ex) { is = null; } String bundleUrl = bundle; if (is == null) { try { String bundlelocation = System.getProperty(VOLTDB_BUNDLE_LOCATION_PROPERTY_NAME); if (bundlelocation == null || bundlelocation.trim().length() == 0) { String rpath = CatalogUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); hostLog.info("Module base is: " + rpath + "/../bundles/"); String bpath = (new File(rpath)).getParent() + "/../bundles/" + bundleUrl; is = new FileInputStream(new File(bpath)); bundleUrl = "file:" + bpath; } else { String bpath = bundlelocation + "/" + bundleUrl; is = new FileInputStream(new File(bpath)); bundleUrl = "file:" + bpath; } } catch (URISyntaxException | FileNotFoundException ex) { is = null; } } if (is != null) { try { is.close(); } catch (IOException ex) { } } else if (!alwaysBundle) { try { CatalogUtil.class.getClassLoader().loadClass(bundleUrl); modulePrefix = "class|"; } catch (ClassNotFoundException ex2) { String msg = "Import failed to configure, failed to load module by URL or classname provided" + " import module: " + bundleUrl; hostLog.error(msg); throw new DeploymentCheckException(msg); } } else { String msg = "Import failed to configure, failed to load module by URL or classname provided" + " format module: " + bundleUrl; hostLog.error(msg); throw new DeploymentCheckException(msg); } return (alwaysBundle ? bundleUrl : modulePrefix + bundleUrl); }