Commit 6fc25a30 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #20192 from zhangt2333

* pr/20192:
  Update copyright date
  Polish

Closes gh-20192
parents ff4de95b 03bee839
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* 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.
...@@ -70,7 +70,7 @@ public enum ApiVersion { ...@@ -70,7 +70,7 @@ public enum ApiVersion {
private static ApiVersion forType(String type) { private static ApiVersion forType(String type) {
if (type.startsWith(MEDIA_TYPE_PREFIX)) { if (type.startsWith(MEDIA_TYPE_PREFIX)) {
type = type.substring(MEDIA_TYPE_PREFIX.length()); type = type.substring(MEDIA_TYPE_PREFIX.length());
int suffixIndex = type.indexOf("+"); int suffixIndex = type.indexOf('+');
type = (suffixIndex != -1) ? type.substring(0, suffixIndex) : type; type = (suffixIndex != -1) ? type.substring(0, suffixIndex) : type;
try { try {
return valueOf(type.toUpperCase()); return valueOf(type.toUpperCase());
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* 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.
...@@ -74,10 +74,7 @@ class ProjectGenerator { ...@@ -74,10 +74,7 @@ class ProjectGenerator {
return true; return true;
} }
// explicit name hasn't been provided for an archive and there is no extension // explicit name hasn't been provided for an archive and there is no extension
if (isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".")) { return isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".");
return true;
}
return false;
} }
private boolean isZipArchive(ProjectGenerationResponse entity) { private boolean isZipArchive(ProjectGenerationResponse entity) {
......
...@@ -140,10 +140,7 @@ public class DependencyCustomizer { ...@@ -140,10 +140,7 @@ public class DependencyCustomizer {
protected boolean canAdd() { protected boolean canAdd() {
for (String path : paths) { for (String path : paths) {
try { try {
if (DependencyCustomizer.this.loader.getResource(path) == null) { return DependencyCustomizer.this.loader.getResource(path) != null;
return false;
}
return true;
} }
catch (Exception ex) { catch (Exception ex) {
// swallow exception and continue // swallow exception and continue
...@@ -166,10 +163,7 @@ public class DependencyCustomizer { ...@@ -166,10 +163,7 @@ public class DependencyCustomizer {
protected boolean canAdd() { protected boolean canAdd() {
for (String path : paths) { for (String path : paths) {
try { try {
if (DependencyCustomizer.this.loader.getResource(path) != null) { return DependencyCustomizer.this.loader.getResource(path) != null;
return true;
}
return false;
} }
catch (Exception ex) { catch (Exception ex) {
// swallow exception and continue // swallow exception and continue
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* 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.
...@@ -381,10 +381,7 @@ public abstract class MainClassFinder { ...@@ -381,10 +381,7 @@ public abstract class MainClassFinder {
return false; return false;
} }
MainClass other = (MainClass) obj; MainClass other = (MainClass) obj;
if (!this.name.equals(other.name)) { return this.name.equals(other.name);
return false;
}
return true;
} }
@Override @Override
......
...@@ -54,7 +54,7 @@ final class ClassPathIndexFile { ...@@ -54,7 +54,7 @@ final class ClassPathIndexFile {
} }
private String getFolder(String name) { private String getFolder(String name) {
int lastSlash = name.lastIndexOf("/"); int lastSlash = name.lastIndexOf('/');
return (lastSlash != -1) ? name.substring(0, lastSlash) : null; return (lastSlash != -1) ? name.substring(0, lastSlash) : null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment