Home >Java >javaTutorial >Why shouldn't exceptions be ignored in Java development?
public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); try { params.putString(URLDecoder.decode(v[0], "UTF-8"), URLDecoder.decode(v[1], "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } } return params; }
Printing stack traces should almost always be avoided in production code. This is just as bad as ignoring the exception. This will write to the standard error stream, which is not where the logging framework is used.
The above is the detailed content of Why shouldn't exceptions be ignored in Java development?. For more information, please follow other related articles on the PHP Chinese website!