Revision 41126

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.lib/src/main/java/org/gvsig/fmap/dal/resource/db/AbstractDBResourceNoBlocker.java
159 159
		if (!equals(myParams.getUser(), params.getUser())) {
160 160
			return false;
161 161
		}
162

  
162
        if (!equals(myParams.getPassword(), params.getPassword())) {
163
            return false;
164
        }
163 165
		return true;
164 166
	}
165 167

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/vectorialdb/wizard/WizardDB.java
460 460
		}
461 461
		DataManager dm = DALLocator.getDataManager();
462 462
		String err_msg = Messages.getText("connection_error");
463
		DBServerExplorer dbExplorer;
463
		DBServerExplorer dbExplorer = null;
464 464
		try {
465 465
			dbExplorer = (DBServerExplorer) dm.openServerExplorer(dbSeverExplorerParameters2.getExplorerName(), dbSeverExplorerParameters2);
466 466

  
......
480 480
			getTablesList().setModel(lmodel);
481 481
			getTablesScrollPane().setViewportView(tablesList);
482 482
			tablesScrollPane.updateUI();
483
		} catch (InitializeException e) {
484
			logger.info("Error while getting table names: " + e.getMessage(), e);
485
			ApplicationLocator.getManager().messageDialog(
486
			    err_msg + ": " + e.getMessage(),
483
		} catch (Exception e) {
484
			logger.info("Error while getting table names: " + e.getMessage());
485
			
486
			String remove_question = Messages.getText(
487
			    "_Remove_connection_parameters_from_list_question");
488
 	 		
489
			int opt = JOptionPane.showConfirmDialog(
490
			    ApplicationLocator.getManager().getRootComponent(),
491
			    err_msg + ": " + getLastMessage(e) + "\n" + remove_question,
487 492
			    err_msg,
488
			    JOptionPane.ERROR_MESSAGE);
489
			return;
490
		} catch (DataException e) {
491
			logger.info("Error while getting table names: " + e.getMessage(), e);
492
            ApplicationLocator.getManager().messageDialog(
493
                err_msg + ": " + e.getMessage(),
494
                err_msg,
495
                JOptionPane.ERROR_MESSAGE);
496
			return;
497
		} catch (Exception e) {
498
			logger.info("Error while getting table names: " + e.getMessage(), e);
499
            ApplicationLocator.getManager().messageDialog(
500
                err_msg + ": " + e.getMessage(),
501
                err_msg,
502
                JOptionPane.ERROR_MESSAGE);
503
			return;
493
			    JOptionPane.YES_NO_OPTION);
494
			
495
			if (opt == JOptionPane.YES_OPTION) {
496
			    removeDBPArameters(dbSeverExplorerParameters2);
497
			    // dbExplorer.
498
			    loadVectorialDBDatasourcesCombo(null);
499
			}
504 500
		}
505 501
	}
506 502

  
507
	public void valueChanged(ListSelectionEvent arg0) {
503
	/**
504
	 * Removes DB parameters from list of pre-configured DB parameters
505
	 * @param dbSeverExplorerParameters2
506
	 */
507
	private void removeDBPArameters(
508
	    DBServerExplorerParameters dbparams) {
509
	    
510
        PluginsManager manager = PluginsLocator.getManager();
511
        DynObject values = manager.getPlugin(ExtDB_Spatial.class).getPluginProperties();
512
        Map connections = (Map) values.getDynValue("db_connections");
513
        if (connections == null) {
514
            return;
515
        }
516
        
517
        DBServerExplorerParameters item = null;
518
        Iterator it = connections.entrySet().iterator();
519
        List<String> toremove = new ArrayList();
520
        
521
        while (it.hasNext()) {
522
            Map.Entry entry = (Entry) it.next();
523
            item = (DBServerExplorerParameters) entry.getValue();
524
            if (dbparams.equals(item)) {
525
                toremove.add((String) entry.getKey());
526
            }
527
        }
528
        
529
        if (toremove.size() == 0) {
530
            return;
531
        }
532
        
533
        for (int i=0; i<toremove.size(); i++) {
534
            connections.remove(toremove.get(i));
535
        }
536
        values.setDynValue("db_connections", connections);
537
        
538
    }
539

  
540

  
541
    public void valueChanged(ListSelectionEvent arg0) {
508 542
		Object src = arg0.getSource();
509 543

  
510 544
		if (src == tablesList) {
......
687 721
	public void close() {
688 722
		// Nothing to do
689 723
	}
724
	
690 725

  
726
	protected String getLastMessage(Throwable ex) {
727
        
728
        Throwable p = ex;
729
        while (p.getCause() != null && p.getCause() != p) {
730
            p = p.getCause();
731
        }
732
        return p.getMessage();
733
    }	
734

  
691 735
} // @jve:decl-index=0:visual-constraint="10,10"
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
34 34
_Table_NAME_does_not_have_declared_PK=The table {0} does not have a declared primary key in the DB
35 35
_If_layer_edited_saving_edits_will_not_be_possible=If layer is edited, saving edits will not be possible
36 36
_Strange_behavior_if_selected_ID_not_unique_values=The layer will have strange behavior if field selected as ID does not have unique values
37
_Remove_connection_parameters_from_list_question=Do you wish to remove the offending parameters from the list?
37 38

  
38 39

  
39 40

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text.properties
34 34
_Table_NAME_does_not_have_declared_PK=La tabla {0} no tiene clave primaria declarada en la BD
35 35
_If_layer_edited_saving_edits_will_not_be_possible=Si edita la capa, no ser? posible salvar los cambios en la misma tabla
36 36
_Strange_behavior_if_selected_ID_not_unique_values=La capa tendr? comportamiento extra?o si el campo elegido como ID no tiene valores ?nicos
37
_Remove_connection_parameters_from_list_question=?Desea eliminar de la lista los par?metros que han causado el problema?
37 38

  
38 39

  
39 40

  

Also available in: Unified diff