|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2022 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -108,19 +108,13 @@ protected File getPortFile(ApplicationContext applicationContext) {
|
108 | 108 | if (!StringUtils.hasLength(namespace)) {
|
109 | 109 | return this.file;
|
110 | 110 | }
|
111 |
| - String name = this.file.getName(); |
112 |
| - String extension = StringUtils.getFilenameExtension(this.file.getName()); |
113 |
| - name = name.substring(0, name.length() - extension.length() - 1); |
114 |
| - if (isUpperCase(name)) { |
115 |
| - name = name + "-" + namespace.toUpperCase(Locale.ENGLISH); |
116 |
| - } |
117 |
| - else { |
118 |
| - name = name + "-" + namespace.toLowerCase(Locale.ENGLISH); |
119 |
| - } |
120 |
| - if (StringUtils.hasLength(extension)) { |
121 |
| - name = name + "." + extension; |
122 |
| - } |
123 |
| - return new File(this.file.getParentFile(), name); |
| 111 | + String filename = this.file.getName(); |
| 112 | + String extension = StringUtils.getFilenameExtension(filename); |
| 113 | + String filenameWithoutExtension = filename.substring(0, filename.length() - extension.length() - 1); |
| 114 | + String suffix = (!isUpperCase(filename)) ? namespace.toLowerCase(Locale.ENGLISH) |
| 115 | + : namespace.toUpperCase(Locale.ENGLISH); |
| 116 | + return new File(this.file.getParentFile(), |
| 117 | + filenameWithoutExtension + "-" + suffix + ((!StringUtils.hasLength(extension)) ? "" : "." + extension)); |
124 | 118 | }
|
125 | 119 |
|
126 | 120 | private String getServerNamespace(ApplicationContext applicationContext) {
|
|
0 commit comments