Project

General

Profile

« Previous | Next » 

Revision 10007

Added by Jing Tao about 8 years ago

Check if the object and sysmeta are null before to get the inputstream object.

View differences:

src/edu/ucsb/nceas/metacat/restservice/v2/MNResourceHandler.java
1506 1506
        InputStream object = null;
1507 1507
        InputStream sysmeta = null;
1508 1508
        File smFile = files.get("sysmeta");
1509
        sysmeta = new FileInputStream(smFile);
1510 1509
        File objFile = files.get("object");
1511
        object = new FileInputStream(objFile);
1512
        
1513 1510
        // ensure we have the object bytes
1514 1511
        if  ( objFile == null ) {
1515 1512
            throw new InvalidRequest("1102", "The object param must contain the object bytes.");
1516 1513
            
1517 1514
        }
1515
        object = new FileInputStream(objFile);
1518 1516
        
1519 1517
        // ensure we have the system metadata
1520 1518
        if  ( smFile == null ) {
1521 1519
            throw new InvalidRequest("1102", "The sysmeta param must contain the system metadata document.");
1522 1520
            
1523 1521
        }
1522
        sysmeta = new FileInputStream(smFile);
1524 1523
        
1525 1524
        response.setStatus(200);
1526 1525
        response.setContentType("text/xml");

Also available in: Unified diff