Bug - Fixed Error fetching avatar

Aankhen

Member
I think it’s r10451 that’s causing this. Mafia keeps trying to fetch the avatar using a doubled path, resulting in these errors:
Code:
java.io.FileNotFoundException: C:\Dev\src\kolmafia\my\botdist\images\http:\images.kingdomofloathing.com\otherimages\sealclubber.gif (The filename, directory name, or volume label syntax is incorrect)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
	at net.java.dev.spellcast.utilities.DataUtilities.getOutputStream(DataUtilities.java:382)
	at net.java.dev.spellcast.utilities.DataUtilities.getOutputStream(DataUtilities.java:368)
	at net.sourceforge.kolmafia.utilities.FileUtilities.loadLibrary(FileUtilities.java:208)
	at net.sourceforge.kolmafia.utilities.FileUtilities.downloadImage(FileUtilities.java:328)
	at net.sourceforge.kolmafia.KoLCharacter.getAvatar(KoLCharacter.java:870)
	at net.sourceforge.kolmafia.swingui.CharSheetFrame.<init>(CharSheetFrame.java:72)
The fix, unfortunately, is exceedingly complicated. It took me at least three weeks to figure it out:[SUP][1][/SUP]
Code:
diff -r 44a002a61d21 src/net/sourceforge/kolmafia/KoLCharacter.java
--- a/src/net/sourceforge/kolmafia/KoLCharacter.java    Sat Feb 11 11:30:35 2012 +0530
+++ b/src/net/sourceforge/kolmafia/KoLCharacter.java    Sat Feb 11 11:40:07 2012 +0530
@@ -862,17 +862,17 @@ public abstract class KoLCharacter
        /**
         * Accessor method to get the avatar associated with this character.
         *
         * @return The avatar for this character
         */

        public static final String getAvatar()
        {
-               FileUtilities.downloadImage( "http://images.kingdomofloathing.com/" + KoLCharacter.avatar );
+               FileUtilities.downloadImage( KoLCharacter.avatar );
                return KoLCharacter.avatar;
        }

        public static final void setGender( final int gender )
        {
                KoLCharacter.gender = gender;
        }
1. Okay, maybe slightly less.
 
Top