Package: mapserver / 6.4.1-5+deb8u3

0001-Backport-4928-and-5356.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
From 022d24bd34196b6dca67053fb797a6980210bc54 Mon Sep 17 00:00:00 2001
From: Thomas Bonfort <thomas.bonfort@gmail.com>
Date: Thu, 1 Dec 2016 18:59:05 +0100
Subject: Backport #4928 and #5356

---
 mapogr.cpp   | 52 ++++++++++++++++++++++++++++------------------------
 mappostgis.c |  4 ++--
 2 files changed, 30 insertions(+), 26 deletions(-)

--- a/mapogr.cpp
+++ b/mapogr.cpp
@@ -1118,18 +1118,15 @@ msOGRFileOpen(layerObj *layer, const cha
     RELEASE_OGR_LOCK;
 
     if( hDS == NULL ) {
-      if( strlen(CPLGetLastErrorMsg()) == 0 )
-        msSetError(MS_OGRERR,
-                   "Open failed for OGR connection in layer `%s'.  "
-                   "File not found or unsupported format.",
-                   "msOGRFileOpen()",
-                   layer->name?layer->name:"(null)" );
-      else
-        msSetError(MS_OGRERR,
-                   "Open failed for OGR connection in layer `%s'.\n%s\n",
-                   "msOGRFileOpen()",
-                   layer->name?layer->name:"(null)",
-                   CPLGetLastErrorMsg() );
+      msSetError(MS_OGRERR, 
+                "Open failed for OGR connection in layer `%s'.  "
+                "Check logs.", 
+                "msOGRFileOpen()",
+                layer->name?layer->name:"(null)" );
+      if( strlen(CPLGetLastErrorMsg()) != 0 )
+          msDebug("Open failed for OGR connection in layer `%s'.\n%s\n",
+                  layer->name?layer->name:"(null)", 
+                  CPLGetLastErrorMsg() );
       CPLFree( pszDSName );
       CPLFree( pszLayerDef );
       return NULL;
@@ -1154,10 +1151,13 @@ msOGRFileOpen(layerObj *layer, const cha
     ACQUIRE_OGR_LOCK;
     hLayer = OGR_DS_ExecuteSQL( hDS, pszLayerDef, NULL, NULL );
     if( hLayer == NULL ) {
-      msSetError(MS_OGRERR,
-                 "ExecuteSQL(%s) failed.\n%s",
-                 "msOGRFileOpen()",
-                 pszLayerDef, CPLGetLastErrorMsg() );
+      msSetError(MS_OGRERR, 
+              "ExecuteSQL(%s) failed. Check logs",
+              "msOGRFileOpen()", 
+              pszLayerDef);
+      msDebug(
+              "ExecuteSQL(%s) failed.\n%s",
+              pszLayerDef, CPLGetLastErrorMsg() );
       RELEASE_OGR_LOCK;
       msConnPoolRelease( layer, hDS );
       CPLFree( pszLayerDef );
@@ -1189,9 +1189,11 @@ msOGRFileOpen(layerObj *layer, const cha
   }
 
   if (hLayer == NULL) {
-    msSetError(MS_OGRERR, "GetLayer(%s) failed for OGR connection `%s'.",
-               "msOGRFileOpen()",
-               pszLayerDef, connection );
+    msSetError(MS_OGRERR, "GetLayer(%s) failed for OGR connection. Check logs.",
+                "msOGRFileOpen()", 
+                pszLayerDef);
+    msDebug("GetLayer(%s) failed for OGR connection `%s'.",
+                pszLayerDef, connection );
     CPLFree( pszLayerDef );
     msConnPoolRelease( layer, hDS );
     return NULL;
@@ -1356,10 +1358,12 @@ static int msOGRFileWhichShapes(layerObj
     if( OGR_L_SetAttributeFilter( psInfo->hLayer, layer->filter.string+6 )
         != OGRERR_NONE ) {
       msSetError(MS_OGRERR,
-                 "SetAttributeFilter(%s) failed on layer %s.\n%s",
+                 "SetAttributeFilter(%s) failed on layer %s.", 
                  "msOGRFileWhichShapes()",
-                 layer->filter.string+6, layer->name?layer->name:"(null)",
-                 CPLGetLastErrorMsg() );
+                 layer->filter.string+6, layer->name?layer->name:"(null)");
+      msDebug("SetAttributeFilter(%s) failed on layer %s.\n%s", 
+              layer->filter.string+6, layer->name?layer->name:"(null)", 
+              CPLGetLastErrorMsg() );
       RELEASE_OGR_LOCK;
       return MS_FAILURE;
     }
@@ -1562,8 +1566,8 @@ msOGRFileNextShape(layerObj *layer, shap
     if( (hFeature = OGR_L_GetNextFeature( psInfo->hLayer )) == NULL ) {
       psInfo->last_record_index_read = -1;
       if( CPLGetLastErrorType() == CE_Failure ) {
-        msSetError(MS_OGRERR, "%s", "msOGRFileNextShape()",
-                   CPLGetLastErrorMsg() );
+        msSetError(MS_OGRERR, "OGR error. check logs", "msOGRFileNextShape()");
+        msDebug("msOGRFileNextShape() error: %s", CPLGetLastErrorMsg() );
         RELEASE_OGR_LOCK;
         return MS_FAILURE;
       } else {
--- a/mappostgis.c
+++ b/mappostgis.c
@@ -2305,7 +2305,8 @@ int msPostGISLayerOpen(layerObj *layer)
         }
       }
 
-      msSetError(MS_QUERYERR, "Database connection failed (%s) with connect string '%s'\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?", "msPostGISLayerOpen()", PQerrorMessage(layerinfo->pgconn), maskeddata);
+      msDebug("Database connection failed (%s) with connect string '%s'\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?.\n", PQerrorMessage(layerinfo->pgconn), maskeddata);
+      msSetError(MS_QUERYERR, "Database connection failed.\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?", "msPostGISLayerOpen()");
 
       free(maskeddata);
       free(layerinfo);
@@ -2327,7 +2328,6 @@ int msPostGISLayerOpen(layerObj *layer)
         msSetError(MS_QUERYERR, "PostgreSQL database connection gone bad (%s)", "msPostGISLayerOpen()", PQerrorMessage(layerinfo->pgconn));
         return MS_FAILURE;
       }
-
     }
   }