[ale] found a bug in an open source API: It 'Broke' under linux.

Joshua jrtroberts at gmail.com
Sat Feb 12 15:51:44 EST 2011


Thanks Tim,

I had thought about that and the ambiguity of having the variable and 
key name being used all over the code, but after getting it to work I 
forgot about it.  It was still nagging at the back of my skull and your 
message brought forward.  Hopefully I can keep that from happening to 
often, lazy coding practices and bad habits and such.



Tim Watts wrote:
> Perhaps factor out the calls to pref.get() and make "cacheFileName" a
> private static final String.
>
> http://pastebin.com/sdhWiuAm
>
>
> On Sat, 2011-02-12 at 14:53 -0500, Joshua wrote:
>   
>> I am working with an API for currency conversion from 
>> http://www.thomasknierim.com/index.php?s=currencyconverter&Submit=Search 
>> <http://www.thomasknierim.com/index.php?s=currencyconverter&Submit=Search>
>>
>> It is all written is Java.
>>
>> The initCacheFile()  method worked fine under windows, but it broke 
>> under linux. 
>>
>> The original code grabbed the path to the java temp directory and then 
>> concatenated  a file name onto the end of it.   I do not know what it 
>> produces under windows, but my suspicion is that windows is something 
>> like </driveletter:\pathtotemp\/>  with the trailing '\' included.
>>
>> Under linux the call to return the temp directory returns '/tmp' and 
>> then the concatenating of '/filename/'  creates a file named 
>> /tmp/filename/ instead of /tmp//filename/  so the application was trying 
>> to write to / where it did not have permissions.  So I had to write a 
>> fix.  Still not sure the fix is this best.
>>
>>
>> Maybe someone can look at the code I wrote and let me know.
>>
>> http://pastebin.com/vsC6vZRU
>>
>> The old code is commented out.
>>
>> Joshua Roberts
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>     
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>   



More information about the Ale mailing list