Skip to content

Commit

Permalink
Replace tabs with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
liefke authored and atl-mk committed Sep 19, 2024
1 parent a771737 commit cf51e1b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,22 @@ public void execute() throws MojoFailureException {
* the <server> entry from the settings.xml
*/
protected Map<String, String> getHttpHeaders(Server server) {
if (server == null || !(server.getConfiguration() instanceof Xpp3Dom)) {
return Collections.emptyMap();
}
Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
Map<String, String> result = new HashMap<>();
if (server == null || !(server.getConfiguration() instanceof Xpp3Dom)) {
return Collections.emptyMap();
}
Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
Map<String, String> result = new HashMap<>();

Xpp3Dom httpHeaders = configuration.getChild("httpHeaders");
if (httpHeaders != null) {
for (Xpp3Dom property : httpHeaders.getChildren("property")) {
for (Xpp3Dom property : httpHeaders.getChildren("property")) {
Xpp3Dom name = property.getChild("name");
Xpp3Dom value = property.getChild("value");
if (name != null && value != null) {
result.put(name.getValue(), value.getValue());
}
Xpp3Dom value = property.getChild("value");
if (name != null && value != null) {
result.put(name.getValue(), value.getValue());
}
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ public void execute(FrontendPluginFactory factory) throws InstallationException
Server server = MojoUtils.decryptServer(serverId, session, decrypter);
if (null != server) {
Map<String, String> httpHeaders = getHttpHeaders(server);
nodeInstaller
.setUserName(server.getUsername())
.setPassword(server.getPassword())
.setHttpHeaders(httpHeaders);
nodeInstaller
.setUserName(server.getUsername())
.setPassword(server.getPassword())
.setHttpHeaders(httpHeaders);
corepackInstaller
.setUserName(server.getUsername())
.setPassword(server.getPassword())
.setHttpHeaders(httpHeaders);
.setUserName(server.getUsername())
.setPassword(server.getPassword())
.setHttpHeaders(httpHeaders);
}

// Perform the installation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void execute(FrontendPluginFactory factory) throws InstallationException
Server server = MojoUtils.decryptServer(serverId, session, decrypter);
if (null != server) {
Map<String, String> httpHeaders = getHttpHeaders(server);
factory.getNodeInstaller(proxyConfig)
factory.getNodeInstaller(proxyConfig)
.setNodeVersion(nodeVersion)
.setNodeDownloadRoot(nodeDownloadRoot)
.setNpmVersion(npmVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void execute(FrontendPluginFactory factory) throws InstallationException
String resolvedPnpmDownloadRoot = getPnpmDownloadRoot();
Server server = MojoUtils.decryptServer(serverId, session, decrypter);
if (null != server) {
Map<String, String> httpHeaders = getHttpHeaders(server);
Map<String, String> httpHeaders = getHttpHeaders(server);
factory.getNodeInstaller(proxyConfig)
.setNodeVersion(nodeVersion)
.setNodeDownloadRoot(resolvedNodeDownloadRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void execute(FrontendPluginFactory factory) throws InstallationException
boolean isYarnYamlFilePresent = isYarnrcYamlFilePresent(this.session, this.workingDirectory);

if (null != server) {
Map<String, String> httpHeaders = getHttpHeaders(server);
Map<String, String> httpHeaders = getHttpHeaders(server);
factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot)
.setNodeVersion(this.nodeVersion).setUserName(server.getUsername())
.setPassword(server.getPassword()).setHttpHeaders(httpHeaders).install();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public BunInstaller setPassword(String password) {
}

public BunInstaller setHttpHeaders(Map<String, String> httpHeaders) {
this.httpHeaders = httpHeaders;
return this;
this.httpHeaders = httpHeaders;
return this;
}

public void install() throws InstallationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public CorepackInstaller setPassword(String password) {
}

public CorepackInstaller setHttpHeaders(Map<String, String> httpHeaders) {
this.httpHeaders = httpHeaders;
return this;
this.httpHeaders = httpHeaders;
return this;
}

public void install() throws InstallationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ private CloseableHttpResponse execute(String requestUrl, String userName, String
}

if (httpHeaders != null) {
for (Map.Entry<String, String> header : httpHeaders.entrySet()) {
LOGGER.info("Using HTTP-Header (" + header.getKey() + ") from settings.xml");
request.addHeader(header.getKey(), header.getValue());
}
for (Map.Entry<String, String> header : httpHeaders.entrySet()) {
LOGGER.info("Using HTTP-Header (" + header.getKey() + ") from settings.xml");
request.addHeader(header.getKey(), header.getValue());
}
}

if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public NodeInstaller setPassword(String password) {
}

public NodeInstaller setHttpHeaders(Map<String, String> httpHeaders) {
this.httpHeaders = httpHeaders;
return this;
this.httpHeaders = httpHeaders;
return this;
}

private boolean npmProvided() throws InstallationException {
Expand Down Expand Up @@ -334,14 +334,14 @@ private void extractFile(File archive, File destinationDirectory) throws Archive
}

private void downloadFileIfMissing(String downloadUrl, File destination, String userName, String password,
Map<String, String> httpHeaders) throws DownloadException {
Map<String, String> httpHeaders) throws DownloadException {
if (!destination.exists()) {
downloadFile(downloadUrl, destination, userName, password, httpHeaders);
}
}

private void downloadFile(String downloadUrl, File destination, String userName, String password,
Map<String, String> httpHeaders) throws DownloadException {
Map<String, String> httpHeaders) throws DownloadException {
this.logger.info("Downloading {} to {}", downloadUrl, destination);
this.fileDownloader.download(downloadUrl, destination.getPath(), userName, password, httpHeaders);
}
Expand Down

0 comments on commit cf51e1b

Please sign in to comment.