Skip to content

Commit

Permalink
BUG: Remove unintended << concatenation of literal words in messages
Browse files Browse the repository at this point in the history
Avoided unintended concatenations, like "PartitionDomainreturned", "hasonly",
"regionRequested", "regionPaste", and "sparsefield", which appeared in exception
and warning messages, when inserting multiple literal strings consecutively into
an output stream. Separated those concatenated words either by a single space
character, or by a period _and_ a space (whichever is appropriate).
  • Loading branch information
N-Dekker authored and dzenanz committed Oct 20, 2022
1 parent 682ad7c commit ab62a8e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkDomainThreader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ DomainThreader<TDomainPartitioner, TAssociate>::DetermineNumberOfWorkUnitsUsed()

if (this->m_NumberOfWorkUnitsUsed > numberOfWorkUnits)
{
itkExceptionMacro("A subclass of ThreadedDomainPartitioner::PartitionDomain"
<< "returned more subdomains than were requested");
itkExceptionMacro(
"A subclass of ThreadedDomainPartitioner::PartitionDomain returned more subdomains than were requested");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ VnlComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::BeforeThreadedGene
if (!VnlFFTCommon::IsDimensionSizeLegal(imageSize[ii]))
{
itkExceptionMacro(<< "Cannot compute FFT of image with size " << imageSize
<< ". VnlComplexToComplexFFTImageFilter operates "
<< "only on images whose size in each dimension has"
<< "only a combination of 2,3, and 5 as prime factors.");
<< ". VnlComplexToComplexFFTImageFilter operates only on images whose size in each dimension "
"has only a combination of 2,3, and 5 as prime factors.");
}
}

Expand Down
5 changes: 2 additions & 3 deletions Modules/Filtering/FFT/include/itkVnlForwardFFTImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ VnlForwardFFTImageFilter<TInputImage, TOutputImage>::GenerateData()
if (!VnlFFTCommon::IsDimensionSizeLegal(inputSize[i]))
{
itkExceptionMacro(<< "Cannot compute FFT of image with size " << inputSize
<< ". VnlForwardFFTImageFilter operates "
<< "only on images whose size in each dimension has"
<< "only a combination of 2,3, and 5 as prime factors.");
<< ". VnlForwardFFTImageFilter operates only on images whose size in each dimension has only a "
"combination of 2,3, and 5 as prime factors.");
}
vectorSize *= inputSize[i];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ VnlHalfHermitianToRealInverseFFTImageFilter<TInputImage, TOutputImage>::Generate
if (!VnlFFTCommon::IsDimensionSizeLegal(outputSize[i]))
{
itkExceptionMacro(<< "Cannot compute FFT of image with size " << outputSize
<< ". VnlHalfHermitianToRealInverseFFTImageFilter operates "
<< "only on images whose size in each dimension has"
<< "only a combination of 2,3, and 5 as prime factors.");
<< ". VnlHalfHermitianToRealInverseFFTImageFilter operates only on images whose size in each "
"dimension has only a combination of 2,3, and 5 as prime factors.");
}
vectorSize *= outputSize[i];
}
Expand Down
5 changes: 2 additions & 3 deletions Modules/Filtering/FFT/include/itkVnlInverseFFTImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ VnlInverseFFTImageFilter<TInputImage, TOutputImage>::GenerateData()
if (!VnlFFTCommon::IsDimensionSizeLegal(outputSize[i]))
{
itkExceptionMacro(<< "Cannot compute FFT of image with size " << outputSize
<< ". VnlInverseFFTImageFilter operates "
<< "only on images whose size in each dimension has"
<< "only a combination of 2,3, and 5 as prime factors.");
<< ". VnlInverseFFTImageFilter operates only on images whose size in each dimension has only a "
"combination of 2,3, and 5 as prime factors.");
}
vectorSize *= outputSize[i];
}
Expand Down
6 changes: 2 additions & 4 deletions Modules/IO/CSV/src/itkCSVFileReaderBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ CSVFileReaderBase::PrepareForParsing()

if (this->m_UseStringDelimiterCharacter && !(this->m_HasRowHeaders || this->m_HasColumnHeaders))
{
itkWarningMacro(<< " Use string delimiter has been set to on"
<< "but row and/or column headers indicators are off!");
itkWarningMacro(<< " Use string delimiter has been set to on but row and/or column headers indicators are off!");
}

if (this->m_UseStringDelimiterCharacter && this->m_FieldDelimiterCharacter == this->m_StringDelimiterCharacter)
{
itkExceptionMacro(<< "The same character has been set for the string"
<< "delimiter and the field delimiter character!");
itkExceptionMacro(<< "The same character has been set for the string delimiter and the field delimiter character!");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/ImageBase/include/itkImageFileReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>::EnlargeOutputRequestedRegion(
// DataObject::PropagateRequestedRegion() has an exception
// specification
std::ostringstream message;
message << "ImageIO returns IO region that does not fully contain the requested region"
<< "Requested region: " << imageRequestedRegion << "StreamableRegion region: " << streamableRegion;
message << "ImageIO returns IO region that does not fully contain the requested region. Requested region: "
<< imageRequestedRegion << "StreamableRegion region: " << streamableRegion;
InvalidRequestedRegionError e(__FILE__, __LINE__);
e.SetLocation(ITK_LOCATION);
e.SetDescription(message.str().c_str());
Expand Down
9 changes: 5 additions & 4 deletions Modules/IO/ImageBase/include/itkImageFileWriter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ ImageFileWriter<TInputImage>::Write()
// largest region or not.
if (!largestIORegion.IsInside(pasteIORegion))
{
itkExceptionMacro(<< "Largest possible region does not fully contain requested paste IO region"
<< "Paste IO region: " << pasteIORegion << "Largest possible region: " << largestRegion);
itkExceptionMacro(<< "Largest possible region does not fully contain requested paste IO region. Paste IO region: "
<< pasteIORegion << "Largest possible region: " << largestRegion);
}

// Determine the actual number of divisions of the input. This is determined
Expand All @@ -270,8 +270,9 @@ ImageFileWriter<TInputImage>::Write()
// largest region or not.
if (!pasteIORegion.IsInside(streamIORegion))
{
itkExceptionMacro(<< "ImageIO returns streamable region that is not fully contain in paste IO region"
<< "Paste IO region: " << pasteIORegion << "Streamable region: " << streamIORegion);
itkExceptionMacro(
<< "ImageIO returns streamable region that is not fully contain in paste IO region. Paste IO region: "
<< pasteIORegion << "Streamable region: " << streamIORegion);
}

InputImageRegionType streamRegion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,7 @@ ParallelSparseFieldLevelSetImageFilter<TInputImage, TOutputImage>::ThreadedAlloc
// Throw an exception if we don't have enough layers.
if (m_Data[ThreadId].m_Layers.size() < 3)
{
itkExceptionMacro(<< "Not enough layers have been allocated for the sparse"
<< "field. Requires at least one layer.");
itkExceptionMacro(<< "Not enough layers have been allocated for the sparse field. Requires at least one layer.");
}

// Layers used as buffers for transferring pixels during load balancing
Expand Down

0 comments on commit ab62a8e

Please sign in to comment.