-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from FISCO-BCOS/release-1.0.10
merge release 1.0.10 into master
- Loading branch information
Showing
18 changed files
with
779 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package console.common; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ContractClassLoader extends ClassLoader { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ContractClassLoader.class); | ||
|
||
private String classPath; | ||
|
||
public ContractClassLoader(String classPath) { | ||
this.classPath = classPath; | ||
} | ||
|
||
@Override | ||
protected Class<?> findClass(String name) throws ClassNotFoundException { | ||
try { | ||
String fullName = classPath + "/" + name.replaceAll("\\.", "/") + ".class"; | ||
logger.debug("name: {}, fullName: {}", name, fullName); | ||
File file = new File(fullName); | ||
byte[] data = Files.readAllBytes(file.toPath()); | ||
return defineClass(name, data, 0, data.length); | ||
} catch (Exception e) { | ||
logger.warn("e: {}", e); | ||
throw new ClassNotFoundException("Cannot findClass " + name, e.getCause()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.