@@ -1315,11 +1315,17 @@ private void updateProviders(String profileExtensionId, List<String> allInfo) {
1315
1315
}
1316
1316
1317
1317
private String getExistingValue (String property ) {
1318
+ if (debug != null ) {
1319
+ debug .println ("\t Getting previous value of property: " + property );
1320
+ }
1321
+
1318
1322
// Look for values from profiles that this one extends.
1319
1323
String existingValue = profileProperties .get (property );
1324
+ String debugMessage = "\t \t Previous value from extended profile: " ;
1320
1325
1321
1326
// If there is no value, look for non-profile values in java.security file.
1322
1327
if (existingValue == null ) {
1328
+ debugMessage = "\t \t Previous value from java.security file: " ;
1323
1329
String propertyKey = null ;
1324
1330
switch (property ) {
1325
1331
case "jdkCertpathDisabledAlgorithms" :
@@ -1342,6 +1348,11 @@ private String getExistingValue(String property) {
1342
1348
}
1343
1349
existingValue = securityProps .getProperty (propertyKey );
1344
1350
}
1351
+
1352
+ if ((debug != null ) && existingValue != null ) {
1353
+ debug .println (debugMessage + existingValue );
1354
+ }
1355
+
1345
1356
return existingValue ;
1346
1357
}
1347
1358
@@ -1626,7 +1637,8 @@ private boolean setProperty(String property, String propertyKey, List<String> al
1626
1637
1627
1638
// Take existing value of property into account, if applicable.
1628
1639
if (existingValue == null ) {
1629
- printStackTraceAndExit ("Property '" + property + "' does not exist in parent profile. Cannot append." );
1640
+ printStackTraceAndExit ("Property '" + property + "' does not exist in"
1641
+ + " parent profile or java.security file. Cannot append." );
1630
1642
} else if (existingValue .isBlank ()) {
1631
1643
newValue = value ;
1632
1644
} else {
@@ -1640,6 +1652,10 @@ private boolean setProperty(String property, String propertyKey, List<String> al
1640
1652
// Remove values from property.
1641
1653
value = value .substring (1 ).trim ();
1642
1654
if (!value .isBlank ()) {
1655
+ if (existingValue == null ) {
1656
+ printStackTraceAndExit ("Property '" + property + "' does not exist in"
1657
+ + " parent profile or java.security file. Cannot remove." );
1658
+ }
1643
1659
List <String > existingValues = Stream .of (existingValue .split ("," ))
1644
1660
.map (v -> v .trim ())
1645
1661
.collect (Collectors .toList ());
@@ -1653,7 +1669,8 @@ private boolean setProperty(String property, String propertyKey, List<String> al
1653
1669
} else {
1654
1670
// Nothing to do. Use existing value of property into account, if available.
1655
1671
if (existingValue == null ) {
1656
- printStackTraceAndExit ("Property '" + property + "' does not exist in parent profile. Cannot remove." );
1672
+ printStackTraceAndExit ("Property '" + property + "' does not exist in"
1673
+ + " parent profile or java.security file. Cannot remove." );
1657
1674
} else if (existingValue .isBlank ()) {
1658
1675
newValue = value ;
1659
1676
} else {
0 commit comments