Buggy code:
public class Item extends SQLObject { private static final String kID_COLUMN_NAME = "item_id" ; private static final String kNAME_COLUMN_NAME = "name" ; private static final String kDESCRIPTION_COLUMN_NAME = "description" ; private static final String kPRICE_COLUMN_NAME = "price" ; private static final String kSTOCK_COLUMN_NAME = "stock_qty" ; private int ID ; private String fetchedName ; private String fetchedDescription ; private Double fetchedPrice ; private Integer fetchedStockQty ; private String name ; private String description ; private Double price ; private Integer stockQty ; public Item ( String name , String description ) { } private Item ( ) { } public static void fetchItemWithIDInBackground ( int ID , final Item . SingleItemCompletionHandler handler ) { } public static void fetchAllItemsInBackground ( final Item . MultipleItemCompletionHandler handler ) { } private static Item itemFromResultSet ( ResultSet results ) throws SQLException { } @ Override public void save ( final DatabaseManager . SaveCompletionHandler handler ) { } @ Override public HashMap < String , Object > changes ( ) { } @ Override public Boolean hasChanges ( ) { } @ Override public String getIDColumnName ( ) { } @ Override public int getID ( ) { } public String getName ( ) { } public String getDescription ( ) { } public double getPrice ( ) { } public int getStockQty ( ) { } public void setName ( String name ) { } public void setDescription ( String description ) { } public void setPrice ( Double price ) { } public void setStockQty ( Integer stockQty ) { } public interface SingleItemCompletionHandler { public void success ( Item item ) { } public void failed ( SQLException exception ) { } public void noResult ( ) { } } public interface MultipleItemCompletionHandler { public void succeeded ( ArrayList < Item > items ) { } public void failed ( SQLException exception ) { } public void noResults ( ) { } } public static class BasketItem extends SQLObject { private static final String kID_COLUMN_NAME = "basket_item_id" ; private static final String kUSER_ID_COLUMN_NAME = "user_id" ; private static final String kITEM_ID_COLUMN_NAME = "item_id" ; private static final String kQUANTITY_COLUMN_NAME = "quantity" ; private int ID ; private Item item ; private int fetchedQuantity ; private int quantity ; private BasketItem ( ) { } private BasketItem ( Item item , int quantity ) { } public static void fetchAllBasketItemsForUser ( User user , final Item . BasketItem . MultipleBasketItemCompletionHandler handler ) { } public static Item . BasketItem makeBasketItem ( final int userID , final Item item , final int quantity ) { if ( ( ( ( userID == 0 ) || ( item == null ) ) || ( ( item . getID ( ) ) == 0 ) ) || ( quantity == 0 ) ) return null ; final Item . BasketItem bItem = new Item . BasketItem ( item , quantity ) ; <START_BUG> HashMap < String , Object > fieldsAndValues = new HashMap < String , Object > ( 4 ) ; <END_BUG> fieldsAndValues . put ( Item . BasketItem . kUSER_ID_COLUMN_NAME , userID ) ; fieldsAndValues . put ( Item . BasketItem . kITEM_ID_COLUMN_NAME , item . getID ( ) ) ; fieldsAndValues . put ( Item . BasketItem . kQUANTITY_COLUMN_NAME , quantity ) ; DatabaseManager . createRecordInBackground ( fieldsAndValues , getSQLTableName ( Item . BasketItem . class ) , new DatabaseManager . CreateCompletionHandler ( ) { @ Override public void succeeded ( int ID ) { bItem . ID = ID ; bItem . fetchedQuantity = quantity ; bItem . quantity = 0 ; } @ Override public void sqlException ( SQLException exception ) { } } ) ; return bItem ; } @ Override public Boolean hasChanges ( ) { } @ Override public HashMap < String , Object > changes ( ) { } @ Override public String getIDColumnName ( ) { } @ Override public int getID ( ) { } public Item getItem ( ) { } public int getQuantity ( ) { } public void setQuantity ( int quantity ) { } public static abstract class MultipleBasketItemCompletionHandler extends DatabaseManager . SQLCompletionHandler { public abstract void succeeded ( HashMap < Integer , Item . BasketItem > basketItems ) { } } } }

Fix:
HashMap < String , Object > fieldsAndValues = new HashMap < String , Object > ( 3 ) ;