merge r76194 from trunk to branch 5.0
JobConductor (branch 5.0): Items cache could not work correctly due to buggy hashcode/equals in keys for cache git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76201 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
@@ -27,6 +27,7 @@ Export-Package: org.talend.commons,
|
||||
org.talend.commons.utils.network,
|
||||
org.talend.commons.utils.performance,
|
||||
org.talend.commons.utils.platform,
|
||||
org.talend.commons.utils.resource,
|
||||
org.talend.commons.utils.scalability,
|
||||
org.talend.commons.utils.system,
|
||||
org.talend.commons.utils.threading,
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2011 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.resource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
|
||||
/**
|
||||
* class ResourceUtil. Helper to handle resource URL from java or Eclipse.
|
||||
*/
|
||||
public class ResourceUtil {
|
||||
|
||||
private static final String BUNDLERESOURCE = "bundleresource";
|
||||
|
||||
public static File convertResourceToFile(URL resource) throws IOException, URISyntaxException {
|
||||
File fileDir = null;
|
||||
if (BUNDLERESOURCE.equals(resource.getProtocol())) {
|
||||
URL unescapedURL = FileLocator.toFileURL(resource);
|
||||
URI escapedURI = new URI(unescapedURL.getProtocol(), unescapedURL.getPath(), unescapedURL.getQuery());
|
||||
fileDir = URIUtil.toFile(escapedURI);
|
||||
} else {
|
||||
fileDir = new File(resource.getFile());
|
||||
}
|
||||
return fileDir;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user