/hg/release/icedtea-web-1.3: Fixing several errors which were ca...

Andrew Hughes ahughes at redhat.com
Wed Sep 5 13:49:54 PDT 2012


----- Original Message -----
> changeset b26d52214ed6 in /hg/release/icedtea-web-1.3
> details:
> http://icedtea.classpath.org/hg/release/icedtea-web-1.3?cmd=changeset;node=b26d52214ed6
> author: Jiri Vanek <jvanek at redhat.com>
> date: Wed Sep 05 16:09:40 2012 +0200
> 
> 	Fixing several errors which were causing incorrect behaviour causing
> 	correct reproduction of PR905
> 
> 
> diffstat:
> 
>  ChangeLog                                                         |
>   13 +++++
>  tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java |
>    3 +
>  tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java      |
>   18 +++++--
>  tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java    |
>   22 +++++++++-
>  tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java     |
>    5 +-
>  5 files changed, 52 insertions(+), 9 deletions(-)
> 
> diffs (149 lines):
> 
> diff -r 2905e24a50bd -r b26d52214ed6 ChangeLog
> --- a/ChangeLog	Wed Sep 05 12:58:30 2012 +0200
> +++ b/ChangeLog	Wed Sep 05 16:09:40 2012 +0200
> @@ -1,3 +1,16 @@
> +2012-09-05  Jiri Vanek  <jvanek at redhat.com>
> +
> +	Fixing several errors which were causing incorrect behaviour
> causing
> +	correct reproduction of PR905
> +	*
> tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java:
> +	added flush for logs
> +	* tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java:
> cleaned
> +	and enhanced getUrl* methods.
> +	* tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java:
> delegated
> +	socket
> +	* tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java:
> fixed
> +	processing of question mark.
> +
>  2012-09-04  Jiri Vanek  <Jvanek at redhat.com>
>              Danesh Dadachanji  <ddadacha at redhat.com>
>  
> diff -r 2905e24a50bd -r b26d52214ed6
> tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java
> ---
> a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java
> 	Wed Sep 05 12:58:30 2012 +0200
> +++
> b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java
> 	Wed Sep 05 16:09:40 2012 +0200
> @@ -201,15 +201,18 @@
>      private void stdout(String idded) throws IOException {
>          DEFAULT_STDOUT_WRITER.write(idded);
>          DEFAULT_STDOUT_WRITER.newLine();
> +        DEFAULT_STDOUT_WRITER.flush();
>      }
>  
>      private void stderr(String idded) throws IOException {
>          DEFAULT_STDERR_WRITER.write(idded);
>          DEFAULT_STDERR_WRITER.newLine();
> +        DEFAULT_STDERR_WRITER.flush();
>      }
>  
>      private void stdeall(String idded) throws IOException {
>          DEFAULT_STDLOGS_WRITER.write(idded);
>          DEFAULT_STDLOGS_WRITER.newLine();
> +        DEFAULT_STDLOGS_WRITER.flush();
>      }
>  }
> diff -r 2905e24a50bd -r b26d52214ed6
> tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
> --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
> 	Wed Sep 05 12:58:30 2012 +0200
> +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
> 	Wed Sep 05 16:09:40 2012 +0200
> @@ -585,16 +585,24 @@
>      }
>  
>      /**
> +     * Ctreate resource on http, on 'localhost' on port on which
> this cached instance is running
> +     * @param resource
> +     * @return
> +     * @throws MalformedURLException
> +     */
> +    public URL getUrlUponThisInstance(String resource) throws
> MalformedURLException {
> +        getInstance();
> +       return getUrlUponInstance(server,resource);
> +    }
> +
> +    /**
>       * Ctreate resource on http, on 'localhost' on port on which
>       this instance is running
>       * @param resource
>       * @return
>       * @throws MalformedURLException
>       */
> -    public URL getUrlUponThisInstance(String resource) throws
> MalformedURLException {
> -        if (!resource.startsWith("/")) {
> -            resource = "/" + resource;
> -        }
> -        return new URL("http", server.getServerName(), getPort(),
> resource);
> +    public static URL getUrlUponInstance(ServerLauncher
> instance,String resource) throws MalformedURLException {
> +       return instance.getUrl(resource);
>      }
>  
>      /**
> diff -r 2905e24a50bd -r b26d52214ed6
> tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java
> --- a/tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java
> 	Wed Sep 05 12:58:30 2012 +0200
> +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java
> 	Wed Sep 05 16:09:40 2012 +0200
> @@ -56,6 +56,7 @@
>      private boolean running;
>      private final Integer port;
>      private final File dir;
> +    private ServerSocket serverSocket;
>  
>      public String getServerName() {
>          return serverName;
> @@ -99,9 +100,9 @@
>      public void run() {
>          running = true;
>          try {
> -            ServerSocket s = new ServerSocket(port);
> +            serverSocket = new ServerSocket(port);
>              while (running) {
> -                new TinyHttpdImpl(s.accept(), dir, port);
> +                new TinyHttpdImpl(serverSocket.accept(), dir, port);
>              }
>          } catch (Exception e) {
>              e.printStackTrace();
> @@ -111,10 +112,27 @@
>      }
>  
>      public URL getUrl(String resource) throws MalformedURLException
>      {
> +        if (resource == null) {
> +            resource = "";
> +        }
> +        if (resource.trim().length() > 0 &&
> !resource.startsWith("/")) {
> +            resource = "/" + resource;
> +        }
>          return new URL("http", getServerName(), getPort(),
>          resource);
>      }
>  
>      public URL getUrl() throws MalformedURLException {
>          return getUrl("");
>      }
> +
> +    public void stop() {
> +        this.running = false;
> +        if (serverSocket != null) {
> +            try {
> +                serverSocket.close();
> +            } catch (Exception ex) {
> +                ServerAccess.logException(ex);
> +            }
> +        }
> +    }
>  }
> diff -r 2905e24a50bd -r b26d52214ed6
> tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java
> --- a/tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java
> 	Wed Sep 05 12:58:30 2012 +0200
> +++ b/tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java
> 	Wed Sep 05 16:09:40 2012 +0200
> @@ -99,8 +99,9 @@
>                          }
>                          ServerAccess.logNoReprint("Getting: " + p);
>                          p = URLDecoder.decode(p, "UTF-8");
> +                        p=p.replaceAll("\\?.*", "");
> +                        p = (".".concat((p.endsWith("/")) ?
> p.concat("index.html") : p)).replace('/', File.separatorChar);
>                          ServerAccess.logNoReprint("Serving: " + p);
> -                        p = (".".concat((p.endsWith("/")) ?
> p.concat("index.html") : p)).replace('/', File.separatorChar);
>                          File pp = new File(dir, p);
>                          int l = (int) pp.length();
>                          byte[] b = new byte[l];
> @@ -115,7 +116,7 @@
>                          } else if (p.toLowerCase().endsWith(".jar"))
>                          {
>                              content = ct + "application/x-jar\n";
>                          }
> -                        o.writeBytes("HTTP/1.0 200 OK\nConten" +
> "t-Length:" + l + "\n" + content + "\n");
> +                        o.writeBytes("HTTP/1.0 200
> OK\nContent-Length:" + l + "\n" + content + "\n");
>                          if (op.startsWith(XSX)) {
>                              byte[][] bb = splitArray(b, 10);
>                              for (int j = 0; j < bb.length; j++) {
> 

Pavel's e-mail only approved this for HEAD:

http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-September/020187.html

This commit also seems to be missing some of the changes in that review.

Thanks,
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07




More information about the distro-pkg-dev mailing list