cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1344
Views
0
Helpful
4
Replies

Checking to see if document exists

rduclos01
Level 1
Level 1

In the script I want to check to see if a .txt file exists in the repository.

For XML files I see you can catch an exception off the GetXML step - the first time I'm using the document holding the .txt file is converting it to a string, which throws a nested filenotfound exception if the file isn't in the repo, which is perfect but I need to find a way to catch this. I tried the OnException GoTo step but none of the exceptions I tried worked.

Any ideas?                  

1 Accepted Solution

Accepted Solutions

Ryan,

I set up the scenerio you described above in my lab and I received the same error.  The document not found exceptions did not catch these errors.  By looking through the MIVR logs, I found that the actual error it was encountering was com.cisco.expression.ExpressionTargetException.  Try catching this error.

402285: Aug 26 12:47:11.474 CDT %MIVR-SS_CM-7-UNK:ICDContactAdapter:contactAborted - This call was aborted. The exception is com.cisco.expression.ExpressionTargetException: unable to generate a string from document; nested exception is:

    java.io.FileNotFoundException: mydoc.txt (No such file or directory) (line: 1, col: 1)

402286: Aug 26 12:47:11.484 CDT %MIVR-SS_RM-7-UNK:Processing msg: SessionTerminatedMsg (Rsrc:null ID:10001/1 Type:IAQ Cause:INVALID Abort Exception:com.cisco.expression.ExpressionTargetException: unable to generate a string from document; nested exception is:

    java.io.FileNotFoundException: mydoc.txt (No such file or directory) (line: 1, col: 1))

View solution in original post

4 Replies 4

villarrealed
Level 1
Level 1

I have handled this error using the DocumentNotFoundException.

I tried that exception as well as the fileNotFound Exception with no luck.

The Document variable is

strMunsterCBFilePath = "MunsterCallBackFile.txt" + appended date (so a new one will be created each day with the first call)

docMunsterCallBackFile = DOC[strMunsterCBFilePath]

The step that throws the exception

strCallback  = (String) docMunsterCallBackFile

Ryan,

I set up the scenerio you described above in my lab and I received the same error.  The document not found exceptions did not catch these errors.  By looking through the MIVR logs, I found that the actual error it was encountering was com.cisco.expression.ExpressionTargetException.  Try catching this error.

402285: Aug 26 12:47:11.474 CDT %MIVR-SS_CM-7-UNK:ICDContactAdapter:contactAborted - This call was aborted. The exception is com.cisco.expression.ExpressionTargetException: unable to generate a string from document; nested exception is:

    java.io.FileNotFoundException: mydoc.txt (No such file or directory) (line: 1, col: 1)

402286: Aug 26 12:47:11.484 CDT %MIVR-SS_RM-7-UNK:Processing msg: SessionTerminatedMsg (Rsrc:null ID:10001/1 Type:IAQ Cause:INVALID Abort Exception:com.cisco.expression.ExpressionTargetException: unable to generate a string from document; nested exception is:

    java.io.FileNotFoundException: mydoc.txt (No such file or directory) (line: 1, col: 1))

Thanks for your help.