About "Illegal group reference" exception throws in Matcher
I somehow need to have a string containing one or more '$' be used in some appendReplacement() function in a matcher, so I decided to modify the "$" character in that string into "\$" to escape from capturing an invalid group.
Here is an example illustrating my case:
http://developer.domaindlx.com/ron/TestRE.java.txt
But after changing the "$" to "\\$", supposedly I did, "Illegal group reference" exception still threw when I try to use that "$"-containing string in appendReplacement() method in Matchers.
Can anyone kindly tell me the reason behind and suggest me possible solution?
Thank you very much.
You didn't put enough backslashes in (and no I don't know why the extra is needed - probably because there is another layer in there.)
String newString = oldString.replaceAll("[\\$]", "\\\\\\$");
Similar Messages
-
Hi all,
i wanted to know that if one had a reference to an exception object, can one use a reference to throw an exception in java?
Message was edited by:
RainXrainman,
The only place you'd want to throw a reference to an existing exception is to "catch and re-throw" that specific type of exception, whilst "rolling up" all other exceptions... which (arguably) makes it easier for the the "client programmer" to deal with the various exceptions thrown by your class.
In all other circumstance you usually just
throw new WhateverException("meaningful message");
coz it's simple, convenient, and effective.
an exception roll-up looks something this...try { //process service request
... stuff ...
try {
//do "stuff"
some where in here something throws InvalidArgumentException("oops!");
} catch(InvalidArgumentException e) {
throw e;
} catch(Exception e) {
throw new ServiceException("failed to do stuff. cause: "+e.getMessage());
} catch(InvalidArgumentException e) { //deal with known alternate outcomes
//prompt user to re-enter arguments and try again
} catch (ServiceException e) {
//log a full stack trace
//return a canned "contact [email protected]" response
} catch (Throwable t) { //catch "the rest"
//log a full stack trace
//return a canned "contact [email protected]" response including the phrase "Please DO NOT repeat whatever you just did. It WILL NOT work".
//SUICIDE THE SERVER
}cheers. keith. -
Illegal monitor state exception?
hi, I am writing a rmi server/client readers/writers type program. server has syncronized start read/stop read methods and also start write/stop write. these are controlled by int variables to give writers priority as ilustrated below
public synchronized String startReading(int yLoc, int xLoc)
int tempVal = 0;
String returnMess = "";
try
nrtotal++; // ADD ONE TO TOTAL READERS
if (nwtotal!=0) // IF WAITING WRITERS
System.out.println("\nClient waiting to read");
wait();
nr++; // INCREASE NUMBER OF READERS BY ONE
tempVal = memory[yLoc][xLoc];
//System.out.println("\nClient read "+tempVal+ " from location y:"+yLoc+" x:"+xLoc);
returnMess = "\nClient read "+tempVal+ " from location y:"+yLoc+" x:"+xLoc;
catch(InterruptedException e)
System.out.println("startReading:"+e.toString());
return returnMess;
The problem is that the read methods should not really be synchronized, so multiple readers can read at the same time. The write methods remain synchronized, but if i change the read methods to normal: public string startreading(etc,etc) when i run the remote client and call the rmi server method to read I get an illegal monitor state exception in main. does anyone know why?
Thankssynchronizing is allowing you to have multiple readers working concurrently.
When the startReading method is invoked it puts a temporary lock on itself. As soon it completes the next thread can access the method.
So in essence, you have a group of threads running for each reader. If a reader makes a call on the startReading method it will wait for its turn.
Should the thread that is accessing the method get detained, locked, or simply have an enormous amount of reading to do, it can seem that the reader is slow and not working concurrent threads. -
<blockquote>Locking duplicate thread.<br>
Please continue here: [[/questions/856718]]</blockquote>
I had 41 tabs open in about six groups over the last year and a half and I just close them and exited Firefox. Is there any way to get them back?
Also, is there any way to save a group or an open session and then restore it later?History menu, if it was destroyed in the last session
then use "Restore Previous session:" and then restore all windows also from the history menu.
If done in this session try the restore all windows under the history menu. -
How to catch exception throw bc4j
Dear Forum
I am user of JDeveloper Swing application.
while exception throw from bc4j some particular
type error such as (oracle.jbo.DMLException) JBO-26041
message display.
i want to catch error no 26041 inorder to display own
messageBox.
There is two methods
1-:
i used messageBundle class i overite message string but unable to change dialogBox,i want to use own dialog.
2-:
And i fund ,DML exception message return from JUErrorHandlerDlg class.So using this subclass how
to catch and throw own message.
Plase send me some code to write sub class of JUErrorHandlerDlg.You want this method System to throw an exception if the String[] is empty?
public void system( ObjectOutputStream output, String cmd [] ) {
if (cmd.length == 0)
throw new IllegalArgumentException("Hey! This is an empty array!");
//...rest of your method
}You can choose for yourself which exception type is most appropriate. You can in theory always use the base Exception but is not very specific nor recommended. In this case, I think an existing unchecked exception such as IllegalArgumentException would be the most appropriate. -
I need information about Web dynpro ABAP Exception : ICF Service Node
I need information about Web dynpro ABAP Exception :
ICF Service Node "/sap/bc/webdynpro/sap/abcd/undefined" does not exist.
Here abcd is application name.
ICF Service Node exists and activated but kindly let me know from where "undefined" is coming .
Please let me know your comments /views about this.Hi,
I think ur webdynpro service is not active after upgradation.
You have manually activate it.
Go go Tcode SICF,Execute the Initial screen,
and in this new screen give service as your application name and click on filter.
You will get your service below which will be ur application name .
right-Click on the deactivate and activate it or just activate it,.
This shd work -
A question about cache group error in TimesTen 7.0.5
hello, chris:
we got some errors about cache group :
2008-09-21 08:56:15.99 Err : ORA: 229574: ora-229574-3085-ogTblGC00405: Failed calling OCI function: OCIStmtFetch()
2008-09-21 08:56:15.99 Err : ORA: 229574: ora-229574-3085-raUtils00373: Oracle native error code = 1405, msg = ORA-01405: fetched column value is NULL
2008-09-21 08:56:28.16 Err : ORA: 229576: ora-229576-2057-raStuff09837: Unexpected row count. Expecting 1. Got 0.
and the exact scene is: our oracle server was restart for some reason, but we didnot restart the cache group agent. then iit start appear those errors informations.
we want to know, if the oracle server restart, whether we need to restart cache agent?? thank you..Yes, the tracking table will track all changes to the associated base table. Only changes that meet the cache group WHERE clause predicate will be refreshed to TimesTen.
The tracking table is managed automatically by the cache agent. As long as the cache agent is running and AUTOREFRESH is occurring the table will be space managed and old data will be purged.
It is okay if very occasionally an AUTOREFRESH is unable to complete within its defined interval but if this happens with any regularity then this is a problem since this situation is unsustainable. To remedy this you need to try one or more of:
1. Tune execution of AUTOREFRESH queries in Oracle. This may mean adding additional indexes to some of the cached Oracle tables. There is an article on this in MetaLink (doc note 473493.1).
2. Increase the AUTOREFRESH interval so that a refresh can always complete within the defined interval.
In any event it is important that you have enough space to cope with the 'steady state' size of the tracking table. If the cache agent will not be running for any significant length of time you need to manually cleanup the tracking table. In TimesTen 11g a script to do this is provided but it is not officially supported in TimesTen 7.0.
If the rate of updates on the base table is such that you cannot arrive at a sustainable situation by tuning etc. then you will need to consider more radical options such as breaking the table into multiple separate tables :-(
Chris -
VI Reference type does not match VI connector pane
I am trying to use Open VI Reference in LabVIEW 8. I am getting error 1031 "VI Reference type does not match VI connector pane." I have a Type Specifier wired to the Type Sepcifier terminal, and I've gone in and selected Select VI Server Class / Browse, and selected the VIT that matches the input path.
My path is correct.
I wired 0x10 (16) to the options terminal so that I would be prompted if LabVIEW couldn't find the necessary subVI files.
I restarted my computer to make sure the old type specifer was not in memory.
Any thoughts on why I still get error 1031?
Thanks,
KathyHi Kathy,
I am still investigating this problem, but right now I do have a workaround for you. If you open your template VI and drag its icon into the type specifier constant, and also drag it into the refnum indicator on the panel of your calling VI, the problem no longer occurs. For some reason the "Browse" operation is behaving differently than dragging the VI icon. I will continue investigating this and let you know what I find out.
Ben: There is no way to automatically update the type specifiers. I've seen people typedef their specifiers before, so they only have to change them in one place when the subVI connector pane changes. We already have this suggestion on file to consider for a future LabVIEW version.
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
Confused about passing by reference and passing by valule
Hi,
I am confuse about passing by reference and passing by value. I though objects are always passed by reference. But I find out that its true for java.sql.PreparedStatement but not for java.lang.String. How come when both are objects?
ThanksHi,
I am confuse about passing by reference and passing
by value. I though objects are always passed by
reference. But I find out that its true for
java.sql.PreparedStatement but not for
java.lang.String. How come when both are objects?
ThanksPass by value implies that the actual parameter is copied and that copy is used as the formal parameter (that is, the method is operating on a copy of what was passed in)
Pass by reference means that the actual parameter is the formal parameter (that is, the method is operating on the thing which is passed in).
In Java, you never, ever deal with objects - only references to objects. And Java always, always makes a copy of the actual parameter and uses that as the formal parameter, so Java is always, always pass by value using the standard definition of the term. However, since manipulating an object's state via any reference that refers to that object produces the same effect, changes to the object's state via the copied reference are visible to the calling code, which is what leads some folk to think of java as passing objects by reference, even though a) java doesn't pass objects at all and b) java doesn't do pass by reference. It passes object references by value.
I've no idea what you're talking about wrt PreparedStatement, but String is immutable, so you can't change its state at all, so maybe that's what's tripping you up?
Good Luck
Lee
PS: I will venture a guess that this is the 3rd reply. Let's see...
Ok, second. Close enough.
Yeah, good on yer mlk, At least I beat Jos.
Message was edited by:
tsith -
IN my contacts under groups, i have about 100 Group names listed and they are empty, I never created them and they are in all our devices, is there a way to delete them without doing one at a time?
No way to get rid of them at all? Or are you saying I have to do it one by one? Thank you
-
Any one have any information about Security Group to send it to me
any one have any information about Security Group to send it to me
what is it and how can we use it in our workHave a look in the general R12 MOAC and FA concepts.
With security groups, you can defined a set of organizations with a shared access.
E.g. you defined one Secruity groups and assigned in these group 5 organizations.
The security group is assign to a responsibility.
You have access to these 5 organizations over one responsibility, you must not change the responsibility, if you will enter transactions for a other organization. -
From which infotype we get details about empoyee group ,subgroup company co
From which infotype we get details about empoyee group ,subgroup company code. based on the selected job position for new employee.
Hi Aruna,
If i can understand your question better, when we do the hiring how to fetch the default EG/ESG/Co.Code/PSA etc....based on the input of position...
When you create position in OM; also create
1. Infotype 1008 - Account assignment - To Fetch Co. Code, PA, PSA, Controlling area
2. Inotype 1013 - EG/ESG - To Fetch Emp Group/Emp SubGroup
Now when you run the hiring action, on IT0000, input the position and hit an enter key...this will call the related values (if integration is active).
Good Luck !!!!
Kumarpal Jain. -
Question about Everyone Group in SharePoint 2013
Hi,
I have couple of question about EVERYONE group below,
- As per the best practice which Group we should use instead of EVERYONE group in Sharepoint ?
- What is the difference between Everyone and All Authenticated Users Group
We have added Everyone Group in different sites, now the question is if we hide this group showing up in sharepoint people picker, is there any impact interms of current site?
- Is there any way we can hide Everyone group showing up in the people picker only for the site / Site Collection level.
Please help.
Thanks
srabonThere is no functional difference between the Everyone group and All Authenticated Users (after Active Directory has been upgraded to Server 2003 native schema).
I'm not aware of any function to hide the group from the People Picker.
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
I have a situation when a runtime exception should be thrown and an utility class is used
for the exception throwing.
Example:
public class ErrorUtils {
public static void throwARuntimeException(Exception e) throws ARuntimeException {
throw new ARuntimeException(p1, p2, p3, p4, p5);
I think such technique is wrong because:
1. When an exception is thrown the programmer will see ErrorUtils.throwARuntimeException() in the top of the stacktrace.
2. It allows to write incorrect code. For example:
try {
// do somethink that can throw an exception
catch (Exception e) {
throwARuntimeException(e);
e.printStackTrace(); // this line will be never reached but compiler allows to do that
Maybe somebody can tell me more arguments why it is not good to throw an exception in a separate method?I have a situation when a runtime exception should be
thrown and an utility class is used
for the exception throwing.
Example:
public class ErrorUtils {
public static void
oid throwARuntimeException(Exception e) throws
ARuntimeException {
throw new ARuntimeException(p1, p2, p3, p4,
p3, p4, p5);
I think such technique is wrong because:
1. When an exception is thrown the programmer will see
ErrorUtils.throwARuntimeException() in the top of the
stacktrace.
2. It allows to write incorrect code. For example:
try {
// do somethink that can throw an exception
catch (Exception e) {
throwARuntimeException(e);
e.printStackTrace(); // this line will be never
ver reached but compiler allows to do that
Maybe somebody can tell me more arguments why it is
not good to throw an exception in a separate method?You're real problem here is not so much a question of what you're doing, but how you're doing it.
Consider the following
public void someMethod() throws RuntimeException {
try{
// ... Do something here that throws a RuntimeException
catch(Exception e){
e.printStackTrace(System.err) ;
throw new RuntimeException(e.toString()) ;
}Ok, looks better, I reversed the order of operations in the catch block so that the stack trace would print before it throws the exception, but there's still a problem, and that's one of lost granularity.
If you cast or convert a double to an int, you lose precision because you lose the decimal places. The same is true if you cast from a more specific class to a more general class. So rather than catching a generic Exception, catch a RuntimeException.
However, the only thing you've gained by doing that is a bit of precision, and you're duplicating effort.
In dealing with exceptions, the question is WHERE should it be handled. If the code that generated the exception can deal with it that's fine, there's no need to throw it. This is the situation where you want a try catch block to handle it. But if you can't deal with it at that point, then you have to throw it to a higher level for disposition.
What I'm driving at here is that if all you're going to do in your catch block is print the stack trace and then throw the error upstream, why bother with catching it here at all. In the code where your method is called you're going to have to handle the exception anyway, so you have a catch block for something that you're going to have to do again anyway.
So, what I would do is the following (Assuming all I want to do is report the error to a higher level).
public void callingMethod(){
try{
myMethodThatThrowsARuntimeException() :
someOtherMethodThatMightThrowAnotherTypeOfException() ;
catch(RuntimeException re){
messageTheUserWithTheProblem(re) ;
doSomethingSpecificAboutTheRuntimeException ;
re.printStackTrace(System.err) ;
catch(Exception e){
messageTheUserWithTheProblem(e) ;
e.printStackTrace(System.err) ;
public void myMethodThatThrowsARuntimeException() throws RuntimeException{
// ... Code that causes a RuntimeException to occur
}There are other ways of doing it, but I find that this 1) allows me to write less code and that's always a good thing as far as I'm concerned, and 2) makes the handling of exceptions by my application more predictable.
Of course your milage may vary. -
Disable Drill Down For Groups only except SubReport
<p> </p><p>Hi All,</p><p>I have 10 subreports and also 5 Groups sections in one report (version CR 10 - VS.Net 2005) </p><p>I need to disable drill down on Groups <strong>except SubReport </strong>. </p><p> </p><p>Thanks in advance for any solution </p><p> </p><p>-Harini </p>
Where are the subreports located? You mention you have 10 subreports and also 5 group sections. Are the subreports located in the page or report header/footer sections? Are there detail records in the groups? If not, then you don't need to supress drill-down, there is nothing to drill to. If there is, suppress the detail section. If a user drills on the groups, there will be no detailed information visible.
Typically, if you have multiple groups and want to supress drill-down but still display the first group, you can use the 'drilldowngrouplevel >1' statement in the section expert to conditionally suppress the group. Right click the group, select 'Section expert', and click the formula button (the button with the 'X-2' and a little pencil) next to 'Suppress (No Drill-Down) Then, enter drilldowngrouplevel >1. This should do the trick if you have your report structured this way. If not, please provide a little more detail.
Thanks and good luck.
Maybe you are looking for
-
Link repositioning breaks the code
This problem was reported on August 4th with no resolution. I have now updated to the latest version (Build 040621) on XP Pro, with Java 1.4.2_04, and the problem persists. I can't believe that links on a page cannot be repositioned without breaking
-
How do I set a PFI to High on a 6602 Board with DAQ Traditional
Dear All, I am using LabVIEW 8.5 on 32-bit Windows XP with an NI 6602 DAQ board. In the past I've used DAQmx but for compatability with older software I need to do a few simple things using Traditional DAQ, which I have never used. Specifically I wou
-
Starting exetutable java file from java code
Hi I was wondering how I can start a executable java file from java code? thanks
-
Migrate the bi publisher report
How to migrate bi publisher reports for one instance to another instance. we getting the following error: XML Parsing Error: no element found Location: http://172.16.113.62:8002/xmlpserver/servlet/xdo Line Number 4, Column 1: Regards Gopal
-
Hello, I'm new to the forum and to Network programming in particular. My question concerns port monitoring. I have a server transmitting UDP packets to a specific port. I need to have a thread that monitors that port and sees that there is traffic go