Caused by: org.apache.activemq.selector.ParseException: Parse error at line 0, column 0. Encountered: <EOF> at org.apache.activemq.selector.SelectorParser.generateParseException(SelectorParser.java:1231) at org.apache.activemq.selector.SelectorParser.jj_consume_token(SelectorParser.java:1179) at org.apache.activemq.selector.SelectorParser.unaryExpr(SelectorParser.java:468) at org.apache.activemq.selector.SelectorParser.multExpr(SelectorParser.java:390) at org.apache.activemq.selector.SelectorParser.addExpression(SelectorParser.java:359) at org.apache.activemq.selector.SelectorParser.comparisonExpression(SelectorParser.java:211) at org.apache.activemq.selector.SelectorParser.equalityExpression(SelectorParser.java:156) at org.apache.activemq.selector.SelectorParser.andExpression(SelectorParser.java:135) at org.apache.activemq.selector.SelectorParser.orExpression(SelectorParser.java:114) at org.apache.activemq.selector.SelectorParser.JmsSelector(SelectorParser.java:106) at org.apache.activemq.selector.SelectorParser.parse(SelectorParser.java:84) ... 63 more
String regEx = "Caused by:(.*)";
Pattern pat = Pattern.compile(regEx);
Matcher mat = pat.matcher(content);
boolean rs = mat.find();
System.out.println("found?" + rs);
System.out.println(mat.group(1));
org.apache.activemq.selector.ParseException: Parse error at line 0, column 0. Encountered: <EOF>
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
System.out.println("baos:" + exception);
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexpTest {
/**
* 读取文件中的内容
* @return
*/
public String readFile(){
try {
String fileName = "D:\\test2\\exception.log";
File f = new File(fileName);
FileInputStream fis = new FileInputStream(f);
int filesize = fis.available();
byte[] buffer = new byte[filesize];
fis.read(buffer);
return new String(buffer);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 正则表达式测试
*/
public void test(){
try {
String content = readFile();
System.out.println(content);
String regEx = "Caused by:(.*)";
Pattern pat = Pattern.compile(regEx);
Matcher mat = pat.matcher(content);
boolean rs = mat.find();
System.out.println("found?" + rs);
System.out.println(mat.group(1));
// for(int i=1;i<=mat.groupCount();i++){
// System.out.println("found:" + mat.group(i));
// }
} catch (Exception e) {
e.printStackTrace();
}
}
public void test2(){
try {
FileInputStream fis = new FileInputStream("d:\\test.txt");
fis.read();
} catch (Exception e) {
e.printStackTrace();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
System.out.println("exception:" + exception);
}
}
public static void main(String[] args) {
RegexpTest rt = new RegexpTest();
//rt.test();
rt.test2();
}
e.getCause().getClass()
e.getCause().getMessage()
@SuppressWarnings("unchecked")
@RequestMapping(value="/createSubscriber", method = RequestMethod.POST)
public @ResponseBody
WrappedResult createSubscriber(@ItemsRequestBody List<Map> list) {
LocalBrokerFacade facade = new LocalBrokerFacade(BrokerRegistry.getInstance().findFirst());
WrappedResult result = new WrappedResult();
try {
Map params = list.get(0);
String clientId = (String)params.get("clientId");
String subscriberName = (String)params.get("subscriberName");
String topicName = (String)params.get("topicName");
String selector = (String)params.get("selector");
// if("".equals(selector)){
// selector = null;
// }
facade.getBrokerAdmin().createDurableSubscriber(clientId,
subscriberName,topicName,selector);
result.setSuccessful(true);
} catch (Exception e) {
System.out.println("Exception:" + e.getCause().getClass() + "," + e.getCause().getMessage());
//log.error("createSubscriber failed.", e);
}
Exception:class org.apache.activemq.selector.ParseException,Parse error at line 0, column 0. Encountered: <EOF>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有