baljeetverma / android-notifier

Automatically exported from code.google.com/p/android-notifier
0 stars 0 forks source link

EOF in Description #328

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using remote notifier desktop 5.1 on a Gentoo machine, I'm seeing the external 
command fail, due to an EOF in the description before the closing quote.

I haven't tracked down where this EOF is coming from, but the simple solution 
would be to remove any non-printable characters from the description.  This 
seems like a good idea regardless of if you can reproduce my issue, as it may 
be possible to have non-printable characters introduced by a number of the 
systems in play here.

I'm using wifi UDP to broadcast, and I see the issue with the {description} in 
using an external command only.

Original issue reported on code.google.com by guardian...@gmail.com on 30 Dec 2010 at 4:54

GoogleCodeExporter commented 9 years ago
is it possible to have the source for the desktop app? someone else could then 
contribute this fix to your project (ie: me)

Original comment by mande...@gmail.com on 14 Aug 2011 at 12:14

GoogleCodeExporter commented 9 years ago
Same problem here. Using AND 0.5.1 on Windows 7 - 64-bit and Wi-Fi. Phone is 
Samsung Galaxy S2. I attached a screenshot from log file 
(android-notifier-desktop.log) using notepad++ so you can see the NUL-character 
after the description-part.

I'm using this command in AND: echo {description} > /temp/AND_data.txt

Original comment by JP.Kinnu...@gmail.com on 26 Aug 2011 at 1:12

Attachments:

GoogleCodeExporter commented 9 years ago
Same for me (using the Windows client). When the _description_ field is used in 
a notification action (command), the command doesn't work.

e.g.
echo %date% %time% : [{type}] {title} {description} >> mylog.txt; notepad 
mylog.txt

The first command (echoing to mylog.txt) doesn't work. The second command 
(opening mylog.txt in notepad) works but indeed nothing new is logged.

The AND log shows:

2013-01-17 08:59:51,621 INFO [OperatingSystemProcessManagerImpl] - Command 
[echo %date% %time% : [PING] "Phone sent a ping" "Test notificatieNUL" >> 
mylog.txt
17/01/2013  8:59:51.62 : [PING] "Phone sent a ping" Test notificatie

2013-01-17 08:59:51,621 INFO [OperatingSystemProcessManagerImpl] - Command 
[echo %date% %time% : [PING] "Phone sent a ping" "Test notificatieNUL" >> 
logje.txt] exited with code [0]

Hoping for a solution .... !

Original comment by edwin.gi...@gmail.com on 17 Jan 2013 at 8:30

GoogleCodeExporter commented 9 years ago
I am having the exact same issue in Windows 7 x64 with the 64 bit client. 
{description} always appends a null to the command line which causes it to 
fail. 

Could you try using either:

.replace((char)0, "");

or

.replaceAll("\\u00", "");

right before you parse out the {description} tag for the command line or even 
right when you receive the value in the first place. (I would do it to all the 
tags. It could not hurt to be safe.)

This will not fix why it is has a NULL, but should mask the problem enough that 
the command line parameter will work.

Also, thanks for making such a great utility/app.

Original comment by But...@gmail.com on 20 Dec 2014 at 10:18

GoogleCodeExporter commented 9 years ago
Also maybe:

.replace("\0","");

(I just checked the (char)0 one can work, but may cause a compile error.)

Original comment by But...@gmail.com on 21 Dec 2014 at 2:09

GoogleCodeExporter commented 9 years ago
Sorry to keep posting, but this problem really cripples a great app and I think 
I have a working solution that should be easy for you to add. I have tested it 
and it seems to work.

If you modify:

notification.getDescription(privateMode)

to:

notification.getDescription(privateMode).replace("\0", "")

that seems to fix the Null issue in the command line. If you need more details, 
just email me back. I would end the same replace to each get statement to be 
safe. Thanks for reading.

Original comment by But...@gmail.com on 21 Dec 2014 at 7:46