"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/com/rapidminer/tools/Tools.java" between
rapidminer-studio-9.4.1-src.tar.gz and rapidminer-studio-9.5.0-src.tar.gz

About: RapidMiner Studio is a code-free environment for designing advanced analytic processes with machine learning, data mining, text mining, predictive analytics and business analytics. Java source.

Tools.java  (rapidminer-studio-9.4.1-src):Tools.java  (rapidminer-studio-9.5.0-src)
skipping to change at line 1143 skipping to change at line 1143
* if resource cannot be found * if resource cannot be found
*/ */
public static InputStream getResourceInputStream(String name) throws IOEx ception, RepositoryException { public static InputStream getResourceInputStream(String name) throws IOEx ception, RepositoryException {
URL resourceURL = Tools.getResource(name); URL resourceURL = Tools.getResource(name);
if (resourceURL == null) { if (resourceURL == null) {
throw new RepositoryException("Missing resource " + name) ; throw new RepositoryException("Missing resource " + name) ;
} }
return resourceURL.openStream(); return resourceURL.openStream();
} }
/**
* Tries to load the given text file from the resources. If it fails, ret
urns an empty string and logs it. This is
* necessary for extensions because {@link #getResource(String)} only loo
ks in {@code
* resources/com/rapidminer/resources}.
*
* @param resourcePath the path, e.g. "com/rapidminer/extension/resources
/folder/script.js". The path is treated as
* an absolute path. If the path contains a version n
umber (which is quite common for HTML
* resources), it & anything behind it will be stripp
ed as it is not a valid filename. Example:
* "/com/test/myFile.js?v=4.7.0" will become "/com/te
st/myFile.js".
* @return the stream, never {@code null}. Must be closed by the caller!
* @throws FileNotFoundException if the resource cannot be found
* @throws IOException if accessing the resource fails
* @since 9.5.0
*/
public static InputStream openStreamFromResources(String resourcePath) th
rows IOException {
if (resourcePath.startsWith("/")) {
resourcePath = resourcePath.substring(1);
}
// in HTML files, it's quite common to reference a version. That
is an invalid file name, so drop that.
if (resourcePath.contains("?v=")) {
resourcePath = resourcePath.substring(0, resourcePath.ind
exOf("?v="));
}
URL scriptResource = Plugin.getMajorClassLoader().getResource(res
ourcePath);
if (scriptResource == null) {
LogService.getRoot().log(Level.WARNING, "com.rapidminer.t
ools.Tools.resource_not_found", resourcePath);
throw new FileNotFoundException("Could not find resource
'" + resourcePath + "'");
}
return scriptResource.openStream();
}
public static String readTextFile(InputStream in) throws IOException { public static String readTextFile(InputStream in) throws IOException {
return readTextFile(new InputStreamReader(in, "UTF-8")); return readTextFile(new InputStreamReader(in, "UTF-8"));
} }
/** /**
* Reads a text file into a single string. Process files created with Rap idMiner 5.2.008 or * Reads a text file into a single string. Process files created with Rap idMiner 5.2.008 or
* earlier will be read with the system encoding (for compatibility reaso ns); all other files * earlier will be read with the system encoding (for compatibility reaso ns); all other files
* will be read with UTF-8 encoding. * will be read with UTF-8 encoding.
*/ */
public static String readTextFile(File file) throws IOException { public static String readTextFile(File file) throws IOException {
 End of changes. 1 change blocks. 
0 lines changed or deleted 42 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)