You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Kari Maja (JIRA)" <ji...@apache.org> on 2009/01/09 13:21:59 UTC

[jira] Created: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Empty File Upload field breaks validation of other fields in WicketTester.
--------------------------------------------------------------------------

                 Key: WICKET-2015
                 URL: https://issues.apache.org/jira/browse/WICKET-2015
             Project: Wicket
          Issue Type: Bug
          Components: wicket-quickstart
    Affects Versions: 1.4-RC1
         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
            Reporter: Kari Maja


Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
- Invalid input on TextField does not trigger fields .setRequired(true)-validation.
- Valid input on DropDownChoise is not accepted.

If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 

Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Attachment: Wicket-Quickstart-Update.zip

Thank you for feedback. Tests are now fixed. 
Includes 6 tests, 3 of them fails because of FileUpload-field.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Attachment:     (was: Wicket-Quickstart-Update.zip)

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695752#action_12695752 ] 

Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------

Please see WICKET-2208 as a follow issue on the MalformedStreamException issue.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>            Assignee: Juergen Donnerstag
>             Fix For: 1.4-RC3
>
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag updated WICKET-2015:
---------------------------------------

    Attachment: Wicket-Quickstart.zip

note that you testcases were wrong. You forgot to set the value. I've attached an updated project. Please review. Based on these testcases there is no bug in current 1.4 trunk.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
> - Invalid input on TextField does not trigger fields .setRequired(true)-validation.
> - Valid input on DropDownChoise is not accepted.
> If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 
> Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667178#action_12667178 ] 

Kari Maja commented on WICKET-2015:
-----------------------------------

If my tests do not prove the bug, then they do not prove the opposite either. It would be a worth wile to look at FileUpload handling code in Wicket and make sure. 

The point in this forum is that users help designers to improve the product. Point is not perfecting the test cases. Or am I wrong?

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Carsten Behring (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667208#action_12667208 ] 

Carsten Behring commented on WICKET-2015:
-----------------------------------------

There is somehow a problem with the tester and file upload.
I use wicket 1.3.4 (but it's the same with 1.3.5)

I have the following test code, which works perfectly:

		FormTester mandateFormTester=tester.newFormTester("mandateForm");
		mandateFormTester.setFile("newdocContainer:fileName", new org.apache.wicket.util.file.File(file), "text/plain");
		mandateFormTester.setValue("mandateNumber", "123");
		mandateFormTester.submit("saveBtn");
		tester.assertNoErrorMessage();
		tester.assertInfoMessageStartsWith("Mandate saved:");


If I remove the "mandateFormTester.setFile"  (which is marked as "required") I do NOT get an validation error, as I would except. Instead the test fails on the last line, so there is no info message, which means for my code that the form did not get submitted.

In a previous version of my code the fileupload was not required, but I had the same problem. 

Without call tester.setFile() it seems to not submit the form. As I said in my previous comment, I found with the debugger an non-catched exception in class MultiPartFormInputStream, method "skipPreamble". 

I will try now with 1.4-RC1 and let you know.


> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664833#action_12664833 ] 

Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------

I modified Kari's test cases to test it, but I was not able to reproduce your problem. It seems to work fine. Could you please provide a quickstart or TestCase. Thanks.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662909#action_12662909 ] 

kmaja edited comment on WICKET-2015 at 1/12/09 12:52 AM:
-------------------------------------------------------------

I disagree that my example was incorrect. I presume submitting a form without field input is the correct way to test if field is set to require input. Fields setValue()-method is not needed for that test. Anyway i checked my examples and expanded them.

Wicket-Quickstart-Update covers also the following malfunctions in file upload:
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

Thanks to Carsten for degugging note! Hopefully it helps someone to fix the bug. I found already a patch to Wicket 1.4-RC2. Maybe it sticks: https://issues.apache.org/jira/browse/WICKET-1931.

      was (Author: kmaja):
    I disagree that my example was incorrect. I presume submitting a form without field input is the correct way to test if field is set to require input. Fields setValue()-method is not needed for that test. Anyway i checked my examples and expanded them.

Wicket-Quickstart-Update covers also the following malfunctions in file upload:
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

Thanks to Carstens for degugging note! Hopefully it helps someone to fix the bug. I found already a patch to Wicket 1.4-RC2. Maybe it sticks: https://issues.apache.org/jira/browse/WICKET-1931.
  
> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662909#action_12662909 ] 

kmaja edited comment on WICKET-2015 at 1/12/09 12:52 AM:
-------------------------------------------------------------

I disagree that my example was incorrect. I presume submitting a form without field input is the correct way to test if field is set to require input. Fields setValue()-method is not needed for that test. Anyway i checked my examples and expanded them.

Wicket-Quickstart-Update covers also the following malfunctions in file upload:
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

Thanks to Carstens for degugging note! Hopefully it helps someone to fix the bug. I found already a patch to Wicket 1.4-RC2. Maybe it sticks: https://issues.apache.org/jira/browse/WICKET-1931.

      was (Author: kmaja):
    I disagree that my example was incorrect. I presume submitting a form without field input is the correct way to test if field is set to require input. Fields setValue()-method is not needed for that test. Anyway i checked my examples and expanded them.

Wicket-Quickstart-Update covers also the following malfunctions in file upload:
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

Thanks to Casters for degugging note! Hopefully it helps someone to fix the bug. I found already a patch to Wicket 1.4-RC2. Maybe it sticks: https://issues.apache.org/jira/browse/WICKET-1931.
  
> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666999#action_12666999 ] 

Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------

I run your latest tests on the current trunk. All tests except 1 were executed successfully. The only test that failed was 

	public void testSubmit_ValidTextField_NoFile() {
		formTester.setValue(textFieldId, 
				FileUploadError.THIS_VALUE_SHOULD_THROW_EXCEPTION);
		try {
			formTester.submit();
			fail("Value not succesfully submitted.");
		} catch (RuntimeException rex) {
			assertEquals("Special value: " + 
					FileUploadError.THIS_VALUE_SHOULD_THROW_EXCEPTION, 
					rex.getMessage());
		}
	}

Here FileUploadError.THIS_VALUE_SHOULD_THROW_EXCEPTION == "this value should throw exception". And this is the constraint: inputField.add(StringValidator.lengthBetween(3, 10)); Obviously the text is longer than 10 chars. Hence you get a validation error and not your expected exception. I'm sorry, but your test is wrong which means that all test pass successfully.



> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Component/s:     (was: wicket-quickstart)
                 wicket

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: WicketQuickstart.zip
>
>
> Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
> - Invalid input on TextField does not trigger fields .setRequired(true)-validation.
> - Valid input on DropDownChoise is not accepted.
> If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 
> Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Carsten Behring (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663096#action_12663096 ] 

Carsten Behring commented on WICKET-2015:
-----------------------------------------

I did not take a close look at the quick start test. In our case the situation was:

1. FileUpload is not required
2. No other fields of the form where required

In this situation the submission of the form via the tester without setting any fields seemed not do anything.
No error messages appeared and the models of the form components were not updated. In this situation I ran it with the debugger, with seemed to show that the form submission process fails silently in the middle.

My workaround was to set a value to the not required fileupload and the form submission worked as expected (no error messages and models updated).


> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667202#action_12667202 ] 

Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------

You are completly right. But look, you reported a major bug and what is well appreciated by every core developer, you provided test cases. Unfortunately some of your test cases were wrong. Correcting these test cases proved that wicket does what it is supposed to do. In order to improve our test coverage I added your test cases to the core test classes. Please correct me if I'm wrong, but until now we do not have a single failing test case for FileUpload which makes me think why it is time worthwile spend on FileUpload if there are other bugs waiting to be fixed. 

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Description: 
Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
- TextField mandatority (field.setRequired(true)).
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

If File Upload -field is filled, then validations above work.
Form submits manually without a problem in web browser.

  was:
Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
- Invalid input on TextField does not trigger fields .setRequired(true)-validation.
- Valid input on DropDownChoise is not accepted.

If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 

Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.


I disagree that my example was incorrect. I presume submitting a form without field input is the correct way to test if field is set to require input. Fields setValue()-method is not needed for that test. Anyway i checked my examples and expanded them.

Wicket-Quickstart-Update covers also the following malfunctions in file upload:
- TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
- DropDownChoice validation does not "see" selection.

Thanks to Casters for degugging note! Hopefully it helps someone to fix the bug. I found already a patch to Wicket 1.4-RC2. Maybe it sticks: https://issues.apache.org/jira/browse/WICKET-1931.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Carsten Behring (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662432#action_12662432 ] 

Carsten Behring commented on WICKET-2015:
-----------------------------------------

I found back the line where this case seems to create the problem.
If you debug your stuff (without having the file upload set), the code will get an exception in MultiPartFormInputStream, method "skipPreamble":

It ends up in the MalformedStreamException, which is swallowed and "false" is returned. 
Maybe this finished the submission and nothing happens.


	public boolean skipPreamble() throws IOException
	{
		// First delimiter may be not preceeded with a CRLF.
		System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
		boundaryLength = boundary.length - 2;
		try
		{
			// Discard all data up to the delimiter.
			discardBodyData();

			// Read boundary - if succeeded, the stream contains an
			// encapsulation.
			return readBoundary();
		}
		catch (MalformedStreamException e)
		{
			return false;
		}
		finally
		{
			// Restore delimiter.
			System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
			boundaryLength = boundary.length;
			boundary[0] = CR;
			boundary[1] = LF;
		}
	}

The exception has as cause: MalformedStreamException: Stream ended unexpectedly

I looked further and the debugger showd that this methods throws the exception : discardBodyData()

By assigning a value to the fileUploadComponent the code does not throw any exception at that point.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: WicketQuickstart.zip
>
>
> Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
> - Invalid input on TextField does not trigger fields .setRequired(true)-validation.
> - Valid input on DropDownChoise is not accepted.
> If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 
> Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Attachment: Wicket-Quickstart-Update.zip

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-2015.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC3

I close this one because no issue was found. I've added additional test cases for verification.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>            Assignee: Juergen Donnerstag
>             Fix For: 1.4-RC3
>
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Carsten Behring (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662402#action_12662402 ] 

Carsten Behring commented on WICKET-2015:
-----------------------------------------

I have the same problem in version 1.3.5 as well.
I debugged it once, and found the root cause somewhere deep in Wicket.

My work-around was to always set a value in the file upload field with the form tester. 

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: WicketQuickstart.zip
>
>
> Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
> - Invalid input on TextField does not trigger fields .setRequired(true)-validation.
> - Valid input on DropDownChoise is not accepted.
> If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 
> Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-2015:
-------------------------------------

    Assignee: Juergen Donnerstag

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>            Assignee: Juergen Donnerstag
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663076#action_12663076 ] 

Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------

Your latest quickstart prove my point. Your tests are wrong. Please see below 

BTW, all tests are against 1.4 trunk.


TestFileUploadWithTextField.java
	/**
	 * File is uploaded: Missing text field input is 
	 * required as supposed to in form submit.
	 */
	public void testSubmit_FileUploaded_NoInput() {
		formTester.setFile(fileUploadId, new File(testUploadFilePath), "UTF-8");
		formTester.submit();
		tester.assertNoErrorMessage();
		//assertEquals(1, tester.getMessages(FeedbackMessage.ERROR).size());
	}
	
You did not provide a value for the TextField which is setRequired(true). Since you are not setting a value for TextValue, you receive an error message. assertNoErrorMessage() == "assert that NO error message has been reported". Wicket it right. Your test is wrong.
	
	/**
	 * No File Uploaded: Text field is not required in 
	 * submit as supposed to.
	 */
	public void testSubmit_NoFileUploaded_NoInput() {
		formTester.submit();
		tester.assertNoErrorMessage();
	}

Same as above. No value for TextField with setRequired(true) => error message. Wicket it right. Your test is wrong.

With HTML there is nothing such as a null value. Hence "" means empty. Hence the following test reports an error
	
	/**
	 * No File Uploaded: Text field is not required in 
	 * submit as supposed to.
	 */
	public void testSubmit_NoFileUploaded_EmptyValues() {
		formTester.setValue(textFieldId, "");
		formTester.submit();
		tester.assertNoErrorMessage();
	}

Your test is wrong. No bug.

	
	/**
	 * No file uploaded: Too short text field input 
	 * validation malfunctions on form submit.
	 */
	public void testSubmit_NoFileUploaded_TooShortInput() {
		formTester.setValue(textFieldId, textTooShortInput);
		formTester.submit();
		tester.assertNoErrorMessage();
	}

You even wrote it in your comment. The value is too short, hence you expect an error message. But that is not what you test. You are testing that there is no error message. => No bug. Your test is wrong


The same, just that the text is too long. You expect an error, but your test is about finding no error message.	
	/**
	 * No file uploaded: Too long text field input 
	 * validation malfunctions on form submit.
	 */
	public void testSubmit_NoFileUploaded_TooLongInput() {
		formTester.setValue(textFieldId, textTooLongInput);
		formTester.submit();
		tester.assertNoErrorMessage();
	}

and so on and so on.

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip, WicketQuickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Attachment: WicketQuickstart.zip

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-quickstart
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: WicketQuickstart.zip
>
>
> Submitting form with empty File Upload -field malfunctions in WicketTester in following way:
> - Invalid input on TextField does not trigger fields .setRequired(true)-validation.
> - Valid input on DropDownChoise is not accepted.
> If File Upload -field is filled, then validations function fine when submitting form in WicketTester. 
> Submitting form normally through web browser does not trigger this bug. It is shown in WicketTester only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2015) Empty File Upload field breaks validation of other fields in WicketTester.

Posted by "Kari Maja (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kari Maja updated WICKET-2015:
------------------------------

    Attachment:     (was: WicketQuickstart.zip)

> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2015
>                 URL: https://issues.apache.org/jira/browse/WICKET-2015
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
>            Reporter: Kari Maja
>         Attachments: Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.