Skip to content

Commit 1199ffe

Browse files
removed duplicate constants
1 parent ffe9d75 commit 1199ffe

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

itext/itext.io/itext/io/util/ImageHandlerUtil.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ public sealed class ImageHandlerUtil {
4848
public const String GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED = "Ghostscript command is not specified. Set the "
4949
+ GHOSTSCRIPT_ENVIRONMENT_VARIABLE + " environment variable to a CLI command that can run the Ghostscript application. See BUILDING.MD in the root of the repository for more details.";
5050

51-
private const String GHOSTSCRIPT_FAILED = "GhostScript failed for <filename>.";
52-
53-
private const String CANNOT_OPEN_OUTPUT_DIRECTORY = "Cannot open output directory for <filename>.";
54-
5551
private const String GHOSTSCRIPT_PARAMS = " -dSAFER -dNOPAUSE -dBATCH -sDEVICE=png16m -r150 <pageNumberParam> -sOutputFile='<outputfile>' '<inputfile>'";
5652

5753
private const String COMPARE_PARAMS = " '<image1>' '<image2>' '<difference>'";
@@ -108,14 +104,14 @@ public void RunGhostScriptImageGeneration(String pdf, String outDir, String imag
108104
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED);
109105
}
110106
if (!FileUtil.DirectoryExists(outDir)) {
111-
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, CANNOT_OPEN_OUTPUT_DIRECTORY.Replace("<filename>"
107+
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, iText.IO.Exceptions.IoExceptionMessageConstant.CANNOT_OPEN_OUTPUT_DIRECTORY.Replace("<filename>"
112108
, pdf));
113109
}
114110
pageNumber = (pageNumber == null) ? "" : "-sPageList=<pagelist>".Replace("<pagelist>", pageNumber);
115111
String currGsParams = GHOSTSCRIPT_PARAMS.Replace("<pageNumberParam>", pageNumber).Replace("<outputfile>",
116112
outDir + image).Replace("<inputfile>", pdf);
117113
if (!SystemUtil.RunProcessAndWait(gsExec, currGsParams)) {
118-
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, GHOSTSCRIPT_FAILED.Replace("<filename>", pdf
114+
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, iText.IO.Exceptions.IoExceptionMessageConstant.GHOSTSCRIPT_FAILED.Replace("<filename>", pdf
119115
));
120116
}
121117
}

itext/itext.kernel/itext/kernel/pdf/PdfReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ public virtual int Get(long offset) {
17801780

17811781
public virtual int Get(long offset, byte[] bytes, int off, int len) {
17821782
if (buffer == null) {
1783-
throw new InvalidOperationException("Already closed");
1783+
throw new InvalidOperationException(iText.IO.Exceptions.IoExceptionMessageConstant.ALREADY_CLOSED);
17841784
}
17851785
if (offset >= buffer.Size()) {
17861786
return -1;

itext/itext.styledxmlparser/itext/styledxmlparser/exceptions/StyledXMLParserException.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public class StyledXMLParserException : ITextException {
4141
/// <summary>Message in case the font provider doesn't know about any fonts.</summary>
4242
public const String FontProviderContainsZeroFonts = "Font Provider contains zero fonts. At least one font shall be present";
4343

44-
/// <summary>The Constant UnsupportedEncodingException.</summary>
45-
public const String UnsupportedEncodingException = "Unsupported encoding exception.";
46-
4744
/// <summary>
4845
/// Creates a new
4946
/// <see cref="StyledXMLParserException"/>

itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/UriEncodeUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static String Encode(String s, String enc)
116116
BinaryWriter charArrayWriter = new BinaryWriter(new MemoryStream());
117117
if (enc == null)
118118
{
119-
throw new StyledXMLParserException(StyledXMLParserException.UnsupportedEncodingException);
119+
throw new StyledXMLParserException(IO.Exceptions.IoExceptionMessageConstant.UNSUPPORTED_ENCODING_EXCEPTION);
120120
}
121121
charset = EncodingUtil.GetEncoding(enc);
122122
int i = 0;

0 commit comments

Comments
 (0)