diff --git a/samples/dk.gov.oiosi.samples.TestUddi/TestUddi/Program.cs b/samples/dk.gov.oiosi.samples.TestUddi/TestUddi/Program.cs index 84df2a320f2650bb53028a65b631fc9995e4d9ca..28a358deafb775453353e948ab43a8386df99ce6 100644 --- a/samples/dk.gov.oiosi.samples.TestUddi/TestUddi/Program.cs +++ b/samples/dk.gov.oiosi.samples.TestUddi/TestUddi/Program.cs @@ -11,7 +11,7 @@ namespace dk.gov.oiosi.samples.TestUddi { static void Main(string[] args) { - new Program(); + Program program = new Program(); } diff --git a/src/dk.gov.oiosi.configuration/CacheConfig.cs b/src/dk.gov.oiosi.configuration/CacheConfig.cs index b7c954a46dca68f6990c5fa2a9c2d4b5f2f7ce50..e3baf333283761c841efbc24a3adf3face8dee7c 100644 --- a/src/dk.gov.oiosi.configuration/CacheConfig.cs +++ b/src/dk.gov.oiosi.configuration/CacheConfig.cs @@ -115,9 +115,9 @@ namespace dk.gov.oiosi.configuration } if (schematronStoreCache == null) { - throw new NullArgumentException("schematromStoreCache"); + throw new NullArgumentException("schematronStoreCache"); } - if (schematronStoreCache == null) + if (schemaStoreCache == null) { throw new NullArgumentException("schemaStoreCache"); } diff --git a/src/dk.gov.oiosi/addressing/Identifier.cs b/src/dk.gov.oiosi/addressing/Identifier.cs index f8070010583adc6621d48aa41079fbdf34d3010a..d1b69151853db9394ea3b0073c817558b6076951 100644 --- a/src/dk.gov.oiosi/addressing/Identifier.cs +++ b/src/dk.gov.oiosi/addressing/Identifier.cs @@ -216,6 +216,17 @@ namespace dk.gov.oiosi.addressing { return this.GetAsString().GetHashCode(); } + public override bool Equals(object obj) + { + var ident = obj as Identifier; + if (ident != null) + { + return this.Equals(ident); + } + return false; + + } + public override string ToString() { return this.GetAsString(); diff --git a/src/dk.gov.oiosi/communication/handlers/email/Inbox.cs b/src/dk.gov.oiosi/communication/handlers/email/Inbox.cs index b903f969bef195aef1ff90d27aaec1231fc827a3..a5330d29c42e8e5f7c0a1f12d1889e52c9ba45f2 100644 --- a/src/dk.gov.oiosi/communication/handlers/email/Inbox.cs +++ b/src/dk.gov.oiosi/communication/handlers/email/Inbox.cs @@ -192,13 +192,14 @@ namespace dk.gov.oiosi.communication.handlers.email { logging.WCFLogger.Write(TraceEventType.Verbose, "Beginning to receive incoming mails on '" + this._serverConfiguration.ServerAddress + "' as user '" + this._serverConfiguration.UserName + "'"); SetState(InboxState.Starting); - try { - _asyncResult = _asyncReceive.BeginInvoke(null, null); - OnStartPolling.WaitOne(); - } - catch { - SetState(InboxState.Faulted); - } + try { + _asyncResult = _asyncReceive.BeginInvoke(null, null); + OnStartPolling.WaitOne(); + _asyncReceive.EndInvoke(_asyncResult); + } + catch { + SetState(InboxState.Faulted); + } } diff --git a/src/dk.gov.oiosi/communication/listener/Listener.cs b/src/dk.gov.oiosi/communication/listener/Listener.cs index 711199111771f749a5f397a8f7990f04b44301bc..b80e08fe2b8686595dcd77d6aac08410b11abaa4 100644 --- a/src/dk.gov.oiosi/communication/listener/Listener.cs +++ b/src/dk.gov.oiosi/communication/listener/Listener.cs @@ -337,14 +337,14 @@ namespace dk.gov.oiosi.communication.listener { /// protected void OverrideConfig(){ if (pListenerIdentity != null) { - - + + // Override certificate // TOOD: what is going on here? why only override the servicehost cridentials one time ? if (pListenerIdentity.ListenerCertificate != null && pServiceHost != null) { pServiceHost.Credentials.ServiceCertificate.Certificate = pListenerIdentity.ListenerCertificate.Certificate; } - else { + else if (pServiceHost != null) { pListenerIdentity.ListenerCertificate = new OcesX509Certificate(pServiceHost.Credentials.ServiceCertificate.Certificate); } diff --git a/src/dk.gov.oiosi/uddi/UddiLookupKey.cs b/src/dk.gov.oiosi/uddi/UddiLookupKey.cs index 1d258712aa58c4ef5abc3acbc376dad2d884ff1d..d1028e48e8fa88c222df1bf7943009a324866073 100644 --- a/src/dk.gov.oiosi/uddi/UddiLookupKey.cs +++ b/src/dk.gov.oiosi/uddi/UddiLookupKey.cs @@ -8,7 +8,7 @@ namespace dk.gov.oiosi.uddi { public class UddiLookupKey { - private Identifier identifier; + private readonly Identifier identifier; private UddiId serviceId; private Uri endpoint; private string profileConformanceClaim; diff --git a/src/dk.gov.oiosi/xml/schematron/SchematronValidator.cs b/src/dk.gov.oiosi/xml/schematron/SchematronValidator.cs index 9185760d75430eedf2f0507a827a6ee14995ec56..8d19649925a59b0795f23a616d54d1a77ecdd0cf 100644 --- a/src/dk.gov.oiosi/xml/schematron/SchematronValidator.cs +++ b/src/dk.gov.oiosi/xml/schematron/SchematronValidator.cs @@ -181,46 +181,52 @@ namespace dk.gov.oiosi.xml.schematron { using (MemoryStream schematronResultMemoryStream = new MemoryStream()) { - using (MemoryStream xmlSchematronStylesheetMemoryStream = compiledXslt.Stream) - { - xmlSchematronStylesheetMemoryStream.Flush();//Adjust this if you want read your data - xmlSchematronStylesheetMemoryStream.Position = 0; + if (compiledXslt != null) + { + using (MemoryStream xmlSchematronStylesheetMemoryStream = compiledXslt.Stream) + { + xmlSchematronStylesheetMemoryStream.Flush();//Adjust this if you want read your data + xmlSchematronStylesheetMemoryStream.Position = 0; - Processor processor = new Processor(); - XsltCompiler compiler = processor.NewXsltCompiler(); - Serializer serializer = processor.NewSerializer(); + Processor processor = new Processor(); + XsltCompiler compiler = processor.NewXsltCompiler(); + Serializer serializer = processor.NewSerializer(); - try - { - XsltTransformer saxonTransformer = compiler.Compile(xmlSchematronStylesheetMemoryStream).Load(); + try + { + XsltTransformer saxonTransformer = compiler.Compile(xmlSchematronStylesheetMemoryStream).Load(); - // Load the XML document. Input to the build method is the document. - XdmNode docXdmNode = processor.NewDocumentBuilder().Build(xmlDocument); + // Load the XML document. Input to the build method is the document. + XdmNode docXdmNode = processor.NewDocumentBuilder().Build(xmlDocument); - // Set the root node of the source document to be the initial - // context node - saxonTransformer.InitialContextNode = docXdmNode; + // Set the root node of the source document to be the initial + // context node + saxonTransformer.InitialContextNode = docXdmNode; - // Init. the result object - serializer.SetOutputProperty(Serializer.INDENT, "yes"); - serializer.SetOutputProperty(Serializer.ENCODING, Encoding.UTF8.BodyName); + // Init. the result object + serializer.SetOutputProperty(Serializer.INDENT, "yes"); + serializer.SetOutputProperty(Serializer.ENCODING, Encoding.UTF8.BodyName); - serializer.SetOutputStream(schematronResultMemoryStream); + serializer.SetOutputStream(schematronResultMemoryStream); - // Run the transformation with result object as input param. - saxonTransformer.Run(serializer); - } - catch (Exception) - { - // easy debugging - throw; - } - finally - { - // close/dispose - serializer.Close(); + // Run the transformation with result object as input param. + saxonTransformer.Run(serializer); + } + catch (Exception) + { + // easy debugging + throw; + } + finally + { + // close/dispose + serializer.Close(); + } } - } + } else + { + throw new Exception("compiledXslt is null."); + } // convert the schematronResultMemoryStream, into a xmlDocument schematronResultMemoryStream.Position = 0; @@ -424,54 +430,60 @@ namespace dk.gov.oiosi.xml.schematron { using (MemoryStream schematronResultMemoryStream = new MemoryStream()) { - using (MemoryStream xmlSchematronStylesheetMemoryStream = compiledXslt.Stream) + if (compiledXslt != null) { - xmlSchematronStylesheetMemoryStream.Flush();//Adjust this if you want read your data - xmlSchematronStylesheetMemoryStream.Position = 0; + using (MemoryStream xmlSchematronStylesheetMemoryStream = compiledXslt.Stream) + { + xmlSchematronStylesheetMemoryStream.Flush();//Adjust this if you want read your data + xmlSchematronStylesheetMemoryStream.Position = 0; - Processor processor = new Processor(); - XsltCompiler compiler = processor.NewXsltCompiler(); - Uri uri = new Uri("file://" + compiledXslt.FileInfo.Directory.FullName); - - compiler.BaseUri = uri; - Serializer serializer = processor.NewSerializer(); + Processor processor = new Processor(); + XsltCompiler compiler = processor.NewXsltCompiler(); + Uri uri = new Uri("file://" + compiledXslt.FileInfo.Directory.FullName); - try - { - XsltTransformer saxonTransformer = compiler.Compile(xmlSchematronStylesheetMemoryStream).Load(); + compiler.BaseUri = uri; + Serializer serializer = processor.NewSerializer(); - // Load the XML document. Input to the build method is the document. - DocumentBuilder docBuilder = processor.NewDocumentBuilder(); - if (docBuilder.BaseUri == null) + try { - docBuilder.BaseUri = uri; - } + XsltTransformer saxonTransformer = compiler.Compile(xmlSchematronStylesheetMemoryStream).Load(); - XdmNode docXdmNode = docBuilder.Build(documentAsString.ToStream()); + // Load the XML document. Input to the build method is the document. + DocumentBuilder docBuilder = processor.NewDocumentBuilder(); + if (docBuilder.BaseUri == null) + { + docBuilder.BaseUri = uri; + } - // Set the root node of the source document to be the initial - // context node - saxonTransformer.InitialContextNode = docXdmNode; + XdmNode docXdmNode = docBuilder.Build(documentAsString.ToStream()); - // Init. the result object - serializer.SetOutputProperty(Serializer.INDENT, "yes"); - serializer.SetOutputProperty(Serializer.ENCODING, Encoding.UTF8.BodyName); + // Set the root node of the source document to be the initial + // context node + saxonTransformer.InitialContextNode = docXdmNode; - serializer.SetOutputStream(schematronResultMemoryStream); + // Init. the result object + serializer.SetOutputProperty(Serializer.INDENT, "yes"); + serializer.SetOutputProperty(Serializer.ENCODING, Encoding.UTF8.BodyName); - // Run the transformation with result object as input param. - saxonTransformer.Run(serializer); - } - catch (Exception) - { - // easy debugging - throw; - } - finally - { - // close/dispose - serializer.Close(); + serializer.SetOutputStream(schematronResultMemoryStream); + + // Run the transformation with result object as input param. + saxonTransformer.Run(serializer); + } + catch (Exception) + { + // easy debugging + throw; + } + finally + { + // close/dispose + serializer.Close(); + } } + } else + { + throw new Exception("compiledXslt is null."); } // convert the schematronResultMemoryStream, into a xmlDocument diff --git a/tool/AutomaticPasswordFiller/AutomaticPasswordFiller/Program.cs b/tool/AutomaticPasswordFiller/AutomaticPasswordFiller/Program.cs index 16d0899e24c4755255663ce1e0d6909c7ed00b45..9029d80e9a2b3144fa64722aa8d43c44e5ab1cec 100644 --- a/tool/AutomaticPasswordFiller/AutomaticPasswordFiller/Program.cs +++ b/tool/AutomaticPasswordFiller/AutomaticPasswordFiller/Program.cs @@ -17,7 +17,7 @@ namespace dk.gov.oiosi.tool.AutomaticPasswordFiller throw new Exception("Require two parameter. First is the keepRunning file, and the second must be the password!"); } - new Program(args[0], args[1]); + Program program = new Program(args[0], args[1]); } public Program(string file, string password)