This is an automated email from the ASF dual-hosted git repository. junichi11 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new d7640dad [NETBEANS-5155] retain fallback to file's MIME type. new 5700971 Merge pull request #2603 from sdedic/bugfix/NETBEANS-5155_mimetype d7640dad is described below commit d7640dadea7f0ca00b0e0bd14fe714a13eec96b4 Author: Svata Dedic <svatopluk.de...@oracle.com> AuthorDate: Thu Dec 17 12:50:54 2020 +0100 [NETBEANS-5155] retain fallback to file's MIME type. --- .../editor/hints/ErrorCheckingSupport.java | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/ErrorCheckingSupport.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/ErrorCheckingSupport.java index e57b0b3..4e659c5 100644 --- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/ErrorCheckingSupport.java +++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/ErrorCheckingSupport.java @@ -85,6 +85,20 @@ public final class ErrorCheckingSupport { } public static String getMimeType(Parser.Result info) { + String mime = getWebPageMetadataMime(info); + if (mime != null) { + return mime; + } + FileObject fo = info.getSnapshot().getSource().getFileObject(); + if (fo != null) { + return fo.getMIMEType(); + } else { + // no fileobject? + return info.getSnapshot().getMimeType(); + } + } + + private static String getWebPageMetadataMime(Parser.Result info) { String mime = WebPageMetadata.getContentMimeType(info, false); if (mime != null) { return mime; @@ -116,16 +130,7 @@ public final class ErrorCheckingSupport { // XXX return null; } - if (res.get() != null) { - return res.get(); - } - FileObject fo = info.getSnapshot().getSource().getFileObject(); - if (fo != null) { - return fo.getMIMEType(); - } else { - // no fileobject? - return info.getSnapshot().getMimeType(); - } + return res.get(); } public static HintFix createErrorFixForFile(Snapshot snapshot, boolean enable) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists