diff --git a/cpp/include/Ice/Properties.h b/cpp/include/Ice/Properties.h index 51d7eb2bc38..cfa5141c981 100644 --- a/cpp/include/Ice/Properties.h +++ b/cpp/include/Ice/Properties.h @@ -82,30 +82,29 @@ namespace Ice std::string getPropertyWithDefault(std::string_view key, std::string_view value) noexcept; /** - * Get a property as an integer. If the property is not set, 0 is returned. Throws PropertyException if - * the property value is not a valid integer. + * Get a property as an integer. If the property is not set, 0 is returned. * @param key The property key. * @return The property value interpreted as an integer. + * @throws PropertyException If the property value is not a valid integer. * @see #setProperty */ int getPropertyAsInt(std::string_view key); /** - * Get an Ice property as an integer. If the property is not set, its default value is returned. Throws - * PropertyException if the property value is not a valid integer. + * Get an Ice property as an integer. If the property is not set, its default value is returned. * @param key The property key. * @return The property value interpreted as an integer, or the default value. - * @throws std::invalid_argument If the property is not a known Ice property. + * @throws PropertyException If the property is not a known Ice property or the value is not a valid integer. * @see #setProperty */ int getIcePropertyAsInt(std::string_view key); /** - * Get a property as an integer. If the property is not set, the given default value is returned. Throws - * PropertyException if the property value is not a valid integer. + * Get a property as an integer. If the property is not set, the given default value is returned. * @param key The property key. * @param value The default value to use if the property does not exist. * @return The property value interpreted as an integer, or the default value. + * @throws PropertyException If the property value is not a valid integer. * @see #setProperty */ int getPropertyAsIntWithDefault(std::string_view key, int value); @@ -130,7 +129,7 @@ namespace Ice * can be written as O'Reilly, "O'Reilly" or 'O\'Reilly'. * @param key The property key. * @return The property value interpreted as list of strings, or the default value. - * @throws std::invalid_argument If the property is not a known Ice property. + * @throws PropertyException If the property is not a known Ice property. * @see #setProperty */ StringSeq getIcePropertyAsList(std::string_view key); diff --git a/csharp/src/Ice/Properties.cs b/csharp/src/Ice/Properties.cs index df23f56ac73..194b94eac1a 100644 --- a/csharp/src/Ice/Properties.cs +++ b/csharp/src/Ice/Properties.cs @@ -174,8 +174,8 @@ public string getPropertyWithDefault(string key, string value) /// /// Get an Ice property as an integer. - /// If the property is not set, its default value is returned. Throws PropertyException if the property - /// value is not a valid integer. + /// If the property is not set, its default value is returned. Throws PropertyException if the property is not a + /// known Ice property or the value is not a valid integer. /// /// The property key. /// The property value interpreted as an integer, or the default value. diff --git a/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/Properties.java b/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/Properties.java index 8e45958f2c7..00002ce2c3b 100644 --- a/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/Properties.java +++ b/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/Properties.java @@ -216,7 +216,8 @@ public int getPropertyAsInt(String key) { * * @param key The property key. * @return The property value interpreted as an integer, or the default value. - * @throws PropertyException Raised if the property value is not a valid integer. + * @throws PropertyException Raised if the property is not a known Ice property or the value is + * not a valid integer. * @see #setProperty */ public synchronized int getIcePropertyAsInt(String key) { diff --git a/php/test/Ice/properties/Client.php b/php/test/Ice/properties/Client.php index 68971e4a903..ac0f9cf5a53 100644 --- a/php/test/Ice/properties/Client.php +++ b/php/test/Ice/properties/Client.php @@ -52,8 +52,8 @@ function run($args) echo "ok\n"; echo "testing load properties exception... "; + $properties = Ice\createProperties(); try { - $properties = Ice\createProperties(); $properties->load("./config/xxxx.config"); test(False); } catch (\Ice\LocalException $ex) { @@ -62,8 +62,8 @@ function run($args) echo "ok\n"; echo "testing that getting an unknown ice property throws an exception... "; + $properties = Ice\createProperties(); try { - $properties = Ice\createProperties(); $properties->getIceProperty("Ice.UnknownProperty"); test(False); } catch (\Ice\PropertyException $ex) { @@ -72,8 +72,8 @@ function run($args) echo "ok\n"; echo "testing that trying to read a non-numeric value as an int throws... "; + $properties = Ice\createProperties(); try { - $properties = Ice\createProperties(); $properties->setProperty("Foo", "bar"); $properties->getPropertyAsInt("Foo"); test(False); diff --git a/ruby/test/Ice/properties/Client.rb b/ruby/test/Ice/properties/Client.rb index 67271cbf795..9e0ca28cfa4 100644 --- a/ruby/test/Ice/properties/Client.rb +++ b/ruby/test/Ice/properties/Client.rb @@ -92,8 +92,8 @@ def run(args) puts "ok" print "testing that getting an unknown ice property throws an exception..." + properties = Ice.createProperties(args) begin - properties = Ice.createProperties(args) properties.getIceProperty("Ice.UnknownProperty") test(false) rescue Ice::PropertyException => ex @@ -102,8 +102,8 @@ def run(args) puts "ok" print "testing that trying to read a non-numeric value as an int throws... " + properties = Ice.createProperties(args) begin - properties = Ice.createProperties(args) properties.setProperty("Foo", "bar") properties.getPropertyAsInt("Foo") test(false) diff --git a/swift/src/Ice/Properties.swift b/swift/src/Ice/Properties.swift index 0ddfe1d2c85..de3ccbef4ff 100644 --- a/swift/src/Ice/Properties.swift +++ b/swift/src/Ice/Properties.swift @@ -30,6 +30,7 @@ public protocol Properties: AnyObject { func getPropertyWithDefault(key: String, value: String) -> String /// Get a property as an integer. If the property is not set, 0 is returned. + /// Throws PropertyException if the property value is not a valid integer. /// /// - parameter _: `String` The property key. /// @@ -37,6 +38,7 @@ public protocol Properties: AnyObject { func getPropertyAsInt(_ key: String) throws -> Int32 /// Get an Ice property as an integer. If the property is not set,its default value is returned. + /// Throws PropertyException if the property value is not a valid integer. /// /// - parameter key: `String` The property key. /// @@ -44,6 +46,7 @@ public protocol Properties: AnyObject { func getIcePropertyAsInt(_ key: String) throws -> Int32 /// Get a property as an integer. If the property is not set, the given default value is returned. + /// Throws PropertyException if the property value is not a valid integer. /// /// - parameter key: `String` The property key. ///