1 13 14 package org.ejbca.util; 15 16 import java.io.BufferedReader ; 17 import java.io.FileReader ; 18 import java.io.FileWriter ; 19 20 21 26 public class TomcatServiceXMLPasswordReplace { 27 30 public TomcatServiceXMLPasswordReplace() { 31 } 32 33 38 public static void main(String [] args) { 39 try { 40 if (args.length != 3) { 42 System.out.println( 43 "Required parameters : <tomcatservice.xml infile> <tomcatservice.xml outfile> <replacementpassword>"); 44 System.exit(0); 45 } 46 47 BufferedReader br = new BufferedReader (new FileReader (args[0])); 48 FileWriter fwr = new FileWriter (args[1]); 49 String line = null; 50 51 while ((line = br.readLine()) != null) { 52 fwr.write(line.replaceAll("foo123", args[2]) + "\n"); 53 } 54 55 br.close(); 56 fwr.close(); 57 } catch (Exception e) { 58 e.printStackTrace(); 59 } 60 } 61 62 } 64 65 66 | Popular Tags |