Skip to content

removed duplicate constants #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions itext/itext.io/itext/io/util/ImageHandlerUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ public sealed class ImageHandlerUtil {
public const String GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED = "Ghostscript command is not specified. Set the "
+ 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.";

private const String GHOSTSCRIPT_FAILED = "GhostScript failed for <filename>.";

private const String CANNOT_OPEN_OUTPUT_DIRECTORY = "Cannot open output directory for <filename>.";

private const String GHOSTSCRIPT_PARAMS = " -dSAFER -dNOPAUSE -dBATCH -sDEVICE=png16m -r150 <pageNumberParam> -sOutputFile='<outputfile>' '<inputfile>'";

private const String COMPARE_PARAMS = " '<image1>' '<image2>' '<difference>'";
Expand Down Expand Up @@ -108,14 +104,14 @@ public void RunGhostScriptImageGeneration(String pdf, String outDir, String imag
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED);
}
if (!FileUtil.DirectoryExists(outDir)) {
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, CANNOT_OPEN_OUTPUT_DIRECTORY.Replace("<filename>"
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, iText.IO.Exceptions.IoExceptionMessageConstant.CANNOT_OPEN_OUTPUT_DIRECTORY.Replace("<filename>"
, pdf));
}
pageNumber = (pageNumber == null) ? "" : "-sPageList=<pagelist>".Replace("<pagelist>", pageNumber);
String currGsParams = GHOSTSCRIPT_PARAMS.Replace("<pageNumberParam>", pageNumber).Replace("<outputfile>",
outDir + image).Replace("<inputfile>", pdf);
if (!SystemUtil.RunProcessAndWait(gsExec, currGsParams)) {
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, GHOSTSCRIPT_FAILED.Replace("<filename>", pdf
throw new ImageHandlerUtil.ImageHandlerExecutionException(this, iText.IO.Exceptions.IoExceptionMessageConstant.GHOSTSCRIPT_FAILED.Replace("<filename>", pdf
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion itext/itext.kernel/itext/kernel/pdf/PdfReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ public virtual int Get(long offset) {

public virtual int Get(long offset, byte[] bytes, int off, int len) {
if (buffer == null) {
throw new InvalidOperationException("Already closed");
throw new InvalidOperationException(iText.IO.Exceptions.IoExceptionMessageConstant.ALREADY_CLOSED);
}
if (offset >= buffer.Size()) {
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public class StyledXMLParserException : ITextException {
/// <summary>Message in case the font provider doesn't know about any fonts.</summary>
public const String FontProviderContainsZeroFonts = "Font Provider contains zero fonts. At least one font shall be present";

/// <summary>The Constant UnsupportedEncodingException.</summary>
public const String UnsupportedEncodingException = "Unsupported encoding exception.";

/// <summary>
/// Creates a new
/// <see cref="StyledXMLParserException"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static String Encode(String s, String enc)
BinaryWriter charArrayWriter = new BinaryWriter(new MemoryStream());
if (enc == null)
{
throw new StyledXMLParserException(StyledXMLParserException.UnsupportedEncodingException);
throw new StyledXMLParserException(IO.Exceptions.IoExceptionMessageConstant.UNSUPPORTED_ENCODING_EXCEPTION);
}
charset = EncodingUtil.GetEncoding(enc);
int i = 0;
Expand Down