• User with authorization code can't upload

    By Rob Kirkland 8 years ago

    A user trying to upload a file using an authorization code can't upload anything.

    Using IE9, the upload appears to be successful, but no files ever become available for download. With FF and Chrome, the upload fails with the following output:

    Unexpected runtime error
    The runtime has encountered an unexpected error.
    Error source
    Page Name:/uploadFiles.xsp
    Control Id: cf_EmbedUploadedFilesToDoc

    Exception
    Error while executing JavaScript computed expression
    Script interpreter error, line=37, col=43: [TypeError] Exception occurred calling method NotesXspDocument.save() null
    JavaScript code
       1: var map = facesContext.getExternalContext().getRequestParameterMap();
       2: var fileUploadResponse = map.get('$$xspsubmitvalue');
       3: var bSaveDocument = false
       4:
       5: var fileRichTextItem:String = compositeData.richtTextFieldName
       6: var uploadField:NotesRichTextItem = null;
       7:
       8: var hdnAllowSubmit:com.ibm.xsp.component.xp.XspInputHidden = getComponent("hdnAllowSubmit");
       9:
      10:// only upload anything then there is something to upload.
      11: if (hdnAllowSubmit.getValue() == 0){
      12:    if (@Contains(fileUploadResponse, "#UPLOADEDFILE#")){
      13:       var arrFiles:Array = @Explode(fileUploadResponse, ",");
      14:
      15:      
      16:       if (compositeData.documentDataSource.getDocument().hasItem(fileRichTextItem)){
      17:          uploadField = compositeData.documentDataSource.getDocument().getFirstItem(fileRichTextItem);
      18:          if (uploadField == null){
      19:             uploadField = compositeData.documentDataSource.getDocument().createRichTextItem(fileRichTextItem);
      20:          }
      21:       }else{
      22:          uploadField = compositeData.documentDataSource.getDocument().createRichTextItem(fileRichTextItem);
      23:       }
      24:      
      25:
      26:       for(i=0;i<@Elements(arrFiles);i=i+1){
      27:          var fileUploadRenamed = new java.io.File(@Word(arrFiles[i], "#UPLOADEDFILE#", 1))
      28:          if (fileUploadRenamed.exists()){
      29:             bSaveDocument = true
      30:             uploadField.embedObject(lotus.domino.local.EmbeddedObject.EMBED_ATTACHMENT, "", fileUploadRenamed.getAbsolutePath(), null);
      31:
      32:             // rename the file back to its original
      33:             fileUploadRenamed.renameTo(new java.io.File(@Word(arrFiles[i], "#UPLOADEDFILE#", 2)));
      34:          }
      35:       }
      36:       if (bSaveDocument == true){
      37:          compositeData.documentDataSource.save()
      38:          // do not allow to run again
      39:          hdnAllowSubmit.setValue(1);
      40:       }
      41:    }
      42: }
      43:
     

    • User with authorization code can't upload

      By Rob Kirkland 8 years ago

      Should have added: filesendr 1.2.0.1 installed on Domino 8.5.3FP1 running on Windows 2008.

    • Got this too

      By Karsten W Rohrbach 8 years ago

      I am experiencing the same error:

       

      Unexpected runtime error

      The runtime has encountered an unexpected error.


      Error source

      Page Name:/uploadFiles.xsp
      Control Id: cf_EmbedUploadedFilesToDoc




      Exception

      Error while executing JavaScript computed expression
      Script interpreter error, line=37, col=43: [TypeError] Exception occurred calling method NotesXspDocument.save() null


      JavaScript code

         1: var map = facesContext.getExternalContext().getRequestParameterMap(); 
         2: var fileUploadResponse = map.get('$$xspsubmitvalue'); 
         3: var bSaveDocument = false
         4: 
         5: var fileRichTextItem:String = compositeData.richtTextFieldName
         6: var uploadField:NotesRichTextItem = null;
         7: 
         8: var hdnAllowSubmit:com.ibm.xsp.component.xp.XspInputHidden = getComponent("hdnAllowSubmit");
         9: 
        10:// only upload anything then there is something to upload.
        11: if (hdnAllowSubmit.getValue() == 0){
        12:    if (@Contains(fileUploadResponse, "#UPLOADEDFILE#")){
        13:       var arrFiles:Array = @Explode(fileUploadResponse, ",");
        14: 
        15:       
        16:       if (compositeData.documentDataSource.getDocument().hasItem(fileRichTextItem)){
        17:          uploadField = compositeData.documentDataSource.getDocument().getFirstItem(fileRichTextItem);
        18:          if (uploadField == null){
        19:             uploadField = compositeData.documentDataSource.getDocument().createRichTextItem(fileRichTextItem);
        20:          }
        21:       }else{
        22:          uploadField = compositeData.documentDataSource.getDocument().createRichTextItem(fileRichTextItem);
        23:       }
        24:       
        25: 
        26:       for(i=0;i<@Elements(arrFiles);i=i+1){
        27:          var fileUploadRenamed = new java.io.File(@Word(arrFiles[i], "#UPLOADEDFILE#", 1))
        28:          if (fileUploadRenamed.exists()){
        29:             bSaveDocument = true
        30:             uploadField.embedObject(lotus.domino.local.EmbeddedObject.EMBED_ATTACHMENT, "", fileUploadRenamed.getAbsolutePath(), null);
        31: 
        32:             // rename the file back to its original
        33:             fileUploadRenamed.renameTo(new java.io.File(@Word(arrFiles[i], "#UPLOADEDFILE#", 2)));
        34:          }
        35:       }
        36:       if (bSaveDocument == true){
        37:          compositeData.documentDataSource.save()
        38:          // do not allow to run again
        39:          hdnAllowSubmit.setValue(1);
        40:       }
        41:    }
        42: }
        43: 
      
      &nbsp;