Thread: Cache Downloading Error.

Results 1 to 10 of 10
  1. #1 Cache Downloading Error. 
    Registered Member
    Join Date
    Jun 2012
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Attempting to download
    java.io.FileNotFoundException: C:\Users\Adam\dcc\Data\Animations\3353.dat (The s
    ystem cannot find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at CacheDownloader.unzip(CacheDownloader.java:194)
    at CacheDownloader.unZip(CacheDownloader.java:184)
    at CacheDownloader.downloadCache(CacheDownloader.java :70)
    at client.startUp(client.java:8019)
    at RSApplet.run(RSApplet.java:98)
    at client.run(client.java:5131)
    at java.lang.Thread.run(Unknown Source)
    java.io.FileNotFoundException: C:\Users\Adam\dcc\Data\Maps\mapConfig.txt (The sy
    stem cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileReader.<init>(Unknown Source)
    at client.setNewMaps(client.java:204)
    at client.startUp(client.java:8020)
    at RSApplet.run(RSApplet.java:98)
    at client.run(client.java:5131)
    at java.lang.Thread.run(Unknown Source)
    Map amount = 660Error: 0
    java.io.FileNotFoundException: C:\Users\Adam\dcc\Data\Animations\Frames.dat (The
    system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at Class36.unpackAnimationData(Class36.java:17)
    at client.startUp(client.java:8070)
    at RSApplet.run(RSApplet.java:98)
    at client.run(client.java:5131)
    at java.lang.Thread.run(Unknown Source)
    Error: 0
    java.io.FileNotFoundException: C:\Users\Adam\dcc\Data\Animations\Skins.dat (The
    system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at Class36.unpackAnimationData(Class36.java:40)
    at client.startUp(client.java:8070)
    at RSApplet.run(RSApplet.java:98)
    at client.run(client.java:5131)
    at java.lang.Thread.run(Unknown Source)
    602 Animations: 13798
    508 Object Amount: 38424
    602 NPC Amount: 11257
    602 GFX Amount: 2617
    Spot Anim 1950: 44811, 10965
    Couldn't find details2.ini
    Why do I get this?

    It doesn't extract the Data, Model and Sprites folder.
    Reply With Quote  
     

  2. #2  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    The files aren't being found for some reason... it almost looks like it's trying to unzip your .dat and .txt files which would obviously throw an error.

    Maybe post the code from where the error is being thrown?



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2012
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    CacheDownloader.java
    Code:
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    
    import sign.signlink;
    
    public class CacheDownloader {
    
            private client client;
    
            private final int BUFFER = 1024;
    
            private final int VERSION = 1; // Version of cache (Change on client updates)
            private String cacheLink = "http://conceptionrsps.info/dcc.zip"; // Link to cache
    
            private String fileToExtract = getCacheDir() + getArchivedName();
    
    	public CacheDownloader(client client) {
    		this.client = client;
    	}
    
    	public void drawLoadingText(String text) {
    		client.drawLoadingText(35, text);
    	}
    
    	public void drawLoadingText(int amount, String text) {
    		client.drawLoadingText(amount, text);
    	}
    
    	public String getCacheDir() {
    		return signlink.findcachedir();
    	}
    
    	public String getCacheLink() {
    		return cacheLink;
    	}
    
    	public int getCacheVersion() {
    		return VERSION;
    	}
    
    	public CacheDownloader downloadCache() {
    		try {
    			File location = new File(getCacheDir());
    			File version = new File(getCacheDir() + "/cacheUpdate"
    					+ getCacheVersion() + ".dat");
    			if (!location.exists()) {
    				downloadFile(getCacheLink(), getArchivedName());
    				unZip();
    				BufferedWriter versionFile = new BufferedWriter(new FileWriter(
    						getCacheDir() + "/cacheUpdate" + getCacheVersion()
    								+ ".dat"));
    				versionFile.close();
    				deleteDownloadedZipFile(getArchivedName());
    			} else {
    				if (!version.exists()) {
    					// delete(getCacheDir());
    					downloadFile(getCacheLink(), getArchivedName());
    					unZip();
    					BufferedWriter versionFile = new BufferedWriter(
    							new FileWriter(getCacheDir() + "/cacheUpdate"
    									+ getCacheVersion() + ".dat"));
    					versionFile.close();
    					deleteDownloadedZipFile(getArchivedName());
    				} else {
    					return null;
    				}
    			}
    		} catch (Exception e) {
    		}
    		return null;
    	}
    
    	public void downloadFile(String adress, String localFileName) {
    	System.out.println("Attempting to download");
    		OutputStream out = null;
    		URLConnection conn;
    		InputStream in = null;
    		try {
    			URL url = new URL(adress);
    			out = new BufferedOutputStream(new FileOutputStream(getCacheDir()
    					+ "/" + localFileName));
    			conn = url.openConnection();
    			in = conn.getInputStream();
    			byte[] data = new byte[BUFFER];
    			int numRead;
    			long numWritten = 0;
    			int length = conn.getContentLength();
    			while ((numRead = in.read(data)) != -1) {
    				out.write(data, 0, numRead);
    				numWritten += numRead;
    				int percentage = (int) (((double) numWritten / (double) length) * 100D);
    				drawLoadingText(percentage, "Downloading Cache " + percentage
    						+ "%");
    			}
    			drawLoadingText("Finished downloading " + getArchivedName() + "!");
    		} catch (Exception exception) {
    			exception.printStackTrace();
    		} finally {
    			try {
    				if (in != null) {
    					in.close();
    				}
    				if (out != null) {
    					out.close();
    				}
    			} catch (IOException ioe) {
    			}
    		}
    	}
    
    	public String getArchivedName() {
    		int lastSlashIndex = getCacheLink().lastIndexOf('/');
    		if (lastSlashIndex >= 0 && lastSlashIndex < getCacheLink().length() - 1) {
    			return getCacheLink().substring(lastSlashIndex + 1);
    		} else {
    		}
    		return "";
    	}
    
    	public void deleteDownloadedZipFile(String fileName) {
    		File f = new File(getCacheDir() + fileName);
    		if (!f.exists())
    			throw new IllegalArgumentException(
    					"Delete: no such file or directory: " + fileName);
    		if (!f.canWrite())
    			throw new IllegalArgumentException("Delete: write protected: "
    					+ fileName);
    		if (f.isDirectory()) {
    			String[] files = f.list();
    			if (files.length > 0)
    				throw new IllegalArgumentException(
    						"Delete: directory not empty: " + fileName);
    		}
    		boolean success = f.delete();
    		if (!success)
    			throw new IllegalArgumentException("Delete: deletion failed");
    	}
    
    	public static boolean delete(String path) {
    		if (path == null || path.trim().length() == 0)
    			return false;
    		return delete(new File(path));
    	}
    
    	public static boolean delete(File fileOrDirectory) {
    		if (fileOrDirectory == null)
    			return false;
    		if (!fileOrDirectory.exists())
    			return false;
    		if (fileOrDirectory.isDirectory()) {
    			for (File childFile : fileOrDirectory.listFiles()) {
    				delete(childFile);
    			}
    		}
    		return fileOrDirectory.delete();
    	}
    
    	public void unZip() {
    		try {
    			InputStream in = new BufferedInputStream(new FileInputStream(
    					fileToExtract));
    			ZipInputStream zin = new ZipInputStream(in);
    			ZipEntry e;
    			while ((e = zin.getNextEntry()) != null) {
    				if (e.isDirectory()) {
    					(new File(getCacheDir() + e.getName())).mkdir();
    				} else {
    					if (e.getName().equals(fileToExtract)) {
    						unzip(zin, fileToExtract);
    						break;
    					}
    					unzip(zin, getCacheDir() + e.getName());
    				}
    			}
    			zin.close();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public void unzip(ZipInputStream zin, String s) throws IOException {
    		FileOutputStream out = new FileOutputStream(s);
    		byte[] b = new byte[BUFFER];
    		int len = 0;
    		while ((len = zin.read(b)) != -1) {
    			out.write(b, 0, len);
    		}
    		out.close();
    	}
    }
    Reply With Quote  
     

  4. #4  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    This right here:

    Code:
    	public void unzip(ZipInputStream zin, String s) throws IOException {
    		FileOutputStream out = new FileOutputStream(s);
    		byte[] b = new byte[BUFFER];
    		int len = 0;
    		while ((len = zin.read(b)) != -1) {
    			out.write(b, 0, len);
    		}
    		out.close();
    	}
    seems to be where the error is coming from.

    It is trying to unzip your "C:\Users\Adam\dcc\Data\Animations\3353.dat" file which cannot even be found, although I assume if it were found it would still throw an error due to the fact that it should be unzipping your cache not some .dat file.



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jun 2012
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Mikee View Post
    This right here:

    Code:
    	public void unzip(ZipInputStream zin, String s) throws IOException {
    		FileOutputStream out = new FileOutputStream(s);
    		byte[] b = new byte[BUFFER];
    		int len = 0;
    		while ((len = zin.read(b)) != -1) {
    			out.write(b, 0, len);
    		}
    		out.close();
    	}
    seems to be where the error is coming from.

    It is trying to unzip your "C:\Users\Adam\dcc\Data\Animations\3353.dat" file which cannot even be found, although I assume if it were found it would still throw an error due to the fact that it should be unzipping your cache not some .dat file.
    How do I fix?
    Reply With Quote  
     

  6. #6  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    You need to do this after you've downloaded the cache since the files are obviously not there since they havn't been downloaded yet.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jun 2012
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Letters View Post
    You need to do this after you've downloaded the cache since the files are obviously not there since they havn't been downloaded yet.
    Spoonfeed me.
    Reply With Quote  
     

  8. #8  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    Nah I'll fork feed you, ok first, oh oops I stabbed you in the eye... Do something for yourself. I've never had this problem so i wouldn't know an exact fix.
    Reply With Quote  
     

  9. Thankful user:


  10. #9  
    Registered Member
    Join Date
    Jun 2012
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Letters View Post
    Nah I'll fork feed you, ok first, oh oops I stabbed you in the eye... Do something for yourself. I've never had this problem so i wouldn't know an exact fix.
    Ffs, I just want a good working source + client that I can start on.
    Reply With Quote  
     

  11. #10  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    Quote Originally Posted by 'Pirate View Post
    Ffs, I just want a good working source + client that I can start on.
    Just because you're getting this error doesn't mean there's any problem with your source or client.



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Downloading Cache Error
    By D G™ in forum Help
    Replies: 3
    Last Post: 06-11-2012, 03:25 AM
  2. Cache Downloading Error
    By I'm A Jerk in forum Help
    Replies: 1
    Last Post: 06-08-2012, 03:03 PM
  3. Cache downloading error
    By thesancezzz in forum Help
    Replies: 0
    Last Post: 12-10-2011, 08:54 PM
  4. Replies: 1
    Last Post: 08-28-2011, 01:09 AM
  5. [PI]Cache Downloading + UnPacking Error
    By tomgun78 in forum Help
    Replies: 1
    Last Post: 01-22-2011, 04:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •