@@ -54,8 +54,18 @@ public class MailcapFile implements MailcapRegistry {
5454
5555 static {
5656 try {
57- addReverse = Boolean .getBoolean ("jakarta.activation.addreverse" ) ||
58- Boolean .getBoolean ("javax.activation.addreverse" );
57+ addReverse = Boolean .getBoolean ("angus.activation.addreverse" );
58+ // deprecated in 1.1.0:
59+ String prop = System .getProperty ("jakarta.activation.addreverse" );
60+ if (prop != null ) {
61+ LogSupport .log ("'jakarta.activation.addreverse' property is deprecated, use 'angus.activation.addreverse' instead" );
62+ addReverse = Boolean .parseBoolean (prop );
63+ }
64+ prop = System .getProperty ("javax.activation.addreverse" );
65+ if (prop != null ) {
66+ LogSupport .log ("'javax.activation.addreverse' property is deprecated, use 'angus.activation.addreverse' instead" );
67+ addReverse = Boolean .parseBoolean (prop );
68+ }
5969 } catch (Throwable t ) {
6070 // ignore any errors
6171 }
@@ -68,8 +78,7 @@ public class MailcapFile implements MailcapRegistry {
6878 * @throws IOException for I/O errors
6979 */
7080 public MailcapFile (String new_fname ) throws IOException {
71- if (LogSupport .isLoggable ())
72- LogSupport .log ("new MailcapFile: file " + new_fname );
81+ LogSupport .log ("new MailcapFile: file " + new_fname );
7382 try (BufferedReader reader = new BufferedReader (new FileReader (new_fname ))) {
7483 parse (reader );
7584 }
@@ -82,17 +91,15 @@ public MailcapFile(String new_fname) throws IOException {
8291 * @throws IOException for I/O errors
8392 */
8493 public MailcapFile (InputStream is ) throws IOException {
85- if (LogSupport .isLoggable ())
86- LogSupport .log ("new MailcapFile: InputStream" );
94+ LogSupport .log ("new MailcapFile: InputStream" );
8795 parse (new BufferedReader (new InputStreamReader (is , StandardCharsets .ISO_8859_1 )));
8896 }
8997
9098 /**
9199 * Mailcap file default constructor.
92100 */
93101 public MailcapFile () {
94- if (LogSupport .isLoggable ())
95- LogSupport .log ("new MailcapFile: default" );
102+ LogSupport .log ("new MailcapFile: default" );
96103 }
97104
98105 /**
@@ -232,8 +239,7 @@ private Map<String, List<String>> mergeResults(Map<String, List<String>> first,
232239 * @param mail_cap the mailcap string
233240 */
234241 public void appendToMailcap (String mail_cap ) {
235- if (LogSupport .isLoggable ())
236- LogSupport .log ("appendToMailcap: " + mail_cap );
242+ LogSupport .log ("appendToMailcap: " + mail_cap );
237243 try {
238244 parse (new BufferedReader (new StringReader (mail_cap )));
239245 } catch (IOException ex ) {
@@ -300,8 +306,7 @@ protected void parseLine(String mailcapEntry)
300306 MailcapTokenizer tokenizer = new MailcapTokenizer (mailcapEntry );
301307 tokenizer .setIsAutoquoting (false );
302308
303- if (LogSupport .isLoggable ())
304- LogSupport .log ("parse: " + mailcapEntry );
309+ LogSupport .log ("parse: " + mailcapEntry );
305310 // parse the primary type
306311 int currentToken = tokenizer .nextToken ();
307312 if (currentToken != MailcapTokenizer .STRING_TOKEN ) {
@@ -339,8 +344,7 @@ protected void parseLine(String mailcapEntry)
339344
340345 String mimeType = primaryType + "/" + subType ;
341346
342- if (LogSupport .isLoggable ())
343- LogSupport .log (" Type: " + mimeType );
347+ LogSupport .log (" Type: " + mimeType );
344348
345349 // now setup the commands hashtable
346350 Map <String , List <String >> commands = new LinkedHashMap <>(); // keep commands in order found
@@ -435,8 +439,7 @@ protected void parseLine(String mailcapEntry)
435439 } else {
436440
437441 // setup the class entry list
438- if (LogSupport .isLoggable ())
439- LogSupport .log (" Command: " + commandName +
442+ LogSupport .log (" Command: " + commandName +
440443 ", Class: " + paramValue );
441444 List <String > classes = commands .computeIfAbsent (commandName , k -> new ArrayList <>());
442445 if (addReverse )
@@ -456,8 +459,7 @@ protected void parseLine(String mailcapEntry)
456459 if (curcommands == null ) {
457460 masterHash .put (mimeType , commands );
458461 } else {
459- if (LogSupport .isLoggable ())
460- LogSupport .log ("Merging commands for type " + mimeType );
462+ LogSupport .log ("Merging commands for type " + mimeType );
461463 // have to merge current and new commands
462464 // first, merge list of classes for commands already known
463465 Iterator <String > cn = curcommands .keySet ().iterator ();
@@ -516,13 +518,6 @@ protected static void reportParseError(int expectedToken,
516518 protected static void reportParseError (int expectedToken ,
517519 int otherExpectedToken , int anotherExpectedToken , int actualToken ,
518520 String actualTokenValue ) throws MailcapParseException {
519- if (LogSupport .isLoggable ())
520- LogSupport .log ("PARSE ERROR: " + "Encountered a " +
521- MailcapTokenizer .nameForToken (actualToken ) + " token (" +
522- actualTokenValue + ") while expecting a " +
523- MailcapTokenizer .nameForToken (expectedToken ) + ", a " +
524- MailcapTokenizer .nameForToken (otherExpectedToken ) + ", or a " +
525- MailcapTokenizer .nameForToken (anotherExpectedToken ) + " token." );
526521 throw new MailcapParseException ("Encountered a " +
527522 MailcapTokenizer .nameForToken (actualToken ) + " token (" +
528523 actualTokenValue + ") while expecting a " +
0 commit comments