You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2020/01/27 12:41:07 UTC

[cayenne] branch master updated (e4809a0 -> de139ab)

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


    from e4809a0  fix NullPointerException and minor cleanup
     new 5a81bc8  minor code cleanup
     new de139ab  fix NullPointerException

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/cayenne/modeler/Application.java    | 17 ++++-------------
 .../modeler/editor/cgen/GeneratorControllerPanel.java   |  9 ++++++---
 2 files changed, 10 insertions(+), 16 deletions(-)


[cayenne] 01/02: minor code cleanup

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 5a81bc8a43938c67fa8f0e3a075425f133f981dc
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Jan 27 15:25:00 2020 +0300

    minor code cleanup
---
 .../java/org/apache/cayenne/modeler/Application.java    | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
index 119def6..b029254 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
@@ -231,7 +231,6 @@ public class Application {
     /**
      * Reinitializes ModelerClassLoader from preferences.
      */
-    @SuppressWarnings("unchecked")
     public void initClassLoader() {
         final FileClassLoadingService classLoader = new FileClassLoadingService();
 
@@ -240,9 +239,8 @@ public class Application {
                 ClasspathPreferences.class,
                 "");
 
-        Collection<String> details = new ArrayList<>();
         String[] keys;
-        ArrayList<String> values = new ArrayList<>();
+        Collection<String> values = new ArrayList<>();
 
         try {
             keys = classLoaderPreference.keys();
@@ -252,10 +250,8 @@ public class Application {
         } catch (BackingStoreException ignored) {
         }
 
-        details.addAll(values);
-
-        if (details.size() > 0) {
-            classLoader.setPathFiles(details.stream().map(File::new).collect(Collectors.toList()));
+        if (values.size() > 0) {
+            classLoader.setPathFiles(values.stream().map(File::new).collect(Collectors.toList()));
         }
 
         this.modelerClassLoader = classLoader;
@@ -264,12 +260,7 @@ public class Application {
         if (SwingUtilities.isEventDispatchThread()) {
             Thread.currentThread().setContextClassLoader(classLoader.getClassLoader());
         } else {
-            SwingUtilities.invokeLater(new Runnable() {
-
-                public void run() {
-                    Thread.currentThread().setContextClassLoader(classLoader.getClassLoader());
-                }
-            });
+            SwingUtilities.invokeLater(() -> Thread.currentThread().setContextClassLoader(classLoader.getClassLoader()));
         }
     }
 


[cayenne] 02/02: fix NullPointerException

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit de139ab11126d77ca933bb08b92c4fba84c92570
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Jan 27 15:40:47 2020 +0300

    fix NullPointerException
---
 .../cayenne/modeler/editor/cgen/GeneratorControllerPanel.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
index 8941860..140bbf6 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
@@ -44,9 +44,12 @@ public class GeneratorControllerPanel extends JPanel {
         this.outputFolder = new TextAdapter(new JTextField()) {
             @Override
             protected void updateModel(String text) throws ValidationException {
-                getCgenByDataMap().setRelPath(text);
-                if(!codeGeneratorControllerBase.isInitFromModel()) {
-                    projectController.setDirty(true);
+                CgenConfiguration cgenByDataMap = getCgenByDataMap();
+                if(cgenByDataMap != null) {
+                    cgenByDataMap.setRelPath(text);
+                    if (!codeGeneratorControllerBase.isInitFromModel()) {
+                        projectController.setDirty(true);
+                    }
                 }
             }
         };