Here you can find the source of saveProperties(String propName, Properties props)
Parameter | Description |
---|---|
propName | name of an existing and readable properties file |
Parameter | Description |
---|---|
IllegalArgumentException | if the name is not a readable file |
public static void saveProperties(String propName, Properties props) throws IllegalArgumentException
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.*; public class Main { /**//from w w w . j a v a 2s. c o m * save a properties file * * @param propName name of an existing and readable properties file * @param propsnun-null properties file * @throws IllegalArgumentException if the name is not a readable file */ public static void saveProperties(String propName, Properties props) throws IllegalArgumentException { try { FileOutputStream fs = new FileOutputStream(propName); props.store(fs, null); } catch (RuntimeException ex) // tempdt Why do we need this catch block? It also is doing a poor job and not using a logger. { // ex.printStackTrace(); throw ex; } catch (IOException ex) // tempdt This really isn't an IllegalArgumentException. Dave thinks this should be fixed. Dave can explain if desired. { throw new IllegalArgumentException("Cannot save properties to " + propName); } } }