Who can tell how to validate a date in poor java?
My programm can let user to input date in the default dateformat. Before save it to database I'd validate if the input is valid date. buf I can't find any function to do it both in java.util.Date and java.sql.Date, my program is as follow:
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); // in default Locale
java.util.Date testdate;
input = jtfInDate.getText().trim();
if(!input.equals("")) {
try {
testdate = df.parse(input);
} catch(ParseException pe) {
JOptionPane.showMessageDialog(this,
"<html><font color=red size=4>invalid date format</font></html>",
"warning",
JOptionPane.WARNING_MESSAGE);
return false;
System.out.println("indate" +testdate);
If I input "dafafa" in the jtfInDate(is a JTextField),the DateFormat can detect that's invalid and throw ParseException. But when I input "9999-99-99", the DateFormat can parse it without Exception!!!
and print out as "indate=Thu Jun 07 00:00:00 CST 10007", year 10007!!!!
"9999-99-99" is obviously a invalid date format. Why DateFormat.parse() can think is OK?
Is this the java's excellency????
Could anyone tell me how to judge a string of date is valid?
You can use the setLenient method to tell the DateFormat object to stop trying to help you out, this should go some way toward getting you where you need to go. Check the API docs out for that.
Good Luck
Lee
PS: don't mind esran, he's not the sharpest tool in the shed, and is likely still trying to figure out the mess he documented in this thread:
http://forum.java.sun.com/thread.jsp?thread=519291&forum=31&message=2479820
So, I suppose a little slack is warrented
Similar Messages
-
Who can tell me the ' Oracle Application Data Exchange ' download url ?
Who can tell me the ' Oracle Application Data Exchange ' download url ?
thanks
Yiming Gao
[email protected]Can you refer the Note:68795.1 ?
Regards -
Anyone? Thanks ;) tell me
How to solve about the "apple ID has been disabled"?I am having the same issue. I just got my Iphone4 on Friday and no matter what I do to confirm my AppleID, it says its been disabled. Anyone have any ideas?
-
Since my iMac OSX have installed the Lion last week, my iMac could not connect to the internet in the first turn on, and at least I turn off the computer, and turn it on again, then there is not problem to connect to the internet. So, it take much time to access to network.
Today I called apple store to fix the problem. They rebooted my system with their distance control.By that time, it seems work. But after couple hours later, I turn on my iMac, there is not connection to the network again. I hope someone could help me to solve that problem. Thanks!I think I would call them back to follow up. As far as they know, everything is fine. But if you call back they can continue from where they were. They usually give a case number either over the phone the first time you called, or in an email later.
-
Who can tell me how to search keywords in java
recently I'm doing a project called "Persistent Search Engine",
when I came to search part implementation, I'm puzzeld with the resource on the web, I found many of the implementation was did with the package " javax.help.search", but I didn't know how to use it, and where can I get it, or just it's already in the java libarary? who can tell me something about it ?
thankyou very much! ---shieldySee here http://java.sun.com/products/javahelp/
-
Who can tell me how to get the CRT for BBPCRM patch 8
hello ,
my solution patch level is SAP_BASIS 700 0011 SAPKB70011 SAP Basis Component
SAP_ABA 700 0011 SAPKA70011 Cross-Application Component
PI_BASIS 2005_1_700 0011 SAPKIPYJ7B PI_BASIS 2005_1_700
ST-PI 2005_1_700 0003 SAPKITLQI3 SAP Solution Tools Plug-In
SAP_BW 700 0012 SAPKW70012 SAP NetWeaver BI 7.0
SAP_AP 700 0008 SAPKNA7008 SAP Application Platform
BBPCRM 500 0007 SAPKU50007 BBPCRM
CPRXRPM 400 0002 SAPK-40002INCPRXRPM SAP xRPM/cProjects/cFolders 4.00 (ABAP)
ST 400 0010 SAPKITL420 SAP Solution Manager Tool
ST-A/PI 01G_BCO700 0000 - Servicetools for other App./Netweaver 04
ST-ICO 150_700 0007 SAPK-15077INSTPL SAP Solution Manager Implementation Cont
ST-SER 700_2005_2 0002 SAPKITLOC2 SAP Solution Manager Service Tools
But now , i find some CRM function can not be used , for example , i could not create a servcie message and monitor , if i create a service message and monitor the message , an abap dump occurs , the dump error is
CALL_METHOD_NOT_IMPLEMENTED
CX_SY_DYN_CALL_ILLEGAL_METH
Error in the ABAP Application Program
The current ABAP program "CL_EX_CRM_APPOINTMENT_BADI====CP" had to be
terminated because it has
come across a statement that unfortunately cannot be executed.
i try to upgrade the BBPCRM patch to 8 . the system tell me that you should need a CRT for the patch . i try to find the CRT, Unfortunate , i could't find it . who can tell me how to find the CRT . thanks !Hi Tony,
Please, refer to note 892412. Here you can find the patch level required depending on the solman used. I can tell u that we have applied this note and currently we create service messages. Check this patch levels first.
Regds,
Jose Sorli -
Who can tell me how to use ni-imaq functions imgSessionSerialFlash,imgSessionSerialWrite and imgSessionSerialRead to set and get my carema attribute?
My camera is duncantech ms3100 and the frame grabber is pci-1428.I use ni-imaq2.6.When I use these functions,it tell me error -1074397163(IMG_ERR_BINT:Bad interface) .I have the same problem on my IPAD 2. One calender that i cant delete or find any settings for... Its just in the calender app under diffrent calenders. how do i delete it?
-
Who can tell me how to use the transction "KKRC"?
who can tell me how to use the transction "KKRC"?
Please explain me all the steps to be required.
Thanks in advance!hi..
http://help.sap.com/bp_bl603/BBLibrary/Documentation/181_BPP_EN_BR.doc
KKBC HOE Transaction code Error
Regards -
i wanna to ask who can tell me when the iphone 5 release at malaysia...??the price how much...??
Put the phone in DFU mode (google it) and restore as new.
When prompted during the restore process, select restore from an iCloud backup, enter your Apple ID credentials and the device will restore. Once complete, everything should be as it was without the passcode.
FYI, syncing photos to PhotoStream on iCloud is NOT a backup. It merely keeps the last 30 days and a set number of photos... anything beyond that rolls off PhotoStream.
You really should be using the device as designed, meaning regularly copying pictures/videos taken with the device off to a computer.
Contacts, if configured, should be synced to iCloud based on your statements above. -
Who can tell me how to finish to filter content of file by Minifilter?
Hi
who can tell me how to finish to filter content of file by Minifilter?
Thanks
www.jiangkai.netThis is a huge project at your level of knowledge expect multiple people for 18 months to 3 years to complete it. You may want to look at the OSR kit for doing this
https://www.osr.com/monadnock/ It is expensive but it means you would have a product this year.
Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com -
Who can tell me how to creat ePubs?
Who can tell me how to creat ePubs?
Try searching google or elsewhere for "how create epub on windows"
-
Topic: Who can explain how EJB connect to Oracle9i DB with DataSource?
I have taken 4 days into this problem. I am developing EJB with
J2EE1.3 and Oracle9i DB, I can connect to DB in code with
DriverManager. But I want to use DataSource to connect to DB. I
failed, I can not get new way to resolve it when I after try to
connect with javax.sql.DataSource,
oracle.jdbc.pool.OracleDataSource and
oracle.jdbc.pool.OracleConnectionPoolDataSource.
I have got different Exceptions when I coding different ways:
one is:
Caught an exception.
java.rmi.ServerException: RemoteException occurred in server
thread; nested exception is:
java.rmi.RemoteException: nested exception is:
javax.ejb.EJBException: Unable to connect to database.
com.sun.enterprise.resource.JdbcDataSource; nested
exception is:
javax.ejb.EJBException: Unable to connect to database.
com.sun.enterprise.resource.JdbcDataSource
java.rmi.RemoteException: nested exception is:
javax.ejb.EJBException: Unable to
connect to database. com.sun.enterprise.resource.JdbcDataSource;
nested exception is:
javax.ejb.EJBException: Unable to connect to database.
com.sun.enterprise.resource.JdbcDataSource
javax.ejb.EJBException: Unable to connect to database.
com.sun.enterprise.resource.JdbcDataSource
<<no stack trace available>>
the Other is:
Caught an exception.
java.rmi.ServerException: RemoteException occurred in server
thread; nested exception is:
java.rmi.RemoteException: nested exception is:
javax.ejb.EJBException: Unable to connect to database.
makeConnection:Io Exception: Connection refused(DESCRIPTION=
(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=
(CODE=12505)(EMFI=4)
))); nested exception is:
javax.ejb.EJBException: Unable to connect to database.
makeConnection:Io
Exception: Connection refused(DESCRIPTION=(TMP=)
(VSNNUM=150999297)(ERR=12505)(ERROR_
STACK=(ERROR=(CODE=12505)(EMFI=4))))
java.rmi.RemoteException: nested exception is:
javax.ejb.EJBException: Unable to
connect to database. makeConnection:Io Exception: Connection
refused(DESCRIPTION=(TM
P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)
(EMFI=4)))); nested exception is:
javax.ejb.EJBException: Unable to connect to database.
makeConnection:Io
Exception: Connection refused(DESCRIPTION=(TMP=)
(VSNNUM=150999297)(ERR=12505)(ERROR_
STACK=(ERROR=(CODE=12505)(EMFI=4))))
javax.ejb.EJBException: Unable to connect to database.
makeConnection:Io Exception: C
onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)
(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
<<no stack trace available>>
My codes related are:
private void makeConnection() throws NamingException,
SQLException {
try{
InitialContext ic = new InitialContext();
OracleConnectionPoolDataSource ocpds =
(OracleConnectionPoolDataSource) ic.lookup(dbName);
PooledConnection pc = ocpds.getPooledConnection();
con = pc.getConnection();
}catch(SQLException ex){
throw new SQLException("makeConnection:" + ex.getMessage());
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
con = DriverManager.getConnection(
"jdbc:oracle:thin:@172.28.200.43:1521:shcd",
"lijun", "xiaotian"); */
public void setEntityContext(EntityContext context) {
this.context = context;
try {
makeConnection();
} catch (Exception ex) {
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
I believe I set JNDI and config EJB right, because I can run it
with Cloudscape DB all right.
who can tell me where is my WRONG, or tell me how to connect to
Oracle9i DB?Hi,
on small thing to check (or perhaps do):
Make sure that you are using the JDBC drivers from the Oracle9i
DB client e.g. copy the classes12.jar from the ORACLE_HOME of
the database client into OC4J_HOME lib.
Also, one thing that might help is to define an explict Oracle
datasource e.g.
- Set class to value of Oracle DataSource class
- Use only the location logical name
- Returns Oracle implementation of java.sql.Connection
<data-source
class="oracle.jdbc.pool.OracleDataSource"
name="jdbc/oracle/PooledDS"
location="jdbc/oracle/PooledDS"
username="scott"
password="tiger"
url="jdbc:oracle:thin:@<host>:<port>:<SID>"
/>
Andy -
About applet ,jsp ,!!!who can tell me ????
how can i pass data from applet to jsp ??????
i have an applet , and i can have data in this applet
i want to do like this :when i press a button in the applet,it is to show a new browser(jsp) ,and the data got form the applet
will be sent to the jsp ( JspDataTest.jsp ).
applet code like this :(i use it to send data to JspDataTest.jsp)
urlInfo = new URL("http://10.33.9.82:8080/Project/JspDataTest.jsp");
/**show jspDataTest.jsp*/
getAppletContext().showDocument(urlInfo);
/**open a connection*/
HttpURLConnection connection = (HttpURLConnection)
urlInfo.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-type", "application/octet-stream");
connection.setDoOutput(true);
connection.setDoInput(true);
Vector data = new Vector() ;
data.add("1");
data.add("2");
data.add("3") ;
ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());
out.writeObject(data) ;
out.flush() ;
out.close();
JspDataTest.jsp ,code like this : (i use it to receive data form applet )
<%
try{
//get data
ObjectInputStream in=new ObjectInputStream(request.getInputStream());
Vector vv = (Vector)in.readObject();
}catch(Exception e){
e.printStackTrace();
%>
but it tell me Error like this :
java.io.EOFException :
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java )
at java.io.ObjectInputStream$BlockDataInput.readShort(ObjectInputStream.java )
who can tell me why ????? and tell me how to resolve it ??
Thanks !!!!!It's not good to send data as serialized data objects to your front end jsp. It'd be better sending data to another servlet/jsp which will process them, probably by saving them in session. After closing the OutputStream, you have to invoke a javascript function in order to make your browser to submit a request to your front end jsp. So you code could be something like:
out.close();
// get the JSObject representing the applet's browser window.
JSObject win = JSObject.getWindow(this);
// Run JavaScript with eval(). Careful with those nested quotes!
win.eval("alert('before submit');jspsubmit();");
Of cource you have to add the jspsumbit() javascript function in the header of your JspDataTest.jsp. It have only to do a submit to itself (or whatever page you like). The jsp which gets this request can get data from the session. -
Who can tell me what are the functions of the following subdirectories?
Who can tell me what are the functions of the following subdirectories? How are they classified?
oracle@hostp ~$ cd $ORACLE_HOME
oracle@hostp db_1$ ls
{color:#0000ff}
assistants demo jdbc network oui slax
bin diagnostics jdk nls owm sqlj
cdata has jlib oc4j perl sqlnet.log
cfgtoollogs hostp_db10g jre odbc plsql sqlplus
clone hostp_rcatalog ldap olap precomp srvm
config hs lib OPatch racg sysman
crs install log opmn rdbms uix
css {color:#000000}install.platform{color} md oracore relnotes wwg
ctx inventory mesg oraInst.loc {color:#ff6600}root.sh{color} xdk
dbs javavm mgw {color:#ff6600}ord root.sh.old{color}
{color}
dbs javavm mgw ord root.sh.oldHi,
Here we go:
- assistants: configuration Assistants
- bin: binaries for all products
- ctx: interMedia Text cartridge
- dbs : contain initsid.ora, lksid (initiation files, password files,etc)
- instal:l install related files
- lib: Oracle product libraries
- jlib: Java classes
- md: Spatial cartridge
- mlx Xerox: Stemmer (for interMedia Text cartridge)
- network: Net8
- nlsrtl : NLS run-time loadable data
- ocommon: common files for all products
- odg: data gatherer
- opsm: Parallel Server Manager Components
- oracore: core libraries
- ord: data cartridges
- otrace: Oracle TRACE
- OPatch: Patches to the DB
- plsql : PL/SQL
- precomp: precompilers
- rdbms : server files and libraries required for the database
- slax: SLAX parser
- sqlplus : SQL*Plus
For more Information you can refer to:
- http://www.stanford.edu/dept/itss/docs/oracle/10g/em.101/b12140/3_oui_oracle_homes.htm
- http://www.dba-oracle.com/linux/important_files_directories.htm
Cheers,
Francisco Munoz Alvarez
http://www.oraclenz.com -
I've seen all the posts for fixing the wifi on the 4s, none of them work! So, who can tell me why my iPhone 4S cannot find any wifi when it used to find wifi, and when it does find a wifi network it can never connect? You think apple would have a clue how to fix it! Because turning the wifi on and off doesn't work, resorting network settings doesn't work, even restoring phone to factory default doesn't work...
Did not work. I've selected iMessage to ON and left it. After a few hours I recieved a message "activation unsuccessful. Turn on iMessage to try again". This has been going on for the past 3 days.
Maybe you are looking for
-
How to use SWX_GET_MANAGER
Hi Friends, Can you please give an example of how to use FM 'SWX_GET_MANAGER'... i really appriciate if you give some examples.. John.
-
Sony xperia j issue with backlight
While the phone is blocked it's sometimes turns on the backlighting,changed the walpapers,rebooted the phone. It appeared after updating to the latest update.
-
WL 8.1-Messaging Bridge..
Hi, I'm evaluating WL 8.1, SP1 for connecting to external MQ Series using Messaging Bridge. I configured the External MQ-JMS queue as Source destination of Messaging Bridge and local Weblogic JMS queu
-
How to preselect all rows before displaying ALV report
I would like to select all rows before sending ALV Grid Display. User then can unselect couple of rows for further processing. How do I do that ?. Im using Method grid1->SET_TABLE_FOR_FIRST_DISPLAY for ALV Report Display. Any help appreciated.
-
Did anyone come across subtotal error in Scheduled workbooks?
Hi In Discoverer worksheet if a column3 has a calculation like column1/column2 then the sum of it should be (sum column1/sum column2). This works fine in interactive worksheets. But when the same workbook is scheduled the Column3 SUM returns merely t