mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
support offline tests
This commit is contained in:
parent
8e9533b2c3
commit
2a72dfa58d
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017 Volker Berlin (i-net software)
|
* Copyright 2017 - 2019 Volker Berlin (i-net software)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -58,12 +58,22 @@ public class SpiderMonkey {
|
|||||||
URL url = new URL( "https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/jsshell-" + fileName
|
URL url = new URL( "https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/jsshell-" + fileName
|
||||||
+ ".zip" );
|
+ ".zip" );
|
||||||
System.out.println( "\tDownload: " + url );
|
System.out.println( "\tDownload: " + url );
|
||||||
|
command = target.getAbsolutePath() + "/js";
|
||||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||||
|
conn.setConnectTimeout( 5000 );
|
||||||
if( target.exists() ) {
|
if( target.exists() ) {
|
||||||
conn.setIfModifiedSince( target.lastModified() );
|
conn.setIfModifiedSince( target.lastModified() );
|
||||||
}
|
}
|
||||||
InputStream input = conn.getInputStream();
|
InputStream input;
|
||||||
command = target.getAbsolutePath() + "/js";
|
try {
|
||||||
|
input = conn.getInputStream();
|
||||||
|
} catch( IOException ex ) {
|
||||||
|
if( target.exists() ) {
|
||||||
|
System.err.println( ex );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
if( conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
if( conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
||||||
System.out.println( "\tUP-TP-DATE, use version from " + Instant.ofEpochMilli( target.lastModified() ) );
|
System.out.println( "\tUP-TP-DATE, use version from " + Instant.ofEpochMilli( target.lastModified() ) );
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user