NullPointerException . . .  problem. in Array

i make a class UserData.java
package server;
import java.io.Serializable;
public class UserData implements Serializable   {
private String name;
private String id;
private String add;
public UserData() {
name = "";
id = "";
add = "";
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public String getId() {
return id;
public void setId(String id) {
this.id = id;
public String getAdd() {
return add;
public void setAdd(String add) {
this.add = add;
a test Class .. TestUserDate.java
package server;
public class TestUserdata {
public static void main(String arg[]) {
UserData ud[] = new UserData[10];
for (int i = 0; i < ud.length; i++) {
ud.setId("123456789");
ud[i].setAdd("Address");
ud[i].setName("user name ");
it give me *Error*
Exception in thread "main" java.lang.NullPointerException
        at server.TestUserdata.main(TestUserdata.java:10)
*Some more info*
when i create a single object i run successfully
but when i make a *Array* it give me Error
*what wrongs this my code*
help me...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

thanks for your efforts.
it work now.
package server;
public class TestUserdata {
    public static void main(String arg[]) {
        UserData ud[] = new UserData[10];
        for (int i = 0; i < ud.length; i++) {
            ud[i] = new UserData();
            ud.setId("123456");
ud[i].setAdd("Address");
ud[i].setName("user name ");

Similar Messages

  • Problem in Array of JCheckBox

    I am facing a problem with the array of JCheckBox. Without array it works but when I use array it gives NullPointerException. No compile time error. I am using Null Layout. But I need to use the array. How can I solve this?
    Here is the code.
    JCheckBox jCheckBox_Questions[] = new JCheckBox[3];
    JCheckBox box = new JCheckBox();
    Dimension d[] = new Dimension[3] ;
    String strQuestions[] = {"No Child ?","Jaundice ?","Migraine ?"};
    int j=20,k=150;
    // This works
    box.setText(strQuestions[0]);
    add(box);
    d[1]= box.getPreferredSize();
    box.setBounds(j,k,d[1].width,d[1].height);
    k=k+20;
    //When I add the follwing fragment it gives NullPointerException
    jCheckBox_Questions[0]. setText(strQuestions[1]);// in this line
    add(jCheckBox_Questions[0]);
    d[2]= jCheckBox_Questions[0].getPreferredSize();
    jCheckBox_Questions[0].setBounds(j,k,d[2].width,d[2].height);

    Hi,
    classic error: in fact the code
       JCheckBox jCheckBox_Questions[] = new JCheckBox[3]; doesn't instantiate the checkboxes, it's only allocating 3 memory pointers (inited to null), ready to receive the futures instances of checkboxes. So you should have typed:
       JCheckBox jCheckBox_Questions[] = new JCheckBox[3];
       // Here we create the 3 objects
       for (int i=0;i<3;i++) jCheckBox_Questions[ i ] = new JCheckBox();
       //...Hope this will help,
    Regards.

  • How can I can solve my NullPointerException problem?

    Hi all,
    So I'm playing around with some code and was wondering why I get the following?
    Exception in thread "main" java.lang.NullPointerException
         at lecture_examples.Library.searchForTitle(Library.java:38)
         at lecture_examples.LibraryManager.main(LibraryManager.java:24)The problem seems to occur when I call searchForTitle() in the library class. Here is my code:
    package lecture_examples;
    public class LibraryManager
         public static void main(String []args)
              Library lib = new Library(150);
              Book book1 = new Book("Africa", "Ray Mears", "1111-1111-1111-1", "Penguin Books", 2007);
              Book book2 = new Book("North America", "Ray Mears", "2222-2222-2222-2", "Penguin Books", 2007);
              Book book3 = new Book("South America", "Ray Mears", "3333-3333-3333-3", "Penguin Books", 2007);
              Book book4 = new Book("Europe", "Ray Mears", "4444-4444-4444-4444-4", "Penguin Books", 2007);
              Book book5 = new Book("Asia", "Ray Mears", "5555-5555-5555-5555-5", "Penguin Books", 2007);
              Book book6 = new Book("Australasia", "Ray Mears", "6666-6666-6666-6666-6", "Penguin Books", 2007);
              Book book7 = new Book("India", "Ray Mears", "7777-7777-7777-7", "Penguin Books", 2007);
              Book book8 = new Book("South Pacific", "Ray Mears", "8888-8888-8888-8", "Penguin Books", 2007);
              lib.addBook(book1);
              lib.addBook(book2);
              lib.addBook(book3);
              lib.addBook(book4);
              lib.addBook(book5);
              lib.addBook(book6);
              lib.addBook(book7);
              lib.addBook(book8);
              lib.searchForTitle("India");
         //other static methods used by main
    package lecture_examples;
    import java.util.Vector;
    public class Library
         private int currSize = 0;
         private Book[] books;
         public Library()
              books=new Book[1000];
         public Library(int maxSize)
              books=new Book[maxSize];
         public void addBook(Book newBook)
              if(currSize<books.length) //if there the book array is not full
                   books[currSize++]=newBook;//Puts the newBook into an element of book array
              else
                   System.out.println("Your Library is Full");//Output error message
         public Book[] searchForTitle(String aTitle)
              Vector v=new Vector();//create an expandable Vector called v.
              for(int i=0;i<books.length;i++)//loops through the array of books
                   if(aTitle.equals(books.getTitle()))//compares the searched Title with each title stored in each element of the book array
                        v.add(books[i]);//if the book lexigraphically matches a book in the book array it adds the existing book to the vector
              Book[] results=new Book[v.size()];//creates an book-result array which is the same size as the vector
              for(int i=0;i<v.size();i++)
                   results[i]=(Book)(v.elementAt(i)); //loops through the results vector and casts them as books into the book array
              return results;     //returns results     
         public void removeBook(String isbn)
              int index=getIndex(isbn);//gets the index of isbn and assigns it to the index integer variable
              for (int i=index;i<currSize-1;i++) //loops through the books
                   books[i]=books[i+1]; //moves each book up one element in the book array
              currSize--;//decrements the number of books in the library
         public int getIndex(String isbn)
              int index = 0;
              for(int i=0;i<currSize;i++)//loops through the number of books
                   if(isbn.equals(books[i].getIsbn()))//If the isbn is in the book array
                        index = i; //assign index to i
              return index;
    package lecture_examples;
    public class Book
         private String title = "Invalid";
         private String author = "Invalid";
         private String isbn = "Invalid";
         private String publisher = "Invalid";
         private int publicationYear = 0000;
         public Book(String title, String author, String isbn, String publisher, int publicationYear)
              this.title = title;
              this.author = author;
              this.isbn = isbn;
              this.publisher = publisher;
              this.publicationYear = publicationYear;          
         public String getTitle()
              return title;
         public String getAuthor()
              return author;
         public String getIsbn()
              return isbn;
         public String getPublisher()
              return publisher;
         public int getPublicationYear()
              return publicationYear;
         public void setTitle(String newTitle)
              title = newTitle;
         public void setAuthor(String newAuthor)
              author = newAuthor;
         public void setisbn(String newisbn)
              isbn = newisbn;
         public void setPublisher(String newPublisher)
              publisher = newPublisher;
         public void setPublicationYear(int newPublicationYear)
              publicationYear = newPublicationYear;
         public String toString()
              String fullDetails = "\nTitle = \t" + title
              + "\nAuthor = \t" + author
              + "\nISBN = \t\t" + isbn
              + "\nPublisher = \t" + publisher
              + "\nYear = \t\t" + publicationYear;
              System.out.println(fullDetails);
              return fullDetails;

    >
    Exception in thread "main" java.lang.NullPointerException
         at lecture_examples.Library.searchForTitle(Library.java:38)
         at lecture_examples.LibraryManager.main(LibraryManager.java:24)Simple, line #38 in your Library.java in giving you NullPointerException. In the constructor of your Library.java, you are creating books array of size 1000, which will be initialized to an Books array with 1000 null values. Are you having a reference to a Book object at all 1000 array positions? If no, then in your searchForTitle() method you are iterating through the entire books array using a for loop and at every array object you are calling books.getTitle(). But, if your array has null values then it will throw NullPointerException. So do something like this...
    if(books!=null && aTitle.equals(books[i].getTitle()))//compares the searched Title with each title stored in each element of the book array
                        v.add(books[i]);//if the book lexigraphically matches a book in the book array it adds the existing book to the vector

  • NullPointer Problems in Array

    I'm trying to create two different hash tables, and put the hased data into each one using linear probing. I'm using an array, but I'm having a little problem (mainly with the circular array part, I think). I've posted what I've got below. Every time I try to test it, I get a NullPointerException. I know the code is a little (a lot) sloppy, but I just sat down and wrote it right now, so take it easy :P
    import java.util.Scanner;
    import java.io.*;
    public class HashingTable {
         private static HashObject[] array1;
         private static HashObject[] array2;
         private static int collision1, collision2;
         public HashingTable() {
              HashObject[] array1 = new HashObject[145];
              HashObject[] array2 = new HashObject[415];
              collision1 = collision2 = 0;
         public static void fillHashTable(String fileName) throws IOException {
            Scanner scan = new Scanner(new File(fileName));
            while(scan.hasNext()) {
                HashObject hashObject1, hashObject2;
               String word = scan.next().toUpperCase();
                        int total = 0;
                        for(int i=0; i < word.length(); i++) {
                             char c = word.charAt(i);
                             if(Character.isLetterOrDigit(c))
                                  total += (int)c;
                             if(c == '-')
                                  total += (int)c;
                             if(c == '/')
                                  total += (int)c;
                        int hashedInt_1 = total%135;
                        hashObject1 = new HashObject(word, hashedInt_1);
                        int hashedInt_2 = total%401;
                        hashObject2 = new HashObject(word, hashedInt_2);
                        for(int j=0; j < array1.length; j++) {
                             if(j == hashedInt_1)
                                  if(array1[j] == null)
                                       array1[j] = hashObject1;
                                  else
                                       while(array1[j] != null) {
                                       j++;
                                       collision1++;
                                            if(j+1 > array1.length)
                                            j = 0;
                        for(int k=0; k < array2.length; k++) {
                             if(k == hashedInt_2)
                                  if(array2[k] == null)
                                       array2[k] = hashObject2;
                                  else
                                       while(array2[k] != null) {
                                       k++;
                                       collision2++;
                                            if(k+1 > array2.length)
                                                 k = 0;
      private static class HashObject {
                protected String hashedWord;
              protected int hashedValue;
              public HashObject(){}
              public HashObject(String s, int n) {
                   hashedWord = s;
                   hashedValue = n;
    }Also, it made me mark my instance variables as static, why is that?

    Wait a minute... I just realized that several things are awkward in your code. For example, why do you loop until you find k to be equal to the other number? Here is a revision:
                                  if(array1[hashedInt_1] == null)
                                       array1[hashedInt_1] = hashObject1;
                                  else
                                       for(int j = 0; the thing doesn't equal null; j++) {
                                       collision1++;
                                            if(j+1 == array1.length)
                                                j = -1;
                                                             //check if the array1[j] is null. If it is, then change it and break the loop
                                                             }I think the error in the circle is that you have 2 loops for no reason, and the inner loop is not doing anything - it's value doesn't reset.
    Edited by: Student_Coder on Dec 4, 2007 8:13 PM

  • Brain hurts, need help nullPointerException problems

    I've been working on this program almost 8 hours straight and have just hit my latest problem but I'm getting too tired to solve it tonight and thought someone might have some useful pointers.
    I have a screen that takes several details in text fields from the user and when the OK button is pressed does the following:
    private void okButtonActionPerformed(ActionEvent evt)
    ConfirmTitlePanel confirmTitlePanel = new ConfirmTitlePanel();
    . // Gets details from text fields here
    model.Title.newInstance( param1,
    param2,
    etc... );
    // Fetch reference to Graphical so buttons can use it to
    // display panels
    graph = model.Shop.getGraphical();
    graph.display( confirmTitlePanel );
    This displays the next panel which works fine on its own but when I add the code to get the details I've just set with newInstance, so I can display them back to the user I get a NullPointerException.
    My set code is called when initialising the panel and looks like this:
    private void
    setValues() throws NullPointerException
    model.Field[] titleDetails = model.Title.getFullDetails();
    param1.setText( titleDetails[0].asString() );
    param2.setText( titleDetails[1].asString() );
    etc...
    Seems getFullDetails is not returning anything to titleDetails. Field is an array of things. It's set up to handle int, boolean and String. The asString determines the type of titleDetails[x] and converts it to a String. It is at the point where asString is trying to convert the first parameter it is determining the object type is null.
    I'm sure the answer is simple but I'm felling a bit fried so any help would be appreciated before I start afresh tomorrow.
    Thanks in advance.
    Regards,
    Mark.

    Please help if you can. I can send the full code directly to people if they wish.
    My problem is not so much setText as the fact when I read the values in the object instance I created they are null. I've found a interesting point though. I added debug lines and found that the newInstance had the correct values and the setObject created an object that was not null.
    However the first time you submit the details when it tries to get the object it is null. However when you try and enter the details for a second time it will display the details entered on your first entry. Likewise if you went to enter a third title and put blank details in it would display the second set of details back to the user when they click OK.
    Right onto the code.
    ----Shop.class - contains
    public static Object
    getObject()
    if ( save_ == null)
    System.out.println("Return save_ but it is null");
    return save_;
    public static void
    setObject( Object save )
    save_ = save;
    if ( save == null)
    System.out.println("Just taken save but it is null");
    if ( save_ == null)
    System.out.println("Just set save_ but it is null");
    ----AddTitlePanel.class contains
    private void okButtonActionPerformed(ActionEvent evt)
    ConfirmAddTitlePanel confirmAddTitlePanel =
    new ConfirmAddTitlePanel();
    // Gets the textField values here
    model.Title mss = model.Title.newInstance( fullISBN,
    ISBN,
    title,
    author,
    copiesInStock,
    price );
    model.Shop.setObject( mss );
    // Fetch reference to Graphical so buttons can use it to
    // display panels
    graph = model.Shop.getGraphical();
    graph.display( confirmAddTitlePanel );
    This creates a newInstance of Title and creates a copy using setObject when the user clicks on "OK" button. It also calls the ConfirmAddTitlePanel.class to display the details back to the user.
    ----ConfirmAddTitlePanel.class contains:
    private void
    setValues() throws NullPointerException
    model.Title mss = (model.Title) model.Shop.getObject();
    if ( mss != null )
    model.Field[] titleDetails = mss.getFullDetails();
    //model.Field[] titleDetails = model.Title.getFullDetails();
    fullISBNTextField.setText( titleDetails[0].asString() );
    //ISBNTextField.setText( titleDetails[1].asString() );
    titleTextField.setText( titleDetails[2].asString() );
    authorTextField.setText( titleDetails[3].asString() );
    copiesInStockTextField.setText( titleDetails[4].asString() );
    priceTextField.setText( titleDetails[5].asString() );
    else
    System.out.println( "\nMSS = null" );
    This is getting the Object back that we just set and fetching its details to display to the user by populating the TextFields.
    As I say first time you enter the details and click OK it displays the above panel and outputs "MSS = null" and cannot populate the fields. When you enter the next set of title details and click "OK" getObject is no longer setting mss to null but the values fetched to set the TextFields is the data entered for the first title and not the details just entered.
    ----Title.class contains:
    public static Title
    newInstance( String fullISBN,
    String ISBN,
    String title,
    String author,
    int copiesInStock,
    int price )
    Title atitle = new Title( fullISBN,
    ISBN,
    title,
    author,
    copiesInStock,
    price );
    System.out.println("Created new object instance Title\n");
    System.out.println( "FullISBN = " + getFullISBN() );
    System.out.println( "ISBN = " + getISBN() );
    System.out.println( "Title = " + getTitle() );
    System.out.println( "Author = " + getAuthor() );
    System.out.println( "Copies = " + getCopiesInStock() );
    System.out.println( "Price = " + getPrice() );
    return atitle;
    I'm really stuck and if I solve this I should hopefully be able to make progress again. Thanks in advance.
    Mark.

  • NullPointerException with an array of LinkedList

    Hello Everybody.
    I'm new to Java and I am trying to use a quite complicated data structure but I am missing something since it does not work.
    Here comes my code:
    import java.util.LinkedList;
    class ObjectToHold {
    public int i;
    ObjectToHold (int j) {
    i=j;
    public class ModifiedArray {
    static final int ARRAY_DIMENSION = 79;
    private LinkedList[] myInternalArray;
    ModifiedArray() {
    LinkedList[] myInternalArray = new LinkedList[ARRAY_DIMENSION];
    for (int i=0;i<ARRAY_DIMENSION;i++) {
    myInternalArray[i] = new LinkedList();
    void insert (int slot, ObjectToHold a) {
    ((LinkedList)myInternalArray[slot]).addLast(a);
    public static void main(String[] args) {
    ModifiedArray myModifiedArray = new ModifiedArray();
    for (int j=0; j<ARRAY_DIMENSION;j++) {
    myModifiedArray.insert(j,new ObjectToHold(j));
    The class ModifiedArray contains a private array of LinkedList objects. I wrote an "insert" method to put objects of type ObjectToHold (which is a very simple one!) into the array.
    While compiling the code, everything works fine.
    On the other hand, when I run the compiled code I get the following run time Exception:
    Java.lang.NullPointerException
    at ModifiedArray.insert ....
    Modified.Array.main ...
    The problem must be in the way I use the reference to myInternalArray.
    I also tried
    myInternalArray[slot].addLast(a);
    instead of
    ((LinkedList)myInternalArray[slot]).addLast(a);
    but I got the same result.
    Can anybody help me or do I have to ask in some other forum?
    Thank you very much
    Tommaso

    You defined myInternalArray as local to the constructor as well as an instance variable.
    Try..
    import java.util.LinkedList;
    class ObjectToHold {
      public int i;
      ObjectToHold (int j) {
        i=j;
    public class ModifiedArray {
      static final int ARRAY_DIMENSION = 79;
      private LinkedList[] myInternalArray;
      ModifiedArray() {
        myInternalArray = new LinkedList[ARRAY_DIMENSION];
        for (int j=0; j<ARRAY_DIMENSION; j++) {
          myInternalArray[j] = new LinkedList();
      void insert (int slot, ObjectToHold a) {
        ((LinkedList)myInternalArray[slot]).addLast(a);
      public static void main(String[] args) {
        ModifiedArray myModifiedArray = new ModifiedArray();
        for (int j=0; j<ARRAY_DIMENSION;j++) {
          myModifiedArray.insert(j,new ObjectToHold(j));
    }

  • (homework) NullPointerException problem

    This is a homework problem that is asking us to go through two lists of names, find the duplicates between the two. Then we are supposed to take only the last names, sort them into ascending order and capitalize the entire name and print it. The problem is I get an NPE every time I add the following code:
    Arrays.sort(lastname);Example:
    import java.util.Arrays;
    public class NameLists2
       public static void main(String [] args)
              String [] names1 = {"Bill Board","John Smith","Smiley Faces","Hazel Nutt",
                                           "Al K Selzer","Wah Shuppe","June Schauer","Simon Sez",
                                            "Justin Time","Fast Walker","Ima Legend","Garren Teed",
                                   "Skip Roper","Hy Price","Shanda Lear","Bill Foldes",
                                    "James Bond","Stu Meat","Mike Raffone","Budd Weiser"};
            String [] names2 = {"Rick Shaw","Smiley Faces","Seymour Faces","Al K Selzer",
                                      "Sandy Beach","June Schauer","Luce Change","Mae Flowers",
                                 "Justin Time","Iona Honda","Budd Weiser","Stu Meat",
                               "Bill Board","Phil R Uppe","Bill Foldes","Ben Dover",
                                "Snough Storm","James Bond","Mike Raffone","Hazel Nutt"};
             String [] lastname = new String [20];
             int loc;
               for(int i = 0; i < names1.length; i++)
                    for(int j = 0; j < names2.length; j++)
                       if(names1.compareTo(names2[j]) == 0)
                   loc = names1[i].indexOf(' ');
                   lastname[i] = names1[i].substring(loc + 1);
                   Arrays.sort(lastname);
    System.out.println(lastname[i]);
    Exception in thread "main" java.lang.NullPointerException
         at java.lang.String.compareTo(String.java:1168)
         at java.lang.String.compareTo(String.java:92)
         at java.util.Arrays.mergeSort(Arrays.java:1144)
         at java.util.Arrays.mergeSort(Arrays.java:1155)
         at java.util.Arrays.mergeSort(Arrays.java:1155)
         at java.util.Arrays.sort(Arrays.java:1079)
         at NameLists2.main(NameLists2.java:35)
    I've read up on NPEs and I still can't figure out where I'm screwing up, any ideas?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The reason you are getting that error is because when you created the array String [] lastname = new String [20]; it makes all twenty entries equal to null therfore the method cannot sort through null entries heres what you do.
    Changes i would make
    int count=0;
    String [] lastname,temp = new String [20];
    for(int i = 0; i < names1.length; i++)
                   for(int j = 0; j < names2.length; j++)
                   if(names1.equal(names2[j]))
                   loc = names1[i].indexOf(' ');
    temp[count] = names[i].substring(loc + 1);
                   count++;
    lastname=new String [count]
    for (int x=0;x<count;x++){
    lastname[x]=temp[x];}
    Array.sort(lastname);
    for (int x=0;x<count;x++){
    System.out.println(lastname[i]);}
    Edited by: Wyatt on Feb 12, 2008 10:41 AM

  • Problem in array output, pls help!

    i made an array:
    public class Estudyante
         String studentNo;
         String studentName;
         String address;
         String phone;
         String email;
         public void displayDetails()
              System.out.println(studentNo);
              System.out.println(studentName);
              System.out.println(address);
              System.out.println(phone);
              System.out.println(email);
    public class StudentFinder
         //define the variables of the class
         Estudyante estObjects[];
         //initialize the variables
         public StudentFinder()
              //creating an array of 3 estudyantes
              estObjects = new Estudyante[3];
              //creating objects of all the three elements in an array
              for(int ctr = 0; ctr !=estObjects.length;ctr++)
                   estObjects[ctr] = new Estudyante();
              //assigning test values
              //estudyante 1 details
              estObjects[0].studentNo = "0001";
              estObjects[0].studentName = "Rez";
              estObjects[0].address = "Pasig";
              estObjects[0].phone = "111-1111";
              estObjects[0].email = "[email protected]";
              //estudyante 2 details
              estObjects[1].studentNo = "0002";
              estObjects[1].studentName = "Reza";
              estObjects[1].address = "Manila";
              estObjects[1].phone = "222-2222";
              estObjects[1].email = "[email protected]";
              //estudyante 3 details
              estObjects[2].studentNo = "0003";
              estObjects[2].studentName = "Reza Ric";
              estObjects[2].address = "Malate";
              estObjects[2].phone = "333-3333";
              estObjects[2].email = "[email protected]";
         //declare the method of the class
         public void displayFinder()
              //add the code for displaying estudyante details
              for (int ctr = 0;ctr != estObjects.length;ctr++)
                   estObjects[ctr].displayDetails();
                   //the displayDetails() method is present in the Estudyante class
         //code the main() method
         public static void main(String args[])
              StudentFinder finderObject;
              finderObject = new StudentFinder();
              finderObject.displayFinder();
    problem:
    when i run this in command prompt, it displays all the 3 sets of details
    question:
    how will i display the set of details i want and not all of them?
    eg: i only want the details of studentNo = "0001"
    so in command prompt i execute
    java StudentFinder 0001
    how will i be able to get the details for studentNo = "0001" only and how will i display "No such student" if the studentNo asked for is not in any of the details.

    Hi KikiMon,
    In your displayFinder() method you'll have to take an argument, specifying which Student to display. Like this:
    public void displayFinder(String target)
    for (int ctr = 0;ctr != estObjects.length;ctr++)
    if(estObjects[ctr].studentNo.equals(target)) {
    estObjects[ctr].displayDetails();
    An in your main you'll have to forward a commandline argument like this:
    public static void main(String args[])
    StudentFinder finderObject;
    finderObject = new StudentFinder();
    finderObject.displayFinder(args[0]);
    Later,
    Klaus

  • Java.lang.NullPointerException problem after installation

    Dear all,
    after i install the EP6.0 SP9 on AIX 5.3 ORACLE 9.2 ,when i want to create role ,i hit the IE error message like "operation aborted" .in the log viewer i found the error
    Time : 16:26:50:119
    Category : /System/Server
    Date : 06/22/2005
    Message :  [com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorCompContextHandler] getPriority() failed
    [EXCEPTION]
    java.lang.NullPointerException
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJndi.getPriority(RoleEditorJndi.java:1622)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJsTree.createTreeNode(RoleEditorJsTree.java:784)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJsTree.getChildTreeNodes(RoleEditorJsTree.java:646)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJsTree.createJScriptTree(RoleEditorJsTree.java:96)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJsTree.createJScriptTree(RoleEditorJsTree.java:106)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorJsTree.buildRoleEditorJsTree(RoleEditorJsTree.java:56)
    at com.sapportals.portal.pcd.admintools.roleeditor.misc.RoleEditorPage2.createContentStudioPage2(RoleEditorPage2.java:1501)
    at com.sapportals.portal.pcd.admintools.roleeditor.misc.RoleEditorPage2.createPage2(RoleEditorPage2.java:1425)
    at com.sapportals.portal.pcd.admintools.roleeditor.RoleEditorMain.doContent(RoleEditorMain.java:129)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
    at java.security.AccessController.doPrivileged1(Native Method)
    it seems to be java problem ,anybody could give some suggestion?thanks

    Hi,
    I have similar problem.
    If you have solved this issue please let me know how.
    Thanks
    Arun

  • NullPointerException problem when  deploying hello1 example.

    I am running Sun AppServer Edition 8.0 on Windows 2000 platform. When I
    executed asant build command, Build Successful message was displayed.
    To configure the Web application, I followed the steps outlined on how
    to package the application using the deploytool in Chapter 3 of the
    tutorial. Again I used the steps outlined on how to deploy the
    packaged web module using the deploytool to deploy the application
    on the Sun AppServer. However the deployment failed with
    NullPointerException message.
    Here is a listing of the error message:
    DetailsTimestamp:Nov 30, 2004 08:13:41.174
    Log Level: WARNING
    Logger:javax.enterprise.system.tools.admin
    Name-Value Pairs:_ThreadID=11;
    Record Number:106
    Message ID:ADM1026
    Complete Message
    Redeployment failed - Detailed Message:java.lang.NullPointerException     at
    com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.getHostName(ApplicationsConfigMBean.java:3045)     at
    com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.setHostAndPort(ApplicationsConfigMBean.java:3038)     at
    com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:274)     at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     at
    java.lang.reflect.Method.invoke(Method.java:324)     at
    com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:287)     at
    com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:280)     at
    com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)     at
    com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)     at
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)     at
    com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)     at
    sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)     at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     at
    java.lang.reflect.Method.invoke(Method.java:324)     at
    com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)     at $Proxy1.invoke(Unknown Source)     at
    com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)     at
    com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)     at
    com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)     at
    com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:
    69)     at
    com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)     at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:768)     at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:861)     at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown
    Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     at
    java.lang.reflect.Method.invoke(Method.java:324)     at
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)     at
    java.security.AccessController.doPrivileged(Native Method)     at
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)     at
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)     at
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)     at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)     at
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)     at
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)     at
    java.security.AccessController.doPrivileged(Native Method)     at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)     at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)     at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)     at
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)     at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)     at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:583)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)     at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)     at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)     at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)     at
    com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)     at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)     at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)     at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)     at
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)     at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)     at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)     at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)     at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)     at
    java.lang.Thread.run(Thread.java:534)
    Here is the output from asant listprops command.
    Buildfile: build.xml
    listprops:
    [echo] Path information
    [echo] j2ee.home = C:/Sun/AppServer
    [echo] env.Path = .;
    c:\oracle\ora92\bin;
    c:\oracle\ora92\sqlj\bin;
    C:\Program Files\Oracle\jre\1.3.1\bin;
    C:\Program Files\Oracle\jre\1.1.8\bin;
    C:\Ant\apache-ant-1.6.2\bin;
    C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Microsoft SQL
    Server\80\Tools\Binn\;
    c:\mysql\bin;
    c:\j2sdk1.4.2_06\bin;
    c:\Sun\AppServer\bin;
    c:\Sun\AppServer\bin;c:\Sun\AppServer\jdk\bin;
    C:\Documents and Settings\sam darko\jwsdp-1.1\jwsdp-shared\bin;
    C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;
    C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual
    Studio\Common\Tools;
    C:\Program Files\Microsoft Visual Studio\VC98\bin;
    C:\Program Files\MSXML 4.0;
    C:\Ant\apache-ant-1.6.2\bin;
    c:\mysql\bin;
    c:\bea\weblogic81\server\bin;
    C:\;
    C:\ERCDTMP;C:\ERCDTMP\BIN;C:\ERCDTMP\TOOLS\PT1
    [echo] env.PATH = ${env.PATH}
    [echo] Classpath information
    [echo] classpath = .;
    c:\Sun\AppServer\lib\j2ee.jar;
    c:\Sun\AppServer\jdk\lib\tools.jar;
    C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;
    c:\bea\weblogic81\server\lib\weblogic_sp.jar;
    c:\bea\weblogic81\server\lib\weblogic.jar;
    C:\jakarta-struts-1.1\lib\struts.jar;
    c:\JSTL1.1\jstl-1.1.2\lib\jstl.jar;
    c:\JSTL1.1\jstl-1.1.2\lib\standard.jar
    [echo] Admin information
    [echo] admin.password = ${admin.password}
    [echo] admin.host = localhost
    [echo] admin.user = admin
    [echo] admin.port = 4848
    [echo] https.port = 8090
    [echo] Domain information
    [echo] domain.resources = "domain.resources"
    [echo] domain.resources.port = 8091
    [echo] Database information
    [echo] db.root = C:/Sun/AppServer/pointbase
    [echo] db.driver = com.pointbase.jdbc.jdbcUniversalDriver
    [echo] db.host = localhost
    [echo] db.port = 9092
    [echo] db.sid = sun-appserv-samples
    [echo] db.url = jdbc:pointbase:server://localhost:9092/sun-appserv-samples
    [echo] db.user = pbpublic
    [echo] db.pwd = pbpublic
    [echo] url.prop = DatabaseName
    [echo] ds.class = com.pointbase.jdbc.jdbcDataSource
    [echo] db.jvmargs = -ms16m -mx32m
    BUILD SUCCESSFUL
    Total time: 5 seconds

    I just ran the hello1 example on a Win2K system from the command line without seeing the problems that you encountered. I am running a later version of the Application Server than you are (8.1 PE vs. 8.0) and am using the tutorial sources that were designed to be used with that version of the tutorial:
    - Use Update 3 version of the tutorial with Application Server 8.1
    - Use Update 2 version of the tutorial with Application Server 8.0 Update 1
    I haven't tried it with deploytool yet, but built, packaged, and deployed using the asant instructions, as follows.
    1. Start the Application Server.
    2. In a terminal window, change to the j2eetutorial14/examples/web/hello1 directory.
    3. Build the example: asant build
    4. Package the example: asant create-war
    5. Deploy the example: asant deploy-war
    6. In your browser, go to http://localhost:8080/hello1and enter your name.
    If you do this do you see the same problem? If you do, where do you encounter that problem? On deployment?
    In the meantime, I'll try to package and deploy with deploytool and report back with my results.
    Hope this helps.
    ~Eric

  • A basic question/problem with array element as undefined

    Hello everybody,
    thank you for looking at my problem. I'm very new to scripting and javaScript and I've encountered a strange problem. I'm always trying to solve all my problem myself, with documentation (it help to learn) or in the last instance with help of google. But in this case I am stuck. I'm sure its something very simple and elementary.
    Here I have a code which simply loads a text file (txt), loads the content of the file in to a "var content". This text file contents a font family name, each name on a separate line, like:
    Albertus
    Antenna
    Antique
    Arial
    Arimo
    Avant
    Barber1
    Barber2
    Barber3
    Barber4
    Birch
    Blackoak ...etc
    Now, I loop trough the content variable, extract each letter and add it to the "fontList[i]" array. If the character is a line break the fontList[i] array adds another element (i = i + 1); That's how I separate every single name into its own array element;
    The problem which I am having is, when I loop trough the fontList array and $.writeln(fontList[i]) the result in the console is:
    undefinedAlbertus
    undefinedAntenna
    undefinedAntique
    undefinedArial ...etc.
    I seriously don't get it, where the undefined is coming from? As far as I have tested each digit being added into the array element, I can't see anything out of ordinary.
    Here is my code:
    #target illustrator
    var doc = app.documents.add();
    //open file
    var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");
    var openFile = myFile.open("r");
    //check if open
    if(openFile == true){
        $.writeln("The file has loaded")}
    else {$.writeln("The file did not load, check the name or the path");}
    //load the file content into a variable
    var content = myFile.read();
    myFile.close();
    var ch;
    var x = 0;
    var fontList = [];
    for (var i = 0; i < content.length; i++) {
        ch = content.charAt (i);
            if((ch) !== (String.fromCharCode(10))) {
                fontList[x] += ch;
            else {
                x ++;
    for ( i = 0; i < fontList.length; i++) {
       $.writeln(fontList[i]);
    doc.close (SaveOptions.DONOTSAVECHANGES);
    Thank you for any help or explanation. If you have any advice on how to improve my practices or any hint, please feel free to say. Thank you

    CarlosCantos wrote an amazing script a while back (2013) that may help you in your endeavor. Below is his code, I had nothing to do with this other then give him praise and I hope it doesn't offend him since it was pasted on the forums here.
    This has helped me do something similar to what your doing.
    Thanks again CarlosCanto
    // script.name = fontList.jsx;
    // script.description = creates a document and makes a list of all fonts seen by Illustrator;
    // script.requirements = none; // runs on CS4 and newer;
    // script.parent = CarlosCanto // 02/17/2013;
    // script.elegant = false;
    #target illustrator
    var edgeSpacing = 10;
    var columnSpacing = 195;
    var docPreset = new DocumentPreset;
    docPreset.width = 800;
    docPreset.height = 600;
    var idoc = documents.addDocument(DocumentColorSpace.CMYK, docPreset);
    var x = edgeSpacing;
    var yyy = (idoc.height - edgeSpacing);
    var fontCount = textFonts.length;
    var col = 1;
    var ABcount = 1;
    for(var i=0; i<fontCount; i++) {
        sFontName = textFonts[i].name;
        var itext = idoc.textFrames.add();
        itext.textRange.characterAttributes.size = 12;
        itext.contents = sFontName;
        //$.writeln(yyy);
        itext.top = yyy;
        itext.left = x;
        itext.textRange.characterAttributes.textFont = textFonts.getByName(textFonts[i].name);
        // check wether the text frame will go off the bottom edge of the document
        if( (yyy-=(itext.height)) <= 20 ) {
            yyy = (idoc.height - edgeSpacing);
            x += columnSpacing;
            col++;
            if (col>4) {
                var ab = idoc.artboards[ABcount-1].artboardRect;
                var abtop = ab[1];
                var ableft = ab[0];
                var abright = ab[2];
                var abbottom = ab[3];
                var ntop = abtop;
                var nleft = abright+edgeSpacing;
                var nbottom = abbottom;
                var nright = abright-ableft+nleft;
                var abRect = [nleft, ntop, nright, nbottom];
                var newAb = idoc.artboards.add(abRect);
                x = nleft+edgeSpacing;
                ABcount++;
                col=1;
        //else yyy-=(itext.height);

  • HP Proliant ML350G4 server - problem with array

    Hi, I have HP Proliant ML350 G4 server. The problem is that I can not configure the array for SCSI hard drives. When I run the Array Configuration Utility from the SmartStart CD, I get the message: "ACU did not detect any supported controllers in your system." How do I solve this problem?

    Hi:
    You may also want to post your question on the HP Business Support Forum -- ML Servers section.
    http://h30499.www3.hp.com/t5/ProLiant-Servers-ML-DL-SL/bd-p/itrc-264#.U48mculOW9I

  • Problems binding array in C# to stored procedure.

    I'm having trouble trying to pass an array of ID's to a stored procedure that is expecting an array (listed the procedure definition below). My current interface doesn't return an error, but it also doesn't insert the proper id's.
    STORED PROCEDURE DEFINITION:
    TYPE source_ids IS TABLE OF wweb.DM_ASSOCIATIONS.source_id%TYPE INDEX BY PLS_INTEGER;
    PROCEDURE add_message_associations
    (p_dm_message_id IN wweb.dm_messages.dm_message_id%TYPE
    ,p_association_type IN wweb.dm_associations.association_type%TYPE
    ,p_sources IN source_ids
    ,p_create_user IN wweb.dm_associations.create_user%TYPE)
    .......variable definitions here...
    v_source_id := p_sources.First;
    WHILE v_source_id IS NOT NULL
    LOOP
    -- Check if this association already exists.
    -- If not add them.
    v_assoc_exists := 0;
    FOR r_chk IN
    (SELECT 1 AS assoc_exists_flag
    FROM dm_associations a
    WHERE a.dm_message_id = p_dm_message_id
    AND a.association_type = p_association_type
    AND a.source_id = v_source_id)
    LOOP
    v_assoc_exists := r_chk.assoc_exists_flag;
    END LOOP;
    IF v_assoc_exists = 0 THEN
    -- Add the association
    INSERT INTO wweb.dm_associations
    (dm_association_id
    ,dm_message_id
    ,association_type
    ,source_id
    ,source_column_name
    ,active_flag
    ,create_date
    ,create_user
    ,last_update_date
    ,last_update_user)
    VALUES
    (wweb.dm_associations_s.NEXTVAL
    ,p_dm_message_id
    ,p_association_type
    ,v_source_id
    ,v_source_column_name
    ,1
    ,SYSDATE
    ,p_create_user
    ,SYSDATE
    ,p_create_user);
    END IF;
    .......error handling here...
    C# CODE:
    OracleParameter[] param = new OracleParameter[4];
    param[0] = new OracleParameter("p_dm_message_id", OracleDbType.Long);
    param[1] = new OracleParameter("p_association_type", OracleDbType.Varchar2, 5);
    param[2] = new OracleParameter("p_sources", OracleDbType.Int32);
    param[3] = new OracleParameter("p_create_user", OracleDbType.Varchar2, 25);
    param[0].Value = 1;
    param[1].Value = "ER";
    param[2].Value = new Int32 [] {1, 172, 412, 7953};
    param[3].Value = "SVC-GDESAI";
    param[2].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    param[2].Size = 4;
    param[2].ArrayBindStatus = new OracleParameterStatus[4]{OracleParameterStatus.Success, OracleParameterStatus.Success, OracleParameterStatus.Success, OracleParameterStatus.Success};
    cn = new OracleConnection(ConnectionString);
    cn.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = cn;
    cmd.CommandText= "dynamic_messages_api.add_message_associations";
    cmd.CommandType= CommandType.StoredProcedure;
    foreach (OracleParameter p in param)
    if ((p.Direction == ParameterDirection.InputOutput || p.Direction == ParameterDirection.Input) && (p.Value == null || p.Value.ToString() == ""))
    p.Value = DBNull.Value;
    cmd.Parameters.Add(p);
    cmd.ExecuteNonQuery();
    This ran fine, and created four rows in the table, but the source id's were (1, 2, 3, 4) instead of (1, 172, 412, 7953) which were the ones I passed in.
    Does anyone know what I'm doing wrong here?
    Thanks,
    Gauranga

    Hi,
    I think you have a problem in you PL/SQL procedure. When you receive an array in the procedure, it is your responsibility to parse it explicitely with a loop or to bulk insert with a "forall" (implicit).
    For instance, here is an example of a procedure of mine. I don't catch exceptions as I want the C# calling code to know about them:
    The type t_* are defined like yours.
    procedure UpdateDistribDates(p_bannerid in t_bannerid,
    p_promonumber in t_promonumber,
    p_datenumber in t_datenumber,
    p_actualdate in t_actualdate ) is
    BEGIN
    -- First delete the existing dates in bulk
    FORALL I IN P_BANNERID.FIRST..P_BANNERID.LAST
    DELETE FROM PROMODISTRIBDATE
    WHERE BANNERID = P_BANNERID(I)
    AND PROMONUMBER = P_PROMONUMBER(I);
    -- Then, insert the values passed in arrays.
    FORALL I IN P_BANNERID.FIRST..P_BANNERID.LAST
    INSERT INTO PROMODISTRIBDATE
    (BANNERID,
    PROMONUMBER,
    DATENUMBER,
    ACTUALDATE)
    VALUES (P_BANNERID(I),
    P_PROMONUMBER(I),
    P_DATENUMBER(I),
    P_ACTUALDATE(I));
    END;
    As you can see, the FORALL keyword will process the arrays passed as any other PL/SQL array in one chunk.
    When you do the insert like:
    INSERT INTO wweb.dm_associations
    (dm_association_id
    ,dm_message_id
    ,association_type
    ,source_id
    ,source_column_name
    ,active_flag
    ,create_date
    ,create_user
    ,last_update_date
    ,last_update_user)
    VALUES
    (wweb.dm_associations_s.NEXTVAL
    ,p_dm_message_id
    ,p_association_type
    ,v_source_id
    ,v_source_column_name
    ,1
    ,SYSDATE
    ,p_create_user
    ,SYSDATE
    ,p_create_user);
    In source_id, you insert the index of the table, not the value of the field.
    I would suggest you completely rewrite this procedure by using the explicit loop like this:
    1/ Explicit loop
    FOR i IN 1 .. p_sources.COUNT LOOP
    -- Check the existence
    EXIST_FLAG := 0;
    BEGIN
    SELECT 1
    INTO EXIST_FLAG
    FROM ...
    WHERE ...
    AND a.source_id = p_source(i) <-- You are parsing here
    AND ...
    EXCEPTION
    WHEN OTHERS THEN -- Nothing was found
    EXIST_FLAG := 0;
    END;
    IF (EXIST_FLAG = 1)
    INSERT INTO wweb.dm_associations
    (dm_association_id
    ,dm_message_id
    ,association_type
    ,source_id
    ,source_column_name
    ,active_flag
    ,create_date
    ,create_user
    ,last_update_date
    ,last_update_user)
    VALUES
    (wweb.dm_associations_s.NEXTVAL
    ,p_dm_message_id
    ,p_association_type
    ,p_source(i) <-- You parse here
    END IF;
    END LOOP;
    2/ Implicit loop and bulk insert
    You would need to completely review the logic and build an array that maps exactly the row of the table you are trying to insert into. Parse the array and check for the existence of your entry, delete the row in memory when not found, then, after the loop do a bulk insert with a "forall".
    Hope it helps,
    Patrice

  • URGENT: Problem sending array of complex type data to webservice.

    Hi,
    I am writing an application in WebDynpo which needs to call External web service. This service has many complex data types. The function which I am trying to access needs some Complex data type array. When i checked the SOAP request i found that the namespace for the array type is getting blank values. Because of which SOAP response is giving exception.
    The SOAP request is as below. For the <maker> which is an array ,the xmlns:tns='' is generated.
    <mapImageOptions xsi:type='tns:MapImageOptions' xmlns:tns='http://www.themindelectric.com/package/com.esri.is.services.glue.v2.mapimage/'>
    <dataSource xsi:type='xs:string'>GDT.Streets.US</dataSource>
    <mapImageSize xsi:type='tns:MapImageSize'><width xsi:type='xs:int'>380</width><height xsi:type='xs:int'>500</height></mapImageSize>
    <mapImageFormat xsi:type='xs:string'>gif</mapImageFormat>
    <backgroundColor xsi:type='xs:string'>255,255,255</backgroundColor>
    <outputCoordSys xsi:type='tns:CoordinateSystem' xmlns:tns='http://www.themindelectric.com/package/com.esri.is.services.common.v2.geom/'>
    <projection xsi:type='xs:string'>4269</projection>
    <datumTransformation xsi:type='xs:string'>dx</datumTransformation>
    </outputCoordSys>
    <drawScaleBar xsi:type='xs:boolean'>false</drawScaleBar>
    <scaleBarPixelLocation xsi:nil='true' xsi:type='tns:PixelCoord'></scaleBarPixelLocation>
    <returnLegend xsi:type='xs:boolean'>false</returnLegend>
    <markers ns2:arrayType='tns:MarkerDescription[1]' xmlns:tns='' xmlns:ns2='http://schemas.xmlsoap.org/soap/encoding/'>
    <item xsi:type='tns:MarkerDescription'><name xsi:type='xs:string'></name>
    <iconDataSource xsi:type='xs:string'></iconDataSource><color xsi:type='xs:string'></color>
    <label xsi:type='xs:string'></label>
    <labelDescription xsi:nil='true' xsi:type='tns:LabelDescription'>
    </labelDescription><location xsi:type='tns:Point' xmlns:tns='http://www.themindelectric.com/package/com.esri.is.services.common.v2.geom/'>
    <x xsi:type='xs:double'>33.67</x><y xsi:type='xs:double'>39.44</y>
    <coordinateSystem xsi:type='tns:CoordinateSystem'>
    <projection xsi:type='xs:string'>4269</projection>
    <datumTransformation xsi:type='xs:string'>dx</datumTransformation>
    </coordinateSystem></location></item>
    </markers><lines xsi:nil='true'>
    </lines><polygons xsi:nil='true'></polygons><circles xsi:nil='true'></circles><displayLayers xsi:nil='true'></displayLayers>
    </mapImageOptions>
    Another problem:
    If the webservice is having overloaded methods , it is generating error for the second overloaded method.The stub file itself contains statment as follow:
    Response = new();
    can anyone guide me on this?
    Thanks,
    Mital.

    I am having this issue as well.
    From:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/ce993b45cb0a85e10000000a1553f6/frameset.htm
    I see that:
    The WSDL document in rpc-style format must also not use any soapenc:Array types; these are often used in SOAP code in documents with this format. soapenc:Array uses the tag <xsd:any>, which the Integration Builder editors or proxy generation either ignore or do not support.
    You can replace soapenc:Array types with an equivalent <sequence>; see the WS-I  example under http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16556272.
    They give an example of what to use instead.
    Of course I have been given a WSDL that has a message I need to map to that uses the enc:Array.
    Has anyone else had this issue?  I need to map to a SOAP message to send to an external party.  I don't know what they are willing to change to support what I can do.  I changed the WSDL to use a sequence as below just to pull it in for now.
    Thanks,
    Eric

  • Output problem in array, code included.

    Been hacking away at a starting java class for a few months now, and never had to resort to asking you guys for help.
    However, i missed class all week due to work conflicts, so i couldn't question my professor on this problem. Oddly, the actual array bits i'm fine with, but the output has me stalled.
    The program is ment to square the numbers 1-10, and then it wants me to output the square and the original number on the same line (It also wanted me to use Math.pow to get the squares, but that gave me a whole slew of syntax errors i couldn't figure out, so i did it the easy way).
    I'm not sure how to do this, have tried quite a few things, but i'm fairly certain i'm just missing something obvious, any tips would be helpful.
    import javax.swing.*;
    public class J6E1 {
       public static void main( String args[] )
          int []  Data = new int [11];
          for (int x=1; x<Data.length; x++)
              Data[x]  =  (x*x);
          for  (int x=1; x<Data.length;x++)
                   System.out.println(Data[x] );
          System.exit(0);
    }

    So for a given x, you have stored x*x value in Data[x].
    What about printing both x and Data[x] then?

Maybe you are looking for