Skip to content

Commit

Permalink
Use default CfT URL when some problem requesting the CfT endpoints ha…
Browse files Browse the repository at this point in the history
…ppens
  • Loading branch information
bonigarcia committed Aug 25, 2023
1 parent 742f0ac commit 5bd62f5
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
Expand Down Expand Up @@ -67,6 +68,7 @@ public class VersionDetector {
static final String VERSIONS_PROPERTIES = "versions.properties";
static final String COMMANDS_PROPERTIES = "commands.properties";
static final String FILE_PROTOCOL = "file";
static final String CFT_URL = "https://googlechromelabs.github.io/chrome-for-testing/";

final Logger log = getLogger(lookup().lookupClass());

Expand Down Expand Up @@ -142,10 +144,16 @@ public Optional<String> getDriverVersionFromRepository(
return Optional.of(versions.channels.stable.version);
}
} catch (Exception e) {
log.warn("Exception reading {} to get version of {} ({})",
log.warn(
"Exception reading CfT URL ('{}') to get version of {} ({})",
cftUrl, driverName, e.getMessage());
try {
driverUrl = new URL(CFT_URL);
} catch (MalformedURLException e1) {
log.error("Exception creating CfT URL {}: {}", CFT_URL,
e.getMessage());
}
}

}

String osLabel = optOsLabel.isPresent() ? optOsLabel.get() : "";
Expand Down

0 comments on commit 5bd62f5

Please sign in to comment.