ArrayOutOfBound Exception??!!!WHY
Dea Forum Members,
i need some help with my following code -
private void display() {
int counter = 0;
for(char letter = 'A'; letter < 'Z'; letter++) {
if(counter == tokenCount) {
break;
else {
rows[letter-'A'].rowDisplay(letter);
counter++;
This is actually a part of a cinema hall booking program where the row and seats will be displayed.tokenCount(an instance variable in this class) is the total number of Rows - row[0] is depicted as row 'A' and row[25] is depcited as row 'Z' for the purpose of display.the number of rows ie. tokenCount is being read from a text file....that may be 1 or 2 or maximum 26.row[i] is an object of a row class and rowDisplay(char) is a method of row class for displaying the seats of a particular row object.
so if the total number of rows(tokenCount) be 2 the for loop should be executed till 'B' only and then it will come out of the for loop as i have issued a break; command.the variable counter is keeping track of the total number of rows processed and if it matches tokenCount,it shud encounter the break; command and come out of the for loop so that further no more array is the loop is processed.so if tokenCount is 2....only row[0] and row[1] will be processed and it will come out of the for loop.but in practise while i am executing the program...i am receing an error as follows -
ArrayIndexOutOfBoundsException:2
at BookingProcess.display<BookingProcess.java:92>
where BookingProcess is the Class containing the method private void display()
pls do help me with ur suggestions......
Regards
RK
ArrayIndexOutOfBoundsException:2
at BookingProcess.display<BookingProcess.java:92>
where BookingProcess is the Class containing the
method private void display()On line 92 in BookingProcess.java, you're trying to access index 2 of an array that has, at most, elements 0 and 1.
Can't say any more than that from the information you've provided.
When you post code, please use [code] and [/code] tags.
Similar Messages
-
ArrayOutOfBound exception thrown in JAI API
Hi
I am getting exception ArrayOutOfBound exception for one of my image sample that i tried.
The code snippet is
src is a BufferedImage.
IndexColorModel icm = (IndexColorModel)src.getColorModel();
int numBands = 3;
if(icm.hasAlpha()) numBands = 4;
byte[][] data = new byte[numBands][icm.getMapSize()];
if(icm.hasAlpha())
icm.getAlphas(data[3]);
icm.getReds(data[0]);
icm.getGreens(data[1]);
icm.getBlues(data[2]);
LookupTableJAI lut = new LookupTableJAI(data);
dst = (JAI.create("lookup", src, lut)).getAsBufferedImage();
java.lang.ArrayIndexOutOfBoundsException: 255
at javax.media.jai.LookupTableJAI.lookup(LookupTableJAI.java:1244)
at javax.media.jai.LookupTableJAI.lookup(LookupTableJAI.java:1016)
at com.sun.media.jai.opimage.LookupOpImage.computeRect(LookupOpImage.java:173)
at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:914)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2343)
at javax.media.jai.RenderedOp.copyData(RenderedOp.java:2299)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2525)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546)
Thanks in advance.Hi,
it seems that the module processing is not working, if the flag keep attachments is not checked.
Best regards,
Nils Kloth -
How to resolve arrayoutofbounds exception on android?
public void fetchcontent() throws IOException
this.open();
ContentValues values = new ContentValues();
String csvFilename = "/mnt/sdcard/content.csv";
// ArrayList<String> al=new ArrayList();
CSVReader csvReader = new CSVReader(new FileReader(csvFilename));
//String row[] = null;
while((row = csvReader.readNext()) != null) {
st1 = row[0];
values.put(DatabaseHandler.Column1,st1);
st2= row[1];
values.put(DatabaseHandler.Column2,st2);
st3= row[2];
values.put(DatabaseHandler.Column3,st3);
st4= row[3];
values.put(DatabaseHandler.Column4,st4);
st5= row[4];
values.put(DatabaseHandler.Column5,st5);
database.insert(DatabaseHandler.Table_Name, null, values);
csvReader.close();
MainActivity.tt1.append("\ncontent table created");
this is my code for inserting data into a table i have created by i am getting arrayoutofbounds exception ..i am a newbiee please guys help..............................
this is the logcat output
02-21 16:27:54.308: E/AndroidRuntime(12511): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webdata/com.example.webdata.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=3; index=3Hi.
Please always specify the version of JDeveloper you are using when you post.
You are getting this message because the call to <tt>csvReader.readNext()</tt> returns an array with three elements instead of four at least once. You should check your CSV file to see if it contains invalid rows.
Best Regards,
Frédéric. -
IsCallerInRole throws "ArrayOutOfBounds" exception
If I create a domain from a Weblogic Server Template that I made, a call to "isCallerInRole" from an EJB will throw an ArrayOutOfBounds exception. The template for the server is very vanilla. If I create a domain from scratch I do not get this error. The test is on a Windows 2000 OS running Weblogic server 8.1 sp2, also it occurs on both secure and non-secure T3 connections.
Here are some other debugging tasks I did on the instance creating the error but error still exists:
1. Tried creating a new security realm and making it default.
2. Redeployed EJB.
3. Compared config.xml and startWeblogic.cmd files from a good instance to a bad one, no differences.
Any ideas?
Thanks.well,
f (newCount <= oldCount)
highest = oldCount;
else
highest = newCount;
should be other way round:
f (newCount > oldCount)
highest = oldCount;
else
highest = newCount;
otherwise you get this exception -
The following block is giving an exception.why?
DECLARE
TYPE typ_tab_oid IS TABLE OF ncs_domain.sco_item_results.OID%TYPE;
v_tab typ_tab_oid;
CURSOR cur_oid
IS
SELECT OID
FROM ncs_domain.sco_item_results sir
WHERE sir.is_total = 'Y';
v_error_code number(10);
v_error_mesg varchar2(4000);
BEGIN
OPEN cur_oid;
LOOP
FETCH cur_oid
BULK COLLECT INTO v_tab LIMIT 1000;
FORALL i IN 1 .. v_tab.COUNT
DELETE FROM ncs_domain.sco_item_results_bkp sir
WHERE sir.OID = v_tab (i);
EXIT WHEN cur_oid%NOTFOUND;
END LOOP;
CLOSE cur_oid;
EXCEPTION
WHEN OTHERS
THEN
v_error_code:=sqlcode;
v_error_messg:=sqlerrm;
insert into my_error_log values()
raise_application_error (-20001, v_error_code||''||v_error_messg);
END;
exception that i am getting is ora-30036: unable to extend segment by 8 in undo tablespace........
why??
also prior to script i had no index on the column is_total of table ncs_domain.sco_item_results
when i ran the scipt it gave the output in approx 3 hrs.
once i created bitmap index on the column is_total and it is taking 5 hrs.
SAD Part is that even after 5hrs i get an exception that no space in undo tablespace(mentioned above).
How do i handle this exception.??I am a user.Dont have any sys previliges also.
Can saomebody help in improving the perfomace of the script..
The script is basically deleting approx 10,000,000 records.Hi.
Following is the sript of the table.
It already includes nologging clause.
CREATE TABLE SCO_ITEM_RESULTS_BKP
OID VARCHAR2(32 CHAR) NOT NULL,
TEST_ID NUMBER(22,10),
STUDENT_OID VARCHAR2(32 CHAR),
TEST_TYPE VARCHAR2(32 CHAR),
CUSTOMER_ID NUMBER(9) NOT NULL,
SCORED_DATE DATE,
STATUS VARCHAR2(50 CHAR),
SCORE_VALUE VARCHAR2(10 CHAR),
SCORE_MIN VARCHAR2(10 CHAR),
SCORE_MAX VARCHAR2(10 CHAR),
NUM_ATTEMPTS NUMBER(22,4),
ITEM_ID NUMBER(22,10),
ASSIGNMENT_OID VARCHAR2(32 CHAR),
AUTH_LEVEL_ENTITY_ID NUMBER(10),
SESSION_ID NUMBER(22,10),
CREATEDBY_OID VARCHAR2(32 CHAR),
UPDATEDBY_OID VARCHAR2(32 CHAR),
CREATEDATE DATE,
UPDATEDATE DATE,
ORIGINTYPECD_OID VARCHAR2(32 CHAR),
OWNER_ORGUNIT_OID VARCHAR2(32 CHAR),
APPLICATION_VERSION VARCHAR2(32 CHAR) NOT NULL,
INACTIVESTATUS CHAR(1 CHAR) NOT NULL,
ISDELETED CHAR(1 CHAR) NOT NULL,
JOB_ID VARCHAR2(32 CHAR),
TESTRESULTS_OID VARCHAR2(32 CHAR),
FORM_ID NUMBER(10),
IS_TOTAL CHAR(1 CHAR),
STUDENT_PERSON_OID VARCHAR2(32 CHAR)
TABLESPACE BASE_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOLOGGING
NOCACHE
NOPARALLEL
MONITORING;
Edited by: user8731258 on Nov 25, 2009 8:16 PM -
AMFConnection never give exception,why?
This is my simple code
import flex.messaging.io.amf.client.AMFConnection;
import flex.messaging.io.amf.client.exceptions.ClientStatusException;
public class AMFClient {
public AMFClient() {
public static void main(String[] args) {
AMFConnection amfConnection = new AMFConnection();
String url = "http://192.168.0.199:9081/testApp/messagebroker/amf";
System.out.println("AMF Client Test");
try
amfConnection.connect(url);
catch (ClientStatusException cse)
System.out.println(cse);
return;
The program never give exception if I give a non-existed url,why?Please help
Thanks
MarkIf you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.0.1. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
iOS 5: Updating your device to iOS 5 or Later
http://support.apple.com/kb/HT4972
How to install iOS 6
http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
iOS: How to update your iPhone, iPad, or iPod touch
http://support.apple.com/kb/HT4623
If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily. Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
Cheers, Tom -
System error in block parforEach: Exception why is process finished?
Hi everybody,
we split a message in BPM. Then we loop the multiline-container element.
For each line-item we call a WebService synchrounous.
We got a exception branch for system errors.
Now we got the following problem:
Our produces abount 3000 line-items.
While processing e.g. item 1000 we got a system error and the BPM jumped into the execption branch. After processing the exception branch the process FINISHED!
We assumed that the process would go on processing the remaining items!
Is there a workaroud, that the process does go on with processing the remaining items?
Regards MarioHi,
After handling the exception, the process will be continuing after that block. So you can try to put the block within a loop until all the line items get over.
Regards,
P.Venkat -
Cursor finding zero records is not going into an exception - Why?
Hi:
I have a stored procedure I am running that opens and returns a ref cursor but if the cursor doesnt have any records in it, it isnt firing an exception.
Thanks for any help
PROCEDURE GetPaymentHistory
( pi_seq_memb_id IN NUMBER,
out_status OUT NUMBER,
out_message OUT VARCHAR2,
po_curPmtHist OUT P_EBIZ_DIAM_CONN.cursorType)
AS
vsql VARCHAR2(2000);
memb_id NUMBER;
vSpc VARCHAR2(1);
vComma VARCHAR2(1);
vLength NUMBER;
vDescription VARCHAR2(60);
BEGIN
memb_id := pi_seq_memb_id;
vSpc := '';
vComma := ',';
vDescription := '';
vsql := '' || '';
OPEN po_curPmtHist FOR
SELECT
(SELECT DISTINCT BB.BILLING_SCHEDULE_TYPE
FROM HSD_MEMBER_ELIG_HISTORY MEH
INNER JOIN BILLABLE_GROUP_BCONFIG BGB ON BGB.SEQ_GROUP_ID = MEH.SEQ_GROUP_ID
INNER JOIN BILLING_BATCH BB ON BGB.BATCH_ID = BB.BATCH_ID
WHERE MEH.SEQ_MEMB_ID= m.SEQ_MEMB_ID
AND MEH.EFFECTIVE_DATE <= sysdate) AS billFrequency,
i.invoice_id AS InvoiceNumber,
i.INVOICE_DATE AS InvoiceDate,
i.INVOICE_FROM_DATE AS BillFrom,
i.INVOICE_THRU_DATE AS BillTo,
i.REPORTED_INVOICE_BALANCE AS InvoiceAmount,
i.PAYMENT_DUE_DATE AS DueDate,
T.POST_DATETIME AS PaidDate,
T.AMOUNT AS PaidAmount,
i.TOTAL_NEW_CHARGES AS NewCharges,
i.TOTAL_APPLIED_PAYMENTS AS AppliedPayments,
i.TOTAL_APPLIED_ADJUSTMENTS AS AppliedAdjustments,
i.TOTAL_APPLIED_TRANSFERS AS AppliedTransfers,
i.TOTAL_APPLIED_RETRO_TRANS AS AppliedRetroTransactions,
i.CURRENT_INVOICE_BALANCE AS InvoiceBalance,
i.PREVIOUS_ACCOUNT_BALANCE AS PreviousAccountBalance,
i.TOTAL_REPORTED_PAYMENTS AS ReportedPayments,
i.TOTAL_REPORTED_ADJUSTMENTS AS ReportedAdjustments,
i.TOTAL_REPORTED_TRANSFERS AS ReportedTransfers,
i.TOTAL_REPORTED_RETRO_TRANS AS ReportedRetroTransactions,
i.REPORTED_ACCOUNT_BALANCE AS AccountBalance,
F.UNAPPLIED_AMOUNT AS unappTotalCash,
F.POST_DATETIME AS unappPostDate,
F.CREATE_DATETIME AS unappTransDate,
F.FUNDS_TYPE AS unappType,
F.AMOUNT AS unappAmount,
F.DESCRIPTION AS unappDescription
FROM
invoice i
INNER JOIN ar_account a ON i.ar_account_id = a.ar_account_id
INNER JOIN HSD_MEMBER_MASTER m ON a.SEQ_BILL_ENTITY_ID = m.SEQ_FAMILY_ID
LEFT OUTER JOIN AR_TRANSACTION T ON T.APPLIED_INVOICE_ID = i.INVOICE_ID
LEFT OUTER JOIN FUNDS F ON F.funds_id = a.ar_account_id
WHERE
m.seq_memb_id = memb_id AND
a.bill_entity_type='S' ;
--IF po_curPmtHist%ROWCOUNT = 0 THEN
--out_status := -1;
--out_message := 'No record found for Get Payment History';
-- ELSE
out_status := 0;
out_message := 'Get Payment History Success';
--END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
out_status := -1;
out_message := 'No record found for Get Payment History';
WHEN OTHERS THEN
out_status := -1;
out_message := 'Exception occured: Error Number:' || SQLCODE || ' Err Msg:' || SUBSTR(SQLERRM,1,100);
END GetPaymentHistory;I have a stored procedure I am running that opens
s and returns a ref cursor but if the cursor doesnt
have any records in it, This is a fairly common misconception. A cursor is simply a pointer to a compiled or prepared SQL statement with a plan for how to return the data.
Cursors do not contain data. With a ref cursor you are passing a pointer that will allow the caller to fetch the data using the prepared SQL statement.
Re: Regarding the data in a cursor -
SOAP Response From ASP Page gives Exceptions-Why ?
Hi Friends,
I am trying to call an ASP Page by sending it a SOAP Request.
The SOAP Request reaches the ASP Page but still i am getting lot of
exceptions.This is my code from Request.java
import javax.xml.soap.*;
import java.util.*;
import java.net.URL;
public class Request {
public static void main(String[] args) {
try {
SOAPConnectionFactory scFactory =
SOAPConnectionFactory.newInstance();
SOAPConnection con = scFactory.createConnection();
MessageFactory factory =
MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPHeader header = envelope.getHeader();
SOAPBody body = envelope.getBody();
header.detachNode();
Name bodyName = envelope.createName(
"TestDtls", "m",
"urn:myserver/soap:TestThis");
SOAPBodyElement gltp =
body.addBodyElement(bodyName);
Name name = envelope.createName("PhoneOrigin");
SOAPElement symbol = gltp.addChildElement(name);
symbol.addTextNode("0672324228");
URL endpoint = new URL
("http://john/myservices/testsoap.asp");
message.writeTo(System.out);
SOAPMessage response = con.call(message, endpoint);
response.writeTo(System.out);
SOAPPart sp = response.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPBody sb = se.getBody();
Iterator it = sb.getChildElements(bodyName);
SOAPBodyElement bodyElement =
(SOAPBodyElement)it.next();
String myvalue = bodyElement.getValue();
System.out.print("The Value Retrived is ");
System.out.println(myvalue);
con.close();
} catch (Exception ex) {
System.out.println(ex);
This is what i have in my ASP Page: testsoap.asp
<%
Set objReq = Server.CreateObject("Microsoft.XMLDOM")
objReq.load(Request)
strmycode = "SOAP-ENV:Envelope/SOAP-ENV:Body/m:TestDtls/PhoneOrigin"
varPhoneOrigin=objReq.SelectSingleNode(strmycode).text
status="ok"
strReturn = "<SOAP-ENV:Envelope xmlns:SOAP=""urn:schemas-xmlsoap-org:soap.v1"">" & _
"<SOAP-ENV:Header></SOAP-ENV:Header>" & _
"<SOAP-ENV:Body>" & _
"<m:TestDtlsResponse xmlns:m=""urn:myserver/soap:TestThis"">" & _
"<PhoneStatus>" & Status & "</PhoneStatus>" & _
"</m:TestDtlsResponse>" & _
"</SOAP-ENV:Body>" & _
"</SOAP-ENV:Envelope>"
Response.Write strReturn
%>
The Exceptions i get are as follows:
=====================================
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><S
OAP-ENV:Body><m:TestDtls xmlns:m="urn:myserver/soap:TestThis"><PhoneOrigin>"0672
324228"</PhoneOrigin></m:TestDtls></SOAP-ENV:Body></SOAP-ENV:Envelope>Jul 11, 20
03 6:37:35 PM com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a S
OAP message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is
this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(Messa
geImpl.java:268)
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
35)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
_1Impl.java:45)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
teMessage(SOAPMessageFactory1_1Impl.java:32)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
PConnection.java:361)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
ost.run(HttpSOAPConnection.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
PConnection.java:126)
at Request.main(Request.java:34)
Jul 11, 2003 6:37:35 PM com.sun.xml.messaging.saaj.soap.MessageImpl <init>
SEVERE: SAAJ0535: Unable to internalize message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:2
02)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
_1Impl.java:45)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
teMessage(SOAPMessageFactory1_1Impl.java:32)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
PConnection.java:361)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
ost.run(HttpSOAPConnection.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
PConnection.java:126)
at Request.main(Request.java:34)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:te
xt/html. Is this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(Messa
geImpl.java:268)
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
35)
... 7 more
CAUSE:
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is
this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(Messa
geImpl.java:268)
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
35)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
_1Impl.java:45)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
teMessage(SOAPMessageFactory1_1Impl.java:32)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
PConnection.java:361)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
ost.run(HttpSOAPConnection.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
PConnection.java:126)
at Request.main(Request.java:34)
CAUSE:
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is
this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(Messa
geImpl.java:268)
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
35)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
_1Impl.java:45)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
teMessage(SOAPMessageFactory1_1Impl.java:32)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
PConnection.java:361)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
ost.run(HttpSOAPConnection.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
PConnection.java:126)
at Request.main(Request.java:34)
java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptio
nImpl: Unable to internalize message
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
PConnection.java:126)
at Request.main(Request.java:34)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize m
essage
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:2
02)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
_1Impl.java:45)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
teMessage(SOAPMessageFactory1_1Impl.java:32)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
PConnection.java:361)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
ost.run(HttpSOAPConnection.java:156)
... 3 more
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:te
xt/html. Is this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(Messa
geImpl.java:268)
at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
35)
... 7 more
Actually,i need to see the response in XML format as per my program.
But,What does all this stuff mean ? I have using latest jwsdp 1.2.
Can Anyone Help me on this ?i have the same problem. when i make a test with a VB client, the SOAP message is builded this way "<SOAP.... instead of <SOAP-ENV.... tag generated by java. When a make a test in vb client using this syntax (SOAP-ENV), the asp page returns a error:
<font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a01a8'</font>
<p>
<font face="Arial" size=2>Object required: 'objXMLDOM.selectSingleNode(...)'</font>
<p>
<font face="Arial" size=2>/rcruz/soap/vbSoap/simplesoap.asp</font><font face="Arial" size=2>, line 6</font>
Anyone have a idea???
Thanks -
While Navigating back Recieved out of Memory Exception: WHY?
i used JHEADSTART to built my Application. Major portion of the Application is Built now. when navigating back to the previous pages i have recieved this exception
23-Jan 13:35:44 DEBUG (JhsNavigationHandlerImpl) -handleNavigation action=#{WizardPageListCreateNewEquip_Acc.getPreviousAction}, outcome=WizardCreateNewEquip_AccbillingProfile
23-Jan 13:35:44 DEBUG (JhsNavigationHandlerImpl) -Executing checkRoles
23-Jan 13:35:46 DEBUG (WizardProcessModel) -Wizard page has changed.
Jan 23, 2008 1:36:21 PM oracle.adf.view.faces.bean.util.StateUtils$Saver restoreState
SEVERE:
java.lang.OutOfMemoryError: Java heap space
23-Jan 13:36:29 DEBUG (JhsPageLifecycle) -Executing prepareModel, page=/pages/CreateNewEquip_AccbillingProfile.jspx, pagedef=CreateNewEquip_AccPageDef
23-Jan 13:36:29 DEBUG (JhsNavigationHandlerImpl) -Executing checkRoles
23-Jan 13:37:26 DEBUG (JhsPageLifecycle) -Executing prepareModel, page=/pages/ProductCatalouge.jspx, pagedef=ProductCatalougePageDef
23-Jan 13:37:26 DEBUG (JhsNavigationHandlerImpl) -Executing checkRoles
I am using Jdeveloper 10.1.3.3
JHEADSTART Version : 10.1.3.1.26
when i again clicked on the link to open the same page it gave same exception i.e. JAVA HEAP SPACE with out f memory.........Seems like your OC4J instance is running out of memory space.
Try starting it with more memory allocated to it.
(or if you only run into this after running your application inside JDeveloper several times - try to stop and restart the embedded OC4J). -
IfsSession.disconnect( ) is throwin an exception. why
ifsSession.disconnect() is throwin the following exception.. what's the reason for this??
Exception in thread "main" org.omg.CORBA.BAD_OPERATION: The delegate has not been set! minor code: 0 completed: No
at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:43)
at org.omg.CORBA.portable.ObjectImpl.hashCode(ObjectImpl.java:268)
at java.util.Hashtable.remove(Hashtable.java:422)
at oracle.ifs.search.SQLGenerator.disposeGenerator(SQLGenerator.java:136)
at oracle.ifs.server.S_LibrarySession.disconnect(S_LibrarySession.java, Compiled Code)
at oracle.ifs.server.S_LibrarySession.DMDisconnect(S_LibrarySession.java:1872)
at oracle.ifs.beans.LibrarySession.DMDisconnect(LibrarySession.java:5332)
at oracle.ifs.beans.LibrarySession.disconnect(LibrarySession.java:1541)
at IfsClass.main(IfsClass.java:41)Hi.
Following is the sript of the table.
It already includes nologging clause.
CREATE TABLE SCO_ITEM_RESULTS_BKP
OID VARCHAR2(32 CHAR) NOT NULL,
TEST_ID NUMBER(22,10),
STUDENT_OID VARCHAR2(32 CHAR),
TEST_TYPE VARCHAR2(32 CHAR),
CUSTOMER_ID NUMBER(9) NOT NULL,
SCORED_DATE DATE,
STATUS VARCHAR2(50 CHAR),
SCORE_VALUE VARCHAR2(10 CHAR),
SCORE_MIN VARCHAR2(10 CHAR),
SCORE_MAX VARCHAR2(10 CHAR),
NUM_ATTEMPTS NUMBER(22,4),
ITEM_ID NUMBER(22,10),
ASSIGNMENT_OID VARCHAR2(32 CHAR),
AUTH_LEVEL_ENTITY_ID NUMBER(10),
SESSION_ID NUMBER(22,10),
CREATEDBY_OID VARCHAR2(32 CHAR),
UPDATEDBY_OID VARCHAR2(32 CHAR),
CREATEDATE DATE,
UPDATEDATE DATE,
ORIGINTYPECD_OID VARCHAR2(32 CHAR),
OWNER_ORGUNIT_OID VARCHAR2(32 CHAR),
APPLICATION_VERSION VARCHAR2(32 CHAR) NOT NULL,
INACTIVESTATUS CHAR(1 CHAR) NOT NULL,
ISDELETED CHAR(1 CHAR) NOT NULL,
JOB_ID VARCHAR2(32 CHAR),
TESTRESULTS_OID VARCHAR2(32 CHAR),
FORM_ID NUMBER(10),
IS_TOTAL CHAR(1 CHAR),
STUDENT_PERSON_OID VARCHAR2(32 CHAR)
TABLESPACE BASE_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOLOGGING
NOCACHE
NOPARALLEL
MONITORING;
Edited by: user8731258 on Nov 25, 2009 8:16 PM -
WL 6.1 ArrayOutOfBounds exception
I recently installed WebLogic 6.1 and jdk 1.4.0 on my RedHat 7.2 box.
It seems to install without issue but when I attempt to start the
server this is what I get:
$ ./setEnv.sh
LD_LIBRARY_PATH=/var/www2/bea/wlserver6.1/lib/linux/i686:/var/www2/bea/wlserver6.1/lib/linux/i686/oci816_8
CLASSPATH=/usr/local/java/j2sdk1.4.0/lib/tools.jar:/var/www2/bea/wlserver6.1/lib/weblogic_sp.jar:/var/www2/bea/wlserver6.1/lib/weblogic.jar:
PATH=/var/www2/bea/wlserver6.1/bin:/usr/local/java/j2sdk1.4.0/jre/bin:/usr/local/java/j2sdk1.4.0/bin:/var/www2/bea/wlserver6.1/lib/linux:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/pwhite/bin
Your environment has been set.
$ ./startWebLogic.sh
LD_LIBRARY_PATH=/var/www2/bea/wlserver6.1/lib/linux/i686:/var/www2/bea/wlserver6.1/lib/linux/i686/oci816_8
* To start WebLogic Server, use the password *
* assigned to the system user. The system *
* username and password must also be used to *
* access the WebLogic Server console from a web *
* browser. *
[UnixLoginModule]: succeeded importing info:
uid = 525
gid = 100
supp gid = 100
supp gid = 101
[UnixLoginModule]: added UnixPrincipal,
UnixNumericUserPrincipal,
UnixNumericGroupPrincipal(s),
to Subject
The WebLogic Server did not start up properly.
Exception raised:
java.lang.ArrayIndexOutOfBoundsException
at com.bea.utils.misc.ProcessUtil.base64ToBytes(ProcessUtil.java:552)
at com.bea.utils.misc.Process.validate(Process.java:1231)
at com.bea.utils.misc.Process.isValidSignature(Process.java:518)
at com.bea.utils.misc.ProcessManager.memCheck(ProcessManager.java:647)
at weblogic.t3.srvr.T3Srvr.checkAccess(T3Srvr.java:286)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:343)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
at weblogic.Server.main(Server.java:35)
Reason: Fatal initialization exception
I have searched around the WebLogic site and Google and could not find
anything helpful.
PeteHi.
If you still see this when running with the JDK (1.3.1_01) that comes with the WLS installation then you should open a case with support. Also, if you are not already doing so you should install service
pack 2 for WLS.
Regards,
Michael
Pete Keiper-White wrote:
Thanks you for the response. I tried using it with 1.3.1_03 and got an
identical error.
Pete
Michael Young <[email protected]> wrote in message news:<[email protected]>...
Hi.
JDK isn't supported yet for WLS. What happens when you use JDK 1.3.1?
Regards,
Michael
Pete Keiper-White wrote:
I recently installed WebLogic 6.1 and jdk 1.4.0 on my RedHat 7.2 box.
It seems to install without issue but when I attempt to start the
server this is what I get:
$ ./setEnv.sh
LD_LIBRARY_PATH=/var/www2/bea/wlserver6.1/lib/linux/i686:/var/www2/bea/wlserver6.1/lib/linux/i686/oci816_8
CLASSPATH=/usr/local/java/j2sdk1.4.0/lib/tools.jar:/var/www2/bea/wlserver6.1/lib/weblogic_sp.jar:/var/www2/bea/wlserver6.1/lib/weblogic.jar:
PATH=/var/www2/bea/wlserver6.1/bin:/usr/local/java/j2sdk1.4.0/jre/bin:/usr/local/java/j2sdk1.4.0/bin:/var/www2/bea/wlserver6.1/lib/linux:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/pwhite/bin
Your environment has been set.
$ ./startWebLogic.sh
LD_LIBRARY_PATH=/var/www2/bea/wlserver6.1/lib/linux/i686:/var/www2/bea/wlserver6.1/lib/linux/i686/oci816_8
* To start WebLogic Server, use the password *
* assigned to the system user. The system *
* username and password must also be used to *
* access the WebLogic Server console from a web *
* browser. *
[UnixLoginModule]: succeeded importing info:
uid = 525
gid = 100
supp gid = 100
supp gid = 101
[UnixLoginModule]: added UnixPrincipal,
UnixNumericUserPrincipal,
UnixNumericGroupPrincipal(s),
to Subject
The WebLogic Server did not start up properly.
Exception raised:
java.lang.ArrayIndexOutOfBoundsException
at com.bea.utils.misc.ProcessUtil.base64ToBytes(ProcessUtil.java:552)
at com.bea.utils.misc.Process.validate(Process.java:1231)
at com.bea.utils.misc.Process.isValidSignature(Process.java:518)
at com.bea.utils.misc.ProcessManager.memCheck(ProcessManager.java:647)
at weblogic.t3.srvr.T3Srvr.checkAccess(T3Srvr.java:286)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:343)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
at weblogic.Server.main(Server.java:35)
Reason: Fatal initialization exception
I have searched around the WebLogic site and Google and could not find
anything helpful.
Pete
Michael Young
Developer Relations Engineer
BEA Support -
I wanted to deploy a webservice with axis and tomcat.
I got the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: javax.xml.rpc.SerciveException.
Can anyone tell me what to do?
thanks,
chilimaninclude the jaxb far files and the saaj.jar file into TOMCAT_HOME\common\libs\
-
Why bad padding exception???
hi guys
here i am trying to decrypt the already encrypted string by one different encrpytion algo.
in the example i have encrypted the string by des and then i tried to decrypt it using blowfish but it gives as the output null instead of a random string...because of a bad padding exception(check line 86). help to remove the exception.
if we try to decrypt the des encrypted string by des again it give n padding exception. why with blowfish???
// CIPHER / GENERATORS
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.KeyGenerator;
// KEY SPECIFICATIONS
import java.security.spec.KeySpec;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEParameterSpec;
// EXCEPTIONS
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;
import java.security.spec.InvalidKeySpecException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
public class StringEncrypter {
Cipher ecipher;
Cipher dcipher;
StringEncrypter(SecretKey key, String algorithm) {
try {
ecipher = Cipher.getInstance(algorithm);
dcipher = Cipher.getInstance(algorithm);
ecipher.init(Cipher.ENCRYPT_MODE, key);
dcipher.init(Cipher.DECRYPT_MODE, key);
} catch (NoSuchPaddingException e) {
System.out.println("EXCEPTION: NoSuchPaddingException");
} catch (NoSuchAlgorithmException e) {
System.out.println("EXCEPTION: NoSuchAlgorithmException");
} catch (InvalidKeyException e) {
System.out.println("EXCEPTION: InvalidKeyException");
public String encrypt(String str) {
try {
// Encode the string into bytes using utf-8
byte[] utf8 = str.getBytes("UTF8");
// Encrypt
byte[] enc = ecipher.doFinal(utf8);
// Encode bytes to base64 to get a string
return new sun.misc.BASE64Encoder().encode(enc);
} catch (BadPaddingException e) {
} catch (IllegalBlockSizeException e) {
} catch (UnsupportedEncodingException e) {
} catch (IOException e) {
return null;
public String decrypt(String str) {
try {
// Decode base64 to get bytes
byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
// Decrypt
byte[] utf8 = dcipher.doFinal(dec);
// Decode using utf-8
return new String(utf8, "UTF8");
} catch (BadPaddingException e) {
System.out.println("BAd padding excception");
} catch (IllegalBlockSizeException e) {
System.out.println("IllegalBlockSizeException");
} catch (UnsupportedEncodingException e) {
System.out.println("UnsupportedEncodingException");
} catch (IOException e) {
System.out.println("IOException");
return null;
public static void testUsingSecretKey() {
try {
String secretString = "code cant be decrypted!";
SecretKey desKey = KeyGenerator.getInstance("DES").generateKey();
SecretKey blowfishKey = KeyGenerator.getInstance("Blowfish").generateKey();
StringEncrypter desEncrypter = new StringEncrypter(desKey, desKey.getAlgorithm());
StringEncrypter blowfishEncrypter = new StringEncrypter(blowfishKey, blowfishKey.getAlgorithm());
String desEncrypted = desEncrypter.encrypt(secretString);
String desDecrypted = desEncrypter.decrypt(desEncrypted);
String blowfishDecrypted = blowfishEncrypter.decrypt(desEncrypted);
System.out.println(desKey.getAlgorithm() + " Encryption algorithm");
System.out.println(" Original String : " + secretString);
System.out.println(" Encrypted String : " + desEncrypted);
System.out.println(" Decrypted String : " + desDecrypted);
System.out.println();
System.out.println(blowfishKey.getAlgorithm() + " Encryption algorithm");
System.out.println(" Original String : " + desEncrypted);
System.out.println(" Decrypted String : " + blowfishDecrypted);
System.out.println();
} catch (NoSuchAlgorithmException e) {
public static void main(String[] args) {
testUsingSecretKey();
}peter_crypt wrote:
you are right but this is my question. why cant we do that?? it should be possible.by the way i am working on a project for cryptanalysis . there i need to implement it.You need to spend more time studying and less time programming -
1) Applied Cryptography, Schneier, Wiley, ISBN 0-471-11709-9
2) Practical Cryptography, Ferguson and Schneier, Wiley, ISBN 0-471-22357-3
3) Java Cryptography, Knudsen, O'Reilly, ISBN 1-56592-402-9 dated but still a good starting point
4) Beginning Cryptography with Java, written by David Hook and published by WROX . -
Life Simulation ~~ Lost in Too many Else/If clauses ~~ Weird Exceptions :)
Hello
I decided to code the "Simulation of Life" problem (It is such a common sense algorithm, I feel if I write down the rules here I'll be flamed for assuming readers are not educated enough :S )
My String array is a 20 by 20 area. Living cells are O , the others are just a blank space.
I have a randomizer method that randomly places cells. Which works OK.
A display method to print out the array in console (for now..) which works OK for the first time
An update method which checks the cells one by one and decides if it is going to live or not. Now this is not the trivial part. Cells at 4 corners, Cells on rows 0 || 19, and cells on columns 0 || 19 are special cases. All the rest are updated depending on the 8 neighbors. I have soooooooooooooooooooo many ifs and elses in this method, sometimes I get a ArrayOutOfBounds exception which happens inside an if clause that only operates if the cell doesnt have row 0 or 19 , column 0 or 19, totally not on a side or corner. Says index is 20, which is impossible :(
When I remove the mentioned lines, the display method doesn't update and print a new array.
When I can get this else/if torture, I ll write another code which simulates a plague traveling in the array and make the 2 simulations communicate (virus location will be sent to first simulation, to kill that cell) on a midware for simulations (pRTI).
Here is my monstrously amateur code
import se.pitch.prti1516.FederateAmbassadorImpl;
import se.pitch.prti1516.RTI;
import hla.rti1516.AttributeHandle;
import hla.rti1516.FederateAmbassador;
import hla.rti1516.FederateHandle;
import hla.rti1516.FederationExecutionAlreadyExists;
import hla.rti1516.ObjectClassHandle;
import hla.rti1516.RTIambassador;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JOptionPane;
public class simOne {
public String federateType;
public FederateAmbassador fedAmb;
public String federationExecutionName;
public String hostname;
public int portnumber;
public RTIambassador rti;
public FederateHandle federateHandle;
public String [][] cells = new String[20][20];
public simOne () throws MalformedURLException, Exception {
//GET RTI AMBASSADOR
hostname = "195.87.237.50";
portnumber = 8989;
rti = RTI.getRTIambassador(hostname, portnumber);
File file = new File("C:\\Documents and settings\\basary\\Desktop\\Workspace\\HelloWorld\\hello.xml");
URL url = null;
java.net.URI url1 = null;
try {
url1 = file.toURI();
url = url1.toURL();
} catch (MalformedURLException e) {
//CREATE FEDERATE EXECUTION
federationExecutionName = "Hello";
try {
rti.createFederationExecution(federationExecutionName, url);
} catch (FederationExecutionAlreadyExists e)
//JOIN FEDERATION EXECUTION
FederateAmbassador fedAmb = null;
String federateType = "Hello";
federateHandle = rti.joinFederationExecution(federationExecutionName, federateType, fedAmb, null);
//DECLARE PARAMETERS/OBJECTS TO BE PUBLISHED AND/OR REGISTERED
ObjectClassHandle helloClassHandle = rti.getObjectClassHandle("ObjectRoot.Hello.Name");
AttributeHandle greetingHandle = rti.getAttributeHandle(helloClassHandle, "Name1");
AttributeHandle typeHandle = rti.getAttributeHandle(helloClassHandle, "type");
public static void main (String []args) throws Exception{
simOne life = new simOne();
life.setCells();
life.displayCommune();
life.updateGeneration();
life.displayCommune();
life.updateGeneration();
life.displayCommune();
life.updateGeneration();
life.displayCommune();
life.updateGeneration();
life.displayCommune();
life.updateGeneration();
life.displayCommune();
private void setCells() {
// TODO Auto-generated method stub
for (int row = 0; row<=19; row++)
for (int column= 0; column<=19 ; column++)
int randomize = (int) (100* Math.random());
if (randomize < 50)
cells [row][column] = "O";
else
cells [row][column] = " ";
private void displayCommune() {
// TODO Auto-generated method stub
for (int row=0; row <= 19 ; row++ )
for (int column= 0; column <= 19 ; column ++)
System.out.print(cells[row][column]);
System.out.println("");
System.out.println("");
private void updateGeneration() {
// TODO Auto-generated method stub
for (int row = 0; row <= 19; row++)
for (int column = 0; column <= 19; column++)
int liveOnes = 0;
//if not alive
if ( cells[row][column].equals(""))
if (row == 0)
if (column == 0)
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else if (row == 19)
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
else
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
else if (row != 0 || row != 19)
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else if ((column != 0 || column != 19) && (row != 0 || row != 19))
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
//life rules to revive an unliving cell here
if (liveOnes >= 3)
cells[row][column] = "O";
// if alive
else if ( cells[row][column].equals("O")) {
int alive= 0;
if (row == 0)
if (column == 0)
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else if (row == 19)
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
else
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
else
if (column == 0)
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
else if (column == 19 )
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
else
if (cells[row-1][column-1].equals("O"))
liveOnes++;
if (cells[row-1][column].equals("O"))
liveOnes++;
if (cells[row-1][column+1].equals("O"))
liveOnes++;
if (cells[row][column-1].equals("O"))
liveOnes++;
if (cells[row][column+1].equals("O"))
liveOnes++;
if (cells[row+1][column-1].equals("O"))
liveOnes++;
if (cells[row+1][column].equals("O"))
liveOnes++;
if (cells[row+1][column+1].equals("O"))
liveOnes++;
} //see if a living cell will die or not
if (liveOnes <= 2)
cells[row][column]="";
else if (liveOnes >= 4)
cells[row][column]="";
}Thanks for the help if you can find the courage to delve into those ifs and elses :)instead of exposing a 2D array of Strings, why not create classes Grid and Cell? Grid will have an implementation of a 2D grid of Cells.
part of the problem with your logic is that you have to continually deal with whether or not an array has been allocated properly and whether or not the reference it holds is null. stop doing that. create the Grid to contain the number of cells it needs, all non-null. Initialize each Cell so it's 100% ready to go - not nul, with proper state.
Give the Grid the rules for changing the state of each Cell, and let the Cell hang onto the state. I think it'll go better that way.
%
Maybe you are looking for
-
Sales Value not updated in credit check
Hai Guys, I am facing an important issue in the Credit check. The Sales value (SO / Dly made but not delivered / billed) is not reflecting in the credit check. 1. I created a step in the pricing procedure and assigned its 'subtotal' to A (KOMP-CMPRE)
-
How do I install VB6 on Windows 7?
I am trying to install VB6 (actually, visual Studio 6) on Win7. In the very early steps of setup, I am stuck to "Need to install Microsoft Java Virtual Machine". If I uncheck the JVM box, I am not allowed to continue. If i check it, I am told that JV
-
See question.
-
Hi Experts Can anyone explain me the complete process of SUS vendor. I transfered some vendors from R/3 to EBP. Made them as portal vendors . Then I transfered vendors to SUS using T.Code BBP_SP_SUPP_INI. Then using SOST T.code i logged in as a vendo
-
When you import a music CD, what's the best setting for highest audio quality? I read somewhere that MP3 is not high quality?