Better way to catch trouble points
<p>User submits a CSV file which is consumed by a program. Values which are used throughout the program come from the CSV, natually if values are missed it is a problem. Below is my solution.</p>

<p>Ip on top</p>

<pre><code>private List&lt;String&gt; currentFieldName = new ArrayList&lt;String&gt;();
</code></pre>

<p>As part of the method:</p>

<pre><code>try {
  setCurrentFieldName("Trim Space");
  p.setTrimSpace(currentLineArray[dc.getTRIM_POSITION()].equals("yes") ? true : false);

  setCurrentFieldName("Ignore Case");
  p.setIgnoreCase(currentLineArray[dc.getIGNORE_CASE_POSITION()].equals("yes") ? true : false);

} catch (NullPointerException e) {
    throw new InputSpreadsheetValueUnassignedException("\"Type\" field not set: " + currentFieldName);
}
</code></pre>

<p>And the method which keeps track of a current field being looked at:</p>

<pre><code>private void setCurrentFieldName(String fieldName) {
 currentFieldName.clear();
 currentFieldName.add(fieldName);
}
</code></pre>

<p>The idea there is that if user fails to submit value and i will end up getting null, before throwing an exception, i will know what value was not assigned.</p>

<p>So, this being said, specific questions:</p>

<ol>
<li>Is what i have shown below an acceptable solution?</li>
<li>Can you suggest something more elegant?</li>
</ol>
