Remove key when the HashMap still is  used

I try to remove some value when the HashMap still is use, but I get compile error:
java.util.ConcurrentModificationException
     at java.util.HashMap$HashIterator.next(HashMap.java:749)
     at PoliceDatabase.listUnlawfulDrivers(PoliceDatabase.java:228)
part of code as follow:
do {
while (de.hasNext()) {
p=(Driver)de.next();
maxt=((ArrayList)tempInfractions.get(p)).size();
if (maxt==0) {tempInfractions.remove(p);}
else if (maxt>max) {
max=maxt;p1=p;
atemp1.addAll((ArrayList)tempInfractions.get(p));}
newInfractions.put(p1,atemp1);
atemp1.clear();
tempInfractions.remove(p1);     } while (tempInfractions.isEmpty());
what should I do?
Thank you first!!

I try to remove some value when the HashMap still is
use, but I get compile error:That's a run time error, not a compiler error.
>
java.util.ConcurrentModificationException
at
java.util.HashMap$HashIterator.next(HashMap.java:749)
at
PoliceDatabase.listUnlawfulDrivers(PoliceDatabase.java:
28)
part of code as follow:
do {
while (de.hasNext()) {
p=(Driver)de.next();
maxt=((ArrayList)tempInfractions.get(p)).size();
if (maxt==0) {tempInfractions.remove(p);}I assume "de" is some kind of iterator. You'll have to remove "p" via the iterator so it will know that element is gone. Look in the API docs for whichever iterator you're using for a remove() method.

Similar Messages

  • Is the "deadline" variable also set when the Due transition is used ?

    Hi,
    I needed to understand if the 'deadline' variable is also set when the due transition is used. The reason I am asking is because of the following scenario that we saw:
    1. There is a Due transition form an interactive activity to an automatic
    2. The automatic had a Syntax error (typo) in a SQL statement
    3. When the instance reached this automatic... the instance aborted... [process level Exception level handling is not present :( ]
    My first thought was that there was an instanceExpiration exception, but was not certain.
    An leads would be nice...

    1. The exception is seen in the Engine Logs, but the strange thing is that sometimes the Expection is caught within the localized exception block and still manages to bubble up to the process level exception handler...If you have a 'throw ex' in your catch block its supposed to propagate up to the process level... (there is a setting to prevent this...)
    2. I tried adding the throws clause in the catch block to force it to always bubble up to the process level exception handle, this does not always happenThis sounds strange, that it doesn't always happen? Right click on the project, and go to Preferences, in the Processes category, set the Exception Handling to 'Propagate', that should send the error the parent process.
    3. I tried removing the localized catch blocks to always be caught by the process level handler... this also does not happen consistently... The exception is seen in the engine log and the instance goes on its merry wayIf the exception gets caught, (without an additional 'throw') the instance will continue...
    HTH,
    -Kevin

  • ERROR - 1013113 - Cannot unload database dbnam , when it is still in use.

    Hi ,
    Below is the scenario of what am doing and the error am getting. Please shed some light and share ur ideas on this.
    1 . I used the below maxl statement and logged out all the sessions on the application by force.
    alter system logout session on application <appname> force;
    2. After logging out the sessiosn, am using the below maxl statement to unload the application,
    ALTER SYSTEM UNLOAD APPLICATION <appname>;
    but am getting error as "*ERROR - 1013113 - Cannot unload database <dbnam>, when it is still in use.*".
    Please share your expertise to eliminate this abnormality of essbase.
    Thanks in advance!!
    -Vinay
    Edited by: user12000483 on Jul 8, 2010 2:10 AM

    I found that sometimes after a EAS command (for instance a export data) is finished (correctly finished or not it does not matter in this case) a rudimentary tcp connection from EAS to the essbase server is left open.
    You can view this with a generic tcp viewer) on either the eas or the essbase server.
    Disconnecting this particular tcp connection "frees" the essbase DB for further actions.
    It is not nesecary to close the proces which keeps the connection open. Since this would kills your essbase application running.
    This was really a pain in the $% for the last years since before I always had to kill the application process. Perhaps I am creating a case at Oracle to solve the initial cause, but for the moment this helps me a lot. I did not have time to see if the same occurs after maxl processes. But I doubt it happens there. The cause can be in the weblogic timeouts and behaviour at the EAS server.

  • Could not found any usage key in the work center WC001(Use T-CODE CR02)?

    my question:
    (1) I have created one Work Center WC001 and one Plant HJW1.
    (2) I have created one Routing with T-CODE CA01.
    (3) Then I use T-CODE CA02 to change this Routing.
    (4) When I enter the Head details screen,I click the Operations button to enter the Operations Overview screen.
    (5) In the Operations Overview screen list,I input the Work Center WC001 and the Plant HJW1 at the first line and press enter.Then the sap raise error message like below.
    (6) The question was: I could not found any usage key in the work center WC001(Use T-CODE CR02)! Could any one tell me the answer or give me some advice to resolve the problem?Thank you so much.
    error message:
    Work center WC001 plant HJW1 does not exist for task list type N
    Message no. CR084
    Diagnosis
    You want to allocate the work center WC001 to a task list of the type N . However this work center is not intended to be used in a task list of the type N.
    Procedure
    The usage of a work center in task lists is restricted via the usage key. You define this key in work center customizing and allocate to it those task list types in which a work center with this usage key can be used.
    Proceed as follows:
    Check the usage key for the work center WC001 in work center maintenance.
    If necessary change the usage key in the work center or change the allocation of task list types to the usage key in customizing or
    allocate to the task list a work center which is valid for use in a task list of the type N.

    Hi
    1) Check what task list usage key you entered for the work center in the basic data . If it is 009 then the work center can be used in all task list type.
    2) If you have defined and used any other usage key , ensure that  for this key , the routing type N is allowed in OP45.
    Regards,
    Ramasamy

  • Why does my Elements 12 ask me to enter Program Key after the product has been used and registered

    I have had Elememts 12 for several months ... when I bought it ...I downloaded the program and registered it ... now ... every once in a while the program asks me to enter the Key number as if I never registered it ... also sometimes I get a message about my 30 day trial ...

    I purchased Elements 12 not the Premier addition .... the disk Elements 12 comes with a trial version of Premier ... I did not install the 30 day trial version .... maybe t is Adobe trying to sell me the Premier addition ... I will pay more attention the next time the message comes up ... after reading some of the posts, I think that is what is happening ... I will have to wait ... someone wrote that they had the same problem and after a while, the message stopped appearing .... as I indicated .... I will look more carefully the next time I see the message...
    Thanks again
    Date: Tue, 1 Apr 2014 16:22:01 -0700
    From: [email protected]
    To: [email protected]
    Subject: Why does my Elements 12 ask me to enter Program Key after the product has been used and registered
        Re: Why does my Elements 12 ask me to enter Program Key after the product has been used and registered
        created by A.T. Romano in Premiere Elements - View the full discussion
    JEROMESTEINER
    I am trying to get through all your recent replies to go back to your post numbered 8.
    1. Go to Control Panel/Programs and determine if you have Premiere Elements 12 and Photoshop Elements 12 installed.
    2. When you have gotten the try out dialog, what program is mentioned in the dialogs - Premiere Elements 12 or Photoshop Elements 12?
    3. The fundamental question is what did you purchase
    a Photoshop Elements 12
    b. Premiere Elements 12
    c. Photoshop Elements 12 and Premiere Elements 12
    From what you wrote it sounds like Photoshop Elements 12. Premiere Elements 12 seems to have come along as a tryout.
    4. If Premiere Elements 12 is a tryout, after 30 days from first install of it, you should not be able to use it without a purchased serial number specific for Premiere Elements 12.
    5. If you have no interest in Premiere Elements 12 tryout, uninstall it if it is installed. If it is not installed, then it is not the cause of your trial messages. But, I offer you this thought. Are these really License This Product/Continue Trial messages or are they really promotional dialogs (ads) put on your computer by Adobe who knows you have Photoshop Elements 12 and are trying to get you interested in Premiere Elements as well?
    Please review and consider.
    Thanks.
    ATR
    Add On...All my encountered with tryout pop ups have been as described and restricted to purchase Photoshop Elements 12 and Premiere Elements 12 purchased as bundle.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6262855#6262855
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6262855#6262855
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6262855#6262855. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Premiere Elements at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Hi BC, I have an issue with BC. When the shopping cart is used it takes stock out of inventory and h

    Hi BC,
    I have an issue with BC. When the shopping cart is used it takes stock out of inventory and holds it, regardless of whether or not a customer proceeds to purchase. OK.
    To make matters worse, the stock is only cleared from the shopping cart when the customer closes the browser - not when they close the shopping window.
    Now lets say a customer doesn't close their browser for a month - it happens! .. when their stock is finally returned it may throw out our stock levels that have in the meanwhile been adjusted. So their stock will be added on top of an accurate stock take, putting stock in that isnt really available.
    This is causing us mayhem.
    We have not yet seen if stock is actually returned at all. In the test we did today where we filled a shopping cart then closed the browser without making a purchase, the stock was not returned immediately. So we dont even know when it will be returned - thats IF a customer actually closes their browser. Any solutions out there?
    Jo

    Hi there,
    The way stock is managed in this situation is desirable for many in that case otherwise shopping on a site and adding to cart would not be viable or use friendly.
    What you mention about not closing a browser though is a case that is not true. IF you go into the shop settings in the admin you can see the cart restore timer which is by default 24 hours but you can change this to as low as 1 hour if you wish.

  • What type of Data target is used when the safety interval is used?

    Hi ,
    what type of Data target is used when the safety interval is used in generic delta in datasource?DSO or cube  or cube?
    Pls explain me ?
    Thanks,
    Nimai

    It's up to your reporting requirement to go for dso or cube..
    I prefer to having staging with DSO and then further reporting on Cube ..
    It's always easier to manage when you have any changes to the cube .. you need not to extract data from R/3 .. if you have dso you can extract directly to cube
    Another thing is -for any reason some of your records got corrupted so you can have full loads to dso which has the overwrite functionality...  and sends delta records to cube. even in cube you can do selective deletion but we have to very careful to avoid double records in next loads
    Edited by: Srinivas on Jul 29, 2010 8:23 PM

  • Help! My iPhone 4 was stolen, and it is in iOS 7, will the phone still be used? Or if they reformat it, my files would be deleted? I hope all my files will be deleted. Thanks for your help. :)

    Help! My iPhone 4 was stolen, and it is in iOS 7, will the phone still be used? Or if they reformat it, my files would be deleted? I hope all my files will be deleted. Thanks for your help.

    Hey ChrisJ4203, thanks for answering buddy , I still have a question.
    I have a passcode for my iPhone, but I don't have the application Find my iPhone. Can I retrieve my photos, notes, reminders and all other data in my iPhone, I mean, if I bought another one, and connect it to my computer and go to iTunes then restore backup, cause I backup my iPhone last Oct 10, 2013, will I recover all the details in my iPhone that was stolen? It's like I'm still using my old iPhone's apps but with a new iPhone. Thanks.
    -Alfonso Santos

  • My MAC Pro shuts down when the battery still have 50 minutes life.

    My MAC Pro shuts down when the battery still has 52 minutes life without any warning. Does anyone have this problem? BTW, it is less than one year old.

    You must have a MacBookPro, right? MacPro's are big desktop models.
    Try the MacBookPro battery forum or their Usage forum.
    DALE

  • [svn:fx-trunk] 11593: Advanced CSS fix - descendant selectors should search for arbitrary ancestors including when the universal selector is used .

    Revision: 11593
    Author:   [email protected]
    Date:     2009-11-09 15:20:36 -0800 (Mon, 09 Nov 2009)
    Log Message:
    Advanced CSS fix - descendant selectors should search for arbitrary ancestors including when the universal selector is used.
    QE notes: Please add test cases for arbitrary ancestor depth that involve using the universal * selector. Thanks for the additional testing on this patch too!
    Doc notes: N/A
    Bugs:
    SDK-23213 - descendent selectors can't catch components more than one level down
    Reviewer: Corey
    Tests run: Checkintests, test case
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23213
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSSelector.as

    Welcome guy -
    Unless you are using Spry menus as a learning experience, you should move forward to a menus system that will display properly on the millions of portable devices that won't work with Spry which was deprecated 2 years ago.
    Many are using JQuery menus or pure HTML/CSS menus.
    If you wish to continue your Spry for learning experience, we'll be glad to assist; please let us know.
    By the way, your submenus are not showing because you need to add the red value to this rule in your vertical CSS
    ul.MenuBarVertical ul.MenuBarSubmenuVisible{
        width: 220px;
        left: 180px;

  • B1 Query returning truncated decimal places when the CASE statement is used

    Hi All,
    Perhaps this is a friday thing.
    In B1 the price setting is for 5 decimal places. I have a query the run a business process looking at the data in the Special Prices Tables. When I run the Query in SQL, the output show the correct number of decimal places. However, when the Query is then  saved and run in B1, the output is truncated to 2 decimal places. Any ideas as to how I can prevent this for happening?
    T0: Points to teh OSPP Table
    T1: Points to the OSP1 Table
    The portion of the query causing the issue is as follows:
    case
       when (T1.price is not null) then
             T1.price
       else
           T0.price
    end

    Hi Earl
    Seems you are right, I have tested with a few different formats and each time get a 2 decimal result. In SQL help I found the following which may explain why:
    Result Types
    Returns the highest precedence type from the set of types in result_expressions and the optional else_result_expression. For more information, see Data Type Precedence (Transact-SQL).
    Even tried it in SQL with a stored procedure storing to a temp table and it shows the full decimals, but executing the SP in SAP Business One results in 2 decimals again.
    This is indeed a strange occurrence and I a not sure how you are going to solve it! You can use NVARCHAR for example except that it right aligns the values returned, but at least it doesn't drop the decimals.
    Kind regards
    Peter Juby

  • How to Fecth data from LDB FMF when the report is already using LDB FMB

    Hi ,
    i have a standard program(T. Code - FMB_PT01) that uses logical database FMB.
    When I run this report it will display Budget value and Budget consumed  value.
    When the user double click on total amount .
    Another report RFFMTO10X will be called using submit statement.
    It will show the Respective  Budget Consumption value totals acc to the value type .
    In Report RFFMTO10X  data is retrieved using  logical database FMF .
    But now my requirement is to bring  budget consumed total wrt to value type field from Report RFMTO10X in to  the basic 
    output list.
    For that I have copied standard Report RFFMREP_LDB_PT01 into ZReport and I have added new field in the fieldcatlog.
    but how to bring the budget Consumed wrt to Value type in the basic output  list..
    Please help me
    Regards,
    Edited by: victor B on Jul 4, 2009 12:35 PM

    Hi,
    you can try to call another program using submit and that program will export your required data into memory (EXPORT statement). After successful call of the second program you get your data from memory (IMPORT statement). Or you can try to call subroutine in the second program and use subroutine interface to pass data to and from second program. BTW the logical databases are obsolete so you can also write your own logic to get required data directly from DB.
    Cheers

  • What happens when the Powerbook is being used as a laptop?

    Sorry if you read this twice - I mistakenly posted it as a reply rather than a question. I am waiting for my new Powerbook along with an Airport Extreme Base Station. I plan to network the Powerbook with 2 PC desktops and a PC laptop.I know I will have to use the Powerbook to configure the network, but I want to know whether it will have to be present and connected whenever the network is in use - it is, after all, a laptop and therefore sometimes not in the house. There are only two of us living here, each of whom will own a desktop and laptop when the Powerbook gets here. Would it make a difference to accessibility when the Powerbook is travelling if we connect one of the desktops to the lan port on the Base Station instead of running everything wirelessly?

  • How to reduce the transmission of data when the phone is not used?

    When my iPhone is not used the transmission of data is ongoing and I will not stop the 3G, what should I do?

    Priya:
    It is likely that the BLOB content defined in your table is being stored 'Out-of-Line'. This means that the LOB columns are stored in segments of their own. These then are the segments that may need shrinking.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#i1006363
    Varad

  • I rented a movie in itunes and after time of rental expired the movie still is using the memory of my iphone how I can liberate this memory???

    I rented a movie in itunes after 48 of rental  and the movie apparently is not in my device  still is using the memory of my iphone (4GB)...I tried to delete it thru itunes but not worked...what else can do???

    I finally called Apple Support to get the answer to this question.
    1st, make sure you are signed in on your computer under the Apple ID that purchased the movie.
    2nd.  Go into the summary page of your device on ITunes. Near the bottom you will see "options".  In that section you will see "manually manage music and videos".  Select that option.
    3rd.  Then go to the "On this Phone" click the RENTAL sub section under your device. This depends on the version of ITunes you are using.
    4th. Right click the movie you want to delete.  The popup box with the delete option should appear.
    5th  After it deletes (which will take quite a while) remember to go back into Options and uncheck the option for"manually manage music and videos". 

Maybe you are looking for