Index: src/test/java/org/apache/harmony/tests/java/net/test_protocol/Handler.java =================================================================== --- src/test/java/org/apache/harmony/tests/java/net/test_protocol/Handler.java (revision 0) +++ src/test/java/org/apache/harmony/tests/java/net/test_protocol/Handler.java (revision 0) @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.tests.java.net.test_protocol; + +import java.io.IOException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +public class Handler extends URLStreamHandler { + protected URLConnection openConnection(URL u) throws IOException { + return null; + } +} + Index: src/test/java/org/apache/harmony/tests/java/net/URLTest.java =================================================================== --- src/test/java/org/apache/harmony/tests/java/net/URLTest.java (revision 501941) +++ src/test/java/org/apache/harmony/tests/java/net/URLTest.java (working copy) @@ -61,4 +61,25 @@ assertEquals("Assert 3: wrong file", "test.html", testURL.getFile()); assertEquals("Assert 4: wrong anchor", "anch", testURL.getRef()); } + + /** + * @tests java.net.URL#URL(String, String, String) + * + */ + public void test_java_protocol_handler_pkgs_prop() throws MalformedURLException { + // Regression test for Harmony-3094 + final String HANDLER_PKGS = "java.protocol.handler.pkgs"; + String pkgs = System.getProperty(HANDLER_PKGS); + System.setProperty("java.protocol.handler.pkgs", "fake|org.apache.harmony.tests.java.net"); + + try { + new URL("test_protocol", "", "fake.jar"); + } finally { + if (pkgs == null) { + System.clearProperty(HANDLER_PKGS); + } else { + System.setProperty(HANDLER_PKGS, pkgs); + } + } + } }