web stats
Empty query results causing StringIndexOutOfBoundsException - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-02-2012, 08:11 AM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default Empty query results causing StringIndexOutOfBoundsException

I getting the error below in the transform step of my channel:

"StringIndexOutOfBoundsException: String index out of range"

is this due to the fact that some elements in the xml string returned from a query are empty?

The source on my channel is a database reader connecting to Oracle. I'm writing an HL7 file to the local drive. I have transform steps on all the xml elements to an HL7 field. But I suspect the error is due to having empty elements. I won't always have data returned in every field.

My question is how to handle that scenario? I still get the file created in my "error" directory, it just doesn't create it in the "out" directory.

Thanks
Reply With Quote
  #2  
Old 11-02-2012, 09:30 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

This could be due to one of many different things; post your channel so that the people here can help troubleshoot.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 11-02-2012, 10:21 AM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default

Here is the channel, thx for the review
Attached Files
File Type: xml ProviderMaster_DWTo360Encompass.xml (24.3 KB, 6 views)
Reply With Quote
  #4  
Old 11-02-2012, 10:46 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by psanders View Post
Here is the channel, thx for the review
Works fine for me; can you post a sample inbound message?
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 11-02-2012, 02:23 PM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default

Here is an example of an incomplete result message taken from the raw message tab in the channel messages:

<result>
<prov_epic_internal_id>40</prov_epic_internal_id>
<prov_refferal_source_type>INTERNAL</prov_refferal_source_type>
<prov_zip>84124</prov_zip>
<prov_family>xxxxxx</prov_family>
<prov_division>PEDIATRIC NEUROLOGY</prov_division>
<prov_address>1151 E 3900 S</prov_address>
<prov_given>xxxxxx</prov_given>
<prov_city>SALT LAKE CITY</prov_city>
<prov_degree>MD</prov_degree>
<prov_md_email/>
<prov_middle>L</prov_middle>
<prov_state>UT</prov_state>
<prov_dept>PEDIATRICS</prov_dept>
<update_date>20121002</update_date>
<prov_phone/>
</result>

Here is a complete message example:

<result>
<prov_epic_internal_id>45</prov_epic_internal_id>
<prov_refferal_source_type>INTERNAL</prov_refferal_source_type>
<prov_zip>84111</prov_zip>
<prov_family>xxxxxx</prov_family>
<prov_division>DERMATOLOGY</prov_division>
<prov_address>324 10TH AVE STE 224</prov_address>
<prov_given>C</prov_given>
<prov_city>SALT LAKE CITY</prov_city>
<prov_degree>MD</prov_degree>
<prov_md_email>xxxxxxxxxxx</prov_md_email>
<prov_middle>DAVID</prov_middle>
<prov_state>UT</prov_state>
<prov_dept>DERMATOLOGY</prov_dept>
<update_date>20121002</update_date>
<prov_phone>801-581-xxxx</prov_phone>
</result>

Notice that the xml tags are different on the two fields missing data. That's what I'm guessing the problem to be.

Last edited by psanders; 11-02-2012 at 02:25 PM.
Reply With Quote
  #6  
Old 11-02-2012, 03:36 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Hm, again that works perfectly fine for me. I wouldn't expect an error to occur because of blank fields. For example, this mapping:

Code:
msg['prov_md_email'].toString()
If the "prov_md_email" node in the inbound message is blank, the above mapping will just evaluate to an empty string, and that's what'll get placed in SFT.15.1. So, there's no reason that the transformer should fail, that I can see. There's most likely something else happening on your specific Mirth Connect instance that's causing those errors. Can you post the entire error message?
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #7  
Old 11-05-2012, 01:55 PM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default

Thx narupley, I found the problem. Your right the error isn't because of blank fields, I found a logic error in the deployment of two channels that was causing it. Essentially, another channel was also looking for the file extension and grabbing a half empty file.
Reply With Quote
Reply

Tags
error, hl7, oracle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:02 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation