Help with ArrayIndexOutOfBounds Exception

Hi all,
I am very new to programming in general and Java in particular. I'm working on a program from a book that is supposed to read 72 hourly readings of voltage and then print the mean voltage over that time period and any hours where the voltage varies from the mean by more than ten percent.
I have an array set up that should have 72 elements created randomly, between 12000-14000. I'm getting an ArrayIndexOutOfBounds Exception when I try to run the program. So far as I understand, this means that somewhere in the program I'm trying to reference an array index that doesn't exist. I just can't see where that is! I've tried a couple different things to see if they've worked but have had no luck.
I'm sure this is just a simple thing, but I'm feeling a little under the weather and I think my brain is pickled from looking at this code for too long. Any suggestions or ideas are gladly welcomed! I'll paste the code below to take a look at. Sorry if it's ugly or messy... I'm just figuring this stuff out still!
Thanks so much-
Heather
import java.lang.*;
import java.util.*;
class VoltageReport {
VoltageReport () throws IOException {
System.out.println("Welcome to the voltage meter program!");
//int place = 0;
int MeterReadings[] = new int [71];
int place = 0;
for (int i = 0; i <= 71; i++) {
//if (place == 72) break; thought this would do it, but it doesn't.
MeterReadings[place] = (int) (Math.random()*2000+12000);
place++;
place = 0;
int VoltageMean;
VoltageMean = 0;
for (int i = 0; i <= 71; i++) {
VoltageMean = VoltageMean + MeterReadings[place];
place++;
place = 0;
VoltageMean = VoltageMean / 72;
for (int i = 0; i <= 71; i++) {
if (MeterReadings[place] < (.9 * VoltageMean)) {
System.out.println("Hour " + place + " is more than 10% lower than the " + "mean of " + VoltageMean + " .");
else if (MeterReadings[place] > (.9 * VoltageMean)) {
System.out.println("Hour " + place + " is more than 10% higher than the " + "mean of " + VoltageMean + " .");
place++;
System.out.println("That's all the information I have. Goodbye!"); }
public static void main (String [] args) throws IOException {
new VoltageReport();
}

if (MeterReadings[place] < (.9 * VoltageMean))
    System.out.println("Hour " + place + " is more than 10% lower than the " + "mean of " + VoltageMean + " .");
else if (MeterReadings[place] > (.9 * VoltageMean))
    System.out.println("Hour " + place + " is more than 10% higher than the " + "mean of " + VoltageMean + " .");The problem lies in the else-if. You are checking if the voltage is over 90% of the mean. I think you want to check if it is over 110% of(10% over) the mean.
else if(MeterReadings[place] > (1.1 * VoltageMean))
....And a few other things.
Arrays
int[] temp = new int[5]; // you have indexes (indices?) 0, 1, 2, 3 & 4 is the last one
// Count them, there is 5 there.  Since we always start at 0, the last one is always 1 less than the length.
// Never do temp[temp.length], this will ALWAYS end in IndexOutOfBoundsException.
// temp[temp.length-1] is the way to get the last element.
Posting code
Since you were unusually nice, no one has cut sick at you, but in the future when you post code, put it between [ code ] and [ /code ] tags (I added spaces so the forum doesn't recognize them, but you get the idea).
Cheers,
Radish21

Similar Messages

  • Urgent help with an exception !!

    Hi I Use a java class to calculate some data.
    This java class is called from a jsp page and first I create a Object from the class (and the constructor method is been called). In this constructor I recive (from the jsp page) a String[][] and other diferent values, but in this method I "copy" the String[][] I have passed to a Double [][] variable (defined like global) and I obtain an exception when the Sting[][] variable contains null vales. But I think I am treating that subject:
    JAVA CLASS:
    public class Functions_AEMult{
        Double [][] datosA;
        public Functions_AEMult( String [][] TablaFinal, String Frecuencia, String [] ValoresMult, HttpSession session)
            datosA = new Double[TablaFinal.length][2];
            for(int i = 0;i< TablaFinal.length;i++)
                if(null != TablaFinal[0])
    datosA [i][0] = new Double(TablaFinal[i][0]);
    if(null != TablaFinal[i][1])
    datosA [i][1] = new Double(TablaFinal[i][1]);
    The exception It gives me: ( In "[i]Functions_AEMult.java:884" the line is datosA [1] = new Double(TablaFinal[i][(j+1)]); )
    type Informe de Excepci�n
    mensaje
    descripci�n El servidor encontr� un error interno () que hizo que no pudiera rellenar este requerimiento.
    excepci�n
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    causa ra�z
    java.lang.NullPointerException
         java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:980)
         java.lang.Double.valueOf(Double.java:202)
         java.lang.Double.<init>(Double.java:277)
         analisisEsp.Functions_AEMult.<init>(Functions_AEMult.java:884)
         org.apache.jsp.admin.PaleoPlot.show_jsp._jspService(show_jsp.java:928)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.0.28.Some body can help me??
    thanks very much

    If you had some code comparing the entries for the String array to null, I would agree with you. But you don't. So you are calling new Double(null) and throwing that exception.Thanks for ur answer DrClap.
    when I do...
    if(null != TablaFinal[0])
    datosA [i][0] = new Double(TablaFinal[i][0]);
    if(null != TablaFinal[i][1])
    datosA [i][1] = new Double(TablaFinal[i][1]);
    I am comparing the entries for the String array to null, No?
    Thanks

  • Help with these Exceptions!

    Hello All,
    when the code below is run and I select a table name that starts with the number 0 I get a Eception, which is fine but when I click back into the combobox where I have the Table name that sarts with the number 0,
    it Thows that Exception again. How can I get my code to only thow that exception once?
    Someone suggested to use the getId() for the Action event will do this. I have tried to find out how to use this but was unsucessfull. Please could someone help me?
    Thanks
    Dave
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class ComboBoxTable{
    static Connection conn2;
       static DatabaseMetaData DMD;
       static JComboBox group = new JComboBox();
       static JComboBox groupList = new JComboBox();
      public static void main(String[] args) {
    try  {
              // Load the database driver
            Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ) ;
            conn2 = DriverManager.getConnection( "jdbc:odbc:myProject") ;
            DMD=conn2 .getMetaData();
            ResultSet rs=DMD.getTables(null,null,null,new String[]{"TABLE"});
            while(rs.next()) {
              group.addItem((String)rs.getString(3));
            rs.close() ;
         } catch (SQLException se ) {
            System.out.println( "SQL Exception: " + se ) ;
         } catch (Exception e ) {
            System.out.println( e ) ;
         group.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e)  {
              String tbl = (String)group.getSelectedItem();
              try {
                    Statement st=conn2.createStatement();
                 st.execute("SELECT * FROM "+tbl+" WHERE 1=0");
                 ResultSet rs=st.getResultSet();
                 ResultSetMetaData md=rs.getMetaData();
                 groupList.removeAllItems();
                 for (int i=1;i<=md.getColumnCount();i++) {
                   groupList.addItem(md.getColumnName(i));
                 st.close() ;
              } catch (SQLException se ) {
                 System.out.println( "SQL Exception: " + se ) ;
              } catch (Exception ex ) {
                 System.out.println( ex ) ;
    int j=10;
          String[][] data = new String[j][2];
          for (int k=0; k<j; k++){
             String[] row = {"",""};
             data[k] = row;
        String[] colNames = {"Column A", "Column B"};
        JTextField jtf = new JTextField();
        JTable tbl = new JTable(data, colNames);
    // Create the combo box editor
        DefaultCellEditor editor = new DefaultCellEditor(groupList);
    // ADDED IN MY ATTEMPT TO HAVE TO COLUMNS WITH COMBOBOXES
        DefaultCellEditor editor2 = new DefaultCellEditor(group);
    // Assign the editor to the second column
        TableColumnModel tcm = tbl.getColumnModel();
        tcm.getColumn(0).setCellEditor(editor2);
    // ADDED
        tcm.getColumn(1).setCellEditor(editor);
    // Set column widths
        tcm.getColumn(0).setPreferredWidth(200);
        tcm.getColumn(1).setPreferredWidth(100);
    // Set row heighht
        tbl.setRowHeight(20);
        tbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        tbl.setPreferredScrollableViewportSize(tbl.getPreferredSize());
         JFrame f = new JFrame("ComboBoxDemo");
        f.getContentPane().add(new JScrollPane(tbl), "Center");
        f.pack();
        f.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
             System.exit(0);
        f.setVisible(true);
    }

    If you can predict an exception with such certainty, you should put some sanity checking in your code to prevent the the exception from ever occurring.

  • Help with nullPointer exception

    Hi,
    I would like some help identifying and error in the code below. Im getting a nullPointer exception at the location specified in the code. Im adding elements to a tableModel. What puzzles me is that the strings I add to the model does contain values. And it does not complain about adding them. Perhaps this is just a simple error, and you more experinced programmars are probably loughing at me ;)
    void getTests() {
          String[] idNummer = getDirectory(); //gets filenames from a directory
          for (int i = 0; i < idNummer.length; i++) {
             idNummer[i] = idNummer.substring(idNummer[i].lastIndexOf(dataSeparetor) + 1, idNummer[i].length());
    // just sorts out specific parts of the filenames
    for (int i = 0; i < idNummer.length; i ++) {
    System.out.println(idNummer[i]); //I print the sorted filenames and they not null
    testModel.addElement(idNummer[i]); //I add them to the table model
    testNr.setModel(testModel); //and gets a nullPoint exception here??

    I'm sorry, you mean testNr. Don't pay any attention to the above post. it is also declared directly in the class:
    public class GUI extends JFrame implements EventListener  {
      JList testModel;
    }and creates an instance here:
    public GUI {
    testModel = new DefaultListModel();
    getTests();
    testNr = new JList(testModel);
          testNr.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
          testNr.setLayoutOrientation(JList.VERTICAL);
          testNr.setPreferredSize(new Dimension(80, 80));
          testNr.addListSelectionListener(new ListSelectionListener() {
             public void valueChanged(ListSelectionEvent event) {
          leftPanel.add(testNr, BorderLayout.EAST);
    }

  • Help with the exception handling

    I have something like
    Node n = getNode();
    if (null == n) {
    throw new ServletException ("Missing or Incorrect Request");
    some extra code here
    catch (Exception e ) {
    logger.error(e);
    throw new ServletException ("Missing or Incorrect Request");
    I though that after throwing ServletException it would be caught in catch block and then will be thrown again so I can handle it in another method. Problem is that it is dies on line
    logger.error(e);
    I understand that it is better to specify exact exception instead of using parent Exception class, yet in theory I thought it should work.
    Can someone tell what is wrong here.
    Message was edited by:
    arushunter

    "Problem is that it is dies on line logger.error(e);"
    What does 'dies' mean? Is logger null? Is there another exception? Can you provide any more detailed info?
    You shouldn't catch any exception that you're not going to handle. Personally, I'm not crazy about logging and rethrowing the same thing. It's really not a servlet exception; it's an application exception that tells users when a request is malformed.
    Seems more like a validation issue to me. If you were using Spring, you'd have a validator that would check the input for correctness, add errors if any, and reroute the user back to the offending page with messages telling them how to correct the problem.
    %

  • What a basis admin can help with GRC except install/upgrade?

    Our basis team installs and upgrades GRC.
    However when coming to the support for GRC, we are not sure where to draw the border line between
    basis team and security team.
    What is the responsibility of basis team in GRC area?
    Thanks  for your help.

    Hi Jennifer,
    There is no real clear cut answer for this! Where do you draw the line for the other ERP systems?
    It really depends on your own support structure and the skills of the individuals. I would ask your Application Support Mgr to confirm / define the remit with those involved.
    Having said that, I would suggest that the technical landscape management and connectors would lend itself to the basis / netweaver analysts role. You may also want them to deal with the assignment of the webservices and the connectivity of the components to each other.
    The functional configuration would tend to lend itself to the security team though as I expect that they would be more business focussed and be able to design the way in which the tools should be used by the business.
    I hope this helps?
    Simon

  • Help with an exception when trying to establish a socket connection

    i am trying to make a chat (using an applet for the client).......
    it uses an simple socket connection between the server and clients.....when i connect the client to address 127.0.0.1 or localhost everything works fine, but when i try to connect the client to my DNS name or ip, i get an exception....the exception reads:
    java.security.AccessControlException: access denied (java.net.SocketPermission nextwave.dyndns.org resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
    at java.net.InetAddress.getAllByName0(InetAddress.java:937)
    at java.net.InetAddress.getAllByName0(InetAddress.java:918)
    at java.net.InetAddress.getAllByName(InetAddress.java:912)
    at java.net.InetAddress.getByName(InetAddress.java:832)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:109)
    at java.net.Socket.<init>(Socket.java:119)
    at Client.<init>(Client.java:42)
    at ClientApplet.init(ClientApplet.java:12)
    at sun.applet.AppletPanel.run(AppletPanel.java:347)
    at java.lang.Thread.run(Thread.java:536)
    what is this all about??????
    i'm not that fluent in java, or networking at that, but i'm sure there is something i can do to fix this......
    any help would be greatley appreciated.

    this is why i am not heart-broken that i will be going the other (executable jar) route.......the major deciding factor is the people who will be using this chat will most likley not be able to edit the policy file due to lack of knowledge, and probably won't want to take the time to try.....they would rather download a program, and double-click execute........
    i thank you for taking the time to help me......i have been reading through the posts in this forum, and am seeing it is a good place to get help, so i will be sticking around.....
    mahalo and happy java

  • Help with this exception calling a WS

    Hello there, i have a stand alone java application that consume a WS deployed in a WLS.
    This call works before... i made some changes in the WS but to the logic not the methods signatures... now i have problems when i want to call... i get this weird Exception... can u help me please to understand it?
    Exception in thread "main" java.lang.ExceptionInInitializerError
         at weblogic.wsee.ws.init.WsDeploymentChain.newClientChain(WsDeploymentChain.java:24)
         at weblogic.wsee.ws.WsFactory.callClientListeners(WsFactory.java:113)
         at weblogic.wsee.ws.WsFactory.createClientService(WsFactory.java:46)
         at weblogic.wsee.jaxrpc.ServiceImpl.init(ServiceImpl.java:149)
         at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:117)
         at com.activacionbb.webservice.cliente.ActivacionWebServices_Impl.<init>(Unknown Source)
         at com.activacionbb.webservice.cliente.ActivacionWebServices_Impl.<init>(Unknown Source)
         at com.activacionbb.mq.Despachador.<init>(Despachador.java:29)
         at com.activacionbb.mq.Despachador.main(Despachador.java:53)
    Caused by: java.lang.ClassCastException: com.bea.xbean.values.XmlTokenImpl
         at weblogic.wsee.tools.wseegen.schemas.impl.ListenerTypeImpl.getListenerClass(ListenerTypeImpl.java:37)
         at weblogic.wsee.ws.init.WsConfigFactory.getDeploymentListenerConfig(WsConfigFactory.java:139)
         at weblogic.wsee.ws.init.WsConfigFactory.load(WsConfigFactory.java:110)
         at weblogic.wsee.ws.init.WsConfigFactory.newInstance(WsConfigFactory.java:59)
         at weblogic.wsee.ws.init.WsConfigFactory.newInstance(WsConfigFactory.java:45)
         at weblogic.wsee.ws.init.WsConfigManager.<clinit>(WsConfigManager.java:8)
         ... 9 more
    Thanx in advance!!

    Hello there, i have a stand alone java application that consume a WS deployed in a WLS.
    This call works before... i made some changes in the WS but to the logic not the methods signatures... now i have problems when i want to call... i get this weird Exception... can u help me please to understand it?
    Exception in thread "main" java.lang.ExceptionInInitializerError
         at weblogic.wsee.ws.init.WsDeploymentChain.newClientChain(WsDeploymentChain.java:24)
         at weblogic.wsee.ws.WsFactory.callClientListeners(WsFactory.java:113)
         at weblogic.wsee.ws.WsFactory.createClientService(WsFactory.java:46)
         at weblogic.wsee.jaxrpc.ServiceImpl.init(ServiceImpl.java:149)
         at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:117)
         at com.activacionbb.webservice.cliente.ActivacionWebServices_Impl.<init>(Unknown Source)
         at com.activacionbb.webservice.cliente.ActivacionWebServices_Impl.<init>(Unknown Source)
         at com.activacionbb.mq.Despachador.<init>(Despachador.java:29)
         at com.activacionbb.mq.Despachador.main(Despachador.java:53)
    Caused by: java.lang.ClassCastException: com.bea.xbean.values.XmlTokenImpl
         at weblogic.wsee.tools.wseegen.schemas.impl.ListenerTypeImpl.getListenerClass(ListenerTypeImpl.java:37)
         at weblogic.wsee.ws.init.WsConfigFactory.getDeploymentListenerConfig(WsConfigFactory.java:139)
         at weblogic.wsee.ws.init.WsConfigFactory.load(WsConfigFactory.java:110)
         at weblogic.wsee.ws.init.WsConfigFactory.newInstance(WsConfigFactory.java:59)
         at weblogic.wsee.ws.init.WsConfigFactory.newInstance(WsConfigFactory.java:45)
         at weblogic.wsee.ws.init.WsConfigManager.<clinit>(WsConfigManager.java:8)
         ... 9 more
    Thanx in advance!!

  • Help with: oracle.toplink.essentials.exceptions.ValidationException

    hi guys,
    I really need ur help with this.
    I have a remote session bean that retrieves a list of books from the database using entity class and I call the session bean from a web service. The problem is that when i display the books in a jsp directly from the session bean everything works ok but the problem comes when I call the session bean via the web service than it throws this:
    Exception Description: An attempt was made to traverse a relationship using indirection that had a null Session. This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization. To avoid this issue, instantiate the LAZY relationship prior to serialization.
    at oracle.toplink.essentials.exceptions.ValidationException.instantiatingValueholderWithNullSession(ValidationException.java:887)
    at oracle.toplink.essentials.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:233)
    at oracle.toplink.essentials.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:105)
    at oracle.toplink.essentials.indirection.IndirectList.buildDelegate(IndirectList.java:208)
    at oracle.toplink.essentials.indirection.IndirectList.getDelegate(IndirectList.java:330)
    at oracle.toplink.essentials.indirection.IndirectList$1.<init>(IndirectList.java:425)
    at oracle.toplink.essentials.indirection.IndirectList.iterator(IndirectList.java:424)
    at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.iterator(Lister.java:278)
    at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.iterator(Lister.java:265)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:129)
    at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
    at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:277)
    at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:100)
    at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:141)
    at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:315)
    at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
    at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:320)
    at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:93)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:454)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:176)
    ... 29 more
    This happens when I test the web service using netbeans 6.5.
    here's my code:
    session bean:
    ArrayList bookList = null;
    public ArrayList retrieveBooks()
    try
    List list = em.createNamedQuery("Book.findAll").getResultList();
    bookList = new ArrayList(list);
    catch (Exception e)
    e.getCause();
    return bookList;
    web service:
    @WebMethod(operationName = "retrieveBooks")
    public Book[] retrieveBooks()
    ArrayList list = ejbUB.retrieveBooks();
    int size = list.size();
    Book[] bookList = new Book[size];
    Iterator it = list.iterator();
    int i = 0;
    while (it.hasNext())
    Book book = (Book) it.next();
    bookList[i] = book;
    i++;
    return bookList;
    Please help guys, it's very urgent

    Yes i have a relationship but i didnt want it to be directly. Maybe this is a design problem but in my case I dont expect any criminals to be involved in lawsuit. My tables are like that:
    CREATE TABLE IF NOT EXISTS Criminal(
         criminal_id INTEGER NOT NULL AUTO_INCREMENT,
         gender varchar(1),
         name varchar(25) NOT NULL,
         last_address varchar(100),
         birth_date date,
         hair_color varchar(10),
         eye_color varchar(10),
         weight INTEGER,
         height INTEGER,
         PRIMARY KEY (criminal_id)
    ENGINE=INNODB;
    CREATE TABLE IF NOT EXISTS Lawsuit(
         lawsuit_id INTEGER NOT NULL AUTO_INCREMENT,
         courtName varchar(25),
         PRIMARY KEY (lawsuit_id),
         FOREIGN KEY (courtName) REFERENCES Court_of_Law(courtName) ON DELETE NO ACTION
    ENGINE=INNODB;
    CREATE TABLE IF NOT EXISTS Rstands_trial(
         criminal_id INTEGER,
         lawsuit_id INTEGER,
         PRIMARY KEY (criminal_id, lawsuit_id),
         FOREIGN KEY (criminal_id) REFERENCES Criminal(criminal_id) ON DELETE NO ACTION,
         FOREIGN KEY (lawsuit_id) REFERENCES Lawsuit(lawsuit_id) ON DELETE CASCADE
    ENGINE=INNODB;So I couldnt get it.

  • Need help with error: XML parser failed: Error An exception occurred! Type:......

    <p>Need help with the following error.....what does it mean....</p><p>28943 3086739136 XML-240304 3/7/07 7:13:23 PM |SessionNew_Job1<br /><font color="#ff0000">28943 3086739136 XML-240304 3/7/07 7:13:23 PM XML parser failed: Error <An exception occurred! Type:UnexpectedEOFException, Message:The end of input was not expected> at</font><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM line <7>, char <8> in <<?xml version="1.0" encoding="WINDOWS-1252" ?><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfigurations><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfiguration default="true" name="Configuration1"><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <case_sensitive>no</case_sensitive><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <database_type>Oracle</database_type><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_alias_name1>ODS_OWNER</db_alias_name1><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_ali>, file <>.<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM |SessionNew_Job1<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM XML parser failed: See previously displayed error message.</p><p>Any help would be greatly appreciated.  It&#39;s something to do with my datasource and possibly the codepage but I&#39;m really not sure.</p><p>-m<br /></p>

    please export your datastore as ATL and send it to support. Somehow the internal language around configurations got corrupted - never seen before.

  • ArrayIndexOutofBound exception, PLEASE HELP

    I am trying to validate my xsd file but when it tries to execute the following line:
    org.apache.xerces.parsers.SAXParser p = new org.apache.xerces.parsers.SAXParser();
    it throws the ArrayIndexOutOfBound exception.
    Anyone has any idea on it?
    thanks in advance...
    faisalk

    Are you sure that's the line that's throwing the error?
    I just compiled and ran the following:
    public class TestMain{
         public static void main(String args[]){
              org.apache.xerces.parsers.SAXParser p = new org.apache.xerces.parsers.SAXParser();
              System.out.println(p.toString());
         }     //end main()
    }     //end class TestMain

  • I need help with proper DNS setup for 10.5.8 Server

    I'm administering a 10.5.8 server that I sold and setup about a year ago. I'm experiencing issues with getting iCal server to be happy. All of the clients are running 10.5.8, but I'm running 10.6.1. I've heard from others that connecting iCal in 10.6 to a 10.5 iCal Server should be no problem.
    I'm beginning to think that I have DNS issues. Probably because I'm not and never have been 100% certain how to set it up completely correctly. I used to be able to get Kerberos tickets, but now I can't. With the new "Ticket Viewer" in 10.6, it asks for two bits of information. First is "Identity" where I'm guessing I should put [email protected] and then password. When I do this I get an alert dialog that says "Kerberos Error -- cannot resolve network address for KDC in realm example.com"
    The server is a Mac Pro tower with two Ethernet ports. En2 is connected directly to the Internet and has a static IP with a domain name assigned to it. We'll call it "example.com" for the purposes of the discussion. The En1 is connected to the network switch and has a static LAN IP of 192.168.1.250. All clients inside and outside are able to reach the server via domain name for WWW & AFP, no problem.
    nslookup on the static IP address returns "example.com" and nslookup on "example.com" returns the correct static IP address. Open Directory is running and happy including Kerberos. The LDAP search base is "dc=example,dc=com". The LDAP search base is a concept I haven't quite grasped, so I'm just going to assume it's correct.
    The domain name is hosted outside by a service provider that forwards all "example.com" requests to the server with the exception of mail.
    In DNS, I have three "sections" that look like this:
    Name Type Value
    1.168.192.in-addr.arpa. Reverse Zone -
    192.168.1.250 Reverse Mapping example.com.
    000.000.00.in-addr.arpa. Reverse Zone -
    000.000.000.000 Reverse Mapping example.com.
    com. Primary Zone -
    mail.example.com. Alias mail.our-email-isp.com.
    example.com. Machine Multiple values
    www.example.com. Machine Multiple values
    NOTE: the zeros aren't actually zeros, they are the static IP assigned to the server/domain
    When I select the top element "1.168.192.in-addr.arpa." down below "Allows zone transfer" is NOT checked. Nameservers shows the zone as "1.168.192.in-addr.arpa." and the Nameserver Hostname as "ns.example.com."
    When I select the next line down "192.168.1.250", Resolve 192.168.1.250 to: example.com.
    When I select the "000.000.00.in-addr.arpa." element, it has the same settings -- nameservers "000.000.00.in-addr.arpa." and "ns.example.com."
    When I select the next line down (our static IP), Resolve 000.000.000.000 to: example.com.
    When I select "com." the admin email is populated with a valid email address, Allows zone transfer is NOT checked. In nameservers, Zone is "com." and Nameserver Hostname is "example.com." The mail exchangers are mail2.our-email-isp.com. priority 10 and mail.our-email-isp.com. and priority 20.
    When I select the machine "example.com." it shows both the real-world static IP and the 192.168.1.250, same with "www.example.com.".
    Am I doing something wrong with this setup? Should "com." be the primary zone or should that be "example.com." ???
    I've been thinking about getting rid of the DNS entry for the 192.168.1.250 address altogether, but will the clients in the office suffer performance issues??? I do not think that the client workstations are configured to get DNS from the server anyway. Should the "www.example.com." record be a Machine record or should it be an alias record?
    Any help you have to offer is greatly appreciated! Thanks!
    In the meantime, I'm going to look around and see if I can understand "Allows zone transfer" and LDAP Search base a bit better.

    Okay, I found a lovely article at the following address which I think helps me to clarify what I'm doing wrong. Despite that, I'd still like to have any feedback you have to offer.
    http://www.makemacwork.com/configure-internal-dns-1.htm
    Also, when editing DNS entries, Server Admin likes to set the nameserver to "ns." -- whatever your domain is. Should I be overriding that and if so, replace it with what?

  • Help with HP Laser Printer 1200se

    HP Support Line,
    Really need your assistance.  I have tried both contacting HP by phone (told they no longer support our printer via phone help), the tech told me that I needed to contact HP by e-mail for assistance.   I then sent an e-mail for assistance and got that reply today, the reply is as follows  "Randall, unfortunately, HP does not offer support via e-mail for your product.  However many resources are available on the HP web site that may provide the answer to your inquiry.  Support is also available via telephone.  A list of technical support numbers can be round at the following URL........."  The phone numbers listed are the ones I called and the ones that told me I needed to contact the e-mail support for help.
    So here I am looking for your help with my issue.
    We just bought a new HP Pavillion Slimline Desk Top PC (as our 6 year old HP Pavillion PC died on us).  We have 2 HP printers, one (an all-in-one type printer, used maily for copying and printing color, when needed) is connected and it is working fine with the exception of the scanning option (not supported by Windows 7).  However we use our Laser Printer for all of our regular prining needs.  This is the HP LaserPrinter 1200se, which is about 6 years old but works really well.  For this printer we currently only have a parallel connection type cord and there is not a parallel port on the Slimline HP PC.  The printer also has the option to connedt a USB cable (we do not currently have this type of cable).
    We posed the following two questions:
    1.  Is the Laser Jet 1200se compatible with Windows 7?
    and if this is the case
    2.  Can we purchase either a) a USC connection cord (generic or do we need a printer specific cord)? or b) is there there a printer cable converter adapater to attach to our parallel cable to convert to a USB connection?
    We do not want to purchase the USB cable if Windows 7 will not accept the connection, or if doing this will harm the PC.
    We really would appreciate any assitance that you might give us.
    Thank you,
    Randy and Leslie Gibson

    Sorry, both cannot be enabled by design.  That said, devices on a network do not care how others are connected.  You can print from a wireless connection to a wired (Ethernet) printer and v/v.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • WRT310N: Help with DMZ/settings (firmware 1.0.09) for wired connection

    Hello. I have a WRT310N and have been having a somewhat difficult time with my xbox 360's connection. I have forwarded all the necessary ports (53, 80, 88, 3074) for it to run, and tried changing MTU and what-not.
    I don't know if I have DMZ setup incorrectly, or if it's my settings.
    Setup as follows:
    PCX2200 modem connected via ethernet to WRT310N. 
    The WRT310N has into ethernet port 1 a WAP54G, and then upstairs (so that my Mother's computer can get a strong signal) I have another WAP54G that I believe receives its signal from the downstairs 54G. 
    In the back of the WRT310N, I have my computer connected via ethernet port 3, and my Xbox 360 connected via ethernet port 4.
    Now, I first figured I just have so many connections tied to the router and that is the reason for being so slow. However, when I unplug all the other ethernet cords and nothing is connected wirelessly, except for my Xbox connected to ethernet port 4, it is still poor. Also, with everything connected (WAP54G and other devices wirelessly) I get on my PC and run a speedtest.  For the sake of advice, my speedtests I am running on my PC are (after 5 tests) averagely 8.5 Mbps download, and 1.00 Mbps upload, with a ping of  82ms.
    Here is an image of the results:
    http://www.speedtest.net][IMG]http://www.speedtest.net/result/721106714.png
    Let me add a little more detail of my (192.168.1.1) settings for WRT310N.
    For starters, my Father's IT guy at his workplace set up this WRT310N and WAP54G's. So some of these settings may be his doing. I just don't know which.
    "Setup" as Auto-configurations DHCP. I've added my Xbox's IP address to the DHCP reservation the IP of 192.168.1.104. This has (from what I've noticed) stayed the same for days.
    MTU: Auto, which stays at 1500 when I check under status.
    Advanced Routing: NAT routing enabled, Dynamic Routing disabled. 
    Security: Disabled SPI firewall, UNchecked these: Filter Anonymous Internet Requests, Multicast, and Internet NAT redirection.
    VPN passthrough: All 3 options are enabled (IPSec, PPTP, L2TP)
    Access Restrictions: None.
    Applications and Gaming: Single port forwarding has no entries. Port Range Forwarding I have the ports 53 UDP/TCP, 88 UDP, 3074 UDP/TCP, and 80 TCP forwarded to IP 192.168.1.104 enabled. (192.168.1.104 is the IP for my xbox connected via ethernet wired that is in DHCP reserved list)
    Port Range Triggering: It does not allow me to change anything in this page.
    DMZ: I have it Enabled. This is where I am a bit confused. It says "Source IP Address" and it has me select either "Any IP address" or to put entries to the XXX.XXX.XXX.XXX to XXX fields. I have selected use any IP address. Then the source IP area, it says "Destination:"  I can do either "IP address: 192.168.1.XXX" or "MAC address:" Also, under MAC Address, it says DHCP Client Table and I went there and saw my Xbox under the DHCP client list (It shows up only when the Xbox is on) and selected it.  
    Under QoS: WMM Enabled, No acknowledgement disabled.
    Internet Access Priority: Enabled. Upstream Bandwith I set it to Manual and put 6000 Kbps. I had it set on Auto before, but I changed it. I have no idea what to put there so I just put a higher number. 
    Then I added for Internet Access Priority a Medium Priority for Ethernet Port 4 (the port my xbox is plugged into).
    Administration: Management: Web utility access: I have checked HTTP, unchecked HTTPS.
    Web utility access via Wireless: Enabled. Remote Access: Disabled.
    UPnp: Enabled.
    Allow Users to Configure: Enabled.
    Allow users to Disable Internet Access: Enabled.
    Under Diagnostics, when I try and Ping test 192.168.1.104 (xbox when on and connected to LIVE), I get:
    PING 192.168.1.104 (192.168.1.104): 24 data bytes
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    --- 192.168.1.104 data statistics ---
    5 Packets transmitted, 0 Packets received, 100% Packet loss
    Also, when I do Traceroute Test for my Xbox's IP, I just keep getting: 
    traceroute to 192.168.1.104 (192.168.1.104), 30 hops max, 40 byte packets
    1 * * * 192.168.1.1 Request timed out.
    2 * * * 192.168.1.1 Request timed out.
     As for the Wireless Settings, it is all on the default settings with Wi-Fi Protected setup Enabled.
    To add, I have tried connecting my modem directly to the Xbox and my connection is much improved. I have no difficulty getting the NAT open, for it seems my settings are working for that. Any help with these settings would be VERY much appreciated. 
    Message Edited by CroftBond on 02-18-2010 01:09 PM

    I own 2 of these routers (one is a spare) with the latest firmware and I have been having trouble with them for over a year.  In my case the connection speed goes to a crawl and the only way to get it back is to disable the SPI firewall.  Rebooting helps for a few minutes, but the problem returns.  All of the other fixes recommended on these forums did not help.  I found out the hard way that disabling the SPI Firewall also closes all open ports ignoring your port forwarding settings.  If you have SPI Firewall disabled, you will never be able to ping your IP from an external address.  Turn your SPI Firewall back on and test your Ping. 
    John

  • Help with if statement for a beginner.

    Hello, I’m new to the dev lark and wondered if someone could point me in the right direction.
    I have the following (working!) app that lets users press a few buttons instead of typing console commands (please do not be too critical of it, it’s my first work prog).
    //DBS File send and Receive app 1.0
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import java.applet.Applet;
    public class Buttons extends JFrame
         public Buttons()
              super("DBS 2");          
              JTextArea myText = new JTextArea   ("Welcome to the DBS application." +
                                                           "\n" +
                                                           "\n\n1. If you have received an email informing you that the DBS is ready to dowload please press the \"Receive DBS\" button." +
                                                           "\n" +
                                                           "\n1. Once this has been Received successfully please press the \"Prep File\" button." +
                                                           "\n\n2. Once the files have been moved to their appropriate locations, please do the \"Load\" into PAS." +
                                                           "\n\n3. Once the \"Load\" is complete, do the \"Extract\"." +
                                                           "\n\n4. When the \"Extract\" has taken place please press the \"File Shuffle\" button." +
                                                           "\n\n5. When the files have been shuffled, please press the \"Send DBS\" Button." +
                                                           "\n\nJob done." +
                                                           "\n", 20,50);
              JPanel holdAll = new JPanel();
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();
              JPanel middle1 = new JPanel();
              JPanel middle2 = new JPanel();
              JPanel middle3 = new JPanel();
              topPanel.setLayout(new FlowLayout());
              middle1.setLayout(new FlowLayout());
              middle2.setLayout(new FlowLayout());
              middle3.setLayout(new FlowLayout());
              bottomPanel.setLayout(new FlowLayout());
              myText.setBackground(new java.awt.Color(0, 0, 0));     
              myText.setForeground(new java.awt.Color(255,255,255));
              myText.setFont(new java.awt.Font("Times",0, 16));
              myText.setLineWrap(true);
              myText.setWrapStyleWord(true);
              holdAll.setLayout(new BorderLayout());
              topPanel.setBackground(new java.awt.Color(153, 101, 52));
              bottomPanel.setForeground(new java.awt.Color(153, 0, 52));
              holdAll.add(topPanel, BorderLayout.CENTER);
              topPanel.add(myText, BorderLayout.NORTH);
              setSize(700, 600);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              getContentPane().add(holdAll, BorderLayout.CENTER);
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
              final JButton receiveDBS = new JButton("Receive DBS"); //marked as final as it is called in an Inner Class later
              final JButton filePrep = new JButton("Prep File");
              final JButton fileShuffle = new JButton("File Shuffle");
              final JButton sendDBS = new JButton("Send DBS");
              JButton exitButton = new JButton("Exit");
    //          JLabel statusbar = new JLabel("Text here");
              receiveDBS.setFont(new java.awt.Font("Arial", 0, 25));
              filePrep.setFont(new java.awt.Font("Arial", 0, 25));
              fileShuffle.setFont(new java.awt.Font("Arial", 0, 25));
              sendDBS.setFont(new java.awt.Font("Arial", 0, 25));
              exitButton.setBorderPainted ( false );
              exitButton.setMargin( new Insets ( 10, 10, 10, 10 ));
              exitButton.setToolTipText( "EXIT Button" );
              exitButton.setFont(new java.awt.Font("Arial", 0, 20));
              exitButton.setEnabled(true);  //Set to (false) to disable
              exitButton.setForeground(new java.awt.Color(0, 0, 0));
              exitButton.setHorizontalTextPosition(SwingConstants.CENTER); //Don't know what this does
              exitButton.setBounds(10, 30, 90, 50); //Don't know what this does
              exitButton.setBackground(new java.awt.Color(153, 101, 52));     
              topPanel.add(receiveDBS);
              middle1.add(filePrep);
              middle2.add(exitButton);
              middle3.add(fileShuffle);
              bottomPanel.add(sendDBS);
              receiveDBS.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == receiveDBS);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\ReceiveDBSfile.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              filePrep.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == filePrep);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\filePrep.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              exitButton.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        System.exit(0);
              fileShuffle.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == fileShuffle);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\fileShuffle.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              sendDBS.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == sendDBS);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\sendDBSFile.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              c.add(receiveDBS);
              c.add(filePrep);
              c.add(fileShuffle);
              c.add(sendDBS);
              c.add(exitButton);
    //          c.add(statusbar);
         public static void main(String args[])
              Buttons xyz = new Buttons();
              xyz.setVisible(true);
         }What I would like help with is the following…
    I would like output to either a JLabel or JTextArea to appear if a file appears on the network. Something along these lines…
    If file named nststrace*.* is in \\[network path] then output “Download successful, please proceed.”
    btw I have done my best to search this forum for something similar and had no luck, but I am looking forward to Encephalopathic’s answer as he/she has consistently made me laugh with posted responses (in a good way).
    Thanks in advance, Paul.

    Hospital_Apps_Monkey wrote:
    we're starting to get aquainted, but I think "best friend" could take a while as it is still as hard going as I recall, but I will persevere.Heh, it's not so bad! For example, if I had no idea how to test whether a file exists, I would just scan the big list of classes on the left for names that sound like they might include File operations. Hey look, File! Then I'd look at all of File's methods for something that tests whether it exists or not. Hey, exists! Then if I still couldn't figure out how to use it, I'd do a google search on that particular method.

Maybe you are looking for