[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: Issue with PSQL JDBC Driver Null Pointer
From:       Bhavesh Mistry <bhavesh.mistry13 () gmail ! com>
Date:       2021-07-29 21:12:12
Message-ID: CAD1effjUeaPHq7y_bCxFJNSWtWBuHHsxFbfgvA5KUz1YAe9njg () mail ! gmail ! com
[Download RAW message or body]

Thanks for fixing it.

Thanks,

Bhavesh

On Thu, Jul 29, 2021 at 12:49 PM Dave Cramer <davecramer@postgres.rocks>
wrote:

>
>
> On Thu, 29 Jul 2021 at 15:44, Bhavesh Mistry <bhavesh.mistry13@gmail.com>
> wrote:
>
>> Hi Dave,
>>
>> It still does not address the NPE issue.  If an alias is NULL. What
>> should be the behavior?
>>
>>
>> public String getTypeForAlias(String alias) {
>> String type = TYPE_ALIASES.get(alias);
>> if (type != null) {
>> return type;
>> }
>> type = TYPE_ALIASES.get(alias.toLowerCase()) *// NPE STILL HERE*;
>> if (type == null) {
>> type = alias;
>> }
>> //populate for future use
>> TYPE_ALIASES.put(alias, type);
>> return type;
>> }
>>
>
> Very good question. I guess we should return null in this case.
>
> I'll fix that
>
> Dave
>


-- 
Thanks,

Bhavesh

[Attachment #3 (text/html)]

<div dir="ltr">Thanks for fixing it.  \
<br><div><br></div><div>Thanks,</div><div><br></div><div>Bhavesh  \
</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, \
Jul 29, 2021 at 12:49 PM Dave Cramer &lt;davecramer@postgres.rocks&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On \
Thu, 29 Jul 2021 at 15:44, Bhavesh Mistry &lt;<a \
href="mailto:bhavesh.mistry13@gmail.com" \
target="_blank">bhavesh.mistry13@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Dave,<div><br></div><div>It \
still does not address the NPE issue.   If an  <span \
style="color:rgb(36,41,46);font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;white-space:pre-wrap">alias is  NULL.  What \
should be the behavior?</span></div><div><br></div><div><br></div><div><table \
style="border-collapse:collapse;border-spacing:0px;color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;Segoe \
UI&quot;,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI \
Emoji&quot;;font-size:14px"><tbody style="box-sizing:border-box"><tr \
style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC681" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">  <span \
style="box-sizing:border-box">public</span> <span \
style="box-sizing:border-box">String</span> <span \
style="box-sizing:border-box">getTypeForAlias</span>(<span \
style="box-sizing:border-box">String</span> <span \
style="box-sizing:border-box">alias</span>) {</td></tr><tr \
style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L682" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC682" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box">String</span> type <span \
style="box-sizing:border-box">=</span> <span \
style="box-sizing:border-box">TYPE_ALIASES</span><span \
style="box-sizing:border-box">.</span>get(alias);</td></tr><tr \
style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L683" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC683" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box">if</span> (type <span \
style="box-sizing:border-box">!=</span> <span \
style="box-sizing:border-box">null</span>) {</td></tr><tr \
style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L684" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC684" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">      \
<span style="box-sizing:border-box">return</span> type;</td></tr><tr \
style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L685" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC685" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    \
}</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L686" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC686" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    type \
<span style="box-sizing:border-box">=</span> <span \
style="box-sizing:border-box">TYPE_ALIASES</span><span \
style="box-sizing:border-box">.</span>get(alias<span \
style="box-sizing:border-box">.</span>toLowerCase()) <b>// NPE STILL \
HERE</b>;</td></tr><tr style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L687" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC687" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box">if</span> (type <span \
style="box-sizing:border-box">==</span> <span \
style="box-sizing:border-box">null</span>) {</td></tr><tr \
style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L688" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC688" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">      type \
<span style="box-sizing:border-box">=</span> alias;</td></tr><tr \
style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L689" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC689" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    \
}</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L690" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC690" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box"><span style="box-sizing:border-box">//</span>populate \
for future use</span></td></tr><tr style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L691" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC691" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box">TYPE_ALIASES</span><span \
style="box-sizing:border-box">.</span>put(alias, type);</td></tr><tr \
style="box-sizing:border-box;background-color:transparent"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L692" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC692" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">    <span \
style="box-sizing:border-box">return</span> type;</td></tr><tr \
style="box-sizing:border-box"><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-L693" \
style="box-sizing:border-box;padding:0px \
10px;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;line-height:20px;min-width:50px;text-align:right;vertical-align:top;white-space:nowrap;width:50px"></td><td \
id="gmail-m_2407121055473716241gmail-m_-94041054983384774gmail-LC693" \
style="box-sizing:border-box;padding:0px \
10px;line-height:20px;vertical-align:top;font-family:ui-monospace,SFMono-Regular,&quot;SF \
Mono&quot;,Menlo,Consolas,&quot;Liberation \
Mono&quot;,monospace;font-size:12px;overflow:visible;white-space:pre-wrap">  \
}</td></tr></tbody></table>  </div></div></blockquote><div><br></div><div>Very good \
question. I guess we should return null in this \
case.</div><div><br></div><div>I&#39;ll fix \
that</div><div><br></div><div>Dave</div></div></div> </blockquote></div><br \
clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div>Thanks,<br><br></div>Bhavesh \
<br><br></div></div></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic