[GeoNetwork-devel] [GeoNetwork opensource Developer website] #841: Data dir changes cause error on Windows

#841: Data dir changes cause error on Windows
---------------------+------------------------------------------------------
Reporter: heikki | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.7.0
Component: General | Version:
Keywords: |
---------------------+------------------------------------------------------
Since the change with datadir, on Windows you get lots of errors in the
console about files not found - the application directory path is
duplicated (see below).

Possibly this is because the generated schemaplugin-uri.xml contains a
file separator too many:

C:\_______qx\web\geonetwork/WEB-
INF/data/\config\schema_plugins/iso19139.geobru/present/metadata-iso19139
.geobru-edit.xsl

{{{
<error id="error">
   <message>C:\_______qx\web\geonetwork\C:\_______qx\web\geonetwork\WEB-
INF\data\config\schema_plugins\iso19139.geobru\loc\eng\labels.xml (The
filename, directory name, or
  volume label syntax is incorrect)</message>
   <class>FileNotFoundException</class>
   <stack>
     <at class="java.io.FileInputStream" file="???" line="-2" method="open"
/>
     <at class="java.io.FileInputStream" file="???" line="-1"
method="&lt;init&gt;" />
     <at class="java.io.FileInputStream" file="???" line="-1"
method="&lt;init&gt;" />
     <at class="sun.net.www.protocol.file.FileURLConnection" file="???"
line="-1" method="connect" />
     <at class="sun.net.www.protocol.file.FileURLConnection" file="???"
line="-1" method="getInputStream" />
     <at class="org.apache.xerces.impl.XMLEntityManager" file="???"
line="-1" method="setupCurrentEntity" />
     <at class="org.apache.xerces.impl.XMLVersionDetector" file="???"
line="-1" method="determineDocVersion" />
     <at class="org.apache.xerces.parsers.XML11Configuration" file="???"
line="-1" method="parse" />
     <at class="org.apache.xerces.parsers.XML11Configuration" file="???"
line="-1" method="parse" />
     <at class="org.apache.xerces.parsers.XMLParser" file="???" line="-1"
method="parse" />
     <skip>...</skip>
     <at class="jeeves.utils.Xml" file="Xml.java" line="219"
method="loadFile" />
     <at class="jeeves.utils.XmlFileCacher" file="XmlFileCacher.java"
line="122" method="load" />
     <at class="jeeves.utils.XmlFileCacher" file="XmlFileCacher.java"
line="84" method="get" />
     <at class="jeeves.server.dispatchers.guiservices.XmlFile"
file="XmlFile.java" line="109" method="exec" />
     <at class="org.fao.geonet.services.schema.Info" file="Info.java"
line="171" method="getHelp" />
     <at class="org.fao.geonet.services.schema.Info" file="Info.java"
line="156" method="handleObject" />
     <at class="org.fao.geonet.services.schema.Info" file="Info.java"
line="124" method="handleElement" />
     <at class="org.fao.geonet.services.schema.Info" file="Info.java"
line="105" method="exec" />
     <at class="jeeves.server.dispatchers.ServiceInfo"
file="ServiceInfo.java" line="230" method="execService" />
     <at class="jeeves.server.dispatchers.ServiceInfo"
file="ServiceInfo.java" line="139" method="execServices" />
     <at class="jeeves.server.dispatchers.ServiceManager"
file="ServiceManager.java" line="411" method="dispatch" />
     <at class="jeeves.server.JeevesEngine" file="JeevesEngine.java"
line="723" method="dispatch" />
     <at class="jeeves.server.sources.http.JeevesServlet"
file="JeevesServlet.java" line="196" method="execute" />
     <at class="jeeves.server.sources.http.JeevesServlet"
file="JeevesServlet.java" line="110" method="doPost" />
     <skip>...</skip>
   </stack>
   <request>
     <language>fre</language>
     <service>xml.schema.info</service>
   </request>
</error>
}}}

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/841&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#841: Data dir changes cause error on Windows
----------------------+-----------------------------------------------------
  Reporter: heikki | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: major | Milestone: v2.7.0
Component: General | Version:
Resolution: fixed | Keywords:
----------------------+-----------------------------------------------------
Changes (by josegar74):

  * status: new => closed
  * resolution: => fixed

Comment:

Error is related to data dir changes, as now using full paths in some
places.

The following code in !XmlFile class (jeeves) caused the issue. This code
seem assumes full paths start with / , not very generic.

{{{
String rootPath = base.startsWith("/") ? base : appPath + base;
}}}

Changed to:

{{{
String rootPath = base.startsWith(appPath) ? base : appPath + base;
}}}

seem working fine.

Committed in revision 8924

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/841#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.