Polish ternary expressions

This commit is contained in:
Phillip Webb
2018-07-29 09:16:06 +01:00
parent b24bb688b8
commit aeb885192e
49 changed files with 59 additions and 60 deletions

View File

@@ -304,7 +304,7 @@ public class PropertiesLauncher extends Launcher {
for (String path : commaSeparatedPaths.split(",")) {
path = cleanupPath(path);
// "" means the user wants root of archive but not current directory
path = ("".equals(path) ? "/" : path);
path = "".equals(path) ? "/" : path;
paths.add(path);
}
if (paths.isEmpty()) {

View File

@@ -124,8 +124,8 @@ public class Handler extends URLStreamHandler {
private void log(boolean warning, String message, Exception cause) {
try {
Logger.getLogger(getClass().getName())
.log((warning ? Level.WARNING : Level.FINEST), message, cause);
Level level = warning ? Level.WARNING : Level.FINEST;
Logger.getLogger(getClass().getName()).log(level, message, cause);
}
catch (Exception ex) {
if (warning) {

View File

@@ -214,7 +214,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
@Override
public Object getContent() throws IOException {
connect();
return (this.jarEntryName.isEmpty() ? this.jarFile : super.getContent());
return this.jarEntryName.isEmpty() ? this.jarFile : super.getContent();
}
@Override
@@ -386,7 +386,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
private String deduceContentType() {
// Guess the content type, don't bother with streams as mark is not supported
String type = (isEmpty() ? "x-java/jar" : null);
String type = isEmpty() ? "x-java/jar" : null;
type = (type != null) ? type : guessContentTypeFromName(toString());
type = (type != null) ? type : "content/unknown";
return type;