try {
componentEle.serializeAndConsume(bos);
} catch (XMLStreamException e) {
e.printStackTrace();
throw new CarbonException(e);
}
byte[] bytes = bos.toByteArray();
try {
// Transform
for (String templatSuffix : mainTemplateSuffixes) {
String xslResourceName = "ui/" + templatSuffix + ".xsl";
URL xslResource = componentBundle.getResource(xslResourceName);
if (xslResource == null) {
throw new CarbonException(
xslResourceName + " is not avaiable in component bundle");
}
ByteArrayOutputStream jspBos = new ByteArrayOutputStream();
transform(new ByteArrayInputStream(bytes), xslResource.openStream(), jspBos);
processedFileMap
.put("web/" + templatSuffix + ".jsp", new String(jspBos.toByteArray()));
}
} catch (TransformerException e) {
e.printStackTrace();
throw new CarbonException(e);
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new CarbonException(e);
} catch (IOException e) {
e.printStackTrace();
throw new CarbonException(e);
}
}