nguyenbahuong / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

small bug in DefaultQueueManager.java #497

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hi guys,

I encounter the following situation using QUEUE_DIRECTORY           

in situations where the gateway name contains "/" then messages cannot be saved 
in the queue directory 

I put here "/" because I am using linux as deployment OS, but I assume it's 
similar for windows with "\"

This situation appeared when I decided to use gatewayId the portId.getName() 
which to me came naturally 

    SerialModemGateway gateway = new SerialModemGateway("Modem." + portId.getName(), portId.getName() , 9600, "", "");

In my case the port name was /dev/ttyUSB0 and /dev/ttyUSB1

the Error in the logs was 
[main] ERROR org.smslib.queues.DefaultQueueManager  - Queue directory could be 
created for gateway Modem./dev/ttyUSB0. Could not create directory: 
/qdir/queue/pending/Modem./dev/ttyUSB0

The solution to this problem was to change the folder creation line in 
DefaultQueueManager.java for method     
private boolean storePendingMessage(OutboundMessage message)

the line to be updated is 
        File gatewayDir = new File(this.pendingMessageDir, message.getGatewayId().replace("/"),"."));

in which I replace the path separator "/" with "."

I don't mention line number since I made also some other changes in the file 
and line numbers will not correspond

Regards,
MaxX

Original issue reported on code.google.com by marius.e...@gmail.com on 29 Jul 2012 at 3:56

GoogleCodeExporter commented 9 years ago

Original comment by T.Delenikas on 31 Jul 2012 at 5:16

GoogleCodeExporter commented 9 years ago
r2387

Original comment by admin@smslib.org on 3 Mar 2013 at 4:43

GoogleCodeExporter commented 9 years ago

Original comment by admin@smslib.org on 3 Mar 2013 at 4:44

GoogleCodeExporter commented 9 years ago

Original comment by admin@smslib.org on 6 Mar 2013 at 9:27