<commit_before>package org.multibit.hd.ui.export;

import com.google.common.base.Joiner;
import com.googlecode.jcsv.writer.CSVEntryConverter;
import org.multibit.hd.core.config.Configurations;
import org.multibit.hd.core.dto.PaymentRequestData;

import java.text.DateFormat;
import java.text.SimpleDateFormat;


/**
 * Convert WalletTableData into single fields for use in a CSV file.
 */
public class PaymentRequestConverter implements CSVEntryConverter<PaymentRequestData> {

  DateFormat dateFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm", Configurations.currentConfiguration.getLocale());


  @Override
  public String[] convertEntry(PaymentRequestData paymentRequestData) {
    String[] columns = new String[12];

    // Date
    columns[0] = paymentRequestData.getDate() == null ? "" : dateFormatter.format(paymentRequestData.getDate().toDate());

    // Type
    columns[1] = paymentRequestData.getType() == null ? "" : paymentRequestData.getType().toString();

    // Bitcoin address
    columns[2] = paymentRequestData.getAddress() == null ? "" : paymentRequestData.getAddress().toString();

    // Description
    columns[3] = paymentRequestData.getDescription() == null ? "" : paymentRequestData.getDescription();<commit_msg>#323 Findbugs: Remove redundant null check<commit_after>package org.multibit.hd.ui.export;

import com.google.common.base.Joiner;
import com.googlecode.jcsv.writer.CSVEntryConverter;
import org.multibit.hd.core.config.Configurations;
import org.multibit.hd.core.dto.PaymentRequestData;

import java.text.DateFormat;
import java.text.SimpleDateFormat;


/**
 * Convert WalletTableData into single fields for use in a CSV file.
 */
public class PaymentRequestConverter implements CSVEntryConverter<PaymentRequestData> {

  DateFormat dateFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm", Configurations.currentConfiguration.getLocale());


  @Override
  public String[] convertEntry(PaymentRequestData paymentRequestData) {
    String[] columns = new String[12];

    // Date
    columns[0] = paymentRequestData.getDate() == null ? "" : dateFormatter.format(paymentRequestData.getDate().toDate());

    // Type
    columns[1] = paymentRequestData.getType() == null ? "" : paymentRequestData.getType().toString();

    // Bitcoin address
    columns[2] = paymentRequestData.getAddress() == null ? "" : paymentRequestData.getAddress().toString();

    // Description (cannot be null)
    columns[3] = paymentRequestData.getDescription();
{'fraction_non_alphanumeric': 0.12222670431625655, 'fraction_numerical': 0.0060508269463493344, 'mean_word_length': 5.048780487804878, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1568747', 'n_tokens_mistral': 710, 'n_tokens_neox': 683, 'n_words': 142}