diff --git a/.gitmodules b/.gitmodules index bdfdadacca0df92464d516237eaaf9ce0aa46b03..ac9721a9bf5070d7fdd6e7cc16d8333fde8eae71 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "dk.gov.oiosi.library/common"] path = dk.gov.oiosi.library/common url = https://rep.erst.dk/git/openebusiness/common.git -[submodule "dk.gov.oiosi.examples.client/common"] - path = dk.gov.oiosi.examples.client/common + +[submodule "dk.gov.oiosi.examples.service/common"] + path = dk.gov.oiosi.examples.service/common url = https://rep.erst.dk/git/openebusiness/common.git diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ca396cb306930cd3e255f4e46205128d182dce8b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../../../../:\Users\kristian.sorensen-bo\Repositories\IntelliJ\OIORASP\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/OIORASP.iml b/.idea/OIORASP.iml new file mode 100644 index 0000000000000000000000000000000000000000..d6ebd4805981b8400db3e3291c74a743fef9a824 --- /dev/null +++ b/.idea/OIORASP.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..53c1cad17cdb79b7fb0739ff4b26824eac34d7f5 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dk.gov.oiosi.examples.client/.idea/libraries/Libs.xml b/dk.gov.oiosi.examples.client/.idea/libraries/Libs.xml new file mode 100644 index 0000000000000000000000000000000000000000..d2969936aa094512cd4c2a22e0e8120cb8953413 --- /dev/null +++ b/dk.gov.oiosi.examples.client/.idea/libraries/Libs.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dk.gov.oiosi.examples.client/.idea/sonarlint/issuestore/index.pb b/dk.gov.oiosi.examples.client/.idea/sonarlint/issuestore/index.pb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dk.gov.oiosi.examples.service/.idea/ant.xml b/dk.gov.oiosi.examples.service/.idea/ant.xml new file mode 100644 index 0000000000000000000000000000000000000000..a2a47698279d3066c062d5472c43634c644f6334 --- /dev/null +++ b/dk.gov.oiosi.examples.service/.idea/ant.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dk.gov.oiosi.examples.service/.idea/workspace.xml b/dk.gov.oiosi.examples.service/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..e4ef1455261a5b6eb82cfbdb9698e1ee82a59254 --- /dev/null +++ b/dk.gov.oiosi.examples.service/.idea/workspace.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1600772851462 + + + 1616067500900 + + + 1616074007858 + + + 1616077260338 + + + 1616159768893 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-1.2.15.jar b/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-1.2.15.jar deleted file mode 100644 index c930a6ab4d4b73c1a6feb9e929091205664bb340..0000000000000000000000000000000000000000 Binary files a/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-1.2.15.jar and /dev/null differ diff --git a/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-core-2.14.1.jar b/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-core-2.14.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..9a9a9be816bcaf4b157013c52cb75bbed3949593 Binary files /dev/null and b/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/log4j-core-2.14.1.jar differ diff --git a/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/mail-1.4.jar b/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/mail-1.4.jar new file mode 100644 index 0000000000000000000000000000000000000000..3b28b6ea9dba3c72a8d86e7df4efb1f8b4b95666 Binary files /dev/null and b/dk.gov.oiosi.examples.service/WebContent/WEB-INF/lib/mail-1.4.jar differ diff --git a/dk.gov.oiosi.examples.service/bin/buildAndDeploy.sh b/dk.gov.oiosi.examples.service/bin/buildAndDeploy.sh old mode 100644 new mode 100755 diff --git a/dk.gov.oiosi.examples.service/build.xml b/dk.gov.oiosi.examples.service/build.xml index 209fa649efbb2a394dd3dec0b35ec8ab678bd846..a4f9ebccb5a1813a6b7684ed63981dbbe5d3f237 100644 --- a/dk.gov.oiosi.examples.service/build.xml +++ b/dk.gov.oiosi.examples.service/build.xml @@ -1,9 +1,10 @@ + - - + + @@ -61,28 +62,29 @@ - - + + + - remove old version of dk.gov.oiosi.library - - - - - - - Copy dk.gov.oiosi.library ... - - - - - + + + + + + + + + + + + + @@ -95,11 +97,12 @@ classpathref="class.path" debug="on" deprecation="on" - compiler="javac1.6" optimize="off" encoding="UTF8" - includeantruntime="true"> - + includeantruntime="true" + compiler="javac1.7" + > + @@ -120,7 +123,7 @@ - + @@ -139,7 +142,7 @@ - + diff --git a/dk.gov.oiosi.examples.service/common b/dk.gov.oiosi.examples.service/common new file mode 160000 index 0000000000000000000000000000000000000000..eadc55672ca15a89cbe95a246676ea654035c4e0 --- /dev/null +++ b/dk.gov.oiosi.examples.service/common @@ -0,0 +1 @@ +Subproject commit eadc55672ca15a89cbe95a246676ea654035c4e0 diff --git a/dk.gov.oiosi.examples.service/dk.gov.oiosi.examples.service.iml b/dk.gov.oiosi.examples.service/dk.gov.oiosi.examples.service.iml index e82b765cc5834618bc5a3f7415a12f95e5a81b6f..17a2c747f4b2ff735c8c738925f46ede6deeb231 100644 --- a/dk.gov.oiosi.examples.service/dk.gov.oiosi.examples.service.iml +++ b/dk.gov.oiosi.examples.service/dk.gov.oiosi.examples.service.iml @@ -1,41 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dk.gov.oiosi.examples.service/doc/Git-readme.txt b/dk.gov.oiosi.examples.service/doc/Git-readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..251ef7a1f4963afba1830d2c970f5bb091d16508 --- /dev/null +++ b/dk.gov.oiosi.examples.service/doc/Git-readme.txt @@ -0,0 +1,23 @@ + +Git tricks +---------- + +ISSUE: +The Git project https://rep.erst.dk/git/openebusiness/common holds a set of common files, +shared between multiple Nemhandel projects. +In the past, this has linked to the respective projects using SVN Externals. + +LINK IN GIT: +In Git this can be done by utilizing the Git submodule function: +http://blog.joncairns.com/2011/10/how-to-use-git-submodules/ + +To add (first time) the common project as a submodule dir to this project, goto to project root. +Execute: +$ git submodule add https://rep.erst.dk/git/openebusiness/common.git common +$ git submodule init + + + +CHECKOUT / CLONE +If you already have cloned this repository and now want to load it’s submodules you have to use submodule update. +git submodule update --init diff --git a/dk.gov.oiosi.examples.service/doc/HowToDeploy.txt b/dk.gov.oiosi.examples.service/doc/HowToDeploy.txt index 001e19a743d88c6a644bd754090c3e1772ef7f45..47006ebc0cf080fac153441066d601d9e77afff0 100644 --- a/dk.gov.oiosi.examples.service/doc/HowToDeploy.txt +++ b/dk.gov.oiosi.examples.service/doc/HowToDeploy.txt @@ -1,13 +1,19 @@ Reminder - how to deploy -1 - upload the the war filer using the Apache Tomcat Manager GUI - http://raspservice.nemhandel.gov.dk:8080/manager/html -2 - When deployed, stop Comcat -3 - Edit C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml +1: Upload the the war file to the Apache Tomcat server + http://demo.nemhandel.dk:8080 + +2: Inside the WAR, replace WEB-INF/keys/oces_digst_live.jks with the oces_digst_live.jks file on the demo-server + (this file contains the receiver FOCES for demo - NOT present here in GIT). + +3: When deployed, stop Tomcat + +4: Edit C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml Add element (update to match the correct path and docBase). -4 - start Tomcat. + +5: Start Tomcat. Note - if the folder 'integration#RASPJava#1.3.0#oces1' is created in the webapps, then the application was NOT deployed before the context element was created. diff --git a/dk.gov.oiosi.examples.service/src/RaspConfiguration.Live.xml b/dk.gov.oiosi.examples.service/src/RaspConfiguration.Live.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a62fda70c730d186113ca8ebbbd844bd742e0d7 --- /dev/null +++ b/dk.gov.oiosi.examples.service/src/RaspConfiguration.Live.xml @@ -0,0 +1,3391 @@ + + + + + + dk.gov.oiosi.common.startup.SchematronPreloadStartupTask + + + initDocumentTypeFriendlyName + Faktura + + + initDocumentTypeFriendlyName + Kreditnota + + + + + + dk.gov.oiosi.common.startup.DownloadCRLStartupTask + + + + downloadCrlUrl + http://crl.oces.certifikat.dk/oces.crl + + + + + dk.gov.oiosi.common.startup.StartCacheStateLogScheduledJobStartupTask + + + + + + + 5a15a880-eef8-40c0-80f2-bb65226f50c2 + Faktura v0.7 + http://rep.oio.dk/ubl/xml/schemas/0p71/pie/ + Invoice + + uddi:bc99bb01-80f9-4f52-89dc-edf7732c56f9 + Resources/Schemas/OIOXML_v0.7/pieStrict.xsd + Resources/UI/OIOXML_v0.7/StyleSheets/html.xsl + + + http://rep.oio.dk/ubl/xml/schemas/0p71/common/ + com + + + http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/ + main + + + http://rep.oio.dk/ubl/xml/schemas/0p71/pie/ + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Invoice07Interface/SubmitInvoice07Request + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Invoice07Interface/SubmitInvoice07Response + + /root:Invoice/com:BuyerParty/com:PartyName[count(../../com:BuyerParty)=1 or translate(../com:Address/com:ID, 'FAKTUREING', 'faktureing') ='faktura' or translate(../com:Address/com:ID, 'FAKTUREING', 'faktureing') ='fakturering']/com:Name + + + /root:Invoice/com:SellerParty/com:PartyName/com:Name + + + /root:Invoice/com:BuyersReferenceID + + + EndpointKeyType + /root:Invoice/com:BuyersReferenceID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/com:SellerParty/com:ID + + + EndpointKeyType + /root:Invoice/com:SellerParty/com:ID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + + + + Resources/Schematrons/OIOXML_v0.7/ublinvoice.xsl + /schematron/error + /schematron/error + + + + + + + /root:Invoice/com:ID + + + + 7bd520d7-6ae5-4a3c-8604-082e69414092 + Kreditnota v0.7 + http://rep.oio.dk/ubl/xml/schemas/0p71/pcm/ + Invoice + + uddi:3bbc9cf0-3c4c-11dc-98be-6976502198bd + Resources/Schemas/OIOXML_v0.7/pcmStrict.xsd + Resources/UI/OIOXML_v0.7/StyleSheets/html.xsl + + + http://rep.oio.dk/ubl/xml/schemas/0p71/common/ + com + + + http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/ + main + + + http://rep.oio.dk/ubl/xml/schemas/0p71/pcm/ + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Creditnote07Interface/SubmitCreditNote07Request + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Creditnote07Interface/SubmitCreditNote07Response + + /root:Invoice/com:BuyerParty/com:PartyName[count(../../com:BuyerParty)=1 or translate(../com:Address/com:ID, 'FAKTUREING', 'faktureing') ='faktura' or translate(../com:Address/com:ID, 'FAKTUREING', 'faktureing') ='fakturering']/com:Name + + + /root:Invoice/com:SellerParty/com:PartyName/com:Name + + + /root:Invoice/com:BuyersReferenceID + + + EndpointKeyType + /root:Invoice/com:BuyersReferenceID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/com:SellerParty/com:ID + + + EndpointKeyType + /root:Invoice/com:SellerParty/com:ID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + + + + Resources/Schematrons/OIOXML_v0.7/ublinvoice.xsl + /schematron/error + /schematron/error + + + + + + + /root:Invoice/com:ID + + + + 40c9fbee-ad39-48ed-9e04-c28cbbf8a38c + Applikationsmeddelse + urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 + ApplicationResponse + + + /root:ApplicationResponse/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:42F92342-C3ED-46ff-8A8A-6518F55D5CD5 + Resources/Schemas/UBL_v2.0/maindoc/UBL-ApplicationResponse-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/ApplicationResponseHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/ApplicationResponse201Interface/SubmitApplicationResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/ApplicationResponse201Interface/SubmitApplicationResponseResponse + + /root:ApplicationResponse/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:ApplicationResponse/cac:SenderParty/cac:PartyName/cbc:Name + + + /root:ApplicationResponse/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:ApplicationResponse/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:ApplicationResponse/cac:SenderParty/cbc:EndpointID + + + EndpointKeyType + /root:ApplicationResponse/cac:SenderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:ApplicationResponse/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_ApplicationResponse_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:ApplicationResponse/cbc:ProfileID + + + /root:ApplicationResponse/cbc:ID + + + + 68db0c6f-ec2c-44ad-b1c3-bdfae65ee5f0 + Katalog + urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2 + Catalogue + + + /root:Catalogue/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:b8a5a5d0-df9f-11dc-889a-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-Catalogue-2.0.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueResponse201Interface/SubmitCatalogueResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueResponse201Interface/SubmitCatalogueResponseRequestResponse + + /root:Catalogue/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:Catalogue/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:Catalogue/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:Catalogue/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Catalogue/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:Catalogue/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Catalogue/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_Catalogue_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:Catalogue/cbc:ProfileID + + + /root:Catalogue/cbc:ID + + + + 463984d1-4ba5-44d6-8903-565cc56dd4cb + Katalogforespørgsel + urn:oasis:names:specification:ubl:schema:xsd:CatalogueRequest-2 + CatalogueRequest + + + /root:CatalogueRequest/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:0cb0ff80-dfa0-11dc-889a-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-CatalogueRequest-2.0.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CatalogueRequest-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueRequestResponse201Interface/SubmitCatalogueRequestResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueRequestResponse201Interface/SubmitCatalogueRequestResponseResponse + + /root:CatalogueRequest/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:CatalogueRequest/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:CatalogueRequest/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueRequest/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueRequest/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueRequest/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueRequest/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_CatalogueRequest_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:CatalogueRequest/cbc:ProfileID + + + /root:CatalogueRequest/cbc:ID + + + + fb3034ea-eaaf-434b-8798-0433db497e66 + Opdatering af katalogelement + urn:oasis:names:specification:ubl:schema:xsd:CatalogueItemSpecificationUpdate-2 + CatalogueItemSpecificationUpdate + + + /root:CatalogueItemSpecificationUpdate/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:63eab5c0-dfa0-11dc-889b-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-CatalogueItemSpecificationUpdate-2.0.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CatalogueItemSpecificationUpdate-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueItemSpecificationUpdateResponse201Interface/SubmitCatalogueItemSpecificationUpdateResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueItemSpecificationUpdateResponse201Interface/SubmitCatalogueItemSpecificationUpdateResponseResponse + + /root:CatalogueItemSpecificationUpdate/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:CatalogueItemSpecificationUpdate/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:CatalogueItemSpecificationUpdate/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueItemSpecificationUpdate/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueItemSpecificationUpdate/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueItemSpecificationUpdate/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueItemSpecificationUpdate/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_CatalogueItemSpecificationUpdate_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:CatalogueItemSpecificationUpdate/cbc:ProfileID + + + /root:CatalogueItemSpecificationUpdate/cbc:ID + + + + 02092e85-c2e4-4bb2-b22d-3eec04007a36 + Opdatering af katalogpriser + urn:oasis:names:specification:ubl:schema:xsd:CataloguePricingUpdate-2 + CataloguePricingUpdate + + + /root:CataloguePricingUpdate/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:abdb2720-dfa0-11dc-889b-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-CataloguePricingUpdate-2.0.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CataloguePricingUpdate-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CataloguePricingUpdateResponse201Interface/SubmitCataloguePricingUpdateResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CataloguePricingUpdateResponse201Interface/SubmitCataloguePricingUpdateResponseResponse + + /root:CataloguePricingUpdate/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:CataloguePricingUpdate/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:CataloguePricingUpdate/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:CataloguePricingUpdate/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CataloguePricingUpdate/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:CataloguePricingUpdate/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CataloguePricingUpdate/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_CataloguePricingUpdate_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:CataloguePricingUpdate/cbc:ProfileID + + + /root:CataloguePricingUpdate/cbc:ID + + + + 0efa1c48-b5e3-4eb8-bc5f-3fbd78daba10 + Sletning af katalog + urn:oasis:names:specification:ubl:schema:xsd:CatalogueDeletion-2 + CatalogueDeletion + + + /root:CatalogueDeletion/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:40e5cbd0-dfa2-11dc-889b-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-CatalogueDeletion-2.0.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CatalogueDeletion-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueDeletionResponse201Interface/SubmitCatalogueDeletionResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CatalogueDeletionResponse201Interface/SubmitCatalogueDeletionResponseResponse + + /root:CatalogueDeletion/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:CatalogueDeletion/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:CatalogueDeletion/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueDeletion/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueDeletion/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:CatalogueDeletion/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CatalogueDeletion/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_CatalogueDeletion_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:CatalogueDeletion/cbc:ProfileID + + + /root:CatalogueDeletion/cbc:ID + + + + a25f2c30-cb5b-404d-886a-9030621f7eea + Kreditnota + urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 + CreditNote + + + /root:CreditNote/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:E4EC9613-4830-4bab-AFEE-C37AB1C67AEC + Resources/Schemas/UBL_v2.0/maindoc/UBL-CreditNote-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/CreditNoteHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CreditNote201Interface/SubmitCreditNoteRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CreditNote201Interface/SubmitCreditNoteResponse + + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CreditNote/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_CreditNote_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:CreditNote/cbc:ProfileID + + + /root:CreditNote/cbc:ID + + + + c0220657-c101-4d7d-9670-c9463e1559d5 + Faktura + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + Invoice + + + /root:Invoice/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:2e0b402a-7a5e-476b-8686-b33f54fd1f47 + Resources/Schemas/UBL_v2.0/maindoc/UBL-Invoice-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/InvoiceHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Invoice201Interface/SubmitInvoiceRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Invoice201Interface/SubmitInvoiceResponse + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_Invoice_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:Invoice/cbc:ProfileID + + + /root:Invoice/cbc:ID + + + + 5b84d1f6-f315-4a2c-a84d-095b10cc5a2c + Ordre + urn:oasis:names:specification:ubl:schema:xsd:Order-2 + Order + + + /root:Order/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:b138dc71-d301-42d1-8c2e-2c3a26faf56a + Resources/Schemas/UBL_v2.0/maindoc/UBL-Order-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/OrderHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Order-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Order201Interface/SubmitOrderRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Order201Interface/SubmitOrderResponse + + /root:Order/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Order/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Order/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Order/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Order/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Order/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Order/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_Order_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:Order/cbc:ProfileID + + + /root:Order/cbc:ID + + + + c4a09991-d038-4e51-bb06-2cdffe6c1b77 + Ordreannulering + urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2 + OrderCancellation + + + /root:OrderCancellation/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:7ba80590-dfa1-11dc-889b-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-OrderCancellation-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/OrderCancellationHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderCancellationResponse201Interface/SubmitOrderCancellationResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderCancellationResponse201Interface/SubmitOrderCancellationResponseResponse + + /root:OrderCancellation/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderCancellation/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderCancellation/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderCancellation/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderCancellation/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderCancellation/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderCancellation/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_OrderCancellation_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:OrderCancellation/cbc:ProfileID + + + /root:OrderCancellation/cbc:ID + + + + ba652e7d-e8bd-4926-8bd8-9e19a5ca23e6 + Ordrebekræftelse + urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2 + OrderResponse + + + /root:OrderResponse/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:ed6d3c40-dfa1-11dc-889b-1a827c218899 + Resources/Schemas/UBL_v2.0/maindoc/UBL-OrderResponse-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/OrderResponseHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderResponseResponse201Interface/SubmitOrderResponseResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderResponseResponse201Interface/SubmitOrderResponseResponseResponse + + /root:OrderResponse/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderResponse/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderResponse/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderResponse/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderResponse/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderResponse/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderResponse/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_OrderResponse_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:OrderResponse/cbc:ProfileID + + + /root:OrderResponse/cbc:ID + + + + 0412fdc2-5f07-4e6f-a8fd-c0dc7d780dce + Ordreændring + urn:oasis:names:specification:ubl:schema:xsd:OrderChange-2 + OrderChange + + + /root:OrderChange/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:ea4bc88f-9479-4f9b-a354-4acabdb99336 + Resources/Schemas/UBL_v2.0/maindoc/UBL-OrderChange-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/OrderChangeHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:OrderChange-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderChangeResponse201Interface/SubmitOrderChangeResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderChangeResponse201Interface/SubmitOrderChangeResponseResponse + + /root:OrderChange/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderChange/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderChange/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderChange/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderChange/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderChange/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderChange/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_OrderChange_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:OrderChange/cbc:ProfileID + + + /root:OrderChange/cbc:ID + + + + c8577e35-7de6-49f6-926c-c061f5a7d1b6 + Simpel ordrebekræftelse + urn:oasis:names:specification:ubl:schema:xsd:OrderResponseSimple-2 + OrderResponseSimple + + + /root:OrderResponseSimple/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:3B0B1309-B575-4d69-9C8F-4126C53CD7B0 + Resources/Schemas/UBL_v2.0/maindoc/UBL-OrderResponseSimple-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/OrderResponseSimpleHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:OrderResponseSimple-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderResponseSimple201Interface/SubmitOrderResponseSimpleRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderResponseSimple201Interface/SubmitOrderResponseSimpleResponse + + /root:OrderResponseSimple/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderResponseSimple/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:OrderResponseSimple/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderResponseSimple/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderResponseSimple/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:OrderResponseSimple/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:OrderResponseSimple/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_OrderResponseSimple_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:OrderResponseSimple/cbc:ProfileID + + + /root:OrderResponseSimple/cbc:ID + + + + b552710b-e4c2-44f6-a89e-1b158375b5f3 + Rykker + urn:oasis:names:specification:ubl:schema:xsd:Reminder-2 + Reminder + + + /root:Reminder/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:4FBBBDEF-0A8E-4d5e-9B9D-23C8FD98E9CE + Resources/Schemas/UBL_v2.0/maindoc/UBL-Reminder-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/ReminderHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Reminder-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Reminder201Interface/SubmitReminderRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/Reminder201Interface/SubmitReminderResponse + + /root:Reminder/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Reminder/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Reminder/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Reminder/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Reminder/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Reminder/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Reminder/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_Reminder_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:Reminder/cbc:ProfileID + + + /root:Reminder/cbc:ID + + + + 76c4f0fa-e969-4360-9a04-8de3c675d4f2 + KontoUdtog + urn:oasis:names:specification:ubl:schema:xsd:Statement-2 + Statement + + + /root:Statement/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:4e383840-bcfc-11dc-a81b-bfc65441a808 + Resources/Schemas/UBL_v2.0/maindoc/UBL-Statement-2.0.xsd + Resources/UI/OIOUBL/Stylesheets/StatementHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Statement-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/StatementResponse201Interface/SubmitStatementResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/StatementResponse201Interface/SubmitStatementResponseResponse + + /root:Statement/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Statement/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Statement/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Statement/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Statement/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Statement/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Statement/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_Statement_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:Statement/cbc:ProfileID + + + /root:Statement/cbc:ID + + + + eee3da84-27b7-4b37-81b1-cfb9d2942a00 + Forsynings Specifikation + urn:oioubl:names:specification:oioubl:schema:xsd:UtilityStatement-2 + UtilityStatement + + + /root:UtilityStatement/cbc:CustomizationID + OIOUBL-2.0(1|2) + + + uddi:236f277d-a786-4724-a16e-26398b685a07 + Resources/Schemas/OIOUBL_v2.1-b/maindoc/UBL-UtilityStatement-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/UtilityStatementHTML.xsl + + + urn:oioubl:names:specification:oioubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oioubl:names:specification:oioubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oioubl:names:specification:oioubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oioubl:names:specification:oioubl:schema:xsd:UtilityStatement-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/UtilityStatement201Interface/SubmitUtilityStatementRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/UtilityStatement201Interface/SubmitUtilityStatementResponse + + /root:UtilityStatement/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:UtilityStatement/cac:SenderParty/cac:PartyName/cbc:Name + + + /root:UtilityStatement/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:UtilityStatement/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:UtilityStatement/cac:SenderParty/cbc:EndpointID + + + EndpointKeyType + /root:UtilityStatement/cac:SenderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:UtilityStatement/cbc:ProfileID + + + + + + Resources/Schematrons/OIOUBL/OIOUBL_UtilityStatement_Schematron.xsl + /Schematron/Error + /Schematron/Error/Description + + + + + + + /root:UtilityStatement/cbc:ProfileID + + + /root:UtilityStatement/cbc:ID + + + + + + 24750a44-9a18-46f4-85ef-50f00c90068b + PEPPOL Catalogue + urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2 + Catalogue + + + /root:Catalogue/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns019:ver2.0:extended:urn:www.peppol.eu:bis:peppol1a:ver4.0 + + + uddi:6c917ef1-5143-4123-879a-471215dbd373 + Resources/Schemas/UBL_v2.1/maindoc/UBL-Catalogue-2.1.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CataloguePeppol1aInterface/SubmitCataloguRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CataloguePeppol1aInterface/SubmitCatalogueResponse + + /root:Catalogue/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:Catalogue/cac:ProviderParty/cac:PartyName/cbc:Name + + + /root:Catalogue/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:Catalogue/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Catalogue/cac:ProviderParty/cbc:EndpointID + + + EndpointKeyType + /root:Catalogue/cac:ProviderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Catalogue/cbc:ProfileID + + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/BIIRULES-UBL-T19.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/OPENPEPPOLCORE-UBL-T19.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/OPENPEPPOL-UBL-T19.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:Catalogue/cbc:ProfileID + + + /root:Catalogue/cbc:ID + + + + + + 551e8437-f543-46cf-bd56-492a25e723fc + Applikationsmeddelse (PEPPOL) + urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 + ApplicationResponse + + + /root:ApplicationResponse/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns058:ver2.0:extended:urn:www.peppol.eu:bis:peppol1a:ver2.0 + + + uddi:e79dd402-8f60-4811-9f59-1acb0c036d05 + Resources/Schemas/UBL_v2.1/maindoc/UBL-ApplicationResponse-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/ApplicationResponseHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/ApplicationResponsePeppol1aInterface/SubmitApplicationResponseRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/ApplicationResponsePeppol1aInterface/SubmitApplicationResponseResponse + + /root:ApplicationResponse/cac:ReceiverParty/cac:PartyName/cbc:Name + + + /root:ApplicationResponse/cac:SenderParty/cac:PartyName/cbc:Name + + + /root:ApplicationResponse/cac:ReceiverParty/cbc:EndpointID + + + EndpointKeyType + /root:ApplicationResponse/cac:ReceiverParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:ApplicationResponse/cac:SenderParty/cbc:EndpointID + + + EndpointKeyType + /root:ApplicationResponse/cac:SenderParty/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:ApplicationResponse/cbc:ProfileID + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/BIIRULES-UBL-T58.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/OPENPEPPOLCORE-UBL-T58.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-catalogue1a/XSLT/OPENPEPPOL-UBL-T58.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:ApplicationResponse/cbc:ProfileID + + + /root:ApplicationResponse/cbc:ID + + + + + + 21671b33-58a2-4ab5-96bd-42f6c4f22af6 + Kreditnota (PEPPOL) + urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 + CreditNote + + + /root:CreditNote/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns014:ver2.0:extended:urn:www.peppol.eu:bis:peppol5a:ver2.0 + + + uddi:4db3f358-6184-4979-bbc9-5d65aee27132 + Resources/Schemas/UBL_v2.1/maindoc/UBL-CreditNote-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/CreditNoteHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CreditNotePeppol5aInterface/SubmitCreditNoteRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/CreditNotePeppol5aInterface/SubmitCreditNoteResponse + + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:CreditNote/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:CreditNote/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:CreditNote/cbc:ProfileID + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-billing5a/XSLT/BIIRULES-UBL-T14.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-billing5a/XSLT/OPENPEPPOLCORE-UBL-T14.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-billing5a/XSLT/OPENPEPPOL-UBL-T14.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:CreditNote/cbc:ProfileID + + + /root:CreditNote/cbc:ID + + + + + + c9f45e05-8cc0-44df-ab1e-111c5167b0b5 + Faktura (PEPPOL) + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + Invoice + + + /root:Invoice/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol5a:ver2.0 + + + uddi:ea27f0c4-cb68-4e39-b0eb-5c96af8c1759 + Resources/Schemas/UBL_v2.1/maindoc/UBL-Invoice-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/InvoiceHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/InvoicePeppol4aInterface/SubmitInvoiceRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/InvoicePeppol4aInterface/SubmitInvoiceResponse + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cbc:ProfileID + + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/BIIRULES-UBL-T10.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/OPENPEPPOLCORE-UBL-T10.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/OPENPEPPOL-UBL-T10.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:Invoice/cbc:ProfileID + + + /root:Invoice/cbc:ID + + + + + + 9e8b18e5-416e-4c41-9b9f-adadc3de6598 + Forsendelsesadvis + urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2 + DespatchAdvice + + + /root:DespatchAdvice/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns016:ver1.0:extended:urn:www.peppol.eu:bis:peppol30a:ver1.0 + + + uddi:96dbec86-aa58-4f1e-ae03-ebb13079ce61 + Resources/Schemas/UBL_v2.1/maindoc/UBL-DespatchAdvice-2.1.xsd + + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2 + root + + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2014/09/15/DespatchAdvice10Interface/SubmitDespatchAdviceRequest + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2014/09/15/DespatchAdvice10Interface/SubmitDespatchAdviceResponse + + + /root:DespatchAdvice/cac:DeliveryCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:DespatchAdvice/cac:DespatchSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:DespatchAdvice/cac:DeliveryCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:DespatchAdvice/cac:DeliveryCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:DespatchAdvice/cac:DespatchSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:DespatchAdvice/cac:DespatchSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:DespatchAdvice/cbc:ProfileID + + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-despatchadvice30a/XSLT/BIIRULES-UBL-T16.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + Resources/Schematrons/PEPPOL/BIS2.0-despatchadvice30a/XSLT/OPENPEPPOLCORE-UBL-T16.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-despatchadvice30a/XSLT/OPENPEPPOL-UBL-T16.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:DespatchAdvice/cbc:ProfileID + + + /root:DespatchAdvice/cbc:ID + + + + + + c1061668-0549-452c-b0cb-7d6428fdc5f7 + Faktura (PEPPOL) + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + Invoice + + + /root:Invoice/cbc:CustomizationID + urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0 + + + uddi:e956ca42-0be2-487a-8573-580b523c248d + Resources/Schemas/UBL_v2.1/maindoc/UBL-Invoice-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/InvoiceHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/InvoicePeppol4aInterface/SubmitInvoiceRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/InvoicePeppol4aInterface/SubmitInvoiceResponse + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Invoice/cbc:ProfileID + + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/BIIRULES-UBL-T10.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/OPENPEPPOLCORE-UBL-T10.xsl + + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-invoice4a/XSLT/OPENPEPPOL-UBL-T10.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:Invoice/cbc:ProfileID + + + /root:Invoice/cbc:ID + + + + + + db2f9050-2adb-49c2-8f05-af9e440d12ca + Ordre (PEPPOL) + urn:oasis:names:specification:ubl:schema:xsd:Order-2 + Order + + + /root:Order/cbc:CustomizationID + + urn:www.cenbii.eu:transaction:biitrns001:ver2.0:extended:urn:www.peppol.eu:bis:peppol3a:ver2.0 + + + + uddi:873c25f6-23d2-4019-830e-89cc89386930 + Resources/Schemas/UBL_v2.1/maindoc/UBL-Order-2.1.xsd + Resources/UI/OIOUBL/Stylesheets/OrderHTML.xsl + + + urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 + cac + + + urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 + cbc + + + urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2 + ccts + + + urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2 + sdt + + + urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 + udt + + + urn:oasis:names:specification:ubl:schema:xsd:Order-2 + root + + + + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderPeppol3aInterface/SubmitOrderRequest + http://rep.oio.dk/oiosi.ehandel.gov.dk/xml/schemas/2007/09/01/OrderPeppol3aInterface/SubmitOrderResponse + + /root:Order/cac:SellerSupplierParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Order/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name + + + /root:Order/cac:SellerSupplierParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Order/cac:SellerSupplierParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Order/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID + + + EndpointKeyType + /root:Order/cac:BuyerCustomerParty/cac:Party/cbc:EndpointID/@schemeID + + + GLN + ean + + + DK:CVR + cvr + + + DK:CPR + cpr + + + + + + + /root:Order/cbc:ProfileID + + + + + + Resources/Schematrons/PEPPOL/BIS2.0-order3a/XSLT/BIICORE-UBL-T01-V1.0.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-order3a/XSLT/BIIRULES-UBL-T01.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + Resources/Schematrons/PEPPOL/BIS2.0-order3a/XSLT/OPENPEPPOL-UBL-T01.xsl + /svrl:schematron-output/svrl:failed-assert[@flag='fatal'] + /svrl:schematron-output/svrl:failed-assert[@flag='fatal']/svrl:text + + + + + + + /root:Order/cbc:ProfileID + + + /root:Order/cbc:ID + + + + + + + + Catalogue-CatBas-1.0 + uddi:4697A391-741F-4534-A21E-8F0A460013BB + + + Catalogue-CatBasR-1.0 + uddi:03717C45-27A8-453f-833C-BD4D8AAB9675 + + + Catalogue-CatSim-1.0 + uddi:BE9F86E6-03C0-4d00-A3EE-44FC29EB3882 + + + Catalogue-CatSimR-1.0 + uddi:48277C4B-489F-498d-8246-303A9867C081 + + + Catalogue-CatExt-1.0 + uddi:1C8E9102-6711-42e8-A35A-997C56A35BFE + + + Catalogue-CatExtR-1.0 + uddi:0B864A5A-5E1E-47da-AD3B-A3932F82DA37 + + + Catalogue-CatAdv-1.0 + uddi:7B7909C1-5DE4-4630-A741-C74A9DDDC6AB + + + Catalogue-CatAdvR-1.0 + uddi:EE7F4AEA-BFDC-4886-8C5E-319596E46DA5 + + + Procurement-BilSim-1.0 + uddi:362229ac-b657-452a-b8f8-c93e62c670ff + + + Procurement-BilSimR-1.0 + uddi:98070e14-ee30-4b10-84ef-986cde3b8116 + + + Procurement-PayBas-1.0 + uddi:E5D505C0-4B52-4485-8169-4AB5343559A5 + + + Procurement-PayBasR-1.0 + uddi:FED5F809-64EC-4523-BC57-4A57D5680DA9 + + + Procurement-OrdSim-BilSim-1.0 + uddi:142C4188-3D53-440d-A64F-68D7C3B9A59B + + + Procurement-OrdSimR-BilSimR-1.0 + uddi:1e1b209e-7b8d-4f1e-8f2a-f3d9a94d1086 + + + Procurement-OrdSim-BilSimR-1.0 + uddi:7A638D35-3E08-432e-B558-74CB85889905 + + + Procurement-OrdSimR-BilSim-1.0 + uddi:EBABEE8B-A5D3-4dc9-B976-3AAFF9A4E855 + + + Procurement-OrdAdv-BilSim-1.0 + uddi:88FBD6D5-6A25-4c08-91CC-5344C73C4D69 + + + Procurement-OrdAdv-BilSimR-1.0 + uddi:76897296-08aa-4848-a933-ae068b4c604e + + + Procurement-OrdAdvR-BilSim-1.0 + uddi:1d01dd98-a302-4897-92d8-fd501447c450 + + + Procurement-OrdAdvR-BilSimR-1.0 + uddi:b23940b1-d571-4640-8830-9b7f34809fbc + + + Procurement-OrdSel-BilSim-1.0 + uddi:46D94D6B-E835-4916-BBB5-F27DC655876A + + + Procurement-OrdSel-BilSimR-1.0 + uddi:42AD3EDE-BBD4-434d-AAE6-044CE3EF8D1F + + + urn:www.nesubl.eu:profiles:profile1:ver2.0 + uddi:FC1D4A1C-1538-4bdb-A718-2EFD712256C5 + + + urn:www.nesubl.eu:profiles:profile2:ver2.0 + uddi:3A3BFE67-AD35-43f0-9AE7-CDF268AE221D + + + urn:www.nesubl.eu:profiles:profile3:ver2.0 + uddi:F5231EDB-FBB4-4a3b-A46C-3BCF1B3C3F35 + + + + + + + urn:www.nesubl.eu:profiles:profile5:ver2.0 + uddi:aee8b6de-298f-4cbc-a96d-9ae8aed0ac31 + + + + + + + urn:www.nesubl.eu:profiles:profile7:ver2.0 + uddi:BB0B4FD4-F6AF-489f-98D9-7130424E7F8D + + + urn:www.nesubl.eu:profiles:profile8:ver2.0 + uddi:F4240370-CCA6-401e-9B5B-4531F413421D + + + Reference-Utility-1.0 + uddi:570b3009-3f9f-46d2-b533-31d0bb4a37a0 + + + Reference-UtilityR-1.0 + uddi:1bfd82e6-0eca-47df-9230-37b97c9788c6 + + + Catalogue-CatPriUpd-1.0 + uddi:a7f4c627-d459-4ef2-a132-fc6df0971db1 + + + Catalogue-CatPriUpdR-1.0 + uddi:fc5313f8-19e0-408b-85ca-87c364f2a41c + + + Procurement-OrdSim-1.0 + uddi:5f2d93a7-bdb7-4543-b667-ba71192e5c5f + + + Procurement-OrdSimR-1.0 + uddi:7fe5938c-1b3a-403c-8155-039b49a06cef + + + Procurement-TecRes-1.0 + uddi:ce80ccce-3ef9-47ea-8cf4-120913a87dc2 + + + Reference-Attachment-1.0 + uddi:10faffb1-1303-485e-924a-e8b551f31949 + + + urn:www.cenbii.eu:profile:bii04:ver2.0 + uddi:553e78e6-7de4-4926-8384-53ef82566560 + + + + + + + urn:www.cenbii.eu:profile:bii01:ver2.0 + uddi:c7cb8dd0-af00-42c6-a8b7-48204aa7b30f + + + urn:www.cenbii.eu:profile:bii30:ver2.0 + uddi:19ec7bb2-a39b-438c-a6ce-2124d6148f8f + + + urn:www.cenbii.eu:profile:bii05:ver2.0 + uddi:8dde0481-9055-41fe-94f7-5102ce3672e7 + + + urn:www.cenbii.eu:profile:bii03:ver2.0 + uddi:90043120-5eab-468c-be4a-5562d95a73a7 + + + + + + + + + + dk.gov.oiosi.security.ldap.LdapCertificateLookup + + + + crtdir.certifikat.dk + 389 + 5000 + 5000 + 5000 + 1 + + + + dk.gov.oiosi.security.revocation.crl.CrlLookup + + + 20000 + + + dk.gov.oiosi.uddi.UddiLookupClient + + + dk.gov.oiosi.uddi.RegistryLookupClient + + + 15 + noMoreThanOneSetOrFail + + + + + http://discoverypublic.nemhandel.dk/uddi/services/inquiry + http://discoverybackup.nemhandel-backup.dk/uddi/services/inquiry + + + + + + + + + + + + + + + dk.gov.oiosi.common.cache.TimedCache + dk.gov.oiosi.RaspLibrary + + + validityTimeInHours + 4 + + + frequencyInMinutes + 60 + + + + + + dk.gov.oiosi.common.cache.LeastFrequentlyUsedQuantityCache + dk.gov.oiosi.RaspLibrary + + + maxSize + 100 + + + onFailureRetryIntervalMinutes + 1 + + + + + + dk.gov.oiosi.common.cache.TimedCache + dk.gov.oiosi.RaspLibrary + + + validityTimeInHours + 4 + + + frequencyInMinutes + 60 + + + + + + dk.gov.oiosi.common.cache.TimedCache + dk.gov.oiosi.RaspLibrary + + + validityTimeInHours + 24 + + + frequencyInHours + 1 + + + + + + dk.gov.oiosi.common.cache.TimedCache + dk.gov.oiosi.RaspLibrary + + + validityTimeInHours + 24 + + + frequencyInHours + 1 + + + + + + dk.gov.oiosi.common.cache.LeastFrequentlyUsedQuantityCache + dk.gov.oiosi.RaspLibrary + + + maxSize + 100 + + + + + + + + + + + + + ./Resources/Certificates/Live/Root/OCES_root_Prod.jks + Test1234 + ca + + + + + + PID + + + RID + + + UID + + + FID + + + + ./cfg/policy.Live.xml + ./cfg/axis2.Live.xml + repository + + + + + + false + 5000 + 5 + + + + + + diff --git a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/InitServlet.java b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/InitServlet.java index cd1759ffdee3d4291da788682afca38461ed4165..504dc235b9d807a9d6423bdb834e98b51de837b6 100644 --- a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/InitServlet.java +++ b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/InitServlet.java @@ -1,34 +1,31 @@ package dk.firma.webservice; +import dk.gov.oiosi.configuration.ConfigurationHandler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; -import dk.gov.oiosi.configuration.ConfigurationHandler; -import org.apache.log4j.Logger; - - /** * Shows how to invoke startup tasks, configured in RaspConfiguration.xml. - * + *

* This servlet should be defined in web.xml as first one to load (see web.xml in this project): - * - * @author Dmitriy Lapko, TrueLink A/S */ public class InitServlet extends HttpServlet { - private static final long serialVersionUID = -4515457543862567508L; - - private static final Logger log = Logger.getLogger(InitServlet.class); + private static final long serialVersionUID = -4515457543862567508L; - public void init(ServletConfig arg0) throws ServletException { - super.init(arg0); + private final Log log = LogFactory.getLog(InitServlet.class); - try { - ConfigurationHandler.getInstance().executeStartupTasks(); - } catch (Throwable e) { - log.error("OIORASP ConfigurationHandler failed to execute startup tasks", e); - } - } + public void init(ServletConfig arg0) throws ServletException { + super.init(arg0); -} \ No newline at end of file + try { + ConfigurationHandler.getInstance().executeStartupTasks(); + } catch (Throwable e) { + log.error("OIORASP ConfigurationHandler failed to execute startup tasks", e); + } + } +} diff --git a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/MyWebService.java b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/MyWebService.java index f75ea59f550e3bcf9f58772bc59880c68b8e396e..a3ad10ce42a373aa2ba308cd777088da70a6f003 100644 --- a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/MyWebService.java +++ b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/MyWebService.java @@ -13,7 +13,7 @@ * The Original Code is Java RASP toolkit. * * The Initial Developer of the Original Code is Lenio. Portions - * created by Lenio are Copyright (C) 2007 Danish National IT and + * created by Lenio are Copyright (C) 2007 Danish National IT and * Telecom Agency (http://www.itst.dk). All Rights Reserved. * * Contributor(s): @@ -71,7 +71,7 @@ public class MyWebService implements IServiceContract { * In a real world scenario received message ids should be persisted, * so that they are not lost if the web service is restarted. */ - private static Set receivedGUIDs = new HashSet(); + private static final Set receivedGUIDs = new HashSet(); public OiosiMessage requestRespond(OiosiMessage message) throws MainException { @@ -84,9 +84,6 @@ public class MyWebService implements IServiceContract { // Use payload here. In this example we simply print it out. System.out.println(payload.getOMDocument()); -// } -// else { - //The document was a duplicate. It should therefore not be used. } // Show the signature validation proof @@ -109,4 +106,4 @@ public class MyWebService implements IServiceContract { return replyMessage; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/PasswordCallback.java b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/PasswordCallback.java index ff998c365e1481a22994c6422520b183ffa8e81b..ad05ce69897aea1b704f6a7b2a4aebfe8cb03297 100644 --- a/dk.gov.oiosi.examples.service/src/dk/firma/webservice/PasswordCallback.java +++ b/dk.gov.oiosi.examples.service/src/dk/firma/webservice/PasswordCallback.java @@ -13,7 +13,7 @@ * The Original Code is Java RASP toolkit. * * The Initial Developer of the Original Code is Lenio. Portions - * created by Lenio are Copyright (C) 2007 Danish National IT and + * created by Lenio are Copyright (C) 2007 Danish National IT and * Telecom Agency (http://www.itst.dk). All Rights Reserved. * * Contributor(s): @@ -29,7 +29,6 @@ * Mikkel Hippe Brun, ITST * Finn Hartmann Jordal, ITST * Christian Lanng, ITST - * */ package dk.firma.webservice; @@ -50,8 +49,6 @@ public class PasswordCallback implements CallbackHandler { * Always return Test1234 for password. * * @param callbacks callbacks - * @throws java.io.IOException - * @throws javax.security.auth.callback.UnsupportedCallbackException */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { @@ -61,4 +58,4 @@ public class PasswordCallback implements CallbackHandler { } } } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/.idea/misc.xml b/dk.gov.oiosi.library/.idea/misc.xml index b0b39a462a7cdf15e459a29344cd2e90073b7312..6300ca8043bc92cc9cae5a872d6611926a25f0ad 100644 --- a/dk.gov.oiosi.library/.idea/misc.xml +++ b/dk.gov.oiosi.library/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/dk.gov.oiosi.library/build.xml b/dk.gov.oiosi.library/build.xml index 330bcc7c8ba7b8a8782f8fcea5f0f05cc4be9319..4001afa8166afb780da41475a2cf586ab85ebae2 100644 --- a/dk.gov.oiosi.library/build.xml +++ b/dk.gov.oiosi.library/build.xml @@ -101,10 +101,11 @@ deprecation="on" optimize="off" encoding="UTF8" - includeantruntime="false"> - - - + includeantruntime="false" + > + + + diff --git a/dk.gov.oiosi.library/doc/Git-readme.txt b/dk.gov.oiosi.library/doc/Git-readme.txt index 2ad7ec6b8f090eb3f5b61fc8df7c2ae3049c273e..3d403eedd9d6e7c712f10f56e0f75713a206fc84 100644 --- a/dk.gov.oiosi.library/doc/Git-readme.txt +++ b/dk.gov.oiosi.library/doc/Git-readme.txt @@ -17,8 +17,6 @@ TO-DO: To add (first time) the common project as a submodule dir to this project, goto to project root. Execute: $ git submodule add https://rep.erst.dk/git/openebusiness/common.git common - -Later, call: $ git submodule init to init the submodule(s) after first checkout. diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/Identifier.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/Identifier.java index e9bd2242bcc0d6bca4508512daee0390d4657a67..35a0ffa0c06eddfbfd5f241b980cc6595b90837d 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/Identifier.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/Identifier.java @@ -20,7 +20,6 @@ package dk.gov.oiosi.addressing; import dk.gov.oiosi.exception.NullOrEmptyArgumentException; - /** * Identifier. */ @@ -52,9 +51,9 @@ public class Identifier { */ void verifyInput() { if (value == null || value.isEmpty()) { - throw new NullOrEmptyArgumentException("Value/key is empty"); + throw new NullOrEmptyArgumentException("E-RSP33001: Value/key is empty"); } else if (value.trim().contains(" ")) { - throw new IncorrectBusinessIdentifierException("Space not allowed in Identifier value"); + throw new IncorrectBusinessIdentifierException("E-RSP33002: Space not allowed in Identifier value"); } // For Type=DK:CVR, strip DK from start (if present) diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/IncorrectSerialNumberException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/IncorrectSerialNumberException.java old mode 100755 new mode 100644 index 5d4eb8f671c878edbec5d73c481e785e87ed03e0..3069988650b9357e8e2d7f6b2bea9a2cd0029d4f --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/IncorrectSerialNumberException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/addressing/IncorrectSerialNumberException.java @@ -1,53 +1,53 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this - * file except in compliance with the License. You may obtain - * a copy of the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an - * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express - * or implied. See the License for the specific language governing - * rights and limitations under the License. - * - * - * The Original Code is Java RASP toolkit. - * - * The Initial Developer of the Original Code is Lenio. Portions - * created by Lenio are Copyright (C) 2007 Danish National IT and - * Telecom Agency (http://www.itst.dk). All Rights Reserved. - */ - -package dk.gov.oiosi.addressing; - - -/** - * IncorrectSerialNumberException. - */ -public class IncorrectSerialNumberException extends IncorrectBusinessIdentifierException { - - /** - * serialVersionUID. - */ - private static final long serialVersionUID = 4L; - - /** - * IncorrectSerialNumberException. - * - * @param s - * message - */ - public IncorrectSerialNumberException(final String s) { - super(s); - } - - /** - * IncorrectSerialNumberException. - * - * @param s - * message - */ - public IncorrectSerialNumberException(final String s, final Throwable e) { - super(s, e); - } - -} +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this + * file except in compliance with the License. You may obtain + * a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language governing + * rights and limitations under the License. + * + * + * The Original Code is Java RASP toolkit. + * + * The Initial Developer of the Original Code is Lenio. Portions + * created by Lenio are Copyright (C) 2007 Danish National IT and + * Telecom Agency (http://www.itst.dk). All Rights Reserved. + */ + +package dk.gov.oiosi.addressing; + + +/** + * IncorrectSerialNumberException. + */ +public class IncorrectSerialNumberException extends IncorrectBusinessIdentifierException { + + /** + * serialVersionUID. + */ + private static final long serialVersionUID = 4L; + + /** + * IncorrectSerialNumberException. + * + * @param s + * message + */ + public IncorrectSerialNumberException(final String s) { + super(s); + } + + /** + * IncorrectSerialNumberException. + * + * @param s + * message + */ + public IncorrectSerialNumberException(final String s, final Throwable e) { + super(s, e); + } + +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/OioraspPolicyBasedResultsValidator.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/OioraspPolicyBasedResultsValidator.java index 3482acac8cde1eb543effd097fa15c1448cba174..3ff71f528728eb4ba49f8382b5516ccddaec8cd4 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/OioraspPolicyBasedResultsValidator.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/OioraspPolicyBasedResultsValidator.java @@ -51,7 +51,7 @@ public class OioraspPolicyBasedResultsValidator extends PolicyBasedResultsValida rmd.getPolicyData().getRampartConfig(), rmd.getCustomClassLoader()).getAliasForX509Cert(issuerString, issuerSerial); } catch (WSSecurityException ex) { - throw new RampartException("cannotFindAliasForCert", new String[]{subjectString}, ex); + throw new RampartException("E-RSP12001: cannotFindAliasForCert", new String[]{subjectString}, ex); } if (alias != null) { @@ -61,7 +61,7 @@ public class OioraspPolicyBasedResultsValidator extends PolicyBasedResultsValida rmd.getPolicyData().getRampartConfig(), rmd.getCustomClassLoader()).getCertificates(alias); } catch (WSSecurityException ex) { - throw new RampartException("noCertForAlias", new String[]{alias}, ex); + throw new RampartException("E-RSP12002: noCertForAlias", new String[]{alias}, ex); } // If certificates have been found, the certificates must be compared @@ -120,7 +120,7 @@ public class OioraspPolicyBasedResultsValidator extends PolicyBasedResultsValida rmd.getPolicyData().getRampartConfig(), rmd.getCustomClassLoader()).getAliasesForDN(issuerString); } catch (WSSecurityException ex) { - throw new RampartException("cannotFindAliasForCert", new String[]{issuerString}, ex); + throw new RampartException("E-RSP12001: cannotFindAliasForCert", new String[]{issuerString}, ex); } // If the alias has not been found, the issuer is not in the keystore @@ -178,13 +178,13 @@ public class OioraspPolicyBasedResultsValidator extends PolicyBasedResultsValida try { certs = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(), rmd.getCustomClassLoader()).getCertificates(alias); } catch (WSSecurityException ex) { - throw new RampartException("noCertForAlias", new String[]{alias}, ex); + throw new RampartException("E-RSP12002: noCertForAlias", new String[]{alias}, ex); } // If no certificates have been found, there has to be an error: // The keystore can find an alias but no certificate(s) if (certs == null || certs.length < 1) { - throw new RampartException("noCertForAlias", new String[]{alias}); + throw new RampartException("E-RSP12002: noCertForAlias", new String[]{alias}); } // Form a certificate chain from the transmitted certificate and the certificate(s) of the issuer from the keystore @@ -216,7 +216,7 @@ public class OioraspPolicyBasedResultsValidator extends PolicyBasedResultsValida return true; } } catch (WSSecurityException e) { - log.error("Validation of [" + subjectString + "] gave: " + e.getMessage(), e); + log.error("E-RSP12004: Validation of [" + subjectString + "] gave: " + e.getMessage(), e); throw new RampartException("certPathVerificationFailed", new String[]{subjectString}, e); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/RaspHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/RaspHandler.java index a301f518c4627e4f622631cb34379d1470a59c0d..ed125e9cd838884fbdd395cc7f16d6bc45fda9fe 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/RaspHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/RaspHandler.java @@ -94,7 +94,7 @@ public abstract class RaspHandler implements Handler { } } } catch (Exception e) { - log.error("Failed to initialize OIOSIPolicyBean - use default values: " + e.getMessage(), e); + log.error("E-RSP12011: Failed to initialize OIOSIPolicyBean - use default values: " + e.getMessage(), e); } // Save for this message context... diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/customheaders/CustomHeaderInHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/customheaders/CustomHeaderInHandler.java index 63ce964705203950cf5dddd470777a6cc3560ecc..4f24efb1a92a79bf8473fdb1b5641fb35be58183 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/customheaders/CustomHeaderInHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/customheaders/CustomHeaderInHandler.java @@ -197,7 +197,7 @@ public class CustomHeaderInHandler extends RaspHandler { // Enforce mandatory headers if ((!foundIdentifier && !rmMessage) || !foundReceiverID || !foundSenderID) { - String msg = "Message receiver without mandatory Rasp Headers (identifier=" + foundIdentifier + ", sender=" + foundSenderID + ", receiver=" + foundReceiverID + ")."; + String msg = "W-RSP12021: Message receiver without mandatory Rasp Headers (identifier=" + foundIdentifier + ", sender=" + foundSenderID + ", receiver=" + foundReceiverID + ")."; log.warn(msg); MainException e = new MainException(msg); e.setReceiverError(false); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/signatureproof/SignatureProofHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/signatureproof/SignatureProofHandler.java index d856b1aa4bf5fc17b12d8861c801643dae37a68b..57a13a5be71148a1797c744f4678bec89d7a8471 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/signatureproof/SignatureProofHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/signatureproof/SignatureProofHandler.java @@ -75,18 +75,18 @@ public class SignatureProofHandler extends RaspHandler { OiosiPolicyBean oiosiPolicyBean = getPolicyBean(msgContext); if (!oiosiPolicyBean.doSignatureProof()) { - log.warn("SignatureProofHandler not activated. Check your policy configuration."); + log.warn("W-RSP12031: SignatureProofHandler not activated. Check your policy configuration."); return InvocationResponse.CONTINUE; } if (!msgContext.isEngaged(RaspModule.MODULE_NAME)) { - log.error("SignatureProofHandler is missing prerequisite: Rasp module not engaged"); + log.error("E-RSP12032: SignatureProofHandler is missing prerequisite: Rasp module not engaged"); // return InvocationResponse.ABORT; throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Receiver, "SignatureProofHandler is missing prerequisite: Rasp module not engaged"); } if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) { - log.error("SignatureProofHandler is missing prerequisite: Security module not engaged"); + log.error("E-RSP12033: SignatureProofHandler is missing prerequisite: Security module not engaged"); // return InvocationResponse.ABORT; throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Receiver, "SignatureProofHandler is missing prerequisite: Security module not engaged"); } @@ -98,14 +98,14 @@ public class SignatureProofHandler extends RaspHandler { Object recv_results = msgContext.getProperty(WSHandlerConstants.RECV_RESULTS); if (recv_results == null) { - log.error("The received result was null"); + log.error("E-RSP12034: The received result was null"); // return InvocationResponse.ABORT; throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Receiver, "The received result was null"); } X509Certificate signerCertificate = AxisWSSUtil.getCertificateFrom_RECV_RESULTS(recv_results); if (signerCertificate == null) { - log.error("Could not read/find any signer certificate"); + log.error("E-RSP12035: Could not read/find any signer certificate"); //return InvocationResponse.ABORT; throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Receiver, "Could not read/find any signer certificate"); } @@ -128,7 +128,7 @@ public class SignatureProofHandler extends RaspHandler { if (response.isValid()) { passedRevocation = true; } else { - log.warn("Certificate is not valid [" + signerCertificate.getSubjectDN() + "]"); + log.warn("W-RSP12036: Certificate is not valid [" + signerCertificate.getSubjectDN() + "]"); throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Sender, "Certificate is not valid [" + signerCertificate.getSubjectDN() + "]"); } } catch (AxisFault exception) { @@ -137,10 +137,10 @@ public class SignatureProofHandler extends RaspHandler { // log.warn("Validation of certificate failed " + signerCertificate.getSubjectX500Principal() + ": " + e.getMessage(), e); // throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (MainException e) { - log.warn("Validation of certificate failed " + signerCertificate.getSubjectX500Principal() + ": " + e.getMessage(), e); + log.warn("W-RSP12037: Validation of certificate failed " + signerCertificate.getSubjectX500Principal() + ": " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (Exception e) { - log.warn("Could not validate incoming signer certificate: " + e.getMessage(), e); + log.warn("W-RSP12038: Could not validate incoming signer certificate: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Receiver, "Could not validate incoming signer certificate: " + e.getMessage()); } @@ -148,10 +148,10 @@ public class SignatureProofHandler extends RaspHandler { CertificateValidator.validateCertificate(signerCertificate); passedValidation = true; } catch (CertificateNotActiveException e) { - log.warn("Incoming certificate not valid yet: " + signerCertificate.getSubjectX500Principal(), e); + log.warn("W-RSP12039: Incoming certificate not valid yet: " + signerCertificate.getSubjectX500Principal(), e); throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Sender, "Sender certificate is not active"); } catch (CertificateExpiredException e) { - log.warn("Incoming certificate is expired: " + signerCertificate.getSubjectX500Principal(), e); + log.warn("W-RSP12040: Incoming certificate is expired: " + signerCertificate.getSubjectX500Principal(), e); throw AxisFaultUtil.buildAxisFault(msgContext, OiosiInnerFaultCode.SignatureNotValidFault, OiosiFaultCode.Sender, "Sender certificate has expired"); } @@ -178,7 +178,7 @@ public class SignatureProofHandler extends RaspHandler { msgContext.setProperty(Constants.RASP_SIGNATURE_PROOF, signatureProof); } catch (SignatureValidationProofAllreadyCompletedException thisShouldNotHappen) { - log.error("SignatureProof could not be created: " + thisShouldNotHappen, thisShouldNotHappen); + log.error("E-RSP12041: SignatureProof could not be created: " + thisShouldNotHappen, thisShouldNotHappen); throw AxisFaultUtil.buildAxisFault(msgContext, thisShouldNotHappen); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchemaHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchemaHandler.java index 8b17f651ae06d69eab981cd69ede60996567a781..8ab1d2a2b0bc1c35423a1a38a0676c2cc09e4f72 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchemaHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchemaHandler.java @@ -105,10 +105,10 @@ public class SchemaHandler extends RaspHandler { DocumentTypeConfigSearcher documentSearcher = new DocumentTypeConfigSearcher(); documentTypeConfig = documentSearcher.findUniqueDocumentType(xmlDocument); } catch (MainException e) { - log.error("Failed init/find document config: " + e.getMessage(), e); + log.error("E-RSP12111: Failed init/find document config: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (Exception e) { - log.error("Failed init/find document config: " + e.getMessage(), e); + log.error("E-RSP12112: Failed init/find document config: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, new MainException(e)); } @@ -120,13 +120,13 @@ public class SchemaHandler extends RaspHandler { log.debug("- Schema validate OK"); } catch (SchemaValidationFailedException e) { // this is what could be expected... only log warn - log.warn("Failed XML schema validate document: " + e); + log.warn("W-RSP12113: Failed XML schema validate document: " + e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (MainException e) { - log.error("Failed XML schema validate document: " + e, e); + log.error("E-RSP12114: Failed XML schema validate document: " + e, e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (Exception e) { - log.error("Failed XML schema validate document: " + e, e); + log.error("E-RSP12115: Failed XML schema validate document: " + e, e); throw AxisFaultUtil.buildAxisFault(msgContext, new MainException(e)); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchematronHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchematronHandler.java index 5b663ab83df3b608a1084b09263345a47540ee70..8a9c62c33c51f67cbbe999c6768da6278f07441a 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchematronHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/SchematronHandler.java @@ -143,11 +143,13 @@ public class SchematronHandler extends RaspHandler { DocumentTypeConfigSearcher documentSearcher = new DocumentTypeConfigSearcher(); return documentSearcher.findUniqueDocumentType(xmlDocument); } catch (MainException e) { - log.error("Failed find document config: " + e.getMessage(), e); + log.error("E-RSP12103: Failed find document config: " + e.getMessage(), e); throw e; } catch (Exception e) { - log.error("Failed find document config: " + e.getMessage(), e); - throw new MainException(e); + + log.error("E-RSP12104: Failed find document config: " + e.getMessage(), e); + throw new MainException(e, "E-RSP12101"); + } } @@ -166,11 +168,11 @@ public class SchematronHandler extends RaspHandler { validator.schematronValidateXmlDocument(xmlDocument, transform); log.debug("- Schematron validate OK"); } catch (SchematronErrorException e) { - log.warn("Failed schematron document validation: " + e.getMessage(), e); + log.warn("W-RSP12105: Failed schematron document validation: " + e.getMessage(), e); throw e; } catch (Exception e) { - log.warn("Failed schematron document validation: " + e.getMessage(), e); - throw new MainException(e); + log.warn("W-RSP12106: Failed schematron document validation: " + e.getMessage(), e); + throw new MainException(e, "E-RSP12102"); } } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/TransformationHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/TransformationHandler.java index 1525c5ce7df7e7597d136a3175cdeb3ddc6cd1bb..140066e486d319aa80d47097645c282f4696ebac 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/TransformationHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/axis2/module/xml/TransformationHandler.java @@ -115,10 +115,10 @@ public class TransformationHandler extends RaspHandler { DocumentTypeConfigSearcher documentSearcher = new DocumentTypeConfigSearcher(); documentTypeConfig = documentSearcher.findUniqueDocumentType(xmlDocument); } catch (MainException e) { - log.error("Failed init/find document config: " + e.getMessage(), e); + log.error("E-RSP12121: Failed init/find document config: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (Exception e) { - log.error("Failed init/find document config: " + e.getMessage(), e); + log.error("E-RSP12122: Failed init/find document config: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, new MainException(e)); } @@ -139,7 +139,7 @@ public class TransformationHandler extends RaspHandler { log.debug("Failed to transform document: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, e); } catch (Exception e) { - log.error("Failed to transform document: " + e.getMessage(), e); + log.error("E-RSP12123: Failed to transform document: " + e.getMessage(), e); throw AxisFaultUtil.buildAxisFault(msgContext, new MainException(e)); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/IdentifierUtility.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/IdentifierUtility.java index 387b22005618d387934697b558e793a0ecbc9e51..4ecb9489876a07cbcd20cbea968475b8af25a774 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/IdentifierUtility.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/IdentifierUtility.java @@ -70,13 +70,13 @@ public class IdentifierUtility { */ public static EndpointAddress getEndpointAddressFromString(final String endpointAddress) { if (!endpointAddress.toLowerCase().startsWith("http://")) { - throw new IllegalArgumentException("EndpointAddress not an http:// address: " + endpointAddress); + throw new IllegalArgumentException("E-RSP32002: EndpointAddress not an http:// address: " + endpointAddress); } try { return new EndpointAddressHttp(new Uri(endpointAddress)); } catch (URISyntaxException e) { - throw new IllegalArgumentException("EndpointAddress could not be created from " + endpointAddress, e); + throw new IllegalArgumentException("E-RSP32001: EndpointAddress could not be created from " + endpointAddress, e); } } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/RaspLibraryException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/RaspLibraryException.java index d1c7370eb0d6e4d1bd71153645c0c590cf50bc81..80bb6fce016efcfdb1f4b7ce41ee6c6493e96dd8 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/RaspLibraryException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/RaspLibraryException.java @@ -28,9 +28,8 @@ public class RaspLibraryException extends RuntimeException { /** * RaspLibraryException. - * - * @param string - * message + * + * @param string message */ public RaspLibraryException(final String string) { super(string); @@ -38,22 +37,19 @@ public class RaspLibraryException extends RuntimeException { /** * RaspLibraryException. - * - * @param t - * message + * + * @param t Error thrown. */ - public RaspLibraryException(final Throwable t) { - super(t); + public RaspLibraryException(final Throwable t, final String errorCode) { + super(errorCode, t); } /** * RaspLibraryException. - * - * @param message - * message + * + * @param message message */ - public RaspLibraryException(String message, Throwable e) { - super(message,e); + public RaspLibraryException(String message, Throwable e, final String errorCode) { + super(errorCode + ": " + message, e); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/Utilities.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/Utilities.java index 5c04f4c4f58c8c3fce481dc8d61d8a6a2bf00b15..44b65b0f0fc3ba3afd467bbe2d4a0b1131c1ff4f 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/Utilities.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/Utilities.java @@ -180,7 +180,7 @@ public class Utilities { return IdentifierUtility.getUddiIDFromString(profileTModelGuid); } - throw new OioublDocumentProfileMappingNotFoundException(profileName); + throw new OioublDocumentProfileMappingNotFoundException(profileName, "E-RSP32002"); } /** @@ -210,6 +210,6 @@ public class Utilities { return IdentifierUtility.getUddiIDFromString(profileTModelGuid); } - throw new OioublDocumentProfileMappingNotFoundException(profileName); + throw new OioublDocumentProfileMappingNotFoundException(profileName, "E-RSP32002"); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/MultipleQuantityCache.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/MultipleQuantityCache.java index c05bcfdaf43d616927f8230ccab307229958b9f5..de0a6adb984bd7c1cc6017e685990edcc249f068 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/MultipleQuantityCache.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/MultipleQuantityCache.java @@ -82,7 +82,7 @@ public class MultipleQuantityCache extends AbstractStatisticsColle */ public MultipleQuantityCache(int maxSize, int maxEqualKeySize) { if (maxSize < 0) { - throw new IllegalArgumentException(CONFIG_MAX_SIZE); + throw new IllegalArgumentException("E-RSP32202: " + CONFIG_MAX_SIZE); } this.configuration = new HashMap(); this.configuration.put(CONFIG_MAX_SIZE, String.valueOf(maxSize)); @@ -104,19 +104,19 @@ public class MultipleQuantityCache extends AbstractStatisticsColle String value = configuration.get(CONFIG_MAX_SIZE); int maxSize = Integer.valueOf(value); if (maxSize < 0) { - throw new IllegalArgumentException(CONFIG_MAX_SIZE); + throw new IllegalArgumentException("E-RSP32202: " + CONFIG_MAX_SIZE); } value = configuration.get(CONFIG_MAX_EQUAL_KEY_SIZE); int maxEqualKeySize = 1; if (value != null) { maxEqualKeySize = Integer.valueOf(value); if (maxEqualKeySize < 0) { - throw new IllegalArgumentException(CONFIG_MAX_EQUAL_KEY_SIZE); + throw new IllegalArgumentException("E-RSP32203: " + CONFIG_MAX_EQUAL_KEY_SIZE); } } this.setup(maxSize, maxEqualKeySize); } else { - throw new IllegalArgumentException("Argument [" + CONFIG_MAX_SIZE + "] was not present in the configuration arguments"); + throw new IllegalArgumentException("E-RSP32204: Argument [" + CONFIG_MAX_SIZE + "] was not present in the configuration arguments"); } } @@ -132,7 +132,7 @@ public class MultipleQuantityCache extends AbstractStatisticsColle public void add(TKey key, TValue value) { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException("key", "E-RSP32205"); } this.statData.incrementAddTotalCount(); if (_maxSize == 0) { @@ -158,7 +158,7 @@ public class MultipleQuantityCache extends AbstractStatisticsColle public boolean containsKey(TKey key) { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException("key", "E-RSP32205"); } if (_maxSize == 0) { this.statData.incrementContainsMissCount(); @@ -183,7 +183,7 @@ public class MultipleQuantityCache extends AbstractStatisticsColle public void remove(TKey key) { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException("key", "E-RSP32205"); } this.statData.incrementRemoveTotalCount(); if (_maxSize == 0) { @@ -196,7 +196,7 @@ public class MultipleQuantityCache extends AbstractStatisticsColle public boolean tryGetValue(TKey key, OutVariable value) { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException("key", "E-RSP32205"); } if (_maxSize == 0) { return false; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/TimedCache.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/TimedCache.java index 5cc76ef2dec23bd318425bfe6a0952d06f94eca6..164289ada5e7de16798a2cecf91a76cb766b56f0 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/TimedCache.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/common/cache/TimedCache.java @@ -52,7 +52,7 @@ public class TimedCache extends AbstractStatisticsCollectorCache extends AbstractStatisticsCollectorCache> cache; - - /* - * Let's use AtomicBoolean, which guarantees that 2 threads will not change - * it from false to true simultaneously by method - */ - private AtomicBoolean isCheckRunningNow = new AtomicBoolean(false); - private final Map configuration; + /* + * Let's use AtomicBoolean, which guarantees that 2 threads will not change + * it from false to true simultaneously by method + */ + private final AtomicBoolean isCheckRunningNow = new AtomicBoolean(false); /* * Constructors, present before OIORASP 1.3.0 @@ -114,40 +112,15 @@ public class TimedCache extends AbstractStatisticsCollectorCache>(); this.createExpiredCheckTask(); } - protected TimeSpan parseTimeOut(Map configuration) { - return parseField(configuration, CONFIG_VALIDITY_TIME_IN_MINUTES, CONFIG_VALIDITY_TIME_IN_HOURS, DEFAULT_VALIDITY_IN_MINUTES); - } - - protected TimeSpan parseFrequency(Map configuration) { - return parseField(configuration, CONFIG_FREQUENCY_IN_MINUTES, CONFIG_FREQUENCY_IN_HOURS, DEFAULT_FREQUENCY_IN_MINUTES); - } - - private TimeSpan parseField(Map configuration, String configMinutes, String configHours, int configDefault) { - TimeSpan timeSpan; - if (configuration.containsKey(configMinutes)) { - String value = configuration.get(configMinutes); - int minutes = Integer.valueOf(value); - timeSpan = new TimeSpan(TimeUnit.MINUTES, minutes); - } else if (configuration.containsKey(configHours)) { - String value = configuration.get(configHours); - int hours = Integer.valueOf(value); - timeSpan = new TimeSpan(TimeUnit.HOURS, hours); - } else { - log.warn("The " + configMinutes + "/" + configHours + " are not defined for the TimedCache, use default '" + configDefault + "' minutes."); - timeSpan = new TimeSpan(TimeUnit.MINUTES, configDefault); - } - return timeSpan; - } - /** * @param timeSpan Cache timeout value. * @param frequencyInMinutes frequency in minutes for checking the time cache. @@ -176,7 +149,7 @@ public class TimedCache extends AbstractStatisticsCollectorCache buildConfigMap(TimeSpan timeSpan, TimeSpan frequencyTimeSpan) { - Map configuration = new HashMap(); + Map configuration = new HashMap<>(); if (timeSpan.getTimeUnit() == TimeUnit.HOURS) { configuration.put(CONFIG_VALIDITY_TIME_IN_HOURS, String.valueOf(timeSpan.getTimeUnitSpan())); } else { @@ -190,9 +163,34 @@ public class TimedCache extends AbstractStatisticsCollectorCache configuration) { + return parseField(configuration, CONFIG_VALIDITY_TIME_IN_MINUTES, CONFIG_VALIDITY_TIME_IN_HOURS, DEFAULT_VALIDITY_IN_MINUTES); + } + + protected TimeSpan parseFrequency(Map configuration) { + return parseField(configuration, CONFIG_FREQUENCY_IN_MINUTES, CONFIG_FREQUENCY_IN_HOURS, DEFAULT_FREQUENCY_IN_MINUTES); + } + + private TimeSpan parseField(Map configuration, String configMinutes, String configHours, int configDefault) { + TimeSpan timeSpan; + if (configuration.containsKey(configMinutes)) { + String value = configuration.get(configMinutes); + int minutes = Integer.valueOf(value); + timeSpan = new TimeSpan(TimeUnit.MINUTES, minutes); + } else if (configuration.containsKey(configHours)) { + String value = configuration.get(configHours); + int hours = Integer.valueOf(value); + timeSpan = new TimeSpan(TimeUnit.HOURS, hours); + } else { + log.warn("W-RSP32305: The " + configMinutes + "/" + configHours + " are not defined for the TimedCache, use default '" + configDefault + "' minutes."); + timeSpan = new TimeSpan(TimeUnit.MINUTES, configDefault); + } + return timeSpan; + } + private void createExpiredCheckTask() { // Start a scheduled task to clean the cache at a fix rate - CacheExpiredCheckTask task = new CacheExpiredCheckTask(this); + CacheExpiredCheckTask task = new CacheExpiredCheckTask<>(this); // Let's use the same scheduling infrastructure in the whole OIORASP library. ScheduledExecutor.getInstance().scheduleJob(task, cacheCheckFrequency.getTimeUnitSpan(), cacheCheckFrequency.getTimeUnit()); } @@ -226,7 +224,7 @@ public class TimedCache extends AbstractStatisticsCollectorCache cacheValue = new TimedCacheValue(timeOut, value); + TimedCacheValue cacheValue = new TimedCacheValue<>(timeOut, value); synchronized (cache) { cache.put(key, cacheValue); } @@ -297,7 +295,7 @@ public class TimedCache extends AbstractStatisticsCollectorCache ignoreMe = new OutVariable(); + OutVariable ignoreMe = new OutVariable<>(); found = tryGetValue(key, ignoreMe); // Move statistics update outside synchronized section - statData uses concurrent-safe objects @@ -330,16 +328,16 @@ public class TimedCache extends AbstractStatisticsCollectorCache extends AbstractStatisticsCollectorCache extends AbstractStatisticsCollectorCache documentTypes = new ArrayList<>(); + private List documentTypes = new ArrayList(); /** * A list of RASP document types supported by the client (e.g. Invoices, Notifications...). @@ -49,19 +49,19 @@ public class DocumentTypeCollectionConfig { /** * A list of RASP document types supported by the client (e.g. Invoices, Notifications...). * - * @return DocumentTypes as list. + * @param value DocumentTypes */ - public List getDocumentTypesAsList() { - return documentTypes; + public void setDocumentTypes(List value) { + documentTypes = value; } /** * A list of RASP document types supported by the client (e.g. Invoices, Notifications...). * - * @param value DocumentTypes + * @return DocumentTypes as list. */ - public void setDocumentTypes(List value) { - documentTypes = value; + public List getDocumentTypesAsList() { + return documentTypes; } /** @@ -71,10 +71,10 @@ public class DocumentTypeCollectionConfig { */ public void addDocumentType(DocumentTypeConfig documentTypeConfig) throws DocumentAllreadyAddedException { if (documentTypeConfig == null) { - throw new ArgumentNullException("documentType"); + throw new ArgumentNullException("documentType", "E-RSP31101"); } if (containsDocumentTypeByValue(documentTypeConfig)) { - throw new DocumentAllreadyAddedException(documentTypeConfig.getFriendlyName()); + throw new DocumentAllreadyAddedException(documentTypeConfig.getFriendlyName(), "E-RSP31127"); } documentTypes.add(documentTypeConfig); } @@ -86,7 +86,7 @@ public class DocumentTypeCollectionConfig { */ public void removeDocumentType(DocumentTypeConfig documentTypeConfig) { if (documentTypeConfig == null) { - throw new ArgumentNullException("documentType"); + throw new ArgumentNullException("documentType", "E-RSP31101"); } documentTypes.remove(documentTypeConfig); } @@ -104,25 +104,25 @@ public class DocumentTypeCollectionConfig { * Returns whether a certain document type is in the collection. The document type is in the collection if it has the same id or has the * same root name, root namespace and identifier discriminators. * - * @param documentTypeConfig - * @return whether the documenttype is in the configuration + * @param documentTypeConfig DocumentTypeConfig. + * @return whether the DocumentType is in the configuration. */ public boolean containsDocumentTypeByValue(DocumentTypeConfig documentTypeConfig) { return documentTypes.contains(documentTypeConfig); } /** - * Returns whether a certain document type is in the collection. The document type is in the collectio if the reference is the same. + * Returns whether a certain document type is in the collection. The document type is in the collection if the reference is the same. * - * @param documentTypeConfig - * @return whether the documenttype is in the configuration + * @param documentTypeConfig DocumentTypeConfig. + * @return whether the DocumentType is in the configuration */ public boolean containsDocumentTypeByReference(DocumentTypeConfig documentTypeConfig) { return documentTypes.contains(documentTypeConfig); } /** - * Gets the documents types with a certain root name and root namespace. This does not uniqely identfies a certain document type hence + * Gets the documents types with a certain root name and root namespace. This does not uniquely identify a certain document type hence * multiple document types can be returned as result. * * @param rootName @@ -130,7 +130,7 @@ public class DocumentTypeCollectionConfig { * @return document types */ public Iterator getDocumentTypes(String rootName, String rootNamespace) { - List results = new ArrayList(); + List results = new ArrayList<>(); for (DocumentTypeConfig config : documentTypes) { if (config.getRootName().equals(rootName) && config.getRootNamespace().equals(rootNamespace)) { results.add(config); @@ -151,18 +151,18 @@ public class DocumentTypeCollectionConfig { XPathDiscriminatorConfigCollection identifierDiscriminators) throws NoDocumentTypeFoundFromParametersException, AmbiguousDocumentTypeResultFromParametersException, ArgumentNullException { if (rootName == null) { - throw new ArgumentNullException("rootName"); + throw new ArgumentNullException("rootName", "E-RSP31102"); } if (rootNamespace == null) { - throw new ArgumentNullException("rootNamespace"); + throw new ArgumentNullException("rootNamespace", "E-RSP31103"); } if (identifierDiscriminators == null) { - throw new ArgumentNullException("identifierDiscriminators"); + throw new ArgumentNullException("identifierDiscriminators", "E-RSP31104"); } DocumentTypeConfig documentType = tryGetDocumentType(rootName, rootNamespace, identifierDiscriminators); if (documentType == null) { - throw new NoDocumentTypeFoundFromParametersException(rootName, rootNamespace, identifierDiscriminators); + throw new NoDocumentTypeFoundFromParametersException(rootName, rootNamespace, identifierDiscriminators, "E-RSP31108"); } return documentType; } @@ -176,7 +176,7 @@ public class DocumentTypeCollectionConfig { public DocumentTypeConfig getDocumentType(Guid id) throws NoDocumentTypeFoundFromIdException, AmbiguousDocumentTypeResultFromIdException { DocumentTypeConfig documentType = tryGetDocumentType(id); if (documentType == null) { - throw new NoDocumentTypeFoundFromIdException(id); + throw new NoDocumentTypeFoundFromIdException(id, "E-RSP31105"); } return documentType; } @@ -193,16 +193,16 @@ public class DocumentTypeCollectionConfig { XPathDiscriminatorConfigCollection identifierDiscriminators) throws AmbiguousDocumentTypeResultFromParametersException, ArgumentNullException { if (rootName == null) { - throw new ArgumentNullException("rootName"); + throw new ArgumentNullException("rootName", "E-RSP31102"); } if (rootNamespace == null) { - throw new ArgumentNullException("rootNamespace"); + throw new ArgumentNullException("rootNamespace", "E-RSP31103"); } if (identifierDiscriminators == null) { - throw new ArgumentNullException("identifierDiscriminators"); + throw new ArgumentNullException("identifierDiscriminators", "E-RSP31104"); } - List searchList = new ArrayList(); + List searchList = new ArrayList<>(); for (DocumentTypeConfig config : documentTypes) { if (config.getRootName().equals(rootName) && config.getRootNamespace().equals(rootNamespace) && config.getIdentifierDiscriminators().equals(identifierDiscriminators)) { @@ -213,7 +213,7 @@ public class DocumentTypeCollectionConfig { if (searchList.isEmpty()) { return null; } else if (searchList.size() > 1) { - throw new AmbiguousDocumentTypeResultFromParametersException(rootName, rootNamespace, identifierDiscriminators); + throw new AmbiguousDocumentTypeResultFromParametersException(rootName, rootNamespace, identifierDiscriminators, "E-RSP31106"); } return searchList.get(0); } @@ -225,7 +225,7 @@ public class DocumentTypeCollectionConfig { * @return a specific document type */ public DocumentTypeConfig tryGetDocumentType(Guid id) throws AmbiguousDocumentTypeResultFromIdException { - List searchList = new ArrayList(); + List searchList = new ArrayList<>(); for (DocumentTypeConfig config : documentTypes) { if (config.getId().equals(id)) { @@ -236,8 +236,8 @@ public class DocumentTypeCollectionConfig { return null; } if (searchList.size() > 1) { - throw new AmbiguousDocumentTypeResultFromIdException(id); + throw new AmbiguousDocumentTypeResultFromIdException(id, "E-RSP31107"); } - return (DocumentTypeConfig) searchList.get(0); + return searchList.get(0); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/DocumentTypeConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/DocumentTypeConfig.java index 849963c14e40d517c9b3212ce71b289c3a97433a..7e10980e30f01e00736187130791b54b21fa4d53 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/DocumentTypeConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/DocumentTypeConfig.java @@ -69,13 +69,13 @@ public class DocumentTypeConfig { */ public DocumentTypeConfig(String rootName, String rootNamespace, XPathDiscriminatorConfigCollection identifierDiscriminators) { if (rootName == null) { - throw new ArgumentNullException("rootName"); + throw new ArgumentNullException("rootName", "E-RSP31111"); } if (rootNamespace == null) { - throw new ArgumentNullException("rootNamespace"); + throw new ArgumentNullException("rootNamespace", "E-RSP31112"); } if (identifierDiscriminators == null) { - throw new ArgumentNullException("identifierDiscriminators"); + throw new ArgumentNullException("identifierDiscriminators", "E-RSP31113"); } this.rootName = rootName; this.rootNamespace = rootNamespace; @@ -102,25 +102,25 @@ public class DocumentTypeConfig { this(rootName, rootNamespace, identifierDiscriminators); if (friendlyName == null) { - throw new ArgumentNullException("friendlyName"); + throw new ArgumentNullException("friendlyName", "E-RSP31114"); } if (schemaPath == null) { - throw new ArgumentNullException("schemaPath"); + throw new ArgumentNullException("schemaPath", "E-RSP31115"); } if (stylesheetPath == null) { - throw new ArgumentNullException("stylesheetPath"); + throw new ArgumentNullException("stylesheetPath", "E-RSP31116"); } if (serviceContractTModel == null) { - throw new ArgumentNullException("serviceContractTModel"); + throw new ArgumentNullException("serviceContractTModel", "E-RSP31117"); } if (xsltTransformStylesheetPath == null) { - throw new ArgumentNullException("xsltTransformStylesheetPath"); + throw new ArgumentNullException("xsltTransformStylesheetPath", "E-RSP31118"); } if (endpointType == null) { - throw new ArgumentNullException("endpointType"); + throw new ArgumentNullException("endpointType", "E-RSP31119"); } if (schematronValidationConfigList == null) { - throw new ArgumentNullException("schematronValidationConfigs"); + throw new ArgumentNullException("schematronValidationConfigs", "E-RSP31120"); } this.friendlyName = friendlyName; this.schemaPath = schemaPath; @@ -153,7 +153,7 @@ public class DocumentTypeConfig { this(friendlyName, rootName, rootNamespace, schemaPath, stylesheetPath, serviceContractTModel, xsltTransformStylesheetPath, endpointType, identifierDiscriminators, schematronValidationConfigList); if (namespaces == null) { - throw new ArgumentNullException("namespaces"); + throw new ArgumentNullException("namespaces", "E-RSP31125"); } this.namespaces = namespaces; } @@ -190,7 +190,7 @@ public class DocumentTypeConfig { */ public void setFriendlyName(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } friendlyName = value; } @@ -211,7 +211,7 @@ public class DocumentTypeConfig { */ public void setRootNamespace(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } rootNamespace = value; @@ -233,7 +233,7 @@ public class DocumentTypeConfig { */ public void setRootName(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } rootName = value; @@ -255,7 +255,7 @@ public class DocumentTypeConfig { */ public void setServiceContractTModel(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } serviceContractTModel = value; @@ -278,7 +278,7 @@ public class DocumentTypeConfig { public void setSchemaPath(String value) { // @since 2.1.0 Empty value is valid. if (value == null) { - throw new ArgumentNullException("value is null"); + throw new ArgumentNullException("value", "E-RSP31121"); } /* * TODO DLK: Try to find another way to allow unit tests to run. It is @@ -324,7 +324,7 @@ public class DocumentTypeConfig { */ public void setStylesheetPath(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } stylesheetPath = value; @@ -354,7 +354,7 @@ public class DocumentTypeConfig { */ public void setNamespaces(PrefixedNamespace[] value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } namespaces = Arrays.asList(value); @@ -367,7 +367,7 @@ public class DocumentTypeConfig { */ public void setNamespaces(Iterator value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } // _namespaces = new ArrayList(value); @@ -393,7 +393,7 @@ public class DocumentTypeConfig { */ public void setEndpointType(DocumentEndpointInformation value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } endpointType = value; @@ -430,7 +430,7 @@ public class DocumentTypeConfig { */ public void setXsltTransformStylesheetPath(String value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } xsltTransformStylesheetPath = value; @@ -452,7 +452,7 @@ public class DocumentTypeConfig { */ public void setIdentifierDiscriminators(XPathDiscriminatorConfigCollection value) { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException("value", "E-RSP31121"); } identifierDiscriminators = value; @@ -474,7 +474,7 @@ public class DocumentTypeConfig { */ public void setSchematronValidationConfigList(List value) { if (value == null) { - throw new ArgumentNullException("List is null"); + throw new ArgumentNullException("List is null", "E-RSP31126"); } schematronValidationConfigList = value; @@ -525,7 +525,7 @@ public class DocumentTypeConfig { */ public boolean isDocumentOfType(XmlDocument document) throws XmlException { if (document == null) { - throw new ArgumentNullException("document"); + throw new ArgumentNullException("document", "E-RSP31124"); } OMElement root = document.getOMDocument(); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/KeyTypeMappingExpression.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/KeyTypeMappingExpression.java index dbdf89facf9ac682804559b188769a252fa4003f..33b465c7b8a2b5d198168771b35de5ae9260501d 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/KeyTypeMappingExpression.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/KeyTypeMappingExpression.java @@ -115,7 +115,7 @@ public class KeyTypeMappingExpression { try { return mappings.get(value); } catch (Exception ex) { - throw new KeyTypeMappingFailedException(value, ex); + throw new KeyTypeMappingFailedException("E-RSP31131: " + value, ex); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundException.java index d298f608e2854141441c6788510cb9b92b6e708c..9432bbb6d64e6e14ff1948e9ff5e0d4965543e19 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundException.java @@ -31,43 +31,37 @@ public class NoDocumentTypeFoundException extends OiosiCommunicationException { */ private static final long serialVersionUID = 1L; - /** - * Default constructor. - */ - public NoDocumentTypeFoundException() { - } +// /** +// * Default constructor. +// */ +// public NoDocumentTypeFoundException() { +// } /** * Default constructor. - * - * @param e - * message + * + * @param e message */ - public NoDocumentTypeFoundException(final String e) { - super(e); + public NoDocumentTypeFoundException(final String e, final String errorCode) { + super(e, errorCode); } /** * Constructor. - * - * @param innerException - * The inner exception + * + * @param innerException The inner exception. */ public NoDocumentTypeFoundException(final Throwable innerException) { super(innerException); } - + /** * Constructor. - * - * @param e - * message - * - * @param innerException - * The inner exception + * + * @param e message. + * @param innerException The inner exception. */ public NoDocumentTypeFoundException(final String e, final Throwable innerException) { super(e, innerException); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromIdException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromIdException.java index d384b1ecaab08d7030e71ee1dc803f26dacb1eee..a6808e3872405539904cda41240360026bef344e 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromIdException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromIdException.java @@ -33,24 +33,19 @@ public class NoDocumentTypeFoundFromIdException extends NoDocumentTypeFoundExcep /** * Constructor that takes the id of the document. - * - * @param id */ - public NoDocumentTypeFoundFromIdException(final Guid id) { - super(id.getGuid()); + public NoDocumentTypeFoundFromIdException(final Guid id, String errorCode) { + super(id.getGuid(), errorCode); } /** * Constructor that takes the id of the document and an exception as the * reason. - * - * @param id - * The ID of the document - * @param innerException - * The inner exception + * + * @param id The ID of the document + * @param innerException The inner exception */ public NoDocumentTypeFoundFromIdException(final Guid id, final Exception innerException) { super(id.getGuid(), innerException); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromParametersException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromParametersException.java index 437011b5f7236789ee989da4489de7ad2ade53d0..63bc15740b2a4c6d634b21f4cda084567d1a6fd0 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromParametersException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/NoDocumentTypeFoundFromParametersException.java @@ -25,7 +25,7 @@ import dk.gov.oiosi.xml.xpath.discriminator.XPathDiscriminatorConfigCollection; * NoDocumentTypeFoundFromParametersException. */ public class NoDocumentTypeFoundFromParametersException extends NoDocumentTypeFoundException { - + /** * serialVersionUID. */ @@ -35,9 +35,9 @@ public class NoDocumentTypeFoundFromParametersException extends NoDocumentTypeFo * Constructor. * @param rootName root name of document * @param rootNamespace document namespace - * @param identifierDiscriminators identifierDiscriminators + * @param identifierDiscriminators identifierDiscriminators */ - public NoDocumentTypeFoundFromParametersException(String rootName, String rootNamespace, XPathDiscriminatorConfigCollection identifierDiscriminators) { - super(rootName + " : " + rootNamespace + " : " + identifierDiscriminators); + public NoDocumentTypeFoundFromParametersException(String rootName, String rootNamespace, XPathDiscriminatorConfigCollection identifierDiscriminators, final String errorCode) { + super(rootName + " : " + rootNamespace + " : " + identifierDiscriminators, errorCode); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/OioublDocumentProfileMappingNotFoundException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/OioublDocumentProfileMappingNotFoundException.java index 1f66ff4f9efd0847df194c62f8d58ddf7410c30d..ca1d2d8011daf1d46bfbfd0dc9774f905137e4e1 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/OioublDocumentProfileMappingNotFoundException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/OioublDocumentProfileMappingNotFoundException.java @@ -43,8 +43,8 @@ public class OioublDocumentProfileMappingNotFoundException extends OiosiCommunic * @param e * message */ - public OioublDocumentProfileMappingNotFoundException(final String e) { - super(e); + public OioublDocumentProfileMappingNotFoundException(final String e, String errorCode) { + super(e, errorCode); } /** diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/ProfileMappingCollectionConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/ProfileMappingCollectionConfig.java index 01e55d91bc450f2fd940b2dcb50121dd18d27097..272887c41eb76ad1c5ae9c4eb6075c66c16d41c6 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/ProfileMappingCollectionConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/configuration/ProfileMappingCollectionConfig.java @@ -30,7 +30,7 @@ import java.util.List; */ public class ProfileMappingCollectionConfig { - private List _profileMappings = new ArrayList(); + private List profileMappings = new ArrayList<>(); /** * Returns a list of mappings between unique profile names and their @@ -39,7 +39,7 @@ public class ProfileMappingCollectionConfig { * @return The mapping */ public Iterable getProfileMappingIterator() { - return _profileMappings; + return profileMappings; } /** @@ -48,7 +48,7 @@ public class ProfileMappingCollectionConfig { * @param collection The collection to use in this configuration */ public void setProfileMappings(ProfileMapping[] collection) { - _profileMappings = Arrays.asList(collection); + profileMappings = Arrays.asList(collection); } /** @@ -57,7 +57,7 @@ public class ProfileMappingCollectionConfig { * @param collection The collection to add */ public void addProfileMappings(ProfileMapping[] collection) { - _profileMappings.addAll(Arrays.asList(collection)); + profileMappings.addAll(Arrays.asList(collection)); } /** @@ -65,22 +65,22 @@ public class ProfileMappingCollectionConfig { * * @throws DocumentAllreadyAddedException On error... */ - public void AddProfileMapping(ProfileMapping profileMapping) throws DocumentAllreadyAddedException { + public void addProfileMapping(ProfileMapping profileMapping) throws DocumentAllreadyAddedException { if (profileMapping == null) { - throw new ArgumentNullException("profileMapping"); + throw new ArgumentNullException("profileMapping", "E-RSP31141"); } if (containsProfileMappingByName(profileMapping.getName())) { - throw new DocumentAllreadyAddedException(profileMapping.getName()); + throw new DocumentAllreadyAddedException(profileMapping.getName(), "E-RSP31142"); } - _profileMappings.add(profileMapping); + profileMappings.add(profileMapping); } /** * Clears the mapping list */ - public void Clear() { - if (_profileMappings != null) { - _profileMappings.clear(); + public void clear() { + if (profileMappings != null) { + profileMappings.clear(); } } @@ -91,7 +91,7 @@ public class ProfileMappingCollectionConfig { * @return True, if profile mapping exists. */ public boolean containsProfileMappingByName(String profileMappingName) { - for (ProfileMapping mapping : _profileMappings) { + for (ProfileMapping mapping : profileMappings) { String currentProfileMappingName = mapping.getName(); if (currentProfileMappingName.equals(profileMappingName)) { return true; @@ -107,11 +107,11 @@ public class ProfileMappingCollectionConfig { * @return The corresponding profile mapping */ public ProfileMapping getMapping(String profileMappingName) { - for (ProfileMapping mapping : _profileMappings) { + for (ProfileMapping mapping : profileMappings) { if (mapping.getName().equals(profileMappingName)) { return mapping; } } return null; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/service/AxisServiceReceiver.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/service/AxisServiceReceiver.java index 1129acc1eacc6d7252dd2d6edeb8ed739c81e194..d284d61f7422c52788e7b35709841b38da382e7c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/service/AxisServiceReceiver.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/communication/service/AxisServiceReceiver.java @@ -96,8 +96,8 @@ public class AxisServiceReceiver extends AbstractInOutMessageReceiver { log.debug("Convert body"); requestBody = requestBody.cloneOMElement(); } catch (Exception e) { - log.error("Error converting body: " + e.getMessage(), e); - throw new MainException("Internal Error: " + e.getMessage(), e); + log.error("E-RSP31501: Error converting body: " + e.getMessage(), e); + throw new MainException("E-RSP31502: Internal Error: " + e.getMessage(), e); } } } @@ -120,7 +120,7 @@ public class AxisServiceReceiver extends AbstractInOutMessageReceiver { log.debug("Call Service class"); response = docService.requestRespond(oiosiMessage); } catch (Exception e) { - log.error("Service threw Exception: " + e.getMessage(), e); + log.error("E-RSP31503: Service threw Exception: " + e.getMessage(), e); // call cancel on service to keep statistic in sync if (docService instanceof IServiceContractTransaction) { diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/CacheFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/CacheFactory.java index 972880ce72347e2f39c39d95ad7ab84dd777f20d..627907291166830a3db209b8fd59e37fd8ea710d 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/CacheFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/CacheFactory.java @@ -42,46 +42,39 @@ import java.util.Map; public class CacheFactory { private static Log log = LogFactory.getLog(CacheFactory.class); + /** + * Cache to store the UnfinishedSignatureValidationProof + */ + //private ICache messageIdUnfinishedSignaturesCache = null; + private static CacheFactory cacheFactory = new CacheFactory(); /** * Cache to store the ocsp lookup - check is a certificate is valid */ private IThreadSafeCache ocspLookupCache = null; - /** * Cache to store the result from the CRL list - the certificates that has been revoked, ala blacklisted */ private IThreadSafeCache crlLookupCache = null; - private IThreadSafeCache> uddiServiceCache = null; - private IThreadSafeCache uddiTModelCache = null; - /** * Cache to store certificated, that has been retrieved from LDAP */ private IThreadSafeCache certificateCache = null; - /** - * Cache to store the compiled schematron - */ - private IThreadSafeCache schematronStoreCache = null; - /** * Cache to store the compiled schema file */ // private ICache schemaStoreCache = null; - /** - * Cache to store the UnfinishedSignatureValidationProof + * Cache to store the compiled schematron */ - //private ICache messageIdUnfinishedSignaturesCache = null; - - private static CacheFactory cacheFactory = new CacheFactory(); + private IThreadSafeCache schematronStoreCache = null; @SuppressWarnings("unchecked") /* - * Marked as protected to make it testable + * Marked as protected to make it testable. */ protected CacheFactory() { CacheConfig cacheConfig = ConfigurationHandler.getInstance().getCacheConfig(); @@ -92,20 +85,22 @@ public class CacheFactory { this.uddiTModelCache = this.createCache(cacheConfig.getUddiTModelCache()); this.certificateCache = this.createCache(cacheConfig.getCertificateCache()); this.schematronStoreCache = this.createCache(cacheConfig.getSchematronCache()); - } catch (Throwable e) { - throw new RaspLibraryException(e); + } catch (Exception e) { + throw new RaspLibraryException(e.getMessage(), e, "E-RSP11002"); } } + public static CacheFactory getInstance() { + return cacheFactory; + } + @SuppressWarnings({"rawtypes"}) /** * Instantiates cache implementation. If given cacheConfig is null or is not valid, generates default cache implementation. + * + * Marked as protected to avoid disclosure of internal implementation of + * this class for clients code, but with possibility to override implementation. */ - /* - * Marked as protected to avoid disclosure of internal implementation of - * this class for clients code, but with possibility to override - * implementation. - */ protected IThreadSafeCache createCache(CacheConfigElement cacheConfig) throws Exception { IThreadSafeCache cache = createCacheInternal(cacheConfig); if (cache == null) { @@ -120,7 +115,7 @@ public class CacheFactory { cacheConfigInternal = CacheFactoryConstants.getDefaultCacheConfig(cacheCode); } if (cacheConfigInternal == null) { - log.warn("CacheFactory: not found default configuration for cache code " + cacheCode + " in class CacheFactoryConstants, use global default configuration"); + log.warn("W-RSP11007: CacheFactory: not found default configuration for cache code " + cacheCode + " in class CacheFactoryConstants, use global default configuration"); cacheConfigInternal = CacheFactoryConstants.getDefaultCacheConfig(); } cache = createCacheInternal(cacheConfigInternal); @@ -134,7 +129,7 @@ public class CacheFactory { @SuppressWarnings({"unchecked", "rawtypes"}) private IThreadSafeCache createCacheInternal(CacheConfigElement cacheConfigElement) throws Exception { if (cacheConfigElement == null) { - log.warn("CacheFactory: cannot find cache configuration, use default"); + log.warn("W-RSP11008: CacheFactory: cannot find cache configuration, use default"); return null; } Class cacheClass = null; @@ -142,7 +137,7 @@ public class CacheFactory { try { cacheClass = Class.forName(cacheConfigElement.getImplementationNamespaceClass()); } catch (Throwable e) { - log.error("Failed to find class of cache implementation, config = " + cacheConfigElement, e); + log.error("W-RSP11009: Failed to find class of cache implementation, config = " + cacheConfigElement, e); } } IThreadSafeCache cache = null; @@ -153,26 +148,22 @@ public class CacheFactory { configurationList = new HashMap(1); } /* - * CACHE_NAME is removed from configuration at RaspConfiguration.xml files, - * it can be set programmatically by the library itself. - * - * Setting it in RaspConfiguration.xml which is error-prone - * (client can just forget to set it!), and it is already - * defined by parent tag of cache configuration element. - */ + * CACHE_NAME is removed from configuration at RaspConfiguration.xml files, + * it can be set programmatically by the library itself. + * + * Setting it in RaspConfiguration.xml which is error-prone + * (client can just forget to set it!), and it is already + * defined by parent tag of cache configuration element. + */ configurationList.put(ICache.CONFIG_CACHE_NAME, cacheConfigElement.getCacheCode()); cache = (IThreadSafeCache) cacheClass.getConstructor(new Class[]{Map.class}).newInstance(cacheConfigElement.getConfigurationList()); } catch (Throwable e) { - log.error("Failed to instantiate cache implementation class, it should implement IThreadSafeCache interface and contain constructor with Map object, config = " + cacheConfigElement, e); + log.error("E-RSP11010: Failed to instantiate cache implementation class, it should implement IThreadSafeCache interface and contain constructor with Map object, config = " + cacheConfigElement, e); } } return cache; } - public static CacheFactory getInstance() { - return cacheFactory; - } - public ICache getOcspLookupCache() { return ocspLookupCache; } @@ -196,4 +187,4 @@ public class CacheFactory { public IThreadSafeCache getSchematronStoreCache() { return this.schematronStoreCache; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationHandler.java index e068120cd302af4bcdb08bdf6934c7ee2c9fc22b..3dcee9d78cc1bcdc2357b04fc0389f8fc11d9638 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationHandler.java @@ -67,6 +67,7 @@ public class ConfigurationHandler { * The default file name of the configuration file. */ private static final String RASPCONFIGURATION_XML_DEFAULT = "RaspConfiguration.xml"; + private static final String JCE_ERROR_STRING = "Java JCE is not installed - see https://en.wikipedia.org/wiki/Java_Cryptography_Extension"; private static String versionNumber; private static String raspConfigurationFileName = RASPCONFIGURATION_XML_DEFAULT; private static ConfigurationHandler static_ConfigurationHandler = null; @@ -108,9 +109,11 @@ public class ConfigurationHandler { * @return ConfigurationHandler The static instance of the configuration handler */ public static synchronized ConfigurationHandler getInstance(final boolean forceReload) { + if (static_ConfigurationHandler == null || forceReload) { static_ConfigurationHandler = new ConfigurationHandler(); static_ConfigurationHandler.loadXMLConfiguration(); + } return static_ConfigurationHandler; } @@ -129,7 +132,7 @@ public class ConfigurationHandler { */ @SuppressWarnings("unchecked") static List parseStartTaskList(XMLConfiguration xmlConfig) { - List taskList = new ArrayList<>(); + List taskList = new ArrayList(); String startupConfigKey = "//ConfigurationSection[@*=\"StartupConfig\"]/StartupTasks/StartupTask"; List startupTaskConfigList = xmlConfig.configurationsAt(startupConfigKey); if (startupTaskConfigList != null) { @@ -138,10 +141,10 @@ public class ConfigurationHandler { if (className != null) { className = className.trim(); } else { - log.warn("ConfigurationHandler: in RaspConfiguration a section StartupTask is found without subtag ImplementationNamespaceClass, section is ignored"); + log.warn("W-RSP11022: ConfigurationHandler: in RaspConfiguration a section StartupTask is found without subtag ImplementationNamespaceClass, section is ignored"); continue; } - List configList = new ArrayList<>(); + List configList = new ArrayList(); List configs = taskConfig.configurationsAt("ConfigurationList/Configuration"); if (configs != null) { for (HierarchicalConfiguration config : configs) { @@ -156,7 +159,7 @@ public class ConfigurationHandler { if (name != null && value != null) { configList.add(new StartupTaskConfiguration(name, value)); } else { - log.warn("ConfigurationHandler: in RaspConfiguration.xml a section StartupTask for class " + className + " is found with tag ConfigurationList/Configuration but empty Name or Value subtags, configuration is ignored."); + log.warn("W-RSP11023: ConfigurationHandler: in RaspConfiguration.xml a section StartupTask for class " + className + " is found with tag ConfigurationList/Configuration but empty Name or Value subtags, configuration is ignored."); } } } @@ -165,14 +168,14 @@ public class ConfigurationHandler { try { taskImpl = Class.forName(className); } catch (Exception e) { - log.warn("ConfigurationHandler: can not find class " + className + ", defined as Startup task implementation in RaspConfiguration.xml", e); + log.warn("W-RSP11024: ConfigurationHandler: can not find class " + className + ", defined as Startup task implementation in RaspConfiguration.xml", e); continue; } Object taskInstance; try { taskInstance = taskImpl.newInstance(); } catch (Exception e) { - log.warn("ConfigurationHandler: cannot create new instance with empty constructor for " + className + ", defined as Startup task implementation in RaspConfiguration.xml", e); + log.warn("W-RSP11025: ConfigurationHandler: cannot create new instance with empty constructor for " + className + ", defined as Startup task implementation in RaspConfiguration.xml", e); continue; } if (taskInstance instanceof IStartupTask) { @@ -180,12 +183,12 @@ public class ConfigurationHandler { try { startupTask.init(configList); } catch (Exception e) { - log.warn("ConfigurationHandler: failed to initialize instance of class " + className + " with config values " + configList + ", startup task is skipped", e); + log.warn("W-RSP11026: ConfigurationHandler: failed to initialize instance of class " + className + " with config values " + configList + ", startup task is skipped", e); continue; } taskList.add(startupTask); } else { - log.warn("ConfigurationHandler: class " + className + ", defined as Startup task implementation in RaspConfiguration.xml, does not implement interface " + IStartupTask.class.getName() + ", skipped."); + log.warn("W-RSP11027: ConfigurationHandler: class " + className + ", defined as Startup task implementation in RaspConfiguration.xml, does not implement interface " + IStartupTask.class.getName() + ", skipped."); } } } @@ -214,12 +217,12 @@ public class ConfigurationHandler { private void initEnvironment() { try { if (Cipher.getMaxAllowedKeyLength("AES") < 1024) { - log.fatal("Java JCE is not installed - see https://en.wikipedia.org/wiki/Java_Cryptography_Extension"); - throw new RaspLibraryException("Java JCE is not installed - see https://en.wikipedia.org/wiki/Java_Cryptography_Extension"); + log.fatal("E-RSP11021: " +JCE_ERROR_STRING); + throw new RaspLibraryException(JCE_ERROR_STRING, null, "E-RSP11021"); } } catch (NoSuchAlgorithmException e) { - log.fatal("Java JCE might not be installed - see https://en.wikipedia.org/wiki/Java_Cryptography_Extension", e); - throw new RaspLibraryException("Java JCE is not installed - see https://en.wikipedia.org/wiki/Java_Cryptography_Extension", e); + log.fatal("E-RSP11021: " + JCE_ERROR_STRING, e); + throw new RaspLibraryException(JCE_ERROR_STRING, e, "E-RSP11021"); } Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); @@ -235,7 +238,7 @@ public class ConfigurationHandler { /** * Loads the configuration from the file specified with setConfigurationFile(String file). */ - synchronized public void loadXMLConfiguration() { + public synchronized void loadXMLConfiguration() { // Empty local cache: uddiConfig = null; @@ -346,7 +349,7 @@ public class ConfigurationHandler { @SuppressWarnings("unchecked") private Map cacheConfiguration(SubnodeConfiguration subnodeConfiguration) { - Map configurationMap = new HashMap<>(); + Map configurationMap = new HashMap(); List configurationCollection = subnodeConfiguration.configurationsAt("Configuration"); for (HierarchicalConfiguration cacheConfiguration : configurationCollection) { @@ -372,7 +375,7 @@ public class ConfigurationHandler { public List getRootCertificateLocationCollection() { // The XPath for our configuration section. String xpathBase = "//ConfigurationSection[@*=\"RootCertificateCollectionConfig\"]/"; - List collection = new ArrayList<>(); + List collection = new ArrayList(); RootCertificateConfig rootCertificateConfig; List subnodeConfigurationList = raspConfigurationFile.configurationsAt(xpathBase + "RootCertificateLocationCollection"); @@ -461,10 +464,10 @@ public class ConfigurationHandler { private LookupRegistryFallbackConfig getLookupRegistryFallbackConfig(SubnodeConfiguration lookupRegistryFallbackSubNodes) throws URISyntaxException { LookupRegistryFallbackConfig config = new LookupRegistryFallbackConfig(); ArrayList registries = new ArrayList<>(); - List registrySubNodes = lookupRegistryFallbackSubNodes.configurationsAt("PrioritizedRegistryList/Registry"); - for (Object registrySubNodeObject : registrySubNodes) { - SubnodeConfiguration registrySubNode = (SubnodeConfiguration) registrySubNodeObject; - Registry registry = loadRegistry(registrySubNode); + List registrySubnodes = lookupRegistryFallbackSubNodes.configurationsAt("PrioritizedRegistryList/Registry"); + for (Object registrySubnodeObject : registrySubnodes) { + SubnodeConfiguration registrySubnode = (SubnodeConfiguration) registrySubnodeObject; + Registry registry = loadRegistry(registrySubnode); registries.add(registry); } config.setRegistries(registries); @@ -507,8 +510,8 @@ public class ConfigurationHandler { raspDocumentTypeCollectionConfig.addDocumentType(typeConfig); } } catch (Exception e) { - log.error("Could not init DocumentTypeConfig " + e.getMessage(), e); - ConfigurationException ex = new ConfigurationException("Could not init DocumentTypeConfig " + e); + log.error("E-RSP11029: Could not init DocumentTypeConfig " + e.getMessage(), e); + ConfigurationException ex = new ConfigurationException("E-RSP11030: Could not init DocumentTypeConfig " + e); ex.setStackTrace(e.getStackTrace()); throw ex; } @@ -641,7 +644,7 @@ public class ConfigurationHandler { for (int i = 0; i < names.length; i++) { ProfileMapping profileMapping = new ProfileMapping(names[i], tModelIds[i]); - profileMappingCollectionConfig.AddProfileMapping(profileMapping); + profileMappingCollectionConfig.addProfileMapping(profileMapping); } } catch (Exception e) { ConfigurationException ex = new ConfigurationException("Could not init ProfileMappingCollectionConfig: " + e); @@ -761,7 +764,7 @@ public class ConfigurationHandler { String csXpath = documentSelect + "/CustomHeaderConfiguration/XPaths"; CustomHeaderConfiguration chc = new CustomHeaderConfiguration(); - List headerList = new ArrayList<>(); + List headerList = new ArrayList(); for (Iterator it = raspConfigurationFile.getKeys(csXpath); it.hasNext(); ) { String key = it.next().toString(); @@ -863,7 +866,7 @@ public class ConfigurationHandler { try { task.doTask(); } catch (Exception e) { - log.error("Failure during startup execution of task " + task + ": " + e.getMessage(), e); + log.error("E-RSP11031: Failure during startup execution of task " + task + ": " + e.getMessage(), e); if (firstException == null) { firstException = e; } @@ -874,10 +877,10 @@ public class ConfigurationHandler { log.info("ConfigurationHandler successfully executed " + taskList.size() + " startup tasks in " + (System.currentTimeMillis() - start) + " ms"); } } else { - throw new MainException("ConfigurationHandler failed to execute " + failedExecutionCount + " startup tasks, see first exception in stack trace", firstException); + throw new MainException("E-RSP11033: ConfigurationHandler failed to execute " + failedExecutionCount + " startup tasks, see first exception in stack trace", firstException); } } else { - log.warn("ConfigurationHandler: executeStartupTasks method was called but no startup tasks are configured. Please check RaspConfiguration.xml file to be updated with StartupConfig ConfigurationSection"); + log.warn("W-RSP11032: ConfigurationHandler: executeStartupTasks method was called but no startup tasks are configured. Please check RaspConfiguration.xml file to be updated with StartupConfig ConfigurationSection"); } } @@ -947,9 +950,9 @@ public class ConfigurationHandler { return loadVersionNumberFromLocalFile(); } } catch (IOException e) { - log.fatal("Problem loading version file: " + e.getMessage(), e); + log.fatal("F-RSP11034: Problem loading version file: " + e.getMessage(), e); } - log.fatal("Problem loading version file... but no exception thrown"); + log.fatal("F-RSP11035: Problem loading version file... but no exception thrown"); return null; } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtil.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtil.java index d99fa0dbaf139cf411ba4125abfe88c378f80a2d..bdad1f5f7f74dd49683269582efa1f82649a6214 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtil.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtil.java @@ -84,11 +84,11 @@ class ConfigurationLoaderUtil { try { config = new XMLConfiguration(configPath); } catch (Throwable e) { - log.error("Unable to find configuration at [" + configPath + "]: " + e.getMessage(), e); + log.error("E-RSP11042: Unable to find configuration at [" + configPath + "]: " + e.getMessage(), e); try { config = new XMLConfiguration("../" + configPath); } catch (Throwable e1) { - log.error("Unable to find configuration at [" + "../" + configPath + "]: " + e1.getMessage(), e1); + log.error("E-RSP11043: Unable to find configuration at [" + "../" + configPath + "]: " + e1.getMessage(), e1); } } @@ -105,8 +105,8 @@ class ConfigurationLoaderUtil { */ e.printStackTrace(); - log.fatal("OIORASP cannot load configuration xml [" + configPath + "]: " + e.getMessage(), e); - throw new RaspLibraryException("OIORASP cannot load configuration xml [" + configPath + "]", e); + log.fatal("E-RSP11041: OIORASP cannot load configuration xml [" + configPath + "]: " + e.getMessage(), e); + throw new RaspLibraryException("OIORASP cannot load configuration xml [" + configPath + "]", e, "E-RSP11041"); } log.info("Configuration file [" + configPath + "] loaded!"); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/ArgumentNullException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/ArgumentNullException.java index d51812c2fc54ddaa7a2fcbe282a695fd9ed36991..ae60118968d14ef888375ac7336d704a120d9163 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/ArgumentNullException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/ArgumentNullException.java @@ -34,7 +34,7 @@ public class ArgumentNullException extends IllegalArgumentException { * * @param argument Name of the argument that was null */ - public ArgumentNullException(final String argument) { - super("Argument [" + argument + "] is null"); + public ArgumentNullException(final String argument, String errorCode) { + super(errorCode + ": Argument [" + argument + "] is null"); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/MainException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/MainException.java index 660340767b098d766dabc1f4053b8c0ae604a074..899b7b5de73d73daff6c0483085f421377e58bf1 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/MainException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/exception/MainException.java @@ -24,18 +24,28 @@ package dk.gov.oiosi.exception; */ public class MainException extends Exception { + /** + * Default soap action for service exceptions. + */ + public static final String DEFAULT_SOAP_ACTION = "InternalSystemFailureFault"; /** * serialVersionUID. */ private static final long serialVersionUID = 1L; + /** + * Faults action. + */ + public String fault = null; + /** + * Who to blame. + */ + private boolean receiverError = true; /** * Constructor. - * - * @param s - * message - * @param e - * causing exception + * + * @param s message + * @param e causing exception */ public MainException(String s, Throwable e) { super(s, e); @@ -43,9 +53,29 @@ public class MainException extends Exception { /** * Constructor. - * - * @param s - * message + * + * @param s message + * @param e causing exception + * @param errorCode NemHandel standardised error code + */ + public MainException(String s, Throwable e, String errorCode) { + super(!errorCode.equals("") ? String.format("%s: %s", errorCode, s) : s, e); + } + + /** + * Constructor. + * + * @param s message + * @param errorCode NemHandel standardised error code + */ + public MainException(String s, String errorCode) { + super(!errorCode.equals("") ? String.format("%s: %s", errorCode, s) : s); + } + + /** + * Constructor. + * + * @param s message */ public MainException(String s) { super(s); @@ -60,27 +90,25 @@ public class MainException extends Exception { /** * Constructor. - * - * @param innerException - * causing exception + * + * @param innerException causing exception */ - public MainException(Throwable innerException) { - super(innerException); + public MainException(Throwable innerException, String errorCode) { + super(errorCode, innerException); } /** - * Default soap action for service exceptions. - */ - public static final String DEFAULT_SOAP_ACTION = "InternalSystemFailureFault"; - - /** - * Faults action. + * Constructor. + * + * @param innerException causing exception */ - public String fault = null; + public MainException(Throwable innerException) { + super(innerException); + } /** * Fault action. - * + * * @return fault action */ public String getSoapFaultAction() { @@ -93,9 +121,8 @@ public class MainException extends Exception { /** * Fault action. - * - * @param s - * fault action + * + * @param s fault action */ public void setSoapFaultAction(String s) { fault = s; @@ -103,9 +130,8 @@ public class MainException extends Exception { /** * Match fault action to thrown exception. - * - * @param s - * fault action + * + * @param s fault action * @return match */ public boolean matchSoapFaultAction(String s) { @@ -114,12 +140,7 @@ public class MainException extends Exception { /** * Who to blame. - */ - private boolean receiverError = true; - - /** - * Who to blame. - * + * * @return who to blame */ public String getSoapFaultCode() { @@ -132,9 +153,8 @@ public class MainException extends Exception { /** * Who to blame. - * - * @param b - * blame receiver + * + * @param b blame receiver */ public void setReceiverError(boolean b) { receiverError = b; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateHandlingException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateHandlingException.java index 4d9f4d5ab3e9966e93d45dd44302a91e2138a569..4f41fd8ee5209d076a9ebce948e366ebaf0a2ab8 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateHandlingException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateHandlingException.java @@ -48,8 +48,8 @@ public class CertificateHandlingException extends MainException { * * @param innerException The exception to display as an inner exception */ - public CertificateHandlingException(final Exception innerException) { - super(innerException); + public CertificateHandlingException(final Exception innerException, final String errorCode) { + super(innerException, errorCode); } /** diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateIssuerSubject.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateIssuerSubject.java index 13fa8d6c140ebdebbed179d2777ce1e77814abc2..9cf360ede08491ddae4a1ac2a906d7e62b6cd53a 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateIssuerSubject.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateIssuerSubject.java @@ -39,7 +39,7 @@ public class CertificateIssuerSubject extends CertificateSubject { */ public CertificateIssuerSubject(String subject) { if (subject == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("certificateSubject", "E-RSP19024"); } subjectString = subject; @@ -52,7 +52,7 @@ public class CertificateIssuerSubject extends CertificateSubject { */ public CertificateIssuerSubject(X509Certificate certificate) { if (certificate == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("certificate", "E-RSP19025"); } subjectString = certificate.getIssuerDN().getName(); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateSubject.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateSubject.java index 49774b141ea0bf3b19e63fd6a3044c6a5bde59ae..e8ed38af89e9db9fe8d17abd082fb4086701a48d 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateSubject.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/CertificateSubject.java @@ -73,7 +73,7 @@ public class CertificateSubject { */ public CertificateSubject(String subject) { if (subject == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("certificateSubject", "E-RSP19024"); } X500Principal principal = new X500Principal(subject); setSubjectString(principal.getName(X500Principal.RFC1779)); @@ -87,7 +87,7 @@ public class CertificateSubject { */ public CertificateSubject(X509Certificate certificate) { if (certificate == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("certificate", "E-RSP19025"); } X500Principal x500 = certificate.getSubjectX500Principal(); @@ -103,7 +103,7 @@ public class CertificateSubject { */ public CertificateSubject(X500Principal subjectDN) { if (subjectDN == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("subjectDN", "E-RSP19026"); } setSubjectString(subjectDN.getName(X500Principal.RFC1779)); getBase(); @@ -122,10 +122,10 @@ public class CertificateSubject { */ private void setSubjectString(String subject) { if (subject == null) { - throw new ArgumentNullException("CertificateSubject"); + throw new ArgumentNullException("certificateSubject", "E-RSP19024"); } if (subject.trim().length() < 1) { - throw new EmptyStringException("CertificateSubject"); + throw new EmptyStringException("E-RSP19027: certificateSubject is an empty string"); } subjectString = subject.trim(); @@ -186,7 +186,7 @@ public class CertificateSubject { if (v.size() > 0) { return v.get(0).toString(); } - throw new IllegalArgumentException("could not parse serial-number [" + subject + "]"); + throw new IllegalArgumentException("E-RSP19029: Could not parse serial-number [" + subject + "]"); } /* diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/SignatureValidationProof.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/SignatureValidationProof.java index abaee42580f3493a670d1acbf1fb9ca5045524ef..57ba237ce947ee52ecabbe385c3660a196e921b0 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/SignatureValidationProof.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/SignatureValidationProof.java @@ -93,7 +93,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void completeValidation(String subject) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(subject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + subject); timeStamp = new Date(); this.certificateSubject = subject; this.validCertificate = true; @@ -137,7 +137,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setTimeStamp(Date value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); timeStamp = value; } @@ -158,7 +158,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setCertificateSubject(String value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); certificateSubject = value; } @@ -180,7 +180,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setValidCertificate(boolean value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); validCertificate = value; } @@ -201,7 +201,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setValidSignature(boolean value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); validSignature = value; } @@ -223,7 +223,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setUnchangedMessage(boolean value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); unchangedMessage = value; } @@ -245,7 +245,7 @@ public class SignatureValidationProof implements ISignatureValidationProof { */ public void setEncryptedMessage(boolean value) throws SignatureValidationProofAllreadyCompletedException { if (completed) - throw new SignatureValidationProofAllreadyCompletedException(certificateSubject); + throw new SignatureValidationProofAllreadyCompletedException("E-RSP19031: " + certificateSubject); encryptedMessage = value; } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/ConnectingToLdapServerFailedException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/ConnectingToLdapServerFailedException.java index 129c4e3d6bffdad2d2ecb7df226d97674eec161d..ec0bc5de67377b881b4b5841c337feadf8f22586 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/ConnectingToLdapServerFailedException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/ConnectingToLdapServerFailedException.java @@ -38,7 +38,7 @@ public class ConnectingToLdapServerFailedException extends LdapException { * @param settings The settings used when attempting connection * @param innerException The cause exception */ - public ConnectingToLdapServerFailedException(final LdapSettings settings, final Throwable innerException) { - super(String.valueOf(settings), innerException); + public ConnectingToLdapServerFailedException(final LdapSettings settings, final Throwable innerException, String errorCode) { + super(errorCode + ": " + String.valueOf(settings), innerException); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateLookup.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateLookup.java index 93e7f7c0369a9db88c1ce2ec82be7f2bdb2d7fe5..f795bf62409b76af94040bfb9fc3851b9a2cbfeb 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateLookup.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateLookup.java @@ -102,7 +102,7 @@ public class LdapCertificateLookup implements ICertificateLookup { */ public X509Certificate getCertificate(final CertificateSubject subject) throws CertificateLookupException, CertificateNotActiveException, CertificateExpiredException { if (subject == null) { - throw new ArgumentNullException("subject"); + throw new ArgumentNullException("subject", "E-RSP19101"); } X509Certificate certificateToBeReturned; @@ -132,7 +132,7 @@ public class LdapCertificateLookup implements ICertificateLookup { * * Let's log it at least */ - log.warn("LdapCertificateLookup: certificate with subject " + subject + " found in cache is not valid by dates: " + e.getMessage() + ", request certificate again"); + log.warn("W-RSP19131: LdapCertificateLookup: certificate with subject " + subject + " found in cache is not valid by dates: " + e.getMessage() + ", request certificate again"); certificateToBeReturned = getCertificateOnlineAndUpdateCache(subject); } @@ -170,7 +170,7 @@ public class LdapCertificateLookup implements ICertificateLookup { public X509Certificate getCertificateFromLDAP(final CertificateSubject subject) throws CertificateLookupException { if (subject == null) { - throw new ArgumentNullException("subjectSerialNumber"); + throw new ArgumentNullException("subjectSerialNumber", "E-RSP19108"); } long start = 0; if (log.isDebugEnabled()) { @@ -206,15 +206,15 @@ public class LdapCertificateLookup implements ICertificateLookup { hasMore = answer.hasMore(); } catch (CommunicationException e) { - log.error("LdapCertificateLookup: Could not perform lookup/search: " + e.getMessage(), e); - throw new ConnectingToLdapServerFailedException(ldapSettings, e); + log.error("E-RSP19132: LdapCertificateLookup: Could not perform lookup/search: " + e.getMessage(), e); + throw new ConnectingToLdapServerFailedException(ldapSettings, e, "E-RSP19102"); } catch (NamingException e) { - log.error("LdapCertificateLookup: Could not create Ldap lookup/Search Context: " + e.getMessage(), e); - throw new LdapCertificateLookupInitializationFailedException("Could not create Ldap Search Context for: " + ldapQueryString, e); + log.error("E-RSP19133: LdapCertificateLookup: Could not create Ldap lookup/Search Context: " + e.getMessage(), e); + throw new LdapCertificateLookupInitializationFailedException("E-RSP19109: Could not create Ldap Search Context for: " + ldapQueryString, e); } if (!hasMore) { - throw new LdapCertificateNotFoundException(subject); + throw new LdapCertificateNotFoundException(subject, "E-RSP19104"); } byte[] certificateBytes; @@ -224,36 +224,36 @@ public class LdapCertificateLookup implements ICertificateLookup { Attribute attribute = attrs.get("userCertificate;binary"); if (attribute == null) { - throw new ConvertingSearchResultToCertificateFailedException("Could not get certificate attribute from Ldap Search: userCertificate;binary"); + throw new ConvertingSearchResultToCertificateFailedException("E-RSP19106: Could not get certificate attribute from Ldap Search: userCertificate;binary"); } certificateBytes = (byte[]) attribute.get(); } catch (NamingException e) { - log.error("LdapCertificateLookup: Could not get certificate attribute from Ldap Search: " + e.getMessage(), e); - throw new ConvertingSearchResultToCertificateFailedException("Could not get certificate attribute from Ldap Search", e); + log.error("E-RSP19134: LdapCertificateLookup: Could not get certificate attribute from Ldap Search: " + e.getMessage(), e); + throw new ConvertingSearchResultToCertificateFailedException("E-RSP19110: Could not get certificate attribute from Ldap Search", e); } try { Collection c = getCertificateFactory().generateCertificates(new ByteArrayInputStream(certificateBytes)); certificateToBeReturned = (X509Certificate) c.iterator().next(); } catch (CertificateException e) { - log.error("LdapCertificateLookup: Could not create certificate form ldap result: " + e.getMessage(), e); - throw new ConvertingSearchResultToCertificateFailedException("Could not create certificate form ldap result", e); + log.error("E-RSP19135: LdapCertificateLookup: Could not create certificate form ldap result: " + e.getMessage(), e); + throw new ConvertingSearchResultToCertificateFailedException("E-RSP19107: Could not create certificate form ldap result", e); } if (certificateToBeReturned == null) { log.info("LdapCertificateLookup: Certificate not found with LDAP query:" + subject.getSerialNumberValue()); - throw new LdapCertificateNotFoundException(subject); + throw new LdapCertificateNotFoundException(subject, "E-RSP19104"); } try { hasMore = answer.hasMore(); } catch (NamingException e) { - log.error("LDAP lookup failed: " + e.getMessage(), e); - throw new LdapCertificateLookupInitializationFailedException("LDAP lookup failed: " + e.getMessage(), e); + log.error("E-RSP19136: LDAP lookup failed: " + e.getMessage(), e); + throw new LdapCertificateLookupInitializationFailedException("E-RSP19109: LDAP lookup failed: " + e.getMessage(), e); } if (hasMore) { - throw new LdapMultipleCertificatesFoundException(subject); + throw new LdapMultipleCertificatesFoundException(subject, "E-RSP19105"); } } finally { if (log.isDebugEnabled()) { diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateNotFoundException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateNotFoundException.java index 09945dd37ba06b87c855c40ade8f12a409dfd3a6..7de529652b108f56e7ed7b6a91eaccc57c462a3a 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateNotFoundException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapCertificateNotFoundException.java @@ -38,8 +38,8 @@ public class LdapCertificateNotFoundException extends CertificateNotFoundExcepti * @param subject * The certificate subject */ - public LdapCertificateNotFoundException(final CertificateSubject subject) { - super(subject.getSubjectString()); + public LdapCertificateNotFoundException(final CertificateSubject subject, final String errorCode) { + super(errorCode + ": " + subject.getSubjectString()); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapLookupFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapLookupFactory.java index 3f2f311d08e8eaad7108de9562da67362e1dba03..57ff851cc184257f01f074b00185b0756002819b 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapLookupFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapLookupFactory.java @@ -26,24 +26,26 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * Instantiates classes with the ICertificateLookup interface, based on - * configuration. + * Instantiates classes with the ICertificateLookup interface, based on configuration. */ public class LdapLookupFactory { - private static Log log = LogFactory.getLog(LdapLookupFactory.class); - + private static final Log log = LogFactory.getLog(LdapLookupFactory.class); /** * Actual lookup instance. */ private static ICertificateLookup lookupClient; /** - * Instantiates classes with the ICertificateLookup interface, based on - * configuration. + * Hide the public constructor. + */ + private LdapLookupFactory() { + } + + /** + * Instantiates classes with the ICertificateLookup interface, based on configuration. * - * @return Returns a class with the ICertificateLookup interface, based on - * configuration. + * @return Returns a class with the ICertificateLookup interface, based on configuration. */ public static ICertificateLookup createLdapLookupClient() { if (lookupClient == null) { @@ -54,14 +56,14 @@ public class LdapLookupFactory { log.debug("Init LdapLookupFactory with class: " + config.getImplementationNamespaceClass()); lookupClient = (ICertificateLookup) Class.forName(config.getImplementationNamespaceClass()).newInstance(); } catch (InstantiationException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP19125"); } catch (IllegalAccessException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP19126"); } catch (ClassNotFoundException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP19127"); } } } return lookupClient; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapMultipleCertificatesFoundException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapMultipleCertificatesFoundException.java index 5090274f0d66243144e6119dec1e2b1ccd0c5e4b..cceaa56756390fda6b87f605920d70da01eeca17 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapMultipleCertificatesFoundException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/ldap/LdapMultipleCertificatesFoundException.java @@ -38,8 +38,8 @@ public class LdapMultipleCertificatesFoundException extends MultipleCertificates * @param subject * The certificate subject */ - public LdapMultipleCertificatesFoundException(final CertificateSubject subject) { - super(String.valueOf(subject)); + public LdapMultipleCertificatesFoundException(final CertificateSubject subject, final String errorCode) { + super(errorCode + ": " + String.valueOf(subject)); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/lookup/CertificateLoader.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/lookup/CertificateLoader.java index 46d868d13661840e3c0f782219aa21becea5a14e..af55715150c67f7fff1902b8f5f53ae858ff4418 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/lookup/CertificateLoader.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/lookup/CertificateLoader.java @@ -41,6 +41,12 @@ public class CertificateLoader { private static final Log log = LogFactory.getLog(CertificateLoader.class); + /** + * Hide public constructor. + */ + private CertificateLoader() { + } + /* * Tries to load the root certificate by searching the user home directory, the current classpath and the system classpath. * @@ -62,12 +68,12 @@ public class CertificateLoader { } catch (Exception e) { // Hide exception } - log.warn("CertificateLoader: cannot locate key store by location " + rootCertConfig.getKeyStoreLocation() + ", among others tried file path " + fileCanonicalPath); + log.warn("W-RSP19203: CertificateLoader: cannot locate key store by location " + rootCertConfig.getKeyStoreLocation() + ", among others tried file path " + fileCanonicalPath); } } if (log.isWarnEnabled() && rootCertLocation != null && cert == null) { - log.warn("CertificateLoader: No certificate with label '" + rootCertConfig.getKeyLabel() + "' is found at key store at " + rootCertLocation); + log.warn("W-RSP19204: CertificateLoader: No certificate with label '" + rootCertConfig.getKeyLabel() + "' is found at key store at " + rootCertLocation); } return cert; @@ -87,7 +93,7 @@ public class CertificateLoader { try { log.info("Loading root certs from JKS=" + new File(rootCertLocation.toURI()).getAbsolutePath()); } catch (URISyntaxException e) { - log.warn("Exception for JKS=" + rootCertConfig.getKeyStoreLocation() + ": " + e.getMessage(), e); + log.warn("W-RSP19205: Exception for JKS=" + rootCertConfig.getKeyStoreLocation() + ": " + e.getMessage(), e); } } keyStore.load(rootCertLocation.openStream(), rootCertConfig.getKeyStorePassword().toCharArray()); @@ -104,10 +110,10 @@ public class CertificateLoader { } } } else { - log.error("Keystore not found at location=" + rootCertConfig.getKeyStoreLocation()); + log.error("E-RSP19206: Keystore not found at location=" + rootCertConfig.getKeyStoreLocation()); } if (x509RootCertificateList.isEmpty()) { - log.error("No certificates found based on: " + rootCertConfig); + log.error("E-RSP19207: No certificates found based on: " + rootCertConfig); } else { log.info(x509RootCertificateList.size() + " certificates found based on: " + rootCertConfig); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/CertificateUtil.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/CertificateUtil.java index f9cdd3f9a25a6c617f96d006210f80bbfdb9c34a..ddbef62bdc5e92ed14c759543d67dcfe40c84372 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/CertificateUtil.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/CertificateUtil.java @@ -130,7 +130,7 @@ public class CertificateUtil { * * TODO DLK: Think at least about logging such exception, throwing exception is preferred. */ - log.error("Unable to find CRL URL for cert=[" + cert.getSubjectDN().getName() + "]: " + e.getMessage(), e); + log.error("E-RSP19351: Unable to find CRL URL for cert=[" + cert.getSubjectDN().getName() + "]: " + e.getMessage(), e); } } @@ -151,7 +151,7 @@ public class CertificateUtil { return list.get(0); } } catch (Exception e) { - log.warn("Error fetching certificate: " + e.getMessage(), e); + log.warn("W-RSP19352: Error fetching certificate: " + e.getMessage(), e); } return null; @@ -214,18 +214,18 @@ public class CertificateUtil { downloadedX509Certificate = (X509Certificate) certificateFactory.generateCertificate(inputStream); cache.add(certificateIssuerSubject, downloadedX509Certificate); } catch (IOException e) { - log.warn("Error reading from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); + log.warn("W-RSP19353: Error reading from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); } catch (CertificateException e) { - log.warn("Error creating certificate from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); + log.warn("W-RSP19354: Error creating certificate from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); } catch (Exception e) { - log.warn("Unexpected error during downloading certificate from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); + log.warn("W-RSP19355: Unexpected error during downloading certificate from url " + issuerCertificateURL + " input stream: " + e.getMessage(), e); } finally { // remember to close the input stream. if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { - log.warn("Error closing InputStream: " + e.getMessage(), e); + log.warn("W-RSP19356: Error closing InputStream: " + e.getMessage(), e); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/FailedGetOcesCertificateTypeException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/FailedGetOcesCertificateTypeException.java index e895b44cd53982b988beeef1a0275be16b6df2e1..de575239ccdbf184b563ebd6af8f868b76b10fd1 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/FailedGetOcesCertificateTypeException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/FailedGetOcesCertificateTypeException.java @@ -28,8 +28,8 @@ public class FailedGetOcesCertificateTypeException extends * Constructor that takes the certificate and an exception as the reason as parameter. * @param innerException */ - public FailedGetOcesCertificateTypeException(Exception innerException) + public FailedGetOcesCertificateTypeException(Exception innerException, String errorCode) { - super(innerException); + super(innerException, errorCode); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/InvalidOcesCertificateException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/InvalidOcesCertificateException.java index 2f62594be6b488b4ba3c7aaf0938fadf9f83f239..9be89b68bbc3d71da03f1ca847cac81ca737529a 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/InvalidOcesCertificateException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/InvalidOcesCertificateException.java @@ -32,13 +32,11 @@ public class InvalidOcesCertificateException extends OcesCertificateException { private static final long serialVersionUID = 1L; /** - * Constructor that takes the certificate that is not a valid oces - * certificate as parameter. - * - * @param certificate - * certificate + * Constructor that takes the certificate that is not a valid oces certificate as parameter. + * + * @param certificate certificate. */ - public InvalidOcesCertificateException(final X509Certificate certificate) { - super(certificate); + public InvalidOcesCertificateException(final X509Certificate certificate, final String errorCode) { + super(certificate, errorCode); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateException.java index fc89ff6b45a6d014302791950f2236e838e8028f..7301281f1f781215f961309fe9d1cfa0f3b13499 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateException.java @@ -45,8 +45,8 @@ public class OcesCertificateException extends CertificateHandlingException { * @param innerException * causing exception */ - public OcesCertificateException(final Exception innerException) { - super(innerException); + public OcesCertificateException(final Exception innerException, final String errorCode) { + super(innerException, errorCode); } /** @@ -65,8 +65,8 @@ public class OcesCertificateException extends CertificateHandlingException { * @param certificate * certificate */ - public OcesCertificateException(final X509Certificate certificate) { - super(certificate.getIssuerDN() + " : " + certificate.getSubjectDN()); + public OcesCertificateException(final X509Certificate certificate, final String errorCode) { + super(errorCode + ": " + certificate.getIssuerDN() + " : " + certificate.getSubjectDN()); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateSubjectKey.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateSubjectKey.java index 0980bcf9615c56b538bf9e5304e5258a68ad5b28..6067952fdffd2514696c42cd182e6f428e4906fd 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateSubjectKey.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesCertificateSubjectKey.java @@ -70,13 +70,13 @@ public class OcesCertificateSubjectKey { } private void CheckSubjectKeyString(String subjectKeyString) throws InvalidOcesCertificateSubjectKeyException { - if (subjectKeyString == null || subjectKeyString.equals("")) throw new NullOrEmptyArgumentException("keyString"); + if (subjectKeyString == null || subjectKeyString.equals("")) throw new NullOrEmptyArgumentException("E-RSP19311: keyString"); Matcher m = subjectKeyStringPattern.matcher(subjectKeyString); if (m.matches()) { - throw new InvalidOcesCertificateSubjectKeyException("Invalid subject key string."); + throw new InvalidOcesCertificateSubjectKeyException("E-RSP19312: Invalid subject key string."); } } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509Certificate.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509Certificate.java index 62b557e3d9d41ee4be5be4a1ebb4cec121a3b821..aa83deaf30066bd5ed7af289a0a6a0af4af7b192 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509Certificate.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509Certificate.java @@ -72,15 +72,15 @@ public class OcesX509Certificate { */ public OcesX509Certificate(X509Certificate certificate) throws InvalidOcesCertificateException, FailedGetOcesCertificateTypeException { if (certificate == null) { - throw new ArgumentNullException("certificate"); + throw new ArgumentNullException("certificate", "E-RSP19321"); } x509Certificate = certificate; subject = new CertificateSubject(x509Certificate); if (getOcesCertificateType(certificate).getType() == OcesCertificateType.NonOces) { - log.error("Object not created, because type=OcesCertificateType.NonOces for [" + certificate.getSubjectDN() + "]"); - throw new InvalidOcesCertificateException(certificate); + log.error("E-RSP19325: Object not created, because type=OcesCertificateType.NonOces for [" + certificate.getSubjectDN() + "]"); + throw new InvalidOcesCertificateException(certificate, "E-RSP19322"); } } @@ -154,14 +154,14 @@ public class OcesX509Certificate { */ public static OcesCertificateType getOcesCertificateType(X509Certificate certificate) throws FailedGetOcesCertificateTypeException { if (certificate == null) { - throw new ArgumentNullException("certificate"); + throw new ArgumentNullException("certificate", "E-RSP19321"); } try { return getFromSubject(certificate); } catch (Exception e) { - log.error("Could not get Oces certificate type from subject " + e, e); - throw new FailedGetOcesCertificateTypeException(e); + log.error("E-RSP19326: Could not get Oces certificate type from subject " + e, e); + throw new FailedGetOcesCertificateTypeException(e, "E-RSP19323"); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509CertificateConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509CertificateConfig.java index 8e1b5b68b95ac5f22c9eb7791df9c26ff1705e46..18aa46579aa2728ca7f96dd00bbf7a75e20b7338 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509CertificateConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/oces/OcesX509CertificateConfig.java @@ -48,10 +48,10 @@ public class OcesX509CertificateConfig OcesCertificateSubjectKey employeeCertificateSubjectKey, OcesCertificateSubjectKey organizationCertificateSubjectKey, OcesCertificateSubjectKey functionCertificateSubjectKey) { - if (personalCertificateSubjectKey == null) throw new ArgumentNullException("personalCertificateSubjectKey"); - if (employeeCertificateSubjectKey == null) throw new ArgumentNullException("employeeCertificateSubjectKey"); - if (organizationCertificateSubjectKey == null) throw new ArgumentNullException("organizationCertificateSubjectKey"); - if (functionCertificateSubjectKey == null) throw new ArgumentNullException("functionCertificateSubjectKey"); + if (personalCertificateSubjectKey == null) throw new ArgumentNullException("personalCertificateSubjectKey", "E-RSP19331"); + if (employeeCertificateSubjectKey == null) throw new ArgumentNullException("employeeCertificateSubjectKey", "E-RSP19332"); + if (organizationCertificateSubjectKey == null) throw new ArgumentNullException("organizationCertificateSubjectKey", "E-RSP19333"); + if (functionCertificateSubjectKey == null) throw new ArgumentNullException("functionCertificateSubjectKey", "E-RSP19334"); _personalCertificateSubjectKey = personalCertificateSubjectKey; _employeeCertificateSubjectKey = employeeCertificateSubjectKey; _organizationCertificateSubjectKey = organizationCertificateSubjectKey; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationException.java index 8bb499e09b00ad084993ae10282366116d7e1180..dec00301bd783edc05d6487d1d26d7ebb39c982f 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationException.java @@ -26,9 +26,9 @@ import dk.gov.oiosi.security.CertificateHandlingException; */ public class RevocationException extends CertificateHandlingException { - private static final long serialVersionUID = -1103450041200842017L; + private static final long serialVersionUID = -1103450041200842017L; - /** + /** * Base constructor. */ public RevocationException() { @@ -38,34 +38,29 @@ public class RevocationException extends CertificateHandlingException { /** * Base constructor. * - * @param e - * message + * @param e message */ public RevocationException(final String e) { super(e); } +// /** +// * Constructor with inner exception. +// * +// * @param innerException Inner exception of the thrown exception. +// */ +// public RevocationException(final Exception innerException) { +// super(innerException); +// } + /** * Constructor with inner exception. * - * @param innerException - * innerexception of the thrown exception + * @param message error message. + * @param innerException Inner exception of the thrown exception. + * @since OIORASP 1.3.0 */ - public RevocationException(final Exception innerException) { - super(innerException); - } - - /** - * Constructor with inner exception. - * - * @param message - * error message - * @param innerException - * innerexception of the thrown exception - * @since OIORASP 1.3.0 - */ public RevocationException(String message, final Exception innerException) { super(message, innerException); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationLookupFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationLookupFactory.java index ffa21b2fe4b11b36916043a663fe72bb98819b51..c07dbcbff5e93656ad72ee2b6d06305f9598c823 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationLookupFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/RevocationLookupFactory.java @@ -29,16 +29,22 @@ import org.apache.commons.logging.LogFactory; */ public class RevocationLookupFactory { - private static Log log = LogFactory.getLog(RevocationLookupFactory.class); + private static final Log log = LogFactory.getLog(RevocationLookupFactory.class); private static IRevocationLookup lookupClient; + /** + * Hide default constructor. + */ + private RevocationLookupFactory() { + } + /** * Builds an instance of an IRevocationLookup client based on configuration. * * @return revocation lookup */ - public static IRevocationLookup createRevocationLookupClient() { + public static IRevocationLookup createRevocationLookupClient() { if (lookupClient == null) { synchronized (RevocationLookupFactory.class) { RevocationLookupFactoryConfig config = ConfigurationHandler.getInstance().getRevocationLookupFactoryConfig(); @@ -47,11 +53,11 @@ public class RevocationLookupFactory { log.debug("Init RevocationLookupFactory with class: " + config.getImplementationNamespaceClass()); lookupClient = (IRevocationLookup) Class.forName(config.getImplementationNamespaceClass()).newInstance(); } catch (InstantiationException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e.getMessage(), e, "E-RSP19454"); } catch (IllegalAccessException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e.getMessage(), e, "E-RSP19455"); } catch (ClassNotFoundException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e.getMessage(), e, "E-RSP19456"); } } } @@ -66,4 +72,4 @@ public class RevocationLookupFactory { protected static void clear() { lookupClient = null; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCache.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCache.java index 2a7ca586390ae826d66cdd15e91da677c9291119..4eed3811313efd4a1332c17e74dc65a550439c18 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCache.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCache.java @@ -74,10 +74,10 @@ public class CrlCache { if (value > 0) { onFailureRetryIntervalMinutes = value; } else { - log.error("Invalid value for config field " + CONFIG_PARAM_ON_FAILURE_RETRY_INTERVAL_MINUTES + ", found='" + configValue + "', which was parsed as " + value + ". Value should be more than 0. Use default " + DEFAULT_ON_FAILURE_RETRY_INTERVAL_MINUTES); + log.error("E-RSP19461: Invalid value for config field " + CONFIG_PARAM_ON_FAILURE_RETRY_INTERVAL_MINUTES + ", found='" + configValue + "', which was parsed as " + value + ". Value should be more than 0. Use default " + DEFAULT_ON_FAILURE_RETRY_INTERVAL_MINUTES); } } catch (Exception e) { - log.error("Failed to parse config field " + CONFIG_PARAM_ON_FAILURE_RETRY_INTERVAL_MINUTES + ", found='" + configValue + "', use default " + DEFAULT_ON_FAILURE_RETRY_INTERVAL_MINUTES); + log.error("E-RSP19462: Failed to parse config field " + CONFIG_PARAM_ON_FAILURE_RETRY_INTERVAL_MINUTES + ", found='" + configValue + "', use default " + DEFAULT_ON_FAILURE_RETRY_INTERVAL_MINUTES); } } } @@ -129,7 +129,7 @@ public class CrlCache { // Cache was successfully updated, schedule next update scheduleCacheUpdate(url, crlInstance.getNextUpdate()); } catch (CheckCertificateRevokedUnexpectedException e) { - log.error("Failed to initialize CRL cache for URL " + key + ", schedule new attempts with interval " + this.onFailureRetryIntervalMinutes + " minutes", e); + log.error("E-RSP19463: Failed to initialize CRL cache for URL " + key + ", schedule new attempts with interval " + this.onFailureRetryIntervalMinutes + " minutes", e); scheduleCacheUpdate(url, null); return crlInstance; } @@ -161,7 +161,7 @@ public class CrlCache { * Log warning message in this case. */ if (nextRun != null && nextRun.before(c.getTime())) { - log.warn("CrlCache: downloaded CRL list requires update before current time (" + nextRun + "). Check your time settings to be sure that you use correct time. Next update date is changed to be not earlier than in 5 minutes from now"); + log.warn("W-RSP19464: CrlCache: downloaded CRL list requires update before current time (" + nextRun + "). Check your time settings to be sure that you use correct time. Next update date is changed to be not earlier than in 5 minutes from now"); c.add(Calendar.MINUTE, MINIMAL_CACHE_UPDATE_INTERVAL_MINUTES); nextRun = c.getTime(); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCacheUpdateJob.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCacheUpdateJob.java index 877ef36524e4328749f2a5fe73135ded0ee4e132..233f4e88abd8d5fc3638f5bad38053e56f92fae0 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCacheUpdateJob.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlCacheUpdateJob.java @@ -25,7 +25,7 @@ public class CrlCacheUpdateJob extends AbstractScheduleJob { public CrlCacheUpdateJob(URL crlUrl, String actionDetail) { if (crlUrl == null) { - throw new IllegalArgumentException("CrlCacheUpdateJob " + actionDetail + ": null url is passed"); + throw new IllegalArgumentException("E-RSP19416: CrlCacheUpdateJob " + actionDetail + ": null url is passed"); } this.actionDetail = actionDetail; this.crlUrl = crlUrl; @@ -58,7 +58,7 @@ public class CrlCacheUpdateJob extends AbstractScheduleJob { try { crl.updateData(); } catch (Exception e) { - log.error("CrlCacheUpdateJob: failed to " + actionDetail + " CRL cache for url '" + crlUrl + "' after " + (System.currentTimeMillis() - start) + " ms, continue attempts later", e); + log.error("E-RSP19415: CrlCacheUpdateJob: failed to " + actionDetail + " CRL cache for url '" + crlUrl + "' after " + (System.currentTimeMillis() - start) + " ms, continue attempts later", e); return true; } /* diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlInstance.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlInstance.java index f558543a0934cb843a24908d9de39297ccb13699..f30560bfab5ed52a20cee59d9e758e76c9552de0 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlInstance.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlInstance.java @@ -27,7 +27,10 @@ import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; -import java.security.cert.*; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.cert.X509CRL; +import java.security.cert.X509CRLEntry; import java.util.*; /** @@ -88,26 +91,23 @@ public class CrlInstance { input.close(); } catch (Exception e) { // Hide exception here, not relevant - log.warn("Error closing InputStream: " + e.getMessage(), e); + log.warn("W-RSP19481: Error closing InputStream: " + e.getMessage(), e); } } // Everything went well. } else { // url connection not valid, throwing an exception - log.error("CRL-data could not be downloaded from url=" + crlUrl + ": " + urlConnection.getResponseMessage()); - throw new CheckCertificateRevokedUnexpectedException("CRL-data could not be downloaded from url=" + crlUrl + ": " + urlConnection.getResponseMessage()); + log.error("E-RSP19407: CRL-data could not be downloaded from url=" + crlUrl + ": " + urlConnection.getResponseMessage()); + throw new CheckCertificateRevokedUnexpectedException("E-RSP19402: CRL-data could not be downloaded from url=" + crlUrl + ": " + urlConnection.getResponseMessage()); } } catch (IOException e) { // Could not download new crl - log.error("CRL-data could not be downloaded from url=" + crlUrl + ": " + e.getMessage(), e); - throw new CheckCertificateRevokedUnexpectedException("IO error via access to url=" + crlUrl, e, crlUrl); - } catch (CRLException e) { - // Something was wrong with crl - log.error("CRL-data could not be downloaded from url=" + crlUrl + ": " + e.getMessage(), e); - throw new CheckCertificateRevokedUnexpectedException("CRL problem during access to url=" + crlUrl, e, crlUrl); + log.error("E-RSP19408: CRL-data could not be downloaded from url=" + crlUrl + ": " + e.getMessage(), e); + throw new CheckCertificateRevokedUnexpectedException("E-RSP19403: IO error via access to url=" + crlUrl, e, crlUrl); } catch (Exception e) { - log.error("CRL-data could not be downloaded from url=" + crlUrl + ": " + e.getMessage(), e); - throw new CheckCertificateRevokedUnexpectedException("Unexpected exception during access to url=" + crlUrl, e, crlUrl); + // Something was wrong with crl + log.error("E-RSP19409: CRL-data could not be downloaded from url=" + crlUrl + ": " + e.getMessage(), e); + throw new CheckCertificateRevokedUnexpectedException(e.getMessage(), e, crlUrl); } } @@ -260,4 +260,4 @@ public class CrlInstance { } } } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlLookup.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlLookup.java index b8d408e5194ea6df610dc418096e10b3c71f11af..04344fa166bf25d997c28888c10d2332b267bb26 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlLookup.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/CrlLookup.java @@ -63,8 +63,8 @@ public class CrlLookup implements IRevocationLookup { try { cache = new CrlCache(); } catch (Exception e) { - log.error("Call to new CrlCache() failed: " + e.getMessage(), e); - throw new RuntimeException(e.getMessage(), e); + log.error("E-RSP19471: Call to new CrlCache() failed: " + e.getMessage(), e); + throw new RuntimeException("E-RSP19408: " + e.getMessage(), e); } } @@ -83,7 +83,7 @@ public class CrlLookup implements IRevocationLookup { // Fail fast! if (certificate == null) { - throw new RevocationException("Fault happened at CrlLookup.checkCertificate: null certificate was passed"); + throw new RevocationException("E-RSP19409: Fault happened at CrlLookup.checkCertificate: null certificate was passed"); } RevocationResponse response = new RevocationResponse(); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/SimpleCrlLookup.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/SimpleCrlLookup.java index 9b0c10e1932eeec46908a5e90eb12cdc40dcb3c0..5bd8acc2a15e61b1a97ca9c3d93ceaca07dde62e 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/SimpleCrlLookup.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/crl/SimpleCrlLookup.java @@ -52,7 +52,7 @@ public class SimpleCrlLookup extends CrlLookup { * Fail fast! */ if (certificate == null) { - throw new RevocationException("Fault happened at CrlLookup.checkCertificate: null certificate was passed"); + throw new RevocationException("E-RSP19409: Fault happened at CrlLookup.checkCertificate: null certificate was passed"); } RevocationResponse response = new RevocationResponse(); @@ -105,7 +105,7 @@ public class SimpleCrlLookup extends CrlLookup { StringBuilder sb = new StringBuilder(); sb.append("Fault happened at CrlLookup.checkCertificate: none URL to CRL server is retrieved from certificate "); sb.append(certificate.getSubjectX500Principal()); - throw new RevocationException(sb.toString()); + throw new RevocationException("E-RSP19410: " + sb.toString()); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspConfig.java index a20aeaf805607ac7a7a4e2d7d67e1b4b02ac50d9..2decdcc535c4f7f8c8f0a8167988e554de642cca 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspConfig.java @@ -27,6 +27,7 @@ import dk.gov.oiosi.security.lookup.CertificateLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.io.FileNotFoundException; import java.io.IOException; import java.net.URISyntaxException; import java.security.KeyStoreException; @@ -106,14 +107,14 @@ public class OcspConfig { */ public void setDefaultTimeoutMsec(long value) { if (defaultTimeoutMsec < 0) { - throw new IllegalArgumentException("Timeout value < 0 must be greater than -1."); + throw new IllegalArgumentException("E-RSP19414: Timeout value < 0 must be greater than -1."); } defaultTimeoutMsec = value; } public List getDefaultOcesRootCertificateCollectionFromStore() throws CertificateHandlingException { log.info("Loading root certificates from RaspConfiguration"); - List x509List = new ArrayList<>(); + List x509List = new ArrayList(); try { ConfigurationHandler configHandler = ConfigurationHandler.getInstance(); List rootCertificateKeyStoreFileList = configHandler.getRootCertificateLocationCollection(); @@ -123,8 +124,18 @@ public class OcspConfig { if (log.isInfoEnabled()) { log.info("Root certificates loaded, found count=" + x509List.size()); } - } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { - throw new CertificateHandlingException(e); + + } catch (KeyStoreException e) { + throw new CertificateHandlingException("E-RSP19413",e); + } catch (NoSuchAlgorithmException e) { + throw new CertificateHandlingException("E-RSP19413",e); + } catch (CertificateException e) { + throw new CertificateHandlingException("E-RSP19413",e); + } catch (FileNotFoundException e) { + throw new CertificateHandlingException("E-RSP19413",e); + } catch (IOException e) { + throw new CertificateHandlingException("E-RSP19413",e); + } return x509List; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java index f5842801a18c175335423df4007c85f87832d49b..70cfac96f9c3faa0c2a1b1719ee849c7d101906d 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java @@ -97,7 +97,7 @@ public class OcspLookup implements IRevocationLookup { try { configuration = ConfigurationHandler.getInstance().getOcspConfig(); } catch (URISyntaxException e) { - throw new ConfigurationException(e.getMessage()); + throw new ConfigurationException("E-RSP19443: "+ e.getMessage()); } rootCertificateMap = new HashMap<>(); @@ -108,7 +108,7 @@ public class OcspLookup implements IRevocationLookup { rootCertificateMap.put(rootCertificate.getIssuerDN().getName(), rootCertificate); } } catch (CertificateHandlingException e) { - log.error(e.getMessage(), e); + log.error("E-RSP19491: " + e.getMessage(), e); } certificateUtil = new CertificateUtil(); @@ -130,7 +130,7 @@ public class OcspLookup implements IRevocationLookup { rootCertificateMap.put(rootCertificate.getIssuerDN().getName(), rootCertificate); } } catch (CertificateHandlingException e) { - log.error(e.getMessage(), e); + log.error("E-RSP19491: " + e.getMessage(), e); } certificateUtil = new CertificateUtil(); @@ -254,18 +254,18 @@ public class OcspLookup implements IRevocationLookup { // The response was not in the cache - we must validate the certificate online. if (x509Certificate == null) { - throw new RevocationException("Certificate object is null"); + throw new RevocationException("E-RSP19421: Certificate object is null"); } X509Certificate issuerX509Certificate = findIssuerCertificate(x509Certificate); if (issuerX509Certificate == null) { - throw new RevocationException("Certificate '" + x509Certificate.getSubjectX500Principal() + "' is not trusted, as issuer could not be identified"); + throw new RevocationException("E-RSP19422: Certificate '" + x509Certificate.getSubjectX500Principal() + "' is not trusted, as issuer could not be identified"); } RevocationResponse revocationResponse; // Is the certificate that we are verifying, the root certificate itself? if (x509Certificate.getIssuerDN().getName().equals(issuerX509Certificate.getSubjectX500Principal().getName())) { - throw new RevocationException("Certificate not trusted, as the certificate is self-signed"); + throw new RevocationException("E-RSP19442: Certificate not trusted, as the certificate is self-signed"); } else { revocationResponse = revocationResponseOnline(x509Certificate, issuerX509Certificate); @@ -330,10 +330,10 @@ public class OcspLookup implements IRevocationLookup { */ private RevocationResponse revocationResponseOnline(X509Certificate certificateToValidate, X509Certificate issuerX509Certificate) throws RevocationException { if (certificateToValidate == null) { - throw new RevocationException("certificateToValidate certificate is null"); + throw new RevocationException("E-RSP19421: certificateToValidate certificate is null"); } if (issuerX509Certificate == null) { - throw new RevocationException("Issuer certificate for server certificate not identified"); + throw new RevocationException("E-RSP19422: Issuer certificate for server certificate not identified"); } if (log.isDebugEnabled()) { log.debug("Prepare online OCSP call for [" + certificateToValidate.getSubjectDN() + "]"); @@ -341,7 +341,7 @@ public class OcspLookup implements IRevocationLookup { List ocspUrlList = getAuthorityInformationAccessOcspUrls(certificateToValidate); if (ocspUrlList.isEmpty()) { - throw new RevocationException("No OCSP url found in certificate: " + certificateToValidate.getSubjectDN().getName()); + throw new RevocationException("E-RSP19423: No OCSP url found in certificate: " + certificateToValidate.getSubjectDN().getName()); } RevocationResponse revocationResponse; @@ -365,8 +365,8 @@ public class OcspLookup implements IRevocationLookup { revocationResponse = processOcspResponse(certificateToValidate, ocspResp); return revocationResponse; } catch (OperatorCreationException | CertificateException | OCSPException e) { - log.error(e.getMessage(), e); - throw new RevocationException(e.getMessage(), e); + log.error("E-RSP19492: " + e.getMessage(), e); + throw new RevocationException("E-RSP19431: " + e.getMessage(), e); } } @@ -397,34 +397,34 @@ public class OcspLookup implements IRevocationLookup { Object responseObject = ocspResponse.getResponseObject(); if (!(responseObject instanceof BasicOCSPResp)) { - throw new IllegalStateException("OCSP response is of unexpected type"); + throw new IllegalStateException("E-RSP19444: OCSP response is of unexpected type"); } BasicOCSPResp basicResp = (BasicOCSPResp) responseObject; SingleResp[] responses = basicResp.getResponses(); if (responses.length != 1) { - throw new IllegalStateException("unexpected number of responses received"); + throw new IllegalStateException("E-RSP19445: Unexpected number of responses received"); } SingleResp singleResp = responses[0]; if (!serverX509Certificate.getSerialNumber().equals(singleResp.getCertID().getSerialNumber())) { - throw new RevocationException("Serial number mismatch problem"); + throw new RevocationException("E-RSP19446: Serial number mismatch problem"); } X509Certificate ocspCertificate = findOcspClientCertificate(basicResp.getCerts()); /* check the signature on the ocsp response */ if (!basicResp.isSignatureValid(new JcaContentVerifierProviderBuilder().setProvider("BC").build(ocspCertificate.getPublicKey()))) { - throw new RevocationException("signature validation failed for ocsp response"); + throw new RevocationException("E-RSP19447: Signature validation failed for ocsp response"); } if (!canSignOcspResponses(ocspCertificate)) { - throw new RevocationException("ocsp signing certificate has not been cleared for ocsp response signing"); + throw new RevocationException("E-RSP19448: Ocsp signing certificate has not been cleared for ocsp response signing"); } /* check expiry of the signing certificate */ if (!certificateValid(ocspCertificate)) { - throw new IllegalStateException("ocsp signing certificate is not valid"); + throw new IllegalStateException("E-RSP19449: ocsp signing certificate is not valid"); } CertificateStatus certStatus = singleResp.getCertStatus(); @@ -446,9 +446,13 @@ public class OcspLookup implements IRevocationLookup { revocationResponse.setIsValid(false); revocationResponse.setNextUpdate(singleResp.getNextUpdate()); } else if (certStatus instanceof org.bouncycastle.cert.ocsp.UnknownStatus) { +<<<<<<< dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java + throw new RevocationException("E-RSP19438: ocsp response indicates unknown certificate status"); +======= throw new RevocationException("OCSP response indicates unknown certificate status"); +>>>>>>> dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookup.java } else { - throw new RevocationException("unknown status"); + throw new RevocationException("E-RSP19438: unknown status"); } break; @@ -460,7 +464,7 @@ public class OcspLookup implements IRevocationLookup { case OCSPResponseStatus.TRY_LATER: case OCSPResponseStatus.UNAUTHORIZED: default: { - log.warn("OCSPResponse has Status error=" + ocspResponse.getStatus()); + log.warn("W-RSP19493: OCSPResponse has Status error=" + ocspResponse.getStatus()); } } @@ -473,8 +477,8 @@ public class OcspLookup implements IRevocationLookup { HttpURLConnection conn = postRequest(req.getEncoded(), url); if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { - log.error("HTTP response code from OCSP request to [" + url + "] was: " + conn.getResponseCode()); - throw new RevocationException("HTTP response code from OCSP request to [" + url + "] was: " + conn.getResponseCode()); + log.error("E-RSP19494: HTTP response code from OCSP request to [" + url + "] was: " + conn.getResponseCode()); + throw new RevocationException("E-RSP19450: HTTP response code from OCSP request to [" + url + "] was: " + conn.getResponseCode()); } // int len = conn.getContentLength(); @@ -490,8 +494,8 @@ public class OcspLookup implements IRevocationLookup { log.debug("Error parsing HttpResponse from url=" + url + ": " + e.getMessage(), e); return null; } catch (IOException e) { - log.error("Error doing OCSP lookup by url=" + url + ": " + e.getMessage(), e); - throw new RevocationException(e); + log.error("E-RSP19495: Error doing OCSP lookup by url=" + url + ": " + e.getMessage(), e); + throw new RevocationException("E-RSP19420", e); } } @@ -574,13 +578,13 @@ public class OcspLookup implements IRevocationLookup { AccessDescription[] acc = auth.getAccessDescriptions(); return acc[0].getAccessLocation().toString().substring(3); } catch (IOException e) { - throw new RevocationException(e); + throw new RevocationException("E-RSP19420", e); } finally { if (aIn != null) { try { aIn.close(); } catch (IOException e) { - log.warn("Error closing stream: " + e.getMessage(), e); + log.warn("W-RSP19496: Error closing stream: " + e.getMessage(), e); } } } @@ -611,20 +615,20 @@ public class OcspLookup implements IRevocationLookup { } } } catch (IOException e) { - log.warn(e.getMessage(), e); + log.warn("W-RSP19497: " + e.getMessage(), e); } finally { if (extensionAns1InputStream != null) { try { extensionAns1InputStream.close(); } catch (IOException e) { - log.warn("Error closing stream: " + e.getMessage(), e); + log.warn("W-RSP19498: Error closing stream: " + e.getMessage(), e); } } if (octetAns1InputStream != null) { try { octetAns1InputStream.close(); } catch (IOException e) { - log.warn("Error closing stream: " + e.getMessage(), e); + log.warn("W-RSP19499: Error closing stream: " + e.getMessage(), e); } } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/X509CertificateFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/X509CertificateFactory.java index cde21340922ddb05f69b0e1a2172be887f50c115..219823db3c0efb337f6ae8c00c5e21497c40b254 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/X509CertificateFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/revocation/ocsp/X509CertificateFactory.java @@ -43,7 +43,7 @@ public class X509CertificateFactory { try { certificateFactory = CertificateFactory.getInstance("X509"); } catch (CertificateException e) { - throw new IllegalStateException(e); + throw new IllegalStateException("E-RSP19417", e); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateExpiredException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateExpiredException.java index 3189615484e4847e5f5496a652f1df4e93edf330..d441e60352364c31c66006ee011772100f372ac6 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateExpiredException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateExpiredException.java @@ -36,7 +36,7 @@ public class CertificateExpiredException extends CertificateValidationException * * @param expireDate the date the certificate expired */ - public CertificateExpiredException(final Date expireDate, String subject) { - super("Certificate [" + subject + "] expired on: " + String.valueOf(expireDate)); + public CertificateExpiredException(final Date expireDate, String subject, String errorCode) { + super(errorCode + ": Certificate [" + subject + "] expired on: " + String.valueOf(expireDate)); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateNotActiveException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateNotActiveException.java index 7a20f2d734ad8f35277c2006043bc2e0950c511a..b46ef1f43d062ef5b3fa05452d4017157106cb4d 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateNotActiveException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateNotActiveException.java @@ -36,7 +36,7 @@ public class CertificateNotActiveException extends CertificateValidationExceptio * * @param activeDate the date the certificate was activated */ - public CertificateNotActiveException(final Date activeDate, String subject) { - super("Certificate [" + subject + "] is active from: " + String.valueOf(activeDate)); + public CertificateNotActiveException(final Date activeDate, String subject, String errorCode) { + super(errorCode + ": Certificate [" + subject + "] is active from: " + String.valueOf(activeDate)); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateValidator.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateValidator.java index 6f23c7a58cbcb73f641a282725e0ee27d307ef22..bf2c72746aabe9ef4b3625012bad1fd8fc64b0f5 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateValidator.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/security/validation/CertificateValidator.java @@ -64,7 +64,7 @@ public class CertificateValidator { if (log.isDebugEnabled()) { log.debug("Certificate [" + certificate.getSubjectDN().getName() + "] is not active now [" + new Date() + "]"); } - throw new CertificateNotActiveException(certificate.getNotBefore(), certificate.getSubjectDN().getName()); + throw new CertificateNotActiveException(certificate.getNotBefore(), certificate.getSubjectDN().getName(), "E-RSP19505"); } } @@ -76,7 +76,7 @@ public class CertificateValidator { */ public static void checkCertificateExpired(X509Certificate certificate) throws CertificateExpiredException { if (certificate.getNotAfter().before(new Date())) { - throw new CertificateExpiredException(certificate.getNotAfter(), certificate.getSubjectDN().getName()); + throw new CertificateExpiredException(certificate.getNotAfter(), certificate.getSubjectDN().getName(), "E-RSP19506"); } } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/LookupParameters.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/LookupParameters.java index 25380d459a976452611f7b3587baf40e4c79a6cb..844b1aee15d09d2f2cddb0847c40cb764a00320a 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/LookupParameters.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/LookupParameters.java @@ -73,7 +73,7 @@ public class LookupParameters { */ public LookupParameters(final Identifier identifier) { if (identifier == null) { - throw new ArgumentNullException("identifier"); + throw new ArgumentNullException("identifier", "E-RSP16001"); } this.identifier = identifier; @@ -107,7 +107,7 @@ public class LookupParameters { this(identifier); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } this.serviceId = serviceId; } @@ -125,7 +125,7 @@ public class LookupParameters { this(identifier, acceptedTransportProtocols); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } this.serviceId = serviceId; } @@ -143,19 +143,19 @@ public class LookupParameters { this(identifier, acceptedTransportProtocols); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } if (profileIds == null) { - throw new ArgumentNullException("profileIds"); + throw new ArgumentNullException("profileIds", "E-RSP16003"); } if (profileRoleIdentifier == null) { - throw new ArgumentNullException("profileRoleIdentifier"); + throw new ArgumentNullException("profileRoleIdentifier", "E-RSP16005"); } - if (profileIds.size() == 0) { - throw new IllegalArgumentException("profileIds must contain at least one item"); + if (profileIds.isEmpty()){ + throw new IllegalArgumentException("E-RSP16006: profileIds must contain at least one item"); } if (profileConformanceClaim == null) { - throw new ArgumentNullException("profileConformanceClaim"); + throw new ArgumentNullException("profileConformanceClaim", "E-RSP16007"); } this.serviceId = serviceId; @@ -175,16 +175,16 @@ public class LookupParameters { this(identifier, acceptedTransportProtocols); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } if (profileIds == null) { - throw new ArgumentNullException("profileIds"); + throw new ArgumentNullException("profileIds", "E-RSP16003"); } if (profileRoleIdentifier == null) { - throw new ArgumentNullException("profileRoleIdentifier"); + throw new ArgumentNullException("profileRoleIdentifier", "E-RSP16005"); } - if (profileIds.size() == 0) { - throw new IllegalArgumentException("profileIds must contain at least one item"); + if (profileIds.isEmpty()) { + throw new IllegalArgumentException("E-RSP16006: profileIds must contain at least one item"); } this.serviceId = serviceId; @@ -202,10 +202,10 @@ public class LookupParameters { this(identifier, acceptedTransportProtocols); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } if (profileConformanceClaim == null) { - throw new ArgumentNullException("profileConformanceClaim"); + throw new ArgumentNullException("profileConformanceClaim", "E-RSP16007"); } this.serviceId = serviceId; @@ -227,13 +227,13 @@ public class LookupParameters { this(identifier, acceptedTransportProtocols); if (serviceId == null) { - throw new ArgumentNullException("serviceId"); + throw new ArgumentNullException("serviceId", "E-RSP16002"); } if (profileIds == null) { - throw new ArgumentNullException("profileIds"); + throw new ArgumentNullException("profileIds", "E-RSP16003"); } - if (profileIds.size() == 0) { - throw new IllegalArgumentException("profileIds must contain at least one item"); + if (profileIds.isEmpty()) { + throw new IllegalArgumentException("E-RSP16006: profileIds must contain at least one item"); } this.serviceId = serviceId; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/ProcessRoleDefinition.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/ProcessRoleDefinition.java index 28e1738ff47b7c66d8161c9e9d35530b69e29990..72d2b66b89d3d339d61ade2ba6d03ad352e3099d 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/ProcessRoleDefinition.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/ProcessRoleDefinition.java @@ -39,11 +39,11 @@ public class ProcessRoleDefinition { * Constructor that takes the given parameters. */ public ProcessRoleDefinition(String name, String description, String role, String roleType, UddiId processDefinitionId) { - if (name == null || name.isEmpty()) throw new NullOrEmptyArgumentException("name"); - if (description == null) throw new ArgumentNullException("description"); - if (role == null) throw new ArgumentNullException("role"); - if (roleType == null) throw new ArgumentNullException("roleType"); - if (processDefinitionId == null) throw new ArgumentNullException("processDefinitionId"); + if (name == null || name.isEmpty()) throw new NullOrEmptyArgumentException("E-RSP16011: name is null or empty"); + if (description == null) throw new ArgumentNullException("description", "E-RSP16012"); + if (role == null) throw new ArgumentNullException("role", "E-RSP16013"); + if (roleType == null) throw new ArgumentNullException("roleType", "E-RSP16014"); + if (processDefinitionId == null) throw new ArgumentNullException("processDefinitionId", "E-RSP16015"); _name = name; _description = description; _role = role; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/Registry.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/Registry.java index e82e19fd7b71532d81b3a573b2c668559a866275..cacdbd76248ea1918bf41930c9c3b2009edaa32c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/Registry.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/Registry.java @@ -50,7 +50,7 @@ public class Registry { */ public Registry(String[] endpoints, int uddiLookupTimeoutSeconds) throws URISyntaxException { if (endpoints == null) { - throw new ArgumentNullException("endpoints"); + throw new ArgumentNullException("endpoints", "E-RSP16020"); } for (String endpoint : endpoints) { _endpoints.add(new Uri(endpoint)); @@ -67,7 +67,7 @@ public class Registry { */ public Registry(Collection endpoints) { if (endpoints == null) { - throw new ArgumentNullException("endpoints"); + throw new ArgumentNullException("endpoints", "E-RSP16020"); } _endpoints = endpoints; } @@ -89,7 +89,7 @@ public class Registry { */ public void setEndpoints(Collection endpoints) { if (endpoints == null) { - throw new ArgumentNullException("endpoints"); + throw new ArgumentNullException("endpoints", "E-RSP16020"); } _endpoints = endpoints; } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/RegistryLookupClientFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/RegistryLookupClientFactory.java index 6c2581c404d8ce70dd0a3606cc4976d26aeb976f..7b5b994e96b270a3807f25c937004941f6429b34 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/RegistryLookupClientFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/RegistryLookupClientFactory.java @@ -52,11 +52,11 @@ public class RegistryLookupClientFactory { log.debug("Init RegistryLookupClientFactory: " + config.getImplementationNamespaceClass()); lookupClient = (IUddiLookupClient) Class.forName(config.getImplementationNamespaceClass()).newInstance(); } catch (InstantiationException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16024"); } catch (IllegalAccessException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16025"); } catch (ClassNotFoundException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16026"); } } return lookupClient; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiBinding.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiBinding.java index 6cd065f8c522f1818ad2e955b7b16e107f179fa9..d298fe5db809300a9b5c365d27e66c1619360c48 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiBinding.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiBinding.java @@ -35,10 +35,10 @@ class UddiBinding { public UddiBinding(BindingTemplate template, List tModels) { if (template == null) { - throw new ArgumentNullException("template"); + throw new ArgumentNullException("template", "E-RSP16031"); } if (tModels == null) { - throw new ArgumentNullException("tModels"); + throw new ArgumentNullException("tModels", "E-RSP16032"); } this.template = template; @@ -48,7 +48,7 @@ class UddiBinding { public EndpointAddress GetEndpointAddress() throws Exception { AccessPoint accessPointItem = template.getAccessPoint(); if (accessPointItem == null) { - throw new Exception("accessPoint type expected"); + throw new Exception("E-RSP16033: accessPoint type expected"); } return IdentifierUtility.getEndpointAddressFromString(accessPointItem.getStringValue()); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiCategoryBag.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiCategoryBag.java index 8e793996447d6622d6b6e632acc014bb0b9fae39..d5594e83dd61a5e617feb1dcbfa4ff3b04de7aea 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiCategoryBag.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiCategoryBag.java @@ -60,7 +60,7 @@ public class UddiCategoryBag { public boolean tryGetKeyedReference(String tModelKey, OutVariable keyedRef) { if (tModelKey == null || tModelKey.length() <= 0) { - throw new NullOrEmptyArgumentException("tModelKey"); + throw new NullOrEmptyArgumentException("E-RSP16041: tModelKey is null or empty"); } keyedRef.setVariable(keyedReferenceBag.get(tModelKey.toLowerCase())); @@ -69,7 +69,7 @@ public class UddiCategoryBag { public boolean tryGetKeyedReferenceGroup(String tModelKey, OutVariable keyedRef) { if (tModelKey == null || tModelKey.length() <= 0) { - throw new NullOrEmptyArgumentException("tModelKey"); + throw new NullOrEmptyArgumentException("E-RSP16041: tModelKey is null or empty"); } keyedRef.setVariable(keyedReferenceGroupBag.get(tModelKey.toLowerCase())); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClient.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClient.java index 0c58c35c0f7204ad5bc9148a48fcd1be5dc83c91..c0b26fd3c19139925d0cbdbd4e692483ac28fbf4 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClient.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClient.java @@ -54,8 +54,8 @@ public class UddiLookupClient implements IUddiLookupClient { private static final String RASPREGISTRATIONCONFORMANCECLAIM = "http://oio.dk/profiles/OIOSI/1.0/UDDI/registrationModel/1.1/"; private static final ICache> serviceCache = createServiceCache(); private static final ICache tModelCache = createTModelCache(); - private static final List EMPTY_LIST = new ArrayList<>(); - private static final Log log = LogFactory.getLog(IUddiLookupClient.class); + private static final List EMPTY_LIST = new ArrayList(); + private static final Log log = LogFactory.getLog(UddiLookupClient.class); private final Uri uddiLookupHost; private final UDDIClient _uddiProxy; @@ -76,7 +76,7 @@ public class UddiLookupClient implements IUddiLookupClient { try { _uddiProxy = new UDDIClient(connectionInfo); } catch (MalformedURLException e) { - throw new MainException(e); + throw new MainException("", e, "E-RSP16062"); } } @@ -106,19 +106,19 @@ public class UddiLookupClient implements IUddiLookupClient { */ public List lookup(LookupParameters lookupParameters) throws MainException { if (lookupParameters == null) { - throw new ArgumentNullException("lookupParameters"); + throw new ArgumentNullException("lookupParameters", "E-RSP16061"); } List uddiLookupResponseList; try { uddiLookupResponseList = getUddiResponses(lookupParameters); } catch (Exception e) { - log.error(e.getMessage(), e); - throw new MainException(e); + log.error("E-RSP16063: " + e.getMessage(), e); + throw new MainException("E-RSP16063", e); } if (lookupParameters.getAcceptedTransportProtocols() != null && !lookupParameters.getAcceptedTransportProtocols().isEmpty()) { - List supportedResponses = new ArrayList<>(); + List supportedResponses = new ArrayList(); for (UddiLookupResponse uddiLookupResponse : uddiLookupResponseList) { if (hasSupportedTransportProtocol(uddiLookupResponse, lookupParameters)) { supportedResponses.add(uddiLookupResponse); @@ -131,12 +131,12 @@ public class UddiLookupClient implements IUddiLookupClient { } public List getProcessDefinitions(List processDefinitionIds) { - List missingIds = new ArrayList<>(); - List foundTModels = new ArrayList<>(); + List missingIds = new ArrayList(); + List foundTModels = new ArrayList(); // Check the cache for any existing tmodels. for (UddiId processDefinitionId : processDefinitionIds) { - OutVariable out = new OutVariable<>(); + OutVariable out = new OutVariable(); if (tModelCache.tryGetValue(processDefinitionId, out)) { foundTModels.add(out.getVariable()); continue; @@ -145,13 +145,13 @@ public class UddiLookupClient implements IUddiLookupClient { } // Get the tmodels not in the cache. - List tmodels = this.GetUddiTModels(missingIds); + List tmodels = this.getUddiTModels(missingIds); // Adds the tmodels to the cache. for (UddiTModel tmodel : tmodels) { tModelCache.set(tmodel.getUddiId(), tmodel); } - List processDefinitions = new ArrayList<>(); + List processDefinitions = new ArrayList(); foundTModels.addAll(tmodels); for (UddiTModel tmodel : foundTModels) { UddiId uddiId = tmodel.getUddiId(); @@ -184,7 +184,7 @@ public class UddiLookupClient implements IUddiLookupClient { UddiLookupKey key = new UddiLookupKey(lookupParameters.getIdentifier(), lookupParameters.getServiceId(), uddiLookupHost); List uddiServices; - OutVariable> uddiServicesOutVar = new OutVariable<>(); + OutVariable> uddiServicesOutVar = new OutVariable>(); if (serviceCache.tryGetValue(key, uddiServicesOutVar)) { uddiServices = uddiServicesOutVar.getVariable(); } else { @@ -196,7 +196,7 @@ public class UddiLookupClient implements IUddiLookupClient { } } - List lookupResponses = new ArrayList<>(); + List lookupResponses = new ArrayList(); for (UddiService uddiService : uddiServices) { if (uddiService.isInactiveOrExpired()) { continue; @@ -275,18 +275,18 @@ public class UddiLookupClient implements IUddiLookupClient { return EMPTY_LIST; } - List endPointUddiIds = new ArrayList<>(); + List endPointUddiIds = new ArrayList(); for (ServiceInfo serviceInfo : serviceResult.getServiceInfos()) { endPointUddiIds.add(serviceInfo.getServiceKey()); } InquiryClient inquiry = _uddiProxy.getInquiry(); - List uddiServices = new ArrayList<>(); + List uddiServices = new ArrayList(); for (BusinessService businessServiceItem : inquiry.getServices(endPointUddiIds)) { - List uddiBindings = new ArrayList<>(); + List uddiBindings = new ArrayList(); for (BindingTemplate bindingTemplate : businessServiceItem.getBindingTemplates().getBindingTemplateArray()) { - List tModelKeys = new ArrayList<>(); + List tModelKeys = new ArrayList(); for (TModelInstanceInfo tModelInfo : bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfoArray()) { tModelKeys.add(tModelInfo.getTModelKey()); } @@ -304,7 +304,7 @@ public class UddiLookupClient implements IUddiLookupClient { return uddiServices; } - private List GetUddiTModels(List uddiIds) { + private List getUddiTModels(List uddiIds) { String[] tModelKeyArray = new String[uddiIds.size()]; for (int i = 0; i < uddiIds.size(); i++) { tModelKeyArray[i] = uddiIds.get(i).getID(); @@ -313,10 +313,10 @@ public class UddiLookupClient implements IUddiLookupClient { TModel[] tmodelDetails = _uddiProxy.getInquiry().getTModels(tModelKeyArray); if (tmodelDetails == null) { - return new ArrayList<>(); + return new ArrayList(); } - List uddiTmodels = new ArrayList<>(); + List uddiTmodels = new ArrayList(); for (TModel tmodel : tmodelDetails) { UddiTModel uddiTmodel = new UddiTModel(tmodel); uddiTmodels.add(uddiTmodel); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClientFactory.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClientFactory.java index a7ea3f2097549c8f8c27cd7bfad8dc2440ec876a..784130f6d92b888b301bc3feed4e8db73ebe5ba5 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClientFactory.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiLookupClientFactory.java @@ -54,11 +54,11 @@ public class UddiLookupClientFactory { log.debug("Init UddiLookupClientFactory: " + config.getImplementationNamespaceClass()); lookupClient = (IUddiLookupClient) Class.forName(config.getImplementationNamespaceClass()).newInstance(); } catch (InstantiationException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16074"); } catch (IllegalAccessException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16075"); } catch (ClassNotFoundException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16076"); } } return lookupClient; @@ -76,19 +76,19 @@ public class UddiLookupClientFactory { return (IUddiLookupClient) Class.forName(implementingClass).getConstructor(Uri.class).newInstance(endpointAddress); } catch (InstantiationException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16074"); } catch (IllegalAccessException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16075"); } catch (ClassNotFoundException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16076"); } catch (InvocationTargetException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16077"); } catch (IllegalArgumentException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16078"); } catch (SecurityException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16079"); } catch (NoSuchMethodException e) { - throw new RaspLibraryException(e); + throw new RaspLibraryException(e, "E-RSP16080"); } } @@ -101,8 +101,20 @@ public class UddiLookupClientFactory { String implementingClass = config.getImplementationNamespaceClass(); return (IUddiLookupClient) Class.forName(implementingClass).getConstructor(Uri.class, Integer.TYPE).newInstance(endpointAddress, uddiLookupTimeoutSeconds); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | InvocationTargetException | IllegalArgumentException | SecurityException | NoSuchMethodException e) { - throw new RaspLibraryException(e); + } catch (InstantiationException e) { + throw new RaspLibraryException(e, "E-RSP16074"); + } catch (IllegalAccessException e) { + throw new RaspLibraryException(e, "E-RSP16075"); + } catch (ClassNotFoundException e) { + throw new RaspLibraryException(e, "E-RSP16076"); + } catch (InvocationTargetException e) { + throw new RaspLibraryException(e, "E-RSP16077"); + } catch (IllegalArgumentException e) { + throw new RaspLibraryException(e, "E-RSP16078"); + } catch (SecurityException e) { + throw new RaspLibraryException(e, "E-RSP16079"); + } catch (NoSuchMethodException e) { + throw new RaspLibraryException(e, "E-RSP16080"); } } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiNonGuidId.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiNonGuidId.java index 6786a0ff9dd2525b6edd6a477e469cdb6d7b22d1..a5d877502927a8281377c4f139c0855dea1b2258 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiNonGuidId.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiNonGuidId.java @@ -43,12 +43,12 @@ public class UddiNonGuidId extends UddiId { public UddiNonGuidId(String id) { if (id == null || id.length() == 0) - throw new NullOrEmptyArgumentException("id"); + throw new NullOrEmptyArgumentException("E-RSP16051: id is null or empty"); boolean isUddiType = id.substring(0, 5).equals("uddi:"); if (UddiGuidId.isValidGuidId(id, isUddiType)) { - throw new IllegalArgumentException("The string is a Guid ID: " + id); + throw new IllegalArgumentException("E-RSP16052: The string is a Guid ID: " + id); } pId = id; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiService.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiService.java index 58559db017f6d1c6b6761701cea880b8d9796b6d..c1a08721b20f21d7c43407663c0e35cd0f6d0fb4 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiService.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiService.java @@ -53,10 +53,10 @@ public class UddiService { public UddiService(BusinessService service, List uddiBindings) { if (service == null) { - throw new ArgumentNullException("service"); + throw new ArgumentNullException("service", "E-RSP16081"); } if (uddiBindings == null) { - throw new ArgumentNullException("uddiBindings"); + throw new ArgumentNullException("uddiBindings", "E-RSP16082"); } this.service = service; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiStringId.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiStringId.java index dc22d79bb9f5bd8c404e47a5838329cf4b502423..6ab9dda59412fc34c0fc4c4a526647863330d7c7 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiStringId.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiStringId.java @@ -25,8 +25,8 @@ public class UddiStringId extends UddiId { * @param isUddiType whether it is prefixed with "uddi:". */ public UddiStringId(String id, boolean isUddiType) { - if (id == null || id.isEmpty()) throw new NullOrEmptyArgumentException("id"); - if (id.length() < 10) throw new UnexpectedNumberOfCharactersException("id", 10); + if (id == null || id.isEmpty()) throw new NullOrEmptyArgumentException("E-RSP16091: id is null or empty"); + if (id.length() < 10) throw new UnexpectedNumberOfCharactersException("E-RSP16092: id", 10); if (isUddiType) { _noUddiPrefix = id.substring(5); } else { diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiTModel.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiTModel.java index b8a5c9bb6e8ba51742815fd7837e6e8b9b7497ef..dbd0f5013d61909b86e3d6a392da29fec6ecb96a 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiTModel.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/uddi/UddiTModel.java @@ -21,7 +21,7 @@ public class UddiTModel { public UddiTModel(TModel tModel) { if (tModel == null) { - throw new ArgumentNullException("tModel"); + throw new ArgumentNullException("tModel", "E-RSP16094"); } this.tModel = tModel; diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocument.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocument.java index 5bdbb20d10f08ad6c7fcdfeddd299d2ef1265c2b..4c3f4cfd450b74c669bf1be09a1b621f8e3030da 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocument.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocument.java @@ -77,6 +77,26 @@ public class XmlDocument { setDocument(doc); } + /** + * Builds input stream object for given path + * + * @param file path to file. Uses {@link org.apache.commons.configuration.ConfigurationUtils} method locate(String) for resource + * search. + * @return InputStream object for given path to file. + * @throws FileNotFoundException On I/O error. + * @since OIORASP 1.3.0 + */ + public static InputStream locateInputStream(String file) throws FileNotFoundException { + InputStream inputStream; + try { + URL url = ConfigurationUtils.locate(file); + inputStream = url.openStream(); + } catch (Exception e) { + inputStream = new BufferedInputStream(new FileInputStream(file), 4 * 1024); + } + return inputStream; + } + /** * Set document as an w3c document. * @@ -113,7 +133,7 @@ public class XmlDocument { try { return XMLUtils.toDOM(omDocument); } catch (Exception e) { - throw new XmlDocumentException(omDocument); + throw new XmlDocumentException(omDocument, "E-RSP15501"); } } @@ -133,7 +153,7 @@ public class XmlDocument { try { return XMLUtils.toOM(w3Document); } catch (Exception e) { - throw new XmlDocumentException(w3Document); + throw new XmlDocumentException(w3Document, "E-RSP15502"); } } @@ -181,8 +201,8 @@ public class XmlDocument { * Loads the document from prepared InputStream. * * @param inputStream InputStream to source from. - * @param buildAxiom True/false to get/avoid document building - * @throws MainException On error... + * @param buildAxiom True/false to get/avoid document building. + * @throws MainException On error. * @since OIORASP 2.1.0 */ void loadFromInputStream(InputStream inputStream, boolean buildAxiom) throws MainException { @@ -193,14 +213,14 @@ public class XmlDocument { OMElement doc = builder.getDocumentElement(); /* - * dlk, 2012-04-05 - * - * In future versions in order to speed up big documents processing, - * it is necessary to load documents without its building. - * - * In OIORASP 1.3.0 there is no optimization code for, so the method - * load(String) should build the document by default. - */ + * dlk, 2012-04-05 + * + * In future versions in order to speed up big documents processing, + * it is necessary to load documents without its building. + * + * In OIORASP 1.3.0 there is no optimization code for, so the method + * load(String) should build the document by default. + */ if (buildAxiom) { doc.build(); } @@ -211,30 +231,10 @@ public class XmlDocument { */ omDocument = doc; } catch (Exception e) { - throw new XmlException("Failed to read XML: " + e.getMessage(), e); + throw new XmlException("Failed to read XML: " + e.getMessage(), e, "E-RSP15503"); } } - /** - * Builds input stream object for given path - * - * @param file path to file. Uses {@link org.apache.commons.configuration.ConfigurationUtils} method locate(String) for resource - * search. - * @return InputStream object for given path to file - * @throws FileNotFoundException On I/O error... - * @since OIORASP 1.3.0 - */ - public static InputStream locateInputStream(String file) throws FileNotFoundException { - InputStream inputStream; - try { - URL url = ConfigurationUtils.locate(file); - inputStream = url.openStream(); - } catch (Exception e) { - inputStream = new BufferedInputStream(new FileInputStream(file), 4 * 1024); - } - return inputStream; - } - /** * @return true if this instance is based on AXIOM * @since OIORASP 1.3.0 @@ -270,17 +270,16 @@ public class XmlDocument { return fileName; } - @Override /** + * E.g. this method is used in dk.gov.oiosi.xml.schematron.SchematronValidator + * .schematronValidateXmlDocument(XmlDocument, XmlDocument, boolean) error + * message - it gives more information about problem than just exception + * stack trace. + * * @return String with information about state of the instance. Only for debug/logging purposes. */ - /* - * E.g. this method is used in dk.gov.oiosi.xml.schematron.SchematronValidator - * .schematronValidateXmlDocument(XmlDocument, XmlDocument, boolean) error - * message - it gives more information about problem than just exception - * stack trace. - */ + @Override public String toString() { return "XmlDocument [fileName=" + fileName + ", w3cBased=" + isW3CBased() + ", omBased=" + isOMBased() + "]"; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocumentException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocumentException.java index fc27a84e72632cdb3aa9531dd14573483dd954f3..42608544ca8d548f1a483f69f6399cb0c00296fe 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocumentException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlDocumentException.java @@ -37,8 +37,8 @@ public class XmlDocumentException extends XmlException { * * @param doc document */ - public XmlDocumentException(final OMElement doc) { - super("Could not convert XmlDocument from Axiom OM format to Java W3"); + public XmlDocumentException(final String message) { + super(message); } /** @@ -46,7 +46,16 @@ public class XmlDocumentException extends XmlException { * * @param doc document */ - public XmlDocumentException(final Element doc) { - super("Could not convert XmlDocument from Java W3 to Axiom OM format"); + public XmlDocumentException(final OMElement doc, String errorCode) { + super(errorCode + ": Could not convert XmlDocument from Axiom OM format to Java W3"); + } + + /** + * Constructor. + * + * @param doc document + */ + public XmlDocumentException(final Element doc, String errorCode) { + super(errorCode + ": Could not convert XmlDocument from Java W3 to Axiom OM format"); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlException.java index 5a78b706b6e5fb5f7de708d5ef202e14138393ee..0f35f0d1e49776fb71c26f501508c547b4254f3b 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlException.java @@ -43,7 +43,16 @@ public class XmlException extends MainException { * @param message message */ public XmlException(final String message) { - super(message); + super(message, ""); + } + + /** + * Constructor with keywords. + * + * @param message message + */ + public XmlException(final String message, final String errorCode) { + super(message, errorCode); } /** @@ -51,8 +60,8 @@ public class XmlException extends MainException { * * @param e inner exception of the thrown exception */ - public XmlException(final Throwable e) { - super(e); + public XmlException(final Throwable e, final String errorCode) { + super(e, errorCode); } @@ -62,7 +71,7 @@ public class XmlException extends MainException { * @param message String to set as error. * @param e inner exception of the thrown exception */ - public XmlException(final String message, final Throwable e) { - super(message, e); + public XmlException(final String message, final Throwable e, final String errorCode) { + super(message, e, errorCode); } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlSchema.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlSchema.java index 9dad067952f05dd1483f21a210fac48ac17c32af..23c72055b1c7d0edf364a8493aba154f1d112f3b 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlSchema.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/XmlSchema.java @@ -35,7 +35,7 @@ public class XmlSchema extends XmlDocument { */ public XmlSchema(String file) { if (file == null || file.trim().isEmpty()) { - throw new NullOrEmptyArgumentException("Xml schema file name"); + throw new NullOrEmptyArgumentException("E-RSP15511: filename is null or empty"); } this.fileName = file; } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/AmbiguousDocumentTypeFoundFromXmlDocumentException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/AmbiguousDocumentTypeFoundFromXmlDocumentException.java index b6b9151aa23e99c6be8859d61c64beb79de99815..be5c52b2bcccf3e0447e8f4004754c254e3ad918 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/AmbiguousDocumentTypeFoundFromXmlDocumentException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/AmbiguousDocumentTypeFoundFromXmlDocumentException.java @@ -19,9 +19,8 @@ package dk.gov.oiosi.xml.documenttype; -import org.apache.axiom.om.OMElement; - import dk.gov.oiosi.communication.configuration.AmbiguousDocumentTypeResultException; +import org.apache.axiom.om.OMElement; /** * More than one document type configuration was found from the xml document @@ -36,12 +35,10 @@ public class AmbiguousDocumentTypeFoundFromXmlDocumentException extends Ambiguou /** * Constructor. - * - * @param doc - * The XML-document from which to find a configuration + * + * @param doc The XML-document from which to find a configuration */ - public AmbiguousDocumentTypeFoundFromXmlDocumentException(OMElement doc) { - super(doc.getLocalName()); + public AmbiguousDocumentTypeFoundFromXmlDocumentException(OMElement doc, String errorCode) { + super(doc.getLocalName(), errorCode); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/DocumentTypeConfigSearcher.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/DocumentTypeConfigSearcher.java index eba30d008ee84b1c624d59c17bc8a5abc944a9e9..984273cc3f1c58a40903f1777e6ddf14a41dc375 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/DocumentTypeConfigSearcher.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/DocumentTypeConfigSearcher.java @@ -71,20 +71,20 @@ public class DocumentTypeConfigSearcher { public DocumentTypeConfig findUniqueDocumentType(XmlDocument document) throws NoDocumentTypeFoundFromXmlDocumentException, SearchForDocumentTypeFromXmlDocumentFailedException { if (document == null) { - throw new ArgumentNullException("XmlDocument"); + throw new ArgumentNullException("XmlDocument", "E-RSP15101"); } try { DocumentTypeConfig documentType = tryFindUniqueDocumentType(document); if (documentType == null) { - log.error("Document not registered in RaspConfiguration.xml: " + document.getOMDocument().getLocalName()); - throw new NoDocumentTypeFoundFromXmlDocumentException(document); + log.error("E-RSP15105: Document not registered in RaspConfiguration.xml: " + document.getOMDocument().getLocalName()); + throw new NoDocumentTypeFoundFromXmlDocumentException(document, "E-RSP15102"); } return documentType; } catch (NoDocumentTypeFoundFromXmlDocumentException ex) { throw ex; } catch (Exception ex) { - throw new SearchForDocumentTypeFromXmlDocumentFailedException(document, ex); + throw new SearchForDocumentTypeFromXmlDocumentFailedException(document, ex, "E-RSP15103"); } } @@ -98,10 +98,10 @@ public class DocumentTypeConfigSearcher { */ public DocumentTypeConfig tryFindUniqueDocumentType(XmlDocument document) throws XmlException, AmbiguousDocumentTypeFoundFromXmlDocumentException { if (document == null) { - throw new ArgumentNullException("document"); + throw new ArgumentNullException("document", "E-RSP15101"); } - List matchedDocumentTypes = new ArrayList(); + List matchedDocumentTypes = new ArrayList<>(); for (DocumentTypeConfig config : documentTypeConfig.getDocumentTypesAsList()) { if (config.isDocumentOfType(document)) { matchedDocumentTypes.add(config); @@ -109,7 +109,7 @@ public class DocumentTypeConfigSearcher { } if (matchedDocumentTypes.size() > 1) { - throw new AmbiguousDocumentTypeFoundFromXmlDocumentException(document.getOMDocument()); + throw new AmbiguousDocumentTypeFoundFromXmlDocumentException(document.getOMDocument(), "E-RSP15104"); } if (matchedDocumentTypes.size() < 1) { return null; @@ -120,4 +120,4 @@ public class DocumentTypeConfigSearcher { public static void clearDocumentTypeConfig() { documentTypeConfig = null; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/NoDocumentTypeFoundFromXmlDocumentException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/NoDocumentTypeFoundFromXmlDocumentException.java index b28e7d715ae0df7dbc4c924cdcd8ce11040fd466..4dc20b4d9157a1d5c92dc6536160aad348e3799a 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/NoDocumentTypeFoundFromXmlDocumentException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/NoDocumentTypeFoundFromXmlDocumentException.java @@ -39,8 +39,8 @@ public class NoDocumentTypeFoundFromXmlDocumentException extends XmlException { * * @param xmlDocument The XML document */ - public NoDocumentTypeFoundFromXmlDocumentException(final XmlDocument xmlDocument) { - super("Document not registered in RaspConfiguration.xml: " + getDocumentName(xmlDocument)); + public NoDocumentTypeFoundFromXmlDocumentException(final XmlDocument xmlDocument, String errorCode) { + super(errorCode + ": Document not registered in RaspConfiguration.xml: " + getDocumentName(xmlDocument)); setReceiverError(false); setSoapFaultAction("UnknownDocumentTypeFault"); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/SearchForDocumentTypeFromXmlDocumentFailedException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/SearchForDocumentTypeFromXmlDocumentFailedException.java index 7709d42d6ae23145316a8add6423951ea5dbfdec..6a33729cabbdfac09ad90f9c23a0db6e14eef0df 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/SearchForDocumentTypeFromXmlDocumentFailedException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/documenttype/SearchForDocumentTypeFromXmlDocumentFailedException.java @@ -34,14 +34,12 @@ public class SearchForDocumentTypeFromXmlDocumentFailedException extends XmlExce /** * Constructor. - * - * @param xmlDocument - * The xml document for which the search was performed - * @param innerException - * The inner exception + * + * @param xmlDocument The xml document for which the search was performed + * @param innerException The inner exception */ - public SearchForDocumentTypeFromXmlDocumentFailedException(final XmlDocument xmlDocument, final Exception innerException) { - super("Document type not found", innerException); + public SearchForDocumentTypeFromXmlDocumentFailedException(final XmlDocument xmlDocument, final Exception innerException, String errorCode) { + super("Document type not found", innerException, errorCode); setReceiverError(false); setSoapFaultAction("UnknownDocumentTypeFault"); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationException.java index 74ac6f1949c2c7bcc505644719ea0295d825f973..ea135a487a7fb78a0f093a2af4d13b5d7edcfa9e 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationException.java @@ -37,12 +37,12 @@ public abstract class SchemaValidationException extends XmlException { super(message); } - /** - * Constructor with inner exception. - * - * @param exception inner exception of the thrown exception - */ - public SchemaValidationException(final Throwable exception) { - super(exception); - } -} \ No newline at end of file +// /** +// * Constructor with inner exception. +// * +// * @param exception inner exception of the thrown exception +// */ +// public SchemaValidationException(final Throwable exception) { +// super(exception); +// } +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationFailedException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationFailedException.java index 44a7fdf258bbd6687e1fb0ae0608ecb28eed5e81..d72109d050e3dab157dc39fa470408ccab05961c 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationFailedException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidationFailedException.java @@ -42,8 +42,8 @@ public class SchemaValidationFailedException extends SchemaValidationException { * @param document the schema * @param innerException inner exception of the thrown exception */ - public SchemaValidationFailedException(final XmlDocument document, final Exception innerException) { - super("Failed to validate document: " + innerException.getMessage()); + public SchemaValidationFailedException(final XmlDocument document, final Exception innerException, String errorCode) { + super(errorCode + ": Failed to validate document: " + innerException.getMessage()); setReceiverError(false); setSoapFaultAction(FAULT_ACTION); } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidator.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidator.java index e53dd6945c09315b2c34d58980e9edd37000a7f5..e18618dee22815c22eea7052a087607e74bf810c 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidator.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schema/SchemaValidator.java @@ -77,15 +77,15 @@ public class SchemaValidator { */ validator.validate(xmlDocument.getTransformationSource()); } catch (Exception e) { - log.error("Schema check failed: " + e.getMessage(), e); - throw new SchemaValidationFailedException(xmlDocument, e); + log.error("E-RSP15213: Schema check failed: " + e.getMessage(), e); + throw new SchemaValidationFailedException(xmlDocument, e, "E-RSP15211"); } } public void schemaValidateXmlDocument(XmlDocument xmlDocument, DocumentTypeConfig documentTypeConfig) throws SchemaValidationException { // Fail fast if possible. if (documentTypeConfig.getSchemaPath().isEmpty()) { - log.warn("No Schema configured for " + documentTypeConfig.getFriendlyName() + ", so bypass it."); + log.warn("W-RSP15214: No Schema configured for " + documentTypeConfig.getFriendlyName() + ", so bypass it."); return; } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToLoadSchematronStylesheetException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToLoadSchematronStylesheetException.java index e2e48b662a01e453343d24778d153cac3821180e..4200ea68d19ff10f0ecb74a9cee01302ffdf0f2c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToLoadSchematronStylesheetException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToLoadSchematronStylesheetException.java @@ -13,7 +13,7 @@ * The Original Code is Java RASP toolkit. * * The Initial Developer of the Original Code is Lenio. Portions - * created by Lenio are Copyright (C) 2007 Danish National IT and + * created by Lenio are Copyright (C) 2007 Danish National IT and * Telecom Agency (http://www.itst.dk). All Rights Reserved. */ @@ -22,29 +22,32 @@ package dk.gov.oiosi.xml.schematron; import dk.gov.oiosi.xml.XmlException; /** - * Exception thrown if the load of the schematron stylesheet fails. + * Exception thrown if the load of the schematron stylesheet fails. */ public class FailedToLoadSchematronStylesheetException extends XmlException { - private static final long serialVersionUID = 2L; - - private String schematronPath = ""; - - /** - * Constructor that takes the schematron stylesheet path used when attempting - * to load the stylesheet and the exception caught as inner exception. - * @param schematronPath - * @param innerException - */ - public FailedToLoadSchematronStylesheetException(String schematronPath, Exception innerException) { - super("Failed to load the schematron stylesheet, tried the following path: " + schematronPath, innerException); - this.schematronPath = schematronPath; - } - - /** - * Gets the schematron path used when the load failed. - * @return The schematron path - */ - public String getSchematronPath() { - return schematronPath; - } + + private static final long serialVersionUID = 2L; + + private String schematronPath = ""; + + /** + * Constructor that takes the schematron stylesheet path used when attempting + * to load the stylesheet and the exception caught as inner exception. + * + * @param schematronPath + * @param innerException + */ + public FailedToLoadSchematronStylesheetException(String schematronPath, Exception innerException, String errorCode) { + super("Failed to load the schematron stylesheet, tried the following path: " + schematronPath, innerException, errorCode); + this.schematronPath = schematronPath; + } + + /** + * Gets the schematron path used when the load failed. + * + * @return The schematron path + */ + public String getSchematronPath() { + return schematronPath; + } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToTransformDocumentException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToTransformDocumentException.java index 446e1b983c4a5326bb3106009b1c4acceb93c6af..722babf91a4de346b115cf6d8834697c3cc10e7c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToTransformDocumentException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/FailedToTransformDocumentException.java @@ -25,7 +25,7 @@ public class FailedToTransformDocumentException extends XmlException { private static final long serialVersionUID = 5446668912286400079L; - public FailedToTransformDocumentException(Exception inner) { - super(inner); + public FailedToTransformDocumentException(Exception inner, String errorCode) { + super(inner, errorCode); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronErrorException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronErrorException.java index f70c80ac7018b519e8be1612bef61a0c523b2788..e805de3c09a15c3a1ecc17acb2c18ff4276d44ee 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronErrorException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronErrorException.java @@ -22,65 +22,62 @@ package dk.gov.oiosi.xml.schematron; import dk.gov.oiosi.xml.XmlDocument; /** - * Exception thrown when the schematron validation of an xml document fails. + * Exception thrown when the schematron validation process is OK, but the document contains a schematron error. */ public class SchematronErrorException extends SchematronValidationException { - /** - * Default empty constructor - */ - public SchematronErrorException() { - super(); - } - - /** - * Constructor. - * - * @param message error message - * @param cause nested exception - */ - public SchematronErrorException(String message, Throwable cause) { - super(message, cause); - } - + /** + * serialVersionUID. + */ + private static final long serialVersionUID = 1L; /** - * Constructor. - * - * @param result - * The schematron result - * @param firstErrorMessage - * The first error message + * document holding the Schematron validation. */ - public SchematronErrorException(final XmlDocument result, final String firstErrorMessage) { - super(firstErrorMessage); + private XmlDocument schematronResult; - schematronResult = result; + + /** + * Default empty constructor + */ + public SchematronErrorException() { + super(); } /** * Constructor. - * - * @param e - * message + * + * @param message error message + * @param cause nested exception */ - public SchematronErrorException(final String e) { - super(e); + public SchematronErrorException(String message, Throwable cause, final String errorCode) { + super(message, cause, errorCode); } - + /** - * serialVersionUID. + * Constructor. + * + * @param result The schematron result + * @param firstErrorMessage The first error message */ - private static final long serialVersionUID = 1L; + public SchematronErrorException(final XmlDocument result, final String firstErrorMessage, final String errorCode) { + super(firstErrorMessage, errorCode); + + schematronResult = result; + } /** - * document holding the Schematron validation. + * Constructor. + * + * @param message message. */ - private XmlDocument schematronResult; + public SchematronErrorException(final String message, final String errorCode) { + super(message, errorCode); + } /** * Gets the schematron result. - * + * * @return document with schematron error */ public XmlDocument getSchematronResult() { diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronStore.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronStore.java index f2eb1871c8975c1a390243c0c4591863cb207a86..6e3a2678559e6af39f9c94ba8215c7cfacfe1230 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronStore.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronStore.java @@ -49,12 +49,12 @@ public class SchematronStore { */ public Transformer getCompiledSchematron(String schematronPath) throws FailedToLoadSchematronStylesheetException { if (schematronPath == null) { - throw new ArgumentNullException("path"); + throw new ArgumentNullException("path", "E-RSP15301"); } Transformer compiledSchematron; - OutVariable result = new OutVariable<>(); + OutVariable result = new OutVariable(); if (_cache.tryGetValue(schematronPath, result)) { compiledSchematron = result.getVariable(); } else { @@ -69,7 +69,7 @@ public class SchematronStore { try { return UTILITY.precompiledStyleSheet(path); } catch (Exception ex) { - throw new FailedToLoadSchematronStylesheetException(path, ex); + throw new FailedToLoadSchematronStylesheetException(path, ex, "E-RSP15302 "); } } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationConfig.java index 17bfd792a783ec2fc22feb21378f99e4d294025d..f30a67c276783ac99415890d362af65503f778bf 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationConfig.java @@ -75,13 +75,13 @@ public class SchematronValidationConfig { */ public SchematronValidationConfig(String schematronDocumentPath, String errorXPath, String errorMessageXPath) { if (schematronDocumentPath == null) { - throw new ArgumentNullException("schematronDocumentPath"); + throw new ArgumentNullException("schematronDocumentPath", "E-RSP15311"); } if (errorXPath == null) { - throw new ArgumentNullException("errorXPath"); + throw new ArgumentNullException("errorXPath", "E-RSP15312"); } if (errorMessageXPath == null) { - throw new ArgumentNullException("errorMessageXPath"); + throw new ArgumentNullException("errorMessageXPath", "E-RSP15313"); } setSchematronDocumentPath(schematronDocumentPath); setErrorXPath(errorXPath); @@ -89,6 +89,36 @@ public class SchematronValidationConfig { rebuildConfig(); } + public static String modifyValueForUnitTests(String value) { + if (ConfigurationUtils.locate(value) == null) { + // In case of unit tests, try one level out. + if (ConfigurationUtils.locate("dk.gov.oiosi.library/" + value) != null) { + value = "dk.gov.oiosi.library/" + value; + } + } + return value; + } + + /** + * @return saxHandlerConfig by given values of errorXPath and errorMessageXPath. If one of them is not set or they are not supported, + * returns null and logs error message + * @since OIORASP 1.3.0 + */ + public static SchematronValidatorSAXHandlerConfig buildSAXHandlerConfig(String errorXPath, String errorMessageXPath) { + if (errorXPath == null || errorMessageXPath == null || errorXPath.length() == 0 || errorMessageXPath.length() == 0) { + return null; + } + try { + return SchematronValidatorSAXHandlerConfig.build(errorXPath, errorMessageXPath); + } catch (Exception e) { + log.warn("E-RSP15320: Failed to build SAXHandlerConfig for errorXPath [" + errorXPath + "], errorMessageXPath [" + errorMessageXPath + "] - schematron validation will execute non-optimized"); + /* + * If configuration is not supported by optimized way of schematron validation, use old way + */ + return null; + } + } + /** * Gets and sets the schematron document path. * @@ -105,7 +135,7 @@ public class SchematronValidationConfig { */ public void setSchematronDocumentPath(String value) { if (value == null || value.isEmpty()) { - throw new ArgumentNullException("SchematronDocumentPath.value is null or empty..."); + throw new ArgumentNullException("SchematronDocumentPath.value is null or empty...", "E-RSP15314"); } // TODO DLK: Try to find another way to allow unit tests to run. It is meaningless for PROD environment... @@ -113,16 +143,6 @@ public class SchematronValidationConfig { this.schematronDocumentPath = value; } - public static String modifyValueForUnitTests(String value) { - if (ConfigurationUtils.locate(value) == null) { - // In case of unit tests, try one level out. - if (ConfigurationUtils.locate("dk.gov.oiosi.library/" + value) != null) { - value = "dk.gov.oiosi.library/" + value; - } - } - return value; - } - /** * Gets and sets the XPath expression that gets the error results from the schematron result. * @@ -139,7 +159,7 @@ public class SchematronValidationConfig { */ public void setErrorXPath(String value) { if (value == null) { - throw new ArgumentNullException("ErrorXPath.value"); + throw new ArgumentNullException("ErrorXPath.value", "E-RSP15315"); } errorXPath = value; @@ -165,7 +185,7 @@ public class SchematronValidationConfig { */ public void setErrorMessageXPath(String value) { if (value == null) { - throw new ArgumentNullException("ErrorMessageXPath.value"); + throw new ArgumentNullException("ErrorMessageXPath.value", "E-RSP15316"); } errorMessageXPath = value; @@ -179,9 +199,9 @@ public class SchematronValidationConfig { * Gets the schematron document. The first time this method is called then the XML-document will be loaded from disc into memory. * * @return XML-document holding stylesheet - * @throws SchematronErrorException On error... + * @throws SchematronValidationFailedException On error. */ - public XmlDocument getSchematronDocument() throws SchematronErrorException { + public XmlDocument getSchematronDocument() throws SchematronValidationFailedException { synchronized (this) { if (schematronDocument == null) { loadSchematronDocument(); @@ -191,17 +211,17 @@ public class SchematronValidationConfig { } /** - * Load the schematron stylesheet from file + * Load the schematron stylesheet from file. * - * @throws SchematronErrorException On error... + * @throws SchematronValidationFailedException On error. */ - private void loadSchematronDocument() throws SchematronErrorException { + private void loadSchematronDocument() throws SchematronValidationFailedException { try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.load(schematronDocumentPath); schematronDocument = xmlDocument; } catch (Exception e) { - throw new SchematronErrorException("Failed to load schematron document:" + e.getMessage()); + throw new SchematronValidationFailedException("Failed to load schematron document:" + e.getMessage(), e, "E-RSP15317"); } } @@ -212,26 +232,6 @@ public class SchematronValidationConfig { setSaxHandlerConfig(buildSAXHandlerConfig(this.getErrorXPath(), this.getErrorMessageXPath())); } - /** - * @return saxHandlerConfig by given values of errorXPath and errorMessageXPath. If one of them is not set or they are not supported, - * returns null and logs error message - * @since OIORASP 1.3.0 - */ - public static SchematronValidatorSAXHandlerConfig buildSAXHandlerConfig(String errorXPath, String errorMessageXPath) { - if (errorXPath == null || errorMessageXPath == null || errorXPath.length() == 0 || errorMessageXPath.length() == 0) { - return null; - } - try { - return SchematronValidatorSAXHandlerConfig.build(errorXPath, errorMessageXPath); - } catch (Exception e) { - log.warn("Failed to build SAXHandlerConfig for errorXPath [" + errorXPath + "], errorMessageXPath [" + errorMessageXPath + "] - schematron validation will execute non-optimized"); - /* - * If configuration is not supported by optimized way of schematron validation, use old way - */ - return null; - } - } - /** * @return Configuration for SchematronValidatorSAXUtil * @since OIORASP 1.3.0 diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationException.java index 5abdca2f93795852610a545c38a212d08d67d7fb..1f562226fc4e2b2c4a51bb614b5d881b74f744f2 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationException.java @@ -25,9 +25,10 @@ import dk.gov.oiosi.xml.XmlException; * Abstract schematron validation exception. */ public abstract class SchematronValidationException extends XmlException { - private static final long serialVersionUID = 2L; - /** + private static final long serialVersionUID = 2L; + + /** * Base constructor. */ public SchematronValidationException() { @@ -36,32 +37,29 @@ public abstract class SchematronValidationException extends XmlException { /** * Base constructor. - * + * * @param e message */ - public SchematronValidationException(final String e) { - super(e); + public SchematronValidationException(final String e, final String errorCode) { + super(e, errorCode); } /** * Constructor with inner exception. - * - * @param innerException - * innerexception of the thrown exception + * + * @param innerException inner exception of the thrown exception. */ public SchematronValidationException(final Throwable innerException) { - super(innerException); + super(innerException, ""); } - + /** * Constructor with cause exception and error message. - * - * @param message error message - * @param innerException - * innerexception of the thrown exception + * + * @param message error message. + * @param innerException inner exception of the thrown exception. */ - public SchematronValidationException(final String message, final Throwable innerException) { - super(message, innerException); + public SchematronValidationException(final String message, final Throwable innerException, final String errorCode) { + super(message, innerException, errorCode); } - } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationFailedException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationFailedException.java index 03e4ffe149c475f8f51723af379549fdad16391f..890a0eff6febc95ae587b3f45d41bb1e8ed9744a 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationFailedException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidationFailedException.java @@ -19,51 +19,39 @@ package dk.gov.oiosi.xml.schematron; -import dk.gov.oiosi.xml.XmlDocument; - /** - * Custom exception used when schematron validation fails. + * Custom exception used when schematron validation process fails (technically). + *

+ * If the process is OK, but a schematron error (content wise) is found, a {@link SchematronErrorException} is thrown. */ public class SchematronValidationFailedException extends SchematronValidationException { + public static final String FAULT_ACTION = "SchematronValidationFault"; + /** * serialVersionUID. */ private static final long serialVersionUID = 2L; /** - * Soap fault sub type / RASP fault action. - */ - public static final String FAULT_ACTION = "SchematronValidationFault"; - - /** - * Constructor. + * Constructor with cause exception and error message. * - * @param document the current document - * @param innerException inner exception of the thrown exception + * @param reason Error reason. */ - @Deprecated - public SchematronValidationFailedException(final XmlDocument document, final Exception innerException) { - super("Failed to Schematron validate document: " + innerException.getMessage()); - setReceiverError(false); - setSoapFaultAction(FAULT_ACTION); - } - - @Deprecated - public SchematronValidationFailedException(final String reason) { - super(reason); + public SchematronValidationFailedException(final String reason, final String errorCode) { + super(reason, errorCode); setReceiverError(false); setSoapFaultAction(FAULT_ACTION); } /** - * Constructor with cause exception and error message + * Constructor with cause exception and error message. * - * @param reason + * @param reason Error reason. */ - public SchematronValidationFailedException(final String reason, final Exception cause) { - super(reason, cause); + public SchematronValidationFailedException(final String reason, final Exception cause, final String errorCode) { + super(reason, cause, errorCode); setReceiverError(false); setSoapFaultAction(FAULT_ACTION); } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidator.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidator.java index 63e072b9dd6f196c7585363e2684b66c3f7aad0b..8e3791f57cbafdeced8f536e5fed0623da7c1afd 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidator.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/SchematronValidator.java @@ -85,7 +85,7 @@ public class SchematronValidator { * @param config configuration * @throws SchematronErrorException On error... */ - public SchematronValidator(SchematronValidationConfig config) throws SchematronErrorException { + public SchematronValidator(SchematronValidationConfig config) throws SchematronErrorException, SchematronValidationFailedException { this(); this.errorXPath = config.getErrorXPath(); this.errorMessageXPath = config.getErrorMessageXPath(); @@ -101,7 +101,7 @@ public class SchematronValidator { */ public void schematronValidateXmlDocument(XmlDocument xmlDocument) throws XmlException { if (schematronDocument == null) { - throw new ArgumentNullException("No schematron document is set"); + throw new ArgumentNullException("No schematron document is set", "E-RSP15321"); } schematronValidateXmlDocument(xmlDocument, schematronDocument); } @@ -159,7 +159,7 @@ public class SchematronValidator { try { result = XSLT_UTILITY.transformXml(document, preCompiledSchematronStylesheet); } catch (Exception e) { - throw new FailedToTransformDocumentException(e); + throw new FailedToTransformDocumentException(e, "E-RSP15324"); } validateResult(result); return; @@ -172,7 +172,7 @@ public class SchematronValidator { boolean hasAnyErrors = DocumentXPathResolver.hasAnyElementsByXpath(result, errorXPath, prefixedNamespaces); if (hasAnyErrors) { String firstErrorMessage = DocumentXPathResolver.getFirstElementValueByXPath(result, errorMessageXPath, prefixedNamespaces); - throw new SchematronErrorException(result, firstErrorMessage); + throw new SchematronErrorException(result, firstErrorMessage.trim(), "E-RSP15325"); } } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXException.java index 9bff86f7a53ed0794e6aef3973a077f5842433a2..5df8a2ef87806e37eb64b32328b3418c26ae46ce 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXException.java @@ -4,19 +4,18 @@ import org.xml.sax.SAXException; /** * Special exception to distinguish between invalid XML structure of the parsed - * document and resolved schematron error message.
- * - * As a message it contains first found error description.
+ * document and resolved schematron error message. + *

+ * As a message it contains first found error description. * * @author Dmitriy Lapko, TrueLink A/S * @since OIORASP 1.3.0 */ public class SchematronValidatorSAXException extends SAXException { - private static final long serialVersionUID = 1427595072051807613L; - - public SchematronValidatorSAXException(String message) { - super(message); - } + private static final long serialVersionUID = 1427595072051807613L; + public SchematronValidatorSAXException(String message) { + super(message); + } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandler.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandler.java index fb9b578be7cf4a7fee2c8710d0eaa2382b6c9d5d..8b30f2a37c17401f2ccf6e2c7d1caf4831c07f7d 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandler.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandler.java @@ -1,6 +1,6 @@ package dk.gov.oiosi.xml.schematron.sax; -import dk.gov.oiosi.xml.schematron.SchematronErrorException; +import dk.gov.oiosi.xml.schematron.SchematronValidationFailedException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -9,13 +9,12 @@ import java.io.Serializable; /** * OIORASP schematron-specific implementation of SAX ContentHandler.
- * - * Main goal - prevent transformation of the whole document when first error is - * found.
- * + *

+ * Main goal: Prevent transformation of the whole document when first error is found. + *

* Implements SAX XPath processing, throws {@link SchematronValidatorSAXException} when * first matched tag defined by errorMessageXPath is closed.
- * + *

* It is supposed to be used only via {@link SchematronValidatorSAXUtil}.
* * @author Dmitriy Lapko, TrueLink A/S @@ -23,130 +22,124 @@ import java.io.Serializable; */ public class SchematronValidatorSAXHandler extends DefaultHandler implements Serializable { - private static final long serialVersionUID = -4973065739708054681L; - - /* - * Number of visited tags in tagList - */ - private int tagListMatchIndex; - - /* - * Number of parents of current tag - */ - private int depth; - /* - * Collects data from all calls of characters() and ignorableWhitespace() - * when errorMessageTagActual is true - */ - private StringBuilder errorMessageResult; - - /* - * true when all tagList was visited and start of errorMessageTag found - */ - private boolean errorMessageTagFound; - - /* - * true when startElement method was called with tag equal to - * errorMessageTag and corresponding endElement not yet called - */ - private boolean errorMessageTagActual; - - /* - * To avoid collecting characters inside nested tags of errorMessageTag, - * let's calculate opened/closed tags inside it. If it is 0, we - */ - private int errorMessageTagRelativeDepth = -1; - - private final SchematronValidatorSAXHandlerConfig config; - - /** - * Reduces visibility of this class by making its constructor protected. - * - * This class is supposed to be used only via {@link SchematronValidatorSAXUtil}. - * - * @param config configuration for handler - * @throws SchematronErrorException - */ - protected SchematronValidatorSAXHandler(SchematronValidatorSAXHandlerConfig config) throws SchematronErrorException { - if (config == null) { - throw new SchematronErrorException("SchematronValidatorSAXHandler was called with null config object"); - } - this.config = config; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - if (!errorMessageTagFound) { - if (tagListMatchIndex == depth && tagListMatchIndex < config.getTagList().length) { - if (qName.equals(config.getTagList()[tagListMatchIndex])) { - tagListMatchIndex++; - } - } - } - depth++; - if (tagListMatchIndex == config.getTagList().length && depth == (config.getTagList().length + 1)) { - /* - * We are at the end of tag list, let's check if current tag matches errorMessageTag - */ - if (config.getErrorMessageTag().equals(qName)) { - errorMessageTagFound = true; - errorMessageTagActual = true; - errorMessageTagRelativeDepth = 0; - } - } - if (errorMessageTagFound) { - if (errorMessageTagActual) { - if (!qName.equals(config.getErrorMessageTag())) { - errorMessageTagActual = false; - errorMessageTagRelativeDepth++; - } - } else { - errorMessageTagRelativeDepth++; - } - } - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (errorMessageTagFound && errorMessageTagActual) { - if (depth == (config.getTagList().length + 1)) { - String message = ""; - if (errorMessageResult != null) { - message = errorMessageResult.toString(); - } - throw new SchematronValidatorSAXException(message); - } - } - depth--; - if (errorMessageTagFound) { - if (!errorMessageTagActual) { - errorMessageTagRelativeDepth--; - if (errorMessageTagRelativeDepth == 0) { - errorMessageTagActual = true; - } - } - } - if (depth < tagListMatchIndex && tagListMatchIndex > 0) { - tagListMatchIndex--; - } - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - appendErrorMessageResult(ch, start, length); - } - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - appendErrorMessageResult(ch, start, length); - } - - protected void appendErrorMessageResult(char[] ch, int start, int length) { - if (errorMessageTagActual) { - if (errorMessageResult == null) { - errorMessageResult = new StringBuilder(length); - } - errorMessageResult.append(ch, start, length); - } - } -} \ No newline at end of file + private static final long serialVersionUID = -4973065739708054681L; + private final SchematronValidatorSAXHandlerConfig config; + /* + * Number of visited tags in tagList + */ + private int tagListMatchIndex; + /* + * Number of parents of current tag + */ + private int depth; + /* + * Collects data from all calls of characters() and ignorableWhitespace() + * when errorMessageTagActual is true + */ + private StringBuilder errorMessageResult; + /* + * true when all tagList was visited and start of errorMessageTag found + */ + private boolean errorMessageTagFound; + /* + * true when startElement method was called with tag equal to + * errorMessageTag and corresponding endElement not yet called + */ + private boolean errorMessageTagActual; + /* + * To avoid collecting characters inside nested tags of errorMessageTag, + * let's calculate opened/closed tags inside it. If it is 0, we + */ + private int errorMessageTagRelativeDepth = -1; + + /** + * Reduces visibility of this class by making its constructor protected. + *

+ * This class is supposed to be used only via {@link SchematronValidatorSAXUtil}. + * + * @param config configuration for handler + * @throws SchematronValidationFailedException + */ + protected SchematronValidatorSAXHandler(SchematronValidatorSAXHandlerConfig config) throws SchematronValidationFailedException { + if (config == null) { + throw new SchematronValidationFailedException("SchematronValidatorSAXHandler was called with null config object", "E-RSP15326"); + } + this.config = config; + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + if (!errorMessageTagFound) { + if (tagListMatchIndex == depth && tagListMatchIndex < config.getTagList().length) { + if (qName.equals(config.getTagList()[tagListMatchIndex])) { + tagListMatchIndex++; + } + } + } + depth++; + if (tagListMatchIndex == config.getTagList().length && depth == (config.getTagList().length + 1)) { + /* + * We are at the end of tag list, let's check if current tag matches errorMessageTag + */ + if (config.getErrorMessageTag().equals(qName)) { + errorMessageTagFound = true; + errorMessageTagActual = true; + errorMessageTagRelativeDepth = 0; + } + } + if (errorMessageTagFound) { + if (errorMessageTagActual) { + if (!qName.equals(config.getErrorMessageTag())) { + errorMessageTagActual = false; + errorMessageTagRelativeDepth++; + } + } else { + errorMessageTagRelativeDepth++; + } + } + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (errorMessageTagFound && errorMessageTagActual) { + if (depth == (config.getTagList().length + 1)) { + String message = ""; + if (errorMessageResult != null) { + message = errorMessageResult.toString(); + } + throw new SchematronValidatorSAXException("E-RSP15325: " + message.trim()); + } + } + depth--; + if (errorMessageTagFound) { + if (!errorMessageTagActual) { + errorMessageTagRelativeDepth--; + if (errorMessageTagRelativeDepth == 0) { + errorMessageTagActual = true; + } + } + } + if (depth < tagListMatchIndex && tagListMatchIndex > 0) { + tagListMatchIndex--; + } + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + appendErrorMessageResult(ch, start, length); + } + + @Override + public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { + appendErrorMessageResult(ch, start, length); + } + + protected void appendErrorMessageResult(char[] ch, int start, int length) { + if (errorMessageTagActual) { + if (errorMessageResult == null) { + errorMessageResult = new StringBuilder(length); + } + errorMessageResult.append(ch, start, length); + } + } +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfig.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfig.java index 6ef607132b37a1ee0077a99c4df83767837b1c1a..3fc6b763938fcc02f48e6c60d053467d23241c4c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfig.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfig.java @@ -1,14 +1,14 @@ package dk.gov.oiosi.xml.schematron.sax; -import dk.gov.oiosi.xml.schematron.SchematronErrorException; +import dk.gov.oiosi.xml.schematron.SchematronValidationFailedException; import java.io.Serializable; import java.util.Arrays; /** - * Contains configuration for SchematronValidatorSAXHandler basing on given errorXPath and errorMessageXPath values.
+ * Contains configuration for SchematronValidatorSAXHandler basing on given errorXPath and errorMessageXPath values. *

- * Parses and validates given pair of XPath to be compatible with {@link SchematronValidatorSAXHandler} implementation.
+ * Parses and validates given pair of XPath to be compatible with {@link SchematronValidatorSAXHandler} implementation. *

* Parsing of these XPath values is separated from {@link SchematronValidatorSAXHandler} to be able to cache it and do parsing/validation. * @@ -33,11 +33,11 @@ public class SchematronValidatorSAXHandlerConfig implements Serializable { * @param errorXPath Very simple XPath, which is actually just list of. * @param errorMessageXPath xPath where the error message is found. * @return SchematronValidatorSAXHandlerConfig - * @throws SchematronErrorException + * @throws SchematronValidationFailedException Exception thrown on process error on execution of the validation. */ - public static SchematronValidatorSAXHandlerConfig build(String errorXPath, String errorMessageXPath) throws SchematronErrorException { + public static SchematronValidatorSAXHandlerConfig build(String errorXPath, String errorMessageXPath) throws SchematronValidationFailedException { if (errorXPath == null || errorMessageXPath == null) { - throw new SchematronErrorException("One of errorXPath or errorMessageXPath is null: errorXPath=" + errorXPath + ", errorMessageXPath = " + errorMessageXPath); + throw new SchematronValidationFailedException("One of errorXPath or errorMessageXPath is null: errorXPath=" + errorXPath + ", errorMessageXPath = " + errorMessageXPath, "E-RSP15328"); } String[] tagListLocal; String errorMessageTagLocal; @@ -55,13 +55,13 @@ public class SchematronValidatorSAXHandlerConfig implements Serializable { errorMessageTagLocal = errorMessageTagLocal.substring(1); } } else { - throw new SchematronErrorException("Current version of SchematronValidatorSAXHandler does not support this combination of errorXPath and errorMessageXPath: errorXPath=" + errorXPath + ", errorMessageXPath = " + errorMessageXPath); + throw new SchematronValidationFailedException("Current version of SchematronValidatorSAXHandler does not support this combination of errorXPath and errorMessageXPath: errorXPath=" + errorXPath + ", errorMessageXPath = " + errorMessageXPath, "E-RSP15328"); } } return new SchematronValidatorSAXHandlerConfig(tagListLocal, errorMessageTagLocal); } - private static String[] splitXPathToTags(String simpleXPath) throws SchematronErrorException { + private static String[] splitXPathToTags(String simpleXPath) throws SchematronValidationFailedException { String line = simpleXPath; if (line.startsWith("/")) { line = line.substring(1); @@ -69,12 +69,12 @@ public class SchematronValidatorSAXHandlerConfig implements Serializable { if (line.endsWith("/")) { line = line.substring(0, line.length() - 1); } - String tagList[] = line.split("/"); + String[] tagList = line.split("/"); for (int i = 0; i < tagList.length; i++) { tagList[i] = tagList[i].trim(); if (!isOneWordString(tagList[i])) { - throw new SchematronErrorException("XPath for SchematronValidatorSAXHandler should contain only list of tags delimited with slash, no XPath functions or selectors are supported. But in XPath '" + simpleXPath + "' part '" + tagList[i] + "' was found"); + throw new SchematronValidationFailedException("XPath for SchematronValidatorSAXHandler should contain only list of tags delimited with slash, no XPath functions or selectors are supported. But in XPath '" + simpleXPath + "' part '" + tagList[i] + "' was found", "E-RSP15328"); } } return tagList; @@ -89,9 +89,9 @@ public class SchematronValidatorSAXHandlerConfig implements Serializable { if (!t.isEmpty()) { /* * From Pattern javadoc: - * - * \w A word character: [a-zA-Z_0-9] - */ + * + * \w A word character: [a-zA-Z_0-9] + */ return t.matches("[-\\w:]+"); } } @@ -118,4 +118,4 @@ public class SchematronValidatorSAXHandlerConfig implements Serializable { final int maxLen = 10; return "SchematronValidatorSAXHandlerConfig [tagList=" + (tagList != null ? Arrays.asList(tagList).subList(0, Math.min(tagList.length, maxLen)) : null) + ", errorMessageTag=" + errorMessageTag + "]"; } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtil.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtil.java index 5d18eb28a937dd317e275c26255d7bffb1b8e240..80061d3b22914a473de002fdcf75b8f6c74b613c 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtil.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtil.java @@ -34,7 +34,7 @@ public class SchematronValidatorSAXUtil { * @param xmlSource Source for xml document to process * @param transformer Transformer to apply * @param config configuration object - * @throws XmlException + * @throws XmlException On error. */ public static void schematronValidateXmlDocument(Source xmlSource, Transformer transformer, SchematronValidatorSAXHandlerConfig config) throws XmlException { if (config != null) { @@ -42,14 +42,15 @@ public class SchematronValidatorSAXUtil { SchematronValidatorSAXHandler contentHandler = new SchematronValidatorSAXHandler(config); transformer.setErrorListener(ERROR_LISTENER); transformer.transform(xmlSource, new SAXResult(contentHandler)); - } catch (Exception e) { - if (e instanceof TransformerException) { - if (e.getCause() != null && e.getCause() instanceof SchematronValidatorSAXException) { - SchematronValidatorSAXException s = (SchematronValidatorSAXException) e.getCause(); - throw new SchematronErrorException(s.getMessage()); - } + } catch (TransformerException e) { + if (e.getCause() instanceof SchematronValidatorSAXException) { + SchematronValidatorSAXException s = (SchematronValidatorSAXException) e.getCause(); + // Special case, where the SchematronValidatorSAXException is translated into a SchematronErrorException, so DO NOT add a new error number: + throw new SchematronErrorException(s.getMessage(), s, ""); } - throw new SchematronValidationFailedException(e.getMessage(), e); + throw new SchematronValidationFailedException(e.getMessage(), e, "E-RSP15332"); + } catch (Exception e) { + throw new SchematronValidationFailedException(e.getMessage(), e, "E-RSP15332"); } } } @@ -59,6 +60,7 @@ public class SchematronValidatorSAXUtil { * about SchematronValidatorSAXException with resolved error description. */ private static class FailoverErrorListener implements ErrorListener { + @Override public void warning(TransformerException exception) throws TransformerException { // Ignore warnings diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/DocumentXPathResolver.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/DocumentXPathResolver.java index c367738543a1e83ec445195a44f96308a4fc9423..78760f7535414979305e5859e4833b1f6d46470c 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/DocumentXPathResolver.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/DocumentXPathResolver.java @@ -45,6 +45,12 @@ public class DocumentXPathResolver { private static final Log log = LogFactory.getLog(DocumentXPathResolver.class); + /** + * Hide public constructor. + */ + private DocumentXPathResolver() { + } + /** * Returns whether the given xpath yields any results. * @@ -84,9 +90,9 @@ public class DocumentXPathResolver { // Check whether the constraints are followed int nodesCount = nodes.size(); if (nodesCount < 1) { - throw new NoXPathResultsException(xpath); + throw new NoXPathResultsException(xpath, "E-RSP15401"); } else if (nodesCount > 1) { - throw new TooManyXpathResultsException(xpath, nodesCount); + throw new TooManyXpathResultsException(xpath, nodesCount, "E-RSP15402"); } // Return result based on type @@ -109,7 +115,7 @@ public class DocumentXPathResolver { String value = tryGetFirstElementValueByXPath(xmlDocument, xpath, prefixedNamespaces); if (value == null) { - throw new NoXPathResultsException(xpath); + throw new NoXPathResultsException(xpath, "E-RSP15401"); } return value; } @@ -175,17 +181,17 @@ public class DocumentXPathResolver { */ private static void checkParameters(XmlDocument xmlDocument, String xpath, PrefixedNamespace[] prefixedNamespaces) { if (xpath == null) { - throw new NullOrEmptyArgumentException("xpath"); + throw new NullOrEmptyArgumentException("E-RSP15403: xpath is null or empty"); } if (xmlDocument == null) { - throw new ArgumentNullException("xmlDocument"); + throw new ArgumentNullException("xmlDocument", "E-RSP15404"); } if (prefixedNamespaces == null) { - throw new ArgumentNullException("prefixedNamespaces"); + throw new ArgumentNullException("prefixedNamespaces", "E-RSP15405"); } if (xpath.trim().length() <= 1) { if (!".".equals(xpath) && !"/".equals(xpath)) { - throw new XPathSizeTooSmallException(xpath); + throw new XPathSizeTooSmallException("E-RSP15406: " + xpath); } } } @@ -197,7 +203,7 @@ public class DocumentXPathResolver { * @param xpath xpath * @param prefixedNamespaces namespaces * @return list of nodes - * @throws XmlException + * @throws XmlException On error. */ private static List getNodes(XmlDocument xmlDocument, String xpath, PrefixedNamespace[] prefixedNamespaces) throws XmlException { AXIOMXPath xpathExpression; @@ -208,7 +214,7 @@ public class DocumentXPathResolver { } return xpathExpression.selectNodes(xmlDocument.getOMDocument()); } catch (Exception e) { - throw new XmlException("Failed to perform Xpath search " + xpath + ": " + e.getMessage(), e); + throw new XmlException("Failed to perform Xpath search " + xpath + ": " + e.getMessage(), e, "E-RSP15407"); } } @@ -218,13 +224,13 @@ public class DocumentXPathResolver { * To avoid this, let's use relative XPath, which start from given node. *

* For this purpose, we need to delete first part of XPath expression, assuming that all passed expressions to this method are very - * simple * + * simple. * * @param xmlDocument * @param xpath * @param prefixedNamespaces * @return list of nodes - * @throws XmlException + * @throws XmlException On error. */ /* * TODO DLK: Integrate it into getNodes @@ -237,9 +243,9 @@ public class DocumentXPathResolver { } /* * If given XPath starts with '/', it means that it is not relative. - * Replace it (by removing first search predicate) with corresponding - * relative XPath - */ + * Replace it (by removing first search predicate) with corresponding + * relative XPath + */ String xpathToUse = xpath.trim(); int firstSlashIndex = xpathToUse.indexOf('/'); if (firstSlashIndex >= 0 && firstSlashIndex + 1 < xpathToUse.length()) { @@ -273,7 +279,7 @@ public class DocumentXPathResolver { } return nList; } catch (Exception e) { - throw new XmlException("Failed to perform Xpath search " + xpath + " (replaced with " + xpathToUse + "): " + e.getMessage(), e); + throw new XmlException("Failed to perform Xpath search " + xpath + " (replaced with " + xpathToUse + "): " + e.getMessage(), e, "E-RSP15408"); } } @@ -287,10 +293,10 @@ public class DocumentXPathResolver { private static String getValue(Object object) { /* * dlk, 2012-04-05 - * - * If null object is returned, do not throw an exception, as it can be - * normal situation for relative XPath search via NamedXPath - */ + * + * If null object is returned, do not throw an exception, as it can be + * normal situation for relative XPath search via NamedXPath + */ if (object == null) { return null; } @@ -307,6 +313,6 @@ public class DocumentXPathResolver { } // for now only elements and attributes are searched in Rasp - throw new RaspLibraryException("Unknown Type: " + object.getClass()); + throw new RaspLibraryException("E-RSP15409: Unknown Type: " + object.getClass()); } } diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NamedOMDocumentNavigator.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NamedOMDocumentNavigator.java index b6f9136f7388b6025355b04f0dc1ed9df2eb91ec..a3edaf2b1fdf6376e952d3b0ccaf50f5f358794f 100644 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NamedOMDocumentNavigator.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NamedOMDocumentNavigator.java @@ -38,7 +38,7 @@ public class NamedOMDocumentNavigator extends DocumentNavigator implements Named } else if (contextNode instanceof OMElement) { contextElement = (OMElement) contextNode; } else { - throw new UnsupportedAxisException("Unsupported contextNode type: " + contextNode.getClass()); + throw new UnsupportedAxisException("E-RSP15411: Unsupported contextNode type: " + contextNode.getClass()); } QName qname = new QName(namespaceURI, localName, namespacePrefix); OMElement firstChildWithName = contextElement.getFirstChildWithName(qname); @@ -56,7 +56,7 @@ public class NamedOMDocumentNavigator extends DocumentNavigator implements Named } else if (contextNode instanceof OMElement) { contextElement = (OMElement) contextNode; } else { - throw new UnsupportedAxisException("Unsupported contextNode type: " + contextNode.getClass()); + throw new UnsupportedAxisException("E-RSP15411: Unsupported contextNode type: " + contextNode.getClass()); } QName qname = new QName(namespaceURI, localName, namespacePrefix); OMAttribute attribute = contextElement.getAttribute(qname); diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NoXPathResultsException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NoXPathResultsException.java index c00a0baf80fa545deef66239645c5f850405b340..e372a7a6b62182717b247a0b28e5e0fbe466d815 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NoXPathResultsException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/NoXPathResultsException.java @@ -36,7 +36,7 @@ public class NoXPathResultsException extends XmlException { * * @param xpath xpath used */ - public NoXPathResultsException(final String xpath) { - super("No result from xpath expresson: " + xpath); + public NoXPathResultsException(final String xpath, final String errorCode) { + super(errorCode + ": No result from xpath expresson: " + xpath); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/TooManyXpathResultsException.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/TooManyXpathResultsException.java index f110aa5923bf8069e63fd60478674d5484c99b6a..e5611cde38168729b2e44edc8d0678173d40b500 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/TooManyXpathResultsException.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xpath/TooManyXpathResultsException.java @@ -34,7 +34,7 @@ public class TooManyXpathResultsException extends XmlException { * @param xpath the used xpath * @param count number of results */ - public TooManyXpathResultsException(final String xpath, final int count) { - super("xpath expression resulted in unexpected number of results: " + xpath + " : " + count); + public TooManyXpathResultsException(final String xpath, final int count, final String errorCode) { + super(errorCode + ": xpath expression resulted in unexpected number of results: " + xpath + " : " + count); } } \ No newline at end of file diff --git a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xslt/XsltUtility.java b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xslt/XsltUtility.java index ba04082b617fc2feb94e834afcfbda28f7bd1269..aebc9edd351b396962e2c2c621b306885df7013c 100755 --- a/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xslt/XsltUtility.java +++ b/dk.gov.oiosi.library/src/dk/gov/oiosi/xml/xslt/XsltUtility.java @@ -49,30 +49,6 @@ public class XsltUtility { private static final Log log = LogFactory.getLog(XsltUtility.class); - /** - * Method to transform any xmlDocument with a given xslt. - * - * @param xmlDoc The xml document to transform. - * @param stylesheet The xslt to transform xml document. - * @return The transformed xml document. - * @throws XmlException Xml transformations errors - */ - public XmlDocument transformXML(XmlDocument xmlDoc, XmlDocument stylesheet) throws XmlException { - try { - Transformer trans = precompiledStyleSheet(stylesheet); - if (trans == null) { - log.error("Unable to get Transformer/precompiledStyleSheet for XSLT=" + stylesheet.getFileName()); - } - return transformXml(xmlDoc, trans); - } catch (XMLStreamException | TransformerException e) { - log.error("XsltUtility.transformXML Failed: " + e.getMessage(), e); - throw new XmlException("XSL transformation error: " + e.getMessage(), e); - } catch (Exception e) { - log.error("XsltUtility.transformXML Failed: " + e.getMessage(), e); - throw new RaspLibraryException("RASP transformation error! " + e.getMessage(), e); - } - } - /** * Method that returns the pre-compiled XSLT stylesheet from the given XmlDocument. *

@@ -89,10 +65,37 @@ public class XsltUtility { return transFact.newTransformer(xsltSource); } - public static TransformerFactory getTransformerFactory(){ + public static TransformerFactory getTransformerFactory() { return new SaxonTransformerFactory(); } + /** + * Method to transform any xmlDocument with a given xslt. + * + * @param xmlDoc The xml document to transform. + * @param stylesheet The xslt to transform xml document. + * @return The transformed xml document. + * @throws XmlException Xml transformations errors + */ + public XmlDocument transformXML(XmlDocument xmlDoc, XmlDocument stylesheet) throws XmlException { + try { + Transformer trans = precompiledStyleSheet(stylesheet); + if (trans == null) { + log.error("E-RSP15604: Unable to get Transformer/precompiledStyleSheet for XSLT=" + stylesheet.getFileName()); + } + return transformXml(xmlDoc, trans); + } catch (XMLStreamException e) { + log.error("E-RSP15605: XsltUtility.transformXML Failed: " + e.getMessage(), e); + throw new XmlException("XSL transformation error: " + e.getMessage(), e, "E-RSP15605"); + } catch (TransformerException e) { + log.error("E-RSP15606: XsltUtility.transformXML Failed: " + e.getMessage(), e); + throw new XmlException("XSL transformation error: " + e.getMessage(), e, "E-RSP15601"); + } catch (Exception e) { + log.error("E-RSP15607: XsltUtility.transformXML Failed: " + e.getMessage(), e); + throw new RaspLibraryException("RASP transformation error! " + e.getMessage(), e, "E-RSP15602"); + } + } + /** * Method that returns the pre-compiled XSLT stylesheet from the given XML document referred by xsltPath. * @@ -101,13 +104,13 @@ public class XsltUtility { */ public Transformer precompiledStyleSheet(String xsltPath) throws MainException, TransformerConfigurationException, FileNotFoundException { if (xsltPath == null) { - throw new FileNotFoundException("Path to XSLT file is not defined"); + throw new FileNotFoundException("E-RSP15603: Path to XSLT file is not defined"); } log.debug("Start precompiledStyleSheet for " + xsltPath); String xsltVersion = DocumentXPathResolver.getElementValueByXpath(xsltPath, "/*/@version", new PrefixedNamespace[0]); if (xsltVersion == null || xsltVersion.isEmpty()) { - log.warn("XSLT version tag missing in file " + xsltPath); + log.warn("W-RSP15608: XSLT version tag missing in file " + xsltPath); } if (xsltVersion == null || !xsltVersion.equalsIgnoreCase("2.0")) { diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/TestConstants.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/TestConstants.java index 2e48c76ac337f4aef886100f0e201e88f61b0006..226af57c99f92b6daf8031c1a2e3912107ce37b2 100755 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/TestConstants.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/TestConstants.java @@ -69,7 +69,6 @@ public class TestConstants { // public static final String PATH_CERTIFICATE_TEST_ROOT = "test/resources/certificates/oces_test_root.cer"; public static final String PATH_CERTIFICATE_ROOT = PATH_COMMON + "Certificates/Live/Root/TDC OCES CA.cer"; public static final String PATH_FOCES2_INVALID = PATH_COMMON + "Certificates/Test/Funktionscertifikat/CVR34051178.Expire20160607.FOCES2.DigstDemo.cer"; -// public static final String PATH_FOCES2_VALID = PATH_COMMON + "Certificates/Test/Funktionscertifikat/DIGST.Expire20201008.FOCES2.DigstDemo.cer"; public static final String PATH_FOCES2_VALID = PATH_COMMON + "Certificates/Test/Funktionscertifikat/FOCES_gyldig_2022.cer"; public static final String PATH_MITID_ORG_TEST = PATH_COMMON + "Certificates/Test/Organisationscertifikat/Nemhandel-DEV-OCES-cert-2.p12"; diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/UtilitiesTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/UtilitiesTest.java index 42506054c2e55d79b3e3f02fb9f4e5d681e250bc..a56fdc4efd63fb418b8b2786f03af01cc8902612 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/UtilitiesTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/UtilitiesTest.java @@ -253,4 +253,4 @@ public class UtilitiesTest extends TestCase { assertEquals("Wrong sender type", "DK:VANS", identifier.getType()); assertEquals("Wrong sender value", "nkspu", identifier.getAsString()); } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/DownloadCRLStartupTaskTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/DownloadCRLStartupTaskTest.java index 1393295c7c038e571fda54f460d05e097ea4b04c..e51b96ba4702deed4b02d0cdecd2a5f771030e2c 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/DownloadCRLStartupTaskTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/DownloadCRLStartupTaskTest.java @@ -45,7 +45,7 @@ public class DownloadCRLStartupTaskTest extends AbstractTestCase { Level initial = Logger.getLogger(CrlCacheUpdateJob.class).getLevel(); try { Logger.getLogger(CrlCacheUpdateJob.class).setLevel(Level.DEBUG); - List configList = new ArrayList<>(); + List configList = new ArrayList(); configList.add(new StartupTaskConfiguration(DownloadCRLStartupTask.CONFIG_DOWNLOAD_CRL_URL, "http://crl.oces.certifikat.dk/oces.crl")); configList.add(new StartupTaskConfiguration(DownloadCRLStartupTask.CONFIG_DOWNLOAD_CRL_URL, "http://crl.systemtest7.trust2408.com/systemtest7.crl")); configList.add(new StartupTaskConfiguration(DownloadCRLStartupTask.CONFIG_DOWNLOAD_CRL_URL, "http://crl.systemtest8.trust2408.com/systemtest8.crl")); @@ -92,7 +92,7 @@ public class DownloadCRLStartupTaskTest extends AbstractTestCase { final boolean[] res = new boolean[1]; final boolean[] isRevocationCrlSource = new boolean[1]; - List configList = new ArrayList<>(); + List configList = new ArrayList(); configList.add(new StartupTaskConfiguration(DownloadCRLStartupTask.CONFIG_DOWNLOAD_CRL_URL, "http://crl.oces.certifikat.dk/oces.crl")); DownloadCRLStartupTask t = new DownloadCRLStartupTask() { /* @@ -154,7 +154,7 @@ public class DownloadCRLStartupTaskTest extends AbstractTestCase { * Check with invalid URL - exception should be thrown as we override * the downloadCrlUrl implementation. */ - List configList = new ArrayList<>(); + List configList = new ArrayList(); configList.add(new StartupTaskConfiguration(DownloadCRLStartupTask.CONFIG_DOWNLOAD_CRL_URL, "http://crl.oces.certifikat.dk/oces.crl")); t.setConfigList(configList); /* diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/StartCacheStateLogScheduledJobStartupTaskTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/StartCacheStateLogScheduledJobStartupTaskTest.java index 1717c99c8433b9eeb648461fe74e532c9ac14acf..e3dac5db18021b19d1b9e5e2726a7c034233fe61 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/StartCacheStateLogScheduledJobStartupTaskTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/common/startup/StartCacheStateLogScheduledJobStartupTaskTest.java @@ -24,6 +24,12 @@ public class StartCacheStateLogScheduledJobStartupTaskTest extends AbstractTestC * Check that task is executed without exceptions in general - fast test */ public void testDoTaskFast() throws MainException { + /* + * Check that task is executed without exceptions in general - fast test + * + * At first with default log level + */ + StartCacheStateLogScheduledJobStartupTask t = new StartCacheStateLogScheduledJobStartupTask(); t.doTask(); } @@ -141,7 +147,7 @@ public class StartCacheStateLogScheduledJobStartupTaskTest extends AbstractTestC } private List buildConfigList(String value, String unit) { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(new StartupTaskConfiguration(StartCacheStateLogScheduledJobStartupTask.CONFIG_SCHEDULE_JOB_RUN_INTERVAL, value)); list.add(new StartupTaskConfiguration(StartCacheStateLogScheduledJobStartupTask.CONFIG_SCHEDULE_JOB_RUN_INTERVAL_TIME_UNIT, unit)); return list; diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtilTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtilTest.java index f5c6b76e3ef37fe64ba3db854dcb3a3069dd5fa7..a3d2ba7cfb9f3422a7642e6fd2599e50e1326b81 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtilTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/configuration/ConfigurationLoaderUtilTest.java @@ -37,7 +37,7 @@ public class ConfigurationLoaderUtilTest extends TestCase { ConfigurationLoaderUtil.loadXMLConfiguration("RaspConfigUnavailable.xml", log); fail("Expected exception not thrown."); } catch (RaspLibraryException e) { - assertTrue("Wrong exception message text: " + e.getMessage(), e.getMessage().startsWith("OIORASP cannot load configuration xml [RaspConfigUnavailable.xml]")); + assertEquals("Wrong exception message text", "E-RSP11041: OIORASP cannot load configuration xml [RaspConfigUnavailable.xml]", e.getMessage().substring(0, e.getMessage().indexOf("]") + 1)); } } @@ -50,7 +50,7 @@ public class ConfigurationLoaderUtilTest extends TestCase { ConfigurationLoaderUtil.loadXMLConfiguration("test/resources/RaspConfiguration_damagedFile.xml", log); fail("Expected exception not thrown."); } catch (RaspLibraryException e) { - assertTrue("Wrong exception message text: " + e.getMessage(), e.getMessage().startsWith("OIORASP cannot load configuration xml [test/resources/RaspConfiguration_damagedFile.xml]")); + assertEquals("Wrong exception message text", "E-RSP11041: OIORASP cannot load configuration xml [test/resources/RaspConfiguration_damagedFile.xml]", e.getMessage().substring(0, e.getMessage().indexOf("]") + 1)); } assertNotNull(ConfigurationLoaderUtil.loadXMLConfiguration(TestConstants.PATH_RASPCONFIGURATION_PRODUCTION, log)); diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupProdTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupProdTest.java index 4353a2b2974a658ab1a35a3407e7ce3711a1c779..3b58adbf67027a9dc312eaf1b2d187a17cf3a169 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupProdTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupProdTest.java @@ -65,7 +65,7 @@ public class LdapCertificateLookupProdTest extends AbstractTestCase { ldapCertificateLookup.getCertificateFromLDAP(new CertificateSubject(certSubject)); fail("Exception not thrown - as expected"); } catch (LdapCertificateNotFoundException e) { - assertEquals("Exception changed", certSubject, e.getMessage()); + assertEquals("Exception changed", "E-RSP19104: " + certSubject, e.getMessage()); } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupTest.java index 8eff34a2ed8b8e763ff4b0d86f90bb0d7f002722..5e380dda2d0c38d92ca88d7abbac15e604b74176 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/ldap/LdapCertificateLookupTest.java @@ -57,7 +57,7 @@ public class LdapCertificateLookupTest extends AbstractTestCase { ldapCertificateLookup.getCertificateFromLDAP(new CertificateSubject(certSubject)); fail("Exception not thrown - as expected"); } catch (LdapCertificateNotFoundException e) { - assertEquals("Exception changed", certSubject, e.getMessage()); + assertEquals("Exception changed", "E-RSP19104: " + certSubject, e.getMessage()); } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlInstanceTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlInstanceTest.java index 6ade42e776f28149092a119211ec93d409c90ca2..c8961b80c36f006ee1032cf3f82e767534e27e2d 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlInstanceTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlInstanceTest.java @@ -60,7 +60,7 @@ public class CrlInstanceTest extends AbstractTestCase { try { CrlInstance.loadData(new URL("http://www.nemhandel.dk/xyz"), CertificateFactory.getInstance("X.509")); } catch (CheckCertificateRevokedUnexpectedException e) { - assertEquals("Wrong exception", "Unexpected exception during access to url=http://www.nemhandel.dk/xyz", e.getMessage()); + assertEquals("Wrong exception", "E-RSP19402: CRL-data could not be downloaded from url=http://www.nemhandel.dk/xyz: Moved Permanently", e.getMessage()); } } -} \ No newline at end of file +} diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlLookupTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlLookupTest.java index 3340ca632f7634ffecf0887421ccfa64b0d4383d..340f32c5dbf7ac2ecd190d7c9d01996f85675f5a 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlLookupTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/crl/CrlLookupTest.java @@ -47,14 +47,28 @@ public class CrlLookupTest extends AbstractTestCase { private CrlLookup crlLookup; + /** + * Read certificate from keystore file: test/resources/keys/oiosi_test_certificates.jks + * + * @param keyLabel Key on the certificate to load from JKS. + * @return X509Certificate + */ + public static X509Certificate getCertificate(String keyLabel) throws Exception { + // define receiver certificate + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(new FileInputStream(TestConstants.PATH_KEYSTORE_TEST), TestConstants.PASSWORD_KEYSTORE_TEST.toCharArray()); + + return (X509Certificate) ks.getCertificate(keyLabel); + } + @Override public void setUp() throws Exception { super.setUp(); resetRaspConfigurationToDefaultTest(); /* - * User log4j to modify logging properties for some classes - */ + * User log4j to modify logging properties for some classes + */ Logger.getLogger(CrlCache.class).setLevel(Level.ALL); Logger.getLogger(ScheduledExecutor.class).setLevel(Level.ALL); Logger.getLogger(CrlInstance.class).setLevel(Level.ALL); @@ -122,7 +136,7 @@ public class CrlLookupTest extends AbstractTestCase { } public void testLookTestMultiThread() throws InterruptedException { - List threads = new ArrayList<>(); + List threads = new ArrayList(); for (int i = 0; i < 32; i++) { Runnable runnable = new ThreadCertificateCheck(); Thread thread = new Thread(runnable); @@ -152,6 +166,7 @@ public class CrlLookupTest extends AbstractTestCase { } static class ThreadCertificateCheck implements Runnable { + public void run() { try { CrlLookup crlLookup = new CrlLookup(); @@ -177,27 +192,14 @@ public class CrlLookupTest extends AbstractTestCase { } } - /** - * Read certificate from keystore file: test/resources/keys/oiosi_test_certificates.jks - * - * @param keyLabel Key on the certificate to load from JKS. - * @return X509Certificate - */ - public static X509Certificate getCertificate(String keyLabel) throws Exception { - // define receiver certificate - KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(TestConstants.PATH_KEYSTORE_TEST), TestConstants.PASSWORD_KEYSTORE_TEST.toCharArray()); - - return (X509Certificate) ks.getCertificate(keyLabel); - } - /** * Special extension of CertificateUtil, where the returned URL list is always empty. */ static class SpecialCertificateUtil extends CertificateUtil { + @Override public List getCrlURLs(X509Certificate cert) { - return new ArrayList<>(); + return new ArrayList(); } } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookupTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookupTest.java index a9b089049fff4ddd5464ada28aef56933dbb511d..db32df604eef8b4d8154616fa7ef463ffcd28a94 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookupTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/security/revocation/ocsp/OcspLookupTest.java @@ -55,8 +55,8 @@ public class OcspLookupTest extends AbstractTestCase { @Override public void setUp() throws Exception { super.setUp(); - resetRaspConfigurationToDefaultTest(); +// ConfigurationHandler.setConfigurationFile(TestConstants.PATH_RASPCONFIGURATION_TEST); ocspLookup = new OcspLookup(); } @@ -170,7 +170,7 @@ public class OcspLookupTest extends AbstractTestCase { ocspLookup.getOnlineBinaryHttpResponse(req, "http://www.nemhandel.dk/unknownUrl"); } catch (RevocationException e) { - assertTrue("Wrong exception text:\n" + e.getMessage(), e.getMessage().startsWith("HTTP response code from OCSP request to [http://www.nemhandel.dk/unknownUrl] was:")); + assertEquals("Wrong exception text:", "E-RSP19450: HTTP response code from OCSP request to [http://www.nemhandel.dk/unknownUrl] was: 301", e.getMessage().substring(0, e.getMessage().indexOf("301")+3)); } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/test/unit/uddi/UddiConfigTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/test/unit/uddi/UddiConfigTest.java index 2b55592f67dccb11fe546ae6971eff7b8eb7345e..00b3bd370e94a7a4d88366b315494cd7553644e5 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/test/unit/uddi/UddiConfigTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/test/unit/uddi/UddiConfigTest.java @@ -46,15 +46,15 @@ public class UddiConfigTest extends AbstractTestCase { UddiConfig config = handler.getUddiConfig(); LookupRegistryFallbackConfig lookupRegistryFallbackConfig = new LookupRegistryFallbackConfig(); - ArrayList registries = new ArrayList<>(); + ArrayList registries = new ArrayList(); Registry registry1 = new Registry(); - List endpoints1 = new ArrayList<>(); + List endpoints1 = new ArrayList(); endpoints1.add(new Uri(_registry1Endpoint1)); endpoints1.add(new Uri(_registry1Endpoint2)); registry1.setEndpoints(endpoints1); registries.add(registry1); Registry registry2 = new Registry(); - List endpoints2 = new ArrayList<>(); + List endpoints2 = new ArrayList(); endpoints2.add(new Uri(_registry2Endpoint1)); endpoints2.add(new Uri(_registry2Endpoint2)); registry2.setEndpoints(endpoints2); diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/RegistryLookupClientTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/RegistryLookupClientTest.java index 8885648e5944e6f4b03adb00335ed79b68745086..3b6d0fd9faa32b0b2711406a7e4ba2059914c9ad 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/RegistryLookupClientTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/RegistryLookupClientTest.java @@ -19,7 +19,7 @@ public class RegistryLookupClientTest extends AbstractTestCase { } public void testGetProcessDefinitions() throws MainException { - List uddiIds = new ArrayList<>(); + List uddiIds = new ArrayList(); uddiIds.add(new UddiGuidId("uddi:AEE8B6DE-298F-4cbc-A96D-9AE8AED0AC31", true)); uddiIds.add(new UddiGuidId("uddi:c001daa0-8ba3-11dd-894e-770465b08940", true)); @@ -33,7 +33,7 @@ public class RegistryLookupClientTest extends AbstractTestCase { public void testLookup() throws MainException { String NES5_UDDI_ID = "uddi:aee8b6de-298f-4cbc-a96d-9ae8aed0ac31"; Identifier endpointID = new Identifier("EAN", "5798009811578"); - List processDefinitionTModelsList = new ArrayList<>(); + List processDefinitionTModelsList = new ArrayList(); processDefinitionTModelsList.add(new UddiGuidId(NES5_UDDI_ID, true)); LookupParameters uddiLookupParams = new LookupParameters( diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/UddiLookupClientTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/UddiLookupClientTest.java index 71aa4688a6b2e068262869e21891b7d20aa4951a..08ec6af3303e90f4d60beb7d6a766e87c2972297 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/UddiLookupClientTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/uddi/UddiLookupClientTest.java @@ -51,7 +51,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookup_existingServiceMustReturnResponseWithValidProperties() throws Exception { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); LookupParameters lookupParameters = new LookupParameters(eanIdentifier, serviceId_order, profileIds, acceptHttpProtocol); @@ -63,17 +63,8 @@ public class UddiLookupClientTest extends AbstractTestCase { assertResponsePropertiesAreSetCorrectly(response); } - public void testLookingUpExistingServiceMustReturnCertificateSubjectString() throws MainException, URISyntaxException { - // Make sure that lookup uses PROD: - reloadNewRaspConfigurationFile(TestConstants.PATH_RASPCONFIGURATION_PRODUCTION); - ConfigurationHandler.getInstance(true).loadXMLConfiguration(); - - UddiConfig config = ConfigurationHandler.getInstance().getUddiConfig(true); - Uri NHRServerUrl = config.getLookupRegistryFallbackConfig().getRegistries().iterator().next().getEndpoints().iterator().next(); - lookupClient = new UddiLookupClient(NHRServerUrl, 30); - - // Actual test: - List profileIds = new ArrayList<>(); + public void testLookingUpExistingServiceMustReturnCertificateSubjectString() throws MainException { + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); // LookupParameters lookupParameters = new LookupParameters(eanIdentifier, serviceId_order, profileIds, acceptHttpProtocol); @@ -88,7 +79,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpNonExistingServiceShouldReturnEmptyResponse() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); LookupParameters lookupParameters = new LookupParameters(eanIdentifier, documentId_nonExisting, profileIds, acceptHttpProtocol); @@ -98,7 +89,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpExistingServiceProvidingNonExistingRoleMustReturnEmptyResponseList() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_nonExistingProfileId); LookupParameters lookupParameters = new LookupParameters(eanIdentifier, serviceId_order, profileIds, acceptHttpProtocol); @@ -107,7 +98,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpServiceProvidingExistingRoleMustReturnResponse() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); String sellerPartyRoleIdentifier = "SellerParty"; @@ -117,7 +108,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpExistingServiceWithoutRoleMustReturnEmptyResponseList() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); String nonExistingRoleIdentifier = "NonExistingSellerParty"; @@ -127,7 +118,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpExistingServiceTwoProfilesBothExistingMustReturnResponse() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_OrdAdvBilSim); profileIds.add(profile_NES_5); @@ -143,7 +134,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookingUpExistingServiceTwoProfilesOneExistingMustReturnResponse() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_nonExistingProfileId); profileIds.add(profile_NES_5); @@ -196,7 +187,7 @@ public class UddiLookupClientTest extends AbstractTestCase { LookupParameters lookupParameters = new LookupParameters(identifierSe, acceptHttpProtocol); List lookupResponses = performLookup(lookupParameters); assertNotNull("Response object must exist", lookupResponses); - assertEquals("Wrong response count (supported document types)", 3, lookupResponses.size()); + assertEquals("Wrong response count", 3, lookupResponses.size()); } public void testLookup_DK_P() throws Exception { @@ -217,7 +208,7 @@ public class UddiLookupClientTest extends AbstractTestCase { // NHRServerUrl = new Uri(url); // lookupClient = new UddiLookupClient(NHRServerUrl); // } - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_BilSim); Identifier ean = new Identifier("EAN", "5798009811578"); // DIGST demo EAN @@ -235,7 +226,7 @@ public class UddiLookupClientTest extends AbstractTestCase { * NHR Test Case 01.04.06: Verify logging from UDDI Inquiry adapter in Splunk key-value format. */ public void testNHR_TestCase_01_04_06() throws Exception { - List profileIdList = new ArrayList<>(); + List profileIdList = new ArrayList(); profileIdList.add(profile_BilSim); // Using an existing EAN (random number) @@ -275,7 +266,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookup_registrationWithOneProfileInTwoRoles() throws MainException { - List profileIds = new ArrayList<>(); + List profileIds = new ArrayList(); profileIds.add(profile_BilSim); LookupParameters lookupParameters = new LookupParameters(eanIdentifier, documentId_invoice, profileIds, acceptHttpProtocol, "BuyerParty"); @@ -290,13 +281,13 @@ public class UddiLookupClientTest extends AbstractTestCase { * Useful info when a NHR load should be reproduced. */ public void testLookupPerformance() throws UddiEmptyGuidException { - List profileIdList = new ArrayList<>(); + List profileIdList = new ArrayList(); profileIdList.add(new UddiGuidId("aee8b6de-298f-4cbc-a96d-9ae8aed0ac31")); // NES5 - acceptHttpProtocol = new ArrayList<>(); + acceptHttpProtocol = new ArrayList(); acceptHttpProtocol.add(EndpointAddressTypeCode.http); - List lookupParametersList = new ArrayList<>(); + List lookupParametersList = new ArrayList(); lookupParametersList.add(new LookupParameters(eanIdentifier, acceptHttpProtocol)); lookupParametersList.add(new LookupParameters(new Identifier("EAN", "5790002133718"), acceptHttpProtocol)); lookupParametersList.add(new LookupParameters(new Identifier("EAN", "5790002130144"), acceptHttpProtocol)); @@ -374,7 +365,7 @@ public class UddiLookupClientTest extends AbstractTestCase { UddiId profileUddiId = Utilities.getProfileId(xmlDocument, documentTypeConfig, profileMappingConfig); System.err.println("Profile UddiId: " + profileUddiId); System.err.println("ServiceContract UddiId: " + documentTypeConfig.getServiceContractTModel()); - List profileDefinitionIds = new ArrayList<>(); + List profileDefinitionIds = new ArrayList(); profileDefinitionIds.add(profileUddiId); parameters = new LookupParameters( endpointID, @@ -429,7 +420,7 @@ public class UddiLookupClientTest extends AbstractTestCase { UddiId profileUddiId = Utilities.getProfileId(xmlDocument, documentTypeConfig, profileMappingConfig); System.err.println("Profile UddiId: " + profileUddiId); System.err.println("ServiceContract UddiId: " + documentTypeConfig.getServiceContractTModel()); - List profileDefinitionIds = new ArrayList<>(); + List profileDefinitionIds = new ArrayList(); profileDefinitionIds.add(profileUddiId); parameters = new LookupParameters( endpointID, @@ -542,7 +533,7 @@ public class UddiLookupClientTest extends AbstractTestCase { } public void testLookup() throws Exception { - List processDefinitionTModelsList = new ArrayList<>(); + List processDefinitionTModelsList = new ArrayList(); processDefinitionTModelsList.add(profile_NES_5); LookupParameters uddiLookupParams = new LookupParameters(eanIdentifier, documentId_invoice, processDefinitionTModelsList, null); diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/SchematronValidationTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/SchematronValidationTest.java index 4bd306a30eae3e1ebd21c1af9b6b66c2e410c394..b111e17c14a08216b8f44d730fb4bcb22f612d3d 100755 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/SchematronValidationTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/SchematronValidationTest.java @@ -122,7 +122,7 @@ public class SchematronValidationTest extends TestCase { assertSchematronValidationOK(TestConstants.PATH_CREDITNOTE07_XML); } - public void testPeppolDespatchAdvoce() throws Exception { + public void testPeppolDespatchAdvice() throws Exception { assertSchematronValidationOK(TestConstants.PATH_DESPATCH_ADVICE); } @@ -149,7 +149,7 @@ public class SchematronValidationTest extends TestCase { assertSchematronValidationOK(TestConstants.PATH_DESPATCH_ADVICE_BZ1366); fail("testDespatchAdvice_invalid_BZ1366 should give error"); } catch (SchematronErrorException e) { - assertEquals("Wrong error found", "[BII2-T16-R013]-Each despatch advice line MUST have a despatch line identifier that is unique within the despatch advice", e.getMessage()); + assertEquals("Wrong error found", "E-RSP15325: [BII2-T16-R013]-Each despatch advice line MUST have a despatch line identifier that is unique within the despatch advice", e.getMessage()); } } @@ -157,6 +157,7 @@ public class SchematronValidationTest extends TestCase { * Verify that it's possible to schematron validate all the example files located in "Resources\Documents\Examples". */ public void testSchematronValidateAllTestFiles() { + // Ignore the old OIOXML documents + AttachedDocument: List avoidList = Arrays.asList("OIOUBL_AttachedDocument_v2p2.xml", "OIOXML_PIP_Invoice.xml", "OIOXML_PCP_CreditNote.xml"); for (File file : TestUtil.getOkExampleDocumentPaths()) { try { diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/MultipleTransformerVsSingleResearchTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/MultipleTransformerVsSingleResearchTest.java index a8c6d2cfc5d63d39c61fd44e1ba3822a6b05ae90..ba4e088936a667c93eaa24f5e15213c6e6f97093 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/MultipleTransformerVsSingleResearchTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/MultipleTransformerVsSingleResearchTest.java @@ -209,7 +209,7 @@ public class MultipleTransformerVsSingleResearchTest extends TestCase { xmlStylesheet.load(path); return xsltUtility.precompiledStyleSheet(xmlStylesheet); } catch (Exception ex) { - throw new FailedToLoadSchematronStylesheetException(path, ex); + throw new FailedToLoadSchematronStylesheetException(path, ex, "TEST"); } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/SchematronComparatorBulkResearchTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/SchematronComparatorBulkResearchTest.java index 507f671de37aca2aa84dcc88856ae3cc374f3e17..af4eab1f8083e637c196dd88f8f7aeea47233145 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/SchematronComparatorBulkResearchTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/SchematronComparatorBulkResearchTest.java @@ -1,27 +1,11 @@ package dk.gov.oiosi.xml.schematron.research; import dk.gov.oiosi.TestConstants; -import dk.gov.oiosi.communication.configuration.DocumentTypeConfig; import dk.gov.oiosi.configuration.ConfigurationHandler; -import dk.gov.oiosi.xml.XmlDocument; -import dk.gov.oiosi.xml.documenttype.DocumentTypeConfigSearcher; -import dk.gov.oiosi.xml.schematron.research.bulk.*; +import dk.gov.oiosi.xml.schematron.research.bulk.IFolderListener; import junit.framework.TestCase; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMXMLParserWrapper; -import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; + import java.util.HashMap; -import java.util.List; import java.util.Map; /** @@ -103,47 +87,47 @@ import java.util.Map; */ public class SchematronComparatorBulkResearchTest extends TestCase { - private static final Logger log = Logger.getLogger(SchematronComparatorBulkResearchTest.class); +// private static final Logger log = Logger.getLogger(SchematronComparatorBulkResearchTest.class); private static final boolean CLEAR_FILE_ERROR_MAPS = true; - public static String PATH_TEST_FOLDER = "D:/temp/32"; +// public static String PATH_TEST_FOLDER = "D:/temp/32"; private Map fileSchematronErrorMap = new HashMap<>(); private Map fileSchemaErrorMap = new HashMap<>(); - private DifferentWayTransformationExecutor transformExecutor; +// private DifferentWayTransformationExecutor transformExecutor; @Override public void setUp() { ConfigurationHandler.setConfigurationFile(TestConstants.PATH_RASPCONFIGURATION_TEST); ConfigurationHandler.getInstance(); - transformExecutor = new DifferentWayTransformationExecutor(); - } - - public void test() throws Exception { - checkFolder(PATH_TEST_FOLDER); +// transformExecutor = new DifferentWayTransformationExecutor(); } - public void checkFolder(String path) throws Exception { - File testFolder = new File(path); - if (!testFolder.exists() || !testFolder.isDirectory()) { - return; - } - - FileSystemCrowler.log.setLevel(Level.INFO); - List fileListenerList = new ArrayList(); - XmlFileListener xmlListener = new XmlFileListener(); - fileListenerList.add(xmlListener); - fileListenerList.add(new ErrorFileListener()); - fileListenerList.add(new GZipFileListener()); - List folderListenerList = new ArrayList(); - folderListenerList.add(new MapCleanerListener()); - - FileSystemCrowler fsc = new FileSystemCrowler(fileListenerList, folderListenerList); - fsc.processFolder(testFolder); - System.out.println(xmlListener.toStatus()); - } +// public void test() throws Exception { +// checkFolder(PATH_TEST_FOLDER); +// } + +// public void checkFolder(String path) throws Exception { +// File testFolder = new File(path); +// if (!testFolder.exists() || !testFolder.isDirectory()) { +// return; +// } +// +// FileSystemCrowler.log.setLevel(Level.INFO); +// List fileListenerList = new ArrayList(); +// XmlFileListener xmlListener = new XmlFileListener(); +// fileListenerList.add(xmlListener); +// fileListenerList.add(new ErrorFileListener()); +// fileListenerList.add(new GZipFileListener()); +// List folderListenerList = new ArrayList(); +// folderListenerList.add(new MapCleanerListener()); +// +// FileSystemCrowler fsc = new FileSystemCrowler(fileListenerList, folderListenerList); +// fsc.processFolder(testFolder); +// System.out.println(xmlListener.toStatus()); +// } protected String buildFileNameKey(String name) { String fileKey = name.trim(); @@ -168,14 +152,14 @@ public class SchematronComparatorBulkResearchTest extends TestCase { } } - private OMElement loadAxiomBuild(byte[] data) throws Exception { - XMLStreamReader parser; - parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(data)); - OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); - OMElement doc = builder.getDocumentElement(); - doc.build(); - return doc; - } +// private OMElement loadAxiomBuild(byte[] data) throws Exception { +// XMLStreamReader parser; +// parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(data)); +// OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); +// OMElement doc = builder.getDocumentElement(); +// doc.build(); +// return doc; +// } public class MapCleanerListener implements IFolderListener { @@ -186,6 +170,7 @@ public class SchematronComparatorBulkResearchTest extends TestCase { } } + private class GZipFileListener implements IFileListener { public void apply(String fileName, byte[] data) { diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/bulk/DifferentWayTransformationExecutor.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/bulk/DifferentWayTransformationExecutor.java index 38f200ff50b3f29f565bd5401e231c95822ce79a..82d93e37111d124debf2ae4229aefa9513541edd 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/bulk/DifferentWayTransformationExecutor.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/research/bulk/DifferentWayTransformationExecutor.java @@ -1,36 +1,18 @@ package dk.gov.oiosi.xml.schematron.research.bulk; -import dk.gov.oiosi.communication.configuration.DocumentTypeConfig; import dk.gov.oiosi.xml.XmlDocument; import dk.gov.oiosi.xml.XmlDocumentException; -import dk.gov.oiosi.xml.XmlException; -import dk.gov.oiosi.xml.schematron.FailedToLoadSchematronStylesheetException; -import dk.gov.oiosi.xml.schematron.SchematronErrorException; -import dk.gov.oiosi.xml.schematron.SchematronValidationConfig; import dk.gov.oiosi.xml.schematron.research.SchematronComparatorBulkResearchTest; -import dk.gov.oiosi.xml.schematron.sax.SchematronValidatorSAXUtil; -import dk.gov.oiosi.xml.xpath.DocumentXPathResolver; -import dk.gov.oiosi.xml.xpath.PrefixedNamespace; -import dk.gov.oiosi.xml.xslt.XsltUtility; import org.apache.axiom.om.impl.builder.StAXOMBuilder; -import org.apache.commons.configuration.ConfigurationUtils; -import org.xml.sax.InputSource; import javax.xml.stream.XMLStreamException; -import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; import java.io.InputStream; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; /** * Helper class for {@link SchematronComparatorBulkResearchTest} @@ -39,53 +21,37 @@ import java.util.Map; */ public class DifferentWayTransformationExecutor { - private Map transformer124Map = new HashMap(10); +// private Map transformer124Map = new HashMap(10); - private Map transformer123Map = new HashMap(10); +// private Map transformer123Map = new HashMap(10); - public String version124Way(DocumentTypeConfig documentType, XmlDocument xd) throws Exception { - for (SchematronValidationConfig config : documentType.getSchematronValidationConfigList()) { - try { - Transformer transformer = getNewTransformer(config.getSchematronDocumentPath()); - SchematronValidatorSAXUtil.schematronValidateXmlDocument(xd.getTransformationSource(), transformer, config.getSaxHandlerConfig()); - } catch (SchematronErrorException e) { - return e.getMessage(); - } - } - return null; - } +// public String version124Way(DocumentTypeConfig documentType, XmlDocument xd) throws Exception { +// for (SchematronValidationConfig config : documentType.getSchematronValidationConfigList()) { +// try { +// Transformer transformer = getNewTransformer(config.getSchematronDocumentPath()); +// SchematronValidatorSAXUtil.schematronValidateXmlDocument(xd.getTransformationSource(), transformer, config.getSaxHandlerConfig()); +// } catch (SchematronErrorException e) { +// return e.getMessage(); +// } +// } +// return null; +// } - /* - * Let's also compare when just byte array is passed to transformer instead - * of built AXIOM document - */ - public String byteArrayXmlTransformerSax(DocumentTypeConfig documentType, byte[] data) throws Exception { - for (SchematronValidationConfig config : documentType.getSchematronValidationConfigList()) { - try { - Transformer transformer = getNewTransformer(config.getSchematronDocumentPath()); - SchematronValidatorSAXUtil.schematronValidateXmlDocument(new SAXSource(new InputSource(new ByteArrayInputStream(data))), transformer, config.getSaxHandlerConfig()); - } catch (SchematronErrorException e) { - return e.getMessage(); - } - } - return null; - } - - public String version123Way(DocumentTypeConfig documentType, XmlDocument xd) throws Exception { - for (SchematronValidationConfig svc : documentType.getSchematronValidationConfigList()) { - try { - Transformer transformer = getOldTransformer(svc.getSchematronDocumentPath()); - /* - * Do not use optimized SaxHandler which stops on first error - */ - XmlDocument oldTransformXml = oldTransformXml(xd, transformer); - oldValidateResult(oldTransformXml, svc.getErrorXPath(), svc.getErrorMessageXPath()); - } catch (SchematronErrorException e) { - return e.getMessage(); - } - } - return null; - } +// /* +// * Let's also compare when just byte array is passed to transformer instead +// * of built AXIOM document +// */ +// public String byteArrayXmlTransformerSax(DocumentTypeConfig documentType, byte[] data) throws Exception { +// for (SchematronValidationConfig config : documentType.getSchematronValidationConfigList()) { +// try { +// Transformer transformer = getNewTransformer(config.getSchematronDocumentPath()); +// SchematronValidatorSAXUtil.schematronValidateXmlDocument(new SAXSource(new InputSource(new ByteArrayInputStream(data))), transformer, config.getSaxHandlerConfig()); +// } catch (SchematronErrorException e) { +// return e.getMessage(); +// } +// } +// return null; +// } /** * Copied from XsltUtility OIORASP 1.2.3 @@ -102,62 +68,28 @@ public class DifferentWayTransformationExecutor { return new XmlDocument(builder.getDocumentElement()); } - /** - * Copied from SchematronValidator 1.2.3 - */ - private void oldValidateResult(XmlDocument result, String errorXPath, String errorMessageXPath) throws XmlException { - PrefixedNamespace[] prefixedNamespaces = new PrefixedNamespace[0]; - boolean hasAnyErrors = DocumentXPathResolver.hasAnyElementsByXpath(result, errorXPath, prefixedNamespaces); - if (hasAnyErrors) { - String firstErrorMessage = DocumentXPathResolver.getFirstElementValueByXPath(result, errorMessageXPath, - prefixedNamespaces); - throw new SchematronErrorException(result, firstErrorMessage); - } - } - - /* - * In version 1.2.3 OIORASP transformers were loaded as AXIOM documents and - * then converted to DOM for DOMSource - */ - private Transformer getOldTransformer(String path) throws FailedToLoadSchematronStylesheetException { - Transformer transformer = transformer123Map.get(path); - if (transformer == null) { - XmlDocument xd = new XmlDocument(); - try { - xd.load(path); - Source xsltSource = new DOMSource(xd.getW3Document()); - TransformerFactory transFact = XsltUtility.getTransformerFactory(); - transformer = transFact.newTransformer(xsltSource); - transformer123Map.put(path, transformer); - } catch (Exception ex) { - throw new FailedToLoadSchematronStylesheetException(path, ex); - } - } - return transformer; - } - - /* - * In version 1.3.0 it is proposed to use SAXSource without unnecessary conversion to DOM - */ - private Transformer getNewTransformer(String path) throws FailedToLoadSchematronStylesheetException { - Transformer transformer = transformer124Map.get(path); - if (transformer == null) { - try { - InputStream is; - try { - URL url = ConfigurationUtils.locate(path); - is = url.openStream(); - } catch (Exception e) { - is = new FileInputStream(path); - } - Source xsltSource = new SAXSource(new InputSource(is)); - TransformerFactory transFact = XsltUtility.getTransformerFactory(); - transformer = transFact.newTransformer(xsltSource); - transformer124Map.put(path, transformer); - } catch (Exception ex) { - throw new FailedToLoadSchematronStylesheetException(path, ex); - } - } - return transformer; - } +// /* +// * In version 1.3.0 it is proposed to use SAXSource without unnecessary conversion to DOM +// */ +// private Transformer getNewTransformer(String path) throws FailedToLoadSchematronStylesheetException { +// Transformer transformer = transformer124Map.get(path); +// if (transformer == null) { +// try { +// InputStream is; +// try { +// URL url = ConfigurationUtils.locate(path); +// is = url.openStream(); +// } catch (Exception e) { +// is = new FileInputStream(path); +// } +// Source xsltSource = new SAXSource(new InputSource(is)); +// TransformerFactory transFact = XsltUtility.getTransformerFactory(); +// transformer = transFact.newTransformer(xsltSource); +// transformer124Map.put(path, transformer); +// } catch (Exception ex) { +// throw new FailedToLoadSchematronStylesheetException(path, ex); +// } +// } +// return transformer; +// } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfigTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfigTest.java index 6d8e17f77b3f856a7f5e82bf87a10f28d5bd6d5d..213baf61585f9756bf9f87682e4bb3b0b408c73b 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfigTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerConfigTest.java @@ -4,9 +4,8 @@ import dk.gov.oiosi.AbstractTestCase; import dk.gov.oiosi.communication.configuration.DocumentTypeCollectionConfig; import dk.gov.oiosi.communication.configuration.DocumentTypeConfig; import dk.gov.oiosi.configuration.ConfigurationHandler; -import dk.gov.oiosi.xml.schematron.SchematronErrorException; import dk.gov.oiosi.xml.schematron.SchematronValidationConfig; -import junit.framework.TestCase; +import dk.gov.oiosi.xml.schematron.SchematronValidationFailedException; /** * Test compatibility of configured document types in RaspConfiguration.xml, test correctness of parsing XPath values and their validation. @@ -45,7 +44,7 @@ public class SchematronValidatorSAXHandlerConfigTest extends AbstractTestCase { } } - public void testBuild() throws SchematronErrorException { + public void testBuild() throws SchematronValidationFailedException { SchematronValidatorSAXHandlerConfig c = SchematronValidatorSAXHandlerConfig.build("/schematron/error", "/schematron/error"); assertEquals("error", c.getErrorMessageTag()); assertEquals(1, c.getTagList().length); @@ -60,28 +59,28 @@ public class SchematronValidatorSAXHandlerConfigTest extends AbstractTestCase { try { SchematronValidatorSAXHandlerConfig.build(null, null); fail("Build method is expected to throw an exception if one of fields is not set"); - } catch (SchematronErrorException see) { + } catch (SchematronValidationFailedException e) { // OK } try { SchematronValidatorSAXHandlerConfig.build("", null); fail("Build method is expected to throw an exception if one of fields is not set"); - } catch (SchematronErrorException see) { + } catch (SchematronValidationFailedException see) { // OK } try { SchematronValidatorSAXHandlerConfig.build(null, ""); fail("Build method is expected to throw an exception if one of fields is not set"); - } catch (SchematronErrorException see) { + } catch (SchematronValidationFailedException see) { // OK } try { SchematronValidatorSAXHandlerConfig.build("/A", "/B"); fail("XPath for error should be equal or start with XPath for error description"); - } catch (SchematronErrorException see) { + } catch (SchematronValidationFailedException see) { // OK } } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest.java index 5f8d69f05e01b518afca2a1c7ea7856016fc7ace..e48a2d10d100da81bd419a07d1ba1f511b92b57c 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest.java @@ -4,7 +4,6 @@ import junit.framework.TestCase; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -35,7 +34,7 @@ public class SchematronValidatorSAXHandlerTest extends TestCase { } private void runCase(int index) throws Exception { - InputStream is = new FileInputStream(new File("test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest_Case" + index + ".xml")); + InputStream is = new FileInputStream("test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXHandlerTest_Case" + index + ".xml"); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); @@ -55,7 +54,7 @@ public class SchematronValidatorSAXHandlerTest extends TestCase { } } catch (SchematronValidatorSAXException v) { if (index < START_SUCCESS) { - assertEquals("Case " + index, "ERROR TEXT TO SHOW", v.getMessage().trim()); + assertEquals("Case " + index + " failed:", "E-RSP15325: ERROR TEXT TO SHOW", v.getMessage().trim()); } else { fail("Case " + index + ", expected to pass without errors"); } diff --git a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtilTest.java b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtilTest.java index fb5c0f308d4eb9ff0541578aa0910b8f4dce2a55..370ee7d1c851bc5ef350822c70b59734baadaec0 100644 --- a/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtilTest.java +++ b/dk.gov.oiosi.library/test/src/dk/gov/oiosi/xml/schematron/sax/SchematronValidatorSAXUtilTest.java @@ -33,29 +33,29 @@ public class SchematronValidatorSAXUtilTest extends TestCase { * Test valid and invalid OIOUBL Invoice */ public void testOIOUBLInvoice() throws Exception { - assertNull("Document should be valid", checkDocument(TestConstants.PATH_INVOICE)); - assertEquals("Wrong Schematron error text", "[F-INV009] Invalid Invoice/ID (Invoice number). Must contain a value.", checkDocument(TestConstants.PATH_INVOICE_NO_ID)); + assertNull("Document should be valid", checkDocumentAndGetError(TestConstants.PATH_INVOICE)); + assertEquals("Wrong Schematron error text", "E-RSP15325: [F-INV009] Invalid Invoice/ID (Invoice number). Must contain a value.", checkDocumentAndGetError(TestConstants.PATH_INVOICE_NO_ID)); } /** * Test valid and invalid PEPPOL Despatch Advice. */ public void testPEPPOLDespatchAdvice() throws Exception { - assertNull("Document should be valid", checkDocument(TestConstants.PATH_DESPATCH_ADVICE)); - assertEquals("Wrong Schematron error text", "[BII2-T16-R013]-Each despatch advice line MUST have a despatch line identifier that is unique within the despatch advice", checkDocument(TestConstants.PATH_DESPATCH_ADVICE_BZ1366)); + assertNull("Document should be valid", checkDocumentAndGetError(TestConstants.PATH_DESPATCH_ADVICE)); + assertEquals("Wrong Schematron error text", "E-RSP15325: [BII2-T16-R013]-Each despatch advice line MUST have a despatch line identifier that is unique within the despatch advice", checkDocumentAndGetError(TestConstants.PATH_DESPATCH_ADVICE_BZ1366)); } public void testPEPPOL_BIS3_Billing() throws Exception { - assertNull("Document should be valid", checkDocument(TestConstants.PATH_PEPPOL_BIS_BILLING_Invoice_v3)); - assertEquals("Wrong Schematron error text", "Business process MUST be provided.", checkDocument(TestConstants.PATH_PEPPOL_BIS_BILLING_Invoice_v3_INVALID)); + assertNull("Document should be valid", checkDocumentAndGetError(TestConstants.PATH_PEPPOL_BIS_BILLING_Invoice_v3)); + assertEquals("Wrong Schematron error text", "E-RSP15325: Business process MUST be provided.", checkDocumentAndGetError(TestConstants.PATH_PEPPOL_BIS_BILLING_Invoice_v3_INVALID)); } /** * Test valid and invalid OIOXML Invoice. */ public void testOIOXMLInvoice() throws Exception { - assertNull("Document should be valid", checkDocument(TestConstants.PATH_INVOICE_PIE)); - assertEquals(":\n WARNING: EAN numbers are 13 digits in length\n", checkDocument(TestConstants.PATH_INVOICE_INVALID_EAN_NUMBER)); + assertNull("Document should be valid", checkDocumentAndGetError(TestConstants.PATH_INVOICE_PIE)); + assertEquals("E-RSP15325: :\n WARNING: EAN numbers are 13 digits in length", checkDocumentAndGetError(TestConstants.PATH_INVOICE_INVALID_EAN_NUMBER)); } /** @@ -70,21 +70,21 @@ public class SchematronValidatorSAXUtilTest extends TestCase { if (value instanceof String) { String filePath = (String) value; if (filePath.endsWith(".xml") && !filePath.startsWith(TestConstants.PATH_EXAMPLES_INVALID)) { - checkDocument(filePath); + checkDocumentAndGetError(filePath); } } } } } - private String checkDocument(String path) throws Exception { + private String checkDocumentAndGetError(String path) throws Exception { XmlDocument xd = new XmlDocument(); xd.load(path); - return checkDocument(xd); + return checkDocumentAndGetError(xd); } - private String checkDocument(XmlDocument xd) throws Exception { + private String checkDocumentAndGetError(XmlDocument xd) throws Exception { DocumentTypeConfigSearcher dts = new DocumentTypeConfigSearcher(); DocumentTypeConfig documentTypeConfig = dts.findUniqueDocumentType(xd); assertNotNull(documentTypeConfig);