Changeset 459 for trunk/zoo-project/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Apr 1, 2014, 11:32:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r458 r459 152 152 char emsg[1024]; 153 153 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); 155 155 return -1; 156 156 } … … 165 165 map* tmpMap=getMap(mi->content,"length"); 166 166 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); 168 168 return -1; 169 169 } … … 172 172 char emsg[1024]; 173 173 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); 175 175 return -1; 176 176 } … … 221 221 } 222 222 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); 224 224 #ifdef DEBUG 225 225 fprintf(stderr,"Not this time!\n"); … … 556 556 m=(maps*)malloc(MAPS_SIZE); 557 557 if(m == NULL){ 558 return errorException(m, _("Unable to allocate memory."), "InternalError" );558 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 559 559 } 560 560 char ntmp[1024]; … … 570 570 snprintf(conf_file,10240,"%s/%s/main.cfg",ntmp,r_inputs->value); 571 571 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); 573 573 free(m); 574 574 return 1; … … 654 654 r_inputs=getMap(request_inputs,"Request"); 655 655 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"); 657 657 freeMaps(&m); 658 658 free(m); … … 664 664 && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0 665 665 && 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"); 667 667 freeMaps(&m); 668 668 free(m); … … 674 674 r_inputs=getMap(request_inputs,"Service"); 675 675 if(r_inputs==NULLMAP){ 676 errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue" );676 errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue","service"); 677 677 freeMaps(&m); 678 678 free(m); 679 679 free(REQUEST); 680 680 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"); 686 684 freeMaps(&m); 687 685 free(m); … … 689 687 return 1; 690 688 } 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 } 691 707 } 692 708 … … 726 742 DIR *dirp = opendir(conf_dir); 727 743 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"); 729 745 } 730 746 xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); … … 748 764 s1=(service*)malloc(SERVICE_SIZE); 749 765 if(s1 == NULL){ 750 return errorException(m, _("Unable to allocate memory."),"InternalError" );766 return errorException(m, _("Unable to allocate memory."),"InternalError",NULL); 751 767 } 752 768 #ifdef DEBUG … … 779 795 if(r_inputs==NULL 780 796 || 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"); 782 798 freeMaps(&m); 783 799 free(m); … … 790 806 DIR *dirp = opendir(conf_dir); 791 807 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); 793 809 freeMaps(&m); 794 810 free(m); … … 833 849 if(s1 == NULL){ 834 850 dup2(saved_stdout,fileno(stdout)); 835 return errorException(m, _("Unable to allocate memory."),"InternalError" );851 return errorException(m, _("Unable to allocate memory."),"InternalError",NULL); 836 852 } 837 853 #ifdef DEBUG … … 863 879 else 864 880 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"); 866 882 #ifdef DEBUG 867 883 fprintf(stderr,"No request found %s",REQUEST); … … 885 901 free(REQUEST); 886 902 free(SERVICE_URL); 887 return errorException(m, _("Unable to allocate memory."),"InternalError" );903 return errorException(m, _("Unable to allocate memory."),"InternalError",NULL); 888 904 } 889 905 r_inputs=getMap(request_inputs,"MetaPath"); … … 908 924 909 925 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"); 911 927 free(tmpMsg); 912 928 free(s1); … … 982 998 char** outputs_as_text=(char**)malloc(128*sizeof(char*)); 983 999 if(outputs_as_text == NULL) { 984 return errorException(m, _("Unable to allocate memory"), "InternalError" );1000 return errorException(m, _("Unable to allocate memory"), "InternalError",NULL); 985 1001 } 986 1002 i=0; … … 993 1009 outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char)); 994 1010 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); 996 1012 } 997 1013 snprintf(outputs_as_text[i],strlen(pToken)+1,"%s",pToken); … … 1010 1026 tmp_output=(maps*)malloc(MAPS_SIZE); 1011 1027 if(tmp_output == NULL){ 1012 return errorException(m, _("Unable to allocate memory."), "InternalError" );1028 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1013 1029 } 1014 1030 tmp_output->name=zStrdup(tmpc); … … 1067 1083 snprintf(cursor_input,40960,"%s",r_inputs->value); 1068 1084 else{ 1069 errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue" );1085 errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue","DataInputs"); 1070 1086 freeMaps(&m); 1071 1087 free(m); … … 1095 1111 char** inputs_as_text=(char**)malloc(100*sizeof(char*)); 1096 1112 if(inputs_as_text == NULL){ 1097 return errorException(m, _("Unable to allocate memory."), "InternalError" );1113 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1098 1114 } 1099 1115 i=0; … … 1109 1125 snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken); 1110 1126 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); 1112 1128 } 1113 1129 pToken = strtok(NULL,";"); … … 1141 1157 tmpmaps=(maps*)malloc(MAPS_SIZE); 1142 1158 if(tmpmaps == NULL){ 1143 return errorException(m, _("Unable to allocate memory."), "InternalError" );1159 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1144 1160 } 1145 1161 tmpmaps->name=zStrdup(tmpn); … … 1195 1211 char emsg[1024]; 1196 1212 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); 1198 1214 freeMaps(&m); 1199 1215 free(m); … … 1312 1328 tmpmaps=(maps*)malloc(MAPS_SIZE); 1313 1329 if(tmpmaps == NULL){ 1314 return errorException(m, _("Unable to allocate memory."), "InternalError" );1330 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1315 1331 } 1316 1332 tmpmaps->name=zStrdup((char*)val); … … 1330 1346 tmpmaps=(maps*)malloc(MAPS_SIZE); 1331 1347 if(tmpmaps == NULL){ 1332 return errorException(m, _("Unable to allocate memory."), "InternalError" );1348 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1333 1349 } 1334 1350 tmpmaps->name=zStrdup("missingIndetifier"); … … 1428 1444 has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char)); 1429 1445 if(has == NULL){ 1430 return errorException(m, _("Unable to allocate memory."), "InternalError" );1446 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1431 1447 } 1432 1448 snprintf(has,(3+strlen((char*)val)+strlen(key)),"%s: %s",key,(char*)val); … … 1478 1494 char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char)); 1479 1495 if(tmpContent == NULL){ 1480 return errorException(m, _("Unable to allocate memory."), "InternalError" );1496 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1481 1497 } 1482 1498 size_t dwRead; … … 1513 1529 (char*)malloc((res1.nDataLen+1)*sizeof(char)); 1514 1530 if(tmp == NULL){ 1515 return errorException(m, _("Unable to allocate memory."), "InternalError" );1531 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1516 1532 } 1517 1533 size_t bRead; … … 1531 1547 char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char)); 1532 1548 if(tmpContent == NULL){ 1533 return errorException(m, _("Unable to allocate memory."), "InternalError" );1549 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1534 1550 } 1535 1551 size_t dwRead; … … 1750 1766 tmpmaps=(maps*)malloc(MAPS_SIZE); 1751 1767 if(tmpmaps == NULL){ 1752 return errorException(m, _("Unable to allocate memory."), "InternalError" );1768 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1753 1769 } 1754 1770 tmpmaps->name=zStrdup("unknownIdentifier"); … … 1792 1808 tmpmaps=(maps*)malloc(MAPS_SIZE); 1793 1809 if(tmpmaps == NULL){ 1794 return errorException(m, _("Unable to allocate memory."), "InternalError" );1810 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1795 1811 } 1796 1812 tmpmaps->name=zStrdup((char*)val); … … 1829 1845 tmpmaps=(maps*)malloc(MAPS_SIZE); 1830 1846 if(tmpmaps == NULL){ 1831 return errorException(m, _("Unable to allocate memory."), "InternalError" );1847 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1832 1848 } 1833 1849 tmpmaps->name=zStrdup("missingIndetifier"); … … 1878 1894 tmpmaps=(maps*)malloc(MAPS_SIZE); 1879 1895 if(tmpmaps == NULL){ 1880 return errorException(m, _("Unable to allocate memory."), "InternalError" );1896 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1881 1897 } 1882 1898 tmpmaps->name=zStrdup((char*)val); … … 1901 1917 tmpmaps=(maps*)malloc(MAPS_SIZE); 1902 1918 if(tmpmaps == NULL){ 1903 return errorException(m, _("Unable to allocate memory."), "InternalError" );1919 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1904 1920 } 1905 1921 tmpmaps->name=zStrdup("missingIndetifier"); … … 1963 1979 if(strcmp(dfv1,"")!=0 || strcmp(dfv,"")!=0){ 1964 1980 char tmps[1024]; 1981 map* tmpe=createMap("code","MissingParameterValue"); 1965 1982 if(strcmp(dfv,"")!=0){ 1966 1983 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); 1967 1985 } 1968 1986 else if(strcmp(dfv1,"")!=0){ 1969 1987 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); 1973 1991 printExceptionReportResponse(m,tmpe); 1974 1992 freeService(&s1); … … 2116 2134 if(status!=NULL && strcmp(status->value,"true")==0 && 2117 2135 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"); 2119 2137 freeService(&s1); 2120 2138 free(s1); … … 2329 2347 */ 2330 2348 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); 2332 2350 } 2333 2351 }
Note: See TracChangeset
for help on using the changeset viewer.