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 202127 - DataObject.setModified(false) doesn't work for GsfDataObject
Summary: DataObject.setModified(false) doesn't work for GsfDataObject
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: CSL (API & infrastructure) (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords: T9Y
Depends on:
Blocks:
 
Reported: 2011-09-14 12:45 UTC by Jiri Skrivanek
Modified: 2011-09-20 11:35 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
PHP unit test that fails (3.47 KB, patch)
2011-09-15 06:59 UTC, Jaroslav Tulach
Details | Diff
Similar test and fix in csl.api (7.69 KB, patch)
2011-09-15 07:20 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2011-09-14 12:45:53 UTC
Calling of Data.setModified(false) from tests for PHP file doesn't reset state of file opened in editor. It seems that SaveCookie is not removed. Please, reassign if it is not bug in loaders (bug 199990 might be related). It is P2 because it blocks PHP validation tests. To reproduce try the following test case:

public class SetModifiedTest extends NbTestCase {

    public static Test suite() {
        return NbModuleSuite.createConfiguration(SetModifiedTest.class).enableModules(".*").clusters(".*").gui(false).suite();
    }

    public SetModifiedTest(String name) {
        super(name);
    }

    public void test1() throws Exception {
        FileSystem fs = FileUtil.createMemoryFileSystem();
        FileObject f = fs.getRoot().createData("index.php");
        DataObject dob = DataObject.find(f);
        System.out.println("dob=" + dob);
        dob.getLookup().lookup(EditorCookie.class).openDocument().insertString(0, "modified", null);
        assertTrue("Should be modified.", dob.isModified());
        dob.setModified(false);
        assertFalse("Should not be modified.", dob.isModified());
        assertNull("Should not have SaveCookie.", dob.getLookup().lookup(SaveCookie.class));
    }
}
Comment 1 Jaroslav Tulach 2011-09-15 06:59:58 UTC
Created attachment 110770 [details]
PHP unit test that fails
Comment 2 Jaroslav Tulach 2011-09-15 07:20:39 UTC
Created attachment 110771 [details]
Similar test and fix in csl.api

Please review and integrate all patches, if they look acceptable.

Btw. your LanguageRegistryTest fails due to introduction of LanguageRegistrationTest. Probably you don't run your unit tests anywhere regularly.
Comment 3 David Strupl 2011-09-16 10:08:09 UTC
I have reviewed the fix. Looks ok to me - Milutin, can you please integrate it?
Comment 4 Milutin Kristofic 2011-09-16 15:03:41 UTC
Thank you, one patch http://hg.netbeans.org/jet-main/rev/801bbaa2b141 and php test http://hg.netbeans.org/jet-main/rev/3f2cdfa14f72
Comment 5 Quality Engineering 2011-09-17 14:21:05 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/801bbaa2b141
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #202127 - DataObject.setModified(false) doesn't work for GsfDataObject