View Full Version : Validation

03-24-2003, 07:12 AM
I am trying to use some custom validation beans. I have created them to extend from UserInputFieldValidator as instructed. They compile fine. However when I build my project, the UserInputFieldValidator class is not included in the jar archive. Consequently when I run the install, I get an error saying the class cannot be found.

Any ideas?

03-24-2003, 11:50 AM
If you used the sample code in the Validate User Input topic of the User's Guide, this topic's code sample has been corrected since the release (is already up-to-date in the PDFs). Attached is a text file of the corrected topic - Please rename it with .htm as the extension, and copy it to your "help/ismp/Topics" directory, overwriting the one that is there.

Hope this helps!

03-25-2003, 04:34 AM
It is not the writing of the validator class I am having a problem with. The problem is not that MY class is not getting included, BUT the SUPER class called UserInputFieldValidator that is in wizard.jar. I do not understand why that class is not getting included. Consequently when the install finds my class, it cannot use it because there is no superclass

03-28-2003, 05:49 AM
I have the same problem.
I created a custom validator that extends UserInputFieldValidator to check the correctness of a password.
I specified the fully classified name of my class in the Custom Validator Settings/Class Name and the value to be matched with the password in Additional Data.
But it seems that the method validate() I overrided is not called by ISMP, as a matter of fact I throwed an exception inside it and also a System.out but they are not displayed in the console.
Is it an ISMP 5.0 bug?

03-28-2003, 10:36 AM
This is a known issue.

Add the following line of code in your custom validator build method.



03-28-2003, 10:59 AM
Please note that this has been fixed and will be included in our first maintenance release.

03-28-2003, 01:01 PM
Originally posted by chakra
This is a known issue.

Add the following line of code in your custom validator build method.



Thank you. Now it enters the validate() method but there is another problem:
if I write the following validate() method:

public boolean validate()
try {
catch (Exception e) {
System.out.println("exception " + e);

return true;

the console shows:

>exception java.lang.NullPointerException

even if I enters some values into the field and the Additional Data.
Do I have to set something else?

03-28-2003, 02:57 PM
Could you post the java stack trace, so that we know where exactly the exception is occuring.

In your catch block do e.printStackTrace() instead of System.out on exception


03-31-2003, 03:20 AM
This is the complete stack trace:

exception java.lang.NullPointerException
at com.installshield.wizardx.panels.UserInputFieldPasswordValidator.validate(UserInputFieldPasswordValidator.java:40)
at com.installshield.wizardx.panels.UserInputPanel.validateField(UserInputPanel.java:80)
at com.installshield.wizardx.panels.UserInputPanel.queryExit(UserInputPanel.java:64)
at com.installshield.wizard.awt.AWTWizardUI.doNext(AWTWizardUI.java:1200)
at com.installshield.wizard.awt.AWTWizardUI.actionPerformed(AWTWizardUI.java:1077)
at com.installshield.wizard.swing.SwingWizardUI.actionPerformed(SwingWizardUI.java:736)
at com.installshield.wizard.swing.SwingWizardUI$SwingNavigationController.notifyListeners(SwingWizardUI.java:866)
at com.installshield.wizard.swing.SwingWizardUI$SwingNavigationController.actionPerformed(SwingWizardUI.java:860)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:384)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:256)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:233)
at java.awt.Component.processMouseEvent(Component.java:3773)
at java.awt.Component.processEvent(Component.java:3602)
at java.awt.Container.processEvent(Container.java:1173)
at java.awt.Component.dispatchEventImpl(Component.java:2651)
at java.awt.Container.dispatchEventImpl(Container.java:1222)
at java.awt.Component.dispatchEvent(Component.java:2555)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java(Compiled Code))
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2230)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2139)
at java.awt.Container.dispatchEventImpl(Container.java:1209)
at java.awt.Window.dispatchEventImpl(Window.java:929)
at java.awt.Component.dispatchEvent(Component.java:2555)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:401)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:109)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:99)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

03-31-2003, 03:14 PM
Class UserInputFieldPasswordValidator is not part of the ISMP classes. Is that your custom validator class? Can you post your code to figure out why the nullpointer exceptionis thrown? or Modify your code to add checks for null values.


04-01-2003, 02:52 AM
In attachment there is the class (inside it there is a reference to a class named Validator that does some comparison)

04-01-2003, 01:02 PM
You are overiding the method initialize(UserInputField field, UserInputPanel panel, WizardUI ui) in your custom validator and you are not calling super.initialize(...) so the UserInputField is not initialized. Thats the reason you are getting a null UserInputField object.
Add the following line of code in your overide of initialize method

04-02-2003, 08:15 AM
Thank you very much, it worked.

Now I have another problem with custom panels in ISMP 5.0.
I migrated two custom panels from ISMP 4.x to 5.x.
I created the three implementors for each.
I used the same widgets for AWT implementor and Swing implementor (TextDisplayComponent and TextInputComponent).
Then if I launch the installer with Swing UI as default and I get to those custom panels they display correctly, but if I click the Back navigation Button and then the Next navigation button to come back to them all the labels (TextDisplayComponent) disappear (they refresh only if I hide and unhide them with another windows).
This doesn't happen if I use the AWT UI as default.

I tried to override the method entering() in the following way:

public void entering(WizardBeanEvent event) {
repaint(); // ???

but it doesn't work. Could you help me?

04-02-2003, 03:27 PM
TextDisplayComponent uses only awt specific controls, that might be causing problems in swing mode. Generally it is not recommended to mix awt specific controls with the swing controls.

I would recommend you use following controls instead of TextDisplayComponent.

com.installshield.wizard.swing.SwingText in your SwingImpl class
and com.installshield.wizard.awt.AWTText in your AwtImpl