GW: Null Pointer Exception after click on Approve button - guidewire

Getting NPE after click on Approve button for the payment activity.And also, getting NPE for Reject button. Even though user is authorized to approve the activity but unable to figure it out from which point it throws null value.
Here are the below logs-
ERROR Displaying to the user an exception message that is not a UserDisplayableException
java.lang.NullPointerException
at com.guidewire.pl.system.entity.proxy.AbstractKeyableBeanProxy.getFieldValue(AbstractKeyableBeanProxy.java:159)
at com.guidewire.pl.system.entity.proxy.BeanProxy.getFieldValue(BeanProxy.java:593)
at com.guidewire.pl.system.graph.AbstractForeignKeyLink.getSourceIdsFromBundleIfPossible(AbstractForeignKeyLink.java:32)
at com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:139)
at com.guidewire.pl.system.graph.Chain.getSourceIdsFromBundleIfPossible(Chain.java:135)
at com.guidewire.pl.system.graph.Chain.getSourceIdsViaBundleIfPossible(Chain.java:44)
at com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.processChainInBundle(TopLevelEntityGraph.java:79)
at com.guidewire.pl.system.integration.messaging.events.TopLevelEntityGraph.getTopLevelObjectIdsReferringToUpdatedBean(TopLevelEntityGraph.java:43)
at com.guidewire.pl.system.bundle.validation.GraphToValidatableBeansImpl.getTopLevelObjectIdsReferringToUpdatedBean(GraphToValidatableBeansImpl.java:63)
at com.guidewire.pl.system.bundle.validation.RootValidatableBeansFinderImpl.findRootBeansToValidate(RootValidatableBeansFinderImpl.java:145)
at com.guidewire.pl.system.preupdate.PreUpdateHelper.executePreUpdateRules(PreUpdateHelper.java:21)
at com.guidewire.pl.system.database.DatabaseBundleWriter.prepareBundleForWritePreIDGeneration(DatabaseBundleWriter.java:73)
at com.guidewire.pl.system.bundle.BundleWriter.commitBundle(BundleWriter.java:85)
at com.guidewire.pl.system.transaction.SessionImpl.flush(SessionImpl.java:139)
at com.guidewire.pl.system.transaction.SessionImpl.commit(SessionImpl.java:200)
at com.guidewire.pl.system.transaction.TransactionManagerImpl.execute(TransactionManagerImpl.java:115)
at com.guidewire.pl.system.transaction.TransactionManagerImpl.commitBundle(TransactionManagerImpl.java:59)
at com.guidewire.pl.system.bundle.EntityBundleImpl.commitAndGetBeans(EntityBundleImpl.java:1669)
at com.guidewire.pl.system.bundle.EntityBundleImpl.commit(EntityBundleImpl.java:1611)
at com.guidewire.pl.web.navigation.EditControllerImpl.commitChanges(EditControllerImpl.java:63)
at com.guidewire.pl.web.navigation.Location.innerCommitChanges(Location.java:476)
at com.guidewire.pl.web.navigation.Location.commitChanges(Location.java:425)
at com.guidewire.pl.web.navigation.LocationConfigCodeGen$6.handleCall(LocationConfigCodeGen.java:91)
at gw.internal.gosu.runtime.GosuRuntimeMethods.invokeMethodInfo(GosuRuntimeMethods.java:252)
at fragment_.pcffragment.ApprovalDetailWorksheet.ApprovalDetailScreen.ApprovalDetailWorksheet_ApproveButton.ToolbarButton_action_0_6.evaluate(Unknown Source)
at gw.internal.gosu.parser.fragments.GosuFragment.evaluate(GosuFragment.java:485) - ({
beforeCommitAction = \ -> Activity.approve()
CurrentLocation.commit()

Related

Getting Incomplete User Details Info from OneLogin

I am trying to get user detail info from onelogin after getting token successfully.
But getting some parameters null. I have used below code:
val config = OIDCConfiguration.Builder()
.clientId("XXXXXXX")
.issuer("XXXXXXXX")
.redirectUrl("XXXXXXX")
.scopes(listOf("openid", "profile", "email"))
.isDebug(true)
.build()
OneLoginOIDC.initialize(this.applicationContext,config)
val oidcClient = OneLoginOIDC.getClient()
Now using oidcClient?.signIn() to get token in onSuccess callback and after getting token when i tried to get user info object using oidcClient?.getUserInfo() I get userinfo object like: UserInfo(sub=123936207, email=hksharma#q3tech.com, preferredUsername=null, name=Harish Kr Sharma, updatedAt=null, givenName=null, familyName=null, groups=null)
Here, getting updatedAt, givenName, familyName, groups and preferredUsername parameters value null.
Also how to get some custom additional information added by backened team to onelogin portal

CodedUI - Check if a control exists or not

I have a web page with a login button, to get to the site you simply click the button. This is easily done by writing this:
//Click the Login button
UITestControl Login = new UITestControl(Browser);
Login.TechnologyName = "Web";
Login.SearchProperties.Add("ControlType", "Button");
Login.SearchProperties.Add("Type", "Submit");
Login.SearchProperties.Add("DisplayText", "Log In");
Mouse.Click(Login);
HOWEVER, after you login the first time, you remain logged in for an hour (auto log out if idle for over an hour). If you access the site more than once within an hour, there will be no login button since you are still logged in so everytime I run my test, it will error right away because it won't find the control.
I hope that makes sense, here is a synopsis:
First time to site - Login screen appears, click login button, gain entry
Subsequent times to site - No login screen appears,no login required
so basically I want to say, "If there is a login button, click it then do the next thing, if no login button, then do the next thing"
There is a TryFind() method which you can use.
UITestControl Login = new UITestControl(Browser);
Login.TechnologyName = "Web";
Login.SearchProperties.Add("ControlType", "Button");
Login.SearchProperties.Add("Type", "Submit");
Login.SearchProperties.Add("DisplayText", "Log In");
// TryFind() returns true if it's in the Markup somewhere, even if hidden.
// By testing Width > 0 && Height > 0, we make sure it is visible.
// If it were Hidden and we did not use TryFind() before checking Height
// or Width, there would be an exception thrown.
if(Login.TryFind() && Login.Width > 0 && Login.Height > 0)
{
Mouse.Click(Login);
}
There is also the TryGetClickablePoint method that you can use instead of looking for width and height.
Point p;
if(Login.TryGetClickablePoint(out p))
{
Mouse.Click(Login);
}
There's a .Exists method for all UI controls
var lastPageButton = new HtmlHyperlink(parent);
lastPageButton.SearchProperties[HtmlHyperlink.PropertyNames.Title] = "Login";
lastPageButton.SearchProperties[HtmlHyperlink.PropertyNames.Class] = "YourClassHere";
if (lastPageButton.Exists) Mouse.Click(lastPageButton);
//Other work

Close a dialog on clicking CANCEL button ignoring EN_KILLFOCUS

I have a CEdit field in my dialog where I have implemented EN_KILLFOCUS, so when the user enters invalid data a warning message is displayed when the focus moves away from this field and the focus returns to the CEdit field so that the user can enter proper data. If the user enters invalid data and clicks on the CANCEL button, then also a warning message is displayed which is undesirable because the user is anyway trying to cancel his actions. I have tried implementing PostQuitMessage when the user clicks on CANCEL button, but this closes the entire application. I want only my dialog to close when the user clicks CANCEL button. Is there any way that I can close the dialog instantly after I click on CANCEL button. This is the code that I tried.
void CMARPropWnd::OnParentNotify(UINT message, LPARAM lParam)
{
CCDialog::OnParentNotify(message, lParam);
// TODO: Add your message handler code here
CPoint ptButtonDown(LOWORD(lParam),HIWORD(lParam));
if ((message == WM_LBUTTONDOWN) && (ChildWindowFromPoint(ptButtonDown) == GetDlgItem(eMARPropWndCancelBtnId)))
{
PostQuitMessage(0);
}
}
Try
OnCancel();
instead of PostQuitMessage(0);
Note that OnCancel() is a virtual method of CDialog, so this is the "most correct", and will do any special code that may override the default CDialog behavior.

adding errors to FacesContext.getCurrentInstance().addMessage shows message but doesn't prevent from processing

I'm validating data selected in a dropdown - ice:selectOneMenu on a form. On the valueChangeListener. I have validation which adds an error message:
FacesContext.getCurrentInstance().addMessage(fieldId,
new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg));
The validation works on the Bean and the error message is displayed to the user but when the "Save" commandbutton is clicked, the page continues the confirm page when it's suppose to stay on the capture page until the correct value is selected in the dropdown.
Why does the page continue to confirm the page?
When validation fails, you have to throw an ValidatorException so that the input can be treated as invalid one. That's most likely the cause. Instead of
FacesContext.getCurrentInstance().addMessage(fieldId,
new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg));
do
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg));

Implementing a blocking modal view/dialog like in Windows Forms - is it possible?

In short:
I want to show a view or action sheet and only continue code execution after the user has dismissed the view / sheet. So: line one shows the view, line two reads some result variable.
In detail why I would need this:
I'm porting a Windows Forms application over to the iPad. The original implementation has a communication class which uses a web service to communicate with the server. It offers a couple of methods to get data. Conveniently it checks prior to each call if the user still has a valid connection or if he has to re-enter his password for security reasons.
If the password is required, the .NET class shows a modal dialog which blocks any further code executio and if the password was entered, retries the last call it has made before showing the dialog.
Now using CocoaTouch I'm facing a problem. I replaced the code that shows the dialog with a UIActionSheet. Works great but code execution continues immediately, whereas in Windows Forms it is blocked (the next line in Windows Forms after showing the dialogs is to read the entered password from the dialog) until the dialog has been closed.
I tried a Thread.Sleep() until the user dismisses the UIActionSheet but the Thread.Sleep() also blocks the main loop and my view won't even be drawn.
The alternative I currently see is to change all methods in the already working class and give them a return value: if password required, handle it, then retry.
But this means that all over my code I will have to add these checks because at any given moment the password might be needed. That's why it is nested in communication class in Windows Forms.
Any other ideas?
René
Yes, it is possible.
To do this, what you can do is to run the mainloop manually. I have not managed to stop the mainloop directly, so I instead run the mainloop for 0.5 seconds and wait until the user responds.
The following function shows how you could implement a modal query with the above approach:
int WaitForClick ()
{
int clicked = -1;
var x = new UIAlertView ("Title", "Message", null, "Cancel", "OK", "Perhaps");
x.Show ();
bool done = false;
x.Clicked += (sender, buttonArgs) => {
Console.WriteLine ("User clicked on {0}", buttonArgs.ButtonIndex);
clicked = buttonArgs.ButtonIndex;
};
while (clicked == -1){
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
Console.WriteLine ("Waiting for another 0.5 seconds");
}
Console.WriteLine ("The user clicked {0}", clicked);
return clicked;
}
I think this approach using async/await is much better, and doesn't suffer from freezing the app when rotating the device, or when the autoscrolling interferes and leaves you stuck in the RunUntil loop forever without the ability to click a button (at least these problems are easy to reproduce on iOS7).
Modal UIAlertView
Task<int> ShowModalAletViewAsync (string title, string message, params string[] buttons)
{
var alertView = new UIAlertView (title, message, null, null, buttons);
alertView.Show ();
var tsc = new TaskCompletionSource<int> ();
alertView.Clicked += (sender, buttonArgs) => {
Console.WriteLine ("User clicked on {0}", buttonArgs.ButtonIndex);
tsc.TrySetResult(buttonArgs.ButtonIndex);
};
return tsc.Task;
}

Resources