Skip to content

Commit 23aa9af

Browse files
committed
SWEEP: Fixed LuceneDev1001 build warnings
1 parent 77f971a commit 23aa9af

10 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public override void SetParams(string @params)
155155
{
156156
case StreamTokenizer.TokenType_Number:
157157
{
158-
argValue = stok.NumberValue.ToString(CultureInfo.InvariantCulture);
158+
argValue = J2N.Numerics.Double.ToString(stok.NumberValue, CultureInfo.InvariantCulture);
159159
// Drop the ".0" from numbers, for integer arguments
160160
argValue = TRAILING_DOT_ZERO_PATTERN.Replace(argValue, "", 1);
161161
// Intentional fallthrough
@@ -440,7 +440,7 @@ private void CreateAnalysisPipelineComponent(StreamTokenizer stok, Type clazz)
440440
{
441441
case StreamTokenizer.TokenType_Number:
442442
{
443-
argValue = stok.NumberValue.ToString(CultureInfo.InvariantCulture);
443+
argValue = J2N.Numerics.Double.ToString(stok.NumberValue, CultureInfo.InvariantCulture);
444444
// Drop the ".0" from numbers, for integer arguments
445445
argValue = TRAILING_DOT_ZERO_PATTERN.Replace(argValue, "", 1);
446446
// Intentional fall-through

src/Lucene.Net.Benchmark/ByTask/Utils/Algorithm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public Algorithm(PerfRunData runData)
116116
{
117117
case StreamTokenizer.TokenType_Number:
118118
{
119-
@params.Append(stok.NumberValue.ToString(CultureInfo.InvariantCulture));
119+
@params.Append(J2N.Numerics.Double.ToString(stok.NumberValue, CultureInfo.InvariantCulture));
120120
break;
121121
}
122122
case StreamTokenizer.TokenType_Word:

src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public virtual double Get(string name, double dflt)
269269
// done if not by round
270270
if (!props.TryGetValue(name, out string sval))
271271
{
272-
sval = dflt.ToString(CultureInfo.InvariantCulture);
272+
sval = J2N.Numerics.Double.ToString(dflt, CultureInfo.InvariantCulture);
273273
}
274274
if (sval.IndexOf(':') < 0)
275275
{

src/Lucene.Net.QueryParser/Flexible/Core/Nodes/BoostQueryNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private string GetValueString()
8383
if (f == (long)f)
8484
return "" + (long)f;
8585
else
86-
return "" + f.ToString("0.0#######"); // LUCENENET TODO: Culture
86+
return "" + J2N.Numerics.Single.ToString(f, "0.0#######"); // LUCENENET TODO: Culture
8787
}
8888

8989
public override string ToString()

src/Lucene.Net/Index/CheckIndex.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ public virtual Status DoCheckIndex(IList<string> onlySegments)
717717
#pragma warning restore 612, 618
718718
{
719719
// don't print size in bytes if its a 3.0 segment with shared docstores
720-
Msg(infoStream, " size (MB)=" + segInfoStat.SizeMB.ToString(nf));
720+
Msg(infoStream, " size (MB)=" + J2N.Numerics.Double.ToString(segInfoStat.SizeMB, nf));
721721
}
722722
IDictionary<string, string> diagnostics = info.Info.Diagnostics;
723723
segInfoStat.Diagnostics = diagnostics;
@@ -2269,7 +2269,7 @@ public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextW
22692269
}
22702270
}
22712271
float vectorAvg = status.DocCount == 0 ? 0 : status.TotVectors / (float)status.DocCount;
2272-
Msg(infoStream, "OK [" + status.TotVectors + " total vector count; avg " + vectorAvg.ToString(CultureInfo.InvariantCulture.NumberFormat) + " term/freq vector fields per doc]");
2272+
Msg(infoStream, "OK [" + status.TotVectors + " total vector count; avg " + J2N.Numerics.Single.ToString(vectorAvg, NumberFormatInfo.InvariantInfo) + " term/freq vector fields per doc]");
22732273
}
22742274
catch (Exception e) when (e.IsThrowable())
22752275
{

src/Lucene.Net/Index/DocumentsWriterPerThread.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ internal virtual FlushedSegment Flush()
571571
if (infoStream.IsEnabled("DWPT"))
572572
{
573573
double newSegmentSize = segmentInfoPerCommit.GetSizeInBytes() / 1024.0 / 1024.0;
574-
infoStream.Message("DWPT", "flushed: segment=" + segmentInfo.Name + " ramUsed=" + startMBUsed.ToString(nf) + " MB" + " newFlushedSize(includes docstores)=" + newSegmentSize.ToString(nf) + " MB" + " docs/MB=" + (flushState.SegmentInfo.DocCount / newSegmentSize).ToString(nf));
574+
infoStream.Message("DWPT", "flushed: segment=" + segmentInfo.Name + " ramUsed=" + J2N.Numerics.Double.ToString(startMBUsed, nf) + " MB" + " newFlushedSize(includes docstores)=" + J2N.Numerics.Double.ToString(newSegmentSize, nf) + " MB" + " docs/MB=" + J2N.Numerics.Double.ToString((flushState.SegmentInfo.DocCount / newSegmentSize), nf));
575575
}
576576

577577
if (Debugging.AssertsEnabled) Debugging.Assert(segmentInfo != null);

src/Lucene.Net/Index/LogMergePolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ public override MergeSpecification FindMerges(MergeTrigger mergeTrigger, Segment
660660
}
661661
if (IsVerbose)
662662
{
663-
Message(" level " + levelBottom.ToString("0.0") + " to " + maxLevel.ToString("0.0") + ": " + (1 + upto - start) + " segments");
663+
Message(" level " + J2N.Numerics.Single.ToString(levelBottom) + " to " + J2N.Numerics.Single.ToString(maxLevel) + ": " + (1 + upto - start) + " segments");
664664
}
665665

666666
// Finally, record all merges that are viable at this level:

src/Lucene.Net/Index/TieredMergePolicy.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public virtual double MaxMergedSegmentMB
152152
{
153153
if (value < 0.0)
154154
{
155-
throw new ArgumentOutOfRangeException(nameof(MaxMergedSegmentMB), "maxMergedSegmentMB must be >=0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
155+
throw new ArgumentOutOfRangeException(nameof(MaxMergedSegmentMB), "maxMergedSegmentMB must be >=0 (got " + J2N.Numerics.Double.ToString(value) + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
156156
}
157157
value *= 1024 * 1024;
158158
maxMergedSegmentBytes = (value > long.MaxValue) ? long.MaxValue : (long)value;
@@ -175,7 +175,7 @@ public virtual double ReclaimDeletesWeight
175175
{
176176
if (value < 0.0)
177177
{
178-
throw new ArgumentOutOfRangeException(nameof(ReclaimDeletesWeight), "reclaimDeletesWeight must be >= 0.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
178+
throw new ArgumentOutOfRangeException(nameof(ReclaimDeletesWeight), "reclaimDeletesWeight must be >= 0.0 (got " + J2N.Numerics.Double.ToString(value) + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
179179
}
180180
reclaimDeletesWeight = value;
181181
}
@@ -195,7 +195,7 @@ public virtual double FloorSegmentMB
195195
{
196196
if (value <= 0.0)
197197
{
198-
throw new ArgumentOutOfRangeException(nameof(FloorSegmentMB), "floorSegmentMB must be >= 0.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
198+
throw new ArgumentOutOfRangeException(nameof(FloorSegmentMB), "floorSegmentMB must be >= 0.0 (got " + J2N.Numerics.Double.ToString(value) + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
199199
}
200200
value *= 1024 * 1024;
201201
floorSegmentBytes = (value > long.MaxValue) ? long.MaxValue : (long)value;
@@ -214,7 +214,7 @@ public virtual double ForceMergeDeletesPctAllowed
214214
{
215215
if (value < 0.0 || value > 100.0)
216216
{
217-
throw new ArgumentOutOfRangeException(nameof(ForceMergeDeletesPctAllowed), "forceMergeDeletesPctAllowed must be between 0.0 and 100.0 inclusive (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
217+
throw new ArgumentOutOfRangeException(nameof(ForceMergeDeletesPctAllowed), "forceMergeDeletesPctAllowed must be between 0.0 and 100.0 inclusive (got " + J2N.Numerics.Double.ToString(value) + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
218218
}
219219
forceMergeDeletesPctAllowed = value;
220220
}
@@ -237,7 +237,7 @@ public virtual double SegmentsPerTier
237237
{
238238
if (value < 2.0)
239239
{
240-
throw new ArgumentOutOfRangeException(nameof(SegmentsPerTier), "segmentsPerTier must be >= 2.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
240+
throw new ArgumentOutOfRangeException(nameof(SegmentsPerTier), "segmentsPerTier must be >= 2.0 (got " + J2N.Numerics.Double.ToString(value) + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
241241
}
242242
segsPerTier = value;
243243
}

src/Lucene.Net/Search/ControlledRealTimeReopenThread.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ControlledRealTimeReopenThread(TrackingIndexWriter writer, ReferenceManag
8383
{
8484
if (targetMaxStaleSec < targetMinStaleSec)
8585
{
86-
throw new ArgumentException("targetMaxScaleSec (= " + targetMaxStaleSec.ToString("0.0") + ") < targetMinStaleSec (=" + targetMinStaleSec.ToString("0.0") + ")");
86+
throw new ArgumentException("targetMaxScaleSec (= " + J2N.Numerics.Double.ToString(targetMaxStaleSec) + ") < targetMinStaleSec (=" + J2N.Numerics.Double.ToString(targetMinStaleSec) + ")");
8787
}
8888

8989
this.writer = writer;

src/Lucene.Net/Search/FieldCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ public override int GetHashCode()
11271127

11281128
public override string ToString()
11291129
{
1130-
return Value.ToString();
1130+
return J2N.Numerics.Single.ToString(Value);
11311131
}
11321132
}
11331133
}

0 commit comments

Comments
 (0)