@@ -243,9 +243,10 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
243243 var localisationHelper = new LocalisationHelper (config , localeResolver .resolveLocale (request , response , config , appConfig ));
244244 var result = new UploadResult <>();
245245
246- if (StringUtils . isBlank ( validationType )) {
247- validationType = config . getType (). get ( 0 );
246+ if (! isOwnSubmission ( request )) {
247+ validationType = inputHelper . determineValidationType ( validationType , domain , config );
248248 }
249+ validationType = inputHelper .validateValidationType (config , validationType );
249250 if (config .hasMultipleValidationTypes () && (validationType == null || !config .getType ().contains (validationType ))) {
250251 // A validation type is required.
251252 result .setMessage (localisationHelper .localise ("validator.label.exception.providedValidationTypeNotValid" ));
@@ -261,7 +262,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
261262 result .setMessage (localisationHelper .localise ("validator.label.exception.providedInputNotXML" ));
262263 }
263264 } catch (IOException e ) {
264- logger .error ("Error while reading uploaded file [" + e .getMessage () + "]" , e );
265+ logger .error ("Error while reading uploaded file [{}]" , e .getMessage (), e );
265266 result .setMessage (localisationHelper .localise ("validator.label.exception.errorInUpload" , e .getMessage ()));
266267 proceedToValidate = false ;
267268 }
@@ -276,7 +277,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
276277 } catch (ValidatorException e ) {
277278 throw e ;
278279 } catch (Exception e ) {
279- logger .error ("Error while reading uploaded file [" + e .getMessage () + "]" , e );
280+ logger .error ("Error while reading uploaded file [{}]" , e .getMessage (), e );
280281 result .setMessage (localisationHelper .localise ("validator.label.exception.errorInUpload" , e .getMessage ()));
281282 proceedToValidate = false ;
282283 }
@@ -316,7 +317,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
316317 fileName , report , aggregateReport ,
317318 new Translations (localisationHelper , report , config ));
318319 } catch (IOException e ) {
319- logger .error ("Error generating detailed report [" + e .getMessage () + "]" , e );
320+ logger .error ("Error generating detailed report [{}]" , e .getMessage (), e );
320321 result .setMessage (localisationHelper .localise ("validator.label.exception.errorGeneratingDetailedReport" , e .getMessage ()));
321322 }
322323 }
@@ -325,7 +326,7 @@ public UploadResult<Translations> handleUpload(@PathVariable("domain") String do
325326 logger .error (e .getMessageForLog (), e );
326327 result .setMessage (e .getMessageForDisplay (localisationHelper ));
327328 } catch (Exception e ) {
328- logger .error ("An error occurred during the validation [" + e .getMessage () + "]" , e );
329+ logger .error ("An error occurred during the validation [{}]" , e .getMessage (), e );
329330 if (e .getMessage () != null ) {
330331 result .setMessage (localisationHelper .localise ("validator.label.exception.unexpectedErrorDuringValidationWithParams" , e .getMessage ()));
331332 } else {
@@ -417,15 +418,15 @@ public UploadResult<Translations> handleUploadMinimal(@PathVariable("domain") St
417418 @ RequestParam (value = "validationType" , defaultValue = "" ) String validationType ,
418419 @ RequestParam (value = "contentType" , defaultValue = "" ) String contentType ,
419420 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchema ,
420- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false ) MultipartFile [] externalSchemaFiles ,
421+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false ) MultipartFile [] externalSchemaFiles ,
421422 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaUri ,
422423 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaString ,
423424 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSch ,
424- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false ) MultipartFile [] externalSchFiles ,
425+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false ) MultipartFile [] externalSchFiles ,
425426 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchUri ,
426427 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchString ,
427428 @ RequestParam (value = "contentType-contextFile" , required = false , defaultValue = "" ) String [] contextFileTypes ,
428- @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
429+ @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
429430 @ RequestParam (value = "uri-contextFile" , required = false , defaultValue = "" ) String [] contextFileUris ,
430431 @ RequestParam (value = "text-contextFile" , required = false , defaultValue = "" ) String [] contextFileStrings ,
431432 RedirectAttributes redirectAttributes ,
@@ -447,15 +448,15 @@ public ModelAndView handleUploadEmbedded(@PathVariable("domain") String domain,
447448 @ RequestParam (value = "validationType" , defaultValue = "" ) String validationType ,
448449 @ RequestParam (value = "contentType" , defaultValue = "" ) String contentType ,
449450 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchema ,
450- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false ) MultipartFile [] externalSchemaFiles ,
451+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false ) MultipartFile [] externalSchemaFiles ,
451452 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaUri ,
452453 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaString ,
453454 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSch ,
454- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) MultipartFile [] externalSchFiles ,
455+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false ) MultipartFile [] externalSchFiles ,
455456 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchUri ,
456457 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchString ,
457458 @ RequestParam (value = "contentType-contextFile" , required = false , defaultValue = "" ) String [] contextFileTypes ,
458- @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
459+ @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
459460 @ RequestParam (value = "uri-contextFile" , required = false , defaultValue = "" ) String [] contextFileUris ,
460461 @ RequestParam (value = "text-contextFile" , required = false , defaultValue = "" ) String [] contextFileStrings ,
461462 RedirectAttributes redirectAttributes ,
@@ -480,15 +481,15 @@ public ModelAndView handleUploadMinimalEmbedded(@PathVariable("domain") String d
480481 @ RequestParam (value = "validationType" , defaultValue = "" ) String validationType ,
481482 @ RequestParam (value = "contentType" , defaultValue = "" ) String contentType ,
482483 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchema ,
483- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) MultipartFile [] externalSchemaFiles ,
484+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false ) MultipartFile [] externalSchemaFiles ,
484485 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaUri ,
485486 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMA , required = false , defaultValue = "" ) String [] externalSchemaString ,
486487 @ RequestParam (value = "contentType-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSch ,
487- @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false ) MultipartFile [] externalSchFiles ,
488+ @ RequestParam (value = "inputFile-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false ) MultipartFile [] externalSchFiles ,
488489 @ RequestParam (value = "uri-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchUri ,
489490 @ RequestParam (value = "text-external_" +DomainConfig .ARTIFACT_TYPE_SCHEMATRON , required = false , defaultValue = "" ) String [] externalSchString ,
490491 @ RequestParam (value = "contentType-contextFile" , required = false , defaultValue = "" ) String [] contextFileTypes ,
491- @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
492+ @ RequestParam (value = "inputFile-contextFile" , required = false ) MultipartFile [] contextFileFiles ,
492493 @ RequestParam (value = "uri-contextFile" , required = false , defaultValue = "" ) String [] contextFileUris ,
493494 @ RequestParam (value = "text-contextFile" , required = false , defaultValue = "" ) String [] contextFileStrings ,
494495 RedirectAttributes redirectAttributes ,
0 commit comments