Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Introduction to Functional Programming Java's Functional Toolset Function Shapes

Andre Kucharzyk
Andre Kucharzyk
4,479 Points

Exception placement in logs.

public class Main {

public static void yell(String words) {
    Objects.requireNonNull(words, () -> "Created issue" + Main.createIssue());
    System.out.printf("%s!!!!! %n", words.toUpperCase());

private static String createIssue() {
    System.out.println("Some external API call to bug tracker");
    return "#135345";

public static void main(String[] args) {
    List<String> ingredients = Arrays.asList(
            "nie dupa",
            "znowu nie dupa",




Exception in thread "main" java.lang.NullPointerException: Created issue#135345 NIE DUPA!!!!! at java.base/java.util.Objects.requireNonNull(Objects.java:347) at Main.yell(Main.java:10) at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4389) at Main.main(Main.java:28) ZNOWU NIE DUPA!!!!! CYCKI!!!!! Some external API call to bug tracker

My question is - why excepion in logs is shown after word "DUPA!!!!!" and not below "CYCKI" where the null is?

Andre Kucharzyk
Andre Kucharzyk
4,479 Points

By the way - when I copy paste logs from InteliJ console they lose formatting (everything is in single line). Is there a way to fix it?