Project

General

Profile

Revision 793ded33

ID793ded331636951452e3ee797a5df1236ebfe191
Parent cf115b19
Child 0aebb4bc

Added by Patrick Plitzner over 1 year ago

ref #8385 Fix potential NPE

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportPreference.java
76 76

  
77 77
        if (preference != null){
78 78

  
79
         String configString = preference.getValue();
80
         String[] configArray = configString.split(";"); //$NON-NLS-1$
81

  
82
         for (String configItem: configArray){
83
             String[] keyValue = configItem.split(":"); //$NON-NLS-1$
84
             if(keyValue.length==2){
85
                 String keyString = keyValue[0];
86
                 String valueString = keyValue[1];
87
                 if (keyString.equals("ignoreImportOfExistingSpecimen")){ //$NON-NLS-1$
88
                     configurator.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
89
                 }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){ //$NON-NLS-1$
90
                     configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
91
                 }else if (keyString.equals("reuseExistingTaxaWhenPossible")){ //$NON-NLS-1$
92
                     configurator.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
93
                 }else if (keyString.equals("ignoreAuthorship")){ //$NON-NLS-1$
94
                     configurator.setIgnoreAuthorship(Boolean.valueOf(valueString));
95
                 }else if (keyString.equals("addMediaAsMediaSpecimen")){ //$NON-NLS-1$
96
                     configurator.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
97
                 }else if (keyString.equals("reuseExistingMetaData")){ //$NON-NLS-1$
98
                     configurator.setReuseExistingMetaData(Boolean.valueOf(valueString));
99
                 }else if (keyString.equals("reuseExistingDescriptiveGroups")){ //$NON-NLS-1$
100
                     configurator.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
101
                 }else if (keyString.equals("allowReuseOtherClassifications")){ //$NON-NLS-1$
102
                     configurator.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
103
                 }else if (keyString.equals("deduplicateReferences")){ //$NON-NLS-1$
104
                     configurator.setDeduplicateReferences(Boolean.valueOf(valueString));
105
                 }else if (keyString.equals("deduplicateClassifications")){ //$NON-NLS-1$
106
                     configurator.setDeduplicateClassifications(Boolean.valueOf(valueString));
107
                 }else if (keyString.equals("moveNewTaxaToDefaultClassification")){ //$NON-NLS-1$
108
                     configurator.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
109
                 }else if (keyString.equals("mapUnitIdToCatalogNumber")){ //$NON-NLS-1$
110
                     configurator.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
111
                 }else if (keyString.equals("mapUnitIdToAccessionNumber")){ //$NON-NLS-1$
112
                     configurator.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
113
                 }else if (keyString.equals("mapUnitIdToBarcode")){ //$NON-NLS-1$
114
                     configurator.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
115
                 }else if (keyString.equals("overwriteExistingSpecimens")){ //$NON-NLS-1$
116
                     configurator.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
117
                 }else if (keyString.equals("nomenclaturalCode")){ //$NON-NLS-1$
118
                     configurator.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
119
                 }else if (keyString.equals("getSiblings")){ //$NON-NLS-1$
120
                     configurator.setGetSiblings(Boolean.valueOf(valueString));
121
                 }else if (keyString.equals("removeCountryFromLocalityText")){ //$NON-NLS-1$
122
                     configurator.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
123
                 }else if (keyString.equals("dnaSource")){ //$NON-NLS-1$
124
                     configurator.setDnaSoure(URI.create(valueString));
125
                 }
126

  
127
             }
128

  
129
         }
79
            String configString = preference.getValue();
80
            if(configString!=null){
81
                String[] configArray = configString.split(";"); //$NON-NLS-1$
82

  
83
                for (String configItem: configArray){
84
                    String[] keyValue = configItem.split(":"); //$NON-NLS-1$
85
                    if(keyValue.length==2){
86
                        String keyString = keyValue[0];
87
                        String valueString = keyValue[1];
88
                        if (keyString.equals("ignoreImportOfExistingSpecimen")){ //$NON-NLS-1$
89
                            configurator.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
90
                        }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){ //$NON-NLS-1$
91
                            configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
92
                        }else if (keyString.equals("reuseExistingTaxaWhenPossible")){ //$NON-NLS-1$
93
                            configurator.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
94
                        }else if (keyString.equals("ignoreAuthorship")){ //$NON-NLS-1$
95
                            configurator.setIgnoreAuthorship(Boolean.valueOf(valueString));
96
                        }else if (keyString.equals("addMediaAsMediaSpecimen")){ //$NON-NLS-1$
97
                            configurator.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
98
                        }else if (keyString.equals("reuseExistingMetaData")){ //$NON-NLS-1$
99
                            configurator.setReuseExistingMetaData(Boolean.valueOf(valueString));
100
                        }else if (keyString.equals("reuseExistingDescriptiveGroups")){ //$NON-NLS-1$
101
                            configurator.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
102
                        }else if (keyString.equals("allowReuseOtherClassifications")){ //$NON-NLS-1$
103
                            configurator.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
104
                        }else if (keyString.equals("deduplicateReferences")){ //$NON-NLS-1$
105
                            configurator.setDeduplicateReferences(Boolean.valueOf(valueString));
106
                        }else if (keyString.equals("deduplicateClassifications")){ //$NON-NLS-1$
107
                            configurator.setDeduplicateClassifications(Boolean.valueOf(valueString));
108
                        }else if (keyString.equals("moveNewTaxaToDefaultClassification")){ //$NON-NLS-1$
109
                            configurator.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
110
                        }else if (keyString.equals("mapUnitIdToCatalogNumber")){ //$NON-NLS-1$
111
                            configurator.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
112
                        }else if (keyString.equals("mapUnitIdToAccessionNumber")){ //$NON-NLS-1$
113
                            configurator.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
114
                        }else if (keyString.equals("mapUnitIdToBarcode")){ //$NON-NLS-1$
115
                            configurator.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
116
                        }else if (keyString.equals("overwriteExistingSpecimens")){ //$NON-NLS-1$
117
                            configurator.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
118
                        }else if (keyString.equals("nomenclaturalCode")){ //$NON-NLS-1$
119
                            configurator.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
120
                        }else if (keyString.equals("getSiblings")){ //$NON-NLS-1$
121
                            configurator.setGetSiblings(Boolean.valueOf(valueString));
122
                        }else if (keyString.equals("removeCountryFromLocalityText")){ //$NON-NLS-1$
123
                            configurator.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
124
                        }else if (keyString.equals("dnaSource")){ //$NON-NLS-1$
125
                            configurator.setDnaSoure(URI.create(valueString));
126
                        }
127

  
128
                    }
129
                }
130
            }
130 131
        }
131 132

  
132 133

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
1444 1444
            return config;
1445 1445
         } else{
1446 1446
             String configString = preference.getValue();
1447
             String[] configArray = configString.split(";");
1448

  
1449
             for (String configItem: configArray){
1450
                 String[] keyValue = configItem.split(":");
1451
                 String keyString = keyValue[0];
1452
                 String valueString = null;
1453
                 if (keyValue.length>1){
1454
                      valueString = keyValue[1];
1455
                 }
1456
                 if (keyString.equals("ignoreImportOfExistingSpecimen")){
1457
                     config.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
1458
                 }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){
1459
                     config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
1460
                 }else if (keyString.equals("reuseExistingTaxaWhenPossible")){
1461
                     config.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
1462
                 }else if (keyString.equals("ignoreAuthorship")){
1463
                     config.setIgnoreAuthorship(Boolean.valueOf(valueString));
1464
                 }else if (keyString.equals("addMediaAsMediaSpecimen")){
1465
                     config.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
1466
                 }else if (keyString.equals("reuseExistingMetaData")){
1467
                     config.setReuseExistingMetaData(Boolean.valueOf(valueString));
1468
                 }else if (keyString.equals("reuseExistingDescriptiveGroups")){
1469
                     config.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
1470
                 }else if (keyString.equals("allowReuseOtherClassifications")){
1471
                     config.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
1472
                 }else if (keyString.equals("deduplicateReferences")){
1473
                     config.setDeduplicateReferences(Boolean.valueOf(valueString));
1474
                 }else if (keyString.equals("deduplicateClassifications")){
1475
                     config.setDeduplicateClassifications(Boolean.valueOf(valueString));
1476
                 }else if (keyString.equals("moveNewTaxaToDefaultClassification")){
1477
                     config.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
1478
                 }else if (keyString.equals("mapUnitIdToCatalogNumber")){
1479
                     config.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
1480
                 }else if (keyString.equals("mapUnitIdToAccessionNumber")){
1481
                     config.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
1482
                 }else if (keyString.equals("mapUnitIdToBarcode")){
1483
                     config.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
1484
                 }else if (keyString.equals("overwriteExistingSpecimens")){
1485
                     config.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
1486
                 }else if (keyString.equals("nomenclaturalCode")){
1447
             if(configString!=null){
1448
                 String[] configArray = configString.split(";");
1449

  
1450
                 for (String configItem: configArray){
1451
                     String[] keyValue = configItem.split(":");
1452
                     String keyString = keyValue[0];
1453
                     String valueString = null;
1454
                     if (keyValue.length>1){
1455
                         valueString = keyValue[1];
1456
                     }
1457
                     if (keyString.equals("ignoreImportOfExistingSpecimen")){
1458
                         config.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
1459
                     }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){
1460
                         config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
1461
                     }else if (keyString.equals("reuseExistingTaxaWhenPossible")){
1462
                         config.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
1463
                     }else if (keyString.equals("ignoreAuthorship")){
1464
                         config.setIgnoreAuthorship(Boolean.valueOf(valueString));
1465
                     }else if (keyString.equals("addMediaAsMediaSpecimen")){
1466
                         config.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
1467
                     }else if (keyString.equals("reuseExistingMetaData")){
1468
                         config.setReuseExistingMetaData(Boolean.valueOf(valueString));
1469
                     }else if (keyString.equals("reuseExistingDescriptiveGroups")){
1470
                         config.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
1471
                     }else if (keyString.equals("allowReuseOtherClassifications")){
1472
                         config.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
1473
                     }else if (keyString.equals("deduplicateReferences")){
1474
                         config.setDeduplicateReferences(Boolean.valueOf(valueString));
1475
                     }else if (keyString.equals("deduplicateClassifications")){
1476
                         config.setDeduplicateClassifications(Boolean.valueOf(valueString));
1477
                     }else if (keyString.equals("moveNewTaxaToDefaultClassification")){
1478
                         config.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
1479
                     }else if (keyString.equals("mapUnitIdToCatalogNumber")){
1480
                         config.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
1481
                     }else if (keyString.equals("mapUnitIdToAccessionNumber")){
1482
                         config.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
1483
                     }else if (keyString.equals("mapUnitIdToBarcode")){
1484
                         config.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
1485
                     }else if (keyString.equals("overwriteExistingSpecimens")){
1486
                         config.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
1487
                     }else if (keyString.equals("nomenclaturalCode")){
1487 1488
                         config.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
1488
                 }else{
1489
                     logger.debug("This key of the abcd configurator needs to be added to the transformer: " + keyString);
1489
                     }else{
1490
                         logger.debug("This key of the abcd configurator needs to be added to the transformer: " + keyString);
1491
                     }
1490 1492
                 }
1491

  
1492 1493
             }
1493
        }
1494
         }
1494 1495
        return config;
1495 1496
    }
1496 1497

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)