- From: Mercurial notifier <nobody@w3.org>
- Date: Tue, 14 Sep 2010 17:16:59 +0000
- To: Unicorn Updates <www-validator-cvs@w3.org>
changeset: 1490:d636697fc869 user: Thomas Gambet <tgambet@w3.org> date: Tue Sep 14 13:15:27 2010 -0400 files: WebContent/WEB-INF/languages/en.properties src/org/w3c/unicorn/action/ObserveAction.java src/org/w3c/unicorn/contract/Observer.java src/org/w3c/unicorn/input/URIInputParameter.java description: + if unicorn can't find a document mimetype then bypass the check and display a warning diff -r 6553009d064b -r d636697fc869 WebContent/WEB-INF/languages/en.properties --- a/WebContent/WEB-INF/languages/en.properties Tue Sep 14 13:13:28 2010 -0400 +++ b/WebContent/WEB-INF/languages/en.properties Tue Sep 14 13:15:27 2010 -0400 @@ -31,6 +31,7 @@ local_file_label=Local file: location=Location message_connect_exception=The URI you submitted seems unreachable. Verify it and try again. +#message_could_not_guess_mimetype= message_document_not_found=The specified document does not exist. message_empty_direct_input=You must enter a document to check. message_empty_uploaded_file=The uploaded file is empty. diff -r 6553009d064b -r d636697fc869 src/org/w3c/unicorn/action/ObserveAction.java --- a/src/org/w3c/unicorn/action/ObserveAction.java Tue Sep 14 13:13:28 2010 -0400 +++ b/src/org/w3c/unicorn/action/ObserveAction.java Tue Sep 14 13:15:27 2010 -0400 @@ -310,9 +310,9 @@ if (req.getMethod().equals("HEAD")) { resp.setHeader("X-W3C-Validator-Status", "Abort"); } else { - if (e.getUnicornMessage() != null) + if (e.getUnicornMessage() != null) { messages.add(e.getUnicornMessage()); - else if (e.getMessage() != null) + } else if (e.getMessage() != null) messages.add(new Message(Message.ERROR, e.getMessage(), null)); aOutputModule.produceError(mapOfStringObject, resp.getWriter()); } diff -r 6553009d064b -r d636697fc869 src/org/w3c/unicorn/contract/Observer.java --- a/src/org/w3c/unicorn/contract/Observer.java Tue Sep 14 13:13:28 2010 -0400 +++ b/src/org/w3c/unicorn/contract/Observer.java Tue Sep 14 13:15:27 2010 -0400 @@ -246,6 +246,8 @@ public boolean canHandleMimeType(final MimeType aMimeType) { // return this.supportedMimeTypes.contains(aMimeType); // equals and thus contains doesn't work :( + if (aMimeType == null) + return true; for (final MimeType mt : this.supportedMimeTypes) { if (mt.match(aMimeType)) { return true; diff -r 6553009d064b -r d636697fc869 src/org/w3c/unicorn/input/URIInputParameter.java --- a/src/org/w3c/unicorn/input/URIInputParameter.java Tue Sep 14 13:13:28 2010 -0400 +++ b/src/org/w3c/unicorn/input/URIInputParameter.java Tue Sep 14 13:15:27 2010 -0400 @@ -112,8 +112,12 @@ throw new UnicornException(Message.ERROR, "$message_document_not_found"); } String sMimeType = con.getContentType(); - sMimeType = sMimeType.split(";")[0]; - mimeType = new MimeType(sMimeType); + if (sMimeType != null) { + sMimeType = sMimeType.split(";")[0]; + mimeType = new MimeType(sMimeType); + } else { + messages.add(new Message(Message.WARNING, "$message_could_not_guess_mimetype")); + } inputModule = new URIInputModule(mimeType, uri); } catch (MalformedURLException e) { throw new UnicornException(Message.ERROR, "$message_invalid_url_syntax", e.getMessage(), uri);
Received on Tuesday, 14 September 2010 17:17:02 UTC