Avoid null in java.util.List...?

Dear friends,
Is there any way to avoid null values in java.util.List<E>.....?
Means any special class(in java.util) is available for avoiding null values....?
Thank you
boss134

boss134 wrote:
Dear masijade.,
i got the class.... using java.util.concurrency.ConcurrentSkipListSet to we can avoid null
Thank you
boss134I didn't say to open the API docs index, then search for the word List. I said look at the API docs for the interface List. It sill list the Classes that implement it. Look at those Classes, and see if any of the add methods will "prevent null" (as you seem fond of saying). But this is getting to be a little old, so I'll just tell you, no, there isn't. If you absolutely must have one, then, as Darryll suggested extend one of the current list Classes and override add, addAll, and (to be certain) the varying get methods (so that they don't return any null items, if, somehow or another, a null managed to finagle it's way into the List).
Edit: Or, as suggested in the other thread, which is better, implement the interface directly, delegating calls to a "wrapped" List.

Similar Messages

  • What is the proper and best way to destroy a java.util.List or Array for GC

    Hi,
    If I have a java.util.List of objects lets say:
    List<File> files = new ArrayList();The List contains 1000 file objects. When my class finishes, is it enough to do
    files = null;to make GC able to release it from memory?
    Cause it seems like I can't do the following:
    for(int i = 0; i < extracted_files.size(); i++){
                extracted_files.get(i) = null;
    }Or should I use this one:
    files.clear()What is the proper and best way to do this in order to avoid memory leaks? How about normal Arrays like File[]?
    Edited by: TolvanTolvanTolvan on 2009-sep-10 16:58

    TolvanTolvanTolvan wrote:
    Thanks for the info!
    But what if the List is a class variable running in a Web Service for like months without terminating?You mean if the List variable is a member variable of a long-lived object? Then presumably the list needs to live as long as the object does. In the unlikely scenario that the object needs to live on but its list member variable does not, then yes, setting the member to null will be needed to make the list eligible for GC. But I highly doubt this is your situation, and if it is, you probably have a design flaw.
    And if the list is referenced only by a local variable, then, as I already said, when the method ends, the variable goes out of scope, and the List is eligible for GC.
    Now, a slightly different situation is when the List needs to live a long time, and at some point during its life, you're done using some object that it refers to. In that situation, simply remove the element from the list (or set the element to null if it's an array rather than a list), and then if it's not referenced anywhere else, it can be GCed.
    How about Arrays like File[]? Do I need to iterate through the array and null all the objects or is it enough to just null the Array?YOU. DON'T. NEED. TO. HELP. GC. You don't need to set the elements to null, and you most likely don't even need to set the array variable to null.
    Also note that only references can be null, not objects.

  • How to display the contents of java.util.list in a frame???

    i should use awt only not applet...
    i need to display the contents of java.util.list in a frame...
    the contents contains rows queried from a oracle database.....
    the contents should be displayed similar to how a lable is displayed..
    please help me out..
    thanks
    dinesh

    Of course there is something in AWT:
    http://java.sun.com/j2se/1.5.0/docs/api/java/awt/List.
    htmlagain, if you carefully read the question, he needs a
    table to display a JDBC result set. There is no
    pre-made table component in AWT.Well, I read that he filled the data into a java.util.List and now wants to display this list. So a List-component should be sufficient. But I might be wrong...
    -Puce

  • Can we define a complex type that is equivalent to java.util.List?

    hi everyone
    is it possible to define a complexType that is equivalent to java.util.List? all i know now is how to define an array of some type using either <xs:list> for simpleType or the minOccurs and maxOccurs of the element tag. i was wondering if there is way to define something equivalent to a List in java. thanks

    Define a sequence of list tems.
    <xs:element name="list">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="item"  maxOccurs="unbounded"  type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

  • Non-built-in type contained in a java.util.List creates a SoapFaultException

    I have created a web service that utilizes non-built-in types which uses other
    non-built-in types...(simplified example follows)
    public class MyService {
    public
    Foo getFoo( String id ) {
    Foo foo = ...; // get persisted foo
    return foo;
    package mypackage;
    public class Foo {
    java.util.List barList;
    public java.util.List getBars() { return barList; }
    public void setBars( java.util.List barList ) { this.barList = barList; }
    public class Bar {
    // some attributes
    I autotyped Bar explicitly and had servicegen/service autotype non-built-in data
    types for MyService (aka..Foo)
    When I execute the test web page...I get the following soap fault exception (Note:
    only if the barList contains some Bar objects)
    <env:Fault>
    <faultcode>env:Server</faultcode>
    <faultstring>Exception during processing: Error at line:1 col:9159 '1' expected
    [?! -- [CDATA[ ] (see Fault Detail for stacktrace)</faultstring>
    <detail>
    <bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">Error
    at line:1 col:9159 '1' expected [?! -- [CDATA[ ]
         at weblogic.xml.babel.scanner.Scanner.startState(Scanner.java:280)
         at weblogic.xml.babel.scanner.Scanner.scan(Scanner.java:176)
         at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:510)
         at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:487)
         at weblogic.xml.babel.baseparser.EndElement.parse(EndElement.java:34)
         at weblogic.xml.babel.baseparser.BaseParser.parseElement(BaseParser.java:444)
         at weblogic.xml.babel.baseparser.BaseParser.parseSome(BaseParser.java:317)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:116)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
         at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
         at weblogic.xml.xmlnode.NodeBuilder.build(NodeBuilder.java:73)
         at weblogic.xml.xmlnode.NodeBuilder.<init>(NodeBuilder.java:46)
         at weblogic.webservice.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:147)
         at weblogic.webservice.core.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:174)
         at weblogic.webservice.core.handler.CheckSoapFaultHandler.handleResponse(CheckSoapFaultHandler.java:21)
         at weblogic.webservice.core.HandlerChainImpl.handleResponse(HandlerChainImpl.java:231)
         at weblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:243)
         at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144)
         at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
         at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:423)
         at weblogic.webservice.server.servlet.ServletBase.invokeMultiOutput(ServletBase.java:349)
         at weblogic.webservice.server.servlet.WebServiceServlet.invokeMultiOutput(WebServiceServlet.java:354)
         at weblogic.webservice.server.servlet.ServletBase.invokeOperation(ServletBase.java:300)
         at weblogic.webservice.server.servlet.WebServiceServlet.invokeOperation(WebServiceServlet.java:344)
         at weblogic.webservice.server.servlet.ServletBase.handleGet(ServletBase.java:266)
         at weblogic.webservice.server.servlet.ServletBase.doGet(ServletBase.java:158)
         at weblogic.webservice.server.servlet.WebServiceServlet.doGet(WebServiceServlet.java:255)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
         at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:313)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    </bea_fault:stacktrace>
    </detail>
    </env:Fault>
    When barList is empty...the webservice executes without any problems.
    I noticed in the generated types.xml...there is a "List" entry and a "java.util.List"
    entry. The bars has "List" associated with it...
    <?xml version="1.0" encoding="UTF-8"?>
    <XMLSchemaAndTypeMapping>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:mypackage"
    attributeFormDefault="qualified"
    elementFormDefault="qualified"
    targetNamespace="java:mypackage">
    <xsd:complexType name="Foo">
    <xsd:complexContent>
    <xsd:element xmlns:tp="java:language_builtins.util"
    name="bars"
    type="tp:List"
    nillable="true"
    minOccurs="1"
    maxOccurs="1">
    </xsd:element>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:language_builtins.util"
    attributeFormDefault="qualified"
    elementFormDefault="qualified"
    targetNamespace="java:language_builtins.util">
    <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/">
    </xsd:import>
    <xsd:complexType name="List">
    <xsd:complexContent>
    <xsd:restriction xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    base="soapenc:Array">
    <xsd:attribute xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    ref="soapenc:arrayType"
    wsdl:arrayType="xsd:anyType[]">
    </xsd:attribute>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    <wsdd:type-mapping xmlns:wsdd="http://www.bea.com/servers/wls70"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <wsdd:type-mapping-entry xmlns:lcl0="java:mypackage"
    class-name="mypackage.Bar"
    type="lcl0:Bar"
    serializer="mypackage.BarCodec"
    deserializer="mypackage.BarCodec">
    </wsdd:type-mapping-entry>
    <wsdd:type-mapping-entry xmlns:lcl0="java:language_builtins.util"
    class-name="java.util.List"
    type="lcl0:List"
    serializer="weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec"
    deserializer="weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec"
    >
    </wsdd:type-mapping-entry>
    <wsdd:type-mapping-entry xmlns:lcl0="java:mypackage"
    class-name="mypackage.Foo"
    type="lcl0:Foo"
    serializer="mypackage.FooCodec"
    deserializer="mypackage.FooCodec">
    </wsdd:type-mapping-entry>
    </wsdd:type-mapping>
    </XMLSchemaAndTypeMapping>
    Any ideas what is causing the problem?
    Using WLS 8.1 sp2 on WinXP, JDK 1.4
    Thanks in advance.
    - Doug

    Certain generic types like java.lang.Object, List etc
    may not work properly with the test page, because it
    is not possible to figure out how the XML data should
    look like.
    Can you please try it out using a clientgen generated
    stub?
    Regards,
    -manoj
    http://manojc.com
    "Doug Leeper" <[email protected]> wrote in message
    news:40e32790$1@mktnews1...
    >
    I have created a web service that utilizes non-built-in types which usesother
    non-built-in types...(simplified example follows)
    public class MyService {
    public
    Foo getFoo( String id ) {
    Foo foo = ...; // get persisted foo
    return foo;
    package mypackage;
    public class Foo {
    java.util.List barList;
    public java.util.List getBars() { return barList; }
    public void setBars( java.util.List barList ) { this.barList =barList; }
    public class Bar {
    // some attributes
    I autotyped Bar explicitly and had servicegen/service autotypenon-built-in data
    types for MyService (aka..Foo)
    When I execute the test web page...I get the following soap faultexception (Note:
    only if the barList contains some Bar objects)
    <env:Fault>
    <faultcode>env:Server</faultcode>
    <faultstring>Exception during processing: Error at line:1 col:9159 '1'expected
    [?! -- [CDATA[ ] (see Fault Detail for stacktrace)</faultstring>
    <detail>
    <bea_fault:stacktracexmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">Er
    ror
    at line:1 col:9159 '1' expected [?! -- [CDATA[ ]
    at weblogic.xml.babel.scanner.Scanner.startState(Scanner.java:280)
    at weblogic.xml.babel.scanner.Scanner.scan(Scanner.java:176)
    at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:510)
    at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:487)
    at weblogic.xml.babel.baseparser.EndElement.parse(EndElement.java:34)
    atweblogic.xml.babel.baseparser.BaseParser.parseElement(BaseParser.java:444)
    at weblogic.xml.babel.baseparser.BaseParser.parseSome(BaseParser.java:317)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:116)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
    at weblogic.xml.xmlnode.NodeBuilder.populateChildren(NodeBuilder.java:128)
    at weblogic.xml.xmlnode.NodeBuilder.build(NodeBuilder.java:73)
    at weblogic.xml.xmlnode.NodeBuilder.<init>(NodeBuilder.java:46)
    atweblogic.webservice.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:
    147)
    atweblogic.webservice.core.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:174
    atweblogic.webservice.core.handler.CheckSoapFaultHandler.handleResponse(CheckS
    oapFaultHandler.java:21)
    atweblogic.webservice.core.HandlerChainImpl.handleResponse(HandlerChainImpl.ja
    va:231)
    atweblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:243)
    atweblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
    atweblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:423)
    atweblogic.webservice.server.servlet.ServletBase.invokeMultiOutput(ServletBase
    .java:349)
    atweblogic.webservice.server.servlet.WebServiceServlet.invokeMultiOutput(WebSe
    rviceServlet.java:354)
    atweblogic.webservice.server.servlet.ServletBase.invokeOperation(ServletBase.j
    ava:300)
    atweblogic.webservice.server.servlet.WebServiceServlet.invokeOperation(WebServ
    iceServlet.java:344)
    atweblogic.webservice.server.servlet.ServletBase.handleGet(ServletBase.java:26
    6)
    atweblogic.webservice.server.servlet.ServletBase.doGet(ServletBase.java:158)
    atweblogic.webservice.server.servlet.WebServiceServlet.doGet(WebServiceServlet
    .java:255)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    atweblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:971)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :402)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
    atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    atcom.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:
    313)
    atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    atweblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:6356)
    atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
    atweblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3635)
    atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2585)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    </bea_fault:stacktrace>
    </detail>
    </env:Fault>
    When barList is empty...the webservice executes without any problems.
    I noticed in the generated types.xml...there is a "List" entry and a"java.util.List"
    entry. The bars has "List" associated with it...
    <?xml version="1.0" encoding="UTF-8"?>
    <XMLSchemaAndTypeMapping>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:mypackage"
    attributeFormDefault="qualified"
    elementFormDefault="qualified"
    targetNamespace="java:mypackage">
    <xsd:complexType name="Foo">
    <xsd:complexContent>
    <xsd:element xmlns:tp="java:language_builtins.util"
    name="bars"
    type="tp:List"
    nillable="true"
    minOccurs="1"
    maxOccurs="1">
    </xsd:element>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:language_builtins.util"
    attributeFormDefault="qualified"
    elementFormDefault="qualified"
    targetNamespace="java:language_builtins.util">
    <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/">
    </xsd:import>
    <xsd:complexType name="List">
    <xsd:complexContent>
    <xsd:restrictionxmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    base="soapenc:Array">
    <xsd:attribute xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    ref="soapenc:arrayType"
    wsdl:arrayType="xsd:anyType[]">
    </xsd:attribute>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    <wsdd:type-mapping xmlns:wsdd="http://www.bea.com/servers/wls70"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <wsdd:type-mapping-entry xmlns:lcl0="java:mypackage"
    class-name="mypackage.Bar"
    type="lcl0:Bar"
    serializer="mypackage.BarCodec"
    deserializer="mypackage.BarCodec">
    </wsdd:type-mapping-entry>
    <wsdd:type-mapping-entry xmlns:lcl0="java:language_builtins.util"
    class-name="java.util.List"
    type="lcl0:List"
    serializer="weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec"
    >
    deserializer="weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec
    >>
    </wsdd:type-mapping-entry>
    <wsdd:type-mapping-entry xmlns:lcl0="java:mypackage"
    class-name="mypackage.Foo"
    type="lcl0:Foo"
    serializer="mypackage.FooCodec"
    deserializer="mypackage.FooCodec">
    </wsdd:type-mapping-entry>
    </wsdd:type-mapping>
    </XMLSchemaAndTypeMapping>
    Any ideas what is causing the problem?
    Using WLS 8.1 sp2 on WinXP, JDK 1.4
    Thanks in advance.
    - Doug

  • Org.exolab.castor.xml.MarshalException:Unable to instantiate java.util.List

    Hi,
    I am using castor to unmarshal an xml into a java object.
    This object has member variables as collections (List).
    Even though in the mapping file I used collections attribute of <field> tag and has set it to arraylist, it is still throwing this exception.
    After doing a bit of research on this,I found that since UnmarshalHandler uses reflection to create object from xml, it is trying to invoke java.util.List.newInstance() which is causing this problem.
    The class which I am trying to unmarshal is an already existing class and I cannot change the type of the member variables to ArrayList from List.
    How can it be resolved?

    The exception trace is as below :
    Caused by: java.lang.InstantiationException: java.util.List() method not
    found
    at
    org.exolab.castor.xml.UnmarshalHandler.createInstance(UnmarshalHandler.java:2584)
    at
    org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:2348)
    at
    org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1436)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
    Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
    Source)

  • Pass and access (java.util.List) between appplications

    Hi,
    I have two classes in separate jars (applications).
    How can I print the dataList record fields in the second class?
    Thanks
         MySync mySync = new MySync();
         // database records
         // Name, Address, City, Phone
         mySync.setMyList ((java.util.List) dataList);
            mySync.processList();
    public class MySync {
         private java.util.List myList;
         public void setMyList((java.util.List) myList) {
              this.myList = myList;
         public void processList() {
              ListIterator itr = this.myList.listIterator();
              while(itr.hasNext()) {
                   Object element = itr.next();
                   System.println("Name = " + element ???);
    }     

    kanei wrote:
    OK say you had a jverd.jar containing a MySync class which you sent to me as a library for my program,
    and I had a jar with a Record class for MySync to process.
    How would your MySync class process a java.util.List of Records?For MySync to even compile, either I had to have your jar available when I was writing my code, so I could put it on my classpath for compilation(And of course I'd also need it to execute my unit tests.), OR Record would have to implement some interface (or extend some class, though that would be less likely) that is on my classpath, either because it's part of the core API or because it's from a 3rd party library that we both downloaded.
    Or maybe it's all done with reflection, but that's probably not what you want.
    Hard to say when you don't provide a concrete explanation of what you're trying to accomplish and an SSCCE to demonstrate it.

  • How to resolve oracle.jbo.Key cannot be cast to java.util.List?

    Hi experts,
    I am getting this error (oracle.jbo.Key cannot be cast to java.util.List) PPR# . . . . . while filtering in grid..
    give some idea to solve this please...
    Note: (This error is occurs only in JDev ver 11.1.1.3.0 and its working fine in 11.1.1.2.0)
    Regards,
    Gops

    I guess information is too less, could you provide some more info ?
    Amit

  • Model generation error when using java.util.List in JavaBeans

    hi there,
    when I try to generate model classes from JavaBeans classes,
    packed into a JAR the generation process always stops with erros when the Bean class uses a property of type
    java.util.List. See my example:
    class MyJavaBean{
       private java.util.List someMembers;
    The error is:
    Inspecting relation "MyJavaBean.SomeMembers" for source class "MyJavaBean"
    [Warning]:This relation cannot be added as the TargetModelClass is not specified
    [Error]: There are one or more relations unresolved. Importing the model without resolvoing the relations might result in erratic output.
    Must I use a workaround or does anybody know something about this problem ? Installed: NW SP12
    thx,
    sabine

    Hi Bhavik,
    Can you please explain the error which you are getting while importing the model.
    Please have a look at this tutorial.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on using ejbs in web dynpro - 20.html
    Hope it helps.
    Regards,
    Naresh

  • Patters for avoiding the '/' (in java.util.regex)

    Hi all ,
    i wanted to knw the pattern format (in java.util.regex) for avoiding the '/' at the begenning of a line ....... hope to get the best answers ....
    thnx 'n cheers
    max

    first of thnx for the quick responses .... !
    what i am really trying to do here is to avoid all lines which are starting with a comment ( '//' or '/*' ) .
    -> I am checking for all lines and inserting a line of code just before a particular statement , the only thing is that statement which i am looking for should not be inside a comment ( '//' or '/*' ) .... hope u got the thing
    thnx
    max

  • Java.util.list is not Generic type

    Hi All,
    i am creating ADF Mobile application and i am getting this error while executing following code.
    List<String> results = new ArrayList<String>();
    Please help me
    Thanks

    972388 wrote:
    Thanks for your reply. I am getting the error in the code snippet "List<ProcessResponse.ArrayofObjects>". But if I change it to only "List", the error is resolved. But I am not quite sure I should change it, as because the former snippet is getting invoked automatically.I assume you problem occurs in on the mobile side? (ADF Mobile)
    If so, are you using 'Web service client and proxy'? This is not supported in ADF Mobile.

  • Import java.util.* or  import java.util.List...?

    does "import package.*" has performance issue?

    does "import package.*" has performance issue?This had issues with older versions. The compiler optimizes the code to manage imports.
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=008968
    As far as maintainability is concerned, it is better to import specific classes instead of the complete package.
    ***Annie***

  • Using List Class in java.awt / java.util ?

    have a program that:
    import java.util.*;
    List list = new LinkedList();
    list = new ArrayList();
    ... read a file and add elements to array
    use a static setter
    StaticGettersSetters.setArray(list);
    next program:
    import java.awt.*;
    public static java.util.List queryArray =
    StaticGettersSetters.getArray();
    If I don't define queryArray with the package and class, the compiler
    gives an error that the List class in java.awt is invalid for queryArray.
    If I import the util package, import java.util.*; , the compiler
    gives an error that the list class is ambiguous.
    Question:
    If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
    Just curious...
    Thanks for your help,
    YAM-SSM

    So what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
    import java.awt.*;
    import java.sql.*;
    import java.util.*;
    public class ClashTest
        public static void main(String [] args)
            java.util.Date today    = new java.util.Date();
            java.util.List argsList = Arrays.asList(args);
            System.out.println(today);
            System.out.println(argsList);
    }No problems here. - MOD

  • Null pointer exception with Lists

    Hi,
    I have got a problem with java.util.List. It is giving Null pointer exception whenever I try to add after extracting from my XML file.I have written the code like this:
    List year; //Global variable
    List loaddatas; //Global variable
    Element e1; //Global
    loaddatas=root.getChild("Load").getChildren("LoadData");
    int k=loaddatas.size();
    for(int i=0;i<loaddatas.size();i++)
    e1=(Element)loaddatas.get(i);
    year.add(i,Integer.valueOf(e1.getChildText("Year"))); // I am getting exception here.....
    root is root element in XML file.
    I am able to display "Integer.valueOf(e1.getChildText("Year"))" correctly.
    Anybody please tell me how to solve this.
    Thanks,
    Sai Ram

    Looks like somebody forgot to learn to program before starting to write code....
    List list = new ArrayList();

  • Error in Parser.fx file "incompatible types found   : java.util.Properties"

    Hi,
    In parser file "Parser.fx",
    public-read def PROPERTIES_PARSER = StreamParser {
    override public function parse(input : java.io.InputStream) : RecordSet {
    var props = javafx.util.Properties {};
    props.load(input);
    input.close();
    MemoryRecordSet {
    records: [
    MapRecord {
    fields: props
    due to under line portion an error is appearing:
    "incompatible types
    found : javafx.util.Properties
    required: java.util.Map
    fields: props".
    Please suggest some solution.
    Thanks in advance.
    regards,
    Choudhary Nafees Ahmed
    Edited by: ChoudharyNafees on Jul 5, 2010 3:48 AM

    Parser.fx
    package org.netbeans.javafx.datasrc;
    import javafx.data.pull.PullParser;
    import javafx.data.pull.Event;
    import org.netbeans.javafx.datasrc.MemoryRecordSet;
    public-read def PROPERTIES_PARSER = StreamParser {
        override public function parse(input : java.io.InputStream) : RecordSet {
            var props =java.util.Properties{};
            props.load(input);
            input.close();
            MemoryRecordSet {
                records: [
                    MapRecord {
                        fields: props
    public-read def LINE_PARSER_FIELD_LINE = ".line";
    public-read def LINE_PARSER = StreamParser {
        override public function parse(input : java.io.Reader) : RecordSet {
            var line : String;
            var result : Record [] = [];
            line = readLine(input);
            // BEWARE  ("" == null) is true
            while (line != null or "".equals(line)) {
                var map = new java.util.HashMap();
                map.put(LINE_PARSER_FIELD_LINE, line);
                var record = MapRecord {
                    fields: map
                insert record into result;
                line = readLine(input);
            MemoryRecordSet {
                records: result
    function readLine(in : java.io.Reader) : String {
        var str = new java.lang.StringBuilder;
        while (true) {
            var c = in.read();
            if (c == -1) {
                return if (str.length() == 0) then null else str.toString();
            } else if (c == 0x0D) {
                c = in.read();
                if (c == 0x0A or c == -1) {
                    return str.toString();
                str.append(0x0D);
            } else if (c == 0x0A) {
                return str.toString();
            str.append(c as Character);
        str.toString()
    public-read def JSON_PARSER = StreamParser {
        function toSequence(list : java.util.List) : Record [] {
            var result : Record [] = [];
            var ii = list.iterator();
            while (ii.hasNext()) {
                var r = ii.next() as Record;
                insert r into result;
            result
        override public function parse(input : java.io.InputStream) : RecordSet {
            var topLevel : Object;
            def parser = PullParser {
                documentType: PullParser.JSON
                input: input
                var mapStack = new java.util.Stack();
                var currentMap : java.util.Map;
                var recordsStack = new java.util.Stack();
                var currentRecords : java.util.List;
                var lastEvent: Event;
                onEvent: function(event: Event) {
                    if (event.type == PullParser.TEXT) {
                        currentMap.put(event.name, event.text)
                    } else if (event.type == PullParser.INTEGER) {
                        currentMap.put(event.name, event.integerValue)
                    } else if (event.type == PullParser.NULL) {
                        currentMap.put(event.name, null)
                    } else if (event.type == PullParser.START_ELEMENT) {
                        if (lastEvent.type == PullParser.START_ARRAY_ELEMENT) return;
                        var oldMap = currentMap;
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        if (topLevel == null) topLevel = currentMap;
                        if (oldMap != null) {
                            var mr = MapRecord {
                                fields: currentMap
                            if (event.name == "" and lastEvent.type == PullParser.START_VALUE) {
                                oldMap.put(lastEvent.name, mr)
                            } else {
                                oldMap.put(event.name, mr)
                    } else if (event.type == PullParser.START_ARRAY_ELEMENT) {
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        var mr = MapRecord {
                            fields: currentMap
                        currentRecords.add(mr);
                    } else if (event.type == PullParser.END_ELEMENT) {
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.END_ARRAY_ELEMENT) {
                        if (lastEvent.type == PullParser.END_ELEMENT) return;
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.START_ARRAY) {
                        currentRecords = new java.util.ArrayList();
                        recordsStack.push(currentRecords);
                        if (topLevel == null) topLevel = currentRecords;
                    } else if (event.type == PullParser.END_ARRAY) {
                        var set = MemoryRecordSet {
                            records: toSequence(currentRecords)
                        currentMap.put(event.name, set);
                        recordsStack.pop();
                        if (not recordsStack.empty()) {
                            currentRecords = recordsStack.peek() as java.util.List;
                        } else {
                            currentRecords = null;
                    lastEvent = event;
            parser.parse();
            if (topLevel instanceof java.util.Map) {
                var mr = MapRecord {
                    fields: topLevel as java.util.Map
                MemoryRecordSet {
                   records: [mr]
            } else {
                // List
                var rs = MemoryRecordSet {
                    records: toSequence(topLevel as java.util.List)
                rs
            parser.parse();
            var mr = MapRecord {
                fields: topLevel as java.util.Map
            MemoryRecordSet {
               records: [mr]

Maybe you are looking for

  • Migration of Revenue and Project Invoices

    Hi, We are implementing Oracle Projects (Costing and Billing) but AR is already implemented and using since long. We are migrating Revenue and Invoice data for open projects. For revenue migration, we are uploading summarized cost and generating reve

  • I can not get my safari to quit and I am unable to logout or restart my computer.

    I just recently upgraded to Snow Leopard and than Lion. Since that time I am only able to put my computer to sleep. My safari is always open. I go to the dashboard to quit and clicking on quit does nothing. Also, if I click on safari at the top of th

  • Flat file as source and target in owb-error

    hi, I want to run an interface with source as flat file and target as rdbms table. The mapping got deployed with warnings. And when i run the mapping i get the below error. ORA-04063: package body "Schema.project_name" has errors ORA-06508: PL/SQL: c

  • ME21n - Purchase order field exit??

    Hi Does anybody know what the ME21n (enter purchase order) field exit would be so that I can default a particular G/L account (HKONT) when the account assignment group is 'F' & the purchasing org is a particular value? If you can also confirm if that

  • Aluminum keyboard (USB, not wireless) intermittent problems

    Since I got my new Mac Pro here at work, the keyboard has intermittently acted strangely. Occasionally, letter and number keys only will occasionally stop working in the current application. Arrows, function keys and modifier keys will continue to wo