From 256c360841f85da6c986963a82ef023e5bffd156 Mon Sep 17 00:00:00 2001 From: Almas Baimagambetov Date: Mon, 3 Oct 2022 12:37:13 +0100 Subject: [PATCH] refactor: Replaced print stack trace calls with Logger (#528) * refactor: Replaced print stack trace calls with Logger * replaced sysout calls * fixed headers --- .../app/menubar/MenuBarController.java | 13 +++++-- .../scenebuilder/app/tracking/Tracking.java | 10 ++--- .../scenebuilder/app/util/AppSettings.java | 18 +++++---- .../scenebuilder/app/util/MessageBox.java | 7 +++- .../kit/editor/EditorPlatform.java | 4 +- .../panel/content/ContentPanelController.java | 8 ++-- .../content/mode/EditModeController.java | 8 +++- .../editor/panel/css/CssPanelController.java | 6 ++- .../kit/editor/panel/css/CssUtils.java | 9 +++-- .../inspector/editors/PropertyEditor.java | 4 +- .../scenebuilder/kit/i18n/I18NControl.java | 38 ++++++++++++++++++- .../scenebuilder/kit/library/LibraryItem.java | 6 ++- .../kit/library/user/UserLibrary.java | 10 +++-- .../kit/metadata/MetadataIntrospector.java | 6 ++- .../kit/util/ReflectionUtils.java | 9 +++-- 15 files changed, 113 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java index 938c540a7..c7f74f77c 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java @@ -65,6 +65,8 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.beans.value.ChangeListener; import javafx.collections.ObservableList; @@ -453,8 +455,12 @@ public MenuBar getMenuBar() { loader.load(); controllerDidLoadFxml(); } catch (RuntimeException | IOException x) { - System.out.println("loader.getController()=" + loader.getController()); //NOI18N - System.out.println("loader.getLocation()=" + loader.getLocation()); //NOI18N + var logMessage = "Failed to load MenuBar.fxml:\n" + + "loader.getController()=" + loader.getController() + "\n" + + "loader.getLocation()=" + loader.getLocation() + ":"; + + Logger.getLogger(getClass().getName()).log(Level.WARNING, logMessage, x); + throw new RuntimeException("Failed to load " + fxmlURL.getFile(), x); //NOI18N } } @@ -1218,7 +1224,8 @@ private void handleOnMenuValidation(Menu menu) { final Exception xx = new Exception(c.getClass().getSimpleName() + ".canPerform() did break for menu item " + i, x); //NOI18N - xx.printStackTrace(); + + Logger.getLogger(getClass().getName()).log(Level.WARNING, xx.getMessage(), xx); } disable = !canPerform; title = c.getTitle(); diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/tracking/Tracking.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/tracking/Tracking.java index 0d068b47c..93e8399ce 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/tracking/Tracking.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/tracking/Tracking.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Gluon and/or its affiliates. + * Copyright (c) 2016, 2022, Gluon and/or its affiliates. * All rights reserved. Use is subject to license terms. * * This file is available and licensed under the following license: @@ -40,6 +40,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; +import java.util.logging.Level; +import java.util.logging.Logger; public class Tracking { public static final String SCENEBUILDER_TYPE = "scenebuilder"; @@ -71,10 +73,8 @@ public static void sendTrackingInfo(String type, String hash, String email, bool while (in.read() > -1) { } } - } catch (MalformedURLException ex) { - ex.printStackTrace(); - } catch (IOException ex) { - ex.printStackTrace(); + } catch (Exception e) { + Logger.getLogger(Tracking.class.getName()).log(Level.WARNING, "Failed to send tracking info: ", e); } }, "UserRegistrationThread").start(); } diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/AppSettings.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/AppSettings.java index c22ec3f74..6820d707d 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/AppSettings.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/AppSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Gluon and/or its affiliates. + * Copyright (c) 2016, 2022, Gluon and/or its affiliates. * All rights reserved. Use is subject to license terms. * * This file is available and licensed under the following license: @@ -50,6 +50,8 @@ import java.net.URL; import java.util.Properties; import java.util.function.Consumer; +import java.util.logging.Level; +import java.util.logging.Logger; public class AppSettings { public static final String APP_ICON_16 = SceneBuilderApp.class.getResource("SceneBuilderLogo_16.png").toString(); @@ -81,8 +83,8 @@ private static void initSceneBuiderVersion() { sbProps.load(in); sceneBuilderVersion = sbProps.getProperty("build.version", "UNSET"); } - } catch (IOException ex) { - ex.printStackTrace(); + } catch (IOException e) { + Logger.getLogger(AppSettings.class.getName()).log(Level.WARNING, "Cannot init SB version:", e); } } @@ -125,15 +127,15 @@ public static void getLatestVersion(Consumer consumer) { try { url = new URL(LATEST_VERSION_CHECK_URL); } catch (MalformedURLException e) { - e.printStackTrace(); + Logger.getLogger(AppSettings.class.getName()).log(Level.WARNING, "Failed to construct version check URL: ", e); } try (InputStream inputStream = url.openStream()) { prop.load(inputStream); onlineVersionNumber = prop.getProperty(LATEST_VERSION_NUMBER_PROPERTY); - } catch (IOException ex) { - ex.printStackTrace(); + } catch (IOException e) { + Logger.getLogger(AppSettings.class.getName()).log(Level.WARNING, "Failed to load latest version number property: ", e); } latestVersion = onlineVersionNumber; consumer.accept(latestVersion); @@ -160,10 +162,10 @@ private static void updateLatestVersionInfo() { latestVersionText = announcementObject.getString("text"); latestVersionAnnouncementURL = announcementObject.getString("url"); } catch (IOException e) { - e.printStackTrace(); + Logger.getLogger(AppSettings.class.getName()).log(Level.WARNING, "Failed to read latest version json: ", e); } } catch (MalformedURLException e) { - e.printStackTrace(); + Logger.getLogger(AppSettings.class.getName()).log(Level.WARNING, "Failed to construct latest version info URL: ", e); } } diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/MessageBox.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/MessageBox.java index d1055ccef..012c805c8 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/MessageBox.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/util/MessageBox.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2022, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -42,6 +43,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.util.logging.Level; +import java.util.logging.Logger; /** * This class implements an simple IPC. @@ -121,9 +124,9 @@ public void release() { try { boxMutex.unlock(); - } catch(IOException x) { + } catch(IOException e) { // Strange - x.printStackTrace(); + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to unlock message box mutex: ", e); } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java index 0993623a4..e2a4e2ac2 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java @@ -42,6 +42,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; import javafx.scene.Node; @@ -208,7 +210,7 @@ public Color getColor() { } } } catch (IOException e) { - e.printStackTrace(); + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to get color from stylesheet: ", e); } } return color; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java index b01ed53f9..0def5bb29 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018 Gluon and/or its affiliates. + * Copyright (c) 2016, 2022, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -39,6 +39,8 @@ import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.beans.value.ChangeListener; import javafx.collections.ListChangeListener; @@ -1049,8 +1051,8 @@ private void traceEvent(Event e) { sb.append(", keyCode="); //NOI18N sb.append(ke.getCode()); } - - System.out.println(sb.toString()); + + Logger.getLogger(getClass().getName()).log(Level.INFO, sb.toString()); } private final EventHandler eventTracingFilter diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java index 291347a44..7e209ee4c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2022, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -69,6 +70,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + import javafx.collections.ObservableList; import javafx.event.EventHandler; import javafx.scene.Group; @@ -777,7 +781,7 @@ private void handleInlineEditing(FXOMInstance hitObject) { inlineEditController.startEditingSession(inlineEditor, inlineEditingBounds, requestCommit, requestRevert); } else { - System.out.println("Beep"); + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Inline editing bounds object is null"); } assert contentPanelController.getEditorController().isTextEditingSessionOnGoing() @@ -825,7 +829,7 @@ private void keyPressedOnGlassLayer(KeyEvent e) { if (RelocateSelectionJob.isSelectionMovable(contentPanelController.getEditorController())) { activateGesture(new MoveWithKeyGesture(contentPanelController), e); } else { - System.out.println("Selection is not movable"); + Logger.getLogger(getClass().getName()).log(Level.INFO, "Selection is not movable"); } e.consume(); break; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssPanelController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssPanelController.java index 2c58d3c92..301bb095e 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssPanelController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssPanelController.java @@ -64,6 +64,8 @@ import java.net.URL; import java.text.MessageFormat; import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.animation.FadeTransition; import javafx.beans.property.ObjectProperty; @@ -966,8 +968,8 @@ public void handle(ActionEvent event) { EditorPlatform.open(DocumentationUrls.JAVADOC_HOME.toString() + "javafx.graphics/javafx/scene/doc-files/cssref.html#" + //NOI18N item.getTarget().getClass().getSimpleName().toLowerCase(Locale.ROOT)); - } catch (IOException ex) { - System.out.println(ex.getMessage()); + } catch (IOException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to open JAVADOC_HOME: ", e); } } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssUtils.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssUtils.java index b411dc685..805216612 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssUtils.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Gluon and/or its affiliates. + * Copyright (c) 2017, 2022, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -35,6 +35,9 @@ import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; import com.oracle.javafx.scenebuilder.kit.util.CssInternal; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + import javafx.css.CssMetaData; import javafx.css.Styleable; import javafx.css.StyleableProperty; @@ -155,8 +158,8 @@ static String getBeanPropertyName(Node node, CssMetaData sp) { CssMetaData raw = (CssMetaData) sp; final StyleableProperty val = raw.getStyleableProperty(node); property = CssInternal.getBeanPropertyName(val); - } catch (RuntimeException ex) { - System.out.println("Can't retrieve property " + ex); //NOI18N + } catch (RuntimeException e) { + Logger.getLogger(CssUtils.class.getName()).log(Level.WARNING, "Failed to retrieve property: ", e); } return property; } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/PropertyEditor.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/PropertyEditor.java index 868f44e3e..c82033693 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/PropertyEditor.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/PropertyEditor.java @@ -47,6 +47,8 @@ import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.animation.FadeTransition; import javafx.beans.property.BooleanProperty; @@ -561,7 +563,7 @@ private void addCssVisual() { try { EditorPlatform.open(cssInfo.getMainUrl().toString()); } catch (IOException ex) { - System.out.println(ex.getMessage() + ex); + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to open css file:", ex); } } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/i18n/I18NControl.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/i18n/I18NControl.java index 55ca35f36..6b1a2b99a 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/i18n/I18NControl.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/i18n/I18NControl.java @@ -1,3 +1,35 @@ +/* + * Copyright (c) 2022, Gluon and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package com.oracle.javafx.scenebuilder.kit.i18n; import java.io.BufferedReader; @@ -7,6 +39,8 @@ import java.util.Locale; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; public class I18NControl extends ResourceBundle.Control { @Override @@ -17,8 +51,8 @@ public ResourceBundle newBundle(String baseName, Locale locale, String format, C InputStreamReader isr = new InputStreamReader(is, "UTF-8"); BufferedReader reader = new BufferedReader(isr)) { return new PropertyResourceBundle(reader); - } catch (IOException ex) { - ex.printStackTrace(); + } catch (IOException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to create ResourceBundle: ", e); return null; } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/LibraryItem.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/LibraryItem.java index 858d4d580..9960484dc 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/LibraryItem.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/LibraryItem.java @@ -38,6 +38,8 @@ import java.io.IOException; import java.net.URL; import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -88,8 +90,8 @@ public FXOMDocument instantiate() { try { result = new FXOMDocument(fxmlText, null, library.getClassLoader(), null, FXOMDocumentSwitch.NORMALIZED); - } catch(Error|IOException x) { - x.printStackTrace(); + } catch(Error|IOException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to instantiate a library item: ", e); result = null; } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/UserLibrary.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/UserLibrary.java index e31c08438..ff9c93176 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/UserLibrary.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/UserLibrary.java @@ -52,6 +52,8 @@ import java.util.TreeSet; import java.util.function.Consumer; import java.util.function.Supplier; +import java.util.logging.Level; +import java.util.logging.Logger; import com.oracle.javafx.scenebuilder.kit.library.BuiltinSectionComparator; import com.oracle.javafx.scenebuilder.kit.library.Library; @@ -180,8 +182,8 @@ public synchronized void stopWatching() { try { watcherThread.join(); - } catch(InterruptedException x) { - x.printStackTrace(); + } catch(InterruptedException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to join watcher thread: ", e); } finally { watcher = null; watcherThread = null; @@ -409,8 +411,8 @@ private void changeClassLoader(ClassLoader newClassLoader) { final URLClassLoader urlClassLoader = (URLClassLoader) classLoader; try { urlClassLoader.close(); - } catch(IOException x) { - x.printStackTrace(); + } catch(IOException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to close URL classloader: ", e); } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/MetadataIntrospector.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/MetadataIntrospector.java index 158fe94d6..b80f608d9 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/MetadataIntrospector.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/MetadataIntrospector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Gluon and/or its affiliates. + * Copyright (c) 2016, 2022, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -69,6 +69,8 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.fxml.FXMLLoader; import javafx.scene.paint.Color; @@ -296,7 +298,7 @@ private PropertyMetadata makePropertyMetadata(PropertyName name, } } } catch (NoSuchMethodException e) { - e.printStackTrace(); + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to find method: " + methodName, e); } } else { result = null; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/ReflectionUtils.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/ReflectionUtils.java index bd8610f43..8927ac98c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/ReflectionUtils.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/ReflectionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Gluon and/or its affiliates. + * Copyright (c) 2017, 2022, Gluon and/or its affiliates. * All rights reserved. Use is subject to license terms. * * This file is available and licensed under the following license: @@ -35,6 +35,9 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + import javafx.fxml.FXMLLoader; /** @@ -55,7 +58,7 @@ public static void setStaticLoad(FXMLLoader loader, boolean staticLoad) { method.setAccessible(true); return method; } catch (NoSuchMethodException e) { - e.printStackTrace(); + Logger.getLogger(ReflectionUtils.class.getName()).log(Level.WARNING, "Failed to find method setStaticLoad: ", e); } return null; }); @@ -63,7 +66,7 @@ public static void setStaticLoad(FXMLLoader loader, boolean staticLoad) { try { setStaticLoadMethod.invoke(loader, staticLoad); } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + Logger.getLogger(ReflectionUtils.class.getName()).log(Level.WARNING, "Failed to invoke method setStaticLoad: ", e); } } }