gvSIG bugs #583

Persistence of dbf tables in project

Added by Antonio Falciano about 12 years ago. Updated about 10 years ago.

Status:Won't fix% Done:

0%

Priority:High
Assignee:Francisco José Peñarrubia
Category:-
Target version:-
Severity: Add-on name:Unknown
gvSIG version:1.12.0 Add-on version:
gvSIG build:1406 Add-on build:
Operative System: Add-on resolve version:
Keywords:dbf, table Add-on resolve build:
Has patch:No

Description

Steps in order to reproduce the bug:
  • Execute gvSIG
  • New table from dbf file
  • Create and open a view
  • Add event theme
  • Save the project
  • Re-open the project

Results: re-opening the project, gvSIG is not able to access to the dbf file(s) and so deletes it(them) from the project.

libFMap_FLayers_AddEventTheme_reading.patch Magnifier (2.37 KB) Francisco José Peñarrubia, 05/31/2012 05:59 PM

History

#1 Updated by Francisco José Peñarrubia almost 12 years ago

  • Assignee set to Francisco José Peñarrubia

#2 Updated by Francisco José Peñarrubia almost 12 years ago

Hi Antonio.

This error was also in 1.11 release or only in 1.12 version?

Thanks.

#3 Updated by Antonio Falciano almost 12 years ago

Hi Francisco,
this issue did also occur in the 1.11 release. Don't mention it.
Cheers,
Antonio

#4 Updated by Francisco José Peñarrubia almost 12 years ago

  • Status changed from New to Won't fix

Hi Antonio.

This error is hard to solve, and it would be necessary to touch some classes in core gvSIG, and maybe affect the stability of the 1.12 release that is about to come.
Right now, I think the only option is to let this bug as a "known bug".

Sorry, and my apologies :-(

Fran

#5 Updated by Francisco José Peñarrubia almost 12 years ago

Just in case someone want to do something with this bug in the future:

The problem is related to the name of class AddEventThemeDriver in extAddEventTheme. This driver is not registered y driverManager, and is stored in the project as "other".
Then, in FLayers.java, inside method addLayerFromXML, we found this code:

                    // Clases con algun driver genérico creado por otro
                    // programador
                    if (xml.contains("other")) {
                        int classChild = 2;
                        if(xml.contains("isLabeled") && xml.getBooleanProperty("isLabeled")){
                            classChild++;
                        }

                        String driverName = xml.getStringProperty("other");
                        VectorialDriver driver = null;
                        try {
                            driver = (VectorialDriver) LayerFactory.getDM().getDriver(driverName);
                        } catch (DriverLoadException e) {
                            // Si no existe ese driver, no pasa nada.
                            // Puede que el desarrollador no quiera que
                            // aparezca en el cuadro de diálogo y ha metido
                            // el jar con sus clases en nuestro directorio lib.
                            // Intentamos cargar esa clase "a pelo".
                            if (xml.getChild(classChild).contains("className"))
                            {
                                String className2 = xml.getChild(classChild).getStringProperty("className");
                                try {
                                    driver = (VectorialDriver) Class.forName(className2).newInstance();
                                } catch (Exception e1) {
                                    throw new DriverLayerException(name,e);
                                }
                            }
                        } catch (NullPointerException npe) {
                            // Si no existe ese driver, no pasa nada.
                            // Puede que el desarrollador no quiera que
                            // aparezca en el cuadro de diálogo y ha metido
                            // el jar con sus clases en nuestro directorio lib.
                            // Intentamos cargar esa clase "a pelo".
                            if (xml.getChild(2).contains("className"))
                            {
                                String className2 = xml.getChild(classChild).getStringProperty("className");
                                try {
                                    driver = (VectorialDriver) Class.forName(className2).newInstance();
                                } catch (Exception e1) {
                                    throw new DriverLayerException(name,e1);
                                }
                            }
                        }
                        if (driver instanceof IPersistence)
                        {
                            IPersistence persist = (IPersistence) driver;
                            persist.setXMLEntity(xml.getChild(classChild));
                        }
                        layer = LayerFactory.createLayer(name, driver, proj);
                    }

One possible solution would be to add a method to driverManager to register manually one driver, or do something with the code that captures the exception.
For example, it maybe useful if a driver is not found in the usual drivers lists, search in other drivers list.

The problem is with the generated XML. First tag (selectionSupport should appear AFTER tag of AddEventThemDriver:


<xml-tag>
        <property key="className" value="com.iver.cit.gvsig.fmap.layers.SelectionSupport"/>
        <property key="numBitSet" value="0"/>
    </xml-tag>
    <xml-tag>
        <property key="className" value="com.iver.gvsig.addeventtheme.AddEventThemeDriver"/>
        <property key="xFieldIndex" value="0"/>
        <property key="yFieldIndex" value="0"/>
        <property key="tableName" value="0_test_label.dbf"/>
        <property key="hasDSInfo" value="true"/>
        <xml-tag>
            <property key="type" value="otherDriverFile"/>
            <property key="gdbmsname" value="0_test_label.dbf"/>
            <property key="file" value="C:\Users\Fjp\Documents\0_test_label.dbf"/>
            <property key="driverName" value="gdbms dbf driver"/>
        </xml-tag>
    </xml-tag>

Hope it helps.

Fran.

#6 Updated by Francisco José Peñarrubia almost 12 years ago

This is a patch that works (but is a very dirty patch, I will not put this in the repository). It's just in case of someone needs this functionality.

#7 Updated by Álvaro Anguix about 10 years ago

  • Project changed from Application: gvSIG desktop to | gvSIG desktop 1

Also available in: Atom PDF