Problem with QofQ and Null Values

Just converted from CF5 to CF7. Finally figured out what was
causing the error message :
"The value "" cannot be converted to a number" when running a
QofQ. It happens whenever there is a NULL (and I think a ZERO)
value in the QofQ. I'm using the QofQ in a seperate chart program.
The main query merges data from a store and a region table.
I'm doing a LEFT OUTER JOIN to combine the REGION with the STORE,
AND so that stores with NO SALES for a given day will show up as
ZERO. On the main report, when I don't use a QofQWhen grouping by
DAY or MONTH, I can test the value in the CFOUTPUT for NULL or ZERO
and display "0" or "N/A" on the report.
But when I try to chart it, using a QofQ to read in the
values from the main query, and format the numbers, I get this
error message. I've tried using the CAST function, using FLOAT,
DOUBLE, BIGINT, etc., but still get same error message.
The only way I could fix this is to add a WHERE statement to
the QofQ, that only includes sales values greater than ZERO. But
then, I have gaps in my chart because stores with NO SALES for a
given day or MONTH don't appear. Because they are removed from the
query. The whole point of LEFT JOINS is to include items with no
values (or NULL) values.
Does anyone know if it's possible to keep these values in a
QofQ? So that items (e.g., store locations in my case) with NULL or
ZERO values for some or all days or months can be charted? Even
with a ZERO value? I've read everything I can get my hands on
regarding QofQ, the CAST function, etc., but nothing seems to work.
Thanks for any help. (FYI, didn't have this problem with CF5. It's
QofQ could handle NULL or ZERO values without providing an error).
Gary

Well, I tried the IsNull function on the 3 SUM() values I was
calculating in my SELECT statement (on a LEFT OUTER JOIN QUERY),
and I STILL got another "cannot convert "" to a number" but this
time the error message was more direct, and pointed me to a DATE
field in my query, where I was SORTING AND GROUPING either by DAY
or MONTH (depending on what user selected on form).
In my QofQ, I'm not just reformating the integer SUM()
values, but also the date values. So, I applied the IsNull()
function to the DATE values in my main query. I still kept getting
errors. But after experimenting ((SQL Server BOL docs doesn't give
ISNULL() examples for DATE FIELDS, only NUMBER fields), I tried
putting the dates in SINGLE QUOTES in my IsNull() function, the
QUERY RAN. Then I wasn't sure WHAT date to enter, e.g., 1/1/1889 or
1/1/2001, etc.
Then, I discovered, after experimenting, that you cannot just
blindly enter ANY date when using IsNull in a date field,
especially if you are using CFGRAPH to chart the results by day.
You have to select a date within the date range the user selected,
so this means using the FORM.DATE (or URL.DATE) value from the
form. Here's the working example from my SELECT main query:
SELECT SUM(ISNULL(d.ttldb,0)) AS SumOfDB,
SUM(ISNULL(d.ttldbv,0)) AS SumOfDBV,
SUM(ISNULL(d.ttldbi,0)) AS SumOfDBI,
<CFIF '#url.reptype#' IS "DAILY">
ISNULL(d.depday, '#url.date1#') AS depday
<CFELSE>
month(ISNULL(d.depday, '#url.date2#')) AS TranMonth,
year(ISNULL(d.depday, '#url.date2#')) AS TranYear
</CFIF>
Then I discovered that whatever date was used in the URL.DATE
field (in my case it would be one of the two date field from the
form, and depended on whether you coded DATE1 or DATE2, the chart
would always show ZERO values for that date. So I tried putting the
IsNull() date values in the GROUP BY and ORDER BY statements, e.g.,
<CFIF '#url.reptype#' IS "DAILY">
GROUP BY ISNULL(d.depday, '#url.date1#')
ORDER BY ISNULL(d.depday, '#url.date1#') DESC
<CFELSE>
GROUP BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
ORDER BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
</CFIF>
And this worked. The report ran just fine, and the chart
charted every value correctly.
I guess you have to learn all the little "quirks" about CF7
and how it's QofQ and chart programs work. But so far, so good.
Thank you all for your help. Now I've got to update other old
CF5 programs that are returning errors when there are null values
from my LEFT OUTER JOIN queries. Will take some time, but at least
I know how to do it. Thanks to your help.
I really appreciate your time and efforts to help with this
issue.
Gary

Similar Messages

  • Problem with inheritance and outputting values in toString.

    Hey guys, i'm having a major problem with inheritances.
    What i'm trying to do with my program is to create objects in my demo class. Values are passed to several other objects that each do their own calculations of grades and results and then outputs the result in my toString. I followed step by step the instructions in my book on how to setup the inheritance and such. I can only output everything that was created in my superclass, any other thing that was created in an object that belongs to a subclass does not display in the output at all.
    Even if I change or create new instance variables, I can't figure out for the life of myself how to output the other values.
    Because there's so much code to be splitting on the forums, I zipped my whole project in a RAR. I'll link it here
    http://www.4shared.com/file/ZleBitzP/Assign7.html
    The file to run the program is CourseGradesDemo class, everything else is either a subclass or superclass to some part of the program. After you run CourseGradesDemo, you will see the output, and understand what displays and what stays at 0.0 value. If anyone can help me out with this it would be greatly appreciated
    Thanks in advance.

    Basshunter36 wrote:
    Hey guys, i'm having a major problem with inheritances.
    What i'm trying to do with my program is to create objects in my demo class. Values are passed to several other objects that each do their own calculations of grades and results and then outputs the result in my toString. I followed step by step the instructions in my book on how to setup the inheritance and such. I can only output everything that was created in my superclass, any other thing that was created in an object that belongs to a subclass does not display in the output at all.
    Even if I change or create new instance variables, I can't figure out for the life of myself how to output the other values.No idea what you're talking about. Provide an [url http://sscce.org]SSCCE.
    Because there's so much code to be splitting on the forums, I zipped my whole project in a RAR. I'll link it here
    http://www.4shared.com/file/ZleBitzP/Assign7.html
    Not gonna happen. Provide an [url http://sscce.org]SSCCE. And don't say you can't. You definitely can. You may have to spend an hour building a new program from scratch and getting it to reproduce the problem, but if you can't or won't do that, you'll find few people here willing to bother with it.

  • Problems with convertNumber and Double values

    I've serious troubles using convertNumber with Double data in input fields.
    While output formatting works fine, the outputted string fails to be converted back - I get conversion errors.
    So the value that is written to the input field generates a conversion error being submitted! This is not good practice!
    I've found out the following: (I use german locale, so following examples containing ',' means decimal point)
    <f:convertNumber pattern="##0.00" />generates the right output, eg. for Double(20.50) - "20,50", but this value ("20,50") will not be parsed using the above pattern! Only values with non zero last minimum fractional digit (eg "20,51", "20,59", ... ) will be parsed!
    In addition, the above pattern doesn't parse numberstrings that don't contain all significant digits.
    For example an input of "20" will not be parsed to "20.00"!
    Maybe this is not the right forum for that problem, since i think this is a general java formatting problem (?).
    But as the problem arised by using the convertNumber tag and acting like this on numeric input fields is not very comfortable, I liked to post this here. Maybe someone can give me some advice?

    I also have found this problem, except that in my experience it is the decimal part that must be non-zero, not just the last digit of the decimal part. So with a pattern of "0.00" the string "1.50" (one and a half) will be accepted whereas the string "1.00" will not.
    My guess (just a guess) is that it is related to the documented behaviour of the DecimalFormat object when it parses a number. According to the documentation:
    The most economical subclass that can represent the number given by the string is chosen. Most integer values are returned as Long objects, no matter how they are written: "17" and "17.000" both parse to Long(17). Values that cannot fit into a Long are returned as Doubles. This includes values with a fractional part, infinite values, NaN, and the value -0.0. DecimalFormat does not decide whether to return a Double or a Long based on the presence of a decimal separator in the source string. Doing so would prevent integers that overflow the mantissa of a double, such as "10,000,000,000,000,000.00", from being parsed accurately. Currently, the only classes that parse returns are Long and Double, but callers should not rely on this. Callers may use the Number methods doubleValue, longValue, etc., to obtain the type they want.
    Which means that "1.50" will be returned as a Double while "1.00" will be returned as a Long. Perhaps there is then a class-cast exception whie trying to use this value?
    If this is indeed the problem, the solution is to use the getDouble() method of the parsed Number to create the Double to be returned, but this is for the implementer to do - not the user!

  • Problem with dg4msql and table-valued functions

    Have configured dg4msql to connect from my oracle db to ms sql server.
    Am able to do simple SELECTs from ms sql tables like:
    select * from "sys"."procedures"@dg4msql;
    or
    select * from "dbo"."SomeTable"@dg4msql;
    But am unable to do a SELECT from a table-valued function:
    select * from "dbo"."GetData"@dg4msql('param1value');
    or
    select * from "dbo"."GetData"('param1value')@dg4msql;
    In both cases I get:
    ORA-00933: SQL command not properly ended
    It does not like the parameters portion of the query ("('param1value')")
    initdg4msql.ora:
    HS_FDS_CONNECT_INFO=[svr1]//mydb
    HS_FDS_TRACE_LEVEL=OFF
    HS_FDS_PROC_IS_FUNCT=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    Have tried the other set of params:
    HS_FDS_PROC_IS_FUNCT=FALSE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    Same story. After changing the init*** file have bounced both Listeners (DB and Gateway), reconnected, and re-run the query.
    Have I missed something?
    Any help is greatly appreciated!

    Sorry, but for me it looks you did not get the problem.
    Oracle® Database Gateway for SQL Server User's Guide,:
    11g Release 2 (11.2)
    Part Number E12069-02
    *2 SQL Server Gateway Features and Restriction*
    Result Sets and Stored Procedures
    The Oracle Database Gateway for SQL Server provides support for stored procedures which return result sets.
    By default, all stored procedures and functions do not return a result set to the user. To enable result sets, set the HS_FDS_RESULTSET_SUPPORT parameter value to TRUE.
    PL/SQL Program Fetching from Result Sets in Sequential Mode
    -- Execute procedure
    out_arg := null;
    refcurproc@MSQL('Hello World', out_arg, rc1);
    Somewhere in this forum I've seen a message that the syntax "SELECT ... FROM sp@db(param1, param2)" works.
    Anyway, even with the PL/SQL block the error message is the same - ORA-00933 "SQL command not properly ended"
    and the cursor (* in SQL*PLUS) is put just at the first bracket.
    Edited by: user636213 on Aug 10, 2012 5:17 AM

  • Problem with trigger and entity in JHeadsart, JBO-25019

    Hi to all,
    I am using JDeveloper 10.1.2 and developing an application using ADF Business Components and JheadStart 10.1.2.27
    I have a problem with trigger and entity in JHeadsart
    I have 3 entity and 3 views
    DsitTelephoneView based on DsitTelephone entity based on DSIT_TELEPHONE database table.
    TelUoView based on TelUo entity based on TEL_UO database table.
    NewAnnuaireView based on NewAnnuaire entity based on NEW_ANNUAIRE database view.
    I am using JHS to create :
    A JHS table-form based on DsitTelephoneView
    A JHS table based on TelUoView
    A JHS table based on NewAnnuaireView
    LIB_POSTE is a :
    DSIT_TELEPHONE column
    TEL_UO column
    NEW_ANNUAIRE column
    NEW_ANNUAIRE database view is built from DSIT_TELEPHONE database table.
    Lib_poste is an updatable attribut in TelUo entity, DsitTelephone entity, NewAnnuaire entity.
    Lib_poste is upadated in JHS table based on TelUoView
    I added a trigger on my database shema « IAN » to upadate LIB_POSTE in DSIT_TELEPHONE database table :
    CREATE OR REPLACES TRIGGER “IAN”.TEL_UO_UPDATE_LIB_POSTE
    AFTER INSERT OR UPDATE OFF lib_poste ONE IAN.TEL_UO
    FOR EACH ROW
    BEGIN
    UPDATE DSIT_TELEPHONE T
    SET t.lib_poste = :new.lib_poste
    WHERE t.id_tel = :new.id_tel;
    END;
    When I change the lib_poste with the application :
    - the lib_poste in DSIT_TELEPHONE database table is correctly updated by trigger.
    - but in JHS table-form based on DsitTelephoneView the lib_poste is not updated. If I do a quicksearch it is updated.
    - in JHS table based on NewAnnuaireView the lib_poste is not updated. if I do a quicksearch, I have an error:
    oracle.jbo.RowAlreadyDeletedException: JBO-25019: The row of entity of the key oracle.jbo. Key [null 25588] is not found in NewAnnuaire.
    25588 is the primary key off row in NEW_ANNUAIRE whose lib_poste was updated by the trigger.
    It is as if it had lost the bond with the row in the entity.
    Could you help me please ?
    Regards
    Laurent

    The following example should help.
    SQL> create sequence workorders_seq
      2  start with 1
      3  increment by 1
      4  nocycle
      5  nocache;
    Sequence created.
    SQL> create table workorders(workorder_id number,
      2  description varchar2(30),
      3   created_date date default sysdate);
    Table created.
    SQL> CREATE OR REPLACE TRIGGER TIMESTAMP_CREATED
      2  BEFORE INSERT ON workorders
      3  FOR EACH ROW
      4  BEGIN
      5  SELECT workorders_seq.nextval
      6    INTO :new.workorder_id
      7    FROM dual;
      8  END;
      9  /
    Trigger created.
    SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
    Session altered.
    SQL> insert into workorders(description) values('test1');
    1 row created.
    SQL> insert into workorders(description) values('test2');
    1 row created.
    SQL> select * from workorders;
    WORKORDER_ID DESCRIPTION                    CREATED_DATE
               1 test1                          30-NOV-2004 15:30:34
               2 test2                          30-NOV-2004 15:30:42
    2 rows selected.

  • Problem with sqlldr and commit

    Hi,
    i have a problem with sqlldr and commit.
    I have a simple table with one colum [ col_id number(6) not null ]. The column "col_id" is primary key in the table. I have one file with 100.000 records ( number from 0 to 99.999 ).
    I want load the file in the table with sqlldr ( sql*loader ) but i want commit only if all records are loaded. If one record is discarded i want discarded all record of file.
    The proble is that in coventional path the commit is on 64 row but if i want the same records of file isn't possible and in direct path sqlldr disable primary key :(
    There are a solutions?
    Thanks
    I'm for the bad English

    This is my table:
    DROP TABLE TEST_SQLLOADER;
    CREATE TABLE TEST_SQLLOADER
    (     COL_ID NUMBER NOT NULL,
         CONSTRAINT TEST_SQLLOADER_PK PRIMARY KEY (COL_ID)
    This is my ctlfile ( test_sql_loader.ctl )
    OPTIONS
    DIRECT=false
    ,DISCARDMAX=1
    ,ERRORS=0
    ,ROWS=100000
    load data
    infile './test_sql_loader.csv'
    append
    into table TEST_SQLLOADER
    fields terminated by "," optionally enclosed by '"'
    ( col_id )
    test_sql_loader.csv
    0
    1
    2
    3
    99999
    i run sqlloader
    sqlldr xxx/yyy@orcl control=test_sql_loader.ctl log=test_sql_loader.log
    output on the screen
    Commit point reached - logical record count 92256
    Commit point reached - logical record count 93248
    Commit point reached - logical record count 94240
    Commit point reached - logical record count 95232
    Commit point reached - logical record count 96224
    Commit point reached - logical record count 97216
    Commit point reached - logical record count 98208
    Commit point reached - logical record count 99200
    Commit point reached - logical record count 100000
    Logfile
    SQL*Loader: Release 11.2.0.1.0 - Production on Sat Oct 3 14:50:17 2009
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    Control File: test_sql_loader.ctl
    Data File: ./test_sql_loader.csv
    Bad File: test_sql_loader.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 0
    Bind array: 100000 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table TEST_SQLLOADER, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    COL_ID FIRST * , O(") CHARACTER
    value used for ROWS parameter changed from 100000 to 992
    Table TEST_SQLLOADER:
    100000 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 255936 bytes(992 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 100000
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Sat Oct 03 14:50:17 2009
    Run ended on Sat Oct 03 14:50:18 2009
    Elapsed time was: 00:00:01.09
    CPU time was: 00:00:00.06
    The commit is on 992 row
    if i have error on 993 record i have commit on first 992 row :(
    Edited by: inter1908 on 3-ott-2009 15.00

  • Problem with axis2 and Tomcat

    Hello,
    I am having a strange problem with Tomcat and axis. I have a webservice that uses axis2 for wsdl2java class generation. When I compile my project in maven a Test is performed. During the test a glassfish server is established and the project is deployed -everything work great with the expected results. However when I try to deploy the webservice on tomcat it has some problems.
    At first I tried to call axis code in a POST method that takes a MultiPart message. The code is as below:
    *@Path("identifyWavestream")*
    *@POST*
    *@Consumes(MediaType.MULTIPART_FORM_DATA)*
    *@Produces(MediaType.APPLICATION_XML)*
    *public String multipartTest(com.sun.jersey.multipart.MultiPart multiPart) throws Exception {* 
    *// get first body part (index 0)*
    *//tomcat shows that the first error is here (line 122 is the nest one with bodypart)*
    BodyPart bp = multiPart.getBodyParts().get(0);
    BodyPartEntity bodyPartEntity = (BodyPartEntity) bp.getEntity();
    InputStream stream = bodyPartEntity.getInputStream();
    *//the rest of the code either saves the incoming file or implements the wsdl2java axis interface - neither works.*
    And the tomcat error is:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    java.util.ArrayList.RangeCheck(Unknown Source)
    java.util.ArrayList.get(Unknown Source)
    com.webserv.rest.resources.SearchResource.test.multipartTest(SearchResource.java:122)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:138)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    It was strange to me since this simple approach of handling a Multipart method worked for me earlier. Then I decided skip the handling of multipart method and just call the axis code. But the results also caused an error. I then tried to call the axis code in a simple @GET method (to cross out any issues regarding the multipart) and the result where the same. Again everything works on the maven- glassfish test. In this case the tomcat error is the following:
    javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:361)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    root cause
    com.sun.jersey.api.container.MappableContainerException: java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:74)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    root cause
    java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    org.apache.axis2.transport.http.AbstractHTTPSender.initializeTimeouts(AbstractHTTPSender.java:454)
    org.apache.axis2.transport.http.AbstractHTTPSender.getHttpClient(AbstractHTTPSender.java:514)
    org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:156)
    org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
    org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
    org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
    org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
    org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
    org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    com.webserv.rest.webapp.IntSoapServiceStub.getServerData(IntSoapServiceStub.java:2447)
    com.webserv..rest.resources.AIntSoapImpl.getServerData(AIntSoapImpl.java:112)
    com.webserv..rest.resources.SearchResource.test.pingTest(SearchResource.java:167)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:138)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    I think it is also a good ide to post the pom.xml file :
    Edited by: 803864 on 2010-10-21 00:30

    I think it is also a good ide to post the pom.xml file:
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    +<modelVersion>4.0.0</modelVersion>+
    +<groupId>com.myProjects</groupId>+
    +<artifactId>audioid-rest-interface</artifactId>+
    +<packaging>war</packaging>+
    +<name>AudioID Rest Interface</name>+
    +<version>0.1</version>+
    +<dependencies>+
    +<!--+
    +<dependency>+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-client</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>jersey-multipart</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.grizzly</groupId>+
    +<artifactId>grizzly-servlet-webserver</artifactId>+
    +<version>1.9.0</version>+
    +<scope>test</scope>+
    +</dependency>-->+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>jersey-multipart</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-client</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-bundle</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>commons-logging</groupId>+
    +<artifactId>commons-logging</artifactId>+
    +<version>1.0.4</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>commons-collections</groupId>+
    +<artifactId>commons-collections</artifactId>+
    +<version>3.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.slf4j</groupId>+
    +<artifactId>slf4j-log4j12</artifactId>+
    +<version>1.5.6</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>junit</groupId>+
    +<artifactId>junit</artifactId>+
    +<version>3.8.2</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.glassfish.distributions</groupId>+
    +<artifactId>web-all</artifactId>+
    +<version>10.0-build-20080430</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.glassfish.embedded</groupId>+
    +<artifactId>gf-embedded-api</artifactId>+
    +<version>1.0-alpha-4</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.hibernate</groupId>+
    +<artifactId>hibernate</artifactId>+
    +<version>3.2.5.ga</version>+
    +<exclusions>+
    +<exclusion>+
    +<groupId>javax.transaction</groupId>+
    +<artifactId>jta</artifactId>+
    +</exclusion>+
    +<exclusion>+
    +<groupId>cglib</groupId>+
    +<artifactId>cglib</artifactId>+
    +</exclusion>+
    +</exclusions>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2</artifactId>+
    +<version>1.4.1</version>+
    +</dependency>+
    +<!-- <dependency> -->+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-aar-maven-plugin</artifactId>+
    +<version>1.4.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-java2wsdl</artifactId>+
    +<version>1.4.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-xmlbeans</artifactId>+
    +<version>1.4.1</version>+
    +</dependency>+
    +<!-- <dependency> -->+
    +<dependency>+
    +<groupId>com.sun.xml.bind</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1.12</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>cglib</groupId>+
    +<artifactId>cglib-nodep</artifactId>+
    +<version>2.1_3</version>+
    +</dependency>+
    +</dependencies>+
    +<build>+
    +<finalName>audioid-rest-interface</finalName>+
    +<plugins>+
    +<plugin>+
    +<!-- This class is just generated for wadl support!!! -->+
    +<!-- Take care that folder ../music-dna-core is existing -->+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<phase>generate-sources</phase>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<generatePackage> com.webserv.wsparameters</generatePackage>+
    +<schemaDirectory>../audioid-rest-interface/src/main/resources+
    +</schemaDirectory>+
    +<includeSchemas>+
    +<includeSchema>**/*.xsd</includeSchema>+
    +</includeSchemas>+
    +<extension>true</extension>+
    +<strict>false</strict>+
    +<verbose>false</verbose>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-javadoc-plugin</artifactId>+
    +<!-- <version>2.6</version> -->+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>javadoc</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<encoding>UTF-8</encoding>+
    +<verbose>false</verbose>+
    +<show>public</show>+
    +<subpackages> com.webserv.rest.rest.resources: com.webserv.rest.rest.commons: com.webserv.wsparameters+
    +</subpackages>+
    +<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>+
    +<docletPath>${path.separator}${project.build.outputDirectory}+
    +</docletPath>+
    +<docletArtifacts>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>wadl-resourcedoc-doclet</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>xerces</groupId>+
    +<artifactId>xercesImpl</artifactId>+
    +<version>2.6.1</version>+
    +</docletArtifact>+
    +</docletArtifacts>+
    +<additionalparam>-output+
    +${project.build.outputDirectory}/resourcedoc.xml</additionalparam>+
    +<useStandardDocletOptions>false</useStandardDocletOptions>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +<executions>+
    +<execution>+
    +<id>generate</id>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<wadlFile>${project.build.outputDirectory}/application.wadl+
    +</wadlFile>+
    +<formatWadlFile>true</formatWadlFile>+
    +<baseUri>http://192.168.2.149:8080/${project.build.finalName}+
    +</baseUri>+
    +<packagesResourceConfig>+
    +<param> com.webserv.rest.resources</param>+
    +</packagesResourceConfig>+
    +<wadlGenerators>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc+
    +</className>+
    +<properties>+
    +<property>+
    +<name>applicationDocsFile</name>+
    +<value>${basedir}/src/main/doc/application-doc.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport+
    +</className>+
    +<properties>+
    +<property>+
    +<name>grammarsFile</name>+
    +<value>${basedir}/src/main/doc/application-grammars.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport+
    +</className>+
    +<properties>+
    +<property>+
    +<name>resourceDocFile</name>+
    +<value>${project.build.outputDirectory}/resourcedoc.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +</wadlGenerators>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.codehaus.mojo</groupId>+
    +<artifactId>exec-maven-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>java</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<mainClass>com.sun.jersey.samples.generatewadl.Main</mainClass>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-compiler-plugin</artifactId>+
    +<inherited>true</inherited>+
    +<configuration>+
    +<source>1.5</source>+
    +<target>1.5</target>+
    +<!--+
    exclude temporary types that are only needed for wadl and doc
    generation
    -->
    +<!--+
    +<excludes> <exclude>com/webserv/types/temporary/**</exclude>+
    +<exclude>com/webserv/rest/commons/Examples.java</exclude>+
    +</excludes>+
    -->
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.jvnet.jaxb2.maven2</groupId>+
    +<artifactId>maven-jaxb2-plugin</artifactId>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-wsdl2code-maven-plugin</artifactId>+
    +<version>1.4.1</version>+
    +<executions>+
    +<execution>+
    +<id>generate reco core</id>+
    +<goals>+
    +<goal>wsdl2code</goal>+
    +</goals>+
    +<configuration>+
    +<packageName>com.webserv.rest.webapp</packageName>+
    +<wsdlFile>src/main/java/com/webserv/wsdl/web.wsdl</wsdlFile>+
    +<databindingName>adb</databindingName>+
    +</configuration>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +<plugin>+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<generatePackage>com.webserv.wsparameters</generatePackage>+
    +<schemaDirectory>src/main/xsd</schemaDirectory> <includeSchemas>+
    +<includeSchema>**/*.xsd</includeSchema> </includeSchemas>+
    +<extension>true</extension>+
    +<strict>false</strict>+
    +<verbose>true</verbose>+
    +</configuration>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +<profiles>+
    +<profile>+
    +<id>jdk-1.5</id>+
    +<activation>+
    +<jdk>1.5</jdk>+
    +</activation>+
    +<dependencies>+
    +<dependency>+
    +<groupId>com.sun.xml.bind</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1.10</version>+
    +</dependency>+
    +</dependencies>+
    +<build>+
    +<plugins>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-javadoc-plugin</artifactId>+
    +<configuration>+
    +<docletArtifacts>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>wadl-resourcedoc-doclet</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>xerces</groupId>+
    +<artifactId>xercesImpl</artifactId>+
    +<version>2.6.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml.bind</groupId>+
    +<artifactId>jaxb-api</artifactId>+
    +<version>2.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.activation</groupId>+
    +<artifactId>activation</artifactId>+
    +<version>1.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml.stream</groupId>+
    +<artifactId>stax-api</artifactId>+
    +<version>1.0</version>+
    +</docletArtifact>+
    +</docletArtifacts>+
    +</configuration>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +</profile>+
    +<profile>+
    +<id>xsltproc</id>+
    +<activation>+
    +<file>+
    +<exists>../xsltproc_win32/xsltproc.exe</exists>+
    +</file>+
    +</activation>+
    +<build>+
    +<plugins>+
    +<!-- Create/generate the application.html using xsltproc -->+
    +<!-- Create/generate the application.html using xsltproc -->+
    +<plugin>+
    +<groupId>org.codehaus.mojo</groupId>+
    +<artifactId>exec-maven-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<id>copy-docs-to-builddir</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +<configuration>+
    +<executable>copy</executable>+
    +<commandlineArgs>src\\main\\doc\\*.* target\\classes+
    +</commandlineArgs>+
    +</configuration>+
    +</execution>+
    +<execution>+
    +<id>prepare-xsltproc</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>package</phase>+
    +<configuration>+
    +<executable>copy</executable>+
    +<commandlineArgs>..\\audioid-rest-interface\\src\\main\\resources\\*.xsd+
    target\\classes</commandlineArgs>
    +</configuration>+
    +</execution>+
    +<execution>+
    +<id>exec-xsltproc: target/application.html</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>package</phase>+
    +<configuration>+
    +<!--<executable>xsltproc</executable>-->+
    +<executable>../xsltproc_win32/xsltproc.exe</executable>+
    +<commandlineArgs>-o target/application.html+
    src/main/doc/wadl_documentation.xsl
    target/classes/application.wadl</commandlineArgs>
    +</configuration>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +</profile>+
    +</profiles>+
    +<pluginRepositories>+
    +<pluginRepository>+
    +<id>maven2-repository.dev.java.net</id>+
    +<name>Java.net Repository for Maven</name>+
    +<url>http://download.java.net/maven/2/</url>+
    +<layout>default</layout>+
    +</pluginRepository>+
    +<pluginRepository>+
    +<id>maven-repository.dev.java.net</id>+
    +<name>Java.net Maven 1 Repository (legacy)</name>+
    +<url>http://download.java.net/maven/1</url>+
    +<layout>legacy</layout>+
    +</pluginRepository>+
    +</pluginRepositories>+
    +<repositories>+
    +<repository>+
    +<id>maven2-repository.dev.java.net</id>+
    +<name>Java.net Repository for Maven</name>+
    +<url>http://download.java.net/maven/2/</url>+
    +<layout>default</layout>+
    +</repository>+
    +<repository>+
    +<id>maven-repository.dev.java.net</id>+
    +<name>Java.net Maven 1 Repository (legacy)</name>+
    +<url>http://download.java.net/maven/1</url>+
    +<layout>legacy</layout>+
    +</repository>+
    +<repository>+
    +<id>glassfish-repository</id>+
    +<name>Java.net Repository for Glassfish</name>+
    +<url>http://download.java.net/maven/glassfish</url>+
    +</repository>+
    +</repositories>+
    +</project>+
    Can anyonr contribute?

  • Problem with Roles and Triggers

    I'm having a strange problem with Roles and Triggers in Oracle. It's a little difficult to describe, so bear with me...
    I'm trying to create a trigger that inserts records into a table belonging to a different user/owner. Of course, the owner of this trigger needs rights to insert records into this other table. I find that if I add these rights directly to the owner of the trigger, everything works okay and the trigger compiles successfully.
    However, if I first create a Role and grant the "insert" rights to it, and then assign this role to the owner of the trigger, the trigger does not compile successfully.
    To illustrate this, here's an example script. I'm using Oracle 10g Release 2...
    -- Clean up...
    DROP TABLE TestUser.TrigTable;
    DROP TABLE TestUser2.TestTable;
    DROP ROLE TestRole;
    DROP TRIGGER TestUser.TestTrigger;
    DROP USER TestUser CASCADE;
    DROP USER TestUser2 CASCADE;
    -- Create Users...
    CREATE USER TestUser IDENTIFIED BY password DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" QUOTA UNLIMITED ON "USERS";
    CREATE USER TestUser2 IDENTIFIED BY password DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" QUOTA UNLIMITED ON "USERS";
    CREATE TABLE TestUser.TrigTable (TestColumn VARCHAR2(40));
    CREATE TABLE TestUser2.TestTable (TestColumn VARCHAR2(40));
    -- Grant Insert rights on TestTable to TestRole...
    CREATE ROLE TestRole NOT IDENTIFIED;
    GRANT INSERT ON TestUser2.TestTable TO TestRole;
    -- Add TestRole to TestUser. TestUser should now have rights to INSERT on TestTable
    GRANT TestRole TO TestUser;
    ALTER USER TestUser DEFAULT ROLE ALL;
    -- Now, create the trigger. This compiles unsuccessfully...
    CREATE TRIGGER TestUser.TestTrigger AFTER INSERT ON TestUser.TrigTable
    BEGIN
    INSERT INTO TestUser2.TestTable (TestColumn) VALUES ('Test');
    END;
    When I do a "SHOW ERRORS;" after this, I get:
    SQL> show errors;
    Errors for TRIGGER TESTUSER.TESTTRIGGER:
    LINE/COL ERROR
    2/3 PL/SQL: SQL Statement ignored
    2/25 PL/SQL: ORA-00942: table or view does not exist
    SQL>
    As I said above, if I just add the Insert rights directly to TestUser, the trigger compiles perfectly. Does anyone know why this is happening?
    Thanks!
    Adrian

    Hi Raghu,
    If the insert rights exist only on TestRole, and TestRole is assigned to TestUser, I can do the INSERT statement you suggest with no problems if I just execute it from SQLPlus (logged in as TestUser).
    The question is, why does the same INSERT fail when it's inside the trigger?

  • Problem with JTextPane and StateInvariantError

    Hi. I am having a problem with JTextPanes and changing only certain text to bold. I am writing a chat program and would like to allow users to make certain text in their entries bold. The best way I can think of to do this is to add <b> and </b> tags to the beginning and end of any text that is to be bold. When the other client receives the message, the program will take out all of the <b> and </b> tags and display any text between them as bold (or italic with <i> and </i>). I've searched the forums a lot and figured out several ways to make the text bold, and several ways to determine which text is bold before sending the text, but none that work together. Currently, I add the bold tags with this code: (note: messageDoc is a StyledDocument and messageText is a JTextPane)
    public String getMessageText() {
              String text = null;
              boolean bold = false, italic = false;
              for (int i = 0; i < messageDoc.getLength(); i++) {
                   messageText.setCaretPosition(i);
                   if (StyleConstants.isBold(messageDoc.getCharacterElement(i).getAttributes()) && !bold) {
                        bold = true;
                        if (text != null) {
                             text = text + "<b>";
                        else {
                             text = "<b>";
                   else if (StyleConstants.isBold(messageDoc.getCharacterElement(i).getAttributes()) && bold) {
                        // Do nothing
                   else if (!StyleConstants.isBold(messageDoc.getCharacterElement(i).getAttributes()) && bold) {
                        bold = false;
                        if (text != null) {
                             text = text + "</b>";
                        else {
                             text = "</b>";
                   try {
                        if (text != null) {
                             text = text + messageDoc.getText(i,1);
                        else {
                             text = messageDoc.getText(i, 1);
                   catch (BadLocationException e) {
                        System.out.println("An error occurred while getting the text from the message document");
                        e.printStackTrace();
              return text;
         } // end getMessageText()When the message is sent to the other client, the program searches through the received message and changes the text between the bold tags to bold. This seems as if it should work, but as soon as I click on the bold button, I get a StateInvariantError. The code for my button is:
    public void actionPerformed(ActionEvent evt) {
              if (evt.getSource() == bold) {
                   MutableAttributeSet bold = new SimpleAttributeSet();
                   StyleConstants.setBold(bold, true);
                   messageText.getStyledDocument().setCharacterAttributes(messageText.getSelectionStart(), messageText.getSelectionStart() - messageText.getSelectionEnd() - 1, bold, false);
         } //end actionPerformed()Can anyone help me to figure out why this error is being thrown? I have searched for a while to figure out this way of doing what I'm trying to do and I've found out that a StateInvariantError has been reported as a bug in several different circumstances but not in relation to this. Or, if there is a better way to add and check the style of the text that would be great as well. Any help is much appreciated, thanks in advance.

    Swing related questions should be posted in the Swing forum.
    Can't tell from you code what the problem is because I don't know the context of how each method is invoked. But it would seem like you are trying to query the data in the Document while the Document is being updated. Try wrapping the getMessageText() method is a SwingUtilities.invokeLater().
    There is no need to write custom code for a Bold Action you can just use:
    JButton bold = new JButton( new StyledEditorKit.BoldAction() );Also your code to build the text String is not very efficient. You should not be using string concatenation to append text to the string. You should be using a StringBuffer or StringBuilder.

  • Problem with writing and reading using serialization

    I am having a problem with writing and reading an object that has another object in it. The purpose of the class is to write a order that has multiple items in it. And there will be several orders. This is for an IB project, where one of the requirements is to utilize a hierarchical composite data structure. That is, it is "one that contains more than one element and at least one of the elements is a composite data structure. Examples are, an array or linked list of records, a record that has one field that is another record, or an array". The code is shown below:
    The error produced is
    java.lang.NullPointerException
         at SamsonRubberIndustries.CustomerOrderDetails.createCustOrdDetailsScreen(CustomerOrderDetails.java:150)
         at SamsonRubberIndustries.CustomerOrderDetails$1.run(CustomerOrderDetails.java:78)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    public class CustOrdObject implements Serializable {
         public int CustID;
         public int CustOrderID;
         public Object OrderDate;
         public InnerCustOrdObject[] innerCustOrdObj;
         public float GrandTotal;
         public int MaxItems;
         public CustOrdObject() {}
         public CustOrdObject(InnerCustOrdObject[] innerCustOrdObj,
    int CustID, int CustOrderID, Object OrderDate,
    float GrandTotal, int innerarrlength, int innerarrpos, int MaxItems) {
              this.CustID = CustID;
              this.CustOrderID = CustOrderID;
              this.OrderDate = OrderDate;
              this.GrandTotal = GrandTotal;          
              this.MaxItems = MaxItems;
              this.innerCustOrdObj = new InnerCustOrdObject[MaxItems];
         public InnerCustOrdObject[] getInnerCustOrdObj() {
              return innerCustOrdObj;
         public void setInnerCustOrdObj(InnerCustOrdObject[] innerCustOrdObj) {
              this.innerCustOrdObj = innerCustOrdObj;
         public int getCustID() {
              return CustID;
         public void setCustID(int custID) {
              CustID = custID;
         public int getCustOrderID() {
              return CustOrderID;
         public void setCustOrderID(int custOrderID) {
              CustOrderID = custOrderID;
         public Object getOrderDate() {
              return OrderDate;
         public void setOrderDate(Object orderDate) {
              OrderDate = orderDate;
         public void setGrandTotal(float grandTotal) {
              GrandTotal = grandTotal;
         public float getGrandTotal() {
              return GrandTotal;
         public int getMaxItems() {
              return MaxItems;
         public void setMaxItems(int maxItems) {
              MaxItems = maxItems;
    public class InnerCustOrdObject implements Serializable{
         public int ItemNumber;
         public float UnitPrice;
         public int QuantityRequired;
         public float TotalPrice;
         public InnerCustOrdObject() {}
         public InnerCustOrdObject(int ItemNumber, float
    UnitPrice, int QuantityRequired, float TotalPrice){
              this.ItemNumber = ItemNumber;
              this.UnitPrice = UnitPrice;
              this.QuantityRequired = QuantityRequired;
              this.TotalPrice = TotalPrice;
         public int getItemNumber() {
              return ItemNumber;
         public void setItemNumber(int itemNumber) {
              ItemNumber = itemNumber;
         public int getQuantityRequired() {
              return QuantityRequired;
         public void setQuantityRequired(int quantityRequired) {
              QuantityRequired = quantityRequired;
         public float getTotalPrice() {
              return TotalPrice;
         public void setTotalPrice(float totalPrice) {
              TotalPrice = totalPrice;
         public float getUnitPrice() {
              return UnitPrice;
         public void setUnitPrice(float unitPrice) {
              UnitPrice = unitPrice;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import javax.swing.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.DefaultTableModel;
    public class CustomerOrderDetails extends CommonFeatures{
         //TODO
         private static int MAX_ORDERS = 200;
         private static int MAX_ORDERITEMS = 100;
         private static int MaxRecord;
         private static int CurrentRecord = 1;
         private static int currentItem;
         private static int MaxItems;
         private static boolean FileExists, recFileExists;
         private static CustOrdObject[] orderDetails = new CustOrdObject[MAX_ORDERS];
         private static InnerCustOrdObject[] innerCustOrdObj = new InnerCustOrdObject[MAX_ORDERITEMS];     
         private static File OrderDetailsFile = new File("CustOrdDetails.dat");
         private static File OrdRecordNumStore = new File("OrdRecordNumStore.txt");
         private static PrintWriter writeFile;
         private static BufferedReader readFile;
         private static ObjectOutputStream objOut;
         private static ObjectInputStream objIn;
         //Set format for date
         SimpleDateFormat simpleDF = new SimpleDateFormat("dd MM yyyy");
         //--<BEGINNING>--Declaring Interface Variables------------------------------------------//
         private JPanel innertoppanel, innercenterpanel, innerbottompanel, innerrightpanel, innerleftpanel;
         private JLabel CustIDLbl, CustOrderIDLbl, OrderedDateLbl, GrandTotLbl, ItemNumberLbl,UnitPriceLbl, QuantityReqLbl, TotPriceLbl;
         private JTextField CustIDTxt, CustOrderIDTxt, OrderedDateTxt, GrandTotTxt, ItemNumberTxt, UnitPriceTxt, QuantityReqTxt, TotPriceTxt;
         private JButton addrecordbtn, savebtn, externalprevbtn, externalnextbtn, internalprevbtn, internalnextbtn, gotorecordbtn, additemreqbtn;
         //--<END>--Declaring Interface Variables------------------------------------------------//
         public static void main(String[] args) {
              final CustomerOrderDetails COD = new CustomerOrderDetails();
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                             COD.createCustOrdDetailsScreen();
                        } catch (Exception eb) {
                             eb.printStackTrace();
         //--<BEGINNING>--Creating CustomerOrderDetails Screen---------------------------------------//
         public JFrame createCustOrdDetailsScreen() {
              createDefaultFrame();
              mainframe.setSize(800,500);
              createContainerPanel();
              containerpanel.add(createCustOrdDetailsTitle(), BorderLayout.NORTH);
              containerpanel.add(createCustOrdDetailsMainPanel(), BorderLayout.CENTER);
              //containerpanel.add(createCustOrdDetailsLeftNavButtons(), BorderLayout.WEST);
              //containerpanel.add(createCustOrdDetailsRightNavButtons(), BorderLayout.EAST);
              containerpanel.add(createCustOrdDetailsButtons(), BorderLayout.SOUTH);
              mainframe.setContentPane(containerpanel);
              mainframe.setLocationRelativeTo(null);
              mainframe.setVisible(true);
              //--<BEGINNING>--Checks to see whether CRecordNumberStore file exists-------------------------------//
              if (OrdRecordNumStore.exists() == true) {
                   recFileExists = true;
              }else {
                   recFileExists = false;
              if (recFileExists == true) {
                   MaxRecord = readRecordNumber();
                   CurrentRecord = MaxRecord;
                   //readOrder();
                   //readInnerOrderRecord(CurrentRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              }else{
                   MaxRecord = 1;
                   writeRecordNumber(MaxRecord);
                   CustOrderIDTxt.setText(""+MaxRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              //--<END>--Checks to see whether CRecordNumberStore file exists--------------------------------------//
              if(readOrder() != null){
                   orderDetails = (CustOrdObject[]) readOrder();
                 innerCustOrdObj = orderDetails[CurrentRecord].getInnerCustOrdObj();
                   MaxItems = orderDetails[CurrentRecord].getMaxItems();
                   if(CurrentRecord > 1 && CurrentRecord < MaxRecord){
                        externalnextbtn.setEnabled(true);
                        externalprevbtn.setEnabled(true);
                   if(CurrentRecord >= MaxRecord){
                        externalnextbtn.setEnabled(false);
                   getFieldText(CurrentRecord-1);
              }else{
                   orderDetails[CurrentRecord] = new CustOrdObject();
                   currentItem = 1;
              return mainframe;
         //--<END>--Creating CustomerOrderDetails Screen---------------------------------------------//
         public JPanel createCustOrdDetailsTitle(){
              createTitlePanel();
              titlepanel.setBackground(TxtfontColor);
              label.setText("- Customer Order Details -");
              labelpanel.setBackground(TxtfontColor);
              label.setForeground(Color.white);
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor) ;
              buttonpanel.add(createReturnToMainMenuButton());
              titlepanel.add(labelpanel, BorderLayout.WEST);
              titlepanel.add(buttonpanel, BorderLayout.EAST);
              return titlepanel;
         public JPanel createCustOrdDetailsMainPanel(){
              createmainpanel();
              mainpanel.setBackground(TxtfontColor);
              mainpanel.setLayout(new BorderLayout());          
              mainpanel.setBorder(BorderFactory.createTitledBorder(""));
              mainpanel.add(createInnerTopPanel(), BorderLayout.NORTH);
              mainpanel.add(createInnerCenterPanel(), BorderLayout.CENTER);
              mainpanel.add(createInnerBottomPanel(), BorderLayout.SOUTH);
              mainpanel.add(createInnerRightPanel(), BorderLayout.EAST);
              mainpanel.add(createInnerLeftPanel(), BorderLayout.WEST);
              return mainpanel;
         public JPanel createInnerTopPanel(){
              innertoppanel = new JPanel(new GridBagLayout());
              innertoppanel.setBackground(TxtfontColor);
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              CustIDLbl = new JLabel("Customer ID");
              CustIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustIDLbl.setFont(font);
              CustIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innertoppanel.add(CustIDLbl, GBC);     
              CustIDTxt = new JTextField(20);
              CustIDTxt.setEditable(true);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innertoppanel.add(CustIDTxt, GBC);
              GBC.gridx = 3;
              GBC.gridy = 1;
              innertoppanel.add(Box.createHorizontalStrut(220), GBC);
              OrderedDateLbl = new JLabel("Order Date");
              OrderedDateLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              OrderedDateLbl.setFont(font);
              OrderedDateLbl.setForeground(LblfontColor);
              GBC.gridx = 4;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateLbl, GBC);     
              //Get today's date
              Date todaydate = new Date();
              OrderedDateTxt = new JTextField(simpleDF.format(todaydate), 20);
              OrderedDateTxt.setHorizontalAlignment(JTextField.CENTER);
              OrderedDateTxt.setEditable(false);
              GBC.gridx = 5;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateTxt, GBC);
              CustOrderIDLbl = new JLabel("Customer Order ID");
              CustOrderIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustOrderIDLbl.setFont(font);
              CustOrderIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDLbl, GBC);
              CustOrderIDTxt = new JTextField(20);
              CustOrderIDTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDTxt, GBC);
              return innertoppanel;
         public JPanel createInnerCenterPanel(){
              innercenterpanel = new JPanel(new GridBagLayout());
              innercenterpanel.setBackground(TxtfontColor);
              innercenterpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              ItemNumberLbl = new JLabel("Item Number");
              ItemNumberLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              ItemNumberLbl.setFont(font);
              ItemNumberLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberLbl, GBC);     
              ItemNumberTxt = new JTextField(20);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberTxt, GBC);
              UnitPriceLbl = new JLabel("Unit Price");
              UnitPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              UnitPriceLbl.setFont(font);
              UnitPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceLbl, GBC);     
              UnitPriceTxt = new JTextField(20);
              //UnitPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceTxt, GBC);
              QuantityReqLbl = new JLabel("Quantity Required");
              QuantityReqLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              QuantityReqLbl.setFont(font);
              QuantityReqLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqLbl, GBC);     
              QuantityReqTxt = new JTextField(20);
              //QuantityReqTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqTxt, GBC);
              TotPriceLbl = new JLabel("Total Price");
              TotPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              TotPriceLbl.setFont(font);
              TotPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceLbl, GBC);     
              TotPriceTxt = new JTextField(20);
              //TotPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceTxt, GBC);
              return innercenterpanel;
         public JPanel createInnerBottomPanel(){
              innerbottompanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              innerbottompanel.setBackground(TxtfontColor);
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              GrandTotLbl = new JLabel("Grand Total");
              GrandTotLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              GrandTotLbl.setFont(font);
              GrandTotLbl.setForeground(LblfontColor);
              innerbottompanel.add(GrandTotLbl);
              innerbottompanel.add(Box.createHorizontalStrut(30));
              GrandTotTxt = new JTextField(20);
              innerbottompanel.add(GrandTotTxt);
              return innerbottompanel;
         public JPanel createInnerRightPanel(){
              innerrightpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerrightpanel.setBackground(TxtfontColor);
              innerrightpanel.setLayout(new BoxLayout(navrightpanel, BoxLayout.Y_AXIS));
              innerrightpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerrightpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalnextbtn = new JButton(createNextButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        //getInnerFieldText(currentItem);
                        internalprevbtn.setEnabled(true);
                        if(currentItem < MaxItems){
                             ++CurrentRecord;
                             //readOrder();
                             //readInnerOrderRecord(CurrentRecord);
                             setInnerFieldText(currentItem);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(currentItem == MaxItems){
                             internalnextbtn.setEnabled(false);
              innerrightpanel.add(internalnextbtn, GBC);
              return innerrightpanel;
         public JPanel createInnerLeftPanel(){
              innerleftpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerleftpanel.setBackground(TxtfontColor);
              innerleftpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerleftpanel.setForeground(Color.BLACK);
              innerleftpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalprevbtn = new JButton(createPreviousButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        //getInnerFieldText(currentItem);
                        internalnextbtn.setEnabled(true);
                        if(currentItem == 1){
                             internalprevbtn.setEnabled(false);
                        if(currentItem > 0){
                             --currentItem;
                             //readOrder();
                             setInnerFieldText(currentItem);
              innerleftpanel.add(internalprevbtn, GBC);
              return innerleftpanel;
         public JPanel createCustOrdDetailsButtons(){
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor);
              externalprevbtn = new JButton(createPreviousButtonIcon());
              externalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalnextbtn.setEnabled(true);
                        if(CurrentRecord == 1){
                             externalprevbtn.setEnabled(false);
                        if(CurrentRecord > 0){
                             --CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
              buttonpanel.add(externalprevbtn);
              addrecordbtn = new JButton("Add Record", createAddButtonIcon());
              addrecordbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             MaxRecord = readRecordNumber();
                             MaxRecord++;
                             writeRecordNumber(MaxRecord);
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             CustIDTxt.setText("");
                             CustOrderIDTxt.setText(""+MaxRecord);
                             //Get today's date
                             Date todaydate = new Date();
                             OrderedDateTxt.setText(""+simpleDF.format(todaydate));
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             GrandTotTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             externalnextbtn.setEnabled(false);
                             externalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(addrecordbtn);
              savebtn = new JButton("Save Data", createSaveButtonIcon());
              savebtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        setFieldText(CurrentRecord);
                        writeOrder();
                        writeRecordNumber(MaxRecord);
                        System.out.println(CurrentRecord);
                        System.out.println(MaxRecord);
              buttonpanel.add(savebtn);
              java.net.URL imageURL_AddRowIcon = CommonFeatures.class.getResource("Icons/edit_add.png");
              ImageIcon AddRowIcon = new ImageIcon(imageURL_AddRowIcon);
              additemreqbtn = new JButton("Add Item", AddRowIcon);
              additemreqbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             //CurrentRecord = MaxRecord;
                             currentItem++;
                             setInnerFieldText(currentItem);
                             internalnextbtn.setEnabled(false);
                             internalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(additemreqbtn);
              externalnextbtn = new JButton(createNextButtonIcon());
              externalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalprevbtn.setEnabled(true);
                        if(CurrentRecord < MaxRecord){
                             ++CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(CurrentRecord == MaxRecord){
                             externalnextbtn.setEnabled(false);
              buttonpanel.add(externalnextbtn);
              return buttonpanel;
         //TODO
         public void setFieldText(int orderID){//TODO
              orderDetails[orderID].setCustID(Integer.parseInt(CustIDTxt.getText()));
              orderDetails[orderID].setCustOrderID(Integer.parseInt(CustOrderIDTxt.getText()));
              orderDetails[orderID].setOrderDate(OrderedDateTxt.getText());
              orderDetails[orderID].setInnerCustOrdObj(innerCustOrdObj);
              orderDetails[orderID].setMaxItems(MaxItems);
              setInnerFieldText(currentItem);
              orderDetails[orderID].setGrandTotal(Float.parseFloat(GrandTotTxt.getText()));
         public void setInnerFieldText(int currentItem){//TODO
              innerCustOrdObj[currentItem] = new InnerCustOrdObject();
              innerCustOrdObj[currentItem].setItemNumber(Integer.parseInt(ItemNumberTxt.getText()));
              innerCustOrdObj[currentItem].setUnitPrice(Float.parseFloat(UnitPriceTxt.getText()));
              innerCustOrdObj[currentItem].setQuantityRequired(Integer.parseInt(QuantityReqTxt.getText()));
              innerCustOrdObj[currentItem].setTotalPrice(Float.parseFloat(TotPriceTxt.getText()));
         public void getFieldText(int orderID){
              CustIDTxt.setText(Integer.toString(orderDetails[orderID].getCustID()));
              CustOrderIDTxt.setText(Integer.toString(orderDetails[orderID].getCustOrderID()));
              OrderedDateTxt.setText(""+orderDetails[orderID].getOrderDate());          
              currentItem = orderDetails[orderID].getMaxItems();
              System.err.println("currentItem" + currentItem);
              getInnerFieldText(currentItem);
              GrandTotTxt.setText(Float.toString(orderDetails[orderID].getGrandTotal()));
         public void getInnerFieldText(int currentItem){
              ItemNumberTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getItemNumber()));
              UnitPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getUnitPrice()));
              QuantityReqTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getQuantityRequired()));
              TotPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getTotalPrice()));
         public void writeOrder(){//TODO
              try {
                   objOut = new ObjectOutputStream(new FileOutputStream(OrderDetailsFile));
                   objOut.writeObject(orderDetails);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              } catch (IOException e) {
                   e.printStackTrace();
         public Object readOrder(){
              Object temporaryObj;
              try{
                   objIn = new ObjectInputStream(new FileInputStream(OrderDetailsFile));
                   temporaryObj = objIn.readObject();               
                   CustOrdObject[] blah = (CustOrdObject[]) temporaryObj;
                   System.out.println("Outer: "+blah[1].getCustID());
                   InnerCustOrdObject[] whee = blah[1].getInnerCustOrdObj();
                   System.out.println("Inner: "+whee[1].getItemNumber());
                   objIn.close();
                   System.out.println("Read Worky!");
                   return temporaryObj;
              }catch(Exception e){
                   e.printStackTrace();
                   System.out.println("Read No Worky!");
                   return null;
         public void writeRecordNumber(int MaxRecord){
              try{
                   objOut = new ObjectOutputStream(new FileOutputStream(OrdRecordNumStore));
                   objOut.writeObject(MaxRecord);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              }catch(Exception e){e.printStackTrace();}
         public int readRecordNumber() {
              try {
                   objIn = new ObjectInputStream(new FileInputStream(OrdRecordNumStore));
                   int temporaryObj = Integer.parseInt(objIn.readObject().toString());
                   objIn.close();
                   System.out.println("Read Number Worky!");
                   return temporaryObj;
              } catch (Exception e) {
                   e.printStackTrace();
                   System.out.println("Read Number No Worky!");
                   return -1;
    }Message was edited by:
    Kilik07
    Message was edited by:
    Kilik07

    ok i got reading to work to a certain extent... but the prob is i cnt seem to save my innerCustOrdObj proprly...when ever i look for a record using the gotorecordbtn, the outerobject, which is the orderDetails, seems to change but the innerCustOrdObj remains the same... heres the new code..
    public class CustomerOrderDetails extends CommonFeatures{
         //TODO
         private static int MAX_ORDERS = 200;
         private static int MAX_ORDERITEMS = 100;
         private static int MaxRecord;
         private static int CurrentRecord = 1;
         private static int currentItem;
         private static int MaxItems = 1;
         private static boolean FileExists, recFileExists;
         private static boolean RecordExists;
         private static CustOrdObject[] orderDetails = new CustOrdObject[MAX_ORDERS];
         private static InnerCustOrdObject[] innerCustOrdObj = new InnerCustOrdObject[MAX_ORDERITEMS];     
         private static File OrderDetailsFile = new File("CustOrdDetails.ser");
         private static File OrdRecordNumStore = new File("OrdRecordNumStore.txt");
         private static PrintWriter writeFile;
         private static BufferedReader readFile;
         private static ObjectOutputStream objOut;
         private static ObjectInputStream objIn;
         //Set format for date
         SimpleDateFormat simpleDF = new SimpleDateFormat("dd MM yyyy");
         //--<BEGINNING>--Declaring Interface Variables------------------------------------------//
         private JPanel innertoppanel, innercenterpanel, innerbottompanel, innerrightpanel, innerleftpanel;
         private JLabel CustIDLbl, CustOrderIDLbl, OrderedDateLbl, GrandTotLbl, ItemNumberLbl,UnitPriceLbl, QuantityReqLbl, TotPriceLbl;
         private JTextField CustIDTxt, CustOrderIDTxt, OrderedDateTxt, GrandTotTxt, ItemNumberTxt, UnitPriceTxt, QuantityReqTxt, TotPriceTxt;
         private JButton addrecordbtn, savebtn, externalprevbtn, externalnextbtn, internalprevbtn, internalnextbtn, gotorecordbtn, additemreqbtn;
         //--<END>--Declaring Interface Variables------------------------------------------------//
         public static void main(String[] args) {
              final CustomerOrderDetails COD = new CustomerOrderDetails();
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                             COD.createCustOrdDetailsScreen();
                        } catch (Exception eb) {
                             eb.printStackTrace();
         //--<BEGINNING>--Creating CustomerOrderDetails Screen---------------------------------------//
         public JFrame createCustOrdDetailsScreen() {
              createDefaultFrame();
              mainframe.setSize(800,500);
              createContainerPanel();
              containerpanel.add(createCustOrdDetailsTitle(), BorderLayout.NORTH);
              containerpanel.add(createCustOrdDetailsMainPanel(), BorderLayout.CENTER);
              //containerpanel.add(createCustOrdDetailsLeftNavButtons(), BorderLayout.WEST);
              //containerpanel.add(createCustOrdDetailsRightNavButtons(), BorderLayout.EAST);
              containerpanel.add(createCustOrdDetailsButtons(), BorderLayout.SOUTH);
              mainframe.setContentPane(containerpanel);
              mainframe.setLocationRelativeTo(null);
              mainframe.setVisible(true);
              //--<BEGINNING>--Checks to see whether CRecordNumberStore file exists-------------------------------//
              if (OrdRecordNumStore.exists() == true) {
                   recFileExists = true;
              }else {
                   recFileExists = false;
              if (recFileExists == true) {
                   MaxRecord = readRecordNumber();
                   CurrentRecord = MaxRecord;
                   //readOrder();
                   //readInnerOrderRecord(CurrentRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              }else{
                   MaxRecord = 1;
                   writeRecordNumber(MaxRecord);
                   CustOrderIDTxt.setText(""+MaxRecord);
                   System.out.println("Current Record " +CurrentRecord);
                   System.out.println("Max Record " +MaxRecord);
              //--<END>--Checks to see whether CRecordNumberStore file exists--------------------------------------//
              if(readOrder() != null){
                   orderDetails = (CustOrdObject[]) readOrder();
                   //CurrentRecord--;
                   //System.out.println("Current Rec Here"+CurrentRecord);
                   if(orderDetails[CurrentRecord] == null){
                        System.err.println("CustomerOrderObj 1 is null !!");
                   }else{
                        System.err.println("CustomerOrderObj 1 is  not null !!");
                   if(orderDetails[CurrentRecord].getInnerCustOrdObj() == null){
                        System.err.println("InnerCustomerOrderObj is null !!");
                   }else{
                        System.err.println("InnerCustomerOrderObj is  not null !!");
                   innerCustOrdObj = orderDetails[CurrentRecord].getInnerCustOrdObj();
                   MaxItems = orderDetails[CurrentRecord].getMaxItems();
                   if(CurrentRecord > 1 && CurrentRecord < MaxRecord){
                        externalnextbtn.setEnabled(true);
                        externalprevbtn.setEnabled(true);
                   if(CurrentRecord >= MaxRecord){
                        externalnextbtn.setEnabled(false);
                   getFieldText(CurrentRecord);
                   getInnerFieldText(MaxItems);
              }else{
                   orderDetails[CurrentRecord] = new CustOrdObject();
                   currentItem = 1;
              return mainframe;
         //--<END>--Creating CustomerOrderDetails Screen---------------------------------------------//
         public JPanel createCustOrdDetailsTitle(){
              createTitlePanel();
              titlepanel.setBackground(TxtfontColor);
              label.setText("- Customer Order Details -");
              labelpanel.setBackground(TxtfontColor);
              label.setForeground(Color.white);
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor) ;
              buttonpanel.add(createReturnToMainMenuButton());
              titlepanel.add(labelpanel, BorderLayout.WEST);
              titlepanel.add(buttonpanel, BorderLayout.EAST);
              return titlepanel;
         public JPanel createCustOrdDetailsMainPanel(){
              createmainpanel();
              mainpanel.setBackground(TxtfontColor);
              mainpanel.setLayout(new BorderLayout());          
              mainpanel.setBorder(BorderFactory.createTitledBorder(""));
              mainpanel.add(createInnerTopPanel(), BorderLayout.NORTH);
              mainpanel.add(createInnerCenterPanel(), BorderLayout.CENTER);
              mainpanel.add(createInnerBottomPanel(), BorderLayout.SOUTH);
              mainpanel.add(createInnerRightPanel(), BorderLayout.EAST);
              mainpanel.add(createInnerLeftPanel(), BorderLayout.WEST);
              return mainpanel;
         public JPanel createInnerTopPanel(){
              innertoppanel = new JPanel(new GridBagLayout());
              innertoppanel.setBackground(TxtfontColor);
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              CustIDLbl = new JLabel("Customer ID");
              CustIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustIDLbl.setFont(font);
              CustIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innertoppanel.add(CustIDLbl, GBC);     
              CustIDTxt = new JTextField(20);
              CustIDTxt.setEditable(true);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innertoppanel.add(CustIDTxt, GBC);
              GBC.gridx = 3;
              GBC.gridy = 1;
              innertoppanel.add(Box.createHorizontalStrut(220), GBC);
              OrderedDateLbl = new JLabel("Order Date");
              OrderedDateLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              OrderedDateLbl.setFont(font);
              OrderedDateLbl.setForeground(LblfontColor);
              GBC.gridx = 4;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateLbl, GBC);     
              //Get today's date
              Date todaydate = new Date();
              OrderedDateTxt = new JTextField(simpleDF.format(todaydate), 20);
              OrderedDateTxt.setHorizontalAlignment(JTextField.CENTER);
              OrderedDateTxt.setEditable(false);
              GBC.gridx = 5;
              GBC.gridy = 1;
              innertoppanel.add(OrderedDateTxt, GBC);
              CustOrderIDLbl = new JLabel("Customer Order ID");
              CustOrderIDLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              CustOrderIDLbl.setFont(font);
              CustOrderIDLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDLbl, GBC);
              CustOrderIDTxt = new JTextField(20);
              //CustOrderIDTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innertoppanel.add(CustOrderIDTxt, GBC);
              return innertoppanel;
         public JPanel createInnerCenterPanel(){
              innercenterpanel = new JPanel(new GridBagLayout());
              innercenterpanel.setBackground(TxtfontColor);
              innercenterpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              ItemNumberLbl = new JLabel("Item Number");
              ItemNumberLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              ItemNumberLbl.setFont(font);
              ItemNumberLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberLbl, GBC);     
              ItemNumberTxt = new JTextField(20);
              GBC.gridx = 2;
              GBC.gridy = 1;
              innercenterpanel.add(ItemNumberTxt, GBC);
              UnitPriceLbl = new JLabel("Unit Price");
              UnitPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              UnitPriceLbl.setFont(font);
              UnitPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceLbl, GBC);     
              UnitPriceTxt = new JTextField(20);
              //UnitPriceTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 2;
              innercenterpanel.add(UnitPriceTxt, GBC);
              QuantityReqLbl = new JLabel("Quantity Required");
              QuantityReqLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              QuantityReqLbl.setFont(font);
              QuantityReqLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqLbl, GBC);     
              QuantityReqTxt = new JTextField(20);
              //QuantityReqTxt.setEditable(false);
              GBC.gridx = 2;
              GBC.gridy = 3;
              innercenterpanel.add(QuantityReqTxt, GBC);
              TotPriceLbl = new JLabel("Total Price");
              TotPriceLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              TotPriceLbl.setFont(font);
              TotPriceLbl.setForeground(LblfontColor);
              GBC.gridx = 1;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceLbl, GBC);     
              TotPriceTxt = new JTextField(20);
              TotPriceTxt.setEditable(false);
              TotPriceTxt.addFocusListener(new FocusAdapter(){
                   public void focusGained(FocusEvent evt){
                        TotPriceTxt.setText(""+Integer.parseInt(UnitPriceTxt.getText())*Integer.parseInt(QuantityReqTxt.getText()));
              GBC.gridx = 2;
              GBC.gridy = 4;
              innercenterpanel.add(TotPriceTxt, GBC);
              return innercenterpanel;
         public JPanel createInnerBottomPanel(){
              innerbottompanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              innerbottompanel.setBackground(TxtfontColor);
              //Setting Font Type and Size
              Font font = new Font("Arial", Font.BOLD, 11);
              GrandTotLbl = new JLabel("Grand Total");
              GrandTotLbl.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              GrandTotLbl.setFont(font);
              GrandTotLbl.setForeground(LblfontColor);
              innerbottompanel.add(GrandTotLbl);
              innerbottompanel.add(Box.createHorizontalStrut(30));
              GrandTotTxt = new JTextField(20);
              innerbottompanel.add(GrandTotTxt);
              return innerbottompanel;
         public JPanel createInnerRightPanel(){
              innerrightpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerrightpanel.setBackground(TxtfontColor);
              innerrightpanel.setLayout(new BoxLayout(navrightpanel, BoxLayout.Y_AXIS));
              innerrightpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerrightpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalnextbtn = new JButton(createNextButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getInnerFieldText(currentItem);
                        internalprevbtn.setEnabled(true);
                        if(currentItem < MaxItems){
                             ++currentItem;
                             orderDetails[CurrentRecord].getInnerCustOrdObj();
                             setInnerFieldText(currentItem);
                             System.out.println("Current Item" + currentItem);
                        if(currentItem == MaxItems){
                             internalnextbtn.setEnabled(false);
              innerrightpanel.add(internalnextbtn, GBC);
              return innerrightpanel;
         public JPanel createInnerLeftPanel(){
              innerleftpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              innerleftpanel.setBackground(TxtfontColor);
              innerleftpanel.setBorder(BorderFactory.createLoweredBevelBorder());
              innerleftpanel.setForeground(Color.BLACK);
              innerleftpanel.setLayout(new GridBagLayout());          
              GridBagConstraints GBC = new GridBagConstraints();
              GBC.fill = GridBagConstraints.HORIZONTAL;
              internalprevbtn = new JButton(createPreviousButtonIcon());
              GBC.gridx = 1;
              GBC.gridy = 1;
              internalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getInnerFieldText(currentItem);
                        internalnextbtn.setEnabled(true);
                        if(currentItem == 1){
                             internalprevbtn.setEnabled(false);
                        if(currentItem > 0){
                             --currentItem;
                             orderDetails[CurrentRecord].getInnerCustOrdObj();
                             setInnerFieldText(currentItem);
                             System.out.println("Current Item" + currentItem);
              innerleftpanel.add(internalprevbtn, GBC);
              return innerleftpanel;
         public JPanel createCustOrdDetailsButtons(){
              createbuttonpanel();
              buttonpanel.setBackground(TxtfontColor);
              externalprevbtn = new JButton(createPreviousButtonIcon());
              externalprevbtn.addActionListener(new ActionListener(){
                   public void  actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalnextbtn.setEnabled(true);
                        if(CurrentRecord == 1){
                             externalprevbtn.setEnabled(false);
                        if(CurrentRecord > 0){
                             --CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println("Current Record " + CurrentRecord);//Checking RECORD_NUM
              buttonpanel.add(externalprevbtn);
              addrecordbtn = new JButton("Add Record", createAddButtonIcon());
              addrecordbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             MaxRecord = readRecordNumber();
                             MaxRecord++;
                             CurrentRecord = MaxRecord;
                             orderDetails[CurrentRecord] = new CustOrdObject();
                             writeRecordNumber(MaxRecord);
                             MaxItems = 1;
                             innerCustOrdObj[MaxItems] = new InnerCustOrdObject();
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             CustIDTxt.setText("");
                             CustOrderIDTxt.setText(""+MaxRecord);
                             //Get today's date
                             Date todaydate = new Date();
                             OrderedDateTxt.setText(""+simpleDF.format(todaydate));
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             GrandTotTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             externalnextbtn.setEnabled(false);
                             externalprevbtn.setEnabled(true);
                             System.out.println(MaxRecord);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(addrecordbtn);
              savebtn = new JButton("Save Data", createSaveButtonIcon());
              savebtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        setFieldText(CurrentRecord);
                        setInnerFieldText(MaxItems);
                        writeOrder();
                        writeRecordNumber(MaxRecord);
                        System.out.println(CurrentRecord);
                        System.out.println(MaxRecord);
              buttonpanel.add(savebtn);
              java.net.URL imageURL_AddRowIcon = CommonFeatures.class.getResource("Icons/edit_add.png");
              ImageIcon AddRowIcon = new ImageIcon(imageURL_AddRowIcon);
              additemreqbtn = new JButton("Add Item", AddRowIcon);
              additemreqbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        try{
                             //--<BEGINNING>--Clear Fields-------------------------------------------------------//
                             ItemNumberTxt.setText("");
                             UnitPriceTxt.setText("");
                             QuantityReqTxt.setText("");
                             TotPriceTxt.setText("");
                             //--<END>--Clear Fields-------------------------------------------------------------//
                             //CurrentRecord = MaxRecord;
                             MaxItems++;
                             innerCustOrdObj[MaxItems] = new InnerCustOrdObject();
                             System.out.println("Max Items "+MaxItems);
                             currentItem = MaxItems;
                             orderDetails[CurrentRecord].setMaxItems(MaxItems);
                             ///setInnerFieldText(currentItem);
                             internalnextbtn.setEnabled(false);
                             internalprevbtn.setEnabled(true);
                        } catch(Exception ec){ec.printStackTrace();}
              buttonpanel.add(additemreqbtn);
              externalnextbtn = new JButton(createNextButtonIcon());
              externalnextbtn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        getFieldText(CurrentRecord);
                        externalprevbtn.setEnabled(true);
                        if(CurrentRecord < MaxRecord){
                             ++CurrentRecord;
                             setFieldText(CurrentRecord);
                             System.out.println(CurrentRecord);//Checking RECORD_NUM
                        if(CurrentRecord == MaxRecord){
                             externalnextbtn.setEnabled(false);
              buttonpanel.add(externalnextbtn);
              gotorecordbtn = new JButton("Go To Record", createGotoButtonIcon());
              gotorecordbtn.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt){
                         * The text from the GotorecordTxt textfield will be taken and assigned
                         * to a temporary integer variable called Find. 
                        int Find = Integer.parseInt(CustOrderIDTxt.getText());
                        for(int j=1; j <= MaxRecord; j++){
                              * Using a for loop, each record can be read using the readCustRecord
                              * method.
                             getFieldText(j);
                              * An if condition is utilized to check whether the temporary stored variable, Find,
                              * matches a field in a record. If this record is found, then using the RecordExists
                              * which was declared at the top, either a true or false statement can be assigned
                              * If the record exists, then a true statement will be assigned, if not a false
                              * statement will be assigned.
                             if(orderDetails[j].getCustOrderID() == Find){
                                  RecordExists = true;
                                  break;
                             }else{
                                  RecordExists = false;
                        if(RecordExists == false){
                              * If the RecordExists is assigned a false statement, then a message will be
                              * displayed to show that the record does not exist.
                             JOptionPane.showMessageDialog(null, "Record Does Not Exist!", "Error Message", JOptionPane.ERROR_MESSAGE, createErrorIcon());
                        }else{
                             getFieldText(Find);
              buttonpanel.add(gotorecordbtn);
              return buttonpanel;
         //TODO
         public void setFieldText(int orderID){//TODO
              orderDetails[orderID].setCustID(Integer.parseInt(CustIDTxt.getText()));
              orderDetails[orderID].setCustOrderID(Integer.parseInt(CustOrderIDTxt.getText()));
              orderDetails[orderID].setOrderDate(OrderedDateTxt.getText());
              orderDetails[orderID].setInnerCustOrdObj(innerCustOrdObj);
              orderDetails[orderID].setMaxItems(MaxItems);
              setInnerFieldText(currentItem);
              orderDetails[orderID].setGrandTotal(Float.parseFloat(GrandTotTxt.getText()));
         public void setInnerFieldText(int currentItem){//TODO
              innerCustOrdObj[currentItem] = new InnerCustOrdObject();
              innerCustOrdObj[currentItem].setMaxItems(MaxItems);
              innerCustOrdObj[currentItem].setItemNumber(Integer.parseInt(ItemNumberTxt.getText()));
              innerCustOrdObj[currentItem].setUnitPrice(Float.parseFloat(UnitPriceTxt.getText()));
              innerCustOrdObj[currentItem].setQuantityRequired(Integer.parseInt(QuantityReqTxt.getText()));
              innerCustOrdObj[currentItem].setTotalPrice(Float.parseFloat(TotPriceTxt.getText()));
         public void getFieldText(int orderID){
              CustIDTxt.setText(Integer.toString(orderDetails[orderID].getCustID()));
              CustOrderIDTxt.setText(Integer.toString(orderDetails[orderID].getCustOrderID()));
              OrderedDateTxt.setText(""+orderDetails[orderID].getOrderDate());          
              currentItem = orderDetails[orderID].getMaxItems();
              orderDetails[orderID].getInnerCustOrdObj();
              System.err.println("currentItem" + currentItem);
              //getInnerFieldText(currentItem);
              GrandTotTxt.setText(Float.toString(orderDetails[orderID].getGrandTotal()));
         public void getInnerFieldText(int currentItem){
              ItemNumberTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getItemNumber()));
              UnitPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getUnitPrice()));
              QuantityReqTxt.setText(Integer.toString(innerCustOrdObj[currentItem].getQuantityRequired()));
              TotPriceTxt.setText(Float.toString(innerCustOrdObj[currentItem].getTotalPrice()));
         public void writeOrder(){//TODO
              try {
                   objOut = new ObjectOutputStream(new FileOutputStream(OrderDetailsFile));
                   objOut.writeObject(orderDetails);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              } catch (IOException e) {
                   e.printStackTrace();
         public Object readOrder(){
              Object temporaryObj;
              try{
                   objIn = new ObjectInputStream(new FileInputStream(OrderDetailsFile));
                   temporaryObj = objIn.readObject();               
                   CustOrdObject[] blah = (CustOrdObject[]) temporaryObj;
                   /*               System.out.println("Outer: "+blah[1].getCustID());
                   InnerCustOrdObject[] whee = blah[1].getInnerCustOrdObj();
                   System.out.println("Inner: "+whee[1].getItemNumber());*/
                   objIn.close();
                   System.out.println("Read Worky!");
                   return temporaryObj;
              }catch(Exception e){
                   e.printStackTrace();
                   System.out.println("Read No Worky!");
                   return null;
         public void writeRecordNumber(int MaxRecord){
              try{
                   objOut = new ObjectOutputStream(new FileOutputStream(OrdRecordNumStore));
                   objOut.writeObject(MaxRecord);
                   System.out.println("WORKING!");
                   objOut.flush();
                   objOut.close();
              }catch(Exception e){e.printStackTrace();}
         public int readRecordNumber() {
              try {
                   objIn = new ObjectInputStream(new FileInputStream(OrdRecordNumStore));
                   int temporaryObj = Integer.parseInt(objIn.readObject().toString());
                   objIn.close();
                   System.out.println("Read Number Worky!");
                   return temporaryObj;
              } catch (Exception e) {
                   e.printStackTrace();
                   System.out.println("Read Number No Worky!");
                   return -1;
    }Message was edited by:
    Kilik07

  • Problem with wpa and hidden ssid

    hi,
    I have a powerbook g4 (1,67ghz). i am having trouble connecting to a netgear router mr814 v3 if i use wpa and hidden ssid, i get a message, that the router would not support wpa!
    there is no problem with wep and hidden ssid or wpa with no hidden ssid.
    is also have no problems with wpa and hidden ssid with an ibook.
    the problems occur only with the powerbook with os x 10.3.9 as well as 10.4.2. even after the recent airport update, no change.
    thanks for the help,
    ben

    I would use WPA and broadcast your SSID.
    It use to be useful, but closing your Airport or wireless network (sometimes referred to as not broadcasting your SSID) is really no longer a real option when it comes to wireless security.
    Unfortunately "Closed" networks, MAC access control lists, and reduction in transmission power are all more "feel good" security rather than real security. All these various approaches are dated and mistakenly lead to overconfidence.
    WPA is your friend if you value wireless security.
    My recommendation is not to worry about broadcasting your SSID but use WPA. This will be more secure than a closed WEP encrypted network. Closing your network makes it very difficult for neighbouring networks to see which channels are free thus causing potential interference problems.
    Another thing to consider is that a closed network is still broadcasting and therefore is detectable (regardless of whether it is broadcasting a SSID). If someone was determined to hack into your network, then not broadcasting your SSID and MAC address access control is not going to stop them.
    WPA is virtually uncrackable (only really vunerable to a dictionary attack if a real word is used as a password) and therefore will stop the casual user and the determined hacker.

  • I'm having a problem with coreaudiotoolbox and corevideo.dll.

    I'm having a problem with coreaudiotoolbox and corevideo.dll. PC was corrupted, I restored. Now when I launch Safari, I run into errors, can't find these two dll files. Itunes won't download at all because it says something is missing but won't say what. Now what do I do? Apple won't help because they want $50 dollars just to talk with me and I've been down that road before and to no satisfaction. Help please!!

    Taken at face value, you're having trouble with Apple Application Support program files there. (Apple Application Support is where single copies of program files used by multiple different Apple programs are kept, so an AAS problem can affect both iTunes and Safari.)
    Let's try something relatively simple first. Restart the PC. Now head into your Add or Remove programs control panel, select "Apple Application Support", click "Change" and then click Repair.
    If no joy after that, try the more rigorous uninstall/reinstall procedure from the following post (although it's for Vista and 7, just read "Computer" as "My Computer", read "Uninstall a program control panel" as "Add or Remove programs control panel" and assume the system is 32-bit, and you'll be doing the right things):
    Re: I recently updated to vista service pack 2 and I updated to itunes 10.2.1 and ever since I did that my itunes won't open any more.  Itunes starts but before anything loads a window pops up saying that the prograam has encountered a problem and sh...

  • Problem with Drag and drop in panel dashboard

    Hi
    I am having problem with drag and drop in panel dashboard.
    I will explain what i am doing.
    I am using Oracle three column template in First region i am having a table that showing all customer.
    I drag one record from my table and drop it on customer info (CIF) page on second region it is working fine.
    my CIF page has a dashboard with 6 panel box. i am showing 6 different jsff in 6 panel box.
    I put drop target in each jsff
    <af:dropTarget dropListener="#{backingBeanScope.backing_customerinformation.handleItemDrop}"
    actions="COPY">
    <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
    discriminant="CustomerSearchDnD"/>
    </af:dropTarget>
    when i put drop target my panel boxes moves only when i drag it to another panel box header not entire part of panel box.
    if i remove the drop target then panel box move normally as the example given on: [http://adfui.us.oracle.com:7778/faces-trunk/faces/visualDesigns/dashboard.jspx?_afrLoop=2021391022520156&_afrWindowMode=0&_afrWindowId=null] but in taht case i am not able to drag and drop my data

    You must be an Oracle employee as you're referring to a component in the upcoming JDeveloper version which has yet been released to the general public. Oracle employee's are, I believe, directed to post on internal Oracle forums.
    CM.

  • Problem with v and w in a cube

    Hi,
    I have problem with 'v' and 'w' in an Analysis Services cube (SQL Server 2008R2).
    The example is employee number 'frvi' and 'frwi'. The cube summarize both employee's measures to employee number 'frvi'. And does not show the employee number 'frwi'. When I make a sql query in the source db it works fine.
    The collation for Analysis Services is Finnish_Swedish, and for the source db Finnish_Swedish_Cl_AS. Is it a problem with the collation?
    I hope I'll get help here!
    //Anna-Karin

    Hi,
    Thank you for your answer.
    I read now somewhere that w became a letter of it's own in the Swedish language in year 2006. That I did not know. The question is how it is handled in the different collations. I have googled a lot today about this, but have not found anything.
    Do you know if you can change the collation in a cube afterwards, and how you do it? 
    It is correct - when I run a query i management studio, it gives me values for both frwi and frvi. But in the cube the values are summarized to employee frvi.
    Best regards Anna-Karin

  • Problem with IE and pubblishedIntoWall

    Hi to all,
       i have a problem with InternetExplorer and CallBack
    In my flex code i have :
    flash.external.ExternalInterface.addCallback("pubblishedIntoWall", pubblishedIntoWall);
    The javascript code:
    function pubblishedIntoWallCarrello() {
            document.getElementById("composer").pubblishedIntoWall(1)
    In both Firefox and Chrome the javascript works in the right way.
    In internet explorer the function pubblishedIntoWall is not called.
    Have some one got an idea of this problem?
    Thanks for your time

    First of all, thank for your reply
    This is the code that i use in the HTML, i use   allowScriptAccess = sameDomain
    ----------- CODE -------------------
    <div id="divContainercomposer" style="position:absolute;left:50%;top:0px;width:930;height:100%;margin-left:-465px">
                <script language="JavaScript" type="text/javascript">
                <!--
                // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
                var hasProductInstall = DetectFlashVer(6, 0, 65);
                // Version check based upon the values defined in globals
                var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
                if ( hasProductInstall && !hasRequestedVersion ) {
                    // DO NOT MODIFY THE FOLLOWING FOUR LINES
                    // Location visited after installation is complete if installation is required
                    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
                    var MMredirectURL = window.location;
                    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                    var MMdoctitle = document.title;
                    AC_FL_RunContent(
                        "src", "playerProductInstall",
                        "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"" ,
                        "width", "930",
                        "height", "100%",
                        "align", "middle",
                        "id", "composer",
                        "quality", "high",
                        "bgcolor", "#ffffff",
                        "name", "flashContent",
                        "allowScriptAccess","sameDomain",
                        "type", "application/x-shockwave-flash",
                        "pluginspage", "http://www.adobe.com/go/getflashplayer"
                } else if (hasRequestedVersion) {
                    // if we've detected an acceptable version
                    // embed the Flash Content SWF when all tests are passed
                    AC_FL_RunContent(
                            "src", "composer",
                            "width", "930",
                            "height", "100%",
                            "align", "middle",
                            "id", "composer",
                            "quality", "high",
                            "bgcolor", "#ffffff",
                            "name", "composer",
                           "allowScriptAccess","sameDomain",
                            "type", "application/x-shockwave-flash",
                            "pluginspage", "http://www.adobe.com/go/getflashplayer"
                  } else {  // flash is too old or we can't detect the plugin
                    var alternateContent = 'Alternate HTML content should be placed here. '
                      + 'This content requires the Adobe Flash Player. '
                       + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
                    document.write(alternateContent);  // insert non-flash content
                // -->
                </script>
                <noscript>
                      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                            id="flashContent" width="930" height="100%"
                            codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                            <param name="movie" value="composer.swf" />
                            <param name="quality" value="high" />
                            <param name="bgcolor" value="#ffffff" />
                            <param name="allowScriptAccess" value="sameDomain" />
                            <embed src="composer.swf" quality="high" bgcolor="#ffffff" id="composer"
                                width="930" height="100%" name="composer" align="middle"
                                play="true"
                                loop="false"
                                quality="high"
                               allowScriptAccess="sameDomain"
                                type="application/x-shockwave-flash"
                                pluginspage="http://www.adobe.com/go/getflashplayer">
                            </embed>
                    </object>
                </noscript>
    </div>

Maybe you are looking for