Remove JNI use on Windows now that we deleted gwt-ll.dll Change-Id: I06be29b1434d6140fc423cdb0ed78d41e3fbe902
diff --git a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java b/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java index 67a65b4..5ac6c00 100644 --- a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java +++ b/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
@@ -19,7 +19,6 @@ import com.google.gwt.core.ext.TreeLogger.HelpInfo; import com.google.gwt.dev.About; import com.google.gwt.dev.GwtVersion; -import com.google.gwt.dev.shell.ie.CheckForUpdatesIE6; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -40,7 +39,6 @@ import java.net.URL; import java.net.URLConnection; import java.util.Date; -import java.util.Locale; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; @@ -56,7 +54,7 @@ * Orchestrates a best-effort attempt to find out if a new version of GWT is * available. */ -public class CheckForUpdates { +public final class CheckForUpdates { /** * Returns the result of an update check. @@ -78,7 +76,6 @@ // System properties used by CheckForUpdates protected static final String PROPERTY_DEBUG_HTTP_GET = "gwt.debugLowLevelHttpGet"; - protected static final String PROPERTY_FORCE_NONNATIVE = "gwt.forceVersionCheckNonNative"; protected static final String PROPERTY_PREFS_NAME = "gwt.prefsPathName"; protected static final String PROPERTY_QUERY_URL = "gwt.forceVersionCheckURL"; @@ -158,12 +155,7 @@ public static CheckForUpdates createUpdateChecker(TreeLogger logger, String entryPoint) { - // Windows has a custom implementation to handle proxies. - if (System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win")) { - return new CheckForUpdatesIE6(logger, entryPoint); - } else { - return new CheckForUpdates(logger, entryPoint); - } + return new CheckForUpdates(logger, entryPoint); } public static void logUpdateAvailable(TreeLogger logger, @@ -312,7 +304,7 @@ // See if new version is available. // String url = queryURL + "?v=" + myVersion.toString() + "&id=" - + firstLaunch + "&r=" + About.getGwtSvnRev(); + + firstLaunch + "&r=" + About.getGwtGitRev(); if (entryPoint != null) { url += "&e=" + entryPoint; } @@ -321,17 +313,8 @@ // Do the HTTP GET. // - byte[] response; String fullUserAgent = makeUserAgent(); - if (System.getProperty(PROPERTY_FORCE_NONNATIVE) == null) { - // Use subclass. - // - response = doHttpGet(branch, fullUserAgent, url); - } else { - // Use the pure Java version, but it probably doesn't work with proxies. - // - response = httpGetNonNative(branch, fullUserAgent, url); - } + byte[] response = doHttpGet(branch, fullUserAgent, url); if (response == null || response.length == 0) { // Problem. Quietly fail. @@ -354,32 +337,7 @@ return null; } - /** - * Default implementation just uses the platform-independent method. A - * subclass should override this method for platform-dependent proxy handling, - * for example. - * - * @param branch TreeLogger to use - * @param userAgent user agent string to send in request - * @param url URL to fetch - * @return byte array of response, or null if an error - */ - protected byte[] doHttpGet(TreeLogger branch, String userAgent, String url) { - return httpGetNonNative(branch, userAgent, url); - } - - /** - * This default implementation uses regular Java HTTP, which doesn't deal with - * proxies automagically. See the IE6 subclasses for an implementation that - * does deal with proxies. - * - * @param branch TreeLogger to use - * @param userAgent user agent string to send in request - * @param url URL to fetch - * @return byte array of response, or null if an error - */ - protected byte[] httpGetNonNative(TreeLogger branch, String userAgent, - String url) { + private byte[] doHttpGet(TreeLogger branch, String userAgent, String url) { Throwable caught; InputStream is = null; try {
diff --git a/dev/core/src/com/google/gwt/dev/shell/ie/CheckForUpdatesIE6.java b/dev/core/src/com/google/gwt/dev/shell/ie/CheckForUpdatesIE6.java deleted file mode 100644 index cf6fe14..0000000 --- a/dev/core/src/com/google/gwt/dev/shell/ie/CheckForUpdatesIE6.java +++ /dev/null
@@ -1,40 +0,0 @@ -/* - * Copyright 2007 Google Inc. - * - * Licensed 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 com.google.gwt.dev.shell.ie; - -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.dev.shell.CheckForUpdates; - -/** - * IE6 implementation of the update checker. - */ -public class CheckForUpdatesIE6 extends CheckForUpdates { - - public CheckForUpdatesIE6(TreeLogger logger, String entryPoint) { - super(logger, entryPoint); - } - - @Override - protected byte[] doHttpGet(TreeLogger branch, String userAgent, String url) { - if (LowLevelIE6.init()) { - return LowLevelIE6.httpGet(branch, userAgent, url, - System.getProperty(PROPERTY_DEBUG_HTTP_GET) != null); - } else { - return super.doHttpGet(branch, userAgent, url); - } - } - -}
diff --git a/dev/core/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java b/dev/core/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java deleted file mode 100644 index bd1d8e4..0000000 --- a/dev/core/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java +++ /dev/null
@@ -1,89 +0,0 @@ -/* - * Copyright 2006 Google Inc. - * - * Licensed 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 com.google.gwt.dev.shell.ie; - -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.util.tools.Utility; - -import java.io.File; -import java.io.IOException; - -/** - * Various low-level helper methods for dealing with COM and such. - */ -class LowLevelIE6 { - - private static boolean sInitialized = false; - - /** - * Does an HTTP GET that works with Windows proxy settings. Set the system - * property <code>gwt.debugLowLevelHttpGet</code> to print failure status - * codes to stderr. - * - * @param userAgent the user-agent to specify for the GET - * @param url the absolute URL to GET - * @return the bytes of the full response (including headers), or - * <code>null</code> if there's a problem - */ - public static byte[] httpGet(TreeLogger branch, String userAgent, String url, - boolean debugFlag) { - if (!init()) { - return null; - } - byte[][] out = new byte[1][]; - int status = _httpGet(userAgent, url, out); - if (status == 0) { - return out[0]; - } else { - if (debugFlag) { - branch.log(TreeLogger.ERROR, "GET failed with status " + status - + " for " + url); - } - return null; - } - } - - public static synchronized boolean init() { - if (!sInitialized) { - File lib = new File(Utility.getInstallPath(), "gwt-ll.dll"); - if (!lib.exists()) { - return false; - } - try { - // Try to make canonical. - System.load(lib.getCanonicalPath()); - } catch (IOException e) { - return false; - } catch (UnsatisfiedLinkError e) { - return false; - } - sInitialized = true; - } - return true; - } - - // CHECKSTYLE_OFF - // out must be an array of size 1 to receive the array answer - private static native int _httpGet(String userAgent, String url, byte[][] out); - - // CHECKSTYLE_ON - - /** - * Not instantiable. - */ - private LowLevelIE6() { - } -}