title: excluding bad lines in spring batch to ItemWriter
body: <pre><code>Cob Date;Supplier Code;Customer Code;
  20180123;ABCLTD;43434;
  20180123;BCD;4645;
  ;;;;;;;;
  ;;;;;;;
  </code></pre>
  
  <p>How can I avoid passing lines with <code>;;;;;;</code>  to the writer? </p>
  
  <p>My mapper class looks something like this:</p>
  
  <pre><code>public class Mapper implements FieldSetMapper&lt;Model&gt; {
  
  
      @Override
      public PosRow mapFieldSet(FieldSet fieldSet) {
  
          if (fieldSet == null) {
              return null;
          }
  
          Model pos = new Model();
  
          try {
  
              if (!StringUtils.isEmpty(fieldSet.readString("cobDate"))) {
                  pos.setCobDate(new Date());
              }
  
              } catch(...) {}
  
              }
              return pos;
      }
  </code></pre>
  
  <p>I check for <code>fieldset==null</code> and then check for each delimited fields and set the values to model. Next, in my processor looks like this:</p>
  
  <pre><code>public class ModelItemProcessor implements ItemProcessor&lt;Model, AnotherModel&gt; {
  
      private Set&lt;AnotherModel&gt; anotherModelSet= new HashSet&lt;&gt;();
  
      @Override
      public AnotherModel process(final Model posRow) throws Exception {
  
          if (posRow == null) {
  
          }
  
          if (!posRow.isValid()) {
              return null;
          }
  
  
         AnotherModel scp = new AnotherModel();
  
        //sett values
  
          if (anotherModelSet.contains(scp)) return null;
  
          anotherModelSet.add(scp);
  
          return scp;
      }
  </code></pre>
  
  <p>but still in my <code>write()</code> method i get items that are of size 0. </p>