Console Exception Handling. Allow another attempt for user before exiting
I am trying to implement a very simple program that prompts the user for info and reads in a few numbers. If the user accidentally enters a letter instead of a number I want the user to get another chance, not just execute the exception handler and exit the program (as it does now). I'd rather have the user get stuck in an endless loop waiting for valid input versus exiting on the first invalid entry.
The code I am using is something like this:
try{
System.out.println("Enter a number?");
int b=System.in.read();
char c=(char) b;
String s=String.valueOf(c);
p.setDummyValue(Integer.parseInt(s) ); //**Possible Exception Here
catch(NumberFormatException e) {
System.out.println("Invalid Input");
// *** I'd love to somehow return to the "Enter a number" line from here
catch(IOException e) {
//IO error code here
}Q: How can I implement the ability to allow a user to correct invalid input?
Thanks
Something like this should work:boolean numberValid = false;
while (!numberValid) {
try {
System.out.println("Enter a number?");
int b=System.in.read();
System.in.skip(System.in.available()); // skip carriage return
char c=(char) b;
String s=String.valueOf(c);
p.setDummyValue(Integer.parseInt(s));
numberValid = true;
} catch(NumberFormatException e) {
System.out.println("Invalid Input");
} catch(IOException e) {
//IO error code here
}
Similar Messages
-
My 7 year old daughter has an iPod Touch 4 and she used the wrong password too many times. She thinks she remembers her password now but we have already exceeded the attempts and it says "iPod is disabled" connect to iTunes. Is there any way we can get the device to allow another attempt? We are traveling this week so don't have access to the serial number or the computer that was used to originally set up her iTouch. I don't even know what operating system it's on and can only see the home screen.
Restoring the iPod will do nothing to his iPhone.
When you restore it wipes the iPod clean no matter what computer you use.
The only plus to doing it form your home computer is if you have a backup stored there, then you can restore from the backup once it's done wiping.
If you are away form your home computer, go ahead and use the computer you have to restore it, then when you get home, you can restore form any backup you may find. You can use this to help you do that when you get there: http://support.apple.com/kb/ht1766 -
Exception Handling in Web Center for UI related Errors not working.
Hi Guys,
I have implemented Error Handling in ADF Application with Custom Model Exception Handler ( which is "CustomExceptionHandler extends DCErrorHandlerImpl") to catch all Model Layer Exception and to customize those error messages.
I have implemented Error Handling in ADF Application with Custom View Exception Handler ( which is "CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler";) to catch all View Layer Exception and to customize those error messages.
The design for this is , in Model Custom Exception Handler i find the exception message in "public String getDisplayMessage(BindingContext bindingContext,Exception exception) " method and throw RuntimeException to pass this exception to Custom View Layer Exception , so that i can handle all the exception @ View Layer it self .
In the View Layer Exception Handler i am navigating to specific error page using
String contextPath = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getContextPath();
ExternalContext ectx = facesContext.getExternalContext();
ectx.redirect.
All these things absolutly working in ADF Application for all the exception ( Model , View ) and i am successfully navigating to error page.
Problem :
When i implement the same thing in Webcenter Application ( Model Custom Exception Handler and View Custom Exception Handler), Model Part is working as expected , but View Custom Exception Handler is not all calling .
i am assuming that ,this View Custom Exception Handler (CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler) works only for JSF Life cycle
"Allows frameworks to intercept otherwise unhandled exceptions thrown during the JSF lifecycle. ExceptionHandlers can be registered by adding a service file with a class name at META-INF/services/oracle.adf.view.rich.context.ExceptionHandler." from http://jdevadf.oracle.com/adf-richclient-demo/docs/apidocs/oracle/adf/view/rich/context/ExceptionHandler.html";
As Webcenter Portal uses ADF Life Cycle this Exception Handler is not calling , i am not sure.
if any one has any idea please let me know .
Thanks
Annapareddy Srinivasrao
Edited by: Srinivasrao Annapareddy on May 22, 2013 12:06 PMi used runtime exception along with the wdwsmodel exception
-
Search for User/Customer-Exit in Printing Quality-Notifications
Hello,
because we want to use the standard of SAP, we don't want to use a custom print programm for our quality-notifications. One of the print programms is "RQQMUD01". Are there spezific User/Customer Exits for the print programs of the quality-notifications. Or do we have to copy the original print program and make our modifications? Thanks.
Regards, Lars.Hi,
In our casewe have copied the standard SAP Program RQQMUD01 and the form QM_NOTIF_OVERVW1 to meet our requirements.
regards
Aveek -
SBS 2011 Console doesn't allow to create a user
When creating a user in SBS 2011 Console, the following error comes up:
Tried -
Repair the Windows Small Business Server 2011 Standard Console - it didn't help
Checked updates, but there are no recently installed updates.
Checked SBS Console logs, but there are no clues:
Window Logs:
first:
Source: .NET Runtime, ID:1026
Application: adduser.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Reflection.TargetInvocationException
Stack:
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
at Microsoft.WindowsServerSolutions.TaskManagement.Admin.Committer.RunSynchronously()
at Microsoft.WindowsServerSolutions.Admin.Common.WizardLauncher.Commit(Microsoft.WindowsServerSolutions.TaskManagement.Admin.ICommitterView)
at Microsoft.WindowsServerSolutions.Admin.Common.WizardLauncher.RunCommitter(Boolean)
at Microsoft.WindowsServerSolutions.Admin.Common.WizardLauncher.RunToCompletion(Microsoft.WindowsServerSolutions.Admin.Common.CommandLineArgs)
at Microsoft.WindowsServerSolutions.Admin.Common.WizardLauncher.Run(System.String[])
at Microsoft.WindowsServerSolutions.Admin.Wizards.AddUser.Program.Main(System.String[])
and second:
Source: Application Error, ID: 1000
Faulting application name: adduser.exe, version: 6.1.7900.0, time stamp: 0x4cd854a8
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18409, time stamp: 0x5315a05a
Exception code: 0xe0434352
Fault offset: 0x000000000000940d
Faulting process id: 0x6388
Faulting application start time: 0x01d076721ff21d75
Faulting application path: C:\Program Files\Windows Small Business Server\Bin\adduser.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: cc2a480b-e265-11e4-bd44-441ea13ae79c
Any ideas?
MichaelHi,
Firstly, please check if you have installed KB2506143. It seems that the functionality to add a new user account with an email address may be broken if you installed that KB.
Please uninstall KB2506143 and reboot to see if everything works. Before you uninatall that KB, please read the KB below to aviod failures:
Failure while trying to uninstall KB2506143 from SBS 2011
https://support.microsoft.com/en-us/kb/2796821/
Best regards,
Susie
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Exception thrown while enumerating UserProfileManager for user profile
Hello All,
We have a SharePoint 2010 Timer Job in which access User Profile Service Application and update user profile properties of some the users. This user profiles is synched with AD.
We have following lines of code here:
SPServiceContext context =
SPServiceContext.GetContext(site);
UserProfileManager profileManager =
new UserProfileManager(context);
int
count = profileManager.Count
//This line works OK
foreach (UserProfile userProfile
in profileManager) //This throws exception at first loop
When we start looping through the
UserProfileManager instance in above lines of code it throws following exception:
System.TimeoutException at Microsoft.Office.Server.UserProfiles.ProfileDBCacheServiceClient.GetUserData(UserSearchCriteria searchCriteria)
at Microsoft.Office.Server.UserProfiles.UserProfileCache.GetBulkUserProfiles(UserProfileManager objManager, String searchColumn, IList searchList, Boolean includeNullsForUnresolvableUsers, Int64& lFailedCount)
at Microsoft.Office.Server.UserProfiles.UserProfileCache.GetBulkUserProfiles(UserProfileManager objManager, List`1 userIdList, Boolean includeNullsForUnresolvableUsers, Int64& lFailedCount)
at Microsoft.Office.Server.UserProfiles.ProfileEnumerator`1.PopulateUserProfileQueue(IList userSearchList)
at Microsoft.Office.Server.UserProfiles.ProfileEnumerator`1.PopulateQueue()
at Microsoft.Office.Server.UserProfiles.ProfileEnumerator`1.MoveNext()
One point to note here is that we have almost 50,000 user profiles in total. This exception is thrown intermittently, I mean in the last 10 days it has happened thrice.
It will be great if someone can help me out on this. Please let me know if any additional information is required.
ThanksHi,
As I understand, you encountered User Profile time out issue.
First of all, please confirm that related service and service application are at started status on all servers.
User Profile time out issue might be caused by several reasons, as you said the issue is generated intermittently, there might be networking issue as well. So please check ULS log for related error message.
Similar issue:
http://wingleungchan.blogspot.com/2012/11/userprofileapplicationnotavailableexcep.html
Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected] .
Rebecca Tu
TechNet Community Support -
SharePoint 2013 allows downloaded even for users with "view only" permissions
I have a new on premises SharePoint 2013 server and assigned a single user "view only" rights to a document library. In the "permission levels" window, this permission is described as "Can view pages, list items,
and documents. Document types with server-side file handlers can be viewed in the browser but not downloaded."
Once I gave the user that permission, I noticed he was able to view documents in the library but the "but not downloaded" part does not seem to be working. The user can still download documents to his local desktop and SharePoint does not prevent
it. The "download a copy" option appears and the user can use it.
My goal is to make all documents in this library such that users can only view them in the browser and not download a local copy. How I do that?
Thanks for your help.Not entirely positive :-)
However, you have no server-side handlers in place today without WAC installed, so that portion of the View Only permission wouldn't be applicable.
Note that WAC must be installed on its own server and if your SharePoint server is extranet or public facing, it needs to have a valid, public SSL certificate. Also, WAC should always be run over SSL regardless if it is public facing or not as the token
sent between the SharePoint server and WAC is the same as having a username and password for the user making the request.
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. -
Allowing setting option for user
Hello,
Right now user does not have authority to change there own setting what is the best way to provide the authority so that users can change there own setting after login into BI.
Thanks,Hello Ram,
You can first categorize the user and assign the Authorization accordingly like Power User, Business User etc., But then if they modify the main query or web template that will impact the other users. So its better to restrict certian major changes.
Thanks
Chandran -
Hello,
I'm trying to add Javascript in order to have a prompt appear once a user clicks an Exit button to confirm their choice to exit the CBT. I added a button to Captivate that successfully calls the closeBrWindow() function (see code below); however, I receive an 'Access is Denied' error message once the 'continuebox' function is added. This CBT is running on the Adobe Connect server when I receive the error message.
Can anyone see what I'm doing wrong? Is there a better way to prompt a user when clicking an Exit button?
function closeBrWindow()
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
var continuebox=confirm("Click OK to exit the CBT, or Cancel to return to the CBT.");
if (continuebox==true)
if (ie7)
//This method is required to close a window without any prompt for IE7
window.open('','_parent','');
top.window.close();
else
//This method is required to close a window without any prompt for IE6
this.focus();
self.opener = this;
self.close();Hi there
Because closing the window using JavaScript is so utterly unreliable and simply doesn't work in all cases...
I'd do it like this.
Insert a slide at the end of the movie.
Time that slide very brief. Perhaps .1 seconds.
Configure the movie to close when it completes play. (Edit > Preferences > Project > Start and End)
Insert two buttons on the slide before the last slide. One will be labeled Yes and one will be labeled No.
Insert a Text Caption on the slide asking the user if they wish to exit.
Program the Yes button to Go to the Next Slide. Program the No button to visit a different slide.
Insert buttons on other slides that are labeled Exit and are configured to jump to the slide where the user chooses.
Cheers... Rick
Click here for Adobe Certified Captivate and RoboHelp HTML Training
Click here for the SorcerStone Blog
Click here for RoboHelp and Captivate eBooks -
[q] WLI Exception Handling
hI,
I am working with WLI 2.0 SP 2 on WL6.0 SP 2.
When I get an exception in my flow the WLI output this exception many times
and not once as
expected.
I even wrote my own exception handling and still it output the exception to
the console too many times.
Is there any way to block this output ?
10xs,
Ronen YaariThanks Vishwa for your help
I did the same in my process. They also don't provide any retry delay in Exception
handling as they provide in case of explicit transactions.
Ashish
"Vishwa" <[email protected]> wrote:
>
You might wan't to try this workaround to see if it achieves the functionality
u are looking for...
a) retry option set to yes/true and
b) In the exception path check for the exception type and if (using decision
node
perhaps)
it happens to be a instanceof 'RecoverableException' do down path with
a "finish
node"
Vishwa
>
"Ashish Agrawal" <[email protected]> wrote:
Hi,
I am using WLI 8.1. I have defined an Exception path to one of a business
process
node. WLI Exception Handler allows you to retry the node before theafterExceute
path is taken. But is it possible to define a condition where it retries
in case
of a particular Exception say 'RecoverableException' and directly execute
the
exception path in case of say 'NonRecoverableException'.
Thanks in advance
Ashish -
Step repeated in Exception branch requires exception handler, why?
I have a BPM Integration process with a sync send step calling a RFC. Any system errors and application errors are handled by an exception branch where I send an alert as then re-do the send step (so that it will fail but allow me to restart from that point after fixing the issue). The problem I am having is that in this send step, since it is mandatory to have an exception handler for application errors (defined fault message RFC.Exception), what do I enter for exception handler in this send step which is itself in an exception branch? I do not want to handle the exception this second time since I want this step to fail and process stops here to be able to restart manually later.
Hi,
I am not sure, how you will restart the step manually? Because once there is an error in the sync send, the message will turn to "Cancelled" status. You cannot restart this message.
Now, for the second send step in the exception block you will not be able to choose the same exception block in the exception handler field. But for some reason if this send also fails then you cannot restart the process manually - same reason i mentioned above. It will fail as you intended it to do so.
Regards,
Balaji.M -
hi,
I'm using weblogic 7.0 server to replace my weblogic 5.0. I've got an error during
login to the server:
<server failed during initialization Exception: java.lang.securityException: Authentification
for user denied..>
could you help me and tell me what to do ?
Thanks you.
Cyrilcyril,
You should use the same username and password that you used to boot your 5.1 server with.
hope it helps,
-satya
cyril wrote:
In fact, I used the properties converter through the console to convert weblogic.properties
to config.xml and the variables:
WLS_USER=weblogic.
WLS_PWD=weblogic.
The petstoreExamples works but not my application...
satya <[email protected]> wrote:
Cyril,
Did you use the properties converter through the console to convert your
weblogic.properties to
config.xml? What username and password did you use to boot the server?
Thanks,
-satya
cyril wrote:
hi,
I'm using weblogic 7.0 server to replace my weblogic 5.0. I've gotan error during
login to the server:
<server failed during initialization Exception: java.lang.securityException:Authentification
for user denied..>
could you help me and tell me what to do ?
Thanks you.
Cyril -
Public exception handler in database package
I'm working on Oracle 10 g; I have a package with 10 functions, instead of writing exception for each individually is there is a way to do the same exception handler in all without repeating the exception handler in the 10 function (my exception handler is the same for the 10 function)
It would depend on how you are using the functions, and what exactly your exception handler does.
If, for example, your handler for no_data_found does a specific select statement, then you could put this statement in another function and call that function in the exception handler of each of the 10 functions. Note that you would need to catch the exception in eacg function, but the common code would be in one place. Something like:
FUNCTION error_func RETURN NUMBER IS
BEGIN
SELECT other_stuff INTO var;
RETURN var;
END;
function1 RETURN NUMBER IS;
BEGIN
SELECT stuff INTO var;
RETURN var;
EXCEPTION
WHEN NO_DATA_FOUND
effor_func;
END;
function2 RETURN NUMBER IS;
BEGIN
SELECT stuff INTO var;
RETURN var;
EXCEPTION
WHEN NO_DATA_FOUND
effor_func;
END;
function3 RETURN NUMBER IS;
BEGIN
SELECT stuff INTO var;
RETURN var;
EXCEPTION
WHEN NO_DATA_FOUND
effor_func;
END;If you always run all 10 functions in sequence, then you could make a wrapper to call the functions, and catch exceptions in the wrapper. Something along the lines of:
FUNCTION wrapper RETURN NUMBER IS;
BEGIN
function1;
function2;
function10;
EXCEPTION
WHEN NO_DATA_FOUND THEN
do something;
END;As constructed here, the wrapper wil not know which function errored nor will it continue running the other functions after getting an error.
John -
Variable not appearing for User
Hi everyone!
I have a query which the user have been using for quite some time and it was working fine. When the query is run the user has option of 3 input variables.
Today, all of a sudden, the 3rd variable does not show up for that user. The query runs fine for every other user. I mean all 3 input variables show up.
Some how only for this particular user, the 3rd variable does not appear.
Has any one encountered this situation. Can any one provide me some possible areas to look into as to what might have changed or what could be causing this problem.
All your help is appreciated.
Thankx!
Kumar.Hi Raj,
I did try to remove the personalization on the user's system. But the variable still did not appear. I noticed few more things. The variable is "Site ID" (custom one).
1) The Site variable does not appear even on other queries only for this user.
2) I tried to make the user use another system and run the query, it still does not appear.
3) I created another query for user just to display the Site ID without any variable. It runs fine. When I created a selection variable for Site ID on the same query now the variable again does not appear.
So I think it must be either a change in authorization or change in definition.
Can you think of any other issue it might be encountering?
Thankx!
Edited by: kumar saurabh on Aug 25, 2008 4:50 PM -
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. when open external list
Hi
i created a external list based on a external content type in shaepoint designer
but i got this error in event viewer when i open this list
Could not open connection using 'data source=xxxx;initial catalog=xxx;integrated security=SSPI;pooling=True;persist security info=false' in App Domain '/LM/W3SVC/1756231635/ROOT-1-130330475307091531'. The full exception text is: Login failed for user 'NT
AUTHORITY\ANONYMOUS LOGON'.
I created bcs service with Users Identity and my web application using claims based authentication
and sql server in seperate server under a domain.
all servers are in same domain
adilMost likely you are running into double-hope issue.
Read following article and implement the workaround that works for you.
http://www.spdoctor.net/Pages/message.aspx?name=login-failed-for-user-bdc
I am assuming your are using NTLM in your farm. If you are using Kerberos then check the following article.
http://blogs.technet.com/b/harmeetw/archive/2011/08/28/getting-login-failed-for-user-nt-authority-anonymous-logon-when-browsing-external-list-on-a-claims-kerberos-web-application.aspx
Amit
Maybe you are looking for
-
Problem with network scanning with Laserjet M1212nf All-in-one printer
I installed drivers for my network connected Laserjet M1212nf on my Windows 7 64-bit laptop computer, but it appears as just a printer (in Devices and Printers). I cannot scan from the laptop (I get a "no TWAIN Device Installed" error). The scan func
-
How do I reset my forgotten Mac Book Pro login password ?
The "help" on my MacBook Pro insists I can change my forgotten login password by using my apple Id and password, by simply hitting the arrow beside the login password box. It appears after a failed attempt to enter your password at Login, however the
-
Snow Leopard 10.6.1 IMAP Sent Messages Missing! Where are they?
I upgraded to 10.6 from 10.5 and everything was fine apart from push to the iPhone! In an effort to get it all working I decided to do a clean install, so backed up my mail accounts (which should now be in one place in 10.6) and everything else + mad
-
When i try to install itunes 10.5 it gives me the following error There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Please let m
-
Outerjoin query performance tuning
Hi, I have two tables, tab1 (7 million records) and tab2 (50,000 records). Following query is taking more than 15 minutes to feth the result from the database. SELECT a.col11, a.col12, b.col11, b.col12 FROM tab1 a, tab2 b WHERE a.col1 = b.col1 (+) AN