/*
 * Copyright 2013 Charles University in Prague
 * Copyright 2013 Vojtech Horky
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.cuni.mff.d3s.spl.tests.probes.instrument;

import java.net.URL;
import java.net.URLClassLoader;

import org.junit.Ignore;

@Ignore
public class MyClassLoader extends URLClassLoader {
	public MyClassLoader(URL[] urls, ClassLoader parent) {
		super(urls, parent);
	}
}

@@ -692,16 +692,110 @@
 ument;%0A%0A
+import java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0A
 import j
@@ -1007,11 +1007,974 @@
 ent);%0A%09%7D
+%0A%0A%09@Override%0A%09public Class%3C?%3E loadClass(String name) throws ClassNotFoundException %7B%0A%09%09if (!name.equals(%22cz.cuni.mff.d3s.spl.tests.probes.instrument.Action%22)) %7B%0A%09%09%09return super.loadClass(name);%0A%09%09%7D%0A%09%09InputStream stream = this.getResourceAsStream(name.replace('.', '/')%0A%09%09%09%09+ %22.class%22);%0A%09%09byte%5B%5D data;%0A%09%09try %7B%0A%09%09%09data = streamToBytes(stream);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09return super.loadClass(name);%0A%09%09%7D%0A%09%09return defineClass(name, data, 0, data.length);%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return String.format(%22MyClassLoader%5B%25s%5D%22, super.toString());%0A%09%7D%0A%0A%09private static byte%5B%5D streamToBytes(InputStream input) throws IOException %7B%0A%09%09ByteArrayOutputStream output = new ByteArrayOutputStream();%0A%09%09while (true) %7B%0A%09%09%09byte%5B%5D buffer = new byte%5B1024%5D;%0A%09%09%09int bytesActuallyRead = input.read(buffer);%0A%09%09%09if (bytesActuallyRead == -1) %7B%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%09output.write(buffer, 0, bytesActuallyRead);%0A%09%09%7D%0A%09%09return output.toByteArray();%0A%09%7D
 %0A%7D%0A

Fix MyClassLoader