// Check if jbossws-cxf.xml is present, and if so, updated the provider implementation class attribute
File f=new File(builder.getWebInf(), "jbossws-cxf.xml");
if (f.exists()) {
FileInputStream fis=null;
FileOutputStream fos=null;
try {
fis=new FileInputStream(f);
byte[] b=new byte[fis.available()];
fis.read(b);
String str=new String(b);
fis.close();
fis = null;
if (str.indexOf("@provider@") != -1) {
fos=new FileOutputStream(f);
str = str.replaceAll("@provider@", provider.getClass().getName());
fos.write(str.getBytes());
fos.flush();
fos.close();
fos = null;
} else {
// Report error
System.err.println("jbossws-cxf.xml file does not contain @provider@ field");
}
} catch (IOException e) {
throw new RuntimeException("Failed to copy files", e);
} finally {
try {
if (fis != null) fis.close();
} catch (IOException e) {
}
try {
if (fos != null) fos.close();
} catch (IOException e) {
}
}
}
}