Ignore:
Timestamp:
Apr 1, 2014, 11:32:29 PM (10 years ago)
Author:
djay
Message:

Initial introduction of Value and Range in AllowedValues?, update zcfg documentation. Return valid Status code when returning ExceptionRepport?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r458 r459  
    152152        char emsg[1024];
    153153        sprintf(emsg,_("You set maximum occurences for <%s> as %i but you tried to use it more than the limit you set. Please correct your ZCFG file or your request."),mi->name,atoi(testMap->value));
    154         errorException(m,emsg,"InternalError");
     154        errorException(m,emsg,"InternalError",NULL);
    155155        return -1;
    156156      }
     
    165165          map* tmpMap=getMap(mi->content,"length");
    166166          sprintf(emsg,_("ZOO-Kernel was unable to load your data for %s position %s."),mi->name,tmpMap->value);
    167           errorException(m,emsg,"InternalError");
     167          errorException(m,emsg,"InternalError",NULL);
    168168          return -1;
    169169        }
     
    172172        char emsg[1024];
    173173        sprintf(emsg,_("You set maximum occurences for <%s> to one but you tried to use it more than once. Please correct your ZCFG file or your request."),mi->name);
    174         errorException(m,emsg,"InternalError");
     174        errorException(m,emsg,"InternalError",NULL);
    175175        return -1;
    176176      }
     
    221221  }
    222222  sprintf(tmp,_("ZOO Kernel failed to process your request receiving signal %d = %s"),sig,ssig);
    223   errorException(NULL, tmp, "InternalError");
     223  errorException(NULL, tmp, "InternalError",NULL);
    224224#ifdef DEBUG
    225225  fprintf(stderr,"Not this time!\n");
     
    556556  m=(maps*)malloc(MAPS_SIZE);
    557557  if(m == NULL){
    558     return errorException(m, _("Unable to allocate memory."), "InternalError");
     558    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    559559  }
    560560  char ntmp[1024];
     
    570570  snprintf(conf_file,10240,"%s/%s/main.cfg",ntmp,r_inputs->value);
    571571  if(conf_read(conf_file,m)==2){
    572     errorException(NULL, _("Unable to load the main.cfg file."),"InternalError");
     572    errorException(NULL, _("Unable to load the main.cfg file."),"InternalError",NULL);
    573573    free(m);
    574574    return 1;
     
    654654  r_inputs=getMap(request_inputs,"Request");
    655655  if(request_inputs==NULL || r_inputs==NULL){
    656     errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue");
     656    errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue","request");
    657657    freeMaps(&m);
    658658    free(m);
     
    664664       && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0
    665665       && strncasecmp(r_inputs->value,"Execute",7)!=0){
    666       errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue");
     666      errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue","request");
    667667      freeMaps(&m);
    668668      free(m);
     
    674674  r_inputs=getMap(request_inputs,"Service");
    675675  if(r_inputs==NULLMAP){
    676     errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue");
     676    errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue","service");
    677677    freeMaps(&m);
    678678    free(m);
    679679    free(REQUEST);
    680680    return 1;
    681   }
    682   if(strncasecmp(REQUEST,"GetCapabilities",15)!=0){
    683     r_inputs=getMap(request_inputs,"Version");
    684     if(r_inputs==NULL){
    685       errorException(m, _("Parameter <version> was not specified"),"MissingParameterValue");
     681  }else{
     682    if(strcasecmp(r_inputs->value,"WPS")!=0){
     683      errorException(m, _("Unenderstood <service> value, WPS is the only acceptable value."), "InvalidParameterValue","service");
    686684      freeMaps(&m);
    687685      free(m);
     
    689687      return 1;
    690688    }
     689  }
     690  if(strncasecmp(REQUEST,"GetCapabilities",15)!=0){
     691    r_inputs=getMap(request_inputs,"Version");
     692    if(r_inputs==NULL){
     693      errorException(m, _("Parameter <version> was not specified"),"MissingParameterValue","version");
     694      freeMaps(&m);
     695      free(m);
     696      free(REQUEST);
     697      return 1;
     698    }else{
     699      if(strcasecmp(r_inputs->value,"1.0.0")!=0){
     700        errorException(m, _("Unenderstood <version> value, 1.0.0 is the only acceptable value."), "InvalidParameterValue","service");
     701        freeMaps(&m);
     702        free(m);
     703        free(REQUEST);
     704        return 1;
     705      }
     706    }
    691707  }
    692708
     
    726742    DIR *dirp = opendir(conf_dir);
    727743    if(dirp==NULL){
    728       return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue");
     744      return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue","metapath");
    729745    }
    730746    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
     
    748764        s1=(service*)malloc(SERVICE_SIZE);
    749765        if(s1 == NULL){
    750           return errorException(m, _("Unable to allocate memory."),"InternalError");
     766          return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    751767        }
    752768#ifdef DEBUG
     
    779795    if(r_inputs==NULL
    780796       || strlen(r_inputs->name)==0 || strlen(r_inputs->value)==0){
    781       errorException(m, _("Mandatory <identifier> was not specified"),"MissingParameterValue");
     797      errorException(m, _("Mandatory <identifier> was not specified"),"MissingParameterValue","identifier");
    782798      freeMaps(&m);
    783799      free(m);
     
    790806    DIR *dirp = opendir(conf_dir);
    791807    if(dirp==NULL){
    792       errorException(m, _("The specified path path doesn't exist."),"InvalidParameterValue");
     808      errorException(m, _("The specified path path doesn't exist."),"InvalidParameterValue",conf_dir);
    793809      freeMaps(&m);
    794810      free(m);
     
    833849            if(s1 == NULL){
    834850              dup2(saved_stdout,fileno(stdout));
    835               return errorException(m, _("Unable to allocate memory."),"InternalError");
     851              return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    836852            }
    837853#ifdef DEBUG
     
    863879    else
    864880      if(strncasecmp(REQUEST,"Execute",strlen(REQUEST))!=0){
    865         errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue");
     881        errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue","request");
    866882#ifdef DEBUG
    867883        fprintf(stderr,"No request found %s",REQUEST);
     
    885901    free(REQUEST);
    886902    free(SERVICE_URL);
    887     return errorException(m, _("Unable to allocate memory."),"InternalError");
     903    return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    888904  }
    889905  r_inputs=getMap(request_inputs,"MetaPath");
     
    908924   
    909925    sprintf(tmpMsg,_("The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),r_inputs->value);
    910     errorException(m, tmpMsg, "InvalidParameterValue");
     926    errorException(m, tmpMsg, "InvalidParameterValue","identifier");
    911927    free(tmpMsg);
    912928    free(s1);
     
    982998      char** outputs_as_text=(char**)malloc(128*sizeof(char*));
    983999      if(outputs_as_text == NULL) {
    984         return errorException(m, _("Unable to allocate memory"), "InternalError");
     1000        return errorException(m, _("Unable to allocate memory"), "InternalError",NULL);
    9851001      }
    9861002      i=0;
     
    9931009        outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
    9941010        if(outputs_as_text[i] == NULL) {
    995           return errorException(m, _("Unable to allocate memory"), "InternalError");
     1011          return errorException(m, _("Unable to allocate memory"), "InternalError",NULL);
    9961012        }
    9971013        snprintf(outputs_as_text[i],strlen(pToken)+1,"%s",pToken);
     
    10101026              tmp_output=(maps*)malloc(MAPS_SIZE);
    10111027              if(tmp_output == NULL){
    1012                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1028                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    10131029              }
    10141030              tmp_output->name=zStrdup(tmpc);
     
    10671083      snprintf(cursor_input,40960,"%s",r_inputs->value);
    10681084    else{
    1069       errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue");
     1085      errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue","DataInputs");
    10701086      freeMaps(&m);
    10711087      free(m);
     
    10951111    char** inputs_as_text=(char**)malloc(100*sizeof(char*));
    10961112    if(inputs_as_text == NULL){
    1097       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1113      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    10981114    }
    10991115    i=0;
     
    11091125      snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken);
    11101126      if(inputs_as_text[i] == NULL){
    1111         return errorException(m, _("Unable to allocate memory."), "InternalError");
     1127        return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    11121128      }
    11131129      pToken = strtok(NULL,";");
     
    11411157          tmpmaps=(maps*)malloc(MAPS_SIZE);
    11421158          if(tmpmaps == NULL){
    1143             return errorException(m, _("Unable to allocate memory."), "InternalError");
     1159            return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    11441160          }
    11451161          tmpmaps->name=zStrdup(tmpn);
     
    11951211                char emsg[1024];
    11961212                sprintf(emsg,_("Unable to find a valid protocol to download the remote file %s"),tmpv1+1);
    1197                 errorException(m,emsg,"InternalError");
     1213                errorException(m,emsg,"InternalError",NULL);
    11981214                freeMaps(&m);
    11991215                free(m);
     
    13121328              tmpmaps=(maps*)malloc(MAPS_SIZE);
    13131329              if(tmpmaps == NULL){
    1314                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1330                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    13151331              }
    13161332              tmpmaps->name=zStrdup((char*)val);
     
    13301346              tmpmaps=(maps*)malloc(MAPS_SIZE);
    13311347              if(tmpmaps == NULL){
    1332                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1348                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    13331349              }
    13341350              tmpmaps->name=zStrdup("missingIndetifier");
     
    14281444                    has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char));
    14291445                    if(has == NULL){
    1430                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1446                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    14311447                    }
    14321448                    snprintf(has,(3+strlen((char*)val)+strlen(key)),"%s: %s",key,(char*)val);
     
    14781494                    char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    14791495                    if(tmpContent == NULL){
    1480                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1496                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    14811497                    }
    14821498                    size_t dwRead;
     
    15131529                      (char*)malloc((res1.nDataLen+1)*sizeof(char));
    15141530                    if(tmp == NULL){
    1515                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1531                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    15161532                    }
    15171533                    size_t bRead;
     
    15311547                      char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    15321548                      if(tmpContent == NULL){
    1533                         return errorException(m, _("Unable to allocate memory."), "InternalError");
     1549                        return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    15341550                      }
    15351551                      size_t dwRead;
     
    17501766          tmpmaps=(maps*)malloc(MAPS_SIZE);
    17511767          if(tmpmaps == NULL){
    1752             return errorException(m, _("Unable to allocate memory."), "InternalError");
     1768            return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    17531769          }
    17541770          tmpmaps->name=zStrdup("unknownIdentifier");
     
    17921808              tmpmaps=(maps*)malloc(MAPS_SIZE);
    17931809              if(tmpmaps == NULL){
    1794                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1810                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    17951811              }
    17961812              tmpmaps->name=zStrdup((char*)val);
     
    18291845              tmpmaps=(maps*)malloc(MAPS_SIZE);
    18301846              if(tmpmaps == NULL){
    1831                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1847                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    18321848              }
    18331849              tmpmaps->name=zStrdup("missingIndetifier");
     
    18781894                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    18791895                  if(tmpmaps == NULL){
    1880                     return errorException(m, _("Unable to allocate memory."), "InternalError");
     1896                    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    18811897                  }
    18821898                  tmpmaps->name=zStrdup((char*)val);
     
    19011917                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    19021918                  if(tmpmaps == NULL){
    1903                     return errorException(m, _("Unable to allocate memory."), "InternalError");
     1919                    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    19041920                  }
    19051921                  tmpmaps->name=zStrdup("missingIndetifier");
     
    19631979  if(strcmp(dfv1,"")!=0 || strcmp(dfv,"")!=0){
    19641980    char tmps[1024];
     1981    map* tmpe=createMap("code","MissingParameterValue");
    19651982    if(strcmp(dfv,"")!=0){
    19661983      snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv);
     1984      addToMap(tmpe,"locator",dfv);
    19671985    }
    19681986    else if(strcmp(dfv1,"")!=0){
    19691987      snprintf(tmps,1024,_("The <%s> argument was specified as Output identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."),dfv1);
    1970     }
    1971     map* tmpe=createMap("text",tmps);
    1972     addToMap(tmpe,"code","MissingParameterValue");
     1988      addToMap(tmpe,"locator",dfv1);
     1989    }
     1990    addToMap(tmpe,"text",tmps);
    19731991    printExceptionReportResponse(m,tmpe);
    19741992    freeService(&s1);
     
    21162134  if(status!=NULL && strcmp(status->value,"true")==0 &&
    21172135     store!=NULL && strcmp(store->value,"false")==0){
    2118     errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue");
     2136    errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue","storeExecuteResponse");
    21192137    freeService(&s1);
    21202138    free(s1);
     
    23292347       */
    23302348      eres=-1;
    2331       errorException(m, _("Unable to run the child process properly"), "InternalError");
     2349      errorException(m, _("Unable to run the child process properly"), "InternalError",NULL);
    23322350    }
    23332351  }
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png