@Test(expected=IllegalArgumentException.class) public void testBadOtherValue() { TesseractOCRConfig config = new TesseractOCRConfig(); config.addOtherTesseractConfig("bad", "bad bad"); }
public void addOtherTesseractConfig(String key, String value) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Matcher m = ALLOWABLE_OTHER_PARAMS_PATTERN.matcher(key); if (! m.find()) { throw new IllegalArgumentException("Key contains illegal characters: "+key); } m.reset(value); if (! m.find()) { throw new IllegalArgumentException("Value contains illegal characters: "+value); } otherTesseractConfig.put(key.trim(), value.trim()); }
TesseractOCRConfig implements Serializable { public void addOtherTesseractConfig(String key, String value) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Matcher m = ALLOWABLE_OTHER_PARAMS_PATTERN.matcher(key); if (! m.find()) { throw new IllegalArgumentException("Key contains illegal characters: "+key); } m.reset(value); if (! m.find()) { throw new IllegalArgumentException("Value contains illegal characters: "+value); } otherTesseractConfig.put(key.trim(), value.trim()); } }
TesseractOCRConfig implements Serializable { public void addOtherTesseractConfig(String key, String value) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Matcher m = ALLOWABLE_OTHER_PARAMS_PATTERN.matcher(key); if (! m.find()) { throw new IllegalArgumentException("Key contains illegal characters: "+key); } m.reset(value); if (! m.find()) { throw new IllegalArgumentException("Value contains illegal characters: "+value); } otherTesseractConfig.put(key.trim(), value.trim()); } TesseractOCRConfig();  TesseractOCRConfig(InputStream is); }
TesseractOCRConfig implements Serializable { public void addOtherTesseractConfig(String key, String value) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Matcher m = ALLOWABLE_OTHER_PARAMS_PATTERN.matcher(key); if (! m.find()) { throw new IllegalArgumentException("Key contains illegal characters: "+key); } m.reset(value); if (! m.find()) { throw new IllegalArgumentException("Value contains illegal characters: "+value); } otherTesseractConfig.put(key.trim(), value.trim()); } TesseractOCRConfig();  TesseractOCRConfig(InputStream is); String getTesseractPath(); void setTesseractPath(String tesseractPath); String getTessdataPath(); void setTessdataPath(String tessdataPath); String getLanguage(); void setLanguage(String language); String getPageSegMode(); void setPageSegMode(String pageSegMode); String getPageSeparator(); void setPageSeparator(String pageSeparator); void setTrustedPageSeparator(String pageSeparator); void setPreserveInterwordSpacing(boolean preserveInterwordSpacing); boolean getPreserveInterwordSpacing(); long getMinFileSizeToOcr(); void setMinFileSizeToOcr(long minFileSizeToOcr); long getMaxFileSizeToOcr(); void setMaxFileSizeToOcr(long maxFileSizeToOcr); void setTimeout(int timeout); int getTimeout(); void setOutputType(OUTPUT_TYPE outputType); void setOutputType(String outputType); OUTPUT_TYPE getOutputType(); int isEnableImageProcessing(); void setEnableImageProcessing(int enableImageProcessing); int getDensity(); void setDensity(int density); int getDepth(); void setDepth(int depth); String getColorspace(); void setColorspace(String colorspace); String getFilter(); void setFilter(String filter); int getResize(); void setResize(int resize); String getImageMagickPath(); void setImageMagickPath(String imageMagickPath); boolean getApplyRotation(); void setApplyRotation(boolean applyRotation); Map<String, String> getOtherTesseractConfig(); void addOtherTesseractConfig(String key, String value); }
TesseractOCRConfig implements Serializable { public void addOtherTesseractConfig(String key, String value) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Matcher m = ALLOWABLE_OTHER_PARAMS_PATTERN.matcher(key); if (! m.find()) { throw new IllegalArgumentException("Key contains illegal characters: "+key); } m.reset(value); if (! m.find()) { throw new IllegalArgumentException("Value contains illegal characters: "+value); } otherTesseractConfig.put(key.trim(), value.trim()); } TesseractOCRConfig();  TesseractOCRConfig(InputStream is); String getTesseractPath(); void setTesseractPath(String tesseractPath); String getTessdataPath(); void setTessdataPath(String tessdataPath); String getLanguage(); void setLanguage(String language); String getPageSegMode(); void setPageSegMode(String pageSegMode); String getPageSeparator(); void setPageSeparator(String pageSeparator); void setTrustedPageSeparator(String pageSeparator); void setPreserveInterwordSpacing(boolean preserveInterwordSpacing); boolean getPreserveInterwordSpacing(); long getMinFileSizeToOcr(); void setMinFileSizeToOcr(long minFileSizeToOcr); long getMaxFileSizeToOcr(); void setMaxFileSizeToOcr(long maxFileSizeToOcr); void setTimeout(int timeout); int getTimeout(); void setOutputType(OUTPUT_TYPE outputType); void setOutputType(String outputType); OUTPUT_TYPE getOutputType(); int isEnableImageProcessing(); void setEnableImageProcessing(int enableImageProcessing); int getDensity(); void setDensity(int density); int getDepth(); void setDepth(int depth); String getColorspace(); void setColorspace(String colorspace); String getFilter(); void setFilter(String filter); int getResize(); void setResize(int resize); String getImageMagickPath(); void setImageMagickPath(String imageMagickPath); boolean getApplyRotation(); void setApplyRotation(boolean applyRotation); Map<String, String> getOtherTesseractConfig(); void addOtherTesseractConfig(String key, String value);  }