1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 | package Torello.Java.Build;
import Torello.Java.StrCSV;
import static Torello.Java.C.BGREEN;
import static Torello.Java.C.BYELLOW;
import static Torello.Java.C.BCYAN;
import static Torello.Java.C.RESET;
import java.util.ArrayList;
import java.util.function.Function;
class ErrorCheckSelectedOpts
{
static void check(final SelectedOptionsRecord sor, final PrintHelpRecord phr)
{
checkNickName_CompatibleWith_MainMenuChoice(sor, phr);
}
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Error-Case: DO_NOT_DOCUMENT Flag
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
private static void checkNickName_CompatibleWith_MainMenuChoice
(final SelectedOptionsRecord sor, final PrintHelpRecord phr)
{
// If there are no user specified packages, then there is nothing to check!
//
// NOTE: Whenever there are ZERO-ELEMENTS to this list, it is actually just supposed to be
// null! That's the intended behavior.
if ((sor.userSpecifiedPackages == null) || (sor.userSpecifiedPackages.size() == 0))
return;
// The Minor "Faux-Pas" is where a user has requested a Partial-Build **BUT** there is a
// Java-Package which has been explicitly requested by Package-Nick-Name - even though
// that package is also on the User's Do-Not-Document List.
//
// This error also may occur if the user has explicity requested the Stage-3 Upgrader
// to run.
//
// NOTE: If the user hasn't selected a "-pbX" or "-3", then this error case is impossible,
// and this method may return immediately!
//
// THE-ERROR: Since all "-pb" switches (and the "-3" switch) request the Java-Doc Upgrader
// to run, it is against the rules for them to request that an "un-documentable"
// package be put through this Menu-Choice
final boolean doNotDocPackages_Disallowed =
sor.MENU_CHOICE.equals("3")
|| sor.MENU_CHOICE.startsWith("pb");
/*
System.out.println(
"doNotDocPackages_Disallowed: " + doNotDocPackages_Disallowed + '\n' +
"MENU_CHOICE: " + sor.MENU_CHOICE
);
*/
// The error-case being investigated is impossible, return now.
if (! doNotDocPackages_Disallowed) return;
// Keep the list of offending packages here..
ArrayList<BuildPackage> offendingPackages = new ArrayList<>();
// Must check the user specified pages.
for (BuildPackage bp : sor.userSpecifiedPackages)
if (! bp.mustDocument)
offendingPackages.add(bp);
// System.out.println("Offending Packages:\n" + offendingPackages.toString());
// Torello.Java.Q.BP();
// This error did not occur, so return without incident...
if (offendingPackages.size() == 0) return;
final Function<BuildPackage, String> PRINTER_01 =
(BuildPackage bp) -> BYELLOW + bp.nickName + RESET;
final Function<BuildPackage, String> PRINTER_02 =
(BuildPackage bp) -> "\n\t" + BYELLOW + bp.fullName + RESET;
phr.print_MainMenu_Options();
System.out.println(
"The following package Nick-Names were named, explicitly, at the " +
"Command-Line:\n\t" +
StrCSV.toCSV(offendingPackages, PRINTER_01, true, null) + '\n' +
"\n" +
"Which correspond to the following Java-Packages:" +
StrCSV.toCSV(offendingPackages, PRINTER_02, true, null) + '\n' +
"\n" +
"However, because these package(s) were marked using the " +
BCYAN + "DO_NOT_DOCUMENT" + RESET + " BuildPackage-Flag, they " +
"may not be run through the Stage-3 (Java-Doc Upgrader) Build-Step, or " +
"the Stage-5 (Java-Doc Cloud-Synchronization) Build-Step.\n" +
"\n" +
"You have made the follwing Main-Menu Choice: " +
BGREEN + '"' + sor.MENU_CHOICE + '"' + RESET + "\n" +
"So, please, either remove these particular packages from your CLI-Command, " +
"or select an alternate Main-Menu Choice.\n"
);
System.exit(1); throw null;
}
}
|