despair-way / ftpupanddown

Overly generic exceptions should not be thrown JAVA-W1042
Anti-pattern
Major
a year agoa year old
main should throw an exception more specific than Exception
18
19public class Main {
20
21	public static void main(String[] args) throws Exception {22		InputStream content = TransferConfig.class.getClassLoader().getResourceAsStream("app.json");
23		ObjectMapper objectMapper = new ObjectMapper();
24		List<TransferConfig> list = objectMapper.readValue(content, new TypeReference<List<TransferConfig>>() {
sftpDown should throw an exception more specific than Exception
 92	 */
 93
 94	public static File sftpDown(String username, String password, String ip, int port, String filepath)
 95			throws Exception { 96		Channel channel = null;
 97		Session session = null;
 98		JSch jsch = new JSch();
sftpUp should throw an exception more specific than Exception
 42	 */
 43
 44	public static void sftpUp(String username, String password, String ip, int port, String filepath, File localfile)
 45			throws Exception { 46		Session session = null;
 47		Channel channel = null;
 48		JSch jsch = new JSch();
ftpDown should throw an exception more specific than Exception
185	 * @throws SocketException,IOException ,FileNotFoundException
186	 */
187	public static File ftpDown(String username, String password, String ip, int port, String filepath)
188			throws Exception {189		FTPClient ftpClient = new FTPClient();
190		FileOutputStream outSteam = null;
191		File localfile = null;
ftpUp should throw an exception more specific than Exception
147	 * @throws SocketException,IOException ,FileNotFoundException
148	 */
149	public static void ftpUp(String username, String password, String ip, int port, String filepath, File localfile)
150			throws Exception {151		FTPClient ftpClient = new FTPClient();
152		FileInputStream inStream = null;
153		try {