You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2013/04/29 17:41:23 UTC

svn commit: r1477157 - /uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java

Author: schor
Date: Mon Apr 29 15:41:18 2013
New Revision: 1477157

URL: http://svn.apache.org/r1477157
Log:
[UIMA-2481] NPE when chosing new Collection Reader descriptor

Modified:
    uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java

Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java?rev=1477157&r1=1477156&r2=1477157&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java Mon Apr 29 15:41:18 2013
@@ -1501,15 +1501,19 @@ public class CpmPanel extends JPanel imp
     try {
       if (source == collectionReaderPanel) {
         if (fileString != null && fileString.length() > 0) {
+          // [UIMA-2841]
+          currentCpeDesc.setAllCollectionCollectionReaders(null);
+          currentCpeDesc.addCollectionReader(fileString);
           CpeCollectionReader[] readers = currentCpeDesc.getAllCollectionCollectionReaders();
-          if (readers.length == 0) {
-            currentCpeDesc.addCollectionReader(fileString);
-            readers = currentCpeDesc.getAllCollectionCollectionReaders();
-          } else {
-            readers[0].getCollectionIterator().getDescriptor().getInclude().set(fileString);
-            // clear config settings
-            readers[0].getCollectionIterator().setConfigurationParameterSettings(null);
-          }
+          
+//          CpeCollectionReader[] readers = currentCpeDesc.getAllCollectionCollectionReaders();
+//          if (readers.length == 0) {
+//            currentCpeDesc.addCollectionReader(fileString);
+//            readers = currentCpeDesc.getAllCollectionCollectionReaders();
+//          } else {
+//            readers[0].getCollectionIterator().getDescriptor().getInclude().set(fileString);
+//            readers[0].getCollectionIterator().setConfigurationParameterSettings(null);
+//          }
 
           rv = populateCollectionReaderPanel(readers[0].getCollectionIterator());
         } else {
@@ -1519,15 +1523,20 @@ public class CpmPanel extends JPanel imp
         selectedComponentsChanged = true;
       } else if (source == casInitializerPanel) {
         if (fileString != null && fileString.length() > 0) {
+          // [UIMA-2841]
+          currentCpeDesc.setAllCollectionCollectionReaders(null);
+          currentCpeDesc.addCasInitializer(fileString);
           CpeCollectionReader[] readers = currentCpeDesc.getAllCollectionCollectionReaders();
-          if (readers.length == 0 || readers[0].getCasInitializer() == null) {
-            currentCpeDesc.addCasInitializer(fileString);
-            readers = currentCpeDesc.getAllCollectionCollectionReaders();
-          } else {
-            readers[0].getCasInitializer().getDescriptor().getInclude().set(fileString);
-            // clear config settings
-            readers[0].getCasInitializer().setConfigurationParameterSettings(null);
-          }
+          
+//          CpeCollectionReader[] readers = currentCpeDesc.getAllCollectionCollectionReaders();
+//          if (readers.length == 0 || readers[0].getCasInitializer() == null) {
+//            currentCpeDesc.addCasInitializer(fileString);
+//            readers = currentCpeDesc.getAllCollectionCollectionReaders();
+//          } else {
+//            readers[0].getCasInitializer().getDescriptor().getInclude().set(fileString);
+//            // clear config settings
+//            readers[0].getCasInitializer().setConfigurationParameterSettings(null);
+//          }
           rv = populateCasInitializerPanel(readers[0].getCasInitializer());
         } else {
           // no CAS initializer selected - OK