This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228291 - web.xml editor inserts garbage text into file
Summary: web.xml editor inserts garbage text into file
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: DD Editor (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-05 17:06 UTC by chase
Modified: 2015-03-18 03:29 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
solution (3.21 KB, patch)
2015-01-19 17:17 UTC, vkhashin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description chase 2013-04-05 17:06:50 UTC
Previously entered and removed garbage text will return after editing web.xml with a form and switching back to source view.

Create a web project.
Create a web.xml file.
Edit the web.xml using the source view.
Add some random text [a-z] after </session-config> that does not include greater than or less than symbols. (file should not be valid)
Remove random text (file should be valid)
Press the security form button.
Use the security form to add a role.
Press the source button.
The first garbage character will now have returned to the web.xml file.
Every time you delete the garbage, edit the file with a form and switch back to source it'll reappear.
Comment 1 David Konecny 2013-08-20 21:37:35 UTC
Valid issue.
Comment 2 vkhashin 2015-01-19 17:17:37 UTC
Created attachment 151579 [details]
solution
Comment 3 vkhashin 2015-01-19 17:18:03 UTC
Very intricate code. First removes all irrelevant(i.e. comments and break lines) nodes. Then the relevant child nodes is merged, irrelevant just inserted. But when node is not bean, it is not merged. (when user type 'a' and then type 'b' in the model exist only 'a' other symbols disappear). But when user type char 'a' and then remove it xml node become irrelevant, so char 'a' will not removed.
The global question is why merge algorithm needed? It is does not work correctly, despite the bug is fixed, the comments do not merged also there is no algorithm to resolve conflicts. Perhaps it is better just replace old WebAppProxy with the new (DDDataObject.java line 299)?
Comment 4 Jiri Kovalsky 2015-03-09 12:08:28 UTC
Petre, can you please review this patch and integrate it if you find the changes all right? Thanks!
Comment 5 Petr Hejl 2015-03-12 14:51:21 UTC
Applied in web-main 25514e39dfe1. Hopefully it won't break anything. Thanks for the contribution.
Comment 6 Quality Engineering 2015-03-13 03:14:13 UTC
Integrated into 'main-silver', will be available in build *201503130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/25514e39dfe1
User: Petr Hejl <phejl@netbeans.org>
Log: #228291 - web.xml editor inserts garbage text into file
Comment 7 Petr Hejl 2015-03-13 10:11:17 UTC
Reopening as tests are failing.
Comment 8 Petr Hejl 2015-03-13 17:41:27 UTC
web-main 55cc75cd1427. I have changed the DDDataObject. Please verify. This could potentially break other things.
Comment 9 Quality Engineering 2015-03-15 06:03:58 UTC
Integrated into 'main-silver', will be available in build *201503150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/55cc75cd1427
User: Petr Hejl <phejl@netbeans.org>
Log: #228291 - web.xml editor inserts garbage text into file
Comment 10 Petr Hejl 2015-03-17 12:00:34 UTC
A better fix web-main cb352c805732.
Comment 11 Quality Engineering 2015-03-18 03:29:13 UTC
Integrated into 'main-silver', will be available in build *201503180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cb352c805732
User: Petr Hejl <phejl@netbeans.org>
Log: #228291 - web.xml editor inserts garbage text into file