java.nio.channels.OverlappingFileLockException#java.net.MalformedURLException源码实例Demo

下面列出了java.nio.channels.OverlappingFileLockException#java.net.MalformedURLException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: uima-uimaj   文件: UimaContext_ImplBase.java
/**
 * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceURL(java.lang.String,
 *      java.lang.String[])
 */
@Override
public URL getResourceURL(String aKey, String[] aParams) throws ResourceAccessException {
  URL result = getResourceManager().getResourceURL(makeQualifiedName(aKey), aParams);
  if (result != null) {
    return result;
  } else {
    // try as an unmanaged resource (deprecated)
    URL unmanagedResourceUrl = null;
    try {
      unmanagedResourceUrl = getResourceManager().resolveRelativePath(aKey);
    } catch (MalformedURLException e) {
      // if key is not a valid path then it cannot be resolved to an unmanged resource
    }
    if (unmanagedResourceUrl != null) {
      UIMAFramework.getLogger().logrb(Level.WARNING, this.getClass().getName(), "getResourceURL",
              LOG_RESOURCE_BUNDLE, "UIMA_unmanaged_resource__WARNING", new Object[] { aKey });
      return unmanagedResourceUrl;
    }
    return null;
  }
}
 
源代码2 项目: packagedrone   文件: JspC.java
private void initServletContext() {
    try {
        context =new JspCServletContext
            (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")),

             new URL("file:" + uriRoot.replace('\\','/') + '/'));
        tldScanner = new TldScanner(context, isValidationEnabled);

        // START GlassFish 750
        taglibs = new ConcurrentHashMap<String, TagLibraryInfo>();
        context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs);

        tagFileJarUrls = new ConcurrentHashMap<String, URL>();
        context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE,
                             tagFileJarUrls);
        // END GlassFish 750
    } catch (MalformedURLException me) {
        System.out.println("**" + me);
    } catch (UnsupportedEncodingException ex) {
    }
    rctxt = new JspRuntimeContext(context, this);
    jspConfig = new JspConfig(context);
    tagPluginManager = new TagPluginManager(context);
}
 
源代码3 项目: lucene-solr   文件: LBSolrClient.java
public String removeSolrServer(String server) {
  try {
    server = new URL(server).toExternalForm();
  } catch (MalformedURLException e) {
    throw new RuntimeException(e);
  }
  if (server.endsWith("/")) {
    server = server.substring(0, server.length() - 1);
  }

  // there is a small race condition here - if the server is in the process of being moved between
  // lists, we could fail to remove it.
  removeFromAlive(server);
  zombieServers.remove(server);
  return null;
}
 
源代码4 项目: Quantum   文件: CloudUtils.java
public static void uploadMedia(byte[] content, String repositoryKey)
		throws UnsupportedEncodingException, MalformedURLException, IOException, URISyntaxException {
	if (content != null) {
		String encodedUser = URLEncoder.encode(getCredentials(ConfigurationUtils.getDesiredDeviceCapabilities()).getUser(), "UTF-8");
		String encodedPassword = URLEncoder.encode(getCredentials(ConfigurationUtils.getDesiredDeviceCapabilities()).getOfflineToken(), "UTF-8");
		
		
		URI uri = new URI(ConfigurationManager.getBundle().getString("remote.server"));
	    String hostName = uri.getHost();
	    
	    String urlStr = HTTPS + hostName + MEDIA_REPOSITORY + repositoryKey + "?" + UPLOAD_OPERATION + "&user="
				+ encodedUser + "&securityToken=" + encodedPassword;
		
		URL url = new URL(urlStr);

		sendRequest(content, url);
	}
}
 
源代码5 项目: components   文件: JarRuntimeInfoTest.java
public void checkFullExampleDependencies(List<URL> mavenUrlDependencies) throws MalformedURLException {
    assertThat(mavenUrlDependencies, containsInAnyOrder(new URL("mvn:org.apache.avro/avro/1.8.0/jar"),
            new URL("mvn:net.sourceforge.javacsv/javacsv/2.0/jar"),
            new URL("mvn:com.cedarsoftware/json-io/4.4.1-SNAPSHOT/jar"), new URL("mvn:joda-time/joda-time/2.8.2/jar"),
            new URL("mvn:org.xerial.snappy/snappy-java/1.1.1.3/jar"),
            new URL("mvn:org.talend.components/components-api/0.13.1/jar"),
            new URL("mvn:com.thoughtworks.paranamer/paranamer/2.7/jar"), new URL("mvn:org.talend.daikon/daikon/0.12.1/jar"),
            new URL("mvn:com.fasterxml.jackson.core/jackson-annotations/2.5.3/jar"),
            new URL("mvn:com.fasterxml.jackson.core/jackson-core/2.5.3/jar"),
            new URL("mvn:org.codehaus.jackson/jackson-core-asl/1.9.13/jar"),
            new URL("mvn:org.talend.components/components-common/0.13.1/jar"),
            new URL("mvn:org.slf4j/slf4j-api/1.7.12/jar"),
            new URL("mvn:org.talend.components/components-api-full-example/0.1.0/jar"), new URL("mvn:org.tukaani/xz/1.5/jar"),
            new URL("mvn:javax.inject/javax.inject/1/jar"), new URL("mvn:org.apache.commons/commons-compress/1.8.1/jar"),
            new URL("mvn:org.apache.commons/commons-lang3/3.4/jar"), new URL("mvn:javax.servlet/javax.servlet-api/3.1.0/jar"),
            new URL("mvn:commons-codec/commons-codec/1.6/jar"),
            new URL("mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13/jar"))//
    );
}
 
源代码6 项目: jdk8u_jdk   文件: PolicySpiFile.java
public PolicySpiFile(Policy.Parameters params) {

        if (params == null) {
            pf = new PolicyFile();
        } else {
            if (!(params instanceof URIParameter)) {
                throw new IllegalArgumentException
                        ("Unrecognized policy parameter: " + params);
            }
            URIParameter uriParam = (URIParameter)params;
            try {
                pf = new PolicyFile(uriParam.getURI().toURL());
            } catch (MalformedURLException mue) {
                throw new IllegalArgumentException("Invalid URIParameter", mue);
            }
        }
    }
 
源代码7 项目: openjdk-jdk9   文件: CloseUnconnectedTest.java
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Test immediate client close for protocol " +
                       proto);
    JMXServiceURL u = new JMXServiceURL(proto, null, 0);
    JMXConnectorServer s;
    try {
        s = JMXConnectorServerFactory.newJMXConnectorServer(u, null, mbs);
    } catch (MalformedURLException e) {
        System.out.println("Skipping unsupported URL " + u);
        return true;
    }
    s.start();
    JMXServiceURL a = s.getAddress();
    JMXConnector c = JMXConnectorFactory.newJMXConnector(a, null);
    c.close();
    s.stop();
    return true;
}
 
源代码8 项目: kruize   文件: KubernetesEnvImpl.java
private void setMonitoringLabels()
{
    PrometheusQuery prometheusQuery = PrometheusQuery.getInstance();

    try {
        URL labelURL = new URL(DeploymentInfo.getMonitoringAgentEndpoint() + "/api/v1/labels");
        String result = HttpUtil.getDataFromURL(labelURL);

        if (result.contains("\"pod\"")) {
            prometheusQuery.setPodLabel("pod");
            prometheusQuery.setContainerLabel("container");
        }
    }
    /* Use the default labels */
    catch (MalformedURLException | NullPointerException ignored) {
        LOGGER.info("Using default labels");
    }
}
 
源代码9 项目: news-crawl   文件: PunycodeURLNormalizer.java
@Override
public String filter(URL sourceUrl, Metadata sourceMetadata,
        String urlToFilter) {
    try {
        URL url = new URL(urlToFilter);
        String hostName = url.getHost();
        if (isAscii(hostName)) {
            return urlToFilter;
        }
        hostName = IDN.toASCII(url.getHost());
        if (hostName.equals(url.getHost())) {
            return urlToFilter;
        }
        urlToFilter = new URL(url.getProtocol(), hostName, url.getPort(),
                url.getFile()).toString();
    } catch (MalformedURLException e) {
        return null;
    }
    return urlToFilter;
}
 
源代码10 项目: openhab-core   文件: ScriptFileWatcher.java
@Override
protected void processWatchEvent(WatchEvent<?> event, Kind<?> kind, Path path) {
    File file = path.toFile();
    if (!file.isHidden()) {
        try {
            URL fileUrl = file.toURI().toURL();
            if (ENTRY_DELETE.equals(kind)) {
                removeFile(fileUrl);
            }

            if (file.canRead() && (ENTRY_CREATE.equals(kind) || ENTRY_MODIFY.equals(kind))) {
                importFile(fileUrl);
            }
        } catch (MalformedURLException e) {
            logger.error("malformed", e);
        }
    }
}
 
源代码11 项目: starcor.xul   文件: XulHttpStack.java
private static void parseUrl(XulHttpTask xulHttpTask, String url) {
	try {
		URL reqUrl = new URL(url);
		xulHttpTask.setSchema(reqUrl.getProtocol())
				.setHost(reqUrl.getHost())
				.setPort(reqUrl.getPort())
				.setPath(reqUrl.getPath());
		String queryStr = reqUrl.getQuery();
		if (!TextUtils.isEmpty(queryStr)) {
			String[] params = queryStr.split("&");
			for (String param : params) {
				String[] pair = param.split("=");
				encodeParams(pair);
				if (pair.length == 2) {
					xulHttpTask.addQuery(pair[0], pair[1]);
				} else if (pair.length == 1) {
					xulHttpTask.addQuery(pair[0], "");
				} // else 无效参数
			}
		}
	} catch (MalformedURLException e) {
		xulHttpTask.setPath(url);
	}
}
 
@Test
public void testCanInstantiateARemoteDriver() throws MalformedURLException {
  factory.setRemoteDriverProvider(new RemoteDriverProvider() {
    @Override
    public WebDriver createDriver(URL hub, Capabilities capabilities) {
      return new FakeWebDriver(capabilities);
    }
  });

  WebDriver driver = factory.getDriver(new URL("http://localhost/"), new FirefoxOptions());
  assertTrue(driver instanceof FakeWebDriver);
  assertFalse(factory.isEmpty());

  factory.dismissDriver(driver);
  assertTrue(factory.isEmpty());
}
 
源代码13 项目: chromecast-java-api-v2   文件: Util.java
static String getMediaTitle(String url) {
    try {
        URL urlObj = new URL(url);
        String mediaTitle;
        String path = urlObj.getPath();
        int lastIndexOfSlash = path.lastIndexOf('/');
        if (lastIndexOfSlash >= 0 && lastIndexOfSlash + 1 < url.length()) {
            mediaTitle = path.substring(lastIndexOfSlash + 1);
            int lastIndexOfDot = mediaTitle.lastIndexOf('.');
            if (lastIndexOfDot > 0) {
                mediaTitle = mediaTitle.substring(0, lastIndexOfDot);
            }
        } else {
            mediaTitle = path;
        }
        return mediaTitle.isEmpty() ? url : mediaTitle;
    } catch (MalformedURLException mfu) {
        return url;
    }
}
 
源代码14 项目: nodes   文件: ArgumentSettingTest.java
@Test
public void argumentPathError() throws GraphQLException, MalformedURLException {
    GraphQLException exception = null;
    try {
        GraphQLRequestEntity.Builder()
                .url(EXAMPLE_URL)
                .arguments(new Arguments("test.testNope", new Argument("id", "1")))
                .request(TestModel.class)
                .build();
    } catch (GraphQLException e) {
        exception = e;
    }
    assertNotNull(exception);
    assertEquals("'test.testNope' is an invalid property path", exception.getMessage());
    assertNull(exception.getErrors());
    assertEquals("GraphQLException{message=''test.testNope' is an invalid property path', status='null', description='null', errors=null}", exception.toString());
}
 
源代码15 项目: ripme   文件: EHentaiRipper.java
@Override
public String getGID(URL url) throws MalformedURLException {
    Pattern p;
    Matcher m;

    p = Pattern.compile("^https?://e-hentai\\.org/g/([0-9]+)/([a-fA-F0-9]+)/?");
    m = p.matcher(url.toExternalForm());
    if (m.matches()) {
        return m.group(1) + "-" + m.group(2);
    }

    throw new MalformedURLException(
            "Expected e-hentai.org gallery format: "
                    + "http://e-hentai.org/g/####/####/"
                    + " Got: " + url);
}
 
源代码16 项目: jrpip   文件: SimpleJrpipServiceTest.java
public void testUnserializableObject() throws MalformedURLException
{
    Echo echo = this.buildEchoProxy();

    for (int i = 0; i < 50; i++)
    {
        try
        {
            echo.testUnserializableObject(new Object());
            Assert.fail("should not get here");
        }
        catch (JrpipRuntimeException e)
        {
        }
    }
    Assert.assertEquals("hello", echo.echo("hello"));
}
 
源代码17 项目: ontopia   文件: InsertTest.java
@Test
public void testNoBaseAddress() throws InvalidQueryException {
  makeEmpty(false); // don't set base address

  // this one is valid because there are no relative URIs
  update("insert <urn:uuid:d84e2777-8928-4bd4-a3e4-8ca835f92304> .");

  LocatorIF si;
  try {
    si = new URILocator("urn:uuid:d84e2777-8928-4bd4-a3e4-8ca835f92304");
  } catch (MalformedURLException e) {
    throw new OntopiaRuntimeException(e);
  }
  
  TopicIF topic = topicmap.getTopicBySubjectIdentifier(si);
  Assert.assertTrue("topic was not inserted", topic != null);
}
 
/**
 * 需要总经理审批
 * @throws ParseException
 */
@Test
public void testTrue() throws ParseException, MalformedURLException {
    /*
    // CXF方式
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    factory.setServiceClass(LeaveWebService.class);
    factory.setAddress(LeaveWebserviceUtil.WEBSERVICE_URL);
    LeaveWebService leaveWebService = (LeaveWebService) factory.create();*/

    // 标准方式
    URL url = new URL(LeaveWebserviceUtil.WEBSERVICE_WSDL_URL);
    QName qname = new QName(LeaveWebserviceUtil.WEBSERVICE_URI, "LeaveWebService");
    Service service = Service.create(url, qname);
    LeaveWebService leaveWebService = service.getPort(LeaveWebService.class);
    boolean audit = leaveWebService.generalManagerAudit("2013-01-01 09:00", "2013-01-05 17:30");
    assertTrue(audit);
}
 
源代码19 项目: jdk1.8-source-analysis   文件: CatalogResolver.java
/** Attempt to construct an absolute URI */
private String makeAbsolute(String uri) {
  if (uri == null) {
    uri = "";
  }

  try {
    URL url = new URL(uri);
    return url.toString();
  } catch (MalformedURLException mue) {
    try {
      URL fileURL = FileURL.makeURL(uri);
      return fileURL.toString();
    } catch (MalformedURLException mue2) {
      // bail
      return uri;
    }
  }
}
 
源代码20 项目: component-runtime   文件: Jars.java
public static Path toPath(final URL url) {
    if ("jar".equals(url.getProtocol())) {
        try {
            final String spec = url.getFile();
            final int separator = spec.indexOf('!');
            if (separator == -1) {
                return null;
            }
            return toPath(new URL(spec.substring(0, separator + 1)));
        } catch (final MalformedURLException e) {
            // no-op
        }
    } else if ("file".equals(url.getProtocol())) {
        String path = decode(url.getFile());
        if (path.endsWith("!")) {
            path = path.substring(0, path.length() - 1);
        }
        return new File(path).getAbsoluteFile().toPath();
    }
    return null;
}
 
源代码21 项目: freehealth-connector   文件: IntraHubServiceImpl.java
public PutTherapeuticLinkResponse putTherapeuticLink(SAMLToken token, PutTherapeuticLinkRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
   request.setRequest(RequestTypeBuilder.init().addGenericAuthor().build());

   try {
      GenericRequest genReq = ServiceFactory.getIntraHubPort(token, "urn:be:fgov:ehealth:interhub:protocol:v1:PutTherapeuticLink");
      genReq.setPayload((Object)request);
      GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
      return (PutTherapeuticLinkResponse)genResp.asObject(PutTherapeuticLinkResponse.class);
   } catch (SOAPException var5) {
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var5, new Object[]{var5.getMessage()});
   } catch (WebServiceException var6) {
      throw ServiceHelper.handleWebServiceException(var6);
   } catch (MalformedURLException var7) {
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var7, new Object[]{var7.getMessage()});
   }
}
 
源代码22 项目: hottub   文件: LoaderHandler.java
/**
 * Load a class from a network location (one or more URLs),
 * but first try to resolve the named class through the given
 * "default loader".
 */
public static Class<?> loadClass(String codebase, String name,
                                 ClassLoader defaultLoader)
    throws MalformedURLException, ClassNotFoundException
{
    if (loaderLog.isLoggable(Log.BRIEF)) {
        loaderLog.log(Log.BRIEF,
            "name = \"" + name + "\", " +
            "codebase = \"" + (codebase != null ? codebase : "") + "\"" +
            (defaultLoader != null ?
             ", defaultLoader = " + defaultLoader : ""));
    }

    URL[] urls;
    if (codebase != null) {
        urls = pathToURLs(codebase);
    } else {
        urls = getDefaultCodebaseURLs();
    }

    if (defaultLoader != null) {
        try {
            Class<?> c = loadClassForName(name, false, defaultLoader);
            if (loaderLog.isLoggable(Log.VERBOSE)) {
                loaderLog.log(Log.VERBOSE,
                    "class \"" + name + "\" found via defaultLoader, " +
                    "defined by " + c.getClassLoader());
            }
            return c;
        } catch (ClassNotFoundException e) {
        }
    }

    return loadClass(urls, name);
}
 
源代码23 项目: ArchUnit   文件: PlantUmlArchConditionTest.java
private static URL toUrl(File file) {
    try {
        return file.toURI().toURL();
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}
 
源代码24 项目: cucumber-performance   文件: AppendableBuilder.java
private URL parseUrl(String url) throws MalformedURLException {
	Matcher argumentWithPostfix = ARGUMENT_POSTFIX_PATTERN.matcher(url);
	String path;
	String argument;

	if (argumentWithPostfix.matches()) {
		path = argumentWithPostfix.group(1);
		argument = argumentWithPostfix.group(2);
	} else {
		path = url;
		argument = "";
	}
	return toURL(path + parsePostFix(argument));
	//new URL(path + parsePostFix(argument));
}
 
源代码25 项目: openjdk-jdk9   文件: ReflectionTest.java
private static Class<?> loadClass(String className, ClassLoader parentClassLoader, File... destDirs) {
    try {
        List<URL> list = new ArrayList<>();
        for (File f : destDirs) {
            list.add(new URL("file:" + f.toString().replace("\\", "/") + "/"));
        }
        return Class.forName(className, true, new URLClassLoader(
                list.toArray(new URL[list.size()]), parentClassLoader));
    } catch (ClassNotFoundException | MalformedURLException e) {
        throw new RuntimeException("Error loading class " + className, e);
    }
}
 
源代码26 项目: cloudstack   文件: BaremetalVlanManagerImpl.java
@Override
public BaremetalRctResponse addRct(AddBaremetalRctCmd cmd) {
    try {
        List<BaremetalRctVO> existings = rctDao.listAll();
        if (!existings.isEmpty()) {
            throw new CloudRuntimeException(String.format("there is some RCT existing. A CloudStack deployment accepts only one RCT"));
        }
        URL url = new URL(cmd.getRctUrl());
        RestTemplate rest = new RestTemplate();
        String rctStr = rest.getForObject(url.toString(), String.class);

        // validate it's right format
        BaremetalRct rct = gson.fromJson(rctStr, BaremetalRct.class);
        QueryBuilder<BaremetalRctVO> sc = QueryBuilder.create(BaremetalRctVO.class);
        sc.and(sc.entity().getUrl(), SearchCriteria.Op.EQ, cmd.getRctUrl());
        BaremetalRctVO vo =  sc.find();
        if (vo == null) {
            vo = new BaremetalRctVO();
            vo.setRct(gson.toJson(rct));
            vo.setUrl(cmd.getRctUrl());
            vo = rctDao.persist(vo);
        } else {
            vo.setRct(gson.toJson(rct));
            rctDao.update(vo.getId(), vo);
        }

        BaremetalRctResponse rsp = new BaremetalRctResponse();
        rsp.setUrl(vo.getUrl());
        rsp.setId(vo.getUuid());
        rsp.setObjectName("baremetalrct");
        return rsp;
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException(String.format("%s is not a legal http url", cmd.getRctUrl()));
    }
}
 
源代码27 项目: scelight   文件: MapImageCache.java
/**
 * Returns the map image of the specified map file.
 * 
 * @param repProc {@link RepProcessor} whose map image to return
 * @return the map image of the specified map file
 */
public static LRIcon getMapImage( final RepProcessor repProc ) {
	// Locally tested edited maps do not have cache handles, only the map name is filled in the game descriptions of the init data
	if ( repProc.getMapCacheHandle() == null )
		return null;
	
	final String hash = repProc.getMapCacheHandle().contentDigest;
	LRIcon ricon = MAP_HASH_IMAGE_MAP.get( hash );
	
	if ( ricon == null ) {
		final Path imgFile = CACHE_FOLDER.resolve( hash + ".jpg" );
		// Have to synchronize this, else if the same image is written by 2 threads, file gets corrupted.
		synchronized ( hash.intern() ) {
			if ( !Files.exists( imgFile ) ) {
				final BufferedImage mapImage = MapParser.getMapImage( repProc );
				if ( mapImage != null )
					try {
						ImageIO.write( mapImage, "jpg", imgFile.toFile() );
					} catch ( final IOException ie ) {
						Env.LOGGER.error( "Failed to write map image: " + imgFile, ie );
					}
			}
		}
		if ( Files.exists( imgFile ) )
			try {
				MAP_HASH_IMAGE_MAP.put( hash, ricon = new LRIcon( imgFile.toUri().toURL() ) );
				ricon.setStringValue( hash );
			} catch ( final MalformedURLException mue ) {
				// Never to happen
				Env.LOGGER.error( "", mue );
			}
	}
	
	return ricon;
}
 
源代码28 项目: L.TileLayer.Cordova   文件: FileUtils.java
public String filesystemPathForURL(String localURLstr) throws MalformedURLException {
    try {
        LocalFilesystemURL inputURL = new LocalFilesystemURL(localURLstr);
        Filesystem fs = this.filesystemForURL(inputURL);
        if (fs == null) {
            throw new MalformedURLException("No installed handlers for this URL");
        }
        return fs.filesystemPathForURL(inputURL);
    } catch (IllegalArgumentException e) {
        throw new MalformedURLException("Unrecognized filesystem URL");
    }
}
 
源代码29 项目: openjdk-jdk9   文件: Resolver.java
/**
 * Return the applicable SYSTEM system identifier, resorting
 * to external RESOLVERs if necessary.
 *
 * <p>If a SYSTEM entry exists in the Catalog
 * for the system ID specified, return the mapped value.</p>
 *
 * <p>In the Resolver (as opposed to the Catalog) class, if the
 * URI isn't found by the usual algorithm, SYSTEMSUFFIX entries are
 * considered.</p>
 *
 * <p>On Windows-based operating systems, the comparison between
 * the system identifier provided and the SYSTEM entries in the
 * Catalog is case-insensitive.</p>
 *
 * @param systemId The system ID to locate in the catalog.
 *
 * @return The system identifier to use for systemId.
 *
 * @throws MalformedURLException The formal system identifier of a
 * subordinate catalog cannot be turned into a valid URL.
 * @throws IOException Error reading subordinate catalog file.
 */
public String resolveSystem(String systemId)
  throws MalformedURLException, IOException {

  String resolved = super.resolveSystem(systemId);
  if (resolved != null) {
    return resolved;
  }

  Enumeration en = catalogEntries.elements();
  while (en.hasMoreElements()) {
    CatalogEntry e = (CatalogEntry) en.nextElement();
    if (e.getEntryType() == RESOLVER) {
      resolved = resolveExternalSystem(systemId, e.getEntryArg(0));
      if (resolved != null) {
        return resolved;
      }
    } else if (e.getEntryType() == SYSTEMSUFFIX) {
      String suffix = e.getEntryArg(0);
      String result = e.getEntryArg(1);

      if (suffix.length() <= systemId.length()
          && systemId.substring(systemId.length()-suffix.length()).equals(suffix)) {
        return result;
      }
    }
  }

  return resolveSubordinateCatalogs(Catalog.SYSTEM,
                                    null,
                                    null,
                                    systemId);
}
 
源代码30 项目: hottub   文件: CorbanameUrl.java
public CorbanameUrl(String url) throws MalformedURLException {

        if (!url.startsWith("corbaname:")) {
            throw new MalformedURLException("Invalid corbaname URL: " + url);
        }

        int addrStart = 10;  // "corbaname:"

        int addrEnd = url.indexOf('#', addrStart);
        if (addrEnd < 0) {
            addrEnd = url.length();
            stringName = "";
        } else {
            stringName = UrlUtil.decode(url.substring(addrEnd+1));
        }
        location = url.substring(addrStart, addrEnd);

        int keyStart = location.indexOf("/");
        if (keyStart >= 0) {
            // Has key string
            if (keyStart == (location.length() -1)) {
                location += "NameService";
            }
        } else {
            location += "/NameService";
        }
    }