diff --git a/csharp/src/Ice/Internal/ReferenceFactory.cs b/csharp/src/Ice/Internal/ReferenceFactory.cs index 4d13e4fc68a..ee9033dae0d 100644 --- a/csharp/src/Ice/Internal/ReferenceFactory.cs +++ b/csharp/src/Ice/Internal/ReferenceFactory.cs @@ -442,8 +442,7 @@ internal Reference create(string s, string propertyPrefix) throw new ParseException($"invalid endpoint '{unknownEndpoints[0]}' in '{s}'"); } else if (unknownEndpoints.Count != 0 && - _instance.initializationData().properties.getPropertyAsIntWithDefault( - "Ice.Warn.Endpoints", 1) > 0) + _instance.initializationData().properties.getIcePropertyAsInt("Ice.Warn.Endpoints") > 0) { StringBuilder msg = new StringBuilder("Proxy contains unknown endpoints:"); int sz = unknownEndpoints.Count; diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js index 1c7fa067f89..1275675e952 100644 --- a/js/src/Ice/ConnectionI.js +++ b/js/src/Ice/ConnectionI.js @@ -97,7 +97,7 @@ export class ConnectionI { this._hasMoreData = { value: false }; - this._warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0; + this._warn = initData.properties.getIcePropertyAsInt("Ice.Warn.Connections") > 0; this._nextRequestId = 1; this._messageSizeMax = instance.messageSizeMax(); this._batchRequestQueue = new BatchRequestQueue(instance); diff --git a/js/src/Ice/DefaultsAndOverrides.js b/js/src/Ice/DefaultsAndOverrides.js index 0cc5137dd19..191f67d1721 100644 --- a/js/src/Ice/DefaultsAndOverrides.js +++ b/js/src/Ice/DefaultsAndOverrides.js @@ -4,7 +4,7 @@ import { FormatType } from "./FormatType.js"; import { EndpointSelectionType } from "./EndpointSelectionType.js"; -import { Protocol, stringToEncodingVersion, encodingVersionToString } from "./Protocol.js"; +import { Protocol, stringToEncodingVersion } from "./Protocol.js"; import { ParseException } from "./LocalExceptions.js"; import { TcpTransceiver } from "./TcpTransceiver.js"; @@ -15,53 +15,46 @@ export class DefaultsAndOverrides { TcpTransceiver !== null ? "tcp" : "ws", ); - let value = properties.getProperty("Ice.Default.Host"); + let value = properties.getIceProperty("Ice.Default.Host"); this.defaultHost = value.length > 0 ? value : null; - value = properties.getProperty("Ice.Default.SourceAddress"); + value = properties.getIceProperty("Ice.Default.SourceAddress"); this.defaultSourceAddress = value.length > 0 ? value : null; this.overrideSecure = false; - value = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random"); + value = properties.getIceProperty("Ice.Default.EndpointSelection"); if (value === "Random") { this.defaultEndpointSelection = EndpointSelectionType.Random; } else if (value === "Ordered") { this.defaultEndpointSelection = EndpointSelectionType.Ordered; } else { - throw new ParseException(`illegal value '${value}'; expected 'Random' or 'Ordered'`); + throw new ParseException( + `illegal value '${value}' in property Ice.Default.EndpointSelection; expected 'Random' or 'Ordered'`, + ); } - this.defaultLocatorCacheTimeout = properties.getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1); + this.defaultLocatorCacheTimeout = properties.getIcePropertyAsInt("Ice.Default.LocatorCacheTimeout"); if (this.defaultLocatorCacheTimeout < -1) { - this.defaultLocatorCacheTimeout = -1; - logger.warning( - "invalid value for Ice.Default.LocatorCacheTimeout `" + - properties.getProperty("Ice.Default.LocatorCacheTimeout") + - "': defaulting to -1", + throw new InitializationException( + `invalid value for Ice.Default.LocatorCacheTimeout '${this.defaultLocatorCacheTimeout}'`, ); } - this.defaultInvocationTimeout = properties.getPropertyAsIntWithDefault("Ice.Default.InvocationTimeout", -1); + this.defaultInvocationTimeout = properties.getIcePropertyAsInt("Ice.Default.InvocationTimeout"); if (this.defaultInvocationTimeout < 1 && this.defaultInvocationTimeout !== -1) { - this.defaultInvocationTimeout = -1; - logger.warning( - "invalid value for Ice.Default.InvocationTimeout `" + - properties.getProperty("Ice.Default.InvocationTimeout") + - "': defaulting to -1", + throw new InitializationException( + `invalid value for Ice.Default.InvocationTimeout '${this.defaultInvocationTimeout}'`, ); } - this.defaultPreferSecure = properties.getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0; + this.defaultPreferSecure = properties.getIcePropertyAsInt("Ice.Default.PreferSecure") > 0; - value = properties.getPropertyWithDefault( - "Ice.Default.EncodingVersion", - encodingVersionToString(Protocol.currentEncoding), - ); + value = properties.getIceProperty("Ice.Default.EncodingVersion"); this.defaultEncoding = stringToEncodingVersion(value); Protocol.checkSupportedEncoding(this.defaultEncoding); - const slicedFormat = properties.getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0; + const slicedFormat = properties.getIcePropertyAsInt("Ice.Default.SlicedFormat") > 0; this.defaultFormat = slicedFormat ? FormatType.SlicedFormat : FormatType.CompactFormat; } } diff --git a/js/src/Ice/InstanceExtensions.js b/js/src/Ice/InstanceExtensions.js index fde515b582c..3bd8f8cb5f2 100644 --- a/js/src/Ice/InstanceExtensions.js +++ b/js/src/Ice/InstanceExtensions.js @@ -197,8 +197,7 @@ Instance.prototype.finishSetup = function (communicator) { this._defaultsAndOverrides = new DefaultsAndOverrides(this._initData.properties, this._initData.logger); - const defMessageSizeMax = 1024; - let num = this._initData.properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defMessageSizeMax); + let num = this._initData.properties.getIcePropertyAsInt("Ice.MessageSizeMax"); if (num < 1 || num > 0x7fffffff / 1024) { this._messageSizeMax = 0x7fffffff; } else { @@ -209,11 +208,11 @@ Instance.prototype.finishSetup = function (communicator) { this._initData.properties.getProperty("Ice.BatchAutoFlushSize").length === 0 && this._initData.properties.getProperty("Ice.BatchAutoFlush").length > 0 ) { - if (this._initData.properties.getPropertyAsInt("Ice.BatchAutoFlush") > 0) { + if (this._initData.properties.getIcePropertyAsInt("Ice.BatchAutoFlush") > 0) { this._batchAutoFlushSize = this._messageSizeMax; } } else { - num = this._initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlushSize", 1024); // 1MB + num = this._initData.properties.getIcePropertyAsInt("Ice.BatchAutoFlushSize"); if (num < 1) { this._batchAutoFlushSize = num; } else if (num > 0x7fffffff / 1024) { @@ -230,16 +229,18 @@ Instance.prototype.finishSetup = function (communicator) { this._classGraphDepthMax = num; } - const toStringModeStr = this._initData.properties.getPropertyWithDefault("Ice.ToStringMode", "Unicode"); + const toStringModeStr = this._initData.properties.getIceProperty("Ice.ToStringMode"); if (toStringModeStr === "ASCII") { this._toStringMode = ToStringMode.ASCII; } else if (toStringModeStr === "Compat") { this._toStringMode = ToStringMode.Compat; } else if (toStringModeStr !== "Unicode") { - throw new InitializationException("The value for Ice.ToStringMode must be Unicode, ASCII or Compat"); + throw new InitializationException( + `illegal value '${toStringModeStr}' in property Ice.ToStringMode; expected 'Unicode', 'ASCII', or 'Compat'`, + ); } - this._implicitContext = ImplicitContext.create(this._initData.properties.getProperty("Ice.ImplicitContext")); + this._implicitContext = ImplicitContext.create(this._initData.properties.getIceProperty("Ice.ImplicitContext")); this._routerManager = new RouterManager(); @@ -274,7 +275,7 @@ Instance.prototype.finishSetup = function (communicator) { this._objectAdapterFactory = new ObjectAdapterFactory(this, communicator); this._retryQueue = new RetryQueue(this); - const retryIntervals = this._initData.properties.getPropertyAsList("Ice.RetryIntervals"); + const retryIntervals = this._initData.properties.getIcePropertyAsList("Ice.RetryIntervals"); if (retryIntervals.length > 0) { this._retryIntervals = []; diff --git a/js/src/Ice/LocatorManager.js b/js/src/Ice/LocatorManager.js index cd12e10b49b..943f5d168cf 100644 --- a/js/src/Ice/LocatorManager.js +++ b/js/src/Ice/LocatorManager.js @@ -10,7 +10,7 @@ import { LocatorTable } from "./LocatorTable.js"; export class LocatorManager { constructor(properties) { - this._background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0; + this._background = properties.getIcePropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0; this._table = new HashMap(HashMap.compareEquals); // Map this._locatorTables = new HashMap(HashMap.compareEquals); // Map } diff --git a/js/src/Ice/TraceLevels.js b/js/src/Ice/TraceLevels.js index 08eeeb2f313..8cbc18bf446 100644 --- a/js/src/Ice/TraceLevels.js +++ b/js/src/Ice/TraceLevels.js @@ -3,21 +3,11 @@ // export function TraceLevels(properties) { - const networkCat = "Network"; - const protocolCat = "Protocol"; - const retryCat = "Retry"; - const locationCat = "Locator"; - const slicingCat = "Slicing"; - - const keyBase = "Ice.Trace."; - - const network = properties.getPropertyAsInt(keyBase + networkCat); - const protocol = properties.getPropertyAsInt(keyBase + protocolCat); - const retry = properties.getPropertyAsInt(keyBase + retryCat); - const location = properties.getPropertyAsInt(keyBase + locationCat); - const slicing = properties.getPropertyAsInt(keyBase + slicingCat); - - properties.getPropertyAsInt(keyBase + "ThreadPool"); // Avoid an "unused property" warning. + const network = properties.getPropertyAsInt("Ice.Trace.Network"); + const protocol = properties.getPropertyAsInt("Ice.Trace.Protocol"); + const retry = properties.getPropertyAsInt("Ice.Trace.Retry"); + const location = properties.getPropertyAsInt("Ice.Trace.Locator"); + const slicing = properties.getPropertyAsInt("Ice.Trace.Slicing"); return class { static get network() { @@ -25,7 +15,7 @@ export function TraceLevels(properties) { } static get networkCat() { - return networkCat; + return "Network"; } static get protocol() { @@ -33,7 +23,7 @@ export function TraceLevels(properties) { } static get protocolCat() { - return protocolCat; + return "Protocol"; } static get retry() { @@ -41,7 +31,7 @@ export function TraceLevels(properties) { } static get retryCat() { - return retryCat; + return "Retry"; } static get location() { @@ -49,7 +39,7 @@ export function TraceLevels(properties) { } static get locationCat() { - return locationCat; + return "Locator"; } static get slicing() { @@ -57,7 +47,7 @@ export function TraceLevels(properties) { } static get slicingCat() { - return slicingCat; + return "Slicing"; } }; }