/**
  * Tell the user about, and log, an exception.
  *
  * @param except the exception in question
  * @param filename what file was being read
  */
 private void printError(final Exception except, final String filename) {
   if (except instanceof MapVersionException) {
     LOGGER.log(Level.SEVERE, "Map version in " + filename + " not acceptable to reader", except);
     printParagraph("ERROR: Map version not acceptable to reader", ERROR_COLOR);
   } else if (except instanceof FileNotFoundException || except instanceof NoSuchFileException) {
     printParagraph("ERROR: File not found", ERROR_COLOR);
     LOGGER.log(Level.SEVERE, filename + " not found", except);
   } else if (except instanceof IOException) {
     //noinspection HardcodedFileSeparator
     printParagraph("ERROR: I/O error reading file", ERROR_COLOR);
     //noinspection HardcodedFileSeparator
     LOGGER.log(Level.SEVERE, "I/O error reading " + filename, except);
   } else if (except instanceof XMLStreamException) {
     printParagraph(
         "ERROR: Malformed XML in the file" + "; see following error message for details",
         ERROR_COLOR);
     final String message =
         NullCleaner.valueOrDefault(except.getLocalizedMessage(), "(message was null)");
     printParagraph(message, ERROR_COLOR);
     LOGGER.log(Level.SEVERE, "Malformed XML in file " + filename, except);
   } else if (except instanceof SPFormatException) {
     printParagraph(
         "ERROR: SP map format error at line "
             + ((SPFormatException) except).getLine()
             + "; see following error message for details",
         ERROR_COLOR);
     final String message =
         NullCleaner.valueOrDefault(except.getLocalizedMessage(), "(message was null)");
     printParagraph(message, ERROR_COLOR);
     LOGGER.log(Level.SEVERE, "SP map format error reading " + filename, except);
   } else {
     throw new IllegalStateException("Unhandled exception class");
   }
 }
 /** Constructor. */
 public MapCheckerFrame() {
   super("Strategic Primer Map Checker", Optional.empty(), new Dimension(640, 320));
   Warning.Custom.setCustomPrinter(
       Warning.wrapHandler(
           str ->
               printParagraph(
                   str, NullCleaner.assertNotNull(StreamingLabel.LabelTextColor.yellow))));
   setBackground(Color.black);
   setContentPane(new JScrollPane(label));
   getContentPane().setBackground(Color.black);
 }
 /**
  * @param strings strings
  * @return them concatenated together
  */
 private static String concat(final String... strings) {
   final StringBuilder build =
       new StringBuilder(Stream.of(strings).mapToInt(String::length).sum());
   Stream.of(strings).forEach(build::append);
   return NullCleaner.assertNotNull(build.toString());
 }
 /** @param tag the current tag (the one that needs a child) */
 public MissingChildException(final StartElement tag) {
   super(
       "Tag " + tag.getName().getLocalPart() + " missing a child",
       NullCleaner.assertNotNull(tag.getLocation()));
   context = NullCleaner.assertNotNull(tag.getName());
 }