Hi all,


I'm using geoserver 1.7.7
I'm trying to add a coverage as it is described in the example: 
http://docs.geoserver.org/1.7.x/en/user/extensions/rest/coverage_xml.html#coverage-xml


I ran into two problems, first, just using the example, simply does not work, 
therefore I had to change CoverageDimension.java as shown below
Then, when I got this work, I could not restart the geoserver anymore because I 
got exceptions when loading the layer just added, therefore I had to change 
LegacyCoverageInfoReader.java as shown below

I also tried to add a similar layer by hand and then make REST GET calls and 
resend the xml, but the same problems  arose ...

Can someone verify my code changes, or tell me what I'm doing wrong ....




Index: 
src/main/src/main/java/org/geoserver/catalog/util/LegacyCoverageInfoReader.java
===================================================================
--- 
src/main/src/main/java/org/geoserver/catalog/util/LegacyCoverageInfoReader.java 
    (revision 13516)
+++ 
src/main/src/main/java/org/geoserver/catalog/util/LegacyCoverageInfoReader.java 
    (working copy)
@@ -140,7 +140,11 @@
     public Map<String,Object> grid() throws Exception {
         Element gridElement = ReaderUtils.getChildElement(coverage, "grid");
         HashMap<String,Object> grid = new HashMap<String, Object>();
-        
+
+        if ( gridElement == null ) {
+            return null;
+        }
+
         grid.put( "dimension", 
             Integer.parseInt( ReaderUtils.getAttribute(gridElement, 
"dimension", true ) ) );
         



Index: src/main/src/main/java/org/vfny/geoserver/global/CoverageDimension.java
===================================================================
--- src/main/src/main/java/org/vfny/geoserver/global/CoverageDimension.java     
(revision 13516)
+++ src/main/src/main/java/org/vfny/geoserver/global/CoverageDimension.java     
(working copy)
@@ -92,7 +92,12 @@
      * @return Returns the nullValues.
      */
     public Double[] getNullValues() {
-        return cd.getNullValues().toArray( new Double[ 
cd.getNullValues().size() ]);
+        if ( cd.getNullValues() != null ) {
+            return cd.getNullValues().toArray( new Double[ 
cd.getNullValues().size() ]);
+        }
+        else {
+            return null;
+        }
         //return nullValues;
     }

Uniting expertise from different fields of technology in a pleasant and 
stimulating environment enhances innovation and  the development of novel 
methods for sustainable production.
Have a look at the international congress 'Innovation for Sustainable 
Production 2010'
April, 18-21, 2010 - Bruges (Belgium)
http://www.i-sup2010.org
---
This e-mail, any attachments and the information it contains are confidential 
and meant only for the use of the addressee(s) only.  Access to this e-mail by 
anyone other than the addressee(s) is unauthorized.  If you are not the 
intended addressee (or responsible for delivery of the message to such person), 
you may not use, copy, distribute or deliver to anyone this message (or any 
part of its contents) or take any action in reliance on it.  In such case, you 
should destroy this message and notify the sender immediately.  If you have 
received this e-mail in error, please notify us immediately by e-mail or 
telephone and delete the e-mail from any computer.
All reasonable precautions have been taken to ensure no viruses are present in 
this e-mail and its attachments.  As our company cannot accept responsibility 
for any loss or damage arising from the use of this e-mail or attachments we 
recommend that you subject these to your virus checking procedures prior to use.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to