ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aatankwadi aatankwadi <golimarbhej...@yahoo.co.in>
Subject Re: AW: Need to add one generic get/set attribute in Project API
Date Fri, 14 Sep 2007 10:07:37 GMT
Hi,
   
  I am adding reference through java code
  project.addReference("conn",conn)
  where conn is my connection object, but I m getting Null Pointer exception here
   
  The code for addReference in Project class is
   
   public void addReference(String referenceName, Object value) {
        synchronized (references) {
            Object old = ((AntRefTable) references).getReal(referenceName);
            if (old == value) {
                // no warning, this is not changing anything
                return;
            }
            if (old != null && !(old instanceof UnknownElement)) {
                log("Overriding previous definition of reference to " + referenceName,
                    MSG_VERBOSE);
            }
            log("Adding reference: " + referenceName, MSG_DEBUG);
            references.put(referenceName, value);
        }
    }
   
  According to below code it seems that it is searching that value in some existing memory...
   
  and if it doesnt get that then it throws exception and if it gets that but with different
value then it override that value.....
   
  I would appreciate clearification... on this method...
   
  Thanks,
  AbhiNandan
   
   
   
  

Jan.Materne@rzf.fin-nrw.de wrote:
  Use set/getReference ;-)

Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: aatankwadi aatankwadi [mailto:golimarbhejeme@yahoo.co.in] 
>Gesendet: Freitag, 14. September 2007 09:18
>An: Ant Users List
>Betreff: Need to add one generic get/set attribute in Project API
>
>Hi,
> 
> I m facing a problem, I want to persist one object through 
>out my project, so I want to put it in some name/value pair, 
>so that I can access it anywhere in my project.
> 
> I am developing a custom sql task that can reuse the 
>connection object created once, rather then using current sql 
>task which create the connection again and again,
> I want to put this connection object in to project instance 
>so that I can access it any where in my project, but no such 
>method(set/get property or attribute) available in current API 
>which can hold an object.
> set property only stores string, where as I need to put an object
> 
> Can ANT Developer can override 
>method(setProperty,getProperty) in Project class which can 
>store an object so that this can act as a generic method for 
>all objects.
> public void setProperty(String key, Object obj2)
> public Object getProperty(String key)
> 
> Please do the needfull as soon as possible or suggest some 
>alternate solution.
> 
> Thanks,
> AbhiNandan
> "Abhi Nahi To Kabhi Nahi"
>
> 
>---------------------------------
> Why delete messages? Unlimited storage is just a click away.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



       
---------------------------------
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message