Java - Fixed loading native libraries from paths that contain international characters.
This fixes Hyperic bug https://jira.hyperic.com/browse/HQ-4227
This commit is contained in:
		
							parent
							
								
									a04f46a647
								
							
						
					
					
						commit
						449de48cea
					
				@ -17,6 +17,7 @@
 | 
				
			|||||||
package org.hyperic.jni;
 | 
					package org.hyperic.jni;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.UnsupportedEncodingException;
 | 
				
			||||||
import java.util.StringTokenizer;
 | 
					import java.util.StringTokenizer;
 | 
				
			||||||
import java.net.URL;
 | 
					import java.net.URL;
 | 
				
			||||||
import java.net.URLClassLoader;
 | 
					import java.net.URLClassLoader;
 | 
				
			||||||
@ -315,7 +316,16 @@ public class ArchLoader {
 | 
				
			|||||||
        if ((file != null) &&
 | 
					        if ((file != null) &&
 | 
				
			||||||
            ((file = file.getParentFile()) != null))
 | 
					            ((file = file.getParentFile()) != null))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            String dir = URLDecoder.decode(file.toString()); 
 | 
					            String dir;
 | 
				
			||||||
 | 
								try {
 | 
				
			||||||
 | 
									// Passing UTF-8 according to the recommendation in the URLDecoder.decode JavaDoc.
 | 
				
			||||||
 | 
									dir = URLDecoder.decode(file.toString(), "UTF-8");
 | 
				
			||||||
 | 
								} catch (UnsupportedEncodingException e) {
 | 
				
			||||||
 | 
									String msg = "Unsupported encoding in file name: " + file.toString();
 | 
				
			||||||
 | 
									ArchLoaderException archLoaderException = new ArchLoaderException(msg);
 | 
				
			||||||
 | 
									archLoaderException.initCause(e);
 | 
				
			||||||
 | 
									throw archLoaderException;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
            if (findNativeLibrary(dir, libName)) {
 | 
					            if (findNativeLibrary(dir, libName)) {
 | 
				
			||||||
                return dir;
 | 
					                return dir;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user