Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DefaultToEmptyNumberFormatter.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package org.sleuthkit.autopsy.logicalimager.configuration;
7 
8 import java.text.NumberFormat;
9 import java.text.ParseException;
10 import javax.swing.text.NumberFormatter;
11 
16 final class DefaultToEmptyNumberFormatter extends NumberFormatter {
17 
18  private static final long serialVersionUID = 1L;
19 
25  DefaultToEmptyNumberFormatter(NumberFormat format) {
26  super(format);
27  }
28 
29  @Override
30  public Object stringToValue(String string)
31  throws ParseException {
32  Object returnValue = null;
33  try {
34  returnValue = super.stringToValue(string);
35  } catch (ParseException ignored) {
36  //reset value to being empty since invalid value was entered
37  }
38  return returnValue;
39  }
40 }

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.