<commit_before>package com.github.julekarenalender.view.util

import scala.collection.JavaConverters._
import no.jervell.view.awt.{Anchor, Image}
import java.awt.image.BufferedImage
import java.awt.{Color, Graphics}
import com.github.julekarenalender.log.Logging
import java.net.URI
import java.io.File
import scala.util.{Failure, Success, Try}

object Images {
  def apply() = new Images with DefaultImageLocations
}

class Images extends Logging {
  this: ImageLocations =>
  private val BlankColour = Color.WHITE
  val Blank: Image = blankImage

  def staticImg(name: String): Image = {
    val staticFilename = s"$staticImageLocation/$name"
    Try(getClass.getClassLoader.getResource(staticFilename).toURI) match {
      case Success(uri) => image(new File(uri))
      case Failure(ex) => {
        logger.error(s"Unable to load static image: $staticFilename")
        Blank
      }
    }<commit_msg>Fixed an issue where static images from classpath in the jar would not load<commit_after>package com.github.julekarenalender.view.util

import scala.collection.JavaConverters._
import no.jervell.view.awt.{Anchor, Image}
import java.awt.image.BufferedImage
import java.awt.{Color, Graphics}
import com.github.julekarenalender.log.Logging
import java.net.URI
import java.io.File
import scala.util.{Failure, Success, Try}

object Images {
  def apply() = new Images with DefaultImageLocations
}

class Images extends Logging {
  this: ImageLocations =>
  private val BlankColour = Color.WHITE
  val Blank: Image = blankImage

  def staticImg(name: String): Image = {
    val staticFilename = s"$staticImageLocation/$name"

    Try(getClass.getClassLoader.getResource(staticFilename).toURI) match {
      case Success(uri) => loadGeneric(uri).get
      case Failure(ex) => {
        logger.error(s"Unable to load static image: $staticFilename")
        Blank
      }
    }
{'fraction_non_alphanumeric': 0.0998398291510945, 'fraction_numerical': 0.0, 'mean_word_length': 4.191135734072022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3227860', 'n_tokens_mistral': 579, 'n_tokens_neox': 570, 'n_words': 144}