Mercurial > hg > release > icedtea-web-1.7
changeset 1405:279d81001d01
* netx/net/sourceforge/jnlp/runtime/Boot.java: added support for jnlp:other_protocol:// handlig
* tests/netx/unit/net/sourceforge/jnlp/runtime/BootTest.java: added unitt tests for various jnlp protocol cases
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Wed, 26 Apr 2017 19:07:31 +0200 |
parents | 4d892fe13055 |
children | 4d2719ecfec6 |
files | ChangeLog netx/net/sourceforge/jnlp/runtime/Boot.java tests/netx/unit/net/sourceforge/jnlp/runtime/BootTest.java |
diffstat | 3 files changed, 67 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Apr 25 14:52:45 2017 +0200 +++ b/ChangeLog Wed Apr 26 19:07:31 2017 +0200 @@ -1,3 +1,8 @@ +2017-04-26 Jiri Vanek <jvanek@redhat.com> + + * netx/net/sourceforge/jnlp/runtime/Boot.java: added support for jnlp:other_protocol:// handlig + * tests/netx/unit/net/sourceforge/jnlp/runtime/BootTest.java: added unitt tests for various jnlp protocol cases + 2017-04-25 Jiri Vanek <jvanek@redhat.com> * tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java: added tests for jnlp protocol
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java Tue Apr 25 14:52:45 2017 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Apr 26 19:07:31 2017 +0200 @@ -232,7 +232,12 @@ OutputController.getLogger().printOut(itwInfoMessage); } - private static String fixJnlpProtocol(String param) { + static String fixJnlpProtocol(String param) { + //remove jnlp: for case like jnlp:https://some.app/file.jnlp + if (param.matches("^jnlp[s]?:.*://.*")){ + param = param.replaceFirst("^jnlp[s]?:", ""); + } + //transalte jnlp://some.app/file.jnlp to http/https return param.replaceFirst("^jnlp:", "http:").replaceFirst("^jnlps:", "https:"); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/BootTest.java Wed Apr 26 19:07:31 2017 +0200 @@ -0,0 +1,56 @@ +/* + Copyright (C) 2017 Red Hat, Inc. + + This file is part of IcedTea. + + IcedTea is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2. + + IcedTea is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with IcedTea; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + */ +package net.sourceforge.jnlp.runtime; + +import net.sourceforge.jnlp.util.logging.NoStdOutErrTest; +import org.junit.Assert; + +import org.junit.Test; + +public class BootTest extends NoStdOutErrTest { + + @Test + public void fixJnlpProtocolTest() throws Exception { + Assert.assertEquals("http://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlp://www.com/file.jnlp")); + Assert.assertEquals("https://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlps://www.com/file.jnlp")); + Assert.assertEquals("http://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlp:http://www.com/file.jnlp")); + Assert.assertEquals("https://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlp:https://www.com/file.jnlp")); + Assert.assertEquals("http://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlps:http://www.com/file.jnlp")); + Assert.assertEquals("https://www.com/file.jnlp", Boot.fixJnlpProtocol("jnlps:https://www.com/file.jnlp")); + } + +}