Ronald Mee

Greenhorn
+ Follow
since Jul 05, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ronald Mee

Is there any regular expression forum on java which i can post my query to for more relevant answers?
12 years ago
Hi sorry if my reply is not very clear.

Basically i have content that is enter into a textarea like this post i am posting.

I want the java regular expresion to be able to autmatically detect the links and convert them to html hyperlinks which are clickable.

|http://naishe.blogspot.com|
|http://tw.com/#!/someTEXTs|
|http://ts123t1.rapi.com/#!download|13321|1313|fairy_tale.mp4|
|http://www.google.com|
|https://www.google.com|
|google.com|
|google.com|
|google.com/test|
|123.com/test|
|ex-ample.com|
|http://ex-ample.com/test-url_chars?param1=val1&;par2=val+with%20spaces|

as you can see alot of forums posts are able to do that. But i been having problem finding a regular expression that will work for all the urls.

Can advise further?

12 years ago
Thanks for input.

Can anyone assist to explain how does this regular expression work exactly?

message = message.replaceAll("(?:https?|http?)://[\\w/%.\\-?&=!#]+(?!.*\\[/)",
"$0");

And also how can i improve it to match the urls.

E.g. like how to make it match url like

http://www.google.com.sg/#hl=en&output=search&sclient=psy-ab&q=test&oq=&aq=&aqi=&aql=&gs_sm=&gs_upl=&gs_l=&psj=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=37e992000c3eb140&biw=1366&bih=638

Or url with special characters like !#&'()*+,-./:;=?@[]_~$
12 years ago

Please refer to below regular expression

message = message.replaceAll("(?:https?|http?)://[\\w/%.\\-?&=!#]+(?!.*\\[/)",
"$0");

I also notice that certain links like http://www.google.com.sg/#hl=en&output=search&sclient=psy-ab&q=test&oq=&aq=&aqi=&aql=&gs_sm=&gs_upl=&gs_l=&psj=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=37e992000c3eb140&biw=1366&bih=638 is not able to convert to html hyperlink successfully.

Can anyone advise how to improve the regular expression?


12 years ago
Hi,

can anyone advise why i encountered index out of bouns exception when running this method to replace the value by $ sign?

E.g. i pass in a message $$vmdomodm$$

message = message.replaceAll("$", "$");
12 years ago
I encounter this error after deployment of the java web application (.war). If i remove the server.policy file. I will not encounter this error however it means that there will be no security. I realize that the error will occur if i include the following in server.policy which by default is included permission java.lang.RuntimePermission "modifyThreadGroup";

If inside the server.policy file i just remove this permission java.lang.RuntimePermission "modifyThreadGroup";

I will get access denied as by default the security manager will check for this permission

Anyone have any idea what is wrong and how do i resolve this?

[#|2009-01-22T12:33:18.229+0800|SEVERE|sun-appserver-ee8.1_02|javax.enterprise.system.container.web|_ThreadID=12;|StandardWrapperValve[default]: Servlet.service() for servlet default threw exception

java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method) at com.sun.security.auth.SubjectCodeSource.<init>(SubjectCodeSource.java:71) at com.sun.security.auth.PolicyFile$2.run(PolicyFile.java:821) at java.security.AccessController.doPrivileged(Native Method) at com.sun.security.auth.PolicyFile.getPermissions(PolicyFile.java:818) at javax.security.auth.SubjectDomainCombiner$3.run(SubjectDomainCombiner.java:357) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.SubjectDomainCombiner.combineJavaxPolicy(SubjectDomainCombiner.java:353) at javax.security.auth.SubjectDomainCombiner.combine(SubjectDomainCombiner.java:191) at java.security.AccessControlContext.goCombiner(AccessControlContext.java:390) at java.security.AccessControlContext.optimize(AccessControlContext.java:304) at java.security.AccessController.checkPermission(AccessController.java:426) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.security.Security.getProperty(Security.java:724) at com.sun.security.auth.PolicyFile.initPolicyFile(PolicyFile.java:356) at com.sun.security.auth.PolicyFile.init(PolicyFile.java:269) at com.sun.security.auth.PolicyFile.getPermissions(PolicyFile.java:869) at com.sun.security.auth.PolicyPermissions.init(PolicyFile.java:1416) at com.sun.security.auth.PolicyPermissions.elements(PolicyFile.java:1429)

15 years ago
I encounter this java.lang.StackOverflowError error after deployment of the java web application (.war). If i remove the server.policy file. I will not encounter this error however it means that there will be no security. I realize that the error will occur if i include the following in server.policy which by default is included permission java.lang.RuntimePermission "modifyThreadGroup";

If inside the server.policy file i just remove this permission java.lang.RuntimePermission "modifyThreadGroup";

I will get access denied as by default the security manager will check for this permission

Anyone have any idea what is wrong and how do i resolve this?

java.lang.StackOverflowError
15 years ago
the previous problem is being resolved


now i am having another problem

when i try to run the .do file i got this error..

java.lang.UnsupportedClassVersionError: Bad version number in .class file


any idea?
17 years ago
Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.

I got the above error..when i try to run a struts application..
anyone have any idea what could be the problem?
17 years ago
Anyone knows what does this error means?

i got this error when trying to run a servlet class from a jsp page
using struts-config

[7/9/07 17:31:45:669 SGT] 1f0102 WebGroup I SRVE0092I: [Servlet
LOG]: action: Error creating Action instance for path '/targetAnnouncement1', class name
'com.ncs.portal.announcement.ctlr.ActTargetAnnouncementTest':
java.lang.UnsupportedClassVersionError:
com/ncs/portal/announcement/ctlr/ActTargetAnnouncementTest (Unsupported major.minor version 49.0)
17 years ago
I been trying to follow this example http://cse-mjmcl.cse.bris.ac.uk/blog/2007/06/20/1182370280435.html

But i have not being able to run the batch job.

Anyone manage to come up with a simple Batch Job Application using Quartz and Spring can guide me along?