Declare context in the try-catch block.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 18 Apr 2012 21:40:26 +0000 (23:40 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 18 Apr 2012 21:40:26 +0000 (23:40 +0200)
src/main/java/net/pterodactylus/demoscenemusic/core/Core.java

index d135924..eaba985 100644 (file)
@@ -45,9 +45,8 @@ public class Core implements ServletContextListener {
         * {@inheritDoc}
         */
        public void contextInitialized(ServletContextEvent servletContextEvent) {
-               Context context;
                try {
-                       context = new InitialContext();
+                       Context context = new InitialContext();
                        DataSource dataSource = (DataSource) context.lookup("java:/comp/env/jdbc/demosceneMusic");
                        Database database = AbstractDatabase.fromDataSource(dataSource);
                        dataManager = new DataManager(database);