Bug in pageContext.getAttributeNames() ???

Hi,
both serlet 2.2/2.3 PDF specifications state that "servlet containers must provide a private temporary directory per servlet context
and make it available via the javax.servlet.context.tempdir context
attribute."
If, under orion 1.5.2/Oracle9iAS (1.0.2.2.1) Containers for J2EE, one uses the following JSP expression
<%=application.getAttribute("javax.servlet.context.tempdir")%>
then the String representation of the File object stored as that attribute is printed out, e.g.
C:\JavaTools\oracleiAS\j2ee\home\application-deployments\default\defaultWebApp\temp
However, the following JSP page fragment results in empty table columns
<table>
<%
Enumeration enum = pageContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
while(enum.hasMoreElements()){
String attr = enum.nextElement().toString();
Object value = pageContext.getAttribute(attr, PageContext.APPLICATION_SCOPE);
%>
<tr>
<td><%=attr%></td>
<td><%=value != null ? value.toString() : ""%></td>
</tr>
<%
%>
</table>
Further examination reveals that the first call to enum.hasMoreElements() returns false.
Can anyone explain this strange behaviour?
Thanks,
Vadym
null

Does it get sorted if you uninstall the subject application ? If so..the problem lies with the application and not the phone ...
..but before that confirm that you are connected to the Internet .. You may try after rebooting the phone. Also un-install and re-install the application and try again ..

Similar Messages

  • Rendering A JPEG image with a custom tag

    Hi All,
    I have dilema. I'm trying to rendering a jpeg in IE/FireFox with a custom tag that I developed. I'm able to access the bean and invoke the getter method to return the InputStream property. But what gets rendered is the byte code not the image. I've tried just about anything I could think off. If any body has an answer I would difinitely appreciate it.
    Thanks,
    Tony
    Below is the jsp, tld, bean and tag.
    ********************************* image.jsp ****************************************
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ taglib uri="/WEB-INF/custom-chtml.tld" prefix="chtml" %>
    <html>
    <head>
    <title>HTML Page</title>
    </head>
    <body bgcolor="#FFFFFF">
    <chtml:img name="photo" property="file"/>
    </body>
    </html>
    ********************************* custom-chtml.tld **********************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>chtml</shortname>
    <tag>
    <name>img</name>
    <tagclass>com.struts.taglib.CustomImgTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
    <name>name</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>property</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    **************************** MemberPhotoBean.java ******************************
    import java.io.InputStream;
    * @author tony
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class MemberPhotoValue {
         private String memberId;
         private int fileSize;
         private InputStream file;
         public MemberPhotoValue() {
         public MemberPhotoValue(String memberId, InputStream file) {
              this.memberId = memberId;
              this.file = file;
         public MemberPhotoValue(String memberId,int fileSize,InputStream file) {
              this.memberId = memberId;
              this.fileSize = fileSize;
              this.file = file;          
         public String getMemberId(){
              return memberId;
         public void setMemberId(String memberId) {
              this.memberId = memberId;
         public int getFileSize() {
              return fileSize;
         public void setFileSize(int fileSize) {
              this.fileSize = fileSize;
         public InputStream getFile(){
              return file;
         public void setFile(InputStream file) {
              this.file = file;
    *************************** CustomTagHandler.java ********************************
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    import java.awt.image.*;
    import java.awt.*;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.*;
    * JSP Tag Handler class
    * @jsp.tag name = "CustomImg"
    * display-name = "Name for CustomImg"
    * description = "Description for CustomImg"
    * body-content = "empty"
    public class CustomImgTag implements Tag {
         private PageContext pageContext;
         private Tag parent;
         private String property;
         private String name;
         private Class bean;
         public int doStartTag() throws JspException {
              return SKIP_BODY;
         public int doEndTag() throws JspException {
         try {
         ServletResponse response = pageContext.getResponse();
         // read in the image from the bean
         InputStream stream = (InputStream) invokeBeanMethod();
         BufferedImage image = ImageIO.read(stream);          Image inImage = new ImageIcon(image).getImage();
         Graphics2D g = image.createGraphics();
         g.drawImage(inImage,null,null);               
         OutputStream out = response.getOutputStream();
    // JPEG-encode the image
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(image);               
         out.close();     
    } catch (IOException io) {
              throw new JspException(io.getMessage());
         return EVAL_PAGE;
         public void release(){}
    private InputStream invokeBeanMethod() throws JspException {
         try {
         Object bean = null;
         if (null != pageContext.getAttribute(name)) {
         bean = (Object) pageContext.getAttributename);
         else if (null != pageContext.getSession().getAttribute(name)) {
         bean = (Object) pageContext.getSession().getAttribute(name);
         else if (null != pageContext.getRequest().getAttribute(name)) {
         bean = (Object) pageContext.getRequest().getAttribute(name);
         else {
         throw new JspException("Bean : "+name+" is not found in any pe.");
         Class[] parameters = null;
         Object[] obj = null;               
         Method method = bean.getClass().getMethod("getFile",parameters);
         return (InputStream) method.invoke(bean,obj);
         } catch (NoSuchMethodException ne) {
         throw new JspException("No getter method "+property+" for bean : "+bean);
         } catch (IllegalAccessException ie) {
         throw new JspException(ie.getMessage());
         } catch (InvocationTargetException ie) {
         throw new JspException(ie.toString());
         public void setPageContext(PageContext pageContext) {
              this.pageContext = pageContext;
         public void setParent(Tag parent) {
              this.parent = parent;
         public Tag getParent() {
              return parent;
         public void setProperty(String property) {
              this.property = property;
         public void setName(String name) {
              this.name = name;
    **************************************************************************************

    If you have access to an image editing tool such as photoshop, I would advice you import the image into Phototshop and save it in a different format e.g, GIF format and re-import it into Final Cut Express HD. This could solve your rendering problem if all you need is to use a Still image.
    Ayemenre

  • Is this JSF 1.2 bug? or is it just Illegal?

    Hello World,
    Why does the following line cause a StackOverFlowError
    <f:view locale="#{pageContext.request.locale}" >
    is this a bug or it's illegal. The stack trace
    [#|2006-09-24T01:42:19.957+0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.syst
    em.container.web|_ThreadID=12;_ThreadName=httpWorkerThread-8080-0;_RequestID=c8a
    e74d3-fe66-4a7f-821b-fc36fb41669f;|ApplicationDispatcher[iBank-war] Servlet.ser
    vice() for servlet jsp threw exception
    java.lang.StackOverflowError
    at org.apache.catalina.core.ApplicationHttpRequest$AttributeNamesEnumera
    tor.<init>(ApplicationHttpRequest.java:936)
    at org.apache.catalina.core.ApplicationHttpRequest.getAttributeNames(App
    licationHttpRequest.java:253)
    at org.apache.catalina.core.ApplicationHttpRequest$AttributeNamesEnumera
    tor.<init>(ApplicationHttpRequest.java:937)
    at org.apache.catalina.core.ApplicationHttpRequest.getAttributeNames(App
    licationHttpRequest.java:253)
    at javax.servlet.ServletRequestWrapper.getAttributeNames(ServletRequestW
    rapper.java:104)
    at com.sun.faces.context.RequestMap.getEntryIterator(ExternalContextImpl
    .java:1080)
    at com.sun.faces.context.BaseContextMap$EntrySet.iterator(ExternalContex
    tImpl.java:573)
    at java.util.AbstractMap.containsKey(AbstractMap.java:136)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver
    .java:73)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
    solver.java:58)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:832)
    at com.sun.faces.application.ApplicationAssociate.getResourceBundle(Appl
    icationAssociate.java:399)
    at com.sun.faces.application.ApplicationImpl.getResourceBundle(Applicati
    onImpl.java:424)
    at com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResource
    BundleELResolver.java:76)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe

    As I said above:
    "Having replaced the screen yourself, you voided the warranty (if any time was left on it)."
    You had previously said:
    "After 1 year I replaced the screen by myself ..."
    So you might have meant 11 months ... or something close to, but less than a year.
    Or you might have purchaed AppleCare.
    Anyway, the point is regardless of whether the warranty was in force or not, I would have recommended you have Apple do the repair when the screen was replaced.

  • Bug in session manager. If you work for Sun, please take a look.

    While evaluating what it would take to transition from Iplanet 6 to Sun Webserver 6.1, I found a problem with the Sun Webserver's s1ws60 session managers. If the page is not explicitly flushed before ending, the session cookie JSESSIONID is never sent. So as long as the user continues to visit small pages, they keep getting new sessions (because they are never sent a session id, so the session manager creates a new one every time they visit). The session cookie is sent if larger pages are visited (the buffer is automatically flushes). The session cookie is also sent if out.flushBuffer() is explicitly called within the JSP. This problem was not present in IWS6.0.
    The problem has been tracked down to a combination of the code in com.iplanet.server.http.session.IWSSessionManager (found in the "plugins" directory) and the JSP's Java code generated by a component of the webserver (Catalina?). Under Iplanet, the code generated in the finally{} section of the JSP first flushed the buffer, then called releasePageContext. Under Sun Webserver, the code generated just calls releasePageContext without explicitly flushing the buffer before the call. When flushing the buffer for a non-committed response, the headers are first generated and sent, along with any cookies, including the session cookie. The server only sends the session cookie if, among other things, the session satisfies "_session.isNew()". The order of events in releasePageContext ensures that this is never true when used in combination with IWSSessionManager. I don't have the source code to verify this, but from experimentation I think this is the reason: Before the buffer is flushed, the session is saved by IWSSessionManager.update(session), which at line 498 calls "sn.unsetNew()". So the session is never isNew() when it gets around to sending the session cookie. This can be resolved by either adding an explicit buffer flush to the finally{} section of the JSP, or removing the unsetNew() call from IWSSessionManager. Since I don't know where the code that generates the JSP is (or if I can even change it), I ended up removing the sn.unsetNew() call from the update() function.
    Here's the code generated in the finally{} section using IWS6 and Sun Webserver:
    Iplanet 6
            } finally {
                if (out != null && (out instanceof org.apache.jasper.runtime.JspWriterImpl)) {
                    ((org.apache.jasper.runtime.JspWriterImpl) out).flushBuffer();
                if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
            }Sun Webserver
            } finally {
                _jspx_releaseTags(_jspx_curTag, null);
                if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
            }

    I posted a bug report on this.

  • Using a custom tag with a 2.3 servlet descriptor BUG?

    Hi,
    I just developed a Custom Tag and I'd like to use in my jsps.
    If I add the jsp in my JDev project with the custom tag when I try to build the project I got this error:
    Error(11): oracle.xml.parser.v2.XMLParseException: Invalid element 'listener' in content of 'web-app', expected elements '[context-param, servlet, servlet-mapping, session-config, mime-mapping, welcome-file-list, error-page, taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'.
    It seems like when the jsp parser encounters the line with taglib it tries to parse the web.xml against a 2.2 version of the dtd. My web.xml begins with the correct dtd version (2.3). Can anyone tell me if this is a bug and eventually tell me how to solve it?
    thanks,
    Giovanni

    I repost this issue again, now with a simple test case.
    If I wrote a simple custom tag:
    import java.io.IOException;
    import javax.servlet.jsp.tagext.TagSupport;
    public class MyCustomTag extends TagSupport {
    public int doStartTag() {
    try {
    pageContext.getOut().print("FOO");
    } catch (IOException ioe) {
    pageContext.getServletContext().log(ioe.getMessage(),ioe);
    return(SKIP_BODY);
    with the associated tld:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.2</jspversion>
    <shortname>try</shortname>
    <uri>try</uri>
    <info>A short description...</info>
    <tag>
    <name>mytag</name>
    <tagclass>MyCustomTag</tagclass>
    <bodycontent>EMPTY</bodycontent>
    </tag>
    </taglib>
    and a jsp using the custom tag:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    Hello World
    </TITLE>
    </HEAD>
    <BODY>
    <H2>
    The current time is:
    </H2>
    <P>
    <% out.println((new java.util.Date()).toString()); %>
    <%@ taglib uri="try.tld" prefix="try" %>
    <try:mytag />
    </P>
    </BODY>
    </HTML>
    all runs fine if I have a web.xml with the dtd version 2.2
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    but if I use the version 2.3 because I want filters,context listeners and so on:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <filter>
    <filter-name>FilterRedirector</filter-name>
    <filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
    </filter>
    <!-- Filter Redirector URL mapping -->
    <filter-mapping>
    <filter-name>FilterRedirector</filter-name>
    <url-pattern>/FilterRedirector/</url-pattern>
    </filter-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    I get the error I report in my last post. (the jsp doesn't compile) If I remove the custom tag from my jsp all works fine (filters, listeners,etc). In my project settings I use the 2.3 version of servlet.jar instead of the ServletRuntime that comes with JDeveloper.
    Can anyone tell me how to resolve this issue (Using simple custom tag with a web application using the 2.3 servlet specs)?
    Thanks in advance,
    Giovanni
    If I remove the filter secion all

  • Two bugs in SP9 HTMLB radioButton?

    I am trying to trigger a client-side event when a radio button is clicked.  There are examples of this, but involve embedding Java in the JSP in the radioButton tag.  When I do that, there are two problems.  First, the object is null and cannot be accessed.  Second, the text label for the radio button disappears.
    <hbj:radioButtonGroup
      id="rbgSearchSelect"
      columnCount="1"
      selection="<%=SearchBy%>">
      <hbj:radioButton
        id="rbSubscriptionSelect"
        jsObjectNeeded="true"
        text="Search by popular"
        key="101"
        disabled="false" >
    <% // rbSubscriptionSelect is null, and text does not appear %>
      </hbj:radioButton>
    </hbj:radioButtonGroup>
    If I simply remove the <% %> line, the text label appears again.  Moving the code to add the client event to the bottom should also work, but the object is still null, even if you try to get it directly from the pageContext object (where the internal code puts it).  Here's the code I want to add:
    rbSubscriptionSelect.setClientEvent(EventTrigger.ON_CLICK, "myfunc()");
    Does anyone have a working example of setting a client-side event on a radio button on EP6 SP9?

    Have you seen these Blogs??
    Portal: Bug in the  radio button's javascript api
    Useful undocumented javascript code for portal
    Regards,
    P.

  • Help! pageContext is NULL in custom tag constructor!

    I'm having a problem with a custom tag class, and I'm not sure whether it's because I'm doing something wrong, or because I'm running into a bug with Tomcat, JDK1.4b2, or something else. Basically, I'm finding that the pageContext object is null in the constructor of a custom tag class... something that I'm pretty sure is NOT supposed to happen.
    I'm running JDK1.4b2 with Forte CE 3.1 (the bug predates the jumbo fix that brought it up to 3.0) and using Forte's embedded Tomcat.
    I'm not sure whether it matters, but here's the sequence of events:
    A servlet gets launched,
    instantiates an object of type Error_list,
    binds Error_list to the request object, and
    forwards to a JSP that uses the custom tag defined by ListErrorsTag.
    Unfortunately, pageContext is null in ErrorListTag's constructor, so the attempt to get the request object from the pageContext object generates a NullPointerException.
    The SERVLET: *****************************************
    // relevant lines from the servlet instantiating the object, binding it, and forwarding...
         Error_list errors = new Error_list("BAD_THINGS", "crash and burn");
         request.setAttribute("errors",errors);
         ServletContext sc = this.getServletContext();
         RequestDispatcher rd = sc.getRequestDispatcher("admin_category_create.jsp");
         rd.forward(request,response);
    The JSP: ************************************************
    In the JSP "admin_category_create.jsp" itself, I specify the taglib:
         <%@ taglib uri='/WEB-INF/AdminTags.tld' prefix = 'admin' %>
    and reference it:
         <admin:listErrors>The errors will be listed here</admin:listErrors>
    The Explosion of the Taglib: ************************
    // beginning of Taglib class:
    public class ListErrorsTag extends BodyTagSupport {
        private Error_list errors;
        public ListErrorsTag() {
        super()
        try {
             if (pageContext == null)
                 System.out.println("uh oh! pageContext is null");
             ServletRequest request = pageContext.getRequest();
             errors = (Error_list)request.getAttribute("errors");
        catch (NullPointerException e) {
             System.out.println("boom!");
    The Result: **************************************
    Tomcat's error log:
    uh oh! pageContext is null
    boom!
    if I eliminate the try/catch and allow the NullPointerException to take place, I get:
    Error: 500
    Location: /admin_category_create.jsp
    Internal Servlet Error:
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
         at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:338)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
         at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
         at admin.processRequest(admin.java:126)
         at admin.doPost(admin.java:144)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:539)
    Root cause:
    java.lang.NullPointerException
         at AdminTags.ListErrorsTag.(ListErrorsTag.java:32)
         at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:272)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
         at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
         at admin.processRequest(admin.java:126)
         at admin.doPost(admin.java:144)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:539)

    Doing a little more experimentation, I discovered that pageContext is null in the constructor, but not null in the otherDoStartTagOperations() method (called by the doStartTag() method of the tag's class... it's something Forte forces you to do).
    Is this normal? I was under the impression that pageContext is supposed to be defined EVERYWHERE in any class that extends BodyTagSupport... including the class' own constructor.
    On a related topic, is there documentation somewhere as to what, exactly, Forte is doing behind the scenes when it's managing a taglib (how it keeps track of them, where it puts config files, how the entries it makes in them are different or extended from the normal layout, etc.)? At the moment, I suspect that half of the grief I'm having with writing taglibs is caused by Forte itself forcing me to do things in a roundabout way that bears little resemblance to the ways shown in different books on the topic (and in fact all but ensures that nearly every published example will fail and require major rewriting because of the way it forces tag classes to be structured), but I don't see any easy way to let Forte handle compiling the classes and testing them with its embedded Tomcat, but do the config file housekeeping myself I can be in control of it.

  • Question: pagecontext.include("url")

              Hi
              I am using a custom tag that implements BodyTagSupport class. Inside the for
              loop I have call to pagecontext.include("");
              <xyz:for>
              <h3>This is the outer tag.</h3>
              <% pagecontext.include("xyz.jsp"); %>
              </xyz:for>
              Inside xyz.jsp I have
              <h4>This is the inner tag </h4>
              Logically one would assume that "This is the outer tag" is printed first
              followed by "This is the outer tag ". But the output is as follows
              This is the inner tag
              This is the outer tag
              What is with respect to the behavior of the pagecontext.include....
              How can I get the order correct?
              thanks a bunch - Sri
              

    This sounds to me like its a buffering issue. It could well be a bug in
              WebLogic. (Heresy I hear you say ;-)
              Have you tried adding the following line before your include...
              pagecontext.getOut().flush();
              pagecontext.include( "foo.jsp" );
              According to the javadoc of the PageContext.include() method, the getOut()
              JspWriter should be explicitly flushed before the include is processed. Did
              the explicit flush work around your problem?
              Regards
              James
              James Strachan
              =============
              email: [email protected]
              web: http://www.metastuff.com
              "Sri Haridasa" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi
              > I am using a custom tag that implements BodyTagSupport class. Inside the
              for
              > loop I have call to pagecontext.include("");
              >
              > <xyz:for>
              > <h3>This is the outer tag.</h3>
              > <% pagecontext.include("xyz.jsp"); %>
              > </xyz:for>
              >
              > Inside xyz.jsp I have
              >
              > <h4>This is the inner tag </h4>
              >
              > Logically one would assume that "This is the outer tag" is printed first
              > followed by "This is the outer tag ". But the output is as follows
              >
              > This is the inner tag
              > This is the outer tag
              >
              >
              > What is with respect to the behavior of the pagecontext.include....
              >
              > How can I get the order correct?
              >
              > thanks a bunch - Sri
              >
              >
              >
              >
              

  • Netui-data:getData no populating pageContext attribute in portlet

    I am attempting to create several pageContext attributes in a page flow and I'm having issues. When I test the page flow itself it works like a charm. But when I generate a portlet based on the same page flow netui-data does not populate the pageContext attribute.
    My code is pasted below. Any help would be greatly appreciated, pulling my hair out.
    <%@ page language="java" contentType="image/gif"%>
    <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
    <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
    <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
    <netui-data:getData resultId="imageByteArray" value="{pageFlow.img.TnImage}"/>
    <netui-data:getData resultId="mimeType" value="{pageFlow.img.TnMimeType}"/>
    <%
    Enumeration e1 = pageContext.getAttributeNamesInScope(1);
    while (e1.hasMoreElements())
    System.out.println("pageContext attributtes: " + e1.nextElement().toString());
    request.setAttribute("byArr", pageContext.getAttribute("imageByteArray"));
    request.setAttribute("mimeType", pageContext.getAttribute("mimeType"));
    request.setAttribute("tiny", "tim");
    Enumeration e = request.getAttributeNames();
    while (e.hasMoreElements())
    System.out.println("request attributtes: " + e.nextElement().toString());
    %>
    <jsp:forward page="/showImage" />

    Personally, I have had a hard time doing what you are asking for using netui tags. I have had the same case, and asked the person in my team to just return a collection of value objects and then iterate through it without the repeater tag. To use the checkbox, I have had to use a String[].
              Kunal

  • Synchronization bug in Cache Tag

    We have encountered what we believe to be a serious synchronization bug in
              the Cache Tag implementation of WL 5.1.0 SP6, under Windows NT 4, using
              HotSpot Server VM 2.0. (It also happens when we use the classic VM with the
              "-classic" option.) It seems like some kind of problem with a global lock
              on the underlying cache. The problem manifests when two or more browser
              clients attempt to access a JSP with a cache tag, where the cached value has
              not yet been computed. If the system is busy computing the contents of the
              tag when the second request arrives, no result is ever returned to either
              client and no further cache tag values (even on unrelated pages) are
              returned until the server is restarted.
              Here is a very simple tag class that illustrates the problem. It simply
              pauses five seconds and then prints the end time.
              package com.splwg.web.services;
              import java.io.IOException;
              import javax.servlet.jsp.JspException;
              import javax.servlet.jsp.JspWriter;
              import javax.servlet.jsp.PageContext;
              import javax.servlet.jsp.tagext.TagSupport;
              public class TestTag extends TagSupport {
              public int doStartTag() throws JspException {
              // Pause 5 seconds
              long start = System.currentTimeMillis();
              long end = start + 5000;
              while (System.currentTimeMillis() < end) {
              JspWriter out = pageContext.getOut();
              try {
              out.print("Done - " + end);
              } catch (IOException e) {
              return SKIP_BODY;
              Here is a JSP page to drive it:
              <%@ taglib uri="taglib.tld" prefix="wl"%>
              <%@ taglib uri="test.tld" prefix="test"%>
              <html><head><title>Test tag</title></head>
              <body>
              <wl:cache timeout="20s">
              <test:test/>
              </wl:cache>
              </body>
              </html>
              And here is the test.tld file:
              <?xml version="1.0" encoding="ISO-8859-1" ?>
              <!DOCTYPE taglib
              PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
              "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
              <taglib>
              <tlibversion>1.0</tlibversion>
              <jspversion>1.1</jspversion>
              <shortname>test</shortname>
              <tag>
              <name>test</name>
              <tagclass>com.splwg.web.services.TestTag</tagclass>
              </tag>
              </taglib>
              To manifest the problem, start a fresh instance of WebLogic and have two
              browsers (nearly) simultaneously attempt to access the page. The server
              never returns to either browser, and no other page that contains a cache tag
              will return. However, WebLogic is not dead; static pages or JSP files
              without cache tags still work.
              The problem will not manifest once the cache is safely loaded, e.g. by
              having only one client make the initial access (in this case the second
              client cannot attempt to access the JSP for five seconds). Further, we
              observe that once the cache value has gone stale, the first new request
              forces a re-read, but other concurrent requests receive the previously
              cached value. Clearly this technique doesn't work when the cached value has
              not yet been populated, such as when the server has just been started.
              Has anyone else seen this problem?
              Felix Hack
              [email protected]
              

    Before you put in that effort...
    This is experimental so do it with a copy of the project.
    With the copy project closed, delete the eHlpDhtm.js and the
    projectname.pss file.
    Copy the eHlpDhtm.js from the new project you created. Open
    the project the the pss will get rebuilt.
    No scientific reason for doing that, just something that is
    minimal effort and worth a try.
    If it fails, go back to the recreation plan! Do let us know
    if it does work.

  • Is there a bug in implementation of RequestDispatcher with sessions?

    Hi,
    I have two applications, one that contains /stest1/test1.jsp, the other that contains /stest2/test2.jsp. In test1.jsp I set the attribute "stest1-attribute" in the session. Then I get the context of /stest2, include /test2.jsp, and then see if I get the "stest2-attribute", which is set in /test2.jsp. I end up getting "stest2-attribute" but it seems to be I shouldn't since where I set that attribute is in an entirely different web context. Is there a bug here?
    /stest1/test1.jsp
    ========================================================
    <html><body>
    Beginning test in /stest1/test1.jsp. Including JSP page /stest2/test2.jsp
    <p>
    <%
    out.flush(); // must flush before include
    ServletContext ctx = pageContext.getServletContext();
    ServletContext parentCtx = ctx.getContext("/stest2");
    session.setAttribute("stest1-attribute", new String("stest1-only"));
    RequestDispatcher rd = parentCtx.getRequestDispatcher("/test2.jsp");
    rd.include(request, response);
    String s2 = (String) session.getAttribute("stest2-attribute");
    if (s2 != null)
    out.println("<b>*** ERROR - should not see stest2-attribute in web application stest1</b>");
    else
    out.println("Correct - no stest2 attribute visible in stest1");
    %>
    </body></html>
    /stest2/test2.jsp
    ========================================================
    In included page /stest2/test2.jsp.
    <%
    if (session.getAttribute("stest1-attribute") == null)
    out.println("<p>Correct - stest1-attribute should not be visible here");
    else
    out.println("<p><b>*** ERROR - should not see stest1-attribute in web application stest2</b>");
    session.setAttribute("stest2-attribute", new String("stest2-only"));
    %>

    What I discovered was that the main WLAN was mapped to the management interface, and AP Group was overriding the setting.  However, what I found was a lot of access points never got assigned to the AP Group, so they were sitting in the default group and I can only wonder what the service was like with "holes" in the coverage on the main WLAN that is meant for production.
    Moving forward, I think I will replace this Farm with a 5508 and use an interface group on the main wlan and do away with the ap groups.  That way, an AP can boot up and be in the default group and will work..That way technicians don't have to remember what ap group to configure, etc.

  • StandalonePortletURL bug ?

    Hi,
    I have a problem using the StandalonePortletURL. I have two portlets A
    and B. In portlet A i have a JSP which creates a standalone portlet URL
    and stores it in the session attribute. In portlet B i have a JSP that
    retrieves the attribute from the session and displays the url as a link.
    When i click the link in porlet B i get a floatable portlet A in its own
    window which is what i want.
    The problem is that this works fine when run from workshop but does not
    work at all when created and run as a desktop. Bascially the returned
    URL gets mangled.
    The code for JSP A is:-
    StandalonePortletURL url =
    StandalonePortletURL.createStandalonePortletURL(request, response);
    request.getSession().setAttribute("float_url",url.toString());
    The code for JSP B is:-
    <a target="_blank" href="<%=
    (String)request.getSession().getAttribute("float_url") %>">Floatable
    Portlet</a>
    The Standalone URL generated running from workshop is:-
    http://localhost:7601/proxy/mnc/portlets/martins/float2.portlet?_windowLabel=portlet_2_1&_portlet.title=Float+Two&_portlet.skeleton=default&_portlet.skeletonPath=%2Fframework%2Fskeletons&_portlet.skin=default&_portlet.skinPath=%2Fframework%2Fskins%2F&_state=float
    The Standalone URL generated running from a desktop is:-
    http://localhost:7601/proxy/10001?_windowLabel=10001&_portlet.title=Float+Two&_portlet.skeleton=default&_portlet.skeletonPath=%2Fframework%2Fskeletons&_portlet.skin=default&_portlet.skinPath=%2Fframework%2Fskins%2F&_state=float
    As you can see the first part of the URL is missing. This looks like a
    bug however looking at the decompiled code for StandalonePortletURL it
    only adds parameters to the URL so i cant see why or how this gets mangled.
    Anyone else had the same experiences or has got this working on a desktop ?
    TIA
    Martin

    Chris,
    My settings for the web.xml were already like the example you sent. And
    thus i still get the problem.
    However it seems that using the Tag Library rather than the API directly
    yields the result i want and it appears to work. Looking at the
    decompiled code for the tag library it includes a call to get the
    servlet name and add it to the generated URL as follows:-
    mUrl =
    StandalonePortletURL.createStandalonePortletURL((HttpServletRequest)pageContext.getRequest(),
    (HttpServletResponse)pageContext.getResponse());
    mUrl.setPortletServletName((String)pageContext.getServletContext().getAttribute(PortletServlet.KEY_SERVLET_NAME));
    Thus the tag library and direct api yield different results. For now we
    can use the tag library as a workaround as we are generating this in a
    JSP but for a pageflow we will need the direct API version.
    Thanks
    Martin
    Chris Jolley wrote:
    this is fixed in sp3 (not out yet) you can get a patch from customer support CR132576
    make sure the follwoing is followed
    1) Make sure the PortletServlet is registered in your web.xml
    <servlet>
    <servlet-name>PortletServlet</servlet-name>
    <servlet-class>com.bea.netuix.servlets.manager.PortletServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>PortletServlet</servlet-name>
    <url-pattern>/portletmanager/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>PortletServlet</servlet-name>
    <url-pattern>*.portlet</url-pattern>
    </servlet-mapping>
    2) If you want the portlet to popup in a small window and not a full browser,
    you will need to copmment out the "initPortletFloatButtons()" line in all the
    skin.js file in all the skins directories
    function initSkin()
    initDynamicMenus();
    initRolloverMenus();
    initPortletDeleteButtons();
    // See the comments in float.js about this function...
    initPortletFloatButtons();
    3) Use the following code in your JSP to float another portlet
    <%@ taglib uri="render.tld" prefix="render" %>
    <a target="_blank" class="bea-portal-button-float"
    href='<render:standalonePortletUrl/>'>Float This portlet</a>
    <a target="_blank" class="bea-portal-button-float"
    href='<render:standalonePortletUrl windowLabel="portlet_2"/>'>Float The Other
    Portlet</a>
    4) And make sure the change list associated with this CR ia applied as there
    was a bug in the code.
    Martin Porter <[email protected]> wrote:
    Hi,
    I have a problem using the StandalonePortletURL. I have two portlets
    A
    and B. In portlet A i have a JSP which creates a standalone portlet URL
    and stores it in the session attribute. In portlet B i have a JSP that
    retrieves the attribute from the session and displays the url as a link.
    When i click the link in porlet B i get a floatable portlet A in its
    own
    window which is what i want.
    The problem is that this works fine when run from workshop but does not
    work at all when created and run as a desktop. Bascially the returned
    URL gets mangled.
    The code for JSP A is:-
    StandalonePortletURL url =
    StandalonePortletURL.createStandalonePortletURL(request, response);
    request.getSession().setAttribute("float_url",url.toString());
    The code for JSP B is:-
    <a target="_blank" href="<%=
    (String)request.getSession().getAttribute("float_url") %>">Floatable
    Portlet</a>
    The Standalone URL generated running from workshop is:-
    http://localhost:7601/proxy/mnc/portlets/martins/float2.portlet?_windowLabel=portlet_2_1&_portlet.title=Float+Two&_portlet.skeleton=default&_portlet.skeletonPath=%2Fframework%2Fskeletons&_portlet.skin=default&_portlet.skinPath=%2Fframework%2Fskins%2F&_state=float
    The Standalone URL generated running from a desktop is:-
    http://localhost:7601/proxy/10001?_windowLabel=10001&_portlet.title=Float+Two&_portlet.skeleton=default&_portlet.skeletonPath=%2Fframework%2Fskeletons&_portlet.skin=default&_portlet.skinPath=%2Fframework%2Fskins%2F&_state=float
    As you can see the first part of the URL is missing. This looks like
    a
    bug however looking at the decompiled code for StandalonePortletURL it
    only adds parameters to the URL so i cant see why or how this gets mangled.
    Anyone else had the same experiences or has got this working on a desktop
    TIA
    Martin

  • Index with "or" clause (BUG still exists?)

    The change log for 2.3.10 mentions "Fixed a bug that caused incorrect query plans to be generated for predicates that used the "or" operator in conjunction with indexes [#15328]."
    But looks like the Bug still exists.
    I am listing the steps to-repro. Let me know if i have missed something (or if the bug needs to be fixed)
    DATA
    dbxml> openContainer test.dbxml
    dbxml> getDocuments
    2 documents found
    dbxml> print
    <node><value>a</value></node>
    <node><value>b</value></node>
    INDEX (just one string equality index on node "value")
    dbxml> listIndexes
    Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
    Index: node-element-equality-string for node {}:value
    2 indexes found.
    QUERY
    setVerbose 2 2
    preload test.dbxml
    query 'let $temp := fn:compare("test", "test") = 0
    let $results := for $i in collection("test.dbxml")
    where ($temp or $i/node[value = ("a")])
    return $i
    return <out>{$temp}{$results}</out>'
    When $temp is true i expected the result set to contain both the records, but that was not the case with the index. It works well when there is no index!
    Result WITH INDEX
    dbxml> print
    <out>true<node><value>a</value></node></out>
    Result WITHOUT INDEX
    dbxml> print
    <out>true<node><value>a</value></node><node><value>b</value></node></out>

    Hi Vijay,
    This is a completely different bug, relating to predicate expressions that do not examine nodes. Please try the following patch, to see if it fixes this bug for you:
    --- dbxml-2.3.10-original/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-04-18 10:05:24.000000000 +0100
    +++ dbxml-2.3.10/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-08-08 11:32:10.000000000 +0100
    @@ -1566,11 +1572,12 @@
         else if(name == Or::name) {
              UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
    +          result.operation = unionOp;
              for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
                   PathResult ret = generate(*i, ids);
                   unionOp->addArg(ret.operation);
    +               if(ret.operation == 0) result.operation = 0;
    -          result.operation = unionOp;
         // These operators use the presence of the node arguments, not their valueJohn

  • Bug report follow-up

    is there a way to follow-up on a bug report that i submitted?  i have the bug number, but would like to see if the report was understood, filled out properly and determine the status of the bug report.
    thanks,
    doug

    They comment on bugs if actions were taken. Otherwise - don't expect any feedback.

  • Solaris8 and 9 (possibly 7) /dev/poll driver bug report.

    Hello,
    I'd like to report a bug in the solaris 8 and 9 /dev/poll driver (poll(7d)).
    As i do not have a support account with sun or anything like that, there
    seems to be no other way to do that here (which is of course a very sad
    thing).
    Bug details:
    The /dev/poll device provides an ioctl-request (DP_ISPOLLED) for checking
    if a particular filedescriptor is currently in the set of monitored
    filedescriptors for that particular /dev/poll fd set (open /dev/poll fd).
    A quote from the documentation of the poll(7d) manual page taken from
    Solaris9:
    "DP_ISPOLLED ioctl allows you to query if a file descriptor is already in
    the monitored set represented by fd. The fd field of the pollfd structure
    indicates the file descriptor of interest. The DP_ISPOLLED ioctl returns 1
    if the file descriptor is in the set. The events field contains the
    currently polled events. The revents field contains 0. The ioctl returns 0
    if the file descriptor is not in the set. The pollfd structure pointed by
    pfd is not modified. The ioctl returns a -1 if the call fails."
    It says that when you query for an filedescriptor which is currently being
    monitored in the set, that it would return 1, and change the events field of
    the pollfd structure to the events it's currently monitoring that fd for.
    The revents field would be set to zero.
    However the only thing which actually happens here, is that FD_ISPOLLED
    returns 1 when the fd is in the set and 0 if not. When the fd is in the
    set, when FD_ISPOLLED returns 1, the events field remains unmodified, but
    the revents field gets changed.
    A small sample code to illustrate:
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <sys/devpoll.h>
    main() {
    struct pollfd a;
    int dp_fd = open("/dev/poll", O_WRONLY);
    a.fd = 0; /* stdin */
    a.events = POLLIN; /* we monitor for readability, POLLIN=1 */
    a.revents = 0;
    write(dp_fd, &a, sizeof(a));
    a.fd = 0;
    a.events = 34; /* filled in with bogus number to show malfunctioning */
    a.revents = 0;
    printf("DP_ISPOLLED returns: %d\n", ioctl(dp_fd, DP_ISPOLLED, &a));
    printf("a.fd=%d, a.events=%hd, a.revents=%hd\n", a.fd, a.events,
    a.revents);
    According to the documentation of /dev/poll and namely DP_ISPOLLED this
    program is supposed to print the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=1, a.revents=0
    However it prints the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=34, a.revents=1
    You can take any number instead of '34' and it will simply remain untouched
    after the DP_ISPOLLED ioctl-request.
    I hope it's clear now that the solaris8 and solaris9 (and probably solaris7
    with /dev/poll patch too) DP_ISPOLLED implementation is broken.
    This bug is also easily illustrated by looking at the solaris8 kernel sourcecode:
    <snippet osnet_volume/usr/src/uts/common/io/devpoll.c:dpioctl()>
    case DP_ISPOLLED:
    pollfd_t pollfd;
    polldat_t *pdp;
    if (pollfd.fd < 0) {
    mutex_exit(&pcp->pc_lock);
    break;
    pdp = pcache_lookup_fd(pcp, pollfd.fd);
    if ((pdp != NULL) && (pdp->pd_fd == pollfd.fd) &&
    (pdp->pd_fp != NULL)) {
    pollfd.revents = pdp->pd_events;
    if (copyout(&pollfd, (caddr_t)arg,
    sizeof(pollfd_t))) {
    mutex_exit(&pcp->pc_lock);
    DP_REFRELE(dpep);
    return (set_errno(EFAULT));
    *rvalp = 1;
    </snippet>
    its' clearly visible that the code writes the current monitored events to
    the revents field:
    'pollfd.revents = pdp->pd_events;'
    and that it doesnt set revents to zero.
    It's funny to see that this has been like this since Solaris8 (possibly 7). That means nobody ever used DP_ISPOLLED that way or people were simply to lazy to file a bug report.
    Another funny thing related to this. is that Hewlett-Packard did seem to know about this. Since HP-UX11i version 1.6 they also support /dev/poll. From their manual page i ll quote some sentences from their WARNING session:
    "The ioctl(DP_ISPOLLED) system call also returns its result in the revents member of the pollfd structure, in order to be compatible with the implementation of the /dev/poll driver by some other vendors."
    Hopefully this will get fixed.
    I also like to reexpress my very negative feelings towards the fact that you're not able to file bug reports when you do not have a support contract. Ridiculous.
    Thanks,
    bighawk

    Have I mentioned how much i love my playbook now Great job on os 2.0

Maybe you are looking for