-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.0, 1.2.2
-
x86
-
windows_95, windows_98, windows_nt
d(disable);
trap.add(port);
close.add(exit);
menubar.add(update);
menubar.add(poll);
menubar.add(trap);
menubar.add(close);
setJMenuBar(menubar);
}
private void setTextField(){
oidvalContainer.setSize(new Dimension(400,10));
oidContainer.setSize(new Dimension(400,10));
labelContainer.add(label_oid);
oidContainer.createHorizontalGlue();
labelContainer.add(label_value);
oidContainer.add(textfield_oid);
oidContainer.add(combobox);
oidvalContainer.add(oidContainer);
oidvalContainer.createVerticalGlue();
oidvalContainer.add(textfield_value);
labelOidValContainer.add(labelContainer);
labelOidValContainer.createHorizontalGlue();
labelOidValContainer.add(oidvalContainer);
lowerRtPanel.add(labelOidValContainer);
}
private void setPanels(){
respArea.setPreferredSize(new Dimension(400,400));
textArea.setVisible(true);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setEditable(false);
areaScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
areaScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));
{
LineBorder bvl = new LineBorder(Color.black,1);
TitledBorder title = new TitledBorder(bvl,"AGENT
RESPONSE");
areaScrollPane.setBorder(title);
}
respArea.add(areaScrollPane);
lowerRtPanel.add(buttonBox);
setTextField();
{
JPanel subObjInfo = new JPanel(new GridLayout(3,2));
objInfoBox.setBackground(Color.pink);
subObjInfo.add(lType);
subObjInfo.add(type);
subObjInfo.add(lAccess);
subObjInfo.add(access);
subObjInfo.add(lHint);
subObjInfo.add(hint);
subObjInfo.setBackground(Color.lightGray);
desArea.setVisible(true);
desArea.setEditable(false);
desArea.setFont(new Font("Serif",Font.ITALIC,16));
desArea.setLineWrap(true);
desArea.setWrapStyleWord(true);
JScrollPane desScrollPane=new JScrollPane(desArea);
//desScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
);
//desScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AL
WAYS);
desScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
desScrollPane.setPreferredSize(new Dimension(200, 100));
objInfoBox.add(subObjInfo);
objInfoBox.add(desScrollPane);
lowerRtPanel.add(objInfoBox);
System.out.println("lowerRtPanel Layout is
:"+lowerRtPanel.getLayout());
}
/* Trap Bar To be Shown At the Bottom */
{
trapBar.add(trapIndLbl);
trapBar.add(trapButton);
trapButton.setAlignmentY(CENTER_ALIGNMENT);
lowerRtPanel.add(trapBar);
}
rightPanel.add(respArea);
rightPanel.createHorizontalGlue();
rightPanel.add(lowerRtPanel);
}
private void changeTrapIndicatorImg(){
if(trapIndicator)
trapIndLbl.setIcon(trapIndImg2);
else
trapIndLbl.setIcon(trapIndImg1);
}
private void resetTrap(){
trapIndicator = false;
}
static public void issuetrap(){
trapIndicator = true;
}
private void buildGUI() throws InterruptedException{
leftPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
//rightPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
leftPanel.add(scrollTree);
top.setOneTouchExpandable(true);
top.setDividerLocation(divide);
setupMenuBar();
createButton();
setPanels();
System.out.println("RightPanel Layout is :"+ rightPanel.getLayout());
getContentPane().add(top);
getContentPane().setSize(new
java.awt.Dimension(fWidth,fHeight));
createTree();
}
public static void main(String[] args) throws InterruptedException{
SnmpUI mg = new SnmpUI();
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) { }
mg.buildGUI();
mg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
mg.setSize(800,600);
mg.pack();
mg.setVisible(true);
}
}
-------------------------------------------
other two modules-----
import java.util.*;
import java.io.*;
class ObjectMapper
{
private static Properties OIDtoObject;
private static String fname ;
private static TreeMap nameToOID;
private static TreeMap oidToName;
private static TreeMap oidTotype;
private static FileInputStream in;
private static String index ;
public ObjectMapper(){
this.fname = fname;
index = new String("0");
OIDtoObject = new Properties();
nameToOID = new TreeMap();
oidTotype = new TreeMap();
oidToName = new TreeMap();
}
public void load(String fname){
try{
in = new FileInputStream(fname);
OIDtoObject.load(in);
propTohash(); // Property to hashtable
in.close();
}catch(FileNotFoundException f){
System.out.println(f.toString());
}catch(IOException i){
System.out.println(i.toString());
}
}
public static String getOID(String Name)
{
return ((String)nameToOID.get(Name)).trim();
}
public static String getType(String oid)
{
return ((String)oidTotype.get(oid)).trim();
}
private void propTohash()
{
StringTokenizer strToken ;
Enumeration enum = OIDtoObject.propertyNames(); // enumeration
of all key values
String key,prop;
while(enum.hasMoreElements())
{
key = ((String)enum.nextElement()).trim(); // get each
of the key from yhe enumeration
/*if(invalidateOID(key))
{
System.out.println("Throw exception");
}*/
prop = (String)OIDtoObject.getProperty(key); // obtain the
ObjectName & type corresponding to the OID(key)
if(prop == null){
System.out.println("Value Not found in the
property");
}
prop = prop.trim();
strToken = new StringTokenizer(prop); // store the ObjectName &
Type
while(strToken.hasMoreElements()){
try
{
prop = strToken.nextToken().trim(); //
Extract the ObjectName
nameToOID.put(prop,key); // Maintain
a hash of ObjectName, OID(key)
oidToName.put(key,prop);
prop = strToken.nextToken().trim(); //
Extract the type of Object
oidTotype.put(key,prop); // Maintain
a hash of OID and Object type(prop)
}catch(NoSuchElementException e){
System.out.println(e.toString());
}
}//end while
}
//System.out.println(" key value from nameToOID
"+nameToOID.toString());
/*Set kSet = oidToName.keySet();
Set entrySet = oidToName.entrySet();
Iterator itr = kSet.iterator();
Iterator eItr = entrySet.iterator();
while(eItr.hasNext()){
Map.Entry entry = (Map.Entry) eItr.next();
System.out.print("key:"+entry.getKey());
System.out.println(" Value:"+entry.getValue());
}*/
}
public Set getOidToNameMap(){
return oidToName.entrySet();
}
public static boolean getMatchingType(String oID)
{
Set kSet = oidTotype.keySet();
Iterator oid_s = kSet.iterator();
while(oid_s.hasNext())
{
String str = (String) oid_s.next();
str=str.trim();
if(oID.startsWith(str))
{
System.out.println("KEY mapped value "+
getType(str));
if(getType(str).equals("PHYSADDRESS"))
{
System.out.println("found "+str);
return true;
}
}
} // end of while
System.out.println("not found");
return false;
}
public static String getName(String oid)
{
String tmpOid = new String("");
int len = 0;
tmpOid = oid;
len = tmpOid.lastIndexOf('.');
while(len != -1){
tmpOid = tmpOid.substring(0,len);
if(oidToName.containsKey(tmpOid))
{
System.out.println(" i have found a matching key
");
index = (String)
oid.substring(tmpOid.length(),(oid.length()));
if(index.startsWith("."))
index = index.substring(1);
System.out.println("index :"+ index);
return ( (String) oidToName.get(tmpOid));
}
len = tmpOid.lastIndexOf('.');
}
return (null);
}
public String getIndex(){
return index;
}
} // end of class
--------------------------------------------------------
import java.util.*;
//import java.util.Iterator;
import javax.swing.tree.DefaultMutableTreeNode;
public class MibLoader extends Thread{
private DefaultMutableTreeNode top;
private ObjectMapper oMap;
private String file;
private Iterator itr;
private String grpStr;
private String subStr;
private Map.Entry tableHashEntry;
Map.Entry hashEntry ;
Map.Entry nxtHashEntry;
int len;
int debug;
static boolean flag = false;
public MibLoader(DefaultMutableTreeNode top, String name){
this.top = top;
oMap = new ObjectMapper();
file = name;
subStr = new String();
grpStr = new String();
int len = 0;
}
public void run(){
DefaultMutableTreeNode obj;
DefaultMutableTreeNode group;
flag = false;
oMap.load(file);
Set entrySet = oMap.getOidToNameMap();
itr = (Iterator) entrySet.iterator();
//System.out.println("In Thread run");
synchronized(top){
if(itr.hasNext())
top.setUserObject(new
DefaultMutableTreeNode(((Map.Entry) itr.next()).getValue()));
}
hashEntry = (Map.Entry) itr.next(); // get first group
//System.out.println("hashentry.value:"+hashEntry.getValue());
while(itr.hasNext()){
grpStr = (String) hashEntry.getKey();
// Group OID
len = grpStr.length(); //Group Length
group = new
DefaultMutableTreeNode(hashEntry.getValue()); // group inserted to tree
//System.out.println(" entering do for "+
hashEntry.getValue() +" group");
hashEntry = (Map.Entry) itr.next();// first entry from
group
//System.out.println("group Len:"+ len);
//System.out.println("NxtEntry :"+hashEntry.getValue());
debug = 0;
do{
// atleast one Group entry
//System.out.println("debug:"+debug++);
obj = new DefaultMutableTreeNode((String)
hashEntry.getValue());
if(!((oMap.getType((String)
hashEntry.getKey())).equals("NODE"))){
nxtHashEntry = (Map.Entry) itr.next();
//System.out.println("nxtHashentry.value:"+nxtHashEntry.getValue());
String tmpStr =
(String)nxtHashEntry.getKey();
subStr =
tmpStr.substring(0,tmpStr.lastIndexOf(".")); // Group element OId of len =
grpStr.length()
//System.out.println("subStr"+ subStr);
}
else{
//System.out.println("entring subtree
for "+ hashEntry.getValue() +" table");
obj.add(subtree(hashEntry));
}
hashEntry = nxtHashEntry;
group.add(obj); // add obj group;
// System.out.println("grp.equals(substr): " +
grpStr.compareTo(subStr));
}while(grpStr.equals(subStr) && itr.hasNext());
synchronized(top){
top.add(group);
}
}
synchronized(top){
setFlag(true); // Set flag indicating
completed operation
top.notifyAll();
// System.out.println("Node creation done,
...notification given to waiting thread");
}
// System.out.println("Closing Thread");
}
public DefaultMutableTreeNode subtree(Map.Entry tableHash){
DefaultMutableTreeNode tableEntry;
DefaultMutableTreeNode column;
nxtHashEntry = (Map.Entry) itr.next(); // tableEntry of Asn.1
// System.out.println("nxtHashEntry: "+
nxtHashEntry.getValue());
tableHashEntry = nxtHashEntry;
String tableEntryOid = (String)tableHashEntry.getKey(); // get
the tableEntry name
int ln = tableEntryOid.length();
// get the tableEntry length
tableEntry = new DefaultMutableTreeNode((String)
tableHashEntry.getValue());
nxtHashEntry = (Map.Entry) itr.next(); // get first column
do{
// System.out.println("debug:"+debug++);
column = new DefaultMutableTreeNode((String)
nxtHashEntry.getValue());
tableEntry.add(column);
// System.out.println("nxtHashEntry:"+
nxtHashEntry.getValue());
nxtHashEntry = (Map.Entry) itr.next();
String tmpStr = (String) nxtHashEntry.getKey();
subStr = tmpStr.substring(0,tmpStr.lastIndexOf("."));
}while(tableEntryOid.equals(subStr) && itr.hasNext());
return(tableEntry);
}
public boolean checkFlag(){
return flag;
}
public void setFlag(boolean val){
flag = true;
}
}
(Review ID: 98833)
======================================================================
Name: skT88420 Date: 08/04/99
I'm getting the following error when running a servlet, which doesn't alter
the program running. I'm running a servlet, using JSDK WebServer Version 2.1,
which creates JESS objects, an expert system package available at:
http://herzberg1.ca.sandia.gov/jess/
version 5.0a6
error:
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)'
has
occurred in :
'jess/Value.equals (Ljess/Value;)Z': Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi
It happens when the following code is invoked in the servlet:
else if ("debbie".equals(action)){
//create a fact and assert it
try{
Fact f = new Fact("user", r);
f.setSlotValue("name", new Value(action, RU.STRING));
r.assert(f);
}catch (JessException e){}
try{
//run jess r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run #2!");
}
}
Source code in it's entirety:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import jess.*;
/* *************************************
* This code is written by Debbie Lampon
*
**************************************** */
public class MyServlet extends HttpServlet {
Rete r = new Rete();
Jesp j;
ServletOutputStream out;
Reader rdr;
String clp = "testing.clp";
// invoked by the browser doing a GET
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
rdr = r.getInputRouter("t"); //set rdr to Jess's input router
//redirect Jess's output to servlet output stream
r.addOutputRouter("t", res.getWriter()); //send standard output from JESS to the servlet's output
//start command
String action = req.getParameter("action");
//if this is the "start" call from the browser
if ("start".equals(action))
{
//open Jess's script file
try{
r.executeCommand("(batch scriptlib.clp)");
}catch (JessException re){
System.out.println("Error: cannot open scriptlib!");
}
//open the .clp file
try{
rdr = new FileReader(clp);
}catch (IOException e){
rdr = null;
System.out.println("Error: cannot open file!"); }
//if there's an open .clp file, parse it
if (rdr != null){
j = new Jesp(rdr, r);
try{
//false because true would printout the "prompt" in Jess
j.parse(false);
}catch (JessException e){
System.out.println("Error: cannot parse file!");
}
try{
//run jess
r.executeCommand("(reset)"); r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run!");
}
}
}
else if ("debbie".equals(action)){
//create a fact and assert it
try{
Fact f = new Fact("user", r);
f.setSlotValue("name", new Value(action, RU.STRING));
r.assert(f);
}catch (JessException e){}
try{
//run jess
r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run #2!");
}
}
else out.println("End I'm afraid!");
}
/**
* We are going to perform the same operations for POST requests
* as for GET methods, so this method just sends the request to
* the doGet method.
*/
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
doGet(req, res);
}
}
(Review ID: 93496)
======================================================================
Name: skT88420 Date: 09/29/99
=20
C:\home\JAVA>del PedidosCopiasProgramas\*.class
C:\home\JAVA>javac PedidosCopiasProgramas/PedidosCopiasProgramas.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)=
' has
occurred in :
'sun/tools/java/ClassDefinition.matchMethod (Lsun/tools/java/Environment;=
Lsun/
tools/java/ClassDefinition;Lsun/tools/java/Identifier;[Lsun/tools/java/Type=
;ZLsu
n/tools/java/Identifier;)Lsun/tools/java/MemberDefinition;': Interpreting m=
ethod
.
Please report this error in detail to http://java.sun.com/cgi-bin/bugrepo=
rt.cgi
(Review ID: 95879)
======================================================================
Name: skT88420 Date: 11/08/99
JPad 3.6 Build 280
Compiling the following:
import java.awt.*;
import java.awt.event.*;
//import javax.swing.*;
public class Life extends java.applet.Applet
{ Button button = new Button("Next Generation");
Panel panel = new Panel();
Container c;
GridLayout grid1 = new GridLayout(10, 10);
GridLayout grid2 = new GridLayout (8,8);
Checkbox check[] [];
public void init()
{ setSize(400, 400);
panel.setLayout(grid1);
for(int i = 0; i < 10; i++)
for(int j = 0; j < 10; j++)
{ check[i][j] = new Checkbox();
panel.add(check[i] [j]);
}
c.add(panel);
panel.add(button);
}
}
Compiling A:\Life.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
occurred in :
'sun/tools/java/ClassDefinition.inSamePackage (Lsun/tools/java/Identifier;)Z':
Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi
Finished
(Review ID: 97578)
======================================================================
Name: skT88420 Date: 11/23/99
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
This was the bug which i encounetered while compiling my program.I missed the
top line of error.
occurred in :
'java/lang/String.getChars (II[CI)V': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
i
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
occurred in :
'java/io/BufferedReader.readLine (Z)Ljava/lang/String;': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
i
persistentcounter.java:13: ';' expected.
BufferedReader bufferesreader = new BufferedReader(filereader)
^
1 error
The buggy code is as follows ::
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class persistentcounter extends HttpServlet
{
int count = 0;
public void init(ServletConfig config) throws ServletException
{
super.init(config);
try
{
FileReader filereader = new filereader("persistentcounter.initial");
BufferedReader bufferesreader = new BufferedReader(filereader)
String initial = bufferesreader.readLine();
count = Integer.parseInt(initial);
return;
} catch(FileNotFoundException ignored) {}
catch(IOException ignored) {}
catch(NumberFormatException ignored) {}
String initial = getInitParameter("initial");
try
{
count = Integer.parseInt(initial);
return;
} catch (NumberFormatException ignored) {}
count = 0;
}
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
count++;
out.println("It has been accessed " + count + "times");
}
public void destroy()
{
savestate();
}
public void savestate()
{
try
{
FileWriter filewriter = new FileWriter("persistentcounter.initial");
String initial = Integer.toString(count);
filewriter.write(initial,0,initial.length());
fileWriter.close();
return;
}catch (IOException e)
{
}
}
}
This error was reported by compiler only once. Second time when i compiled my
program It simply gave me a single error. I think some exception was raised
while parsing the code.
I was just trying to catch the erros reported by compiler by playing with these
lines of code, may be the exception was raised as i have used wrong
constructors for FileReader.
(Review ID: 98171)
======================================================================
Name: skT88420 Date: 12/09/99
C:\Vijay\Java\SNMP project\ui>javac SnmpUI.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' ha
occurred in :
'sun/tools/java/Parser.parseStatement ()Lsun/tools/tree/Statement;': Interpre
ing method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.c
i
Error detected while Compiling.
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JButton;
import javax.swing.JTree;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JFrame;
import javax.swing.BorderFactory;
import javax.swing.WindowConstants;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JViewport;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JToolBar;
import javax.swing.event.*;
import javax.swing.UIManager;
import javax.swing.BoxLayout;
import javax.swing.Box;
import javax.swing.BorderFactory.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
//import java.util.*;
public class SnmpUI extends JFrame {
final int divide = 250;
final int fWidth = 800;
final int fHeight = 600;
private JSplitPane top;
private JPanel leftPanel;
private Box rightPanel;
private Box oidContainer;
private Box valContainer;
private Box oidvalContainer;
private Box labelContainer;
private Box labelOidValContainer;
private Box objInfoBox;
private JTree tree;
private JScrollPane scrollTree;
private JViewport colHeader;
private JLabel colLabel;
private DefaultMutableTreeNode node;
private Box buttonBox;
private JPanel respArea;
private JPanel lowerRtPanel;
private JLabel lType;
private JLabel type;
private JLabel lAccess;
private JLabel access;
private JLabel lHint;
private JLabel hint;
private JTextArea textArea;
private JScrollPane areaScrollPane ;
private JTextArea desArea;
private JTextField textfield_oid;
private JTextField textfield_value;
private JLabel label_value;
private JLabel label_oid;
private JComboBox combobox;
private JMenuBar menubar;
private JMenu update;
private JMenuItem loadAgent;
private JMenuItem loadMIB;
private JMenuItem changeAgent;
private JMenuItem changeMIB;
private JMenu poll;
private JMenuItem setInterval;
private JMenuItem setGroup;
private JMenuItem start;
private JMenuItem stop;
private JMenu trap;
private JMenuItem enable;
private JMenuItem disable;
private JMenuItem port;
private JMenu close;
private JMenuItem exit;
private JButton get;
private JButton getnext;
private JButton set;
private JButton walk;
private JButton reset;
private JToolBar trapBar;
private JButton trapButton;
private ImageIcon trapIndImg1;
private ImageIcon trapIndImg2;
private ImageIcon trapIndImg3;
private JLabel trapIndLbl;
static private boolean trapIndicator;
private MibLoader loader;
public SnmpUI(){
node = new DefaultMutableTreeNode();
loader = new MibLoader(node,"mib-2.snm");
loader.start();
scrollTree = new
JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
colHeader = new JViewport();
colLabel = new JLabel("MIB TREE VIEW");
oidContainer = new Box(BoxLayout.X_AXIS);
oidvalContainer = new Box(BoxLayout.Y_AXIS);
labelContainer = new Box(BoxLayout.Y_AXIS);
labelOidValContainer = new Box(BoxLayout.X_AXIS);
objInfoBox = new Box(BoxLayout.Y_AXIS);
respArea=new JPanel();
respArea.setLayout(new GridLayout());
lType = new JLabel("Type");
type = new JLabel("OctetString");
lAccess=new JLabel("Access");
access =new JLabel("ReadOnly");
lHint =new JLabel("Hint");
hint =new JLabel("N/A");
desArea=new JTextArea("Here de description will go");
textArea=new JTextArea("Here data to display");
areaScrollPane = new JScrollPane(textArea);
textfield_oid=new JTextField(20);
textfield_value=new JTextField(30);
label_value=new JLabel(" Value ");
label_oid=new JLabel("Object ID ");
combobox=new JComboBox();
menubar=new JMenuBar();
update=new JMenu("Update");
loadAgent=new JMenuItem("Load Agent");
loadMIB=new JMenuItem("Load MIB");
changeAgent=new JMenuItem("Change Agent");
changeMIB=new JMenuItem("Change MIB");
poll=new JMenu("Poll");
setInterval=new JMenuItem("Set Interval");
setGroup=new JMenuItem("Group");
start=new JMenuItem("Start");
stop=new JMenuItem("Stop");
trap=new JMenu("Trap");
enable=new JMenuItem("Enable");
disable=new JMenuItem("Disable");
port=new JMenuItem("Port");
close=new JMenu("Exit");
exit=new JMenuItem("Exit");
get=new JButton("GET");
getnext=new JButton("GETNEXT");
set=new JButton("SET");
walk=new JButton("WALK");
reset=new JButton("RESET");
trapBar = new JToolBar();
trapBar.setFloatable(false);
trapBar.setBorderPainted(true);
trapButton = new JButton("TRAP");
trapIndImg1 = new ImageIcon("bulb1.gif");
trapIndImg2 = new ImageIcon("bulb2.gif");
trapIndImg3 = new ImageIcon("bulb3.gif");
trapIndLbl = new JLabel(trapIndImg1);
trapIndicator = false;
buttonBox = new Box(BoxLayout.X_AXIS);
rightPanel = new Box(BoxLayout.Y_AXIS);
lowerRtPanel = new JPanel();
leftPanel=new JPanel();
rightPanel=new Box(BoxLayout.Y_AXIS);
rightPanel.setSize(new Dimension(550,550));
top = new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel);
lowerRtPanel.setLayout(new
BoxLayout(lowerRtPanel,BoxLayout.Y_AXIS));
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
private void createTree() throws InterruptedException {
colHeader.setView(colLabel);
scrollTree.setColumnHeader(colHeader);
scrollTree.setViewportBorder(BorderFactory.createEtchedBorder(Color.white,Color.
darkGray));
synchronized(node){
while(!loader.checkFlag()){
System.out.println("trying to create tree, ...
waiting for notification");
node.wait();
System.out.println("trying to create tree, ...
Got the notification");
}
tree = new JTree(node);
}
scrollTree.setViewportView(tree);
scrollTree.setMaximumSize(new Dimension(250,550));
}
void createButton(){
buttonBox.add(get);
buttonBox.add(getnext);
buttonBox.add(set);
buttonBox.add(walk);
buttonBox.add(reset);
}
void setupMenuBar(){
update.add(loadAgent);
update.add(loadMIB);
update.add(changeAgent);
update.add(changeMIB);
poll.add(setInterval);
poll.add(setGroup);
poll.add(start);
poll.add(stop);
trap.add(enable);
trap.ad
trap.add(port);
close.add(exit);
menubar.add(update);
menubar.add(poll);
menubar.add(trap);
menubar.add(close);
setJMenuBar(menubar);
}
private void setTextField(){
oidvalContainer.setSize(new Dimension(400,10));
oidContainer.setSize(new Dimension(400,10));
labelContainer.add(label_oid);
oidContainer.createHorizontalGlue();
labelContainer.add(label_value);
oidContainer.add(textfield_oid);
oidContainer.add(combobox);
oidvalContainer.add(oidContainer);
oidvalContainer.createVerticalGlue();
oidvalContainer.add(textfield_value);
labelOidValContainer.add(labelContainer);
labelOidValContainer.createHorizontalGlue();
labelOidValContainer.add(oidvalContainer);
lowerRtPanel.add(labelOidValContainer);
}
private void setPanels(){
respArea.setPreferredSize(new Dimension(400,400));
textArea.setVisible(true);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setEditable(false);
areaScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
areaScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));
{
LineBorder bvl = new LineBorder(Color.black,1);
TitledBorder title = new TitledBorder(bvl,"AGENT
RESPONSE");
areaScrollPane.setBorder(title);
}
respArea.add(areaScrollPane);
lowerRtPanel.add(buttonBox);
setTextField();
{
JPanel subObjInfo = new JPanel(new GridLayout(3,2));
objInfoBox.setBackground(Color.pink);
subObjInfo.add(lType);
subObjInfo.add(type);
subObjInfo.add(lAccess);
subObjInfo.add(access);
subObjInfo.add(lHint);
subObjInfo.add(hint);
subObjInfo.setBackground(Color.lightGray);
desArea.setVisible(true);
desArea.setEditable(false);
desArea.setFont(new Font("Serif",Font.ITALIC,16));
desArea.setLineWrap(true);
desArea.setWrapStyleWord(true);
JScrollPane desScrollPane=new JScrollPane(desArea);
//desScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
);
//desScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AL
WAYS);
desScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
desScrollPane.setPreferredSize(new Dimension(200, 100));
objInfoBox.add(subObjInfo);
objInfoBox.add(desScrollPane);
lowerRtPanel.add(objInfoBox);
System.out.println("lowerRtPanel Layout is
:"+lowerRtPanel.getLayout());
}
/* Trap Bar To be Shown At the Bottom */
{
trapBar.add(trapIndLbl);
trapBar.add(trapButton);
trapButton.setAlignmentY(CENTER_ALIGNMENT);
lowerRtPanel.add(trapBar);
}
rightPanel.add(respArea);
rightPanel.createHorizontalGlue();
rightPanel.add(lowerRtPanel);
}
private void changeTrapIndicatorImg(){
if(trapIndicator)
trapIndLbl.setIcon(trapIndImg2);
else
trapIndLbl.setIcon(trapIndImg1);
}
private void resetTrap(){
trapIndicator = false;
}
static public void issuetrap(){
trapIndicator = true;
}
private void buildGUI() throws InterruptedException{
leftPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
//rightPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
leftPanel.add(scrollTree);
top.setOneTouchExpandable(true);
top.setDividerLocation(divide);
setupMenuBar();
createButton();
setPanels();
System.out.println("RightPanel Layout is :"+ rightPanel.getLayout());
getContentPane().add(top);
getContentPane().setSize(new
java.awt.Dimension(fWidth,fHeight));
createTree();
}
public static void main(String[] args) throws InterruptedException{
SnmpUI mg = new SnmpUI();
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) { }
mg.buildGUI();
mg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
mg.setSize(800,600);
mg.pack();
mg.setVisible(true);
}
}
-------------------------------------------
other two modules-----
import java.util.*;
import java.io.*;
class ObjectMapper
{
private static Properties OIDtoObject;
private static String fname ;
private static TreeMap nameToOID;
private static TreeMap oidToName;
private static TreeMap oidTotype;
private static FileInputStream in;
private static String index ;
public ObjectMapper(){
this.fname = fname;
index = new String("0");
OIDtoObject = new Properties();
nameToOID = new TreeMap();
oidTotype = new TreeMap();
oidToName = new TreeMap();
}
public void load(String fname){
try{
in = new FileInputStream(fname);
OIDtoObject.load(in);
propTohash(); // Property to hashtable
in.close();
}catch(FileNotFoundException f){
System.out.println(f.toString());
}catch(IOException i){
System.out.println(i.toString());
}
}
public static String getOID(String Name)
{
return ((String)nameToOID.get(Name)).trim();
}
public static String getType(String oid)
{
return ((String)oidTotype.get(oid)).trim();
}
private void propTohash()
{
StringTokenizer strToken ;
Enumeration enum = OIDtoObject.propertyNames(); // enumeration
of all key values
String key,prop;
while(enum.hasMoreElements())
{
key = ((String)enum.nextElement()).trim(); // get each
of the key from yhe enumeration
/*if(invalidateOID(key))
{
System.out.println("Throw exception");
}*/
prop = (String)OIDtoObject.getProperty(key); // obtain the
ObjectName & type corresponding to the OID(key)
if(prop == null){
System.out.println("Value Not found in the
property");
}
prop = prop.trim();
strToken = new StringTokenizer(prop); // store the ObjectName &
Type
while(strToken.hasMoreElements()){
try
{
prop = strToken.nextToken().trim(); //
Extract the ObjectName
nameToOID.put(prop,key); // Maintain
a hash of ObjectName, OID(key)
oidToName.put(key,prop);
prop = strToken.nextToken().trim(); //
Extract the type of Object
oidTotype.put(key,prop); // Maintain
a hash of OID and Object type(prop)
}catch(NoSuchElementException e){
System.out.println(e.toString());
}
}//end while
}
//System.out.println(" key value from nameToOID
"+nameToOID.toString());
/*Set kSet = oidToName.keySet();
Set entrySet = oidToName.entrySet();
Iterator itr = kSet.iterator();
Iterator eItr = entrySet.iterator();
while(eItr.hasNext()){
Map.Entry entry = (Map.Entry) eItr.next();
System.out.print("key:"+entry.getKey());
System.out.println(" Value:"+entry.getValue());
}*/
}
public Set getOidToNameMap(){
return oidToName.entrySet();
}
public static boolean getMatchingType(String oID)
{
Set kSet = oidTotype.keySet();
Iterator oid_s = kSet.iterator();
while(oid_s.hasNext())
{
String str = (String) oid_s.next();
str=str.trim();
if(oID.startsWith(str))
{
System.out.println("KEY mapped value "+
getType(str));
if(getType(str).equals("PHYSADDRESS"))
{
System.out.println("found "+str);
return true;
}
}
} // end of while
System.out.println("not found");
return false;
}
public static String getName(String oid)
{
String tmpOid = new String("");
int len = 0;
tmpOid = oid;
len = tmpOid.lastIndexOf('.');
while(len != -1){
tmpOid = tmpOid.substring(0,len);
if(oidToName.containsKey(tmpOid))
{
System.out.println(" i have found a matching key
");
index = (String)
oid.substring(tmpOid.length(),(oid.length()));
if(index.startsWith("."))
index = index.substring(1);
System.out.println("index :"+ index);
return ( (String) oidToName.get(tmpOid));
}
len = tmpOid.lastIndexOf('.');
}
return (null);
}
public String getIndex(){
return index;
}
} // end of class
--------------------------------------------------------
import java.util.*;
//import java.util.Iterator;
import javax.swing.tree.DefaultMutableTreeNode;
public class MibLoader extends Thread{
private DefaultMutableTreeNode top;
private ObjectMapper oMap;
private String file;
private Iterator itr;
private String grpStr;
private String subStr;
private Map.Entry tableHashEntry;
Map.Entry hashEntry ;
Map.Entry nxtHashEntry;
int len;
int debug;
static boolean flag = false;
public MibLoader(DefaultMutableTreeNode top, String name){
this.top = top;
oMap = new ObjectMapper();
file = name;
subStr = new String();
grpStr = new String();
int len = 0;
}
public void run(){
DefaultMutableTreeNode obj;
DefaultMutableTreeNode group;
flag = false;
oMap.load(file);
Set entrySet = oMap.getOidToNameMap();
itr = (Iterator) entrySet.iterator();
//System.out.println("In Thread run");
synchronized(top){
if(itr.hasNext())
top.setUserObject(new
DefaultMutableTreeNode(((Map.Entry) itr.next()).getValue()));
}
hashEntry = (Map.Entry) itr.next(); // get first group
//System.out.println("hashentry.value:"+hashEntry.getValue());
while(itr.hasNext()){
grpStr = (String) hashEntry.getKey();
// Group OID
len = grpStr.length(); //Group Length
group = new
DefaultMutableTreeNode(hashEntry.getValue()); // group inserted to tree
//System.out.println(" entering do for "+
hashEntry.getValue() +" group");
hashEntry = (Map.Entry) itr.next();// first entry from
group
//System.out.println("group Len:"+ len);
//System.out.println("NxtEntry :"+hashEntry.getValue());
debug = 0;
do{
// atleast one Group entry
//System.out.println("debug:"+debug++);
obj = new DefaultMutableTreeNode((String)
hashEntry.getValue());
if(!((oMap.getType((String)
hashEntry.getKey())).equals("NODE"))){
nxtHashEntry = (Map.Entry) itr.next();
//System.out.println("nxtHashentry.value:"+nxtHashEntry.getValue());
String tmpStr =
(String)nxtHashEntry.getKey();
subStr =
tmpStr.substring(0,tmpStr.lastIndexOf(".")); // Group element OId of len =
grpStr.length()
//System.out.println("subStr"+ subStr);
}
else{
//System.out.println("entring subtree
for "+ hashEntry.getValue() +" table");
obj.add(subtree(hashEntry));
}
hashEntry = nxtHashEntry;
group.add(obj); // add obj group;
// System.out.println("grp.equals(substr): " +
grpStr.compareTo(subStr));
}while(grpStr.equals(subStr) && itr.hasNext());
synchronized(top){
top.add(group);
}
}
synchronized(top){
setFlag(true); // Set flag indicating
completed operation
top.notifyAll();
// System.out.println("Node creation done,
...notification given to waiting thread");
}
// System.out.println("Closing Thread");
}
public DefaultMutableTreeNode subtree(Map.Entry tableHash){
DefaultMutableTreeNode tableEntry;
DefaultMutableTreeNode column;
nxtHashEntry = (Map.Entry) itr.next(); // tableEntry of Asn.1
// System.out.println("nxtHashEntry: "+
nxtHashEntry.getValue());
tableHashEntry = nxtHashEntry;
String tableEntryOid = (String)tableHashEntry.getKey(); // get
the tableEntry name
int ln = tableEntryOid.length();
// get the tableEntry length
tableEntry = new DefaultMutableTreeNode((String)
tableHashEntry.getValue());
nxtHashEntry = (Map.Entry) itr.next(); // get first column
do{
// System.out.println("debug:"+debug++);
column = new DefaultMutableTreeNode((String)
nxtHashEntry.getValue());
tableEntry.add(column);
// System.out.println("nxtHashEntry:"+
nxtHashEntry.getValue());
nxtHashEntry = (Map.Entry) itr.next();
String tmpStr = (String) nxtHashEntry.getKey();
subStr = tmpStr.substring(0,tmpStr.lastIndexOf("."));
}while(tableEntryOid.equals(subStr) && itr.hasNext());
return(tableEntry);
}
public boolean checkFlag(){
return flag;
}
public void setFlag(boolean val){
flag = true;
}
}
(Review ID: 98833)
======================================================================
Name: skT88420 Date: 08/04/99
I'm getting the following error when running a servlet, which doesn't alter
the program running. I'm running a servlet, using JSDK WebServer Version 2.1,
which creates JESS objects, an expert system package available at:
http://herzberg1.ca.sandia.gov/jess/
version 5.0a6
error:
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)'
has
occurred in :
'jess/Value.equals (Ljess/Value;)Z': Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi
It happens when the following code is invoked in the servlet:
else if ("debbie".equals(action)){
//create a fact and assert it
try{
Fact f = new Fact("user", r);
f.setSlotValue("name", new Value(action, RU.STRING));
r.assert(f);
}catch (JessException e){}
try{
//run jess r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run #2!");
}
}
Source code in it's entirety:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import jess.*;
/* *************************************
* This code is written by Debbie Lampon
*
**************************************** */
public class MyServlet extends HttpServlet {
Rete r = new Rete();
Jesp j;
ServletOutputStream out;
Reader rdr;
String clp = "testing.clp";
// invoked by the browser doing a GET
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
rdr = r.getInputRouter("t"); //set rdr to Jess's input router
//redirect Jess's output to servlet output stream
r.addOutputRouter("t", res.getWriter()); //send standard output from JESS to the servlet's output
//start command
String action = req.getParameter("action");
//if this is the "start" call from the browser
if ("start".equals(action))
{
//open Jess's script file
try{
r.executeCommand("(batch scriptlib.clp)");
}catch (JessException re){
System.out.println("Error: cannot open scriptlib!");
}
//open the .clp file
try{
rdr = new FileReader(clp);
}catch (IOException e){
rdr = null;
System.out.println("Error: cannot open file!"); }
//if there's an open .clp file, parse it
if (rdr != null){
j = new Jesp(rdr, r);
try{
//false because true would printout the "prompt" in Jess
j.parse(false);
}catch (JessException e){
System.out.println("Error: cannot parse file!");
}
try{
//run jess
r.executeCommand("(reset)"); r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run!");
}
}
}
else if ("debbie".equals(action)){
//create a fact and assert it
try{
Fact f = new Fact("user", r);
f.setSlotValue("name", new Value(action, RU.STRING));
r.assert(f);
}catch (JessException e){}
try{
//run jess
r.executeCommand("(run)");
}catch (JessException e){
System.out.println("Error: cannot run #2!");
}
}
else out.println("End I'm afraid!");
}
/**
* We are going to perform the same operations for POST requests
* as for GET methods, so this method just sends the request to
* the doGet method.
*/
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
doGet(req, res);
}
}
(Review ID: 93496)
======================================================================
Name: skT88420 Date: 09/29/99
=20
C:\home\JAVA>del PedidosCopiasProgramas\*.class
C:\home\JAVA>javac PedidosCopiasProgramas/PedidosCopiasProgramas.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)=
' has
occurred in :
'sun/tools/java/ClassDefinition.matchMethod (Lsun/tools/java/Environment;=
Lsun/
tools/java/ClassDefinition;Lsun/tools/java/Identifier;[Lsun/tools/java/Type=
;ZLsu
n/tools/java/Identifier;)Lsun/tools/java/MemberDefinition;': Interpreting m=
ethod
.
Please report this error in detail to http://java.sun.com/cgi-bin/bugrepo=
rt.cgi
(Review ID: 95879)
======================================================================
Name: skT88420 Date: 11/08/99
JPad 3.6 Build 280
Compiling the following:
import java.awt.*;
import java.awt.event.*;
//import javax.swing.*;
public class Life extends java.applet.Applet
{ Button button = new Button("Next Generation");
Panel panel = new Panel();
Container c;
GridLayout grid1 = new GridLayout(10, 10);
GridLayout grid2 = new GridLayout (8,8);
Checkbox check[] [];
public void init()
{ setSize(400, 400);
panel.setLayout(grid1);
for(int i = 0; i < 10; i++)
for(int j = 0; j < 10; j++)
{ check[i][j] = new Checkbox();
panel.add(check[i] [j]);
}
c.add(panel);
panel.add(button);
}
}
Compiling A:\Life.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
occurred in :
'sun/tools/java/ClassDefinition.inSamePackage (Lsun/tools/java/Identifier;)Z':
Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi
Finished
(Review ID: 97578)
======================================================================
Name: skT88420 Date: 11/23/99
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
This was the bug which i encounetered while compiling my program.I missed the
top line of error.
occurred in :
'java/lang/String.getChars (II[CI)V': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
i
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
occurred in :
'java/io/BufferedReader.readLine (Z)Ljava/lang/String;': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
i
persistentcounter.java:13: ';' expected.
BufferedReader bufferesreader = new BufferedReader(filereader)
^
1 error
The buggy code is as follows ::
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class persistentcounter extends HttpServlet
{
int count = 0;
public void init(ServletConfig config) throws ServletException
{
super.init(config);
try
{
FileReader filereader = new filereader("persistentcounter.initial");
BufferedReader bufferesreader = new BufferedReader(filereader)
String initial = bufferesreader.readLine();
count = Integer.parseInt(initial);
return;
} catch(FileNotFoundException ignored) {}
catch(IOException ignored) {}
catch(NumberFormatException ignored) {}
String initial = getInitParameter("initial");
try
{
count = Integer.parseInt(initial);
return;
} catch (NumberFormatException ignored) {}
count = 0;
}
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
count++;
out.println("It has been accessed " + count + "times");
}
public void destroy()
{
savestate();
}
public void savestate()
{
try
{
FileWriter filewriter = new FileWriter("persistentcounter.initial");
String initial = Integer.toString(count);
filewriter.write(initial,0,initial.length());
fileWriter.close();
return;
}catch (IOException e)
{
}
}
}
This error was reported by compiler only once. Second time when i compiled my
program It simply gave me a single error. I think some exception was raised
while parsing the code.
I was just trying to catch the erros reported by compiler by playing with these
lines of code, may be the exception was raised as i have used wrong
constructors for FileReader.
(Review ID: 98171)
======================================================================
Name: skT88420 Date: 12/09/99
C:\Vijay\Java\SNMP project\ui>javac SnmpUI.java
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' ha
occurred in :
'sun/tools/java/Parser.parseStatement ()Lsun/tools/tree/Statement;': Interpre
ing method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.c
i
Error detected while Compiling.
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JButton;
import javax.swing.JTree;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JFrame;
import javax.swing.BorderFactory;
import javax.swing.WindowConstants;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JViewport;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JToolBar;
import javax.swing.event.*;
import javax.swing.UIManager;
import javax.swing.BoxLayout;
import javax.swing.Box;
import javax.swing.BorderFactory.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
//import java.util.*;
public class SnmpUI extends JFrame {
final int divide = 250;
final int fWidth = 800;
final int fHeight = 600;
private JSplitPane top;
private JPanel leftPanel;
private Box rightPanel;
private Box oidContainer;
private Box valContainer;
private Box oidvalContainer;
private Box labelContainer;
private Box labelOidValContainer;
private Box objInfoBox;
private JTree tree;
private JScrollPane scrollTree;
private JViewport colHeader;
private JLabel colLabel;
private DefaultMutableTreeNode node;
private Box buttonBox;
private JPanel respArea;
private JPanel lowerRtPanel;
private JLabel lType;
private JLabel type;
private JLabel lAccess;
private JLabel access;
private JLabel lHint;
private JLabel hint;
private JTextArea textArea;
private JScrollPane areaScrollPane ;
private JTextArea desArea;
private JTextField textfield_oid;
private JTextField textfield_value;
private JLabel label_value;
private JLabel label_oid;
private JComboBox combobox;
private JMenuBar menubar;
private JMenu update;
private JMenuItem loadAgent;
private JMenuItem loadMIB;
private JMenuItem changeAgent;
private JMenuItem changeMIB;
private JMenu poll;
private JMenuItem setInterval;
private JMenuItem setGroup;
private JMenuItem start;
private JMenuItem stop;
private JMenu trap;
private JMenuItem enable;
private JMenuItem disable;
private JMenuItem port;
private JMenu close;
private JMenuItem exit;
private JButton get;
private JButton getnext;
private JButton set;
private JButton walk;
private JButton reset;
private JToolBar trapBar;
private JButton trapButton;
private ImageIcon trapIndImg1;
private ImageIcon trapIndImg2;
private ImageIcon trapIndImg3;
private JLabel trapIndLbl;
static private boolean trapIndicator;
private MibLoader loader;
public SnmpUI(){
node = new DefaultMutableTreeNode();
loader = new MibLoader(node,"mib-2.snm");
loader.start();
scrollTree = new
JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
colHeader = new JViewport();
colLabel = new JLabel("MIB TREE VIEW");
oidContainer = new Box(BoxLayout.X_AXIS);
oidvalContainer = new Box(BoxLayout.Y_AXIS);
labelContainer = new Box(BoxLayout.Y_AXIS);
labelOidValContainer = new Box(BoxLayout.X_AXIS);
objInfoBox = new Box(BoxLayout.Y_AXIS);
respArea=new JPanel();
respArea.setLayout(new GridLayout());
lType = new JLabel("Type");
type = new JLabel("OctetString");
lAccess=new JLabel("Access");
access =new JLabel("ReadOnly");
lHint =new JLabel("Hint");
hint =new JLabel("N/A");
desArea=new JTextArea("Here de description will go");
textArea=new JTextArea("Here data to display");
areaScrollPane = new JScrollPane(textArea);
textfield_oid=new JTextField(20);
textfield_value=new JTextField(30);
label_value=new JLabel(" Value ");
label_oid=new JLabel("Object ID ");
combobox=new JComboBox();
menubar=new JMenuBar();
update=new JMenu("Update");
loadAgent=new JMenuItem("Load Agent");
loadMIB=new JMenuItem("Load MIB");
changeAgent=new JMenuItem("Change Agent");
changeMIB=new JMenuItem("Change MIB");
poll=new JMenu("Poll");
setInterval=new JMenuItem("Set Interval");
setGroup=new JMenuItem("Group");
start=new JMenuItem("Start");
stop=new JMenuItem("Stop");
trap=new JMenu("Trap");
enable=new JMenuItem("Enable");
disable=new JMenuItem("Disable");
port=new JMenuItem("Port");
close=new JMenu("Exit");
exit=new JMenuItem("Exit");
get=new JButton("GET");
getnext=new JButton("GETNEXT");
set=new JButton("SET");
walk=new JButton("WALK");
reset=new JButton("RESET");
trapBar = new JToolBar();
trapBar.setFloatable(false);
trapBar.setBorderPainted(true);
trapButton = new JButton("TRAP");
trapIndImg1 = new ImageIcon("bulb1.gif");
trapIndImg2 = new ImageIcon("bulb2.gif");
trapIndImg3 = new ImageIcon("bulb3.gif");
trapIndLbl = new JLabel(trapIndImg1);
trapIndicator = false;
buttonBox = new Box(BoxLayout.X_AXIS);
rightPanel = new Box(BoxLayout.Y_AXIS);
lowerRtPanel = new JPanel();
leftPanel=new JPanel();
rightPanel=new Box(BoxLayout.Y_AXIS);
rightPanel.setSize(new Dimension(550,550));
top = new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel);
lowerRtPanel.setLayout(new
BoxLayout(lowerRtPanel,BoxLayout.Y_AXIS));
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
private void createTree() throws InterruptedException {
colHeader.setView(colLabel);
scrollTree.setColumnHeader(colHeader);
scrollTree.setViewportBorder(BorderFactory.createEtchedBorder(Color.white,Color.
darkGray));
synchronized(node){
while(!loader.checkFlag()){
System.out.println("trying to create tree, ...
waiting for notification");
node.wait();
System.out.println("trying to create tree, ...
Got the notification");
}
tree = new JTree(node);
}
scrollTree.setViewportView(tree);
scrollTree.setMaximumSize(new Dimension(250,550));
}
void createButton(){
buttonBox.add(get);
buttonBox.add(getnext);
buttonBox.add(set);
buttonBox.add(walk);
buttonBox.add(reset);
}
void setupMenuBar(){
update.add(loadAgent);
update.add(loadMIB);
update.add(changeAgent);
update.add(changeMIB);
poll.add(setInterval);
poll.add(setGroup);
poll.add(start);
poll.add(stop);
trap.add(enable);
trap.ad