|
25 | 25 | import java.nio.file.Files; |
26 | 26 | import java.nio.file.Path; |
27 | 27 | import java.nio.file.StandardCopyOption; |
| 28 | +import java.util.Locale; |
28 | 29 | import java.util.StringTokenizer; |
29 | 30 |
|
30 | 31 | import javax.management.InstanceNotFoundException; |
@@ -309,7 +310,13 @@ private static boolean pathCheck(File input, File expected, PrintWriter writer, |
309 | 310 | } |
310 | 311 |
|
311 | 312 |
|
312 | | - // -------------------------------------------------------- Private Methods |
| 313 | + private static String normalizeHostName(String hostName) { |
| 314 | + if (hostName == null) { |
| 315 | + return null; |
| 316 | + } else { |
| 317 | + return hostName.toLowerCase(Locale.ENGLISH); |
| 318 | + } |
| 319 | + } |
313 | 320 |
|
314 | 321 |
|
315 | 322 | /** |
@@ -340,6 +347,9 @@ protected synchronized void add(PrintWriter writer, String name, String aliases, |
340 | 347 | return; |
341 | 348 | } |
342 | 349 |
|
| 350 | + // Normalize host name before it is used |
| 351 | + name = normalizeHostName(name); |
| 352 | + |
343 | 353 | // Check if host already exists |
344 | 354 | if (engine.findChild(name) != null) { |
345 | 355 | writer.println(smClient.getString("hostManagerServlet.alreadyHost", name)); |
@@ -456,6 +466,9 @@ protected synchronized void remove(PrintWriter writer, String name, StringManage |
456 | 466 | return; |
457 | 467 | } |
458 | 468 |
|
| 469 | + // Normalize host name before it is used |
| 470 | + name = normalizeHostName(name); |
| 471 | + |
459 | 472 | // Check if host exists |
460 | 473 | if (engine.findChild(name) == null) { |
461 | 474 | writer.println(smClient.getString("hostManagerServlet.noHost", name)); |
@@ -534,6 +547,9 @@ protected void start(PrintWriter writer, String name, StringManager smClient) { |
534 | 547 | return; |
535 | 548 | } |
536 | 549 |
|
| 550 | + // Normalize host name before it is used |
| 551 | + name = normalizeHostName(name); |
| 552 | + |
537 | 553 | Container host = engine.findChild(name); |
538 | 554 |
|
539 | 555 | // Check if host exists |
@@ -585,6 +601,9 @@ protected void stop(PrintWriter writer, String name, StringManager smClient) { |
585 | 601 | return; |
586 | 602 | } |
587 | 603 |
|
| 604 | + // Normalize host name before it is used |
| 605 | + name = normalizeHostName(name); |
| 606 | + |
588 | 607 | Container host = engine.findChild(name); |
589 | 608 |
|
590 | 609 | // Check if host exists |
@@ -676,6 +695,9 @@ protected File getConfigBase(String hostName) { |
676 | 695 | * @return the config base for the host |
677 | 696 | */ |
678 | 697 | protected File getConfigBase(String hostName, PrintWriter writer, StringManager smClient) { |
| 698 | + // Normalize host name before it is used |
| 699 | + hostName = normalizeHostName(hostName); |
| 700 | + |
679 | 701 | File configBase = new File(context.getCatalinaBase(), "conf"); |
680 | 702 | if (!configBase.exists()) { |
681 | 703 | return null; |
|
0 commit comments