Project

General

Profile

« Previous | Next » 

Revision 10006

Added by Jing Tao over 7 years ago

Clear the code for the method handleInsertOrUpdate.

View differences:

src/edu/ucsb/nceas/metacat/MetacatHandler.java
1674 1674
        } catch (MetacatUtilException ue) {
1675 1675
            logMetacat.error("MetacatHandler.handleInsertOrUpdateAction - " + 
1676 1676
            		         "Could not determine if user could insert or update: " + 
1677
            		         ue.getMessage());
1678
            ue.printStackTrace(System.out);
1679
            // TODO: This is a bug, as it allows one to bypass the access check -- need to throw an exception
1677
            		         ue.getMessage(), ue);
1678
            String msg = this.PROLOG +
1679
                    this.ERROR +
1680
                    "MetacatHandler.handleInsertOrUpdateAction - " + 
1681
                             "Could not determine if user could insert or update: " + 
1682
                             ue.getMessage() +
1683
                    this.ERRORCLOSE;
1684
            if(out != null)
1685
            {
1686
              out.println(msg);
1687
            }
1688
            return msg;
1680 1689
        }
1681 1690
        
1682 1691
        try {
......
1875 1884
        			}
1876 1885
                    
1877 1886
                  } catch ( McdbDocNotFoundException dnfe ) {
1878
                    logMetacat.debug(
1887
                    logMetacat.error(
1879 1888
                      "There was a problem finding the localId " +
1880 1889
                      newdocid + "The error was: " + dnfe.getMessage());
1881 1890
                    throw dnfe;
1882 1891
            
1883 1892
                  } catch ( AccessionNumberException ane ) {
1884 1893
            
1885
                    logMetacat.debug(
1894
                    logMetacat.error(
1886 1895
                      "There was a problem creating the accession number " +
1887 1896
                      "for " + newdocid + ". The error was: " + ane.getMessage());
1888 1897
                    throw ane;
......
1924 1933
            output += this.ERROR;
1925 1934
            output += e.getMessage();
1926 1935
            output += this.ERRORCLOSE;
1927
            logMetacat.warn("MetacatHandler.handleInsertOrUpdateAction - " +
1936
            logMetacat.error("MetacatHandler.handleInsertOrUpdateAction - " +
1928 1937
            		        "General error when writing the xml object " +
1929 1938
            		        "document to the database: " + 
1930
            		        e.getMessage());
1939
            		        e.getMessage(), e);
1931 1940
            e.printStackTrace();
1932 1941
        }
1933 1942
        
......
1945 1954
                trans.transformXMLDocument(output,
1946 1955
                        "message", "-//W3C//HTML//EN", qformat,
1947 1956
                        out, null, null);
1957
                return output;
1948 1958
            } catch (Exception e) {
1949 1959
                
1950 1960
                logMetacat.error("MetacatHandler.handleInsertOrUpdateAction - " +
......
1953 1963
                e.printStackTrace(System.out);
1954 1964
            }
1955 1965
        }
1956
        return null;
1966
        return output;
1957 1967
    }
1958 1968
    
1959 1969
    /**
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
468 468
            throw e;
469 469
        } catch (Exception e) {
470 470
            removeSystemMeta(pid);
471
            throw new ServiceFailure("1190", "The node is unable to create the object: " + e.getMessage());
471
            logMetacat.error("The node is unable to create the object: "+pid.getValue()+ " since " + e.getMessage(), e);
472
            throw new ServiceFailure("1190", "The node is unable to create the object: " +pid.getValue()+" since "+ e.getMessage());
472 473
        }
473 474
                    
474 475
      } else {
......
1467 1468
    		detailCode = "1310";
1468 1469
    		
1469 1470
    	}
1471
    	logMetacat.error("D1NodeService.insertOrUpdateDocument - Error inserting or updating document: "+pid.getValue()+" since "+result);
1470 1472
        throw new ServiceFailure(detailCode, 
1471
          "Error inserting or updating document: " + result);
1473
          "Error inserting or updating document: " +pid.getValue()+" since "+ result);
1472 1474
    }
1473 1475
    logMetacat.debug("Finsished inserting xml document with id " + localId);
1474 1476
    

Also available in: Unified diff