NULLReferenceException when using LINQ query with In clause
Hi,
I am not sure where my code is actually breaking. Kindly help as it's a production issue. It's not happening in SIT, but on production.
NullReferenceException occurring when below method is called:
internal bool IsFilingPartyWithActiveLAB(string docId)
IBackEndMediator bckEndMd = null;
List<DocCasePartyEntity> lstDCPWithLAB = null;
try
if (!string.IsNullOrEmpty(docId))
bckEndMd = new BackEndMediatorImpl();
List<DocCasePartyEntity> lstDCP = bckEndMd.GetListDocCasePartyByDocId(docId);
lstDCPWithLAB = new List<DocCasePartyEntity>();
if (lstDCP != null && lstDCP.Count > 0)
lstDCPWithLAB = (from dcp in lstDCP
where dcp.FilingInd
== FilingPartyInd.Y &&
dcp.HasLAC == YesNo.Y
select dcp).ToList();
if (lstDCPWithLAB != null && lstDCPWithLAB.Count > 0)
foreach (DocCasePartyEntity dcp in lstDCPWithLAB)
DocCasePartyLACDetailEntity dcpLACDetailEntity = bckEndMd.GetDocCasePartyLACDetailByDCPId(dcp.DCPID);
if (dcpLACDetailEntity != null)
if (dcpLACDetailEntity.LACRefStatus == LACRefStatus.A)
return true;
catch (Exception ex)
log.Error("Exception during IsFilingPartyWithActiveLAB()", ex);
throw;
return false;
Logged ERROR is:
ERROR 2015-04-16 10:23:05,296 20 IELS.BackEnd.TaskList.Business.TaskListLABService -
Exception during IsFilingPartyWithActiveLAB()
System.NullReferenceException: Object reference not set to an instance of an object.
at IELS.BackEnd.TaskList.Business.TaskListLABService.IsFilingPartyWithActiveLAB(String docId)
DEBUG 2015-04-16 10:23:05,296 56 CrimsonLogic.Common.DMS.Utilities.SharePointHelper - :End GetSPFolder(http://URL, IELSFormXMLTemplates)
ERROR 2015-04-16 10:23:05,296 20 IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage - TaskItemApproval: method-TaskItemApproval.BindWaiverFeeDetails, msg-System.NullReferenceException: Object reference not set to an instance of an object.
at IELS.BackEnd.TaskList.Business.TaskListLABService.IsFilingPartyWithActiveLAB(String docId)
at IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage.BindWaiverFeeDetails(List`1 feeListDTO)
ERROR 2015-04-16 10:23:05,296 20 IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage - TaskListApprovalPageException occured at Page_Load
System.NullReferenceException: Object reference not set to an instance of an object.
at IELS.BackEnd.TaskList.Business.TaskListLABService.IsFilingPartyWithActiveLAB(String docId)
at IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage.BindWaiverFeeDetails(List`1 feeListDTO)
at IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage.Page_Load(Object sender, EventArgs e)
ERROR 2015-04-16 10:23:05,296 20 CrimsonLogic.Legal.BootStrapper.BackEnd.ExceptionHandlerModule - Unhandled error occurred -
System.NullReferenceException: Object reference not set to an instance of an object.
at IELS.BackEnd.TaskList.Business.TaskListLABService.IsFilingPartyWithActiveLAB(String docId)
at IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage.BindWaiverFeeDetails(List`1 feeListDTO)
at IELS.BackEnd.TaskList.Presentation.TaskItemApprovalPage.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
ERROR 2015-04-16 10:23:05,296 20 CrimsonLogic.Legal.BootStrapper.BackEnd.BootStrapper - Unknown application error occurred.
Thanks, SS
I don't trust compilers. Had issues over 30 years ago and never use a combined 'if' where one of the items is null.
if (lstDCP != null)
if(lstDCP.Count > 0)
lstDCPWithLAB = (from dcp in lstDCP
where dcp.FilingInd == FilingPartyInd.Y &&
dcp.HasLAC == YesNo.Y
select dcp).ToList();
jdweng
That will not happen becuase he is checking for null first then count:
This is
List<string> lst = null;
if ( lst != null && lst.Count > 0 )
different than this: this will cause null ref error
List<string> lst = null;
if ( lst.Count > 0 && lst != null )
Fouad Roumieh
Similar Messages
-
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
How to numberformat when using sql:query alogn with c:forEach JSTL tags
Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
Here is my jsp code
<sql:query..../>
<c:forEach var="row" items="${queryResults.rows}">
<tr>
<td><c:out value="${row.COL1}" /></td>
<td><c:out value="${row.COL2}" /></td>
</tr>
</c:forEach>
Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
how can i format them to 1,000 , 10,1000 , 100,000 etcIt is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
I presume you discovered the JSTL <fmt:formatNumber> tag? -
Hi All,
I am writing the below linq query to fetch the record from the database ,
var individualres = (from c in orgContext.CreateQuery("contact")
join a in orgContext.CreateQuery("annotation")
on c["contactid"] equals a["objectid"]
where (bool)a["isdocument"] == true && a["objectid"] == r.GUID &&
a["filename"] != null
select new
FirstName = c["firstname"],
LastName = c["lastname"],
CreatedDate=a["createdon"],
DocumentBody = (a["documentbody"] == null) ? "" : a["documentbody"],
GUID = c["contactid"],
FileName = a["filename"],
WorkStatus = (c["new_workstatus"] == null) ? "" : c["new_workstatus"],
Rank = (c["new_rank"] == null) ? "" : c["new_rank"],
State = (c["address1_stateorprovince"] == null) ? "" : c["address1_stateorprovince"],
City = (c["address1_city"] == null) ? "" : c["address1_city"]
But it is throwing the error Exception has been thrown by the target of an invocation.
if this error is related to null values into the columns , then i am handling those by using the
ternary operator.
Can anybody help me out for this issue.
thanks in advance.Hello EmpAnsar,
>>But it is throwing the error Exception has been thrown by the target of an invocation.
From your LINQ query, it is hard to tell what the caused reason is since we do not have your exact tables and data. My suggestion is that you could narrow this issue by reducing items you want to fetch, for example, you could firstly write a sample query
without where clause and select new syntax as:
var individualres = (from c in orgContext.CreateQuery("contact")
join a in orgContext.CreateQuery("annotation")
on c["contactid"] equals a["objectid"]
select c).ToList();
To check if it would work, if so, you could add these filters and items you want step by step until reproducing this issue, this would help locate the root reason.
Update:
For this exception, i found some related threads which might be helpful to you:
http://stackoverflow.com/questions/11809530/linq-and-exception-has-been-thrown-by-the-target-of-an-invocation
http://stackoverflow.com/questions/4074058/exception-raised-when-using-a-linq-query-with-entity-framework
http://stackoverflow.com/questions/7674105/linq-aggregate-produces-error-exception-has-been-thrown-by-the-target-of-an-in
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Issue in select query with where clause
Hi guys,
I'm facing an issue while using select query with the where clause. When I'm selecting all the data from the table it returns the correct result. But when I'm using the where clause to get the specific rows from the table it returns no rows. But the data I'm trying to fetch using the where condition exists in the table.
Here is my query which causing the issue,
select * from mytable where myfield = 'myvalue'
But if I use the following query it returns the result correctly.
select * from mytable
Also the myfield value 'myvalue' exists in the table.
I have tried by running this query in both SQL Developer and SQL Plus. I have tried this query in mssql as well. It works perfectly and returns correct result sets for both the queries I have mentioned above. I'm unable to predict the issue as I'm new to ORACLE. Please help.
Thanks,
Ram.Hi Ram,
I experienced an issue similar to this with a varchar2 field. Some of our records had a hidden newline character at the end of them, which was making queries like the one below fail:
select * from employees
where email = '[email protected]'The best way I found to detect this was to use
select 'XX'||email||'XX' from employeesTo make sure that there were no newlines. But that is just a guess. If you could provide some example table data and the outputs of your selects, it would be helpful.
Jeff -
Hierarchical query with where clause
Hi,
How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
When I try with the following query,
select id, level from relation
where session_id = 79977
connect by prior id = root_id start with id = 5042;
It gets duplicate values.
I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
Thanks in Advance.
Regards,
-ParmyHi Sridhar Murthy an others,
Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
Any way thanks for your reply,
It's working for me.
With happiness,
-Parmy -
Using bind variable with IN clause
My application runs a limited number of straight up queries (no stored procs) using ODP.NET. For the most part, I'm able to use bind variables to help with query caching, etc... but I'm at a loss as to how to use bind variables with IN clauses. Basically, I'm looking for something like this:
int objectId = 123;
string[] listOfValues = { "a", "b", "c"};
OracleCommand command = new OracleCommand();
command.Connection = conn;
command.BindByName = true;
command.CommandText = @"select blah from mytable where objectId = :objectId and somevalue in (:listOfValues)";
command.Parameters.Add("objectId", objectId);
command.Parameters.Add("listOfValues", listOfValues);
I haven't had much luck yet using an array as a bind variable. Do I need to pass it in as a PL/SQL associative array? Cast the values to a TABLE?
Thanks,
NickNevermind, found this
How to use OracleParameter whith the IN Operator of select statement
which contained this, which is a brilliant solution
http://oradim.blogspot.com/2007/12/dynamically-creating-variable-in-list.html -
Outer join on query with OR clause
hi all, i am having problem outerjoining a query with or clause
here is my data
WITH table1 AS
SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual
,table2 AS
SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL
SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual
SELECT b.pid, a.*
from table1 a, table2 b
WHERE (a.txt1 = b.txt1 OR
a.txt1 IS NULL AND a.txt2=b.txt2 OR
Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR
Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4
) as you can see i am joining table1 and table 2. i am joining with txt1, if txt1 is null then join by txt2, if null then join by txt3 and so on.
the code above product this output
PID TXT1 TXT2 TXT3 TXT4
=== ==== === ==== ====
111 test pak ced su
222 pak ced2 su2
333 ced3 su3
444 su3this output is partially correct. only 4 rows were display and two was left out
SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual i tried using outer join but oracle complain that i cannot use outerjoin with OR clause.
can someone help modify my query to display the output below ?
PID TXT1 TXT2 TXT3 TXT4
=== ==== === ==== ====
111 test pak ced su
222 pak ced2 su2
333 ced3 su3
444 su3
NULL NULL NULL NULL NULL
test5Not sure you can do it with the Oracle style outer joins, but wioth ANSI style joins it is simple, actually exactly as you had it.
SQL> set null null;
SQL> WITH table1 AS (
2 SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
3 SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
4 SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL
5 SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
6 SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
7 SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual),
8 table2 AS (
9 SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
10 SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
11 SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL
12 SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual)
13 SELECT b.pid, a.*
14 from table1 a
15 LEFT JOIN table2 b
16 ON (a.txt1 = b.txt1 OR
17 a.txt1 IS NULL AND a.txt2=b.txt2 OR
18 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR
19 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4);
PID TXT1 TXT2 TXT3 TXT4
111 test pak ced su
222 null pak ced2 su2
333 null null ced3 su3
444 null null null su3
null text5 null null su3
null null null null nullJohn -
How to avoid data repetation when using select statements with innerjoin
how to avoid data repetation when using select statements with innerjoin.
thanks in advance,
satheeshyou can use a query like this...
SELECT DISTINCT
frg~prc_group1 "Product Group 1
frg~prc_group2 "Product Group 2
frg~prc_group3 "Product Group 3
frg~prc_group4 "Product Group 4
frg~prc_group5 "Product Group 5
prc~product_id "Product ID
txt~short_text "Product Description
UP TO 10 ROWS
INTO TABLE l_i_data
FROM
Joining CRMM_PR_SALESG and
COMM_PR_FRG_ROD
crmm_pr_salesg AS frg
INNER JOIN comm_pr_frg_rod AS prd
ON frgfrg_guid = prdfragment_guid
Joining COMM_PRODUCT and
COMM_PR_FRG_ROD
INNER JOIN comm_product AS prc
ON prdproduct_guid = prcproduct_guid
Joining COMM_PRSHTEXT and
COMM_PR_FRG_ROD
INNER JOIN comm_prshtext AS txt
ON prdproduct_guid = txtproduct_guid
WHERE frg~prc_group1 IN r_zprc_group1
AND frg~prc_group2 IN r_zprc_group2
AND frg~prc_group3 IN r_zprc_group3
AND frg~prc_group4 IN r_zprc_group4
AND frg~prc_group5 IN r_zprc_group5.
reward it it helps
Edited by: Apan Kumar Motilal on Jun 24, 2008 1:57 PM -
Revision: 1720
Author: [email protected]
Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
Log Message:
Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
QA: Yes
Doc: No
Details:
Update to the TomcatLoginCommand to work correctly with NIO endpoints.
Ticket Links:
http://bugs.adobe.com/jira/browse/LCDS-304
Modified Paths:
blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. javaRevision: 1720
Author: [email protected]
Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
Log Message:
Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
QA: Yes
Doc: No
Details:
Update to the TomcatLoginCommand to work correctly with NIO endpoints.
Ticket Links:
http://bugs.adobe.com/jira/browse/LCDS-304
Modified Paths:
blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java -
Strange behaviour when using connection pooling with proxy authentication
All
I have developed an ASP.NET 1.1 Web application that uses ODP.NET 9.2.0.4 accessing Oracle Database 8i (which is to be upgraded to 10g in the coming months). I have enabled connection pooling and implemented proxy authentication.
I am observing a strange behaviour in the live environment. If two users (User 1 and User 2) are executing SQL statements at the same time (concurrent threads in IIS), the following is occurring:
* User 1 opens a new connection, executes a SELECT statement, and closes this connection. The audit log, which uses the USER function, shows User 1 executed this statement.
* User 2 opens the same connection (before it is released to the connection pool?), excutes an INSERT statement, and closes this connection. The audit log shows User 1, not User 2, executed this statement.
Is this a known issue when using connection pooling with proxy authentication? I appreciate your help.
Regards,
ChrisHi Chris,
I tried to reproduce your complaint, but was unable to. I didnt use auditting however, just a series of "select user from dual" with proxy authentication. You might want to see if you can put together a small complete testcase for this and open a sr with support.
Cheers
Greg -
Scope when using a JavaBean with JSP
what is the meaning of this question .....?
"Which of the following can not be used as the scope when using a JavaBean with JSP? "
question 4
site :http://java.sun.com/developer/Quizzes/jsptut/The question is clearly written. I don't see how you can be confused. But let's assume you are since you would not have posed the question.
Dumbed-down:
There are 4 scopes or areas of variable visibility in JavaServer Pages. Which of those can areas can not be used with JavaBeans?
Does that help? -
When using Camera raw with PS12 after editing, I cannot save my file in JPEG, only DNG
When using Camera RAW after editing photo I can only save file as DNG, I want to save as JPEG. HOW??
THANKS LLOYDBARBARA,Yes, you are so right, I was deceived by the eve button, Just tried it and it WORKS GREAT-Thanks for the help.
THANKS AGAIN AND HAVE A GOOD DAY Lloyd
From: Barbara B. <[email protected]>
To: Lloyd Bennett <[email protected]>
Sent: Tuesday, January 13, 2015 11:46 AM
Subject: When using Camera raw with PS12 after editing, I cannot save my file in JPEG, only DNG
When using Camera raw with PS12 after editing, I cannot save my file in JPEG, only DNG
created by Barbara B. in Photoshop Elements - View the full discussionYou are being deceived by the Save button, like most people. That button is not the Save As button, really, but a link to the DNG converter. To save your raw file in an image format, click the Open button instead and then save in the format of your choice in the editor. If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7092207#7092207 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7092207#7092207 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following" Start a new discussion in Photoshop Elements by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624. -
Hosting company does not support SQL query with OUTFILE clause
From my mysql database, I want to allow the user to run a query and produce a csv / text file of our membership database. Unfortunately, I just found out my hosting company does not support the SQL query with OUTFILE clause for MySQL database.
Are there any other options available to produce a file besides me running the query in phpadmin and making the file available to users.
Thanks. GeorgeMaybe this external Export Mysql data to CSV - PHP tutorial will be of help
Cheers,
Günter -
How do you stop needing to verify email password when using yahoo.att with Mac Mail
How do you stop needing to verify email password when using yahoo.att with Mac Mail?
Nevermind, I fixed it (I think). I went into Settings | Accounts & Sync and found Yahoo at the bottom of the list (alphabetically). I selected it and it had an optiion to delete the account, which I did.
Maybe you are looking for
-
Can't view photos on dvd in iphoto 11
I have several dvd's with iphoto libraries on them that I burned with iphoto 09 or earlier. When I insert the dvds into a computer with iphoto 11, the dvd shows up with the correct title, but it says "no photos" where the photos should be displayed.
-
Designer 6i on Oracle 8.0.6 Server
Hi, Did anybody used Designer 6i on Oracle 8.0.6 database Server?? I tried using it but I am getting the following error: IMP-00003: ORACLE error 2248 encountered ORA-02248: invalid option for ALTER SESSION IMP-00000: Import terminated unsuccessfully
-
Select Options: How to preallocate the select options values?
Hi All, I have been trying to preallocate my select options. I want to read all values a user is authorized for and set them in the range of the select options fields (before the are actually shown to the user). However, I wasn't able to.. Does anybo
-
Wrong advertised C5380 printer cartridge
Have finally got round to setting up my C5380 HP Photosmart All-in-One Printer, and had to go out and buy cartridges, purchased the 564s which list my printer on the side, to find they are too big to fit in the printer cradle!! Which are the ones tha
-
I have the latest version of firefox. I know this because your website says so. But for some reason, my current firefox keeps trying to install a new version by "trying" to install a patch. But it fails every time. I cant say exactly when this starte