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 208456

Summary: ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty failure
Product: platform Reporter: Jiri Skrivanek <jskrivanek>
Component: TemplatesAssignee: Jesse Glick <jglick>
Status: VERIFIED FIXED    
Severity: normal CC: jglick, mmirilovic
Priority: P1 Keywords: TEST
Version: 7.0.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 208445    

Description Jiri Skrivanek 2012-02-15 14:54:16 UTC
As reported in bug 208445 org.netbeans.freemarker.templates.ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty is failing on Mac with JDK7u4. Please, evaluate and possibly fix it.

junit.framework.ComparisonFailure: null expected:<[text/x-freemarker]> but was:<[content/unknown]>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at org.netbeans.freemarker.templates.ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty(ScriptingCreateFromTemplateTest.java:93)
Comment 1 Marian Mirilovic 2012-02-27 14:39:10 UTC
Please evaluate ASAP, escalated by JDK team ... we need to know whether it's a random failuer, issue in test or problem in JDK.
Comment 2 Martin Entlicher 2012-02-27 14:58:04 UTC
Will look at it...
Comment 3 Martin Entlicher 2012-02-29 16:24:19 UTC
This occasionally fails on JDK 1.7.0_04-ea-b13 on Ubuntu 11.04 as well.
Comment 4 Martin Entlicher 2012-02-29 17:49:06 UTC
It looks like this depends on the order of executed tests, I do not think this has anything with Mac's JDK specifically. But it can be that the new JDK alters something that allows the tests to be altered randomly.

Reducing the priority to P3 as it does not seem to be a bug in JDK.

This problem occurs when
ScriptingCreateFromTemplateTest.testFreeFileExtension() is run before
ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty()

In that case, that the list of MIME resolvers is initialized to an empty array from:
Resolvers assigned with []
org.openide.filesystems.MIMESupport$CachedFileObject.getResolvers(MIMESupport.java:243)
org.openide.filesystems.MIMESupport$CachedFileObject.resolveMIME(MIMESupport.java:376)
org.openide.filesystems.MIMESupport$CachedFileObject.getMIMEType(MIMESupport.java:321)
org.openide.filesystems.MIMESupport.findMIMEType(MIMESupport.java:140)
org.openide.filesystems.FileUtil.getMIMEType(FileUtil.java:1481)
org.openide.filesystems.FileObject.getMIMEType(FileObject.java:587)
org.openide.filesystems.AbstractFileObject.getMIMEType(AbstractFileObject.java:195)
org.openide.loaders.DataLoaderPool.allLoaders(DataLoaderPool.java:332)
org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:530)
org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:493)
org.openide.loaders.DataObject.find(DataObject.java:528)
org.netbeans.freemarker.templates.ScriptingCreateFromTemplateTest.testFreeFileExtension(ScriptingCreateFromTemplateTest.java:135)

and therefore "text/x-freemarker" is not found at ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty()
Comment 5 Jesse Glick 2012-02-29 18:47:43 UTC
Neither a threading issue nor a JDK-specific issue, just depends on order of test execution and easily reproduced using -Dtest-unit-sys-prop.NbTestCase.order=shuffle (simulates unpredictability native to JDK 7).
Comment 6 Jesse Glick 2012-02-29 18:52:50 UTC
core-main #fd97cc518926
Comment 7 Marian Mirilovic 2012-03-01 00:05:50 UTC
Jesse, 
I forgot to mark as 7.1.1 candidate , could you also port this into release71_fixes ? That's the branch we will build Binary Tests Distribution for JDK from.

Thanks in advance
Comment 8 Jesse Glick 2012-03-01 00:22:29 UTC
releases #d2e1800f88fc
Comment 9 Quality Engineering 2012-03-01 11:01:30 UTC
Integrated into 'main-golden', will be available in build *201203010400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fd97cc518926
User: Jesse Glick <jglick@netbeans.org>
Log: #208456: ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty failure
Comment 10 Quality Engineering 2012-03-02 02:55:52 UTC
Integrated into 'releases', will be available in build *201203012225* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/d2e1800f88fc
User: Jesse Glick <jglick@netbeans.org>
Log: #208456: ScriptingCreateFromTemplateTest.testCreateFromTemplateEncodingProperty failure