Skip to content

Commit

Permalink
Avoid Hiding Cause Exception #195 Compilable UT inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkravin committed Sep 1, 2014
1 parent cf7e29b commit 534e9ee
Showing 1 changed file with 47 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,64 @@
public class InputAvoidHidingCauseExceptionCheck2
{

@Override
public Object convertToObject(String newString, Object previousValue)
throws DataTypeConversionException
{
if (BigDecimal.class.equals(type)) { // fix for #279
DecimalFormat format = (DecimalFormat) NumberFormat
.getNumberInstance(getLocale());
format.setParseBigDecimal(true);
Object type = null;
if (String.class.equals(type)) { // fix for #279
String format = (String) String
.valueOf(true);
format.substring(2);
try {
return format.parse(newString);
throw new ParseException();
}
catch (ParseException e) {
ErrorObject errorCode = new ErrorObject(
ErrorCodes.ERROR_CODE_BAD_FORMAT, newString);
throw new DataTypeConversionException(
"Could not be converted to BigDecimal", e, errorCode); //// INCORRECT WARNING HERE!!
"Could not be converted to String", e); //// INCORRECT WARNING HERE!!
}
}
return convertType(super.convertToObject(newString, previousValue));
return convertType(super.toString());
}

private Object convertType(String string)
{
return null;
}

private Object getLocale()
{
return null;
}

private class ErrorObject {

public ErrorObject(String errorCodeBadFormat, String newString)
{
}

}

private static class ErrorCodes {

public static final String ERROR_CODE_BAD_FORMAT = null;

}

private class DataTypeConversionException extends Throwable {

public DataTypeConversionException(String string, ParseException e)
{
// TODO Auto-generated constructor stub
}

}

private class ParseException extends Throwable {

}



}

0 comments on commit 534e9ee

Please sign in to comment.