/** * Performs a specified 'find_and_replace_path' installation action. * * @param action * The given 'find_and_replace_path' installation action. * @throws IOException * if any I/O exception occurred. */ protected static void findAndReplacePath(InstallationDescriptor.ActionInfo action) throws IOException { // get action parameters String filePath = action.params.getProperty(InstallationDescriptorHandler.FILE_TAG); if (filePath == null) throw new RuntimeException("no " + InstallationDescriptorHandler.FILE_TAG + " defined"); String findString = action.params.getProperty(InstallationDescriptorHandler.FIND_STRING_TAG); if (findString == null) throw new RuntimeException("no " + InstallationDescriptorHandler.FIND_STRING_TAG + " defined"); String replaceWith = action.params.getProperty(InstallationDescriptorHandler.REPLACE_WITH_TAG); if (replaceWith == null) throw new RuntimeException("no " + InstallationDescriptorHandler.REPLACE_WITH_TAG + " defined"); // replace all specified path-strings in specified file File inputFile = new File(filePath); FileUtil.replaceStringInFile(inputFile, StringUtil.toRegExpString(findString), replaceWith); }