@Test public void copyProperties() throws IOException { File tmpDir = Files.createTempDir(); File targetPropertyFile = new File(tmpDir, "propertyFile.properties"); Properties properties = new Properties(); properties.put("firstKey", "firstValue"); properties.put("secondKey", "secondValue"); SearchConfigurationFilesUtils.copyProperties(properties, targetPropertyFile); assertPropertyFile(targetPropertyFile, properties); FileUtils.deleteDirectory(tmpDir); }
public static void copyProperties(Properties properties, File target) { Writer writer = null; try { writer = new FileWriter(target); properties.store(writer, null); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(writer); } }
SearchConfigurationFilesUtils { public static void copyProperties(Properties properties, File target) { Writer writer = null; try { writer = new FileWriter(target); properties.store(writer, null); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(writer); } } }
SearchConfigurationFilesUtils { public static void copyProperties(Properties properties, File target) { Writer writer = null; try { writer = new FileWriter(target); properties.store(writer, null); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(writer); } } private  SearchConfigurationFilesUtils(); }
SearchConfigurationFilesUtils { public static void copyProperties(Properties properties, File target) { Writer writer = null; try { writer = new FileWriter(target); properties.store(writer, null); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(writer); } } private  SearchConfigurationFilesUtils(); static void copyProperties(Properties properties, File target); static void copyResource(Resource source, File target); }
SearchConfigurationFilesUtils { public static void copyProperties(Properties properties, File target) { Writer writer = null; try { writer = new FileWriter(target); properties.store(writer, null); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(writer); } } private  SearchConfigurationFilesUtils(); static void copyProperties(Properties properties, File target); static void copyResource(Resource source, File target);  }