Things not to Do

Ondrej Zizka edited this page May 31, 2013 · 2 revisions

Use deprecated methods in a new code.

Use generated variable names - always name them by their purpose.

Use ArrayList when the capacity is not known in advance.

Throw empty exceptions as causes, like

throw new LoadMigrationException("...", new FileNotFoundException());

Stdout - use logging

Swallow exceptions just with log.error()

throw new FooException("Blah", new FileNotFoundException())

        File f = Utils.createPath(as5Config.getDir(), "server",
            as5Config.getProfileName(), "deploy", "hdscanner-jboss-beans.xml");

        File f = Utils.createPath(as5Config.getDeployDir(), "hdscanner-jboss-beans.xml");

    } catch (JAXBException e) {
        throw new LoadMigrationException(e);
    } catch (SAXException saxe) {
        throw new LoadMigrationException(saxe);
    } catch (IOException ioe) {
        throw new LoadMigrationException(ioe);
    } catch (XPathExpressionException xee) {
        throw new LoadMigrationException(xee);


    } catch (JAXBException | SAXException | IOException | XPathExpressionException ex) {
        throw new LoadMigrationException(ex);

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.