use of com.sun.faces.config.ConfigurationException in project mojarra by eclipse-ee4j.
the class FaceletTaglibConfigProcessor method processConverter.
private void processConverter(ServletContext sc, FacesContext facesContext, NodeList converter, TagLibraryImpl taglibrary, String name) {
if (converter != null && converter.getLength() > 0) {
String converterId = null;
String handlerClass = null;
for (int i = 0, ilen = converter.getLength(); i < ilen; i++) {
Node n = converter.item(i);
if (n.getLocalName() != null) {
switch(n.getLocalName()) {
case CONVERTER_ID:
converterId = getNodeText(n);
break;
case HANDLER_CLASS:
handlerClass = getNodeText(n);
break;
}
}
}
if (handlerClass != null) {
try {
Class<?> clazz = loadClass(sc, facesContext, handlerClass, this, null);
taglibrary.putConverter(name, converterId, clazz);
} catch (NoClassDefFoundError defNotFound) {
String message = defNotFound.toString();
if (message.contains("com/sun/facelets/") || message.contains("com.sun.facelets.")) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING, "faces.config.legacy.facelet.warning", new Object[] { handlerClass });
}
} else {
throw defNotFound;
}
} catch (ClassNotFoundException e) {
throw new ConfigurationException(e);
}
} else {
taglibrary.putConverter(name, converterId);
}
}
}
use of com.sun.faces.config.ConfigurationException in project mojarra by eclipse-ee4j.
the class DocumentOrderingWrapper method sort.
/**
* Sort the provided array of <code>Document</code>s per the requirements of the 2.0 specification. Note, that this
* method only provides partial ordering and not absolute ordering.
* @param documents the documents to sort
*/
public static void sort(DocumentOrderingWrapper[] documents) {
Timer t = Timer.getInstance();
if (t != null) {
t.startTiming();
}
try {
enhanceOrderingData(documents);
} catch (CircularDependencyException re) {
String msg = "Circular dependencies detected!\nDocument Info\n==================\n";
for (DocumentOrderingWrapper w : documents) {
msg += " " + w.toString() + '\n';
}
throw new ConfigurationException(msg);
}
// Sort the documents such that specified ordering will be considered.
//
// It turns out that some of the specified ordering, if it was not discovered by the sort routine
// until later in its processing, was not being considered correctly in the ordering algorithm.
//
// This preSort method puts all of the documents with specified ordering as early on in the
// list of documents as possible for Mojarra to consider it quickly, and be
// able to use its ordering algorithm to the best of its ability.
preSort(documents);
// original inner sort algorithm
int numberOfPasses = innerSort(documents);
// final sort
for (int i = 0; i < documents.length; i++) {
LinkedList<String> ids = getIds(documents);
if (done(documents, ids)) {
break;
}
}
if (t != null) {
t.stopTiming();
t.logResult("\"faces-config\" document sorting complete in " + numberOfPasses + '.');
}
}
use of com.sun.faces.config.ConfigurationException in project mojarra by eclipse-ee4j.
the class ReflectionUtil method decorateInstance.
public static Object decorateInstance(String className, Class rootType, Object root) {
Class clazz;
Object returnObject = null;
if (className != null) {
try {
clazz = loadClass(className, returnObject, null);
if (clazz != null) {
returnObject = decorateInstance(clazz, rootType, root);
}
} catch (ClassNotFoundException cnfe) {
throw new ConfigurationException(buildMessage(MessageFormat.format("Unable to find class ''{0}''", className)));
} catch (NoClassDefFoundError ncdfe) {
throw new ConfigurationException(buildMessage(MessageFormat.format("Class ''{0}'' is missing a runtime dependency: {1}", className, ncdfe.toString())));
} catch (ClassCastException cce) {
throw new ConfigurationException(buildMessage(MessageFormat.format("Class ''{0}'' is not an instance of ''{1}''", className, rootType)));
} catch (Exception e) {
throw new ConfigurationException(buildMessage(MessageFormat.format("Unable to create a new instance of ''{0}'': {1}", className, e.toString())), e);
}
}
return returnObject;
}
use of com.sun.faces.config.ConfigurationException in project mojarra by eclipse-ee4j.
the class FaceletTaglibConfigProcessor method processComponent.
private void processComponent(ServletContext sc, FacesContext facesContext, Element documentElement, NodeList component, TagLibraryImpl taglibrary, String name) {
if (component != null && component.getLength() > 0) {
String componentType = null;
String rendererType = null;
String handlerClass = null;
Node resourceId = null;
for (int i = 0, ilen = component.getLength(); i < ilen; i++) {
Node n = component.item(i);
if (n.getLocalName() != null) {
switch(n.getLocalName()) {
case COMPONENT_TYPE:
componentType = getNodeText(n);
break;
case RENDERER_TYPE:
rendererType = getNodeText(n);
break;
case HANDLER_CLASS:
handlerClass = getNodeText(n);
break;
case RESOURCE_ID:
resourceId = n;
break;
}
}
}
if (handlerClass != null) {
try {
Class<?> clazz = loadClass(sc, facesContext, handlerClass, this, null);
taglibrary.putComponent(name, componentType, rendererType, clazz);
} catch (NoClassDefFoundError defNotFound) {
String message = defNotFound.toString();
if (message.contains("com/sun/facelets/") || message.contains("com.sun.facelets.")) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING, "faces.config.legacy.facelet.warning", new Object[] { handlerClass });
}
} else {
throw defNotFound;
}
} catch (ClassNotFoundException e) {
throw new ConfigurationException(e);
}
} else if (resourceId != null) {
processResourceId(documentElement, resourceId, taglibrary, name);
} else {
taglibrary.putComponent(name, componentType, rendererType);
}
}
}
use of com.sun.faces.config.ConfigurationException in project mojarra by eclipse-ee4j.
the class FaceletTaglibConfigProcessor method processBehavior.
private void processBehavior(ServletContext sc, FacesContext facesContext, NodeList behavior, TagLibraryImpl taglibrary, String tagName) {
if (behavior != null && behavior.getLength() > 0) {
String behaviorId = null;
String handlerClass = null;
for (int i = 0, ilen = behavior.getLength(); i < ilen; i++) {
Node n = behavior.item(i);
if (n.getLocalName() != null) {
switch(n.getLocalName()) {
case BEHAVIOR_ID:
behaviorId = getNodeText(n);
break;
case HANDLER_CLASS:
handlerClass = getNodeText(n);
break;
}
}
}
if (handlerClass != null) {
try {
Class<?> clazz = loadClass(sc, facesContext, handlerClass, this, null);
taglibrary.putBehavior(tagName, behaviorId, clazz);
} catch (ClassNotFoundException e) {
throw new ConfigurationException(e);
}
} else {
taglibrary.putBehavior(tagName, behaviorId);
}
}
}
Aggregations