Project

General

Profile

« Previous | Next » 

Revision 9245

Added by Jing Tao over 9 years ago

Throw an exception if the request doesn't specify the name of the theme in the view method.

View differences:

src/edu/ucsb/nceas/metacat/restservice/v2/CNResourceHandler.java
388 388
                    deleteReplica(extra);
389 389
                    status = true;
390 390
                } else if (resource.startsWith(RESOURCE_VIEWS)) {
391
                    logMetacat.debug("Using resource " + RESOURCE_VIEWS);
391
                    logMetacat.info("Using resource " + RESOURCE_VIEWS);
392 392
                    // after the command
393 393
                    extra = parseTrailing(resource, RESOURCE_VIEWS);
394
                    logMetacat.debug("view extra: " + extra);
394
                    logMetacat.info("view extra: " + extra);
395 395

  
396 396
                    String format = null;
397 397
                    String pid = null;
......
401 401
                        int formatIndex = extra.length();
402 402
                        if (extra.indexOf("/") > -1) {
403 403
                            formatIndex = extra.indexOf("/");
404
                            format = extra.substring(0, formatIndex);
405
                        } else {
406
                            throw new InvalidRequest("2853", "The request doesn't specify the name of theme.");
404 407
                        }
405
                        format = extra.substring(0, formatIndex);
406
                        logMetacat.debug("view format: " + format);
408
                        logMetacat.info("view format: " + format);
407 409
                        
408 410
                        // get the pid if it is there
409 411
                        pid = extra.substring(formatIndex, extra.length());

Also available in: Unified diff