I am passing two string arguments to the applet SurfCore.class through a cgi script. Please check wheter this is the right way to do it. All HTML code is in the proper tag . I could not keep it this way as its not allowed on the forum due to a security issue -------------------------------------------------------------------------- print <<ENDF6;
print <<END9; ">/applet /body /html END9 --------------------------------------------------------------------------- I am getting an error which looks like this
java.lang.NullPointerException at SurfCore.init(SurfCore.java:106) at sun.applet.AppletPanel.run(AppletPanel.java:380) at java.lang.Thread.run(Thread.java:595) --------------------------------------------------------------------------- Finally this is the Java File. The error is originating at line 106 which I have commented in the code as //LINE 106: Error It just shows that second argument is not getting passed properly...
import java.awt.*; import java.applet.*; import java.awt.event.*; public class SurfCore extends Applet {
Image purdue; Image router1; Image router2; Font bigFont;
String foo; String foo2;
int size; // counting the no. of vlan# int size2; // counting the no. of vlan# int bsize; int bsize2;
int i = 0; // for iteration int p = 0; int w = 0; int n = 0; int s = 0; int m = 0; int m2= 0; int k = 0; int l = 0; int j = 0; int h = 0; int v = 0; int q = 0;
int[] btest_des_cord=new int[3]; // integer forms int[] btest_des_cord2=new int[3]; // integer forms
// The colors you will use Color redColor; Color greenColor; Color blackColor; Color orangeColor; Color blueColor;
public void init()
{ bigFont = new Font("Arial",Font.BOLD,13);
// Standard colors can be named like this redColor = Color.red; blackColor = Color.black; orangeColor = Color.orange; blueColor = Color.blue; greenColor = Color.green; // The following 2 lines get the Purdue topology & router image
//System.out.println("Value = " + size); for (i = 0; i < size; i++) { v = 0; test2 = test[i+2+size2].split(":"); for (v = 0; v < 3; v++) { V_Array[m++] = test2[v]; } }
for (i = 0; i < bsize; i++) { v = 0; btest2 = test[i+2+bsize2].split(":"); for (v = 0; v < 3; v++) { bV_Array[m2++] = btest2[v]; } }
if (btest[(btest.length - 1)].equals("YES_MATCH")) { if (btest_des_cord[0] != 0) { g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null); } for (q = 1; q < m2; q = q + 3) { bV_cord = bV_Array[q+1].split(","); g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55, Integer.parseInt(bV_cord[1])+70); } } else { if (btest_des_cord[0] != 0) { g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null); } for (q = 1; q < m2; q = q + 3) { bV_cord = bV_Array[q+1].split(","); g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55, Integer.parseInt(bV_cord[1])+70); } if (btest_des_cord2[0] != 0) { g.drawImage(router2,btest_des_cord2[0],btest_des_cord2[1],null); } } } } // end class PurdueTopology
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
It sure looks as if neither vlan_num nor vlan_num2 could possibly be passed correctly. More interesting is what the HTML looks like that gets generated - do a "view source" in the browser, and post the full applet tag.