rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
ruby.getBlock().getCurrent().getFrame().setNamespace(ruby.getCurrentFrame().getNamespace());
ruby.getBlockStack().getCurrent().getFrame().setNamespace(ruby.getCurrentFrame().getNamespace());
public RubyObject execute(RubyObject self, RubyObject[] args, Ruby ruby) { // if () { Block oldBlock = ruby.getBlock().getCurrent().cloneBlock(); /* copy the block to avoid modifying global data. */ ruby.getBlock().getCurrent().getFrame().setNamespace(ruby.getCurrentFrame().getNamespace()); try { return ruby.yield(args[0], args[0], ruby.getRubyClass(), false).toRubyObject(); } finally { ruby.getBlock().setCurrent(oldBlock); } // } /* static block, no need to restore */ // ruby.getBlock().frame.setNamespace(ruby.getRubyFrame().getNamespace()); // return ruby.yield0(args[0], args[0], ruby.getRubyClass(), false); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyObject.java/buggy/org/jruby/RubyObject.java
ruby.getBlock().setCurrent(oldBlock);
ruby.getBlockStack().setCurrent(oldBlock);
public RubyObject execute(RubyObject self, RubyObject[] args, Ruby ruby) { // if () { Block oldBlock = ruby.getBlock().getCurrent().cloneBlock(); /* copy the block to avoid modifying global data. */ ruby.getBlock().getCurrent().getFrame().setNamespace(ruby.getCurrentFrame().getNamespace()); try { return ruby.yield(args[0], args[0], ruby.getRubyClass(), false).toRubyObject(); } finally { ruby.getBlock().setCurrent(oldBlock); } // } /* static block, no need to restore */ // ruby.getBlock().frame.setNamespace(ruby.getRubyFrame().getNamespace()); // return ruby.yield0(args[0], args[0], ruby.getRubyClass(), false); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyObject.java/buggy/org/jruby/RubyObject.java
return "AnalysisChainNode"+(analysisChainNodeId==null ? ":Hash"+this.hashCode() : ":"+analysisChainNodeId);
return "AnalysisChainNode"+(analysisChainNodeId==null ? ":Hash_"+this.hashCode() : ":Id_"+analysisChainNodeId);
public String toString(){ return "AnalysisChainNode"+(analysisChainNodeId==null ? ":Hash"+this.hashCode() : ":"+analysisChainNodeId); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/51a3c546dfc7a7a98b29771a459df19094fc5b51/AnalysisChainNode.java/buggy/components/common/src/ome/model/AnalysisChainNode.java
} ClassLoader classLoader = runtime.getJavaSupport().getJavaClassLoader(); String xname = name.replace('\\', '/'); if (xname.charAt(0) == '/') { URL loc = classLoader.getResource(xname); if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); }
private LoadServiceResource findFile(String name) { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } try { JRubyFile file = JRubyFile.create(runtime.getCurrentDirectory(),name); if(file.isFile() && file.isAbsolute()) { try { return new LoadServiceResource(file.toURL(),name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, applet security } catch (IllegalArgumentException illArgEx) { } ClassLoader classLoader = runtime.getJavaSupport().getJavaClassLoader(); String xname = name.replace('\\', '/'); // Look in classpath next (we do not use File as a test since UNC names will match) // Note: Jar resources must always begin with an '/'. if (xname.charAt(0) == '/') { URL loc = classLoader.getResource(xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } for (Iterator pathIter = loadPath.iterator(); pathIter.hasNext();) { String entry = pathIter.next().toString(); if (entry.startsWith("jar:")) { JarFile current = (JarFile)jarFiles.get(entry); if(null == current) { try { current = new JarFile(entry.substring(4)); jarFiles.put(entry,current); } catch (FileNotFoundException ignored) { } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } if (current.getJarEntry(name) != null) { try { return new LoadServiceResource(new URL(entry + name), entry + name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } try { JRubyFile current = JRubyFile.create(JRubyFile.create(runtime.getCurrentDirectory(),entry).getAbsolutePath(), name); if (current.isFile()) { try { return new LoadServiceResource(current.toURL(), current.getPath()); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, we're in an applet } catch (IllegalArgumentException illArgEx) { // ignore; Applet under windows has issues with current dir = "/" } // otherwise, try to load from classpath (Note: Jar resources always uses '/') URL loc = classLoader.getResource(entry.replace('\\', '/') + "/" + xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } // Try to load from classpath without prefix. "A/b.rb" will not load as // "./A/b.rb" in a jar file. (Note: Jar resources always uses '/') URL loc = classLoader.getResource(xname); return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
URL loc = classLoader.getResource(entry.replace('\\', '/') + "/" + xname); if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); }
private LoadServiceResource findFile(String name) { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } try { JRubyFile file = JRubyFile.create(runtime.getCurrentDirectory(),name); if(file.isFile() && file.isAbsolute()) { try { return new LoadServiceResource(file.toURL(),name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, applet security } catch (IllegalArgumentException illArgEx) { } ClassLoader classLoader = runtime.getJavaSupport().getJavaClassLoader(); String xname = name.replace('\\', '/'); // Look in classpath next (we do not use File as a test since UNC names will match) // Note: Jar resources must always begin with an '/'. if (xname.charAt(0) == '/') { URL loc = classLoader.getResource(xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } for (Iterator pathIter = loadPath.iterator(); pathIter.hasNext();) { String entry = pathIter.next().toString(); if (entry.startsWith("jar:")) { JarFile current = (JarFile)jarFiles.get(entry); if(null == current) { try { current = new JarFile(entry.substring(4)); jarFiles.put(entry,current); } catch (FileNotFoundException ignored) { } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } if (current.getJarEntry(name) != null) { try { return new LoadServiceResource(new URL(entry + name), entry + name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } try { JRubyFile current = JRubyFile.create(JRubyFile.create(runtime.getCurrentDirectory(),entry).getAbsolutePath(), name); if (current.isFile()) { try { return new LoadServiceResource(current.toURL(), current.getPath()); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, we're in an applet } catch (IllegalArgumentException illArgEx) { // ignore; Applet under windows has issues with current dir = "/" } // otherwise, try to load from classpath (Note: Jar resources always uses '/') URL loc = classLoader.getResource(entry.replace('\\', '/') + "/" + xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } // Try to load from classpath without prefix. "A/b.rb" will not load as // "./A/b.rb" in a jar file. (Note: Jar resources always uses '/') URL loc = classLoader.getResource(xname); return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
URL loc = classLoader.getResource(xname); return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null;
return null;
private LoadServiceResource findFile(String name) { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } try { JRubyFile file = JRubyFile.create(runtime.getCurrentDirectory(),name); if(file.isFile() && file.isAbsolute()) { try { return new LoadServiceResource(file.toURL(),name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, applet security } catch (IllegalArgumentException illArgEx) { } ClassLoader classLoader = runtime.getJavaSupport().getJavaClassLoader(); String xname = name.replace('\\', '/'); // Look in classpath next (we do not use File as a test since UNC names will match) // Note: Jar resources must always begin with an '/'. if (xname.charAt(0) == '/') { URL loc = classLoader.getResource(xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } for (Iterator pathIter = loadPath.iterator(); pathIter.hasNext();) { String entry = pathIter.next().toString(); if (entry.startsWith("jar:")) { JarFile current = (JarFile)jarFiles.get(entry); if(null == current) { try { current = new JarFile(entry.substring(4)); jarFiles.put(entry,current); } catch (FileNotFoundException ignored) { } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } if (current.getJarEntry(name) != null) { try { return new LoadServiceResource(new URL(entry + name), entry + name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } try { JRubyFile current = JRubyFile.create(JRubyFile.create(runtime.getCurrentDirectory(),entry).getAbsolutePath(), name); if (current.isFile()) { try { return new LoadServiceResource(current.toURL(), current.getPath()); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } catch (AccessControlException accessEx) { // ignore, we're in an applet } catch (IllegalArgumentException illArgEx) { // ignore; Applet under windows has issues with current dir = "/" } // otherwise, try to load from classpath (Note: Jar resources always uses '/') URL loc = classLoader.getResource(entry.replace('\\', '/') + "/" + xname); // Make sure this is not a directory or unavailable in some way if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } // Try to load from classpath without prefix. "A/b.rb" will not load as // "./A/b.rb" in a jar file. (Note: Jar resources always uses '/') URL loc = classLoader.getResource(xname); return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
private Library findLibrary(String file) { if (builtinLibraries.containsKey(file)) { return (Library) builtinLibraries.get(file); } LoadServiceResource resource = findFile(file); if (resource == null) { return null; } if (file.endsWith(".jar")) { return new JarredScript(resource); } else if (file.endsWith(".rb.ast.ser")) { return new PreparsedScript(resource); } else { return new ExternalScript(resource, file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } }
for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } try {
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java");
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
} catch (AccessControlException accessEx) {
} catch (AccessControlException accessEx) {
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
} if (runtime.getSafeLevel() == 0) { addPath("."); }
}
public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } // wrap in try/catch for security exceptions in an applet try { if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } String jrubyHome = System.getProperty("jruby.home"); if (jrubyHome != null) { char sep = '/'; String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep; addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION + sep + "java"); addPath(rubyDir + "site_ruby"); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION); addPath(rubyDir + Constants.RUBY_MAJOR_VERSION + sep + "java"); // Added to make sure we find default distribution files within jar file. // TODO: Either make jrubyHome become the jar file or allow "classpath-only" paths addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { // ignore, we're in an applet and can't access filesystem anyway } if (runtime.getSafeLevel() == 0) { addPath("."); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
throw runtime.newLoadError("No such file to load -- " + file);
library = findLibraryWithClassloaders(file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); }
public void load(String file) { Library library = null; library = findLibrary(file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { library.load(runtime); } catch (IOException e) { throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
String filestr = suffixPattern.matcher(file).replaceAll("$1");
String filestr = allPattern.matcher(file).replaceAll("$1");
public boolean require(String file) { String filestr = suffixPattern.matcher(file).replaceAll("$1"); if (loadedFeaturesInternal.contains(filestr)) { return false; } smartLoad(filestr); return true; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
public boolean require(String file) { String filestr = suffixPattern.matcher(file).replaceAll("$1"); if (loadedFeaturesInternal.contains(filestr)) { return false; } smartLoad(filestr); return true; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]);
if (file.indexOf('.') >= 0) { Matcher matcher = null; if ((matcher = sourcePattern.matcher(file)).matches()) { extensionsToSearch = sourceSuffixes; file = matcher.group(1); } else if ((matcher = extensionPattern.matcher(file)).matches()) { extensionsToSearch = extensionSuffixes; file = matcher.group(1); } else { throw runtime.newLoadError("no such file to load -- " + file); } } else { extensionsToSearch = allSuffixes; } for (int i = 0; i < extensionsToSearch.length; i++) { library = findLibrary(file + extensionsToSearch[i]);
public void smartLoad(String file) { Library library = null; String loadName = file; // nothing yet, try suffixes for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]); if (library != null) { loadName = file + suffixes[i]; break; } } if(library == null) { library = findLibrary(file); if(library != null) { loadName = file; } } library = tryLoadExtension(library,file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
loadName = file + suffixes[i];
loadName = file + extensionsToSearch[i];
public void smartLoad(String file) { Library library = null; String loadName = file; // nothing yet, try suffixes for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]); if (library != null) { loadName = file + suffixes[i]; break; } } if(library == null) { library = findLibrary(file); if(library != null) { loadName = file; } } library = tryLoadExtension(library,file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
if(library == null) { library = findLibrary(file); if(library != null) { loadName = file;
if (library == null) { for (int i = 0; i < extensionsToSearch.length; i++) { library = findLibraryWithClassloaders(file + extensionsToSearch[i]); if (library != null) { loadName = file + extensionsToSearch[i]; break; }
public void smartLoad(String file) { Library library = null; String loadName = file; // nothing yet, try suffixes for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]); if (library != null) { loadName = file + suffixes[i]; break; } } if(library == null) { library = findLibrary(file); if(library != null) { loadName = file; } } library = tryLoadExtension(library,file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
throw runtime.newLoadError("No such file to load -- " + file);
throw runtime.newLoadError("no such file to load -- " + file);
public void smartLoad(String file) { Library library = null; String loadName = file; // nothing yet, try suffixes for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]); if (library != null) { loadName = file + suffixes[i]; break; } } if(library == null) { library = findLibrary(file); if(library != null) { loadName = file; } } library = tryLoadExtension(library,file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file);
synchronized (this) { try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); }
public void smartLoad(String file) { Library library = null; String loadName = file; // nothing yet, try suffixes for (int i = 0; i < suffixes.length; i++) { library = findLibrary(file + suffixes[i]); if (library != null) { loadName = file + suffixes[i]; break; } } if(library == null) { library = findLibrary(file); if(library != null) { loadName = file; } } library = tryLoadExtension(library,file); if (library == null) { throw runtime.newLoadError("No such file to load -- " + file); } try { loadedFeaturesInternal.add(file); loadedFeatures.add(runtime.newString(loadName)); library.load(runtime); } catch (IOException e) { loadedFeaturesInternal.remove(file); loadedFeatures.remove(runtime.newString(loadName)); throw runtime.newLoadError("IO error -- " + file); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
for(int i=0,j=(all.length-1);i<j;i++) {
for(int i=0, j=(all.length-1); i<j; i++) {
private Library tryLoadExtension(Library library, String file) { // This code exploits the fact that all .jar files will be found for the JarredScript feature. // This is where the basic extension mechanism gets fixed Library oldLibrary = library; if(library == null || library instanceof JarredScript) { // Create package name, by splitting on / and joining all but the last elements with a ".", and downcasing them. String[] all = file.split("/"); StringBuffer finName = new StringBuffer(); for(int i=0,j=(all.length-1);i<j;i++) { finName.append(all[i].toLowerCase()).append("."); } // Make the class name look nice, by splitting on _ and capitalize each segment, then joining // the, together without anything separating them, and last put on "Service" at the end. String[] last = all[all.length-1].split("_"); for(int i=0,j=last.length;i<j;i++) { finName.append(Character.toUpperCase(last[i].charAt(0))).append(last[i].substring(1)); } finName.append("Service"); // We don't want a package name beginning with dots, so we remove them String className = finName.toString().replaceAll("^\\.*",""); // If there is a jar-file with the required name, we add this to the class path. if(library instanceof JarredScript) { // It's _really_ expensive to check that the class actually exists in the Jar, so // we don't do that now. runtime.getJavaSupport().addToClasspath(((JarredScript)library).getResource().getURL()); } try { Class theClass = runtime.getJavaSupport().loadJavaClass(className); library = new ClassExtensionLibrary(theClass); } catch(Exception ee) { library = null; } } // If there was a good library before, we go back to that if(library == null && oldLibrary != null) { library = oldLibrary; } return library; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
for(int i=0,j=last.length;i<j;i++) {
for(int i=0, j=last.length; i<j; i++) {
private Library tryLoadExtension(Library library, String file) { // This code exploits the fact that all .jar files will be found for the JarredScript feature. // This is where the basic extension mechanism gets fixed Library oldLibrary = library; if(library == null || library instanceof JarredScript) { // Create package name, by splitting on / and joining all but the last elements with a ".", and downcasing them. String[] all = file.split("/"); StringBuffer finName = new StringBuffer(); for(int i=0,j=(all.length-1);i<j;i++) { finName.append(all[i].toLowerCase()).append("."); } // Make the class name look nice, by splitting on _ and capitalize each segment, then joining // the, together without anything separating them, and last put on "Service" at the end. String[] last = all[all.length-1].split("_"); for(int i=0,j=last.length;i<j;i++) { finName.append(Character.toUpperCase(last[i].charAt(0))).append(last[i].substring(1)); } finName.append("Service"); // We don't want a package name beginning with dots, so we remove them String className = finName.toString().replaceAll("^\\.*",""); // If there is a jar-file with the required name, we add this to the class path. if(library instanceof JarredScript) { // It's _really_ expensive to check that the class actually exists in the Jar, so // we don't do that now. runtime.getJavaSupport().addToClasspath(((JarredScript)library).getResource().getURL()); } try { Class theClass = runtime.getJavaSupport().loadJavaClass(className); library = new ClassExtensionLibrary(theClass); } catch(Exception ee) { library = null; } } // If there was a good library before, we go back to that if(library == null && oldLibrary != null) { library = oldLibrary; } return library; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
private Library tryLoadExtension(Library library, String file) { // This code exploits the fact that all .jar files will be found for the JarredScript feature. // This is where the basic extension mechanism gets fixed Library oldLibrary = library; if(library == null || library instanceof JarredScript) { // Create package name, by splitting on / and joining all but the last elements with a ".", and downcasing them. String[] all = file.split("/"); StringBuffer finName = new StringBuffer(); for(int i=0,j=(all.length-1);i<j;i++) { finName.append(all[i].toLowerCase()).append("."); } // Make the class name look nice, by splitting on _ and capitalize each segment, then joining // the, together without anything separating them, and last put on "Service" at the end. String[] last = all[all.length-1].split("_"); for(int i=0,j=last.length;i<j;i++) { finName.append(Character.toUpperCase(last[i].charAt(0))).append(last[i].substring(1)); } finName.append("Service"); // We don't want a package name beginning with dots, so we remove them String className = finName.toString().replaceAll("^\\.*",""); // If there is a jar-file with the required name, we add this to the class path. if(library instanceof JarredScript) { // It's _really_ expensive to check that the class actually exists in the Jar, so // we don't do that now. runtime.getJavaSupport().addToClasspath(((JarredScript)library).getResource().getURL()); } try { Class theClass = runtime.getJavaSupport().loadJavaClass(className); library = new ClassExtensionLibrary(theClass); } catch(Exception ee) { library = null; } } // If there was a good library before, we go back to that if(library == null && oldLibrary != null) { library = oldLibrary; } return library; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe11f82bc6236dc6746a228a50d4bac6d467618e/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java
return new Object[4];
return new Object[6];
public Object[] getSelectItemListArray() { return new Object[4]; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/36163213865d20118bce2335dd258c26a2a29846/ArticleSearchResultBean.java/buggy/src/java/com/idega/block/article/bean/ArticleSearchResultBean.java
values.add(getLocaleIdAsString()); values.add(getStatus());
public Object[] getValues() {// "Headline", "Published", "Author", "Status" List values = new ArrayList(); values.add(getHeadline()); values.add(getAuthor()); values.add(getSource()); values.add(getCreationDate()); return values.toArray(new Object[values.size()]); }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/36163213865d20118bce2335dd258c26a2a29846/ArticleSearchResultBean.java/buggy/src/java/com/idega/block/article/bean/ArticleSearchResultBean.java
start.clearLinkedTo(end); end.clearLinkedTo(start);
if (start != null) start.clearLinkedTo(end); if (end != null) end.clearLinkedTo(start);
public void clearLinks() { start.clearLinkedTo(end); end.clearLinkedTo(start); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6dad47fbaa74e36fa3a3799bf802e22d4902205c/ParamLink.java/clean/SRC/org/openmicroscopy/shoola/agents/chainbuilder/piccolo/ParamLink.java
checkRoomsForTimeout();
private ChatManager() { chatContainer = new ChatContainer(); // Add a Message Handler SparkManager.getMessageEventManager().addMessageEventNotificationListener(this); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(final Packet packet) { if (customList.contains(StringUtils.parseBareAddress(packet.getFrom()))) { cancelledNotification(packet.getFrom(), ""); } } }, new PacketTypeFilter(Message.class)); // Start timeout checkRoomsForTimeout(); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/93be14b35e2ec723a91a9660ce4217f9947cf7b5/ChatManager.java/clean/src/java/org/jivesoftware/spark/ChatManager.java
{ this.control = control; items = new HashMap(); }
{ this.control = control; items = new HashMap(); }
public ZoomMenuManager(ImageInspectorManager control) { this.control = control; items = new HashMap(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomMenuManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomMenuManager.java
{ int index = Integer.parseInt(e.getActionCommand()); Double value = (Double) inverseValues.get(new Integer(index)); if (value != null) control.setZoomLevel(value.doubleValue()); else throw new Error("Invalid Action ID "+index); }
{ int index = Integer.parseInt(e.getActionCommand()); Double value = (Double) inverseValues.get(new Integer(index)); if (value != null) control.setZoomLevel(value.doubleValue()); else throw new Error("Invalid Action ID "+index); }
public void actionPerformed(ActionEvent e) { int index = Integer.parseInt(e.getActionCommand()); Double value = (Double) inverseValues.get(new Integer(index)); if (value != null) control.setZoomLevel(value.doubleValue()); else throw new Error("Invalid Action ID "+index); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomMenuManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomMenuManager.java
{ item.setActionCommand(""+id); item.addActionListener(this); items.put(new Integer(id), item); }
{ item.setActionCommand(""+id); item.addActionListener(this); items.put(new Integer(id), item); }
void attachItemListener(AbstractButton item, int id) { item.setActionCommand(""+id); item.addActionListener(this); items.put(new Integer(id), item); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomMenuManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomMenuManager.java
if (getRuntime().getLoadService().autoload(name) != null) {
if (getRuntime().getLoadService().autoload(p.getName() + "::" + name) != null) {
private IRubyObject getConstantInner(String name, boolean exclude) { IRubyObject objectClass = getRuntime().getObject(); boolean retryForModule = false; RubyModule p = this; retry: while (true) { while (p != null) { IRubyObject constant = p.getConstantAt(name); if (constant == null) { if (getRuntime().getLoadService().autoload(name) != null) { continue; } } if (constant != null) { if (exclude && p == objectClass && this != objectClass) { getRuntime().getWarnings().warn("toplevel constant " + name + " referenced by " + getName() + "::" + name); } return constant; } p = p.getSuperClass(); } if (!exclude && !retryForModule && getClass().equals(RubyModule.class)) { retryForModule = true; p = getRuntime().getObject(); continue retry; } break; } return callMethod(getRuntime().getCurrentContext(), "const_missing", RubySymbol.newSymbol(getRuntime(), name)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/3cd87a03d9ff599871bd14f49c218d1045bca20b/RubyModule.java/clean/src/org/jruby/RubyModule.java
this.sourceFiles.put(classData.getSourceFileName(), packageData.getChild(classData.getSourceFileName()));
public void addClassData(ClassData classData) { String packageName = classData.getPackageName(); PackageData packageData = (PackageData)children.get(packageName); if (packageData == null) { packageData = new PackageData(packageName); // Each key is a package name, stored as an String object. // Each value is information about the package, stored as a PackageData object. this.children.put(packageName, packageData); } packageData.addClassData(classData); this.classes.put(classData.getName(), classData); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c7179e693f89a314eb6898100456db755030dd92/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
public SortedSet getSourceFiles()
public Collection getSourceFiles()
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getSourceFiles()); } return sourceFiles; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c7179e693f89a314eb6898100456db755030dd92/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getSourceFiles()); } return sourceFiles;
return this.sourceFiles.values();
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getSourceFiles()); } return sourceFiles; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c7179e693f89a314eb6898100456db755030dd92/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
menu.add(createRootMenu());
createRootMenu();
private JMenu createFileMenu() { JMenu menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); TreeViewerAction a = controller.getAction( TreeViewerControl.CREATE_TOP_CONTAINER); JMenuItem item = new JMenuItem(a); item.setText(a.getActionName()); menuItems.add(item); menu.add(item); a = controller.getAction(TreeViewerControl.CREATE_OBJECT); item = new JMenuItem(a); menu.add(item); item.setText(a.getActionName()); menuItems.add(item); menu.add(createRootMenu()); menu.add(new JSeparator(JSeparator.HORIZONTAL)); a = controller.getAction(TreeViewerControl.VIEW); item = new JMenuItem(a); item.setText(a.getActionName()); menuItems.add(item); menu.add(item); menu.add(new JMenuItem( controller.getAction(TreeViewerControl.REFRESH_TREE))); menu.add(new JSeparator(JSeparator.HORIZONTAL)); menu.add(new JMenuItem( controller.getAction(TreeViewerControl.EXIT))); return menu; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3b273af3a5320ab0a054540f14a3c299ff01de69/TreeViewerWin.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerWin.java
this.sourceFiles.put(classData.getSourceFileName(), packageData.getChild(classData.getSourceFileName()));
this.sourceFiles.put(classData.getSourceFileName(), packageData.getChild(classData .getSourceFileName()));
public void addClassData(ClassData classData) { String packageName = classData.getPackageName(); PackageData packageData = (PackageData)children.get(packageName); if (packageData == null) { packageData = new PackageData(packageName); // Each key is a package name, stored as an String object. // Each value is information about the package, stored as a PackageData object. this.children.put(packageName, packageData); } packageData.addClassData(classData); this.sourceFiles.put(classData.getSourceFileName(), packageData.getChild(classData.getSourceFileName())); this.classes.put(classData.getName(), classData); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
File dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (dataFile.isFile()) { globalProjectData = CoverageDataFileHandler .loadCoverageData(dataFile); } if (globalProjectData == null) { System.out.println("Cobertura: Coverage data file " + dataFile.getAbsolutePath() + " either does not exist or is not readable. Creating a new data file."); globalProjectData = new ProjectData(); } if( System.getProperty("catalina.home")!=null) { saveGlobalProjectData(); ClassData.class.toString(); CoverageData.class.toString(); CoverageDataContainer.class.toString(); HasBeenInstrumented.class.toString(); LineData.class.toString(); PackageData.class.toString(); SourceFileData.class.toString(); } saveTimer = new SaveTimer(); Runtime.getRuntime().addShutdownHook(new Thread(saveTimer));
initialize(); globalProjectData = new ProjectData();
public static ProjectData getGlobalProjectData() { if (globalProjectData != null) return globalProjectData; File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Read projectData from the serialized file. if (dataFile.isFile()) { //System.out.println("Cobertura: Loading global project data from " + dataFile.getAbsolutePath()); globalProjectData = CoverageDataFileHandler .loadCoverageData(dataFile); } if (globalProjectData == null) { // We could not read from the serialized file, so create a new object. System.out.println("Cobertura: Coverage data file " + dataFile.getAbsolutePath() + " either does not exist or is not readable. Creating a new data file."); globalProjectData = new ProjectData(); } // Hack for Tomcat - by saving project data right now we force loading // of classes involved in this process (like ObjectOutputStream) // so that it won't be necessary to load them on JVM shutdown if( System.getProperty("catalina.home")!=null) { saveGlobalProjectData(); // Additionaly force loading of other classes that might be not loaded // becouse saved project data was empty ClassData.class.toString(); CoverageData.class.toString(); CoverageDataContainer.class.toString(); HasBeenInstrumented.class.toString(); LineData.class.toString(); PackageData.class.toString(); SourceFileData.class.toString(); } // Add a hook to save the data when the JVM exits saveTimer = new SaveTimer(); Runtime.getRuntime().addShutdownHook(new Thread(saveTimer)); // Possibly also save the coverage data every x seconds? //Timer timer = new Timer(true); //timer.schedule(saveTimer, 100); return globalProjectData; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
for (Iterator iter = projectData.sourceFiles.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); if (!this.sourceFiles.containsKey(key)) { this.sourceFiles.put(key, projectData.sourceFiles.get(key)); } }
for (Iterator iter = projectData.sourceFiles.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); if (!this.sourceFiles.containsKey(key)) { this.sourceFiles.put(key, projectData.sourceFiles.get(key)); } }
public void merge(CoverageData coverageData) { super.merge(coverageData); ProjectData projectData = (ProjectData)coverageData; for (Iterator iter = projectData.sourceFiles.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); if (!this.sourceFiles.containsKey(key)) { this.sourceFiles.put(key, projectData.sourceFiles.get(key)); } } for (Iterator iter = projectData.classes.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); if (!this.classes.containsKey(key)) { this.classes.put(key, projectData.classes.get(key)); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
ProjectData projectData = getGlobalProjectData(); synchronized (projectData)
ProjectData projectDataToSave = globalProjectData; /* * The next statement is not necessary at the moment, because this method is only called * either at the very beginning or at the very end of a test. If the code is changed * to save more frequently, then this will become important. */ globalProjectData = new ProjectData(); /* * Now sleep a bit in case there is a thread still holding a reference to the "old" * globalProjectData (now referenced with projectDataToSave). * We want it to finish its updates. I assume 2 seconds is plenty of time. */ try
public static void saveGlobalProjectData() { ProjectData projectData = getGlobalProjectData(); synchronized (projectData) { CoverageDataFileHandler.saveCoverageData(projectData, CoverageDataFileHandler.getDefaultDataFile()); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
CoverageDataFileHandler.saveCoverageData(projectData, CoverageDataFileHandler.getDefaultDataFile());
Thread.sleep(1000);
public static void saveGlobalProjectData() { ProjectData projectData = getGlobalProjectData(); synchronized (projectData) { CoverageDataFileHandler.saveCoverageData(projectData, CoverageDataFileHandler.getDefaultDataFile()); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
catch (InterruptedException e) { } File dataFile = CoverageDataFileHandler.getDefaultDataFile(); FileLocker lock = new FileLocker(dataFile); if (lock.lock()) { ProjectData datafileProjectData = loadCoverageDataFromDatafile(dataFile); if (datafileProjectData == null) { datafileProjectData = projectDataToSave; } else { datafileProjectData.merge(projectDataToSave); } CoverageDataFileHandler.saveCoverageData(datafileProjectData, dataFile); } lock.release();
public static void saveGlobalProjectData() { ProjectData projectData = getGlobalProjectData(); synchronized (projectData) { CoverageDataFileHandler.saveCoverageData(projectData, CoverageDataFileHandler.getDefaultDataFile()); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/55571e8b292791cc80dd02e2bed0dfd9f206376b/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
mainContainer.add(p); mainContainer.add(WFUtil.getBreak());
p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
p = WFPanelUtil.getPlainFormPanel(1);
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") ));
p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionId"));
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
mainContainer.add(p); mainContainer.add(WFUtil.getBreak());
p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
p = WFPanelUtil.getFormPanel(2);
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
mainContainer.add(p);
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
mainContainer.add(p); mainContainer.add(WFUtil.getBreak());
p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
p = WFPanelUtil.getPlainFormPanel(1);
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);
HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save");
public UIComponent getEditContainer() { WFUtilArticle localizer = WFUtilArticle.getWFUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(40); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "440px", "30px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(22); p.getChildren().add(authorInput); p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "100%", "400px"); bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); bodyArea.setAllowFontSelection(false); HtmlCommandButton editButton = localizer.getButtonVB(EDIT_HTML_ID, "edit"); editButton.setOnclick("wurl='htmlarea/webface/htmledit.jsp?" + PREVIEW_ARTICLE_ITEM_ID + "='+this.tabindex;window.open(wurl,'Edit','height=450,width=600,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');return false;"); p.getChildren().add(WFUtil.group(WFUtil.group(bodyArea, WFUtil.getBreak()), editButton));/* WFContainer imageContainer = new WFContainer(); imageContainer.add(WFUtil.getButtonVB(ADD_IMAGE_ID, bref + "add_image", this)); imageContainer.add(WFUtil.getBreak()); imageContainer.add(getImageList()); p.getChildren().add(imageContainer); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "source"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "main_category"), WFUtil.getText(":"))); HtmlInputTextarea sourceArea = WFUtil.getTextArea(SOURCE_ID, ref + "source", "440px", "30px"); p.getChildren().add(sourceArea); HtmlSelectOneMenu mainCategoryMenu = WFUtil.getSelectOneMenu(MAIN_CATEGORY_ID, ref + "categories", ref + "mainCategoryId"); p.getChildren().add(mainCategoryMenu); */ mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/ p.getChildren().add(WFUtil.getText(" ")); UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": ")); t.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(t); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getTextVB(ref + "versionId") )); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "400px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); mainContainer.add(p); mainContainer.add(WFUtil.getBreak()); p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); p.getChildren().add(WFUtil.group(localizer.getTextVB("category"), WFUtil.getText(":"))); HtmlInputText categoryInput = WFUtil.getInputText(MAIN_CATEGORY_ID, ref + "mainCategory"); if(null==categoryInput.getValue() || "".equals(categoryInput.getValue())) { categoryInput.setValue(ROOT_CATEGORY); } categoryInput.setSize(40); p.getChildren().add(categoryInput); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); FileUploadForm f = new FileUploadForm(); f.setId(FILE_UPLOAD_FORM_ID); editorSelector.add(f); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/fdb093b346b26ca405d1fd2c2138d5eb605ebade/EditArticleBlock.java/clean/src/java/com/idega/block/article/component/EditArticleBlock.java
controllers = new Controllers(this); listener = new Listener(controllers);
Dispatcher dispatcher = new Dispatcher(this); listener = new Listener(dispatcher);
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document Note root = new Note("root", null, ""); document = new Document(root); // Controllers controllers = new Controllers(this); // Listener listener = new Listener(controllers); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(shell, sashForm, listener); tree.loadTree(root); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); sashForm.setWeights(new int[] {20, 80}); }
57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/18ce9cf33f3e06fda4addd57f5ae5c9423a990fb/DisplayedDocument.java/clean/trunk/src/de/berlios/koalanotes/display/DisplayedDocument.java
tree = new NoteTree(shell, sashForm, listener);
tree = new NoteTree(sashForm, listener);
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document Note root = new Note("root", null, ""); document = new Document(root); // Controllers controllers = new Controllers(this); // Listener listener = new Listener(controllers); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(shell, sashForm, listener); tree.loadTree(root); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); sashForm.setWeights(new int[] {20, 80}); }
57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/18ce9cf33f3e06fda4addd57f5ae5c9423a990fb/DisplayedDocument.java/clean/trunk/src/de/berlios/koalanotes/display/DisplayedDocument.java
if (event==null) return null; if (!event.isLoaded()) return null; if (event.getTime()==null) return null;
if (event==null || !event.isLoaded() || event.getTime()==null) { return new Timestamp( new Date().getTime() ); }
protected Timestamp timeOfEvent( Event event ) { if (event==null) return null; if (!event.isLoaded()) return null; if (event.getTime()==null) return null; return new Timestamp( event.getTime().getTime() ); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/af34941053c1f949ddffc6dfb6138b54c60f81c1/DataObject.java/buggy/components/client/src/pojos/DataObject.java
iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
CreateJumpTargetVisitor.setJumpTarget(newMethod, iVisited.getBodyNode());
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); // if no block passed, do a simple call if (iterNode == null) { return receiver.callMethod(context, iVisited.getName(), args, callType); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return receiver.callMethod(context, iVisited.getName(), args, callType); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass rubyClass; if (receiver.isNil()) { rubyClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { rubyClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { rubyClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } rubyClass = receiver.getSingletonClass(); } if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); // if no block passed, do a simple call if (iterNode == null) { return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return iVisited.getFixnum(runtime); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(context, iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; // new-style handling of blocks, for nodes that support it // don't process the block until it's needed, to avoid nasty iter tricks if (iVisited.getIterNode() instanceof BlockAcceptingNode) { ((BlockAcceptingNode)iVisited.getIterNode()).setIterNode(iVisited); node = iVisited.getIterNode(); continue bigloop; } // otherwise do it the same as the old way context.preIterEval(Block.createBlock(context, iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } try { return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } catch(java.util.regex.PatternSyntaxException e) { throw runtime.newSyntaxError(e.getMessage()); } } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("Superclass method '" + name + "' disabled.", name); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("superclass method '" + name + "' disabled", name); } return context.callSuper(context.getFrameArgs(), true); } } } while (true); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/bf9566bc66503df4ccccadc79d302823756a1ae4/EvaluationState.java/buggy/src/org/jruby/evaluator/EvaluationState.java
iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod));
CreateJumpTargetVisitor.setJumpTarget(newMethod, iVisited.getBodyNode());
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); // if no block passed, do a simple call if (iterNode == null) { return receiver.callMethod(context, iVisited.getName(), args, callType); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return receiver.callMethod(context, iVisited.getName(), args, callType); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass rubyClass; if (receiver.isNil()) { rubyClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { rubyClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { rubyClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } rubyClass = receiver.getSingletonClass(); } if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); // if no block passed, do a simple call if (iterNode == null) { return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return iVisited.getFixnum(runtime); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(context, iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; // new-style handling of blocks, for nodes that support it // don't process the block until it's needed, to avoid nasty iter tricks if (iVisited.getIterNode() instanceof BlockAcceptingNode) { ((BlockAcceptingNode)iVisited.getIterNode()).setIterNode(iVisited); node = iVisited.getIterNode(); continue bigloop; } // otherwise do it the same as the old way context.preIterEval(Block.createBlock(context, iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } try { return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } catch(java.util.regex.PatternSyntaxException e) { throw runtime.newSyntaxError(e.getMessage()); } } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("Superclass method '" + name + "' disabled.", name); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("superclass method '" + name + "' disabled", name); } return context.callSuper(context.getFrameArgs(), true); } } } while (true); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/bf9566bc66503df4ccccadc79d302823756a1ae4/EvaluationState.java/buggy/src/org/jruby/evaluator/EvaluationState.java
assertTrue(new File(jsDir, "percentagesorttype.js").isFile());
assertTrue(new File(jsDir, "customsorttypes.js").isFile());
public static void testCopy() throws IOException { CopyFiles.copy(tmpDir); assertTrue(new File(tmpDir, "help.html").isFile()); assertTrue(new File(tmpDir, "index.html").isFile()); File cssDir = new File(tmpDir, "css"); assertTrue(cssDir.isDirectory()); assertTrue(new File(cssDir, "help.css").isFile()); assertTrue(new File(cssDir, "main.css").isFile()); assertTrue(new File(cssDir, "sortabletable.css").isFile()); assertTrue(new File(cssDir, "source-viewer.css").isFile()); assertTrue(new File(cssDir, "tooltip.css").isFile()); File imagesDir = new File(tmpDir, "images"); assertTrue(imagesDir.isDirectory()); assertTrue(new File(imagesDir, "blank.png").isFile()); assertTrue(new File(imagesDir, "downsimple.png").isFile()); assertTrue(new File(imagesDir, "upsimple.png").isFile()); File jsDir = new File(tmpDir, "js"); assertTrue(jsDir.isDirectory()); assertTrue(new File(jsDir, "percentagesorttype.js").isFile()); assertTrue(new File(jsDir, "popup.js").isFile()); assertTrue(new File(jsDir, "sortabletable.js").isFile()); assertTrue(new File(jsDir, "stringbuilder.js").isFile()); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8aa2b024b47f24f410d25e5d8eb53673520a571e/CopyFilesTest.java/clean/cobertura/test/net/sourceforge/cobertura/reporting/html/files/CopyFilesTest.java
arrayClass.defineMethod("==", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class));
arrayClass.defineMethod("==", callbackFactory.getMethod(RubyArray.class, "array_op_equal", IRubyObject.class));
public static RubyClass createArrayClass(Ruby ruby) { RubyClass arrayClass = ruby.defineClass("Array", ruby.getClasses().getObjectClass()); arrayClass.includeModule(ruby.getModule("Enumerable")); CallbackFactory callbackFactory = ruby.callbackFactory(); arrayClass.defineSingletonMethod("new", callbackFactory.getOptSingletonMethod(RubyArray.class, "newInstance")); arrayClass.defineSingletonMethod("[]", callbackFactory.getOptSingletonMethod(RubyArray.class, "create")); arrayClass.defineMethod("initialize", callbackFactory.getOptMethod(RubyArray.class, "initialize")); arrayClass.defineMethod("inspect", callbackFactory.getMethod(RubyArray.class, "inspect")); arrayClass.defineMethod("to_s", callbackFactory.getMethod(RubyArray.class, "to_s")); arrayClass.defineMethod("to_a", callbackFactory.getSelfMethod(0)); arrayClass.defineMethod("to_ary", callbackFactory.getSelfMethod(0)); arrayClass.defineMethod("frozen?", callbackFactory.getMethod(RubyArray.class, "frozen")); arrayClass.defineMethod("==", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class)); arrayClass.defineMethod("eql?", callbackFactory.getMethod(RubyArray.class, "eql", IRubyObject.class)); arrayClass.defineMethod("===", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class)); arrayClass.defineMethod("hash", callbackFactory.getMethod(RubyArray.class, "hash")); arrayClass.defineMethod("[]", callbackFactory.getOptMethod(RubyArray.class, "aref")); arrayClass.defineMethod("[]=", callbackFactory.getOptMethod(RubyArray.class, "aset")); arrayClass.defineMethod("at", callbackFactory.getMethod(RubyArray.class, "at", RubyNumeric.class)); arrayClass.defineMethod("fetch", callbackFactory.getOptMethod(RubyArray.class, "fetch", RubyNumeric.class)); arrayClass.defineMethod("first", callbackFactory.getOptMethod(RubyArray.class, "first")); arrayClass.defineMethod("insert", callbackFactory.getOptMethod(RubyArray.class, "insert", RubyNumeric.class)); arrayClass.defineMethod("last", callbackFactory.getMethod(RubyArray.class, "last")); arrayClass.defineMethod("concat", callbackFactory.getMethod(RubyArray.class, "concat", IRubyObject.class)); arrayClass.defineMethod("<<", callbackFactory.getMethod(RubyArray.class, "append", IRubyObject.class)); arrayClass.defineMethod("push", callbackFactory.getOptMethod(RubyArray.class, "push")); arrayClass.defineMethod("pop", callbackFactory.getMethod(RubyArray.class, "pop")); arrayClass.defineMethod("shift", callbackFactory.getMethod(RubyArray.class, "shift")); arrayClass.defineMethod("unshift", callbackFactory.getOptMethod(RubyArray.class, "unshift")); arrayClass.defineMethod("each", callbackFactory.getMethod(RubyArray.class, "each")); arrayClass.defineMethod("each_index", callbackFactory.getMethod(RubyArray.class, "each_index")); arrayClass.defineMethod("reverse_each", callbackFactory.getMethod(RubyArray.class, "reverse_each")); arrayClass.defineMethod("length", callbackFactory.getMethod(RubyArray.class, "length")); arrayClass.defineMethod("size", callbackFactory.getMethod(RubyArray.class, "length")); arrayClass.defineMethod("empty?", callbackFactory.getMethod(RubyArray.class, "empty_p")); arrayClass.defineMethod("index", callbackFactory.getMethod(RubyArray.class, "index", IRubyObject.class)); arrayClass.defineMethod("rindex", callbackFactory.getMethod(RubyArray.class, "rindex", IRubyObject.class)); arrayClass.defineMethod("indexes", callbackFactory.getOptMethod(RubyArray.class, "indices")); arrayClass.defineMethod("indices", callbackFactory.getOptMethod(RubyArray.class, "indices")); arrayClass.defineMethod("clone", callbackFactory.getMethod(RubyArray.class, "rbClone")); arrayClass.defineMethod("join", callbackFactory.getOptMethod(RubyArray.class, "join")); arrayClass.defineMethod("reverse", callbackFactory.getMethod(RubyArray.class, "reverse")); arrayClass.defineMethod("reverse!", callbackFactory.getMethod(RubyArray.class, "reverse_bang")); arrayClass.defineMethod("sort", callbackFactory.getMethod(RubyArray.class, "sort")); arrayClass.defineMethod("sort!", callbackFactory.getMethod(RubyArray.class, "sort_bang")); arrayClass.defineMethod("transpose", callbackFactory.getMethod(RubyArray.class, "transpose")); arrayClass.defineMethod("values_at", callbackFactory.getOptMethod(RubyArray.class, "values_at")); arrayClass.defineMethod("collect", callbackFactory.getMethod(RubyArray.class, "collect")); arrayClass.defineMethod("collect!", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("map!", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("filter", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("delete", callbackFactory.getMethod(RubyArray.class, "delete", IRubyObject.class)); arrayClass.defineMethod("delete_at", callbackFactory.getMethod(RubyArray.class, "delete_at", IRubyObject.class)); arrayClass.defineMethod("delete_if", callbackFactory.getMethod(RubyArray.class, "delete_if")); arrayClass.defineMethod("reject!", callbackFactory.getMethod(RubyArray.class, "reject_bang")); arrayClass.defineMethod("replace", callbackFactory.getMethod(RubyArray.class, "replace", IRubyObject.class)); arrayClass.defineMethod("clear", callbackFactory.getMethod(RubyArray.class, "clear")); arrayClass.defineMethod("fill", callbackFactory.getOptMethod(RubyArray.class, "fill")); arrayClass.defineMethod("include?", callbackFactory.getMethod(RubyArray.class, "include_p", IRubyObject.class)); arrayClass.defineMethod("<=>", callbackFactory.getMethod(RubyArray.class, "op_cmp", IRubyObject.class)); arrayClass.defineMethod("slice", callbackFactory.getOptMethod(RubyArray.class, "aref")); arrayClass.defineMethod("slice!", callbackFactory.getOptMethod(RubyArray.class, "slice_bang")); arrayClass.defineMethod("assoc", callbackFactory.getMethod(RubyArray.class, "assoc", IRubyObject.class)); arrayClass.defineMethod("rassoc", callbackFactory.getMethod(RubyArray.class, "rassoc", IRubyObject.class)); arrayClass.defineMethod("+", callbackFactory.getMethod(RubyArray.class, "op_plus", IRubyObject.class)); arrayClass.defineMethod("*", callbackFactory.getMethod(RubyArray.class, "op_times", IRubyObject.class)); arrayClass.defineMethod("-", callbackFactory.getMethod(RubyArray.class, "op_diff", IRubyObject.class)); arrayClass.defineMethod("&", callbackFactory.getMethod(RubyArray.class, "op_and", IRubyObject.class)); arrayClass.defineMethod("|", callbackFactory.getMethod(RubyArray.class, "op_or", IRubyObject.class)); arrayClass.defineMethod("uniq", callbackFactory.getMethod(RubyArray.class, "uniq")); arrayClass.defineMethod("uniq!", callbackFactory.getMethod(RubyArray.class, "uniq_bang")); arrayClass.defineMethod("compact", callbackFactory.getMethod(RubyArray.class, "compact")); arrayClass.defineMethod("compact!", callbackFactory.getMethod(RubyArray.class, "compact_bang")); arrayClass.defineMethod("flatten", callbackFactory.getMethod(RubyArray.class, "flatten")); arrayClass.defineMethod("flatten!", callbackFactory.getMethod(RubyArray.class, "flatten_bang")); arrayClass.defineMethod("nitems", callbackFactory.getMethod(RubyArray.class, "nitems")); arrayClass.defineMethod("pack", callbackFactory.getMethod(RubyArray.class, "pack", IRubyObject.class)); return arrayClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/72f0d4f6effb0bc3fc4af34ad92e81593b8ff47a/RubyArray.java/buggy/src/org/jruby/RubyArray.java
arrayClass.defineMethod("===", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class));
arrayClass.defineMethod("===", callbackFactory.getMethod(RubyArray.class, "array_op_equal", IRubyObject.class));
public static RubyClass createArrayClass(Ruby ruby) { RubyClass arrayClass = ruby.defineClass("Array", ruby.getClasses().getObjectClass()); arrayClass.includeModule(ruby.getModule("Enumerable")); CallbackFactory callbackFactory = ruby.callbackFactory(); arrayClass.defineSingletonMethod("new", callbackFactory.getOptSingletonMethod(RubyArray.class, "newInstance")); arrayClass.defineSingletonMethod("[]", callbackFactory.getOptSingletonMethod(RubyArray.class, "create")); arrayClass.defineMethod("initialize", callbackFactory.getOptMethod(RubyArray.class, "initialize")); arrayClass.defineMethod("inspect", callbackFactory.getMethod(RubyArray.class, "inspect")); arrayClass.defineMethod("to_s", callbackFactory.getMethod(RubyArray.class, "to_s")); arrayClass.defineMethod("to_a", callbackFactory.getSelfMethod(0)); arrayClass.defineMethod("to_ary", callbackFactory.getSelfMethod(0)); arrayClass.defineMethod("frozen?", callbackFactory.getMethod(RubyArray.class, "frozen")); arrayClass.defineMethod("==", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class)); arrayClass.defineMethod("eql?", callbackFactory.getMethod(RubyArray.class, "eql", IRubyObject.class)); arrayClass.defineMethod("===", callbackFactory.getMethod(RubyArray.class, "equal", IRubyObject.class)); arrayClass.defineMethod("hash", callbackFactory.getMethod(RubyArray.class, "hash")); arrayClass.defineMethod("[]", callbackFactory.getOptMethod(RubyArray.class, "aref")); arrayClass.defineMethod("[]=", callbackFactory.getOptMethod(RubyArray.class, "aset")); arrayClass.defineMethod("at", callbackFactory.getMethod(RubyArray.class, "at", RubyNumeric.class)); arrayClass.defineMethod("fetch", callbackFactory.getOptMethod(RubyArray.class, "fetch", RubyNumeric.class)); arrayClass.defineMethod("first", callbackFactory.getOptMethod(RubyArray.class, "first")); arrayClass.defineMethod("insert", callbackFactory.getOptMethod(RubyArray.class, "insert", RubyNumeric.class)); arrayClass.defineMethod("last", callbackFactory.getMethod(RubyArray.class, "last")); arrayClass.defineMethod("concat", callbackFactory.getMethod(RubyArray.class, "concat", IRubyObject.class)); arrayClass.defineMethod("<<", callbackFactory.getMethod(RubyArray.class, "append", IRubyObject.class)); arrayClass.defineMethod("push", callbackFactory.getOptMethod(RubyArray.class, "push")); arrayClass.defineMethod("pop", callbackFactory.getMethod(RubyArray.class, "pop")); arrayClass.defineMethod("shift", callbackFactory.getMethod(RubyArray.class, "shift")); arrayClass.defineMethod("unshift", callbackFactory.getOptMethod(RubyArray.class, "unshift")); arrayClass.defineMethod("each", callbackFactory.getMethod(RubyArray.class, "each")); arrayClass.defineMethod("each_index", callbackFactory.getMethod(RubyArray.class, "each_index")); arrayClass.defineMethod("reverse_each", callbackFactory.getMethod(RubyArray.class, "reverse_each")); arrayClass.defineMethod("length", callbackFactory.getMethod(RubyArray.class, "length")); arrayClass.defineMethod("size", callbackFactory.getMethod(RubyArray.class, "length")); arrayClass.defineMethod("empty?", callbackFactory.getMethod(RubyArray.class, "empty_p")); arrayClass.defineMethod("index", callbackFactory.getMethod(RubyArray.class, "index", IRubyObject.class)); arrayClass.defineMethod("rindex", callbackFactory.getMethod(RubyArray.class, "rindex", IRubyObject.class)); arrayClass.defineMethod("indexes", callbackFactory.getOptMethod(RubyArray.class, "indices")); arrayClass.defineMethod("indices", callbackFactory.getOptMethod(RubyArray.class, "indices")); arrayClass.defineMethod("clone", callbackFactory.getMethod(RubyArray.class, "rbClone")); arrayClass.defineMethod("join", callbackFactory.getOptMethod(RubyArray.class, "join")); arrayClass.defineMethod("reverse", callbackFactory.getMethod(RubyArray.class, "reverse")); arrayClass.defineMethod("reverse!", callbackFactory.getMethod(RubyArray.class, "reverse_bang")); arrayClass.defineMethod("sort", callbackFactory.getMethod(RubyArray.class, "sort")); arrayClass.defineMethod("sort!", callbackFactory.getMethod(RubyArray.class, "sort_bang")); arrayClass.defineMethod("transpose", callbackFactory.getMethod(RubyArray.class, "transpose")); arrayClass.defineMethod("values_at", callbackFactory.getOptMethod(RubyArray.class, "values_at")); arrayClass.defineMethod("collect", callbackFactory.getMethod(RubyArray.class, "collect")); arrayClass.defineMethod("collect!", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("map!", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("filter", callbackFactory.getMethod(RubyArray.class, "collect_bang")); arrayClass.defineMethod("delete", callbackFactory.getMethod(RubyArray.class, "delete", IRubyObject.class)); arrayClass.defineMethod("delete_at", callbackFactory.getMethod(RubyArray.class, "delete_at", IRubyObject.class)); arrayClass.defineMethod("delete_if", callbackFactory.getMethod(RubyArray.class, "delete_if")); arrayClass.defineMethod("reject!", callbackFactory.getMethod(RubyArray.class, "reject_bang")); arrayClass.defineMethod("replace", callbackFactory.getMethod(RubyArray.class, "replace", IRubyObject.class)); arrayClass.defineMethod("clear", callbackFactory.getMethod(RubyArray.class, "clear")); arrayClass.defineMethod("fill", callbackFactory.getOptMethod(RubyArray.class, "fill")); arrayClass.defineMethod("include?", callbackFactory.getMethod(RubyArray.class, "include_p", IRubyObject.class)); arrayClass.defineMethod("<=>", callbackFactory.getMethod(RubyArray.class, "op_cmp", IRubyObject.class)); arrayClass.defineMethod("slice", callbackFactory.getOptMethod(RubyArray.class, "aref")); arrayClass.defineMethod("slice!", callbackFactory.getOptMethod(RubyArray.class, "slice_bang")); arrayClass.defineMethod("assoc", callbackFactory.getMethod(RubyArray.class, "assoc", IRubyObject.class)); arrayClass.defineMethod("rassoc", callbackFactory.getMethod(RubyArray.class, "rassoc", IRubyObject.class)); arrayClass.defineMethod("+", callbackFactory.getMethod(RubyArray.class, "op_plus", IRubyObject.class)); arrayClass.defineMethod("*", callbackFactory.getMethod(RubyArray.class, "op_times", IRubyObject.class)); arrayClass.defineMethod("-", callbackFactory.getMethod(RubyArray.class, "op_diff", IRubyObject.class)); arrayClass.defineMethod("&", callbackFactory.getMethod(RubyArray.class, "op_and", IRubyObject.class)); arrayClass.defineMethod("|", callbackFactory.getMethod(RubyArray.class, "op_or", IRubyObject.class)); arrayClass.defineMethod("uniq", callbackFactory.getMethod(RubyArray.class, "uniq")); arrayClass.defineMethod("uniq!", callbackFactory.getMethod(RubyArray.class, "uniq_bang")); arrayClass.defineMethod("compact", callbackFactory.getMethod(RubyArray.class, "compact")); arrayClass.defineMethod("compact!", callbackFactory.getMethod(RubyArray.class, "compact_bang")); arrayClass.defineMethod("flatten", callbackFactory.getMethod(RubyArray.class, "flatten")); arrayClass.defineMethod("flatten!", callbackFactory.getMethod(RubyArray.class, "flatten_bang")); arrayClass.defineMethod("nitems", callbackFactory.getMethod(RubyArray.class, "nitems")); arrayClass.defineMethod("pack", callbackFactory.getMethod(RubyArray.class, "pack", IRubyObject.class)); return arrayClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/72f0d4f6effb0bc3fc4af34ad92e81593b8ff47a/RubyArray.java/buggy/src/org/jruby/RubyArray.java
if (argc != 0) len = RubyNumeric.fix2long(args[0]);
if (argc != 0) { if (args[0] instanceof RubyNumeric) { len = RubyNumeric.fix2long(args[0]); } else if (args[0] instanceof RubyArray) { arrayInitializer = (RubyArray)args[0]; } }
public IRubyObject initialize(IRubyObject[] args) { int argc = argCount(args, 0, 2); long len = 0; if (argc != 0) len = RubyNumeric.fix2long(args[0]); modify(); if (len < 0) { throw new ArgumentError(getRuntime(), "negative array size"); } if (len > Integer.MAX_VALUE) { throw new ArgumentError(getRuntime(), "array size too big"); } list = new ArrayList((int) len); if (len > 0) { IRubyObject obj = (argc == 2) ? args[1] : getRuntime().getNil(); Collections.fill(list, obj); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/72f0d4f6effb0bc3fc4af34ad92e81593b8ff47a/RubyArray.java/buggy/src/org/jruby/RubyArray.java
IRubyObject obj = (argc == 2) ? args[1] : getRuntime().getNil(); Collections.fill(list, obj);
if (runtime.isBlockGiven()) { for (int i = 0; i < len; i++) { list.add(runtime.yield(new RubyFixnum(runtime, i))); } } else { IRubyObject obj = (argc == 2) ? args[1] : getRuntime().getNil(); list.addAll(Collections.nCopies((int)len, obj)); }
public IRubyObject initialize(IRubyObject[] args) { int argc = argCount(args, 0, 2); long len = 0; if (argc != 0) len = RubyNumeric.fix2long(args[0]); modify(); if (len < 0) { throw new ArgumentError(getRuntime(), "negative array size"); } if (len > Integer.MAX_VALUE) { throw new ArgumentError(getRuntime(), "array size too big"); } list = new ArrayList((int) len); if (len > 0) { IRubyObject obj = (argc == 2) ? args[1] : getRuntime().getNil(); Collections.fill(list, obj); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/72f0d4f6effb0bc3fc4af34ad92e81593b8ff47a/RubyArray.java/buggy/src/org/jruby/RubyArray.java
RubyClass arrayClass = getRuntime().getClasses().getArrayClass(); if (!other.isKindOf(arrayClass)) { throw new TypeError(getRuntime(), other, arrayClass); }
public IRubyObject op_and(IRubyObject other) { List ary1 = uniq(list); int len1 = ary1.size(); List ary2 = arrayValue(other).getList(); int len2 = ary2.size(); ArrayList ary3 = new ArrayList(len1); for (int i = 0; i < len1; i++) { IRubyObject obj = (IRubyObject) ary1.get(i); for (int j = 0; j < len2; j++) { if (obj.callMethod("eql?", (IRubyObject) ary2.get(j)).isTrue()) { ary3.add(obj); break; } } } ary3.trimToSize(); return new RubyArray(getRuntime(), ary3); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/72f0d4f6effb0bc3fc4af34ad92e81593b8ff47a/RubyArray.java/buggy/src/org/jruby/RubyArray.java
tsm.putImageData((Image)iter.next());
tsm.putImageData((ImageData)iter.next());
public void loadInto(DatasetData data, ThumbnailSourceModel tsm) { if(data == null || tsm == null) { // do nothing return; } List imageList; try { imageList = data.getImages(); } catch(DataException de) { fillInDatasetDTO(data); imageList = data.getImages(); } // now, suck the images into the TSM for(Iterator iter = imageList.iterator(); iter.hasNext();) { tsm.putImageData((Image)iter.next()); } // OK, now the image data will have a data model backing, but // perhaps no thumbnails. }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c398869c38ee45e9472e026b10f8c92555b7b882/DatasetLoader.java/clean/SRC/org/openmicroscopy/shoola/agents/browser/datamodel/DatasetLoader.java
public void putImageData(Image image)
public void putImageData(ImageData imageData)
public void putImageData(Image image) { if(image != null) { sourceMap.put(new Integer(image.getID()),image); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c398869c38ee45e9472e026b10f8c92555b7b882/ThumbnailSourceModel.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ThumbnailSourceModel.java
if(image != null)
if(imageData != null)
public void putImageData(Image image) { if(image != null) { sourceMap.put(new Integer(image.getID()),image); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c398869c38ee45e9472e026b10f8c92555b7b882/ThumbnailSourceModel.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ThumbnailSourceModel.java
sourceMap.put(new Integer(image.getID()),image);
sourceMap.put(new Integer(imageData.getID()),imageData);
public void putImageData(Image image) { if(image != null) { sourceMap.put(new Integer(image.getID()),image); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c398869c38ee45e9472e026b10f8c92555b7b882/ThumbnailSourceModel.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ThumbnailSourceModel.java
mockStateful.reset(); mockStateless.reset(); mockSession.reset(); mockFactory.reset(); mockTransaction.reset(); mockDataSource.reset(); mockConnection.reset(); mockInvocation.reset();
reset(mockStateful,mockStateless,mockSession,mockFactory,mockTransaction, mockDataSource,mockConnection,mockInvocation);
protected void tearDown() throws Exception { session = null; mockStateful.reset(); mockStateless.reset(); mockSession.reset(); mockFactory.reset(); mockTransaction.reset(); mockDataSource.reset(); mockConnection.reset(); mockInvocation.reset(); super.tearDown(); if (TransactionSynchronizationManager.isSynchronizationActive()) TransactionSynchronizationManager.clearSynchronization(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/609c3b121ade2206fddbd11591ffc1531a099c5d/SessionHandlerMockHibernateTest.java/clean/components/server/test/ome/server/utests/handlers/SessionHandlerMockHibernateTest.java
*/ moduleClass.defineMethod("remove_method", getMethod("remove_method", RubyObject.class, false)); moduleClass.defineMethod("undef_method", getMethod("undef_method", RubyObject.class, false)); moduleClass.defineMethod("alias_method", getMethod("alias_method", RubyObject.class, RubyObject.class));
*/ moduleClass.defineMethod("remove_method", getMethod("remove_method", RubyObject.class, false)); moduleClass.defineMethod("undef_method", getMethod("undef_method", RubyObject.class, false)); moduleClass.defineMethod("alias_method", getMethod("alias_method", RubyObject.class, RubyObject.class));
public static void initModuleClass(RubyClass moduleClass) { moduleClass.defineMethod("===", getMethod("op_eqq", RubyObject.class, false)); moduleClass.defineMethod("<=>", getMethod("op_cmp", RubyObject.class, false)); moduleClass.defineMethod("<", getMethod("op_lt", RubyObject.class, false)); moduleClass.defineMethod("<=", getMethod("op_le", RubyObject.class, false)); moduleClass.defineMethod(">", getMethod("op_gt", RubyObject.class, false)); moduleClass.defineMethod(">=", getMethod("op_ge", RubyObject.class, false)); moduleClass.defineMethod("clone", getMethod("m_clone", false)); moduleClass.defineMethod("dup", getMethod("m_dup", false)); moduleClass.defineMethod("to_s", getMethod("m_to_s", false)); moduleClass.defineMethod("included_modules", getMethod("m_included_modules", false)); moduleClass.defineMethod("name", getMethod("m_name", false)); moduleClass.defineMethod("ancestors", getMethod("m_ancestors", false)); moduleClass.definePrivateMethod("attr", getMethod("m_attr", RubySymbol.class, true)); moduleClass.definePrivateMethod("attr_reader", getMethod("m_attr_reader", true)); moduleClass.definePrivateMethod("attr_writer", getMethod("m_attr_writer", true)); moduleClass.definePrivateMethod("attr_accessor", getMethod("m_attr_accessor", true)); moduleClass.defineSingletonMethod("new", getSingletonMethod("m_new", false)); moduleClass.defineMethod("initialize", getMethod("m_initialize", true)); moduleClass.defineMethod("instance_methods", getMethod("m_instance_methods", true)); moduleClass.defineMethod("public_instance_methods", getMethod("m_instance_methods", true)); moduleClass.defineMethod("protected_instance_methods", getMethod("m_protected_instance_methods", true)); moduleClass.defineMethod("private_instance_methods", getMethod("m_private_instance_methods", true)); moduleClass.defineMethod("constants", getMethod("m_constants", false)); moduleClass.defineMethod("const_get", getMethod("m_const_get", RubySymbol.class, false)); moduleClass.defineMethod("const_set", getMethod("m_const_set", RubySymbol.class, RubyObject.class)); moduleClass.defineMethod("const_defined?", getMethod("m_const_defined", RubySymbol.class, false)); moduleClass.definePrivateMethod("method_added", getDummyMethod()); moduleClass.defineMethod("class_variables", getMethod("m_class_variables", false)); moduleClass.definePrivateMethod("remove_class_variable", getMethod("m_remove_class_variable", RubyObject.class, false)); moduleClass.definePrivateMethod("append_features", getMethod("m_remove_append_features", RubyModule.class, false)); moduleClass.definePrivateMethod("extend_object", getMethod("m_extend_object", RubyObject.class, false)); moduleClass.definePrivateMethod("include", getMethod("m_include", true)); moduleClass.definePrivateMethod("public", getMethod("m_public", true)); moduleClass.definePrivateMethod("protected", getMethod("m_protected", true)); moduleClass.definePrivateMethod("private", getMethod("m_private", true)); moduleClass.definePrivateMethod("module_function", getMethod("m_module_function", true)); moduleClass.defineMethod("method_defined?", getMethod("m_method_defined", RubyObject.class, false)); moduleClass.defineMethod("public_class_method", getMethod("m_public_class_method", true)); moduleClass.defineMethod("private_class_method", getMethod("m_private_class_method", true)); /* rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1); rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1); */ moduleClass.defineMethod("remove_method", getMethod("remove_method", RubyObject.class, false)); moduleClass.defineMethod("undef_method", getMethod("undef_method", RubyObject.class, false)); moduleClass.defineMethod("alias_method", getMethod("alias_method", RubyObject.class, RubyObject.class)); /*rb_define_private_method(rb_cModule, "define_method", rb_mod_define_method, -1); rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0); rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, 0);*/ }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0a7181933af700ea8025a4197f3a5ebcc08333c3/RbModule.java/clean/org/jruby/core/RbModule.java
setRolloverEnabled(true);
AnnotatedButton(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node"); parentNode = node; setBorder(BorderFactory.createEmptyBorder()); //No border around icon. setMargin(new Insets(0, 0, 0, 0));//Just to make sure button sz=icon sz. setOpaque(false); //B/c button=icon. setFocusPainted(false); //Don't paint focus box on top of icon. setRolloverEnabled(true); IconManager im = IconManager.getInstance(); setIcon(im.getIcon(IconManager.ANNOTATED_SMALL)); setRolloverIcon(im.getIcon(IconManager.ANNOTATED_SMALL_OVER)); setToolTipText(DESCRIPTION); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parentNode.fireAnnotation(); } }); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/58be91fb535c971d0bef1fde12344382b140273b/AnnotatedButton.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/browser/AnnotatedButton.java
setRolloverIcon(im.getIcon(IconManager.ANNOTATED_SMALL_OVER));
AnnotatedButton(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node"); parentNode = node; setBorder(BorderFactory.createEmptyBorder()); //No border around icon. setMargin(new Insets(0, 0, 0, 0));//Just to make sure button sz=icon sz. setOpaque(false); //B/c button=icon. setFocusPainted(false); //Don't paint focus box on top of icon. setRolloverEnabled(true); IconManager im = IconManager.getInstance(); setIcon(im.getIcon(IconManager.ANNOTATED_SMALL)); setRolloverIcon(im.getIcon(IconManager.ANNOTATED_SMALL_OVER)); setToolTipText(DESCRIPTION); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parentNode.fireAnnotation(); } }); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/58be91fb535c971d0bef1fde12344382b140273b/AnnotatedButton.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/browser/AnnotatedButton.java
final Frame currentFrame = runtime.getCurrentFrame(); final Block currentBlock = runtime.getBlockStack().getCurrent();
private static RubyThread startThread(final IRubyObject recv, final IRubyObject[] args, boolean callInit) { final Ruby runtime = recv.getRuntime(); if (! runtime.isBlockGiven()) { throw new ThreadError(runtime, "must be called with a block"); } final RubyThread result = new RubyThread(runtime, (RubyClass) recv); if (callInit) { result.callInit(args); } final RubyProc proc = RubyProc.newProc(runtime, runtime.getClasses().getProcClass()); final Frame currentFrame = runtime.getCurrentFrame(); final Block currentBlock = runtime.getBlockStack().getCurrent(); result.jvmThread = new Thread(new Runnable() { public void run() { ThreadContext context = runtime.getCurrentContext(); context.getFrameStack().push(currentFrame); context.getBlockStack().setCurrent(currentBlock); context.setCurrentThread(result); proc.call(args); } }); result.jvmThread.start(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1ceedf02ac15d7325cfcf505ca74f35c5bc4a258/RubyThread.java/clean/org/jruby/RubyThread.java
private static RubyThread startThread(final IRubyObject recv, final IRubyObject[] args, boolean callInit) { final Ruby runtime = recv.getRuntime(); if (! runtime.isBlockGiven()) { throw new ThreadError(runtime, "must be called with a block"); } final RubyThread result = new RubyThread(runtime, (RubyClass) recv); if (callInit) { result.callInit(args); } final RubyProc proc = RubyProc.newProc(runtime, runtime.getClasses().getProcClass()); final Frame currentFrame = runtime.getCurrentFrame(); final Block currentBlock = runtime.getBlockStack().getCurrent(); result.jvmThread = new Thread(new Runnable() { public void run() { ThreadContext context = runtime.getCurrentContext(); context.getFrameStack().push(currentFrame); context.getBlockStack().setCurrent(currentBlock); context.setCurrentThread(result); proc.call(args); } }); result.jvmThread.start(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1ceedf02ac15d7325cfcf505ca74f35c5bc4a258/RubyThread.java/clean/org/jruby/RubyThread.java
public void run() { ThreadContext context = runtime.getCurrentContext(); context.getFrameStack().push(currentFrame); context.getBlockStack().setCurrent(currentBlock); context.setCurrentThread(result); proc.call(args); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1ceedf02ac15d7325cfcf505ca74f35c5bc4a258/RubyThread.java/clean/org/jruby/RubyThread.java
Thread.sleep((long) (seconds.getDoubleValue() * 1000.0));
Thread.sleep(milliseconds);
public static IRubyObject sleep(IRubyObject recv, RubyNumeric seconds) { try { Thread.sleep((long) (seconds.getDoubleValue() * 1000.0)); } catch (InterruptedException iExcptn) { } return recv; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe758a7c8ed9be7b679b8aef938333d27e876035/KernelModule.java/clean/src/org/jruby/KernelModule.java
return recv;
return RubyFixnum.newFixnum(recv.getRuntime(), Math.round(((double)(System.currentTimeMillis() - currentTime))/1000));
public static IRubyObject sleep(IRubyObject recv, RubyNumeric seconds) { try { Thread.sleep((long) (seconds.getDoubleValue() * 1000.0)); } catch (InterruptedException iExcptn) { } return recv; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/fe758a7c8ed9be7b679b8aef938333d27e876035/KernelModule.java/clean/src/org/jruby/KernelModule.java
JavaObject javaArgument = (JavaObject) argument; if (javaArgument.isJavaNull()) {
argument = ((JavaObject) argument).getValue(); if (argument == null) {
public static Object convertArgument(Object argument, Class parameterType) { if (argument instanceof JavaObject) { JavaObject javaArgument = (JavaObject) argument; if (javaArgument.isJavaNull()) { return null; } argument = javaArgument.getValue(); } Class type = primitiveToWrapper(parameterType); if (type == Void.class) { return null; } if (argument instanceof Number) { final Number number = (Number) argument; if (type == Long.class) { return new Long(number.longValue()); } else if (type == Integer.class) { return new Integer(number.intValue()); } else if (type == Short.class) { return new Short(number.shortValue()); } else if (type == Byte.class) { return new Byte(number.byteValue()); } else if (type == Character.class) { return new Character((char) number.intValue()); } else if (type == Double.class) { return new Double(number.doubleValue()); } else if (type == Float.class) { return new Float(number.floatValue()); } } return argument; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/206c7b0b7eb0c58d4a00f4aaa94c9013ad204adc/JavaUtil.java/buggy/src/org/jruby/javasupport/JavaUtil.java
argument = javaArgument.getValue();
public static Object convertArgument(Object argument, Class parameterType) { if (argument instanceof JavaObject) { JavaObject javaArgument = (JavaObject) argument; if (javaArgument.isJavaNull()) { return null; } argument = javaArgument.getValue(); } Class type = primitiveToWrapper(parameterType); if (type == Void.class) { return null; } if (argument instanceof Number) { final Number number = (Number) argument; if (type == Long.class) { return new Long(number.longValue()); } else if (type == Integer.class) { return new Integer(number.intValue()); } else if (type == Short.class) { return new Short(number.shortValue()); } else if (type == Byte.class) { return new Byte(number.byteValue()); } else if (type == Character.class) { return new Character((char) number.intValue()); } else if (type == Double.class) { return new Double(number.doubleValue()); } else if (type == Float.class) { return new Float(number.floatValue()); } } return argument; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/206c7b0b7eb0c58d4a00f4aaa94c9013ad204adc/JavaUtil.java/buggy/src/org/jruby/javasupport/JavaUtil.java
private void addInstrumentation(File file)
private void addInstrumentation(FileInfo fileInfo)
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
if (isClass(file))
if (fileInfo.isClass() && shouldInstrument(fileInfo.pathname))
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
addInstrumentationToSingleClass(file);
addInstrumentationToSingleClass(fileInfo);
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
else if (file.isDirectory())
else if (fileInfo.isDirectory())
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
File[] contents = file.listFiles();
String[] contents = fileInfo.list();
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
addInstrumentation(contents[i]);
{ File relativeFile = new File(fileInfo.pathname, contents[i]); FileInfo relativeFileInfo = new FileInfo(fileInfo.baseDir, relativeFile.toString()); addInstrumentation(relativeFileInfo); }
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
if (isClass(entry))
if (isClass(entry) && shouldInstrument(entry.getName()))
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegexes); cr.accept(cv, CustomAttribute.getExtraAttributes(), false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumented entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
private static boolean isClass(File file)
private static boolean isClass(ZipEntry entry)
private static boolean isClass(File file) { return file.getName().endsWith(".class"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
return file.getName().endsWith(".class");
return entry.getName().endsWith(".class");
private static boolean isClass(File file) { return file.getName().endsWith(".class"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); }
addRegex(ignoreRegexes, args[++i]);
private void parseArguments(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Parse our parameters List filePaths = new ArrayList(); String baseDir = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) baseDir = args[++i]; else if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--destination")) destinationDirectory = new File(args[++i]); else if (args[i].equals("--ignore")) { String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); } } else { filePaths.add(new File(baseDir, args[i])); } } // Load coverage data if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); // Instrument classes System.out.println("Instrumenting " + filePaths.size() + " " + (filePaths.size() == 1 ? "class" : "classes") + (destinationDirectory != null ? " to " + destinationDirectory.getAbsoluteFile() : "")); Iterator iter = filePaths.iterator(); while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file); } } // Save coverage data CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
else { filePaths.add(new File(baseDir, args[i]));
else if (args[i].equals("--includeClasses")) { addRegex(includeClassesRegexes, args[++i]); } else if (args[i].equals("--excludeClasses")) { addRegex(excludeClassesRegexes, args[++i]); } else { FileInfo fileInfo = new FileInfo(baseDir, args[i]); filePaths.add(fileInfo);
private void parseArguments(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Parse our parameters List filePaths = new ArrayList(); String baseDir = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) baseDir = args[++i]; else if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--destination")) destinationDirectory = new File(args[++i]); else if (args[i].equals("--ignore")) { String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); } } else { filePaths.add(new File(baseDir, args[i])); } } // Load coverage data if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); // Instrument classes System.out.println("Instrumenting " + filePaths.size() + " " + (filePaths.size() == 1 ? "class" : "classes") + (destinationDirectory != null ? " to " + destinationDirectory.getAbsoluteFile() : "")); Iterator iter = filePaths.iterator(); while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file); } } // Save coverage data CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
private void parseArguments(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Parse our parameters List filePaths = new ArrayList(); String baseDir = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) baseDir = args[++i]; else if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--destination")) destinationDirectory = new File(args[++i]); else if (args[i].equals("--ignore")) { String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); } } else { filePaths.add(new File(baseDir, args[i])); } } // Load coverage data if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); // Instrument classes System.out.println("Instrumenting " + filePaths.size() + " " + (filePaths.size() == 1 ? "class" : "classes") + (destinationDirectory != null ? " to " + destinationDirectory.getAbsoluteFile() : "")); Iterator iter = filePaths.iterator(); while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file); } } // Save coverage data CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
+ (filePaths.size() == 1 ? "class" : "classes")
+ (filePaths.size() == 1 ? "file" : "files")
private void parseArguments(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Parse our parameters List filePaths = new ArrayList(); String baseDir = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) baseDir = args[++i]; else if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--destination")) destinationDirectory = new File(args[++i]); else if (args[i].equals("--ignore")) { String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); } } else { filePaths.add(new File(baseDir, args[i])); } } // Load coverage data if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); // Instrument classes System.out.println("Instrumenting " + filePaths.size() + " " + (filePaths.size() == 1 ? "class" : "classes") + (destinationDirectory != null ? " to " + destinationDirectory.getAbsoluteFile() : "")); Iterator iter = filePaths.iterator(); while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file); } } // Save coverage data CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file);
while (iter.hasNext()) { FileInfo fileInfo = (FileInfo)iter.next(); if (fileInfo.isArchive()) { addInstrumentationToArchive(fileInfo); } else { addInstrumentation(fileInfo);
private void parseArguments(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); // Parse our parameters List filePaths = new ArrayList(); String baseDir = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) baseDir = args[++i]; else if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--destination")) destinationDirectory = new File(args[++i]); else if (args[i].equals("--ignore")) { String regex = args[++i]; try { Perl5Compiler pc = new Perl5Compiler(); this.ignoreRegexes.add(pc.compile(regex)); } catch (MalformedPatternException e) { logger.warn("The regular expression " + regex + " is invalid: " + e.getLocalizedMessage()); } } else { filePaths.add(new File(baseDir, args[i])); } } // Load coverage data if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); // Instrument classes System.out.println("Instrumenting " + filePaths.size() + " " + (filePaths.size() == 1 ? "class" : "classes") + (destinationDirectory != null ? " to " + destinationDirectory.getAbsoluteFile() : "")); Iterator iter = filePaths.iterator(); while (iter.hasNext()) { File file = (File)iter.next(); if (isArchive(file)) { addInstrumentationToArchive(file); } else { addInstrumentation(file); } } // Save coverage data CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/f21d7d6c791a9d50e30e19d77af0c8b3f2897c6c/Main.java/clean/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
public LogFile(String file, String format, Properties levels, boolean trace)
public LogFile(String file, String format, String defaultLevel, Properties levels, boolean trace)
public LogFile(String file, String format, Properties levels, boolean trace) throws IOException { this(((file != null) ? new PrintStream(new FileOutputStream(file,true)) : System.err), format, levels, trace); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/4f312fd00a74365a2671f796aeebcfbe9888b8cc/LogFile.java/buggy/webmacro/src/org/webmacro/util/LogFile.java
this(((file != null) ?
this(file, ((file != null) ?
public LogFile(String file, String format, Properties levels, boolean trace) throws IOException { this(((file != null) ? new PrintStream(new FileOutputStream(file,true)) : System.err), format, levels, trace); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/4f312fd00a74365a2671f796aeebcfbe9888b8cc/LogFile.java/buggy/webmacro/src/org/webmacro/util/LogFile.java
format, levels, trace);
format, defaultLevel, levels, trace);
public LogFile(String file, String format, Properties levels, boolean trace) throws IOException { this(((file != null) ? new PrintStream(new FileOutputStream(file,true)) : System.err), format, levels, trace); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/4f312fd00a74365a2671f796aeebcfbe9888b8cc/LogFile.java/buggy/webmacro/src/org/webmacro/util/LogFile.java
level = (String) _levels.getProperty("*");
level = _defaultLevel;
public void attach(LogSource l) { String name = l.getName(); String level = _levels.getProperty(name); if (level == null) { level = (String) _levels.getProperty("*"); } l.addTarget(this, level); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/4f312fd00a74365a2671f796aeebcfbe9888b8cc/LogFile.java/buggy/webmacro/src/org/webmacro/util/LogFile.java
return Collections.EMPTY_LIST;
return EMPTY_LIST;
public List childNodes() { return Collections.EMPTY_LIST; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b1293eda8454686e846e2a9837b348e2983bb423/NthRefNode.java/buggy/src/org/jruby/ast/NthRefNode.java
String[] ls = s.split(":");
String[] ls = s.split(java.io.File.pathSeparator);
private void processArgument() { String argument = arguments[argumentIndex]; FOR : for (characterIndex = 1; characterIndex < argument.length(); characterIndex++) { switch (argument.charAt(characterIndex)) { case 'h' : main.printUsage(); shouldRunInterpreter = false; break; case 'I' : String s = grabValue(" -I must be followed by a directory name to add to lib path"); String[] ls = s.split(":"); for(int i=0;i<ls.length;i++) { loadPaths.add(ls[i]); } break FOR; case 'r' : requiredLibraries.add(grabValue("-r must be followed by a package to require")); break FOR; case 'e' : inlineScript.append(grabValue(" -e must be followed by an expression to evaluate")); inlineScript.append('\n'); break FOR; case 'b' : benchmarking = true; break; case 'p' : assumePrinting = true; assumeLoop = true; break; case 'O' : objectSpaceEnabled = false; break; case 'C' : compilerEnabled = true; break; case 'n' : assumeLoop = true; break; case 'a' : split = true; break; case 'd' : debug = true; verbose = true; break; case 'l' : processLineEnds = true; break; case 'v' : verbose = true; setShowVersion(true); break; case 'w' : verbose = true; break; case 'K': // FIXME: No argument seems to work for -K in MRI plus this should not // siphon off additional args 'jruby -K ~/scripts/foo'. Also better error // processing. String eArg = grabValue("provide a value for -K"); if ("u".equals(eArg) || "U".equals(eArg) || "UTF8".equals(eArg)) { encoding = "UTF-8"; } break; case '-' : if (argument.equals("--version")) { setShowVersion(true); break FOR; } else if(argument.equals("--debug")) { debug = true; verbose = true; break; } else { if (argument.equals("--")) { // ruby interpreter compatibilty // Usage: ruby [switches] [--] [programfile] [arguments]) break FOR; } } default : throw new MainExitException(1, "unknown option " + argument.charAt(characterIndex)); } } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/e4905982a81424922852e33d8165887ff6ada056/CommandlineParser.java/clean/src/org/jruby/util/CommandlineParser.java
if (!name.startsWith("/")) name = "/" + name;
public URL getResource(String name) { try { URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/3636b47aac97eb53b8cc68ff37df9acc5567fc23/Servlet22Broker.java/clean/webmacro/src/org/webmacro/servlet/Servlet22Broker.java
public ZoomBar(ToolBar tbContainer, Registry registry,
public ZoomBar(Registry registry,
public ZoomBar(ToolBar tbContainer, Registry registry, ImageInspectorManager mng, double magFactor) { this.registry = registry; this.tbContainer = tbContainer; initTxtWidth(); initZoomComponents(magFactor); manager = new ZoomBarManager(this, mng, magFactor); manager.attachListeners(); buildToolBar(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomBar.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomBar.java
{ this.registry = registry; this.tbContainer = tbContainer; initTxtWidth(); initZoomComponents(magFactor); manager = new ZoomBarManager(this, mng, magFactor); manager.attachListeners(); buildToolBar(); }
{ this.registry = registry; initTxtWidth(); initZoomComponents(magFactor); manager = new ZoomBarManager(this, mng, magFactor); manager.attachListeners(); buildGUI(); }
public ZoomBar(ToolBar tbContainer, Registry registry, ImageInspectorManager mng, double magFactor) { this.registry = registry; this.tbContainer = tbContainer; initTxtWidth(); initZoomComponents(magFactor); manager = new ZoomBarManager(this, mng, magFactor); manager.attachListeners(); buildToolBar(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c61e383c3ea1df4e7b870a5e40d70e12c9ce01f4/ZoomBar.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/transform/zooming/ZoomBar.java