Banging My Head Against the Wall

What I wish I knew before I started…

Category: Java

  • AWS SDK version 2 – Error configuring S3 Lifecyle Configuration

    I was trying to use the AWS Java SDK version 2 to create an S3 bucket and add a Lifecycle Rule to expire all objects after 14 days. The Developer Guide has a similar example, only that example transitions objects to S3 Glacier. I ended up encountering an error that was of very little help:…

  • AWS Managing large SQS messages using S3 with Java SDK version 2

    AWS has a page in their SQS Developer Guide about how to manage large SQS messages using S3. (As of August 4, 2022 the SQS message size limit is 256 KB.) The solution makes use of the Amazon SQS Extended Client Library for Java, which is found in GitHub and any of the central Maven…

  • Using Matches for null parameter with Mockito

    I was using Mockito to write a unit test today and had a brief struggle trying to write a Matcher for a parameter I expected to be null. Here is the method in my interface that was causing problems: public interface ItemService { List<Item> findItems(String query, Map<String, String> qualifiers); } In my unit test I…

  • FindBugs warning with Guava’s Predicate interface

    When running FindBugs on some code I wrote, I received a  NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE warning: Bug type NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE (click for details) In class com.wall.steve.HelperMethods$1 In method com.wall.steve.HelperMethods$1.apply(MyItem) Parameter item At HelperMethods.java:[line 27] This was the code I had written: //com.wall.steve.HelperMethods class public static final Predicate<MyItem> NON_REJECTED_ITEMS = new Predicate<MyItem>() { @Override public boolean apply(final MyItem item) //This is…

  • My Presentation at the Twin Cities Java User Group

    This week I gave a presentation titled “What’s New in Java 8” at the November meeting of the Twin Cities Java User Group (TCJUG). Topics covered include: Interfaces – static and default methods Lambdas Functional Programming Streams API New java.time API Nashorn JavaScript Engine Other new classes and methods The code I wrote during the…

  • Java 8 Streams.max() and Streams.min() example

    I have been playing around with the new Stream interface in Java 8 and struggled briefly with the max() and min() methods.  Here is some example code I wrote for how to use the method max() from the Stream class.  The min() method will be very similar. First, I had a Person class which is just a POJO…

  • Eclipse Error: project facet java 1.7 is not supported by target runtime apache tomcat v6.0

    We are upgrading some Java Projects from Java 6 to Java 7.  We use Eclipse yet still need to use Apache Tomcat 6.0.x.  After downloading and installing the a JDK 7 and changing all the necessary references in Project Preferences to Java 7 (e.g. Java Build Path, Java Compiler, etc.), I was still left with this error:…