Author: gert
Date: 2008-02-17 14:08:47 -0500 (Sun, 17 Feb 2008)
New Revision: 95995
Added:
trunk/mcs/class/System/Test/System.ComponentModel/CharConverterTest.cs
trunk/mcs/class/System/Test/System.ComponentModel/CultureInfoConverterTest.cs
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/System.ComponentModel/ChangeLog
trunk/mcs/class/System/System.ComponentModel/CharConverter.cs
trunk/mcs/class/System/System.ComponentModel/CultureInfoConverter.cs
trunk/mcs/class/System/System_test.dll.sources
trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog
Log:
* CharConverterTest.cs: Added tests for ConvertFrom and ConvertTo.
* CultureInfoConverterTest.cs: Added tests for ConvertFrom and
ConvertTo.
* CharConverter.cs (ConvertFrom): Avoid NRE when value is null.
Provide more info when left of value > 1.
* CultureInfoConverter.cs (ConvertFrom): Avoid NRE when value is null.
On 2.0 profile, use case-sensitive comparison for (Default) value.
Use case-insensitive comparing when value is considered as displayname.
Provide more info in exception message.
(ConvertTo): Use '(Default)' instead of '(default)' for invariant
culture.
* System_test.dll.sources: Added CharConverterTest.cs and
CultureInfoConverterTest.cs.
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2008-02-17 19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/ChangeLog 2008-02-17 19:08:47 UTC (rev 95995)
@@ -1,3 +1,8 @@
+2008-02-17 Gert Driesen <[EMAIL PROTECTED]>
+
+ * System_test.dll.sources: Added CharConverterTest.cs and
+ CultureInfoConverterTest.cs.
+
2008-02-17 Raja R Harinath <[EMAIL PROTECTED]>
* Makefile (CYCLIC_DEPS): New macro.
Modified: trunk/mcs/class/System/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/ChangeLog 2008-02-17
19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/System.ComponentModel/ChangeLog 2008-02-17
19:08:47 UTC (rev 95995)
@@ -1,3 +1,14 @@
+2008-02-17 Gert Driesen <[EMAIL PROTECTED]>
+
+ * CharConverter.cs (ConvertFrom): Avoid NRE when value is null.
+ Provide more info when left of value > 1.
+ * CultureInfoConverter.cs (ConvertFrom): Avoid NRE when value is null.
+ On 2.0 profile, use case-sensitive comparison for (Default) value.
+ Use case-insensitive comparing when value is considered as displayname.
+ Provide more info in exception message.
+ (ConvertTo): Use '(Default)' instead of '(default)' for invariant
+ culture.
+
2008-02-16 Ivan N. Zlatev <[EMAIL PROTECTED]>
* CharConverter.cs:
Modified: trunk/mcs/class/System/System.ComponentModel/CharConverter.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/CharConverter.cs
2008-02-17 19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/System.ComponentModel/CharConverter.cs
2008-02-17 19:08:47 UTC (rev 95995)
@@ -38,24 +38,25 @@
{
public override bool CanConvertFrom (ITypeDescriptorContext
context, Type sourceType)
{
- if (sourceType == typeof (string))
+ if (sourceType == typeof (string))
return true;
return base.CanConvertFrom (context, sourceType);
}
public override object ConvertFrom (ITypeDescriptorContext
context, CultureInfo culture, object value)
{
- if (value.GetType() == typeof (string)) {
- if (value == null)
+ string char_string = value as string;
+ if (char_string != null) {
+ if (char_string.Length > 1)
+ char_string = char_string.Trim ();
+ if (char_string.Length > 1)
+ throw new FormatException
(string.Format (
+ "String {0} is not a valid
Char: " +
+ "it has to be less than or
equal to " +
+ "one char long.", value));
+ if (char_string.Length == 0)
return '\0';
- string str = (String) value;
- if (str.Length > 1)
- str = str.Trim ();
- if (str.Length > 1)
- throw new FormatException ("String has
to be less than or equal to one char long");
- if (str.Length == 0)
- return '\0';
- return str[0];
+ return char_string [0];
}
return base.ConvertFrom (context, culture, value);
}
Modified: trunk/mcs/class/System/System.ComponentModel/CultureInfoConverter.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/CultureInfoConverter.cs
2008-02-17 19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/System.ComponentModel/CultureInfoConverter.cs
2008-02-17 19:08:47 UTC (rev 95995)
@@ -41,7 +41,6 @@
{
public class CultureInfoConverter : TypeConverter
{
-
private class CultureInfoComparer : IComparer
{
public int Compare (object first, object second)
@@ -60,7 +59,7 @@
}
}
- private StandardValuesCollection _standardValues = null;
+ private StandardValuesCollection _standardValues;
public CultureInfoConverter()
{
@@ -87,21 +86,28 @@
public override object ConvertFrom (ITypeDescriptorContext
context,
CultureInfo culture, object value)
{
- if (value.GetType() == typeof (string)) {
- string CultureString = (String) value;
- if (String.Compare (CultureString, "(default)",
true) == 0) {
+ string culture_string = value as string;
+ if (culture_string != null) {
+#if NET_2_0
+ if (String.Compare (culture_string,
"(Default)", false) == 0)
+#else
+ if (String.Compare (culture_string,
"(Default)", true) == 0)
+#endif
return CultureInfo.InvariantCulture;
- }
+
try {
// try to create a new CultureInfo if
form is RFC 1766
- return new CultureInfo (CultureString);
+ return new CultureInfo (culture_string);
} catch {
// try to create a new CultureInfo if
form is verbose name
foreach (CultureInfo CI in
CultureInfo.GetCultures (CultureTypes.AllCultures))
- if (CI.DisplayName.IndexOf
(CultureString) >= 0)
+ if (string.Compare
(CI.DisplayName, 0, culture_string, 0, culture_string.Length, true) == 0)
return CI;
}
- throw new ArgumentException ("Culture incorrect
or not available in this environment.", "value");
+ throw new ArgumentException (string.Format (
+ "Culture {0} cannot be converted to a "
+
+ "CultureInfo or is not available in " +
+ "this environment.", value));
}
return base.ConvertFrom (context, culture, value);
}
@@ -112,11 +118,11 @@
if (destinationType == typeof (string)) {
if (value != null && (value is CultureInfo)) {
if (value ==
CultureInfo.InvariantCulture)
- return "(default)";
+ return "(Default)";
else
return ((CultureInfo)
value).DisplayName;
} else {
- return "(default)";
+ return "(Default)";
}
}
if (destinationType == typeof (InstanceDescriptor) &&
value is CultureInfo) {
Modified: trunk/mcs/class/System/System_test.dll.sources
===================================================================
--- trunk/mcs/class/System/System_test.dll.sources 2008-02-17 19:05:40 UTC
(rev 95994)
+++ trunk/mcs/class/System/System_test.dll.sources 2008-02-17 19:08:47 UTC
(rev 95995)
@@ -112,10 +112,12 @@
System.ComponentModel/BackgroundWorkerTest.cs
System.ComponentModel/BindingListTest.cs
System.ComponentModel/ByteConverterTests.cs
+System.ComponentModel/CharConverterTest.cs
System.ComponentModel/CollectionConverterTest.cs
System.ComponentModel/ComplexBindingPropertiesAttributeTest.cs
System.ComponentModel/ComponentResourceManagerTest.cs
System.ComponentModel/ContainerTest.cs
+System.ComponentModel/CultureInfoConverterTest.cs
System.ComponentModel/DataObjectMethodAttributeTests.cs
System.ComponentModel/DateTimeConverterTests.cs
System.ComponentModel/DefaultBindingPropertyAttributeTest.cs
Modified: trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog 2008-02-17
19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog 2008-02-17
19:08:47 UTC (rev 95995)
@@ -1,3 +1,9 @@
+2008-02-17 Gert Driesen <[EMAIL PROTECTED]>
+
+ * CharConverterTest.cs: Added tests for ConvertFrom and ConvertTo.
+ * CultureInfoConverterTest.cs: Added tests for ConvertFrom and
+ ConvertTo.
+
2008-02-04 Ivan N. Zlatev <[EMAIL PROTECTED]>
* DateTimeConverterTests.cs: Test ConvertFrom with empty string.
Added: trunk/mcs/class/System/Test/System.ComponentModel/CharConverterTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.ComponentModel/CharConverterTest.cs
2008-02-17 19:05:40 UTC (rev 95994)
+++ trunk/mcs/class/System/Test/System.ComponentModel/CharConverterTest.cs
2008-02-17 19:08:47 UTC (rev 95995)
@@ -0,0 +1,147 @@
+//
+// System.ComponentModel.CharConverter test cases
+//
+// Authors:
+// Gert Driesen ([EMAIL PROTECTED])
+//
+// (c) 2008 Gert Driesen
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Globalization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.ComponentModel
+{
+ [TestFixture]
+ public class CharConverterTest
+ {
+ private CharConverter converter;
+ private string pattern;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ converter = new CharConverter ();
+
+ DateTimeFormatInfo info =
CultureInfo.CurrentCulture.DateTimeFormat;
+ pattern = info.ShortDatePattern + " " +
info.ShortTimePattern;
+ }
+
+ [Test]
+ public void CanConvertFrom ()
+ {
+ Assert.IsTrue (converter.CanConvertFrom (typeof
(string)), "#1");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(char)), "#2");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(object)), "#3");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(int)), "#4");
+ Assert.IsFalse (converter.CanConvertFrom (typeof (char
[])), "#5");
+ Assert.IsTrue (converter.CanConvertFrom (typeof
(InstanceDescriptor)), "#6");
+ }
+
+ [Test]
+ public void CanConvertTo ()
+ {
+ Assert.IsTrue (converter.CanConvertTo (typeof
(string)), "#1");
+ Assert.IsFalse (converter.CanConvertTo (typeof (char)),
"#2");
+ Assert.IsFalse (converter.CanConvertTo (typeof
(object)), "#3");
+ Assert.IsFalse (converter.CanConvertTo (typeof (int)),
"#4");
+ Assert.IsFalse (converter.CanConvertTo (typeof (char
[])), "#5");
+ Assert.IsFalse (converter.CanConvertTo (typeof
(InstanceDescriptor)), "#6");
+ }
+
+ [Test]
+ public void ConvertFrom_String ()
+ {
+ char c;
+
+ c = (char) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ String.Empty);
+ Assert.AreEqual ('\0', c, "#1");
+
+ c = (char) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "e");
+ Assert.AreEqual ('e', c, "#2");
+
+ c = (char) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "\t f\r\n ");
+ Assert.AreEqual ('f', c, "#3");
+ }
+
+ [Test]
+ public void ConvertFrom_String_Invalid ()
+ {
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "ef");
+ Assert.Fail ("#A1");
+ } catch (FormatException ex) {
+ // ef is not a valid value for Char
+ Assert.AreEqual (typeof (FormatException),
ex.GetType (), "#A2");
+ Assert.IsNull (ex.InnerException, "#A3");
+ Assert.IsNotNull (ex.Message, "#A4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(char).Name) != -1, "#A5");
+ Assert.IsTrue (ex.Message.IndexOf ("ef") != -1,
"#A6");
+ }
+
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "\ref\n");
+ Assert.Fail ("#B1");
+ } catch (FormatException ex) {
+ // \ref\n is not a valid value for Char
+ Assert.AreEqual (typeof (FormatException),
ex.GetType (), "#B2");
+ Assert.IsNull (ex.InnerException, "#B3");
+ Assert.IsNotNull (ex.Message, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(char).Name) != -1, "#B5");
+ Assert.IsTrue (ex.Message.IndexOf ("\ref\n") !=
-1, "#B6");
+ }
+ }
+
+ [Test]
+ public void ConvertFrom_Value_Null ()
+ {
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ (string) null);
+ Assert.Fail ("#1");
+ } catch (NotSupportedException ex) {
+ // CharConverter cannot convert from (null)
+ Assert.AreEqual (typeof
(NotSupportedException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CharConverter).Name) != -1, "#5");
+ Assert.IsTrue (ex.Message.IndexOf ("(null)") !=
-1, "#6");
+ }
+ }
+
+ [Test]
+ public void ConvertToString ()
+ {
+ string result;
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ ' ');
+ Assert.AreEqual (" ", result, "#1");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ '\0');
+ Assert.AreEqual (string.Empty, result, "#2");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ 'f');
+ Assert.AreEqual ("f", result, "#3");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ null);
+ Assert.AreEqual (string.Empty, result, "#4");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ new char [] { 'a', 'f' });
+ Assert.AreEqual ("System.Char[]", result, "#5");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/System/Test/System.ComponentModel/CharConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/System/Test/System.ComponentModel/CultureInfoConverterTest.cs
===================================================================
---
trunk/mcs/class/System/Test/System.ComponentModel/CultureInfoConverterTest.cs
2008-02-17 19:05:40 UTC (rev 95994)
+++
trunk/mcs/class/System/Test/System.ComponentModel/CultureInfoConverterTest.cs
2008-02-17 19:08:47 UTC (rev 95995)
@@ -0,0 +1,211 @@
+//
+// System.ComponentModel.CultureInfoConverter test cases
+//
+// Authors:
+// Gert Driesen ([EMAIL PROTECTED])
+//
+// (c) 2008 Gert Driesen
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Globalization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.ComponentModel
+{
+ [TestFixture]
+ public class CultureInfoConverterTest
+ {
+ private CultureInfoConverter converter;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ converter = new CultureInfoConverter ();
+ }
+
+ [Test]
+ public void CanConvertFrom ()
+ {
+ Assert.IsTrue (converter.CanConvertFrom (typeof
(string)), "#1");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(CultureInfo)), "#2");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(object)), "#3");
+ Assert.IsFalse (converter.CanConvertFrom (typeof
(int)), "#4");
+ Assert.IsTrue (converter.CanConvertFrom (typeof
(InstanceDescriptor)), "#5");
+ }
+
+ [Test]
+ public void CanConvertTo ()
+ {
+ Assert.IsTrue (converter.CanConvertTo (typeof
(string)), "#1");
+ Assert.IsFalse (converter.CanConvertTo (typeof
(object)), "#2");
+ Assert.IsFalse (converter.CanConvertTo (typeof
(CultureInfo)), "#3");
+ Assert.IsFalse (converter.CanConvertTo (typeof (int)),
"#4");
+ Assert.IsTrue (converter.CanConvertTo (typeof
(InstanceDescriptor)), "#5");
+ }
+
+ [Test]
+ public void ConvertFrom_String ()
+ {
+ CultureInfo c;
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ String.Empty);
+ Assert.AreEqual (CultureInfo.InvariantCulture, c, "#1");
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "nl-BE");
+ Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#2");
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "Dut");
+ Assert.AreEqual (new CultureInfo ("nl"), c, "#3");
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "Dutch (Bel");
+ Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#4");
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "duTcH (Bel");
+ Assert.AreEqual (new CultureInfo ("nl-BE"), c, "#5");
+
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "(Default)");
+ Assert.AreEqual (CultureInfo.InvariantCulture, c, "#6");
+
+#if ONLY_1_1
+ c = (CultureInfo) converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "(defAuLt)");
+ Assert.AreEqual (CultureInfo.InvariantCulture, c, "#6");
+#endif
+ }
+
+ [Test]
+ public void ConvertFrom_String_IncompleteName ()
+ {
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "nl-B");
+ Assert.Fail ("#1");
+ } catch (ArgumentException ex) {
+ // The nl-B culture cannot be converted to a
+ // CultureInfo object on this computer
+ Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CultureInfo).Name) != -1, "#5");
+ Assert.IsTrue (ex.Message.IndexOf ("nl-B") !=
-1, "#6");
+ Assert.IsNull (ex.ParamName, "#7");
+ }
+ }
+
+ [Test]
+ public void ConvertFrom_String_InvalidCulture ()
+ {
+#if NET_2_0
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "(default)");
+ Assert.Fail ("#A1");
+ } catch (ArgumentException ex) {
+ // The (default) culture cannot be converted to
+ // a CultureInfo object on this computer
+ Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#A2");
+ Assert.IsNull (ex.InnerException, "#A3");
+ Assert.IsNotNull (ex.Message, "#A4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CultureInfo).Name) != -1, "#A5");
+ Assert.IsTrue (ex.Message.IndexOf ("(default)")
!= -1, "#A6");
+ Assert.IsNull (ex.ParamName, "#A7");
+ }
+#endif
+
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ " ");
+ Assert.Fail ("#B1");
+ } catch (ArgumentException ex) {
+ // The culture cannot be converted to
+ // a CultureInfo object on this computer
+ Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#B2");
+ Assert.IsNull (ex.InnerException, "#B3");
+ Assert.IsNotNull (ex.Message, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CultureInfo).Name) != -1, "#B5");
+ Assert.IsTrue (ex.Message.IndexOf (" ") !=
-1, "#B6");
+ Assert.IsNull (ex.ParamName, "#B7");
+ }
+
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ "\r\n");
+ Assert.Fail ("#C1");
+ } catch (ArgumentException ex) {
+ // The \r\n culture cannot be converted to
+ // a CultureInfo object on this computer
+ Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#C2");
+ Assert.IsNull (ex.InnerException, "#C3");
+ Assert.IsNotNull (ex.Message, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CultureInfo).Name) != -1, "#C5");
+ Assert.IsTrue (ex.Message.IndexOf ("\r\n") !=
-1, "#C6");
+ Assert.IsNull (ex.ParamName, "#C7");
+ }
+ }
+
+ [Test]
+ public void ConvertFrom_Value_Null ()
+ {
+ try {
+ converter.ConvertFrom (null,
CultureInfo.InvariantCulture,
+ (string) null);
+ Assert.Fail ("#1");
+ } catch (NotSupportedException ex) {
+ // CultureInfoConverter cannot convert from
(null)
+ Assert.AreEqual (typeof
(NotSupportedException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsTrue (ex.Message.IndexOf (typeof
(CultureInfoConverter).Name) != -1, "#5");
+ Assert.IsTrue (ex.Message.IndexOf ("(null)") !=
-1, "#6");
+ }
+ }
+
+ [Test]
+ public void ConvertToString ()
+ {
+ string result;
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ new MyCultureInfo ());
+ Assert.AreEqual ("display", result, "#1");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ null);
+ Assert.AreEqual ("(Default)", result, "#2");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ CultureInfo.InvariantCulture);
+ Assert.AreEqual ("(Default)", result, "#3");
+
+ result = converter.ConvertToString (null,
CultureInfo.InvariantCulture,
+ new CultureInfo ("nl-BE"));
+ Assert.AreEqual ("Dutch (Belgium)", result, "#4");
+ }
+
+ [Serializable]
+ private sealed class MyCultureInfo : CultureInfo
+ {
+ internal MyCultureInfo () : base ("nl-BE")
+ {
+ }
+
+ public override string DisplayName {
+ get { return "display"; }
+ }
+
+ public override string EnglishName {
+ get { return "english"; }
+ }
+ }
+ }
+}
Property changes on:
trunk/mcs/class/System/Test/System.ComponentModel/CultureInfoConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches