Trying to return a Hashtable object

Hi,
I'm trying to return a Hashtable object from a method defined as:
public static Hashtable getValues(String str){
In the calling method, I'm using:
Hashtable<Object,Object> table=new Hashtable<Object,Object>();
table=(Hashtable<Object,Object>)Test.getValues(str);
I get the compiler warning as shown below:
Note: App.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Upon compiling with -Xlint:unchecked option, I get:
App.java:10: warning: [unchecked] unchecked cast
found : java.util.Hashtable
required: java.util.Hashtable<java.lang.Object,java.lang.Object>
table=(Hashtable<Object,Object>)Test.getValues(str);
^
How can I correct this?
Thanks.
Vijay

were your method to return a Map<Object, Object> rather than a HashMapyou could transparently return either a HashMap or a HashTable - or anything else that implements the Map interface - without changing any of the code that actually calls this method. you will still, obviously, need to instantiate one inside the method
hence the mantra "code to an abstraction, not a concrete type"

Similar Messages

  • NoClassDefFoundError when trying to return a custom Object

    Hi,
    I'm trying to get some system memory info from a Windows machine using Java. I've written the C code and Java code and it all compiles fine. I can also use most of the methods in the two files. I have a problem with one method though. Its a method that is returning an object type that I created that mirrors a windows structure. Below is the code.
    // Java Object to store the data
    package agent.win32;
    public class MemoryInfo{
      int dwLength;
      int dwMemoryLoad;
      int dwTotalPhys;
      int dwAvailPhys;
      int dwTotalPageFile;
      int dwAvailPageFile;
      int dwTotalVirtual;
      int dwAvailVirtual;
      public int get_dwLength() { return dwLength; }
      public int get_dwMemoryLoad() { return dwMemoryLoad; }
      public int get_dwTotalPhys() { return dwTotalPhys; }
      public int get_dwAvailPhys() { return dwAvailPhys; }
      public int get_dwTotalPageFile() { return dwTotalPageFile; }
      public int get_dwAvailPageFile() { return dwAvailPageFile; }
      public int get_dwTotalVirtual() { return dwTotalVirtual; }
      public int get_dwAvailVirtual() { return dwAvailVirtual; }
    // Java Class that uses JNI
    package agent.win32;
    public class NIMSNT {
      //Constructor
      public NIMSNT(){};
      static{
        try{
          System.loadLibrary("NIMSNT");
        catch (java.lang.UnsatisfiedLinkError e) {
          System.out.println (e);
       * check psapi.dll and psapi functions
       * return true if NT process can be enumerate
      public static native boolean Initialize();
       * Description:The EnumProcesses function retrieves the process identifier
       * for each process object in the system
       * return value:the list of process identifiers
       * call psapi function EnumProcesses
      public static native int[] EnumProcesses();
       * Description:The OpenProcess function returns a handle to an existing process object.
       * return value:If the function succeeds, the return value is an open handle to the specified process
       * call kernel32 function OpenProcess
      public static native int OpenProcess(int Pid);
       * Description:The EnumProcessModules function retrieves a handle for each module in the specified process
       * return value:the list of module handles
       * call psapi function EnumProcessModules
      public static native int[] EnumProcessModules(int hProcess);
       * Description:The GetModuleFileNameEx function retrieves the fully qualified path for the specified module
       * return value:the fully qualified path for the specified module
       * call psapi function GetModuleFileNameEx
      public static native String GetModuleFileName(int hProcess,int hModule);
       * Description:The GetModuleBaseName function retrieves the base name of the specified module
       * return value:the base name of the specified module
       * call psapi function GetModuleBaseName
      public static native String GetModuleBaseName(int hProcess,int hModule);
       * Description:function closes an open object handle
       * return value:true if succesfuly
       * call kernel32 function CloseHandle
      public static native boolean CloseHandle(int handle);
       * Description:function gets system memory
       * return value:String
      public static native MemoryInfo GetSystemMemoryInfo();
    // C Structure (defined in windows.h)
    typedef struct _MEMORYSTATUS {
      DWORD dwLength;
      DWORD dwMemoryLoad;
      SIZE_T dwTotalPhys;
      SIZE_T dwAvailPhys;
      SIZE_T dwTotalPageFile;
      SIZE_T dwAvailPageFile;
      SIZE_T dwTotalVirtual;
      SIZE_T dwAvailVirtual;
    } MEMORYSTATUS, *LPMEMORYSTATUS;
    // C code
    #include <windows.h>
    #include <string.h>
    #include "agent_win32_NIMSNT.h"
    #define MaxProcessNumber 10000
    /** Type Definitions                                  **/
    typedef BOOL (WINAPI *ENUMPROCESSES)(
         DWORD * lpidProcess, 
           DWORD cb,            
           DWORD * cbNeeded     
    typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
         HANDLE hProcess,     
         HMODULE * lphModule, 
         DWORD cb,            
         LPDWORD lpcbNeeded   
    typedef DWORD (WINAPI *GETMODULEFILENAMEEXA)(
         HANDLE hProcess,          
         HMODULE hModule,          
         LPTSTR lpstrFileName,     
         DWORD nSize               
    typedef DWORD (WINAPI *GETMODULEBASENAME)(
         HANDLE hProcess,          
         HMODULE hModule,          
         LPTSTR lpstrFileName,     
         DWORD nSize               
    typedef struct _PROCESS_MEMORY_COUNTERS {
        DWORD cb;
        DWORD PageFaultCount;
        DWORD PeakWorkingSetSize;
        DWORD WorkingSetSize;
        DWORD QuotaPeakPagedPoolUsage;
        DWORD QuotaPagedPoolUsage;
        DWORD QuotaPeakNonPagedPoolUsage;
        DWORD QuotaNonPagedPoolUsage;
        DWORD PagefileUsage;
        DWORD PeakPagefileUsage;
    } PROCESS_MEMORY_COUNTERS, *PPROCESS_MEMORY_COUNTERS;
    typedef BOOL (WINAPI *GETPROCESSMEMORYINFO)(
         HANDLE hProcess,
         PPROCESS_MEMORY_COUNTERS ppsmenCounters,
         DWORD cb
    /** Global Variables                                  **/
    ENUMPROCESSES EnumProcesses;
    ENUMPROCESSMODULES EnumProcessModules;
    GETMODULEFILENAMEEXA GetModuleFileNameExA;
    GETMODULEBASENAME GetModuleBaseName;
    GETPROCESSMEMORYINFO GetProcessMemoryInfo;
    /** DLL Entry                                         **/
    BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved){    
         return TRUE;
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    Initialize
    * Signature: ()Z
    JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_Initialize(JNIEnv * env,jclass clazz){
         HANDLE hpsapi=LoadLibrary("PSAPI.DLL");
         if (hpsapi==NULL) return FALSE;
         EnumProcesses=(ENUMPROCESSES)GetProcAddress((HINSTANCE)hpsapi,"EnumProcesses");
         GetModuleFileNameExA = (GETMODULEFILENAMEEXA)GetProcAddress((HINSTANCE)hpsapi, "GetModuleFileNameExA");
         GetModuleBaseName = (GETMODULEBASENAME)GetProcAddress((HINSTANCE)hpsapi, "GetModuleBaseNameA");
         EnumProcessModules = (ENUMPROCESSMODULES)GetProcAddress((HINSTANCE)hpsapi, "EnumProcessModules");
         GetProcessMemoryInfo = (GETPROCESSMEMORYINFO)GetProcAddress((HINSTANCE)hpsapi, "GetProcessMemoryInfo");
         if (
              NULL == EnumProcesses          ||
              NULL == GetModuleFileName     ||
              NULL == GetModuleBaseName     ||
              NULL == EnumProcessModules  )
            return FALSE;
         return TRUE;   
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    EnumProcesses
    * Signature: ()[I
    JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcesses(JNIEnv * env, jclass clazz){
         DWORD aPids[MaxProcessNumber];
         DWORD cGot;
         jintArray Pids=0;
         if(EnumProcesses(aPids,sizeof(aPids),&cGot)){
              cGot /= sizeof(aPids[0]);
                 Pids= (*env)->NewIntArray(env,cGot);
              (*env)->SetIntArrayRegion(env,Pids,0,cGot,(jint*) aPids);
         return Pids;
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    OpenProcess
    * Signature: (IZI)I
    JNIEXPORT jint JNICALL Java_agent_win32_NIMSNT_OpenProcess (JNIEnv * env, jclass clazz,jint Pid){
         return (jint) OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,Pid);
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    EnumProcessModules
    * Signature: (I[I)[I
    JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcessModules (JNIEnv * env, jclass clazz, jint hProcess){
         HMODULE hModule[MaxProcessNumber];
         jintArray jModule=0;
         DWORD cGot;    
         if (EnumProcessModules((HANDLE)hProcess,hModule,sizeof(hModule),&cGot)){
              cGot/= sizeof(hModule[0]);
              jModule= (*env)->NewIntArray(env,cGot);
              (*env)->SetIntArrayRegion(env,jModule,0,cGot,(jint*)hModule);
         return jModule;
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    GetModuleFileName
    * Signature: (II)Ljava/lang/String;
    JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleFileName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
         jstring jName=0;
         char FileName[MAX_PATH];
         if(GetModuleFileNameExA((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
              jName=(*env)->NewStringUTF(env,FileName);
         return jName;
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    GetModuleBaseName
    * Signature: (II)Ljava/lang/String;
    JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleBaseName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
         jstring jName=0;
         char FileName[MAX_PATH];
         if(GetModuleBaseName((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
              jName=(*env)->NewStringUTF(env,FileName);
         return jName;
    * Class:     nims4_agent_win32_NIMSNT
    * Method:    CloseHandle
    * Signature: (I)Z
    JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_CloseHandle(JNIEnv * env, jclass clazz, jint handle)
         return CloseHandle((HANDLE) handle);
    * Class:     nims_agent_win32_NIMSNT
    * Method:    GetSystemMemoryInfo
    * Signature: (I)Lagent/win32/MemoryInfo;
    JNIEXPORT jobject JNICALL Java_agent_win32_NIMSNT_GetSystemMemoryInfo(JNIEnv * env, jclass clazz){
         jfieldID jfield;
         jobject jobj=0;
         MEMORYSTATUS stat;
         stat.dwLength = sizeof(stat);
         GlobalMemoryStatus(&stat);
         clazz=(*env)->FindClass(env,"agent.win32.NIMSMemoryInfo");
         if (clazz==0) return 0;
         jobj = (*env)->AllocObject (env,clazz);
         //set NIMSMemoryInfo object field
         // dwLength
         jfield=(*env)->GetFieldID(env,clazz,"dwLength","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwLength);
         // dwMemoryLoad
         jfield=(*env)->GetFieldID(env,clazz,"dwMemoryLoad","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwMemoryLoad);
         // dwTotalPhys
         jfield=(*env)->GetFieldID(env,clazz,"dwTotalPhys","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwTotalPhys);
         // dwAvailPhys
         jfield=(*env)->GetFieldID(env,clazz,"dwAvailPhys","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwAvailPhys);
         // dwTotalPageFile
         jfield=(*env)->GetFieldID(env,clazz,"dwTotalPageFile","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwTotalPageFile);
         // dwAvailPageFile
         jfield=(*env)->GetFieldID(env,clazz,"dwAvailPageFile","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwAvailPageFile);
         // dwTotalVirtual
         jfield=(*env)->GetFieldID(env,clazz,"dwTotalVirtual","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwTotalVirtual);
         // dwAvailVirtual
         jfield=(*env)->GetFieldID(env,clazz,"dwAvailVirtual","I");
         (*env)->SetIntField (env,jobj, jfield,stat.dwAvailVirtual);
         return jobj;
    };I can use all of the methods in the Java/C code except for the the last native method   public static native MemoryInfo GetSystemMemoryInfo(); . I get a NoClassDefFoundError when I try to use this method. I have a feeling that I'm just doing something stupid.
    Thanks in advance,
    John

    Yes, exactly. I changed the name of that class and forgot to change it in the c code. Thanks for the feedback.
    Also, if anyone is using this code as an example, you need to change "agent.win32.MemoryInfo" to "agent/win32/MemoryInfo" in the c code. If it is left as "agent.win32.MemoryInfo" you will get a ClassCircularityError when trying to make multiple calls to the NIMSNT.GetSystemMemoryInfo();.

  • Remote object trying to return another remote object and a ClassCastExcepti

    I have a server running with a TreeModel (the tree model implements Remote). I also have the the TreeNodes all linked together on the server. Now, I can get to the TreeModel on the server and the root node of the remote tree model.
    treeModelStub = (treeModelIface)Naming.lookup(url+"remoteTM"); //works
    rootStub = (remoteTreeNodeIface)treeModelStub.getRoot(); //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild = (remoteTreeNodeIface)rootStub.getChildAt(index) //Does not work. "Exception in thread "main" java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown Source)
    The remote tree node method getChildAt returns TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends UnicastRemoteObject implements rdcaDataIface, Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is "+this.getClass()); // class is remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote {
    public TreeNode getChildAt(int idx) throws RemoteException;
    Any ideas why this does not work. Why can a remote object of type Object be returned just fine, but a TreeNode not be returned?
    Thank you for your help,
    Brent

    I have a server running with a TreeModel (the tree
    model implements Remote). I also have the the
    TreeNodes all linked together on the server. Now, I
    can get to the TreeModel on the server and the root
    node of the remote tree model.
    treeModelStub =
    (treeModelIface)Naming.lookup(url+"remoteTM");
    //works
    rootStub =
    (remoteTreeNodeIface)treeModelStub.getRoot();
    //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild =
    (remoteTreeNodeIface)rootStub.getChildAt(index)******************************************
    can only be casted to rdcaDataIface. The returned object is an instanceof the rdcaDataIface_stub, which have nothing to do with TreeNode.
    //Does not work. "Exception in thread "main"
    java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown
    t(Unknown Source)
    The remote tree node method getChildAt returns
    TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends
    UnicastRemoteObject implements rdcaDataIface,
    Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is
    lass is "+this.getClass()); // class is
    remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote
    public TreeNode getChildAt(int idx) throws
    ows RemoteException;
    Any ideas why this does not work. Why can a remote
    object of type Object be returned just fine, but a
    TreeNode not be returned?
    Thank you for your help,
    Brent

  • How to Include Warnings/Error messages in Return Service Data Object

    Hello All,
    I am using Jdeveloper 11.1.1.3.0, ADF BC. and want to publish Service-Enabled application modules, specifically I want to publish a custome method in the application module as a web service.
    While going through Enable support for Service Interface wizard as explained in developer guide, in step 7 I read this
    >
    7. To expose service information messages such as warnings and exceptions for a custom method or warnings for process operation methods, select Include Warnings in Return Service Data Object. For example, you might want display an informational message when a method returns the total employee compensation and the total is outside of the desired range.
    If Include Warnings is not selected, no informational messages will be returned with the service response. This option is only enabled when the method does not return a view row or a list
    of view rows. When the method returns view rows, the underlying view object determines whether the method supports warnings, as described Section 11.2.4, "How to Service-Enable Individual View Objects." The informational messages (and warnings) are reported as part of the return object. JDeveloper generates appropriate wrappers as the return objects, and the wrappers contain the actual method return and the informational messages.
    >
    I am interested in this part: For example, you might want display an informational message when a method returns the total employee compensation and the total is outside of the desired range.
    To do this, I write a method in the application module
    public Number getEmpSal(Number empId){
            EmployeesViewImpl employeesView1 = this.getEmployeesView1();
            //this is the bind variable setter
            employeesView1.setEmpId(empId);
            employeesView1.executeQuery();
            EmployeesViewRowImpl first = (EmployeesViewRowImpl)employeesView1.first();
           return first!=null ? first.getSalary() : null;
    }and I selected the Include Warnings in Return Service Data Object check box. but how and where can I expose the error or warning message?
    Note:
    I tried to throw an exception in the method
    public Number getEmpSal(Number empId){
            EmployeesViewImpl employeesView1 = this.getEmployeesView1();
            //this is the bind variable setter
            employeesView1.setEmpId(empId);
            employeesView1.executeQuery();
            EmployeesViewRowImpl first = (EmployeesViewRowImpl)employeesView1.first();
            if(first!=null && (first.getSalary()!=null || first.getSalary().compareTo(1000)==1))
                throw new JboException("out of range salary");
             return first!=null ? first.getSalary() : null;
    }and when I test the web service for some employee I get this response:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>
         <env:Body>
              <env:Fault>
                   <faultcode>env:Server</faultcode>
                   <faultstring>out of range salary</faultstring>
                   <detail><tns:ServiceErrorMessage xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/" xmlns:xsi=      "http://www.w3.org/2001/XMLSchema-instance"><tns:code/><tns:message>out of range  salary</tns:message><tns:severity>SEVERITY_ERROR</tns:severity><tns:exceptionClassName>oracle.jbo.JboException</tns:exceptionClassName></tns:ServiceErrorMessage>
                   </detail>
              </env:Fault>
         </env:Body>
    </env:Envelope>but is this the right approach or there is another place to show error/warning messages?
    Edited by: Mohammad Jabr on Apr 16, 2012 1:17 PM

    This is fine if you raise exception from your code. It will be raised as a server fault only.

  • Ldapsearch returns "no such object"

    Hi, all,
    I am new to directory server. I want to write a script to create batch users using ldapmodify. I tried to use ldapsearch to list the current entries.
    ' ldapsearch -h "saowsp02" -b "cn=xxx, cn=yyy" -s sub "objectclass=*" but returns 'no such object'.
    1. where can I find out what is my baseDN? I have no problem searching the root DSE entry
    2. can I use ldapmodify to create a new user? Where should I put user password, encrypted, uncrypted?
    Thanks,
    lynne

    1. BaseDN is your search base point. For example, you have:
    o=xyz.com
    ou=People
    ou=Groups
    etc. ...
    You want to find all person objects.
    In that case your BaseDN would be
    "ou=People,o=xyz.com"
    2. Yes, you can. You can do almost all operations via ldapmodify.
    http://docs.sun.com/source/816-6678-10/ldif.htm
    You can enter new values to the STDIN or (its more convenient)
    you can create ldif file with all necessary attributes and values.

  • Returning Non Serializable Objects

    Is it possible in anyway to return non serializable objects from the remote method of an EJB, for instance return a result set. Everytime i try, i get a CORBA marshalling exception, i tried to put the resultset in a serilized object such as an enumeration or vector but got the same error when retreiving it from the enumeration or vector. Help is needed and appreciated. Thanx.

    Is it possible in anyway to return non serializable objects from the remote method of an EJB, for instance return a result set. Everytime i try, i get a CORBA marshalling exception, i tried to put the resultset in a serilized object such as an enumeration or vector but got the same error when retreiving it from the enumeration or vector. Help is needed and appreciated. Thanx.

  • Can plsql return table of object type

    Dear All,
    I am trying to return a set of data using object type.
    But i am able to return only a single row but I want to return multiple rows.
    I am trying to create the procedure which will return the table of object type but I am not able to assign value to table of object type.
    Any ideas will be appreciated.
    Regards
    Abhishek

    ArchitectView wrote:
    The intention is to create a tree structure of data.Is this structure stored in the database? If so, then what data model is used? Relational? Hierachical? Object?
    Each of these have pros and cons. The object model has many when persisted in a database as it nowhere near as flexible and robust as relational. Simple example, you can define an object class called Address. You can define a collection class called addressList. You can make that collection class a column in the Customers table. This allows you to store multiple addresses for a customer - as part of the same row for a customer.
    However, there is a data modeling issue here. How do you index the region code in the address to do region based sales and marketing queries? There is a performance issue here - every time a customer row is read, the Addresses column is also read and this column contains a collection of addresses... Expensive I/O wise.
    If relational data model was used, there would have been an Addresses table. It would have had a region index. And every time you read a customer row, all the addresses of that customer is not automatically read into memory too.
    This Pl/SQL is to be called by another program which will accept the tree structure.So PL/SQL is to deliver a tree structure class?
    You have mentioned about the design being not optimal, please elaborate.
    I am doing these steps to improve performance.
    i already have a java code which creates the data in the tree form {common data model -  XML} .
    I am thinking that if I create the structure in database , it will be better for performance.What makes sense to me (performance, usability and data modeling wise) is to use a relational design to store the tree data in Oracle. Each tree item will have a unique identifier and an optional parent identifier. The latter will be a foreign key constraint to the unique identifier.
    The PL/SQL procedure can use a hierachical SQL to select the relevant root nodes from the tree table (i.e. start with tree items that have null parent identifiers) and transform this into a XML and supply XML output.
    This allows Java to call this PL/SQL procedure, and get XML in response.
    An alternative would be to not use XML, but instead define the tree structure as Java expects it, using SQL advance data types (i.e. classes). But instead of using that for store of the tree's data, the PL/SQL proc uses it to transform the tree data (selected via a hierarchical query) into this class object structure.
    The Java client then needs to have wrapper classes for these SQL classes - and when it calls the PL/SQL proc, it gets a class structure returned that it can natively use on its side.
    This a tad more complex to do than the XML interface - but could be faster as the Java layer does not need to transform the XML into a local data structure... it gets an equivalent data structure directly from PL/SQL.
    The only issue ito performance I can see, is attempting to use such an object structure also as data storage (Oracle table) structure. This is usually less than optimal. Fair to say, that relational data modeling still reigns supreme ito usability, integrity and performance. (at least within RDBMS products, like Oracle)

  • Error #1009 When trying to return to frame 1

    I am getting an error #1009 "Cannot access a property or method of a null object reference."  Frame one is not empty. I have buttons in frame 1 that use this code to gotoAndStop on frames 5,10,25...they work just fine.  I only get the error when trying to return to frame 1 from those locations. Can someone help me out with this issue?
    stop();
    btn_rtni.addEventListener(MouseEvent.CLICK, mainBooth_1);
    function mainBooth_i(MouseEvent):void {
                gotoAndStop(1);

    I allowed "debugging" and this is the error that appreared.  But I still don't get what the problem is or how to correct it.  Most of my content is in frame 1, so I don't understand why it's returning null.  Any advice would be appreciated.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at VB_NABR_fla::MainTimeline/frame1()[VB_NABR_fla.MainTimeline::frame1:93]

  • How to return a java object to VB through the activex bridge?

    Hello,
    I am trying to return more than just a primitive data type to VB from Java. To do this, I compile the two attached files and jar them into FastStatWrapper.jar which I then run through packager.exe and thus end up with an activex object. I then instantiate the FastStatWrapper object in VB and call execute in the following way:
    dim result as Object
    Dim wrapper as Object
    Set wrapper = CreateObject("FastStatWrapper.Bean.1")
    Set result = wrapper.execute("SOMETHING")However, I can't seem to access the result object. It doesn't have any methods. Do I have to package it as a separate bean?
    package test;
    public class FastStatWrapper
         public FastStatWrapper()
         public StatData execute(String _command)
              return new StatData("A", 3.0);
    }and here the data object...
    package test;
    public class StatData
         private String name = null;
         private double value;
         public StatData(String _name, double _value)
              name = _name;
              value = _value;
         public String getValueType()
              return name;
         public double getValue()
              return value;
    }                    

    The returned java object will be exposed as a dispatch object. You should be able to call methods on the returned java object. However, type information will not be available for that object and hence no support for code completion and syntax checking.

  • Not sure on how to return a new object

    hi i am not sure on how to return a new Set object, i am not asking how to code this, i just don't exactly know what to write after "return.." to return a new object ...that part of the code is towards the bottom where i put arrows.....this is the skeleton of the code:
    public class Set
         // define fields here
         public Set(int maxinteger)
              // complete this method
         public boolean add(int integer)
              return false; // replace this line with your code
         public boolean remove(int integer)
              return false; // replace this line with your code
         public boolean contains(int integer)
              return false; // replace this line with your code
         public int size()
              return 0; // replace this line with your code
         public String toString()
              return null; // replace this line with your code
         public void addAll(Set other)
              // complete this method
    --------->     public Set subset(int min, int max)
              return null; // replace this line with your code
    ----------->     public Set intersection(Set other)
              return null; // replace this line with your code
    ------------->     public Set difference(Set other)
              return null; // replace this line with your code
         }

    well, when you use return is when trying to make a method have a value that have to be returned from it.
    In your case you have a Set CLASS, with methods, some methods have to return Strings, ints, Objects, etc.
    just make sure that you are returning the same type of value than the method say.
    the method parts are:
    modifier returnType name (parameters) {
    . code
    modifiers are public, private, etc.
    the return type specifies what the method will return, for example:
    public String toString () {
    must return a String value.
    to return a new Object just do it like a simple value, Strings are objects.
    just define a Set object and then return it.

  • How to return new blob object?

    Hi,
    I am trying to find documentation on how to return a custom abstract data type (ADT) using the CREATE TYPE... and BLOB interface.
    How can I return a new object type defined inside a blob. Can I return a blob (without initializing the lob locator first)?
    Please advise.

    Hi,
    Please check the below link.
    http://docs.oracle.com/cd/E24693_01/appdev.11203/e17126/create_type.htm
    Regards,
    Sailaja

  • How to return array of object

    public class A{
    public class B{
    publc C[] sample()
    int i=0;
    ResultSet rset = s.executeQuery("select name, id  from emp ");
    while(rs.next()){
    name = rset.getString("nam");
    id = rset.getInt("id");
    c.setName(name )
    c[i].setId(id)
    return c[]
    public class C{
    // here i have getter and setter metod for name & id
    When I try to return the object c[]..i am getting "cannot conver from C to C[]".
    Can u pls help me, how to return array of object and how to get name and id values in other class using this array object
    Thanks for ur help

    public class Starting{
    public long empID;
    Data data = new Data();
    Value[] value;
    int count = 0;
         public static void executeDe(){
              value = new Value[100]
              try{
                     data.getDetails()
                     processDetails(value);
                   }catch(Exception e){e.printStackTrace();}
         public static void processDetails(Value[] value){
         count = data.i;
              int i;
              for(i=0;i<count;i++){
                  empID=value.getempID(); \\ here i am not getting all values..... am getting only last value of the array
    public class Data{
    public long empID;
    public int i=0;
    static Value[] value = new Value[100];
    public static Value[] getDetails(){
    Connection con=null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con=DriverManager.getConnection("jdbc:oracle:thin:@" + hostname + ":1521:" + sid, user, password);
    System.out.println(" conn " + con);
    System.out.println("");
    Statement s=con.createStatement();
    try{
         ResultSet rset = s.executeQuery("select EMPID from Employee ");
         while(rset.next()){
    empID = rset.getLong("EMPID");
    value[i].setCycleID(cy_i);
    i++;
         rset.close();
         con.close();
    }catch (SQLException sqle){sqle.printStackTrace();}
         finally{
              try{
              s.close();
         con.close();
              }catch(SQLException e){e.printStackTrace();}
    catch(Exception e){e.printStackTrace();}
    return value;
         public class Value {
         public static long cycleID;
              public static void setempID(long empID) {
                   Value.empID = empID;
              public static long getempID() {
                   return empID;
    This is my actual code..... I am able to set the values in Value class from Data class using getDetails() method, which is returning array of value object.
    In Starting class, I am trying to get values using value[i].. i am getting last value of the array. This is my actual problem... here i want to get all values.
    Please help me how to resolve this.

  • PowerShell: Possible to return a DataReader object from a function call

    I have to interact with several different db's.  I was wondering how I could use a common Function for the connection and commnad params and have it return a DatReader object that I then could evaluate?
    Example: (psuedo-code)
    Function SqlCmd(Db, instance, command) {... return <DataReader onject>}
    $Datareader= SqlCmd Db instance command
    if ($Datareader.HasRows) {..to something..}
    Thanks
    TR

    Hi TR,
    This is possible by using the Dot.Net Sql objects. Below is a small function which takes a connection string and a SQL query string and returns a DataReader object:
    function
    Get-SQLData()
    param (
       [string]$sqlConnectionString,
       [string]$query
    # Create a connection to the OLAP Database
    $connection
    =
    New-Object
    System.Data.SqlClient.SqlConnection
    $sqlConnectionString
    $connection.Open()
    if (!$?)
    {throw
    "Could not open the connection."}
    $command
    =
    New-Object
    System.Data.SqlClient.sqlCommand
    $query,
    $connection
    $dataReader
    =
    $command.ExecuteReader()
    ,$dataReader
    The most important thing to note in this entire function in the comma in front of the $dataReader at the end of the function. As PowerShell implicitly tries to unpack collection objects, this comma forces the collection to
    be returned intact allowing you to use it as required. So here is an example of usage:
    $dr
    =
    Show-SQLData
    $sqlConnectionString
    $query
    if ($dr.HasRows)
       while ($dr.Read())
    "$($dr[0]) $($dr[1]) $($dr[2])"
    Hope that helps!
    Chris

  • Trying to solve the hashtable problem;

    this is a test of a part of my programming, trying to solve the hashtable
    i took out the erronous part and change some of it.i'm trying to print out a table of data with 4 column
    import java.util.*;
    public class test {
         // creating a global hashtable name "b" its
         //static just for the convieniet of it
    static Hashtable b = new Hashtable();
    public static void addItem(String keyid, String t, double p, int q){
    // array size of 4 for my value in hashtable "b"
    String [] array = new String [4];
    // puting all my variables into string array
    //including my keyid as the first in array[0]      
         array[0]=keyid;
         array[1]=t;
         array[2]= String.valueOf(p);//casting of double type to string
         array[3]= String.valueOf(q);//casting of int type to string
         b.put(id,array);//setting key = id and value = my array[]
    public static void main (String args[]) throws Exception {
         String numb = "009", piss="theone";
         double cost = 19.50;
         int a = 1;
         String [] testItem;
         addItem(numb,piss,cost,a); //call of method additem;
         Enumeration e = b.keys();
    // Get all values
    while ( e.hasMoreElements())
    {            tempItem = (String [])e.nextElement(); **// error msg here**
         System.out.println("array element 1"+tempItem[1]);
         System.out.println("array element 2"+tempItem[2]);
         System.out.println("array element 3"+tempItem[3]);
    this is my error msg "ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;"
    1 =====>cannot find symbol
    symbol  : variable id
    location: class test
            b.put(id,array);//setting key = id and value = my array[]
    2 ===>cannot find symbol
    symbol : variable tempItem
    location: class test
    tempItem = (String [])e.nextElement();
    3 ====>cannot find symbol
    symbol : variable tempItem
    location: class test
    System.out.println("array element 1"+tempItem[1]);
    is there anyway to solve this or anyone can provide me with an alternative way of printing a table with 4 col?

    you should learn to post your code inside code tags
    mangotree wrote:
    1 =====>cannot find symbol
    symbol : variable id
    location: class test
    b.put(id,array);//setting key = id and value = my array[]there is nothing called "id"
    mangotree wrote:
    2 ===>cannot find symbol
    symbol : variable tempItem
    location: class test
    tempItem = (String [])e.nextElement();
    3 ====>cannot find symbol
    symbol : variable tempItem
    location: class test
    System.out.println("array element 1"+tempItem[1]);there is nothing called "tempItem"
    mangotree wrote:
    this is my error msg "ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;"
    here you are iterating through the keys of the hash table ("b.keys()"), and your key is a String, not a String[; perhaps you want the value instead?

  • Problems when trying to return information for External Content Types in Sharepoint 2013

    This is my first post on the forum, until I tried on this problem but have not found anything.
    When trying to return the information from the external content displays the following error:
    Error retrieving data from mill. Administrators: query the server log for more information.
    I do not know what else to do...

    Hi,
    According to your post, my understanding is that you got an error when tried to return the information from the external content.
    Did the error occur when you created a new external content type or created a external list?
    You can check the steps with the following articles about how to create a external content type.
    http://lightningtools.com/bcs/creating-an-external-content-type-with-sharepoint-designer-2013/
    http://wyldesharepoint.blogspot.in/2012/12/sharepoint-2013-setting-up-external.html
    If the error occurred with the external list, you can check the steps with the following article.
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/01/08/how-to-create-external-data-column-in-sharepoint-2013.aspx
    You can also check the event log and ULS log to see if anything unexpected occurred.
    For SharePoint 2013, by default, ULS log is at      
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

Maybe you are looking for