Cinchoo.PGP throwing null reference error when all references are valid - c#-4.0

I am using Cinchoo.PGP to decrypt some files. When it runs, I am getting an "Object reference not set to an instance of an object" error.
using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt())
{
EncryptionViewModel pem = rpt.Encryption_In;
var from = setFiles.FileToProcessPath + setFiles.FileToProcess;
var to = setFiles.ProcessedPath + setFiles.ProcessedName;
if (from == to)
{
to = setFiles.ProcessedPath + "_" + setFiles.ProcessedName;
pgp.DecryptFile(from, to, pem.PEMPath, pem.PassPhrase);
File.Delete(from);
File.Move(to, from);
}
else { pgp.DecryptFile(from, to, pem.PEMPath, pem.PassPhrase); }
}
Stack trace is here:
at Cinchoo.PGP.ChoPGPEncryptDecrypt.Decrypt(Stream inputStream, Stream outputStream, Stream privateKeyStream, String passPhrase)
at Cinchoo.PGP.ChoPGPEncryptDecrypt.DecryptFile(String inputFilePath, String outputFilePath, String privateKeyFilePath, String passPhrase)
at EDI2.Data.Process_Unencrypt_File.Process(ReportAllDataViewModel rpt) in C:\TWRAProjects\EDI2\EDI2\Data\Data_Process.cs:line 544
When I step through the code, all my variables are correct. My files exist, the pgp reference is valid, my "from" file exists (I manually verified that), my "to" file doesn't exist (same), and my PEMPath and PassPhrase values are populated.
When it runs the pgp.DecryptFile line, however, it throws the "object reference" error.
I'm not sure if I've found a bug in Cinchoo.PGP, or if I am doing something wrong. Anyone have any thoughts? Has anyone else experienced this?
Thanks,
Carthax

Related

Downloading a ZIP file containing JSON in Groovy

I'm trying to 1. download a ZIP file in Groovy and 2. unzip the contents of that file. The code that exists currently is as follows:
try{
URL url = new URL(SOLIDURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Authorization","Bearer "+SOLIDpassword);
conn.setRequestProperty("Content-Length","");
conn.setRequestProperty("Content-Type","application/json");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8");
osw.write("");
osw.flush();
osw.close();
os.close();
println("token: " + SOLIDpassword);
conn.getInputStream();
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String output2;
StringBuffer response2 = new StringBuffer();
while ((output2 = bufferReader.readLine()) != null) {
response2.append(output2);
println(output2.toString());
}
println("Output:-" + output2.toString());
bufferReader.close();
// printing result from response
println("Response:-" + response2.toString());
} catch (Exception e) {
println("Error:"+e.getMessage());
println("Error:"+e.printStackTrace());
}
(SOLIDurl/SOLIDpassword are defined earlier in the code.)
When I run this on a valid URL containing a ZIP file, I get the following output:
Response:-PK�;Uv��4J -FIGS_Payload_19015_8_600_20220819_023031.json�m�\Gv]�W�W�z�E�HC� �ǒ�p�#�L{�T��!����U�f�[ݷn��u���q<����V��;O���o�������O?~��_���?��Wg��~�����/_�������������m���~|��>����o����_��柾��_��_���7���g�����������W�~��?���~���v����_���������͏����O���o��q��؊��_~�����������7?���o���o�������F��~��/y�����+���������~��;����g���?�����b�ڎ|���~���_�y�S���~��O~����p�������g����ۿ�Տ_���n�ɟ~����َ>���o����˛����v��K�ǟ�t�W|���o���IA�� o��x��������4�}=y��������͗;:���?�gJ�����������_��������ի�߇��^~����b\���=�ei�2� ��!�u[f5!��Of=!�>$�j�l&d6�dgm�� ��:���D�bB�b6:� �۱�?'����n���5W�������W�?|���W�<:��?��-����������9{|�Z��o�?��������ݫ���n>����jq������X���>��/�|���>�r�O�z��L|���y�S��֍�j}�C�of��֍o����\��Em���9���<���?��75�V�W���_?�|+���G|���=����-�����|���W�>9X��eT�c�ϟ|���GO����чx~�C�֏/W������������w����ZE����V��<>xO�*z�|����/���G/�z��g���/�|��㧟�x�����G�}�j�Go��-�O�n�7��i��^>����aC��c��y>~���Ϟo_6>��g�rP��?��-����7�N��E����b��ގ�V7u6}0v��k��u����j�6}06=�f:m�`�T����.'d.��֮&d�f�k�?ۃ�v06坓�,w��ѱS-�b�:(3;��9�N���E����?ϛk���?����ɷ��X��f�9X8���e��C�g5�O���6q����A���[���*1��v����!�o�1�|��_=���/��3�>���'�}���'���˭k_��f�?�.k,j>����Y>�-Ϟl��/�~�ᣏ^<��ӧ��ӧO����߯��G뭃�y�����ѓ����4�>����/�-��ǟ|�e�������>���>��32t�ٶ���_|������g���ѓ����}������1=;{��Ŀr����'����nU��ї/��bc1���Տ>�������=�y6�Y^>�S�~S�>��է��~�O�8��1}�婟�`�`��3l\]d�ն�u��-�2?�J|�䋧Ϸ�����'��իG�>�b����'/����ӷ��w�_���������/2T��_m ��bJz�]��/'�j�Pd}?z�d;C|���n]��&����ѧۿ���m o����������6'&��o�3�B��p�$��?����z�������t[ޯ����ᣋ�h���{���濻?�����_=_}���?�<<z�����O^�����Xn����N�%���ǟ��=(w]����-zN�|���Ϟ<�~}�?�>��_�u�r�D�� lh��|��?{��M���O�����������뛩kyx]�X��t��O:Q�g��������|;Ӽ�"�>߷�]������ӧ�����sv��Ó��g=���O��,f�D�ǫ�'�x����|���'�d�;�gX�a��~�T�˦�vjݜ�q��~����'�k�����R��g7�!W��Ww{�F'�]��;_���=]jsu�98>:��f=�F���n7�F����H����vU�Gg�Z��vV�GO�Z_^���� �Y޵��3H-�.��.��$��;�Aj���Fg��v�&�jtV���8�A��|���3|��v�Gg�Zm&&����R˫��Id0:���j��>�Ajy1QW��ӥW�z��3Hm�� ��A�~#a|��R��FU�������ӥ���#�FFO���j�۶;0<�Wx�y4���ad.�Lg��#k3V�#�3|����`��/�ls>�Fg��M�,��Q�Hj�Y�L�#���E��t����/W#�FFg��_.G�����Y-6��'S���W-��q�G�J�����;2��:2��vdv�Ǝ�;2vd��ؑ�#cGƎ�;2vd��ؑ�#cG���\�ޑY�֑���#��4vd��ؑ�#cGƎ�;2vd��ؑ�#cGƎ�;2�uG����)׍�~��:2�䕣�Z�Ԓ��<��%O-yj�SK�Z�Ԓ��<��%O-yj�SK�td�N�ȬO��\�ۑ�};2fd�Ș�1#cFƌ�32fd�Ș�1#cFƌ���9#���:�ud6'udn>�l�ݧ�#cGƎ�;2vd��ؑ�#cGƎ�;2vd��ؑy�;2��;2�ud�vdv�Ǝ�;2vd��ؑ�#cGƎ�;2vd��ؑ�#cG���,O��\�֑Y�ۑ�};2vd��ؑ�#cGƎ�;2vd��ؑ�#cGƎ����#�:�#syZGf5oGf�i��ؑ�#cGƎ�;2vd��ؑ�#cGƎ�;2vd�������촎�z֎����#cGƎ�;2vd��ؑ�#cGƎ�;2\G�-��\� z#j0�p�W���b���/�K����W�]m�������R��Մ�`t���ry6�W��=�e�������/�FO�����xƥ�����������ͬ͟͟�Oc�����?6l�����c���͟�zxy9��=}���،,�GFO_�m�'���诪Mr��\���m���T��vt��ˑ����R�ՄT��.u�XMHF���.����Aj�����Rg������R������R��ăi0z����r}Xj0:���r��`t����/p0:�/�j1������S���������sH]�|�����?�˩g�`t���3p0:��b3���.��<���Fg�Zo&XFg�:��`5=]j�������R�ˉ�j0:���rb���*�E�ۥ���S.�����b��nWWc���ч�����A���VϾ���=�U{�xq5���3����Ĵ8��Q{6�P�� �\M<��s<�7�����p����ί&&���R���d?�c�ZO��kt���|���_�\u~�\uʕ��`����Rùʹʹʹʹ���U'�U׭�檋Y��O�\��u��*�U��u���s�ⴹ�r޹j�i��V�����[���N��N9�s� f��~�s<����h��U��ӯ��:i����]��4�U��\W��r]�[ZW-'�U��is�bֹ���8W9W9W9W9W����_v�ܜ6W�����O�\�\�\�\�\����N�����y_y�i����������~Ss��g����������O�\�6x�\�ݦ<2:�����e5:C8��j�|i�Α�YL�^�yx�����R멫��3H-�n��� �8���jt�/��c��x;:C]�����8���q��9��O]A8��i����CO���9�YN�s;:�q��W�<�;:�q�����s�����F�vs1ǖ��c'��`�����W����/ۉb��~���2�ֿ6V��G~�� ����]-#�7����f�m�чW��?�3M#�3�.d����чIm�����Cw�����~�7O�ݥ�Ww=����~������j��_�~>kg�������g���|]��>k}��~���_;�5U�S�)��`�g�/O���k���ٳ�W�kg�f�x��'��Y��+|����Y��!��� :���O0۳��*�g��Z��>k�᚛S�X��`�g�/��Y��g��ڇ�N�����d'�潦�����uo̽����د�_;���͉��y�no��g��{�Z�O�<z0:C�f�&�X���A��7x�{A���}�8X�(�������]l��;\,ǂ�#���0ζ�3�FO�Zm�'~����֛ V����.�~�5z��6/9!5}��iʓ���Ŕ�s���=�M��j5�D<��p�oݝ�,t��l���{o��A��b|�P{�Z��f������N�����������?���]�9>�� ~���?i|��O��'��I����w��=<-~������A������������F~#��)���[��^ <>x�R���5A����?����F�y���ٜ�*��O0[�`������[c~?>x��w�]�[ŏ޷-i'ӣ[n����؂�'~��7���2Go����`�����u�����is�z޹c�i�;����c��掋w�n^��ij�����8��|6�{3��'�7�������O�~ψ�����VS������]=�[�{�)O�`[^Mm�F�����n��~pb|p�7������a#�3tL��p����w��N���>uq1�l<}��v ��gX����<�Ww��>��?��R��ǖJ��3|w���^�{j�O?^�9�x��'��,�������-���-��{�!�>z}��ч���_lWGg����϶����n�d����?���ʦ�+���Ѡ����1���؏rdt���GF.u��g���.�Z��GF�eN�Z��j3v����<E�������o�Tԛ՝�������A�{�wۜ���mD��jk0x�͹�l|�a��u/�:>x�_�~�E2<��<;��<�/��#3��:ۜX<���1t�˱e����%���ΰY/���/���.�?FO/�{M������_i|#��K��oMܜvk��'�m���^���w��_���}��2G[�A>lyy��4�ߘ�������c�{����c�/vq�&��H���N�7摼���o���9�r8�Z����]w`��ݧq���V��7�=}���ͻ����nn�^���džƨ����/�:Qd����(:�ǰ�ZN���34iF�FFO������`t�6�����><_>(� ���]�Q���ӿ����T|�FO^��v��t�srH�v�d��}H�����/��T�x0z_�}o�}�}`��ω[����b80:��1y��&I���1���>�j0:���ڏ���WM�\�)uv9�s1=�g��d}�_u�ζ�!=��X��ٱ����ru�Z�NY��/{�Kj����s������Vw�>ョO۹tB���Q��������,oj#�F�fD�������i<�,��'���_�,������`�r��ƃ����#�9-^'��C��s�Я?�/�C/{��ېz����f����7FOﯜ_^�H���0y�|�����q�t�m}N��{"����x߽����Rg�GsI��,��^]�3H�_��Fg��,G"s#�3H��(wdt���/�F����9�헧\�z� f��~�]�|��B��U�3�(�*�����Ŀ��/��Ѽ�O��?췊�����/z7�>��6���h�-����4��߿�zZ��f�m�w�ir��I�;�tr�����%�i��[�>8-#�w�-���#湵�wRO� �Y8�N����*�� �+��,on�}pz{a��f��w� ��n��pz�I�p�іS� ���h�)���n��p}č��N���іS����Ӎ���u���}�-�����y���c��F�N���#�7��~'����h�)�堏�іS� ��n��pz{.��t�-�c��`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���p}����> 0�\��S� ���z:�F�m=%����ҖS��J[N',oT�r8ay�ҖSꗗ��NT���p��y�|���J�zJ|9�#�5���d�軘�7*m�{�8]�y�ҖSZ?���NT����p�|Di�)�D����N�:���p��F�-���#�����wE�疶��p}�y�F=Q}�Ҷ��G�?���N���=��s�'�����؇���F=��'s�N��0����s�9',�\���d�K�J[N '��[n���\s�N��3�����[n�r�G�[np�'s�9',�\���c�.��ri�)�D��J[N '�_^�rJ8Q>���p��F�-����-m9���ri�)��s��:w�]Q���m=%�#an�QOTߨ�����Q�O�-��8?�[Ο{Xn�����؇5�ܨ'p�dn�� ���#an9��K[��s��Qi�)��=sˍ���kn�� �{����\s�_�s�N��dn9��K[_~���[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-�s����'p?��r� �-��>"��O��z�r˥m=�8�r�m9%����#[N '�_>ЖS� �m9%����#[N 'h�;ЖS���-��p}���l�{�]A��m�)��sˍz��Fm�)�{���#[N 'p~2��?����#�zJ8�}Xsˍz�O��#an�� ��sNTny���HֹP�h�-�����-7�F�~���'��[np�s�-7|9�#�-78����[h�ˏqZ���ҖSZ?���NT����p�|Di�)�D�J[N 'j�[�r8a��ҖS� ���u��sK�zJ8�>��r����Qi[O�ߣ��J[N 'p~2��?���ri[O '�kn�QO����r���Ö�Ͻ���-m9��<li�)�D��ҖS�',m9%��~Di����5�>�ҖS� {�Zi�)�D����p�ާV�rJ8Q��(m9%�������N���^����w���9'�}j��s/Y�R�A)m9%�#�g6�a�S+m�)��=���z�ާV��S��A���8?y/A� {�Zi��;�i�����-���~*m9%��~yi�)�D��ҖS� :O8ЖSZ疶�N���h�)���%׹����-m�)���%h��7*m�)�{��Si�)��O����[.m�)��a�-7�%��1��ޛc6��KP��O'�^�ҖS� ���<l�D��r�N��3���_n���Aa�� ����朰�t�����%���ҖSZ?���N����-���#J[N '���-����-m9��<�#[N '�G��׹����-m�)���z��F�m=%~��*m9%����<l�����U��S� �Ú�m��~��'�G�[np}����[.m}D�Υ�F�-�����-7�F�~���'��[np�s�-7|9�#�-78����[.m}�1N+0�\�rJ8Q�ҖSꗗ��N��(m9%���Qi�)�D�sK[N',�\�rJ8�>��r���}W�~ni[O '�G�[n��7*m�)�{��Si�)��O����[.m�)��a�-7� \?�[np}���'�G�[�9a����G$�\*oT�rJ8�~��r�o��[np����'p?��r×�>��r�8?�[�9a���֗�s˥-���~*m9%��~yi�)�D�����7���}WTި������-m9���ri�)��s�����K�zJ8�>��r����Qi[O�ߣ��J[N 'p~2��?���ri[O '�kn�QO����r��#�-78�>��r�_���-7ֹTި��{ '��[n���kn�� �{����\s�_�s�N��dn9��K[_~��98?���N��T�rJ8Q�Si�)���O�-�c�.�s5�-����+m9%����ҖS��-����-m9%��uni�)����)m9%�#Ṛ������Qi[O '�Gx��QOTߨ�����Q��ҖS� ��<W�?��s5�m=%��>��j���<W�����48�>�s59'�\Mi�#�u.�7*m9%�#�繚F����\M���<W����[n�r�G�[np�'s�9',�\���c���ɜQVG�`��������-m9%����ҖS�y�-���+m9%�0�g�<~��%�+/m�)��s�z���K�zJ8�>�\y����^i[O�ߣ�K[N 'p~2W�?��\yi[O '�k��QO���\y��#̕78�>�\yc?\?�+o�s�<Xi��N��3Wި'p?�\�w9'��+op�s��地\yi�#N��d�<�',W^���NXh��rXIX\٬rLj��R� A��|rL�L� A�X�N Q�d��1!�)�CN A��&�cB�S0{��?��c/m�7� Q�I�36c�:���SB�z�\qJ�r&�SB�S0K�z9j=d�8]�B���1!�˙N Q{�f�SB��3-���X� �n�r&�SB�<d68$D�MG��� ��g*���m�>���P[N 'dbO[N '���i�)�����pB�{�r81��=m9%�#a�;_?1�=m�)���ލzB�y{��S����=m9%�����w��c�{��S� �Úo��~2���S�N��0����O&��\$�����K8�~ϴx����\3�N��39޷�������N�{̅��w�ra{��S��\X������q��Wa.�ʼn��s����p}���F=Q�e4�{�>�\X���sa=�G�G�\X�8?��9Q���� '�k.�QO���\X��#̅58�>�\X���'sa�u.��`sa����̅58������9�~�\X���뽢_�omp�'��9Q׌����t�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[׹����-m�)��sˍz��F�m=%~��*m9%�����r���r˥m=%��>���F=��'s�N��0��C��-m秄u_Xi�)�D�[�r8a�Ö��N����-��u?li�)�D�[�rJ8�~�s���9��m=%���h�#���s9'����Ͻc��s{�rJ8Q�'����o�+�_�9�'�Gx�ljz��z��u��Z��s{�����#<Ш'j?�s���#<��D��<��{����z����s9'�����<��a=Ш'p�dn�� ���#an���������:����~/��=sˍz�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏq�s˥-���~*m9%��~yi�)�D��ҖS����N�:���p�r˥-���#�-����wE�疶��p}���F=Q}�Ҷ��G�?���N��dn9�a��Ҷ��q��G��-����������`��Ӷ�N�~���� ���:J�s���K��]� �g����~Dl������xߨ�S���>yi[O '�>l�����~���'�G���������'�G�����/�~{×��q��� ���oo�����78�}X� �8-θ�����N��4ЖS���j�-��u��#[N '�G��p�� �rJ8�~���r_N���S��A��S�u.8?�W�9Qy偶Ͻc�\v�-���~*m9%���#[N '�G���NP�e�-����-m9��<�#[N '�G��׹����-m�)���z��F�m=%~��*m9%����<l�ܣ�m�)��a��6� \?���'�G�[np}����[.m}D�Υ�F�-�����-7�F�~���'��[np�s�-7|9�#�-78����[.m}�1NK0�\�rJ8Q�ҖSꗗ��N��(m9%���Qi�)�D�sK[N',�\�rJ8�>��r���}W�~ni[O '�G�[n��7*m�)�{��Si�)��O����[.m�)��a�-7� \?�[np}���'�G�[�9a����G$�\*oT�rJ8�~���wy���5����=s�N�~����[.m}D� ���-����K�z:�i�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[׹����-m�)��sˍz��F�m=%~��*m9%�����r���r˥m=%��>���F=��'s�N��0����s�9',�\���d�K�J[N '��[n���\s�N��3�����[n�r�G�[np�'s�9',�\���c��`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���t�����h�)������NP�|�-����h�)�D�#�r8Q�����N��3��k\WP�h�m=%�#�g>�QOP�h�m=%���#�z��m�)�D�#�r:���G��p��O�-���//m9%�(Q�rJ8A�����N�:���p��m9%�#�na?b�]Q���m=%�#�n�z��F�m=%~��*m9%����{���u��#�zJ8�}Xsˍz�O��#an�� ��sNXn����:�����N��3��������#�gn�� ��5���堏X�#rN��dn9��K[_~���[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏpZ���.m9%���Q���N���K[N '�}ԥ-���>�ҖSzui�)�������p}���l�{�]A��m�)��sˍz��Fm�)�{���#[N 'p~2��?����#�zJ8�}Xsˍz�O�CN.;���p��m9��<�#[N '�G���N�>ai�)�D�#J[N 'j�����r�G��m�����<lΉ���}��t�aK[N 'j�T�rJ8Q}�ҖS��-���c)m9%��uni�)���aK[N '�G��׹����-m�)���z��F�m=%~��*m9%����<l��[�~�����UO�-����J[N '��N��+m9%���I���=��Si[O 'j߽��p�O��.�>��648�>�sj9'�Zi;?%�\*_^�rJ8�~�sj�s;�V��S� �{�Sk���+m�)�堏�Zc��O�S�9a��J���1N�;Q�~yi�)����9�����~yi[O '����D�J�zJ8���xN-�'�Zi[O '�G�[n�x塀�'�G�[np�72�����=�������r� �-���<��a�-7� \?�[np}������VO{��O '�����pB|����N�9�=m9��s{�rJ8!�=m9%��|Ğ��N���#��=�{�m=%�����k�x����'�>K�N�}��#rNؽ���8a����N�߳�?��{ J�zJ8�~�~D����y/A×�>�{ ����{ rNؽ���8Ɖ:��yϬ�.�{#J�:J8Q��ҖS��(m9%�(�W�rJ8a�{#ޤ~|�]Q}�Ҷ�Nؽ�-���#�7"�a�F����p}���F=Q}�Ҷ��G����N����s˕������#ֹ{�r81��{�rJ8����o��`������c��Zr?#���;���m%����-��u�Qi�)��M�g��7��'�Ӷ�NT���pb������A� �����߾�m=%�#�~{����^i[O'f�}O[N 'p~r�=�1��{��S� ��z�[�������58�>�{�y0�Ͻ'�Ͻ'0��s�� �+{e�'xN��+�i�{�J�un� �{�_٨'���lp���W68��Fx����A�y�'p~�<M����m�a�|���F��:�YڮsN�~���F=��5\�68����s����s���s����un� �7�����8�� H�aK[N 'j�T�r����iJ[N�8Q{O����3.��Ӕ�u�p��+�-���W.m9%>�:OS�rJ8Q}�ҖS�����p���-��v�Qi�)���5j�s��^i[O '�=B�-�����G��GX��S�#��ri�)��s�w/�E�+*Q��Sҏ��-��8?y�^�����+m�)���>�}�����/��������ϭQO`��S�G��޻�����w�� \?yA� �����{I�:GX�rJ8�����r0g�}N���>�'0g����/}��48���䜰�J[_~���wj����p��O�-���//m9%�(Q�rJ� ��=J[N�9�=�-���c93��#��ޞ���p�c1oԨ'0gi��� ��X�#a��q�\?�ci�a��>��~/��=s,�z��0����=s,N�=�X���X����K� �_����G8a���` + ����JLj��Z� A���JL:�1!h��)!�Jo�� QN���RB��7ń(���7)!��c�8�r�֑y�5�4 Q1c3�1!�sj�8%D�����(�`�8%D9�ĩ���C���+�1?�������jf8%Dy9��)!j�՜p�)�`B8%D�Cf�CBT0�Tpv!A�����!7གྷ�m����]e�{NK[N '��ҖS���7�i�)���i�1���z�Ri[O '�G�yl�uo{i[O�ߣ��R�rJ8��)�����/��������z�O�"�#a:�� �f$sN�{�K[��s������N��35����S2;���=�N�~�9ʆ/}�i�'p~2S�s��\���c�v�����-���~*m9%��~yi�)�D��ҖS����N�:���p�r˥-���#�-����wE�疶��p}���F=Q}�Ҷ�>���T�rJ8�������K�zJ8�}Xsˍz�O��#an�� ��sNXn���',�\�rJ8�~��r�o��[np����'p?��r×�>��r�8?�[�9a���֗�t�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[n�����m=%��z*m9%�(_^�rJ8Q����p�|yi�)����ҖS� ���ܗc� K�zJ8�>��z��sK�zJ��+m9%������s;OX��S� ��z�0��+�<ai[O '�G���N��(m9%�j�T�rJ�ݩs�-�����<a����m=%�#��y�F=�9K�6ֹ���<a�8?y�0焝',m}�N�3�<�#[N 'h�4ЖS� ���p�|�#[N '(o4ЖS� Z���p�r�m9%�#an9[�^W�~�#�zJ8�>��r�����#�zJ���4ЖS� ���-��=*�<ж�N`��r�������'�G�[np}����[h�#�u.�7h�)��=sˍ���kn�� �{����\s�_�s�N��dn9�D����c�`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���p}���p�������Ҷ�N��0�ܨ'�oT��S�����ҖS� ���-��=,�\��S� �Ú[n��~2�ܸ�����S��>j�ON�}a��rN��jJ[��p�'�O��,����~jp�/w�����y��v~J8Q��ҖS� ;OX�r8a� K[N '�[�rJ8Q9�ҖS� �{�'�}9v�����ė�>��u.8?y�0焝',m�{�8�ޱN�XJ[N 'j�T�rJ8Q9�ҖS��-��u���p�ֹ�-��v����p}�� �u��sK�zJ8�>�<l����Qi[O�ߣ��J[N 'p~2�?���m=%��>�y�F=��'�68�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏq�z�gut��K�:J8Q��ҖS��(m9%�(�W�rJ8Qy�ҖS�C���NX����p}���|�ĭq͕��p}���'��W��O�ߣ�K[N 'p~2W�?��\yi[O '�k��QO���\�w9'�G�+op}����+/m}D�Υ�`�-����̕��=,W^��S� �{�����+o�r�G�+op�'s�!��;������ '�Q�r8a��ҖS� �G���NT?���p��^i�)��=��/���m=%���#�\p~��s�ι��Ͻc���9�ҖSZ?���NT~���p�|Di�)�D�*m9%��uni�)����.m9%�#�9�p�������Ҷ�N���u����Qi[O�ߣ��J[N 'p~�u����Q����p����n��~�u��#�-78�>��r� �-��>"Y�Ry�ҖS� �{�}#p?��r����-78������������r� �-������[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9�t�XJ[N�8Q�=��y����u�p�ַ�-����-m9%���Qi�)�ysFo����3*m�)���J[N�#a�(�a9�Ҷ�N���Ѩ'��W��S� ����N��d�(�a9�Ҷ�N`֜Q�����9�'�G�3jp}�9�F\?�3j�s��Qi��N���~�F=���ޏ���=�Glp�s����A���N�����9',W^���c���ɜQVG�`��������-m9%����ҖS�y�-���+m9%�0�g�<��_���Ҷ�N��0Wި'j�������#̕7��땶���=j���p�'s��s˕����p�������̕78�>�\y��#̕7�s������:�ʃ��~/��=s�z�s͕78�~�\y���k~���Aa��� ��̕眰\yi�ˏp�B�&��J���f�cBP�ܔrL��cBP��drLZ�z�uJ�$�F� QN�r���{Uݧhp��#�m!��W�}�F=Q��m=��}�ҖS� ��ܧȟ{�>Ei[O�8���UJ[N 'j�T�rJ8Q��ҖS��-��u.���p�ֹ�-��v�Ji�)���5�u�Ν����p}���4�������=j����p�'�Wɟ{��*�m=%��>��>l^O����U������'��������RB��v��d���(>�5��(��C�<�"� Q^�tJ�:�i�?%Dy9�)!꼦Y��mSN�J�����������Wt��.�6������qB���}qIE���¾��"R�nѾ��"R���TD ��K*"����%��b��K*"E:��d݈�_�r���"R���,L���>쾸5y?���y��k���"�)O�4H1Gb��}�E���Y�NM��)3�R�����R������G��|�pg勤����~)����������)��y�C����L#zj�:��TJ�zS��Q)!�L��P�)v�����5�M����~S�/�K���Ha��TB�K����"R�~S�K*!�%XJ\R)l��%��,%.���(L�4�S\��ĭ�����),��`)qk*"Ez?,���,%nME�H�g��SSX��ĭ�ȥ����-;�)r���)��}q�~GIa�$��y�b�[K)l�[⒊Ha�%.����J\R),=V⒊Ha���TB��Q��%�"�7*6�S܍�%nME�HGa�SS\'�<z~O��~a;�%��9O�Go��G/qk*"Evhͣwj�\O�G�"�y�)�Q�G�tr=��|g勥�J\��"��y�NM�{���;�H�g�C���5��q餣0��!E�S����<z��ҏ���R���ZZ��y􁸵��V�qIE��ݎ���"R���K*"E��⒊HQ�����RX} .���(̣7�SX} nME�HGa�SST�o nMEޏ�A�K*"E�S��O?,�>��"Rd��<z�����y�)�Q�G�"�y�Ξ/��2��Y�r���I��/��~��;��=_��R��3��!E���G�t�Q�GOS���#����Ha'J\R )��#�K�()����p~Z�7ٗ�����ʗ��"R�=I%.��7Gyr �#s�ea�Ζ�5��n5(qI%����K\R)�Qxr�1Oq7ٗ�5�"�':5���Jܚ��v�X�K*"E�S�h<����Kܚ�H�ZOtj�\Oyr�C�t��"�':�tr=�Ɂ��K����/"Ez?Otj�����#���<9�!E��zr���IGa�C���̣7Hqy�ץ%��'ܕk�̣�����V�%.����Q⒊Ha���%�ABK����"RXo��%�����%.���(̣7�S\�ĭ���(̣wj����5y?l��%�"�);����G/qk*"Evhͣwj�\O�G�"�y�)�Q�G�����)�蝕/�+q�_D��~��;5E���G�"��y�)r��<zǥ���<z�9O�Go����%�K?J��5=���G/qk)"��xK\R)l���%��<_�K���r��Cԝ7�݆��5u���̡�����#�Z�HaoV.qIE�(w>�TD�|%.�����K*"����%����E�w�]Y���h������H���Ӣ����}%nMEޏ���%�"�)O�6�~�iс�5�";�������h��(<-�!E:O�v�|����E;+_�l�#\��"���E;5E��zZ�C��~��"�|=-�q餣�h�9O�Go����%�K?Js�fg�ZZ�y���"R\=�G��c�/��(qk*"�y��TDK����"RXo��%�����%.���(̣7��G/qk*"E:�蝚��}%nME��A,qIE��y�<z�����Kܚ�H�Z�蝚"�S��;�HGa�C�t�ѿk�O��)��R\���~)���x����k�C��~��;��=_��R\��u)r�2�ި).�^���QRX��DfXK+2�^��RD[񖸤"Rܓ�<z~r`�ea��ĭ���+qIE���D�K*!���K\R)�Q��j8.�^��TD�t��Ú�~�'�l�_�����(�7�闐¼�#\R)�]�z����~qk*"E:�_����ށ�5y?*=6�TD���<��x�ag��TD�ڝ�K*"E��<��y���³�R���,b�CK��<��Y�R'�:����<�ة)*�7��"R���,b���=_�"v\:�(<��!E�S�El���"�uGIas�����.���qk)"��xK\R)l���%��<_�K*"���J\R)���G�O\�y���"R��0�ީ)lW�ĭ�c��zj .��v��T�nr=5��"R�Il�S͚��vq=�#����z�I�t��:���]\O5k�t�����r.q]z����C���"R�<����ӏ{�h�[S)�C���NM��)��vH����R���|o�CK��<��Y�bo+q�_D��~����������=��<U�>�R\߯�%�"�=pf�/�q}���"R�[���uj�|G�}�)�Q���"�}�Λ,���}��������/"Ez?�~��"��k߯C��~���!E���{�:.�t���!E�S��� ���7ץ%�Փ�{�ZZ���ĭ����-qIE��ݎ�TD�����"?5����S�%nME���D�K*!��CQ⒊H���{(�wE�[S)�QxE���~_�[S���vK\R)r�2��x�qy���"Rd��<z�����y�)�Q�G�"�y�N/�\O�G�|��X���"R��3�ީ)r��lR���̣wH�{���;.�t��;��y�<z��G/q]�QR��p_*���G/qk)"��xK\R)l���%��<_�K*"���J\R)�7Q�JHqy��TD�t���).�^��TD�t��;5���Jܚ����3�����}Y�<e�A�ˣ��O��١5�ީ)r=e�C�t��;�"�`�o�֡-qEB�K����"R���L�5�~\z�ĭ�c��`������H�y����5��3�̃���]h�(gD-l�Ō�Б�����Ō�\SF9#�3�/�Q� �E��������bF�|d�(e�E��匰�� ���>2;3�<�������2�u��ț+�5,��ʜ�뼭2f���zOe��uf�cF�>����{c��\q���L���8�Y���Q.�݆��t�{�{9��I%�I��y2��C���)�BtH�'��EtH�7Rڑ�t�Qؗ�"�)�R�y�ץ%��'�34��s�m%n-E��o�K*"���V⒊Ha���%���.qIE���D�K*!Ž-��%�"�'��)p��9�<?���HG�i�)��W��S���vK\R)r��|{��ǽ-�ĭ��١��{�����'�;�HG��)�Q�G�����)�蝕/�+q�_D��~��;5E���G�"��y�)r��<zǥ���<z�9O�Go����%�K?J��5=���G/qk)"��xK\R)l���%��<_�K*"Ź ��y�o�ea����R\��%�"�y��ӏˣ��5�"�=�NMa����"�� ���"R�<e������%nME���y�NM��)��R��0��!E:��-��2��Y�b���E�H�g�SS䞯y�)���G��A���5�� ���K\G�"�)�荚���%nM%��Qf��Z�$���m����PK�;Uv��4J -FIGS_Payload_19015_8_600_20220819_023031.jsonPK[UJ
I can tell from reading the response that it's reading in the file somewhat-correctly, hence the FIGS_Payload...json string in the content, but what I don't understand is how to convert that response (which looks like base64 to me) into a usable/human-readable string. I've tried a number of solutions found in other answers - for example, putting this following function in the code:
def unzip(String compressed){
def inflaterStream = new GZIPInputStream(new ByteArrayInputStream(compressed.decodeBase64()))
def uncompressedStr = inflaterStream.getText('UTF-8')
return uncompressedStr
}
and then calling it via unzip(theLargeResponse). When I try that, I get Error:bad character in base64 value error - but I can't determine where the bad character is coming in or how to mitigate it. I've also tried the answer suggested here:
https://stackoverflow.com/a/45854656/5266746
But that gives me compilation errors when I put the string above in the PUT BASE 64ENCODED GZIPPED STRING HERE spot. I'm wondering if I'm even going about this the right way. Does anyone see anything that might stick out or make this make a bit more sense to me?
Thanks!
zip is not gzip. gzip is not zip.
You are reading in a zip file, indicated by the first two bytes "PK". You are then trying to decode it as a gzip file, which it isn't. You need save the thing and unzip it with unzip.

How to test for Empty array value in Unirest json Response

I have the following code snipet used in Jira Script Runner cloud
String _userId
def result = get(graph_base_user_url + "?")
.header("Authorization","Bearer " + AuthToken )
.queryString("\$filter","mail eq '$userEmail'")
.asJson()
if (result.getStatus().toString() =="200")
{
**if (result.getBody().value){ // <<<<< is Value is not empty ???
_userId=result.getBody().value[0].id
}**
else
_userId="-1" // user does not exist
}
// user ID not found : error 404
if (result.getStatus().toString()=="404")
_userId="User not found"
This code is returning in the result.getBody() the following output
{"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users","value":[]}
What I am trying to achieve is to test if the value array of the response is empty or not and if not empty I need to fetch the first element item as value[0].Id, but I could not get it correctly
How can I define my code in BOLD above to perform my correct test ?
Error I get from my code is : " Value is not a property of JsonNode object
Thanks for help
regards
from official doc http://kong.github.io/unirest-java/#responses
String result = Unirest.get("http://some.json.com")
.asJson()
.getBody()
.getObject()
.getJSONObject("car")
.getJSONArray("wheels")
.get(0)
so, something like this should work for you:
def a = result.getBody().getObject().getJSONArray("value")
if(a.length()>0) _userId = a.get(0).get("id")

How can i simplify checking if a value exist in Json doc

Here is my scenario, i am parsing via javascript a webpage and then post the result to an restApi to store the json in a db. The code works fine as long as all fields i defined in my script are send. Problem is over time they website might change names for fields and that would cause my code to crash.
Originally i used code like this
const mySchool = new mls.School();
mySchool.highSchoolDistrict = data["HIGH SCHOOL DISTRICT"].trim();
mySchool.elementary = data.ELEMENTARY.trim();
mySchool.elementaryOther = data["ELEMENTARY OTHER"].trim();
mySchool.middleJrHigh = data["MIDDLE/JR HIGH"].trim();
mySchool.middleJrHighOther = data["MIDDLE/JR HIGH OTHER"].trim();
mySchool.highSchool = data["HIGH SCHOOL"].trim();
mySchool.highSchoolOther = data["HIGH SCHOOL OTHER"].trim();
newListing.school = mySchool;
but when the element does not exist it complains about that it can not use trim of undefined. So to fix this i came up with this
if (data["PATIO/PORCH"]) {
newExterior.patioPorch = data["PATIO/PORCH"].trim();
}
this works but i am wondering if there is a more global approach then to go and check each field if it is defined ?
You could leverage a sort of helper function to check first if the item is undefined, and if not, return a trim()-ed version of the string.
var data = Array();
data["HIGH SCHOOL DISTRICT"] = " 123 ";
function trimString(inputStr) {
return (inputStr != undefined && typeof inputStr == "string") ? inputStr.trim() : undefined;
}
console.log(trimString(data["HIGH SCHOOL DISTRICT"]));
console.log(trimString(data["ELEMENTARY OTHER"]));

Option issue using chrome.storage.sync.get for first time user

chrome.storage.sync.get('savedItem', function (result) {
//some if else condition for result.savedItem here
myResult = result.savedItem;
});
$('p').val(myResult);
With above code, I got an undefined, because there is no setting been saved in my options page for the first time user. I tried to set a default value to myResult like if(result.savedItem == undefined) myResult = ''; but I still got undefined. Why?
2 issues at the same time.
1) You can set default for values not in the storage by providing a dictionary:
chrome.storage.sync.get({'savedItem' : 'myDefault'}, function (result) {
// result.savedItem is the saved value or 'myDefault'
});
2) The biggest issue is not understanding how asynchronous code works.
$('p').val(myResult); gets executed before myResult is assigned, because chrome.storage.sync.get returns immediately, with the function(result){...} being called later.
There have been tons of questions about that, take a look at, say, this and this.
Use chrome storage change - Refer this link
Example code:
chrome.storage.onChanged.addListener(function(changes, namespace) {
for (var key in changes) {
var storageChange = changes[key];
console.log('Storage key "%s" in namespace "%s" changed. ' + 'Old value was "%s", new value is "%s".', key, namespace, storageChange.oldValue, storageChange.newValue);
}
});

How to retrieve Oracle Clob more than 4000 characters ODP.NET

I am trying to retrieve CLOB data via ODP.NET.
My problem is that reader.GetValue(i).ToString() can return only up to 4000 characters and the rest of the data is truncated.
If I use reader.GetOracleClob(1).Value I got "Specified cast is not valid" error.
Any idea what I have missed? I am using ODP.NET 4.0
Below is my code.
using (OracleConnection oConn = new OracleConnection())
{
oConn.ConnectionString = pConnstr;
oConn.Open();
using (OracleCommand oCmd = new OracleCommand("select varchar_column, clob_column from test", oConn))
{
oCmd.InitialLOBFetchSize = -1;
string key, value, value1;
var rd = oCmd.ExecuteReader();
while (rd.Read())
{
if (rd.IsDBNull(1)) { value = ""; }
else
{
key = rd.GetValue(0).ToString();
value = rd.GetValue(1).ToString(); // unable to get more than 4000.
value1 = rd.GetOracleClob(1).Value; // Specified cast is not valid.
}
}
}
}
I found in Oracle Doc that When the InitialLOBFetchSize property is set to a nonzero value, the GetOracleBlob, GetOracleClob, GetOracleBlobForUpdate, and GetOracleClobForUpdate typed accessor methods are disabled. That may help explain why I got "Specified cast is not valid" error.
However, I still cannot get data beyond 4000 limit.
I have tried different combinations documented here
http://docs.oracle.com/cd/E11882_01/win.112/e18754/featData.htm#autoId6
But no luck.
Actually the code works correctly and gets the data it supposed to get. I just didn't realize that my data is incomplete and appeared to be a retrieval problem at the first look. Sorry.
The following is the good code.
using (OracleConnection oConn = new OracleConnection())
{
oConn.ConnectionString = pConnstr;
oConn.Open();
using (OracleCommand oCmd = new OracleCommand("select varchar_column, clob_column from test", oConn))
{
oCmd.InitialLOBFetchSize = -1;
string key, value;
var rd = oCmd.ExecuteReader();
while (rd.Read())
{
if (rd.IsDBNull(1)) { value = ""; }
else
{
key = rd.GetValue(0).ToString();
value = rd.GetValue(1).ToString();
}
}
}
}
The above solution did not work for me. It turns out my data was not CLOB or BLOB but LONG Data! So the fix is just to set:
oCmd.InitialLONGFetchSize= -1;
Instead of
oCmd.InitialLOBFetchSize = -1;
Please leave a comment if this method worked for you also.

Resources