svn commit: r16603 - trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-01-14 12:49:03-0800
New Revision: 16603

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java

Log:
Fix for issue 5619: "Generate code for Project" throws NPE

Modified: trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java?view=diff&pathrev=16603&r1=16602&r2=16603
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/generator/ui/ClassGenerationDialog.java	2009-01-14 12:49:03-0800
@@ -290,12 +290,10 @@
 
         // Generate Button --------------------------------------
         if (e.getSource() == getOkButton()) {
-            String path =
-                ((String) outputDirectoryComboBox.getModel()
-                        .getSelectedItem()).trim();
+            String path = null;
             // TODO: Get default output directory from user settings
-//            Project p = ProjectManager.getManager().getCurrentProject();
-//            p.getProjectSettings().setGenerationOutputDir(path);
+            // Project p = ProjectManager.getManager().getCurrentProject();
+            // p.getProjectSettings().setGenerationOutputDir(path);
             List<String>[] fileNames = new List[languages.size()];
             for (int i = 0; i < languages.size(); i++) {
                 fileNames[i] = new ArrayList<String>();
@@ -305,11 +303,20 @@
                 Set nodes = classTableModel.getChecked(language);
 
                 if (!isPathInModel) {
-                    Collection<String> files =
-                            generator.generateFiles(nodes, path, false);
-                    for (String filename : files) {
-                        fileNames[i].add(path + CodeGenerator.FILE_SEPARATOR
-                                + filename);
+                    path =
+                        ((String) outputDirectoryComboBox.getModel()
+                                .getSelectedItem());
+                    if (path != null) {
+                        path = path.trim();
+                        if (path.length() > 0) {
+                            Collection<String> files =
+                                generator.generateFiles(nodes, path, false);
+                            for (String filename : files) {
+                                fileNames[i].add(
+                                    path + CodeGenerator.FILE_SEPARATOR
+                                        + filename);
+                            }
+                        }
                     }
                 } else {
                     // classify nodes by base path

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1024854

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.