-
1. Re: Migration to JSF2/Richfaces4: NullPointerException: Resource input stream is null
javatwo Oct 31, 2012 7:24 PM (in response to javatwo)Debugging ...
when trying to access
/javax.faces.resource/calendar.ecss.xhtml?ln=org.richfaces
CompiledCSSResource.java
styleSheet = parser.parseStyleSheet(source, null, null);
return null styleSheet.
I am using the cssparser-0.9.7.jar, com.steadystate.css.parser.CSSOMParser,
which is not from richfaces download. This is the right jar to use?
but the the ecss is in the richfaces jar ( 4.2.3.Final).
META-INF/resources/org.richfaces/calendar.ecss
Thanks for help.
Dave
CompiledCSSResource.java
@Override
public InputStream getInputStream() throws IOException {
FacesContext ctx = FacesContext.getCurrentInstance();
InputStream stream = null;
CSSStyleSheet styleSheet = null;
try {
stream = getResourceInputStream();
if (null == stream) {
return null;
}
InputSource source = new InputSource(new InputStreamReader(stream));
CSSOMParser parser = new CSSOMParser();
ErrorHandlerImpl errorHandler = new ErrorHandlerImpl(this, ctx.isProjectStage(ProjectStage.Production));
parser.setErrorHandler(errorHandler);
// parse and create a stylesheet composition
styleSheet = parser.parseStyleSheet(source, null, null); ------> return null.
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
LOGGER.warn(e.getMessage(), e);
}
}
}
if (styleSheet != null) {
// TODO nick - handle encoding
String encoding = ctx.getExternalContext().getResponseCharacterEncoding();
CSSVisitorImpl cssVisitor = new CSSVisitorImpl(ctx);
cssVisitor.setEncoding(encoding != null ? encoding : "UTF-8");
cssVisitor.visitStyleSheet(styleSheet);
String cssText = cssVisitor.getCSSText();
return new ByteArrayInputStream(cssText.getBytes(cssVisitor.getEncoding()));
} else {
if (!ctx.isProjectStage(ProjectStage.Production)) {
LOGGER.info(MessageFormat.format(NULL_STYLESHEET, getLibraryName(), getResourceName()));
}
return null;
}
}
-
2. Re: Migration to JSF2/Richfaces4: NullPointerException: Resource input stream is null
javatwo Nov 2, 2012 12:42 AM (in response to javatwo)has anyone used JSF2/Richfaces 4 successfully? I trying 4.2.3.Final, but not successful.
The show case: http://showcase.richfaces.org/
is for RF 4 features. I am wondering if I can download the war somewhere, to see if it works
in my JBoss 7 environment.
Thanks for any info.
Dave