rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
OMEModel o = (OMEModel) session.load(klazz,id); BaseModelUtils u = o.getUtils(); return o; | Criteria c = session.createCriteria(klazz); c.add(Expression.ilike("name",name,MatchMode.ANYWHERE)); return c.uniqueResult(); | public Object doInHibernate(Session session) throws HibernateException { OMEModel o = (OMEModel) session.load(klazz,id); BaseModelUtils u = o.getUtils(); return o; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/00ef5f18481d04aa649d8ea20819b4b7bb9c2f28/GenericDaoHibernate.java/buggy/components/server/src/org/openmicroscopy/omero/logic/GenericDaoHibernate.java |
Criteria c = session.createCriteria(klazz); c.add(Expression.ilike("name",name,MatchMode.ANYWHERE)); return c.uniqueResult(); | Criteria c = session.createCriteria(example.getClass()); c.add(Example.create(example)); return c.list(); | public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(klazz); c.add(Expression.ilike("name",name,MatchMode.ANYWHERE)); return c.uniqueResult(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/00ef5f18481d04aa649d8ea20819b4b7bb9c2f28/GenericDaoHibernate.java/buggy/components/server/src/org/openmicroscopy/omero/logic/GenericDaoHibernate.java |
for (Object o : objects){ session.saveOrUpdate(o); } return null; | OMEModel o = (OMEModel) session.load(klazz,id); BaseModelUtils u = o.getUtils(); return o; | public Object doInHibernate(Session session) throws HibernateException { for (Object o : objects){ session.saveOrUpdate(o); } return null; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/00ef5f18481d04aa649d8ea20819b4b7bb9c2f28/GenericDaoHibernate.java/buggy/components/server/src/org/openmicroscopy/omero/logic/GenericDaoHibernate.java |
return newBignum(input.getRuby(), value); | return newBignum(input.getRuntime(), value); | public static RubyBignum unmarshalFrom(UnmarshalStream input) throws IOException { int signum = (input.readUnsignedByte() == '+' ? 1 : -1); int shortLength = input.unmarshalInt(); byte[] digits = new byte[shortLength * 2]; for (int i = digits.length - 1; i >= 0; i--) { digits[i] = input.readSignedByte(); } BigInteger value = new BigInteger(digits); if (signum == -1) { value = value.negate(); } return newBignum(input.getRuby(), value); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f235ab756f32ea9496f8f880066b46ad95ebb692/RubyBignum.java/clean/org/jruby/RubyBignum.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/ZArrayNode.java/clean/src/org/jruby/ast/ZArrayNode.java |
FastWriter fw = new FastWriter(os, "UTF8"); | FastWriter fw = new FastWriter(os, context.getEncoding()); | final public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch(IOException e) { Engine.log.exception(e); Engine.log.warning( "Include: evaluate got IO exception on write to StringWriter"); return ""; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/9dc4324fb914abcbf2ec188e4eb77b1bf503f330/ParseDirective.java/buggy/webmacro/src/org/webmacro/engine/ParseDirective.java |
return os.toString("UTF8"); | return os.toString(context.getEncoding()); | final public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch(IOException e) { Engine.log.exception(e); Engine.log.warning( "Include: evaluate got IO exception on write to StringWriter"); return ""; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/9dc4324fb914abcbf2ec188e4eb77b1bf503f330/ParseDirective.java/buggy/webmacro/src/org/webmacro/engine/ParseDirective.java |
public void setColumnNames(String[] colNames){ _colNames = colNames; } | public void setColumnNames(String[] colNames){ if (_caseSensitive){ _colNames = colNames; } else { _colNames = new String[colNames.length]; for (int i=0; i<colNames.length; i++){ _colNames[i] = colNames[i].toUpperCase(); } } } | public void setColumnNames(String[] colNames){ _colNames = colNames; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/5729b41ccfce450fabc642c0d322460672dd0ddb/SimpleDataTable.java/buggy/contrib/DataTable/org/webmacro/datatable/SimpleDataTable.java |
setFolderLocation(null); | public void clear() { super.clear(); setHeadline(null); setTeaser(null); setBody(null); setAuthor(null); setSource(null); setComment(null); setImages(null); setFilename(null);// setFolderLocation(null); _isUpdated = false; } | 57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/7493a23b4d95bba0468c9c8438a4f930b908ebf1/ArticleItemBean.java/clean/src/java/com/idega/block/article/bean/ArticleItemBean.java |
|
tryPublish(); | public Boolean storeArticle() { try { store(); }catch(ArticleStoreException e) { return new Boolean(false); } return new Boolean(true); } | 57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/7493a23b4d95bba0468c9c8438a4f930b908ebf1/ArticleItemBean.java/clean/src/java/com/idega/block/article/bean/ArticleItemBean.java |
|
if (pixelSizeX <= 0) | if (pixelSizeX < 0) | public PixelsDimensions(int sizeX, int sizeY, int sizeZ, int sizeW, int sizeT, double pixelSizeX, double pixelSizeY, double pixelSizeZ) { if (sizeX <= 0 || sizeY <= 0 || sizeZ <= 0) throw new IllegalArgumentException( "Spatial dimensions must be positive."); if (sizeW < 1) throw new IllegalArgumentException( "At least one wavelength is required."); if (sizeT < 1) throw new IllegalArgumentException("Timepoints must be positive."); if (pixelSizeX <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeY <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeZ <= 0) throw new IllegalArgumentException("Pixel size must be positive."); this.sizeX = sizeX; this.sizeY = sizeY; this.sizeZ = sizeZ; this.sizeW = sizeW; this.sizeT = sizeT; this.pixelSizeX = pixelSizeX; this.pixelSizeY = pixelSizeY; this.pixelSizeZ = pixelSizeZ; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/79f5ec9546333e90817b776c99deb818af0b588c/PixelsDimensions.java/clean/SRC/org/openmicroscopy/shoola/env/rnd/metadata/PixelsDimensions.java |
if (pixelSizeY <= 0) | if (pixelSizeY < 0) | public PixelsDimensions(int sizeX, int sizeY, int sizeZ, int sizeW, int sizeT, double pixelSizeX, double pixelSizeY, double pixelSizeZ) { if (sizeX <= 0 || sizeY <= 0 || sizeZ <= 0) throw new IllegalArgumentException( "Spatial dimensions must be positive."); if (sizeW < 1) throw new IllegalArgumentException( "At least one wavelength is required."); if (sizeT < 1) throw new IllegalArgumentException("Timepoints must be positive."); if (pixelSizeX <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeY <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeZ <= 0) throw new IllegalArgumentException("Pixel size must be positive."); this.sizeX = sizeX; this.sizeY = sizeY; this.sizeZ = sizeZ; this.sizeW = sizeW; this.sizeT = sizeT; this.pixelSizeX = pixelSizeX; this.pixelSizeY = pixelSizeY; this.pixelSizeZ = pixelSizeZ; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/79f5ec9546333e90817b776c99deb818af0b588c/PixelsDimensions.java/clean/SRC/org/openmicroscopy/shoola/env/rnd/metadata/PixelsDimensions.java |
if (pixelSizeZ <= 0) | if (pixelSizeZ < 0) | public PixelsDimensions(int sizeX, int sizeY, int sizeZ, int sizeW, int sizeT, double pixelSizeX, double pixelSizeY, double pixelSizeZ) { if (sizeX <= 0 || sizeY <= 0 || sizeZ <= 0) throw new IllegalArgumentException( "Spatial dimensions must be positive."); if (sizeW < 1) throw new IllegalArgumentException( "At least one wavelength is required."); if (sizeT < 1) throw new IllegalArgumentException("Timepoints must be positive."); if (pixelSizeX <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeY <= 0) throw new IllegalArgumentException("Pixel size must be positive."); if (pixelSizeZ <= 0) throw new IllegalArgumentException("Pixel size must be positive."); this.sizeX = sizeX; this.sizeY = sizeY; this.sizeZ = sizeZ; this.sizeW = sizeW; this.sizeT = sizeT; this.pixelSizeX = pixelSizeX; this.pixelSizeY = pixelSizeY; this.pixelSizeZ = pixelSizeZ; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/79f5ec9546333e90817b776c99deb818af0b588c/PixelsDimensions.java/clean/SRC/org/openmicroscopy/shoola/env/rnd/metadata/PixelsDimensions.java |
ProviderManager.addIQProvider(Gateway.ELEMENT_NAME, Gateway.NAMESPACE, new Gateway.Provider()); | public void initialize() { SwingWorker thread = new SwingWorker() { public Object construct() { try { populateTransports(SparkManager.getConnection()); } catch (Exception e) { Log.error(e); return false; } return true; } public void finished() { Boolean transportExists = (Boolean)get(); if (!transportExists) { return; } for (final Transport transport : TransportUtils.getTransports()) { addTransport(transport); } // Register presences. registerPresenceListener(); } }; thread.start(); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/6c0051f92a99737d42226d1e696824d21ec0dcd2/GatewayPlugin.java/clean/src/java/org/jivesoftware/sparkimpl/plugin/gateways/GatewayPlugin.java |
|
Presence presence = statusBar.getPresence(); | Presence oldPresence = statusBar.getPresence(); Presence presence = new Presence(oldPresence.getType(), oldPresence.getStatus(), oldPresence.getPriority(), oldPresence.getMode()); | public GatewayButton(final Transport transport) { setLayout(new GridBagLayout()); setOpaque(false); this.transport = transport; final StatusBar statusBar = SparkManager.getWorkspace().getStatusBar(); final JPanel commandPanel = statusBar.getCommandPanel(); button.setIcon(transport.getInactiveIcon()); button.setToolTipText(transport.getInstructions()); commandPanel.add(button); statusBar.invalidate(); statusBar.validate(); statusBar.repaint(); button.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent mouseEvent) { handlePopup(mouseEvent); } }); // Send directed presence if registered with this transport. final boolean isRegistered = TransportUtils.isRegistered(SparkManager.getConnection(), transport); if (isRegistered) { // Check if auto login is set. boolean autoJoin = TransportUtils.autoJoinService(transport.getServiceName()); if (autoJoin) { Presence presence = statusBar.getPresence(); presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/65023340f7287fee8d2f1535446bf62c3ed50749/GatewayButton.java/buggy/src/java/org/jivesoftware/sparkimpl/plugin/gateways/GatewayButton.java |
if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } | if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
try { | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
|
ClassLoader classLoader = runtime.getJavaSupport().getJavaClassLoader(); String xname = name.replace('\\', '/'); if (xname.charAt(0) == '/') { URL loc = classLoader.getResource(xname); | } catch (AccessControlException accessEx) { } catch (IllegalArgumentException illArgEx) { } | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); | 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()); } } 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); } | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
} 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); | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
if (current.getJarEntry(name) != null) { try { return new LoadServiceResource(new URL(entry + name), entry + name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } } | } } | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
try { | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/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()); } | } catch (AccessControlException accessEx) { } catch (IllegalArgumentException illArgEx) { | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
URL loc = classLoader.getResource(xname); | URL loc = classLoader.getResource(entry.replace('\\', '/') + "/" + xname); | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null; | if (isRequireable(loc)) { return new LoadServiceResource(loc, loc.getPath()); } } URL loc = classLoader.getResource(xname); return isRequireable(loc) ? new LoadServiceResource(loc, loc.getPath()) : null; | private LoadServiceResource findFile(String name) { // try { if (name.startsWith("jar:")) { try { return new LoadServiceResource(new URL(name), name); } catch (MalformedURLException e) { throw runtime.newIOErrorFromException(e); } } // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 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); } } 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); } } } // // Load from local filesystem // NormalizedFile current = (NormalizedFile)new NormalizedFile(entry, name).getAbsoluteFile(); 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); } } // 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; // } catch (MalformedURLException e) { // throw runtime.newIOErrorFromException(e); // } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
if (runtime.getSafeLevel() == 0) { String jrubyLib = System.getProperty("jruby.lib"); if (jrubyLib != null) { addPath(jrubyLib); } } | public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } 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); } if (runtime.getSafeLevel() == 0) { addPath("."); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
|
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"); addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); | 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"); addPath("lib" + sep + "ruby" + sep + Constants.RUBY_MAJOR_VERSION); } } catch (AccessControlException accessEx) { | public void init(List additionalDirectories) { for (Iterator iter = additionalDirectories.iterator(); iter.hasNext();) { addPath((String) iter.next()); } 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); } if (runtime.getSafeLevel() == 0) { addPath("."); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
loc.openConnection(); return true; | loc.openConnection(); return true; | private boolean isRequireable(URL loc) { if (loc != null) { if (loc.getProtocol().equals("file") && new java.io.File(loc.getFile()).isDirectory()) { return false; } try { loc.openConnection(); return true; } catch (Exception e) {} } return false; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/LoadService.java/clean/src/org/jruby/runtime/load/LoadService.java |
NormalizedFile file = new NormalizedFile(path.getValue()); | NormalizedFile file = new NormalizedFile(path.toString()); | private static NormalizedFile newFile(RubyString path) { NormalizedFile file = new NormalizedFile(path.getValue()); if (!file.isAbsolute()) { file = new NormalizedFile(path.getRuntime().getCurrentDirectory(), path.getValue()); } try { file = (NormalizedFile)file.getCanonicalFile(); } catch (IOException e) { file = (NormalizedFile)file.getAbsoluteFile(); } return file; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyFileTest.java/buggy/src/org/jruby/RubyFileTest.java |
file = new NormalizedFile(path.getRuntime().getCurrentDirectory(), path.getValue()); | file = new NormalizedFile(path.getRuntime().getCurrentDirectory(), path.toString()); | private static NormalizedFile newFile(RubyString path) { NormalizedFile file = new NormalizedFile(path.getValue()); if (!file.isAbsolute()) { file = new NormalizedFile(path.getRuntime().getCurrentDirectory(), path.getValue()); } try { file = (NormalizedFile)file.getCanonicalFile(); } catch (IOException e) { file = (NormalizedFile)file.getAbsoluteFile(); } return file; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyFileTest.java/buggy/src/org/jruby/RubyFileTest.java |
throw recv.getRuntime().newErrnoENOENTError("No such file: " + filename.getValue()); | throw recv.getRuntime().newErrnoENOENTError("No such file: " + filename); | public static IRubyObject size(IRubyObject recv, RubyString filename) { NormalizedFile file = newFile(filename); if (!file.exists()) { throw recv.getRuntime().newErrnoENOENTError("No such file: " + filename.getValue()); } return filename.getRuntime().newFixnum(file.length()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyFileTest.java/buggy/src/org/jruby/RubyFileTest.java |
String version = SpringVersion.getVersion(); | String version = "2.0"; try { Class spring20Clazz = Class.forName("org.springframework.core.AttributeAccessorSupport"); version = "2.0"; } catch(ClassNotFoundException e) { version = "1.2.8"; } | public static XmlBeanDefinitionReader createBeanDefinitionReader( SpringApplicationContext applicationContext, BeanDefinitionRegistry registry, List xmlPreprocessors) { String version = SpringVersion.getVersion(); String className = "org.apache.xbean.spring.context.v" + version.charAt(0) + ".XBeanXmlBeanDefinitionReader"; try { Class cl = Class.forName(className); Constructor cstr = cl.getConstructor(new Class[] { SpringApplicationContext.class, BeanDefinitionRegistry.class, List.class }); return (XmlBeanDefinitionReader) cstr.newInstance(new Object[] { applicationContext, registry, xmlPreprocessors }); } catch (Exception e) { throw (IllegalStateException) new IllegalStateException("Could not find valid implementation for: " + version).initCause(e); } } | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/11df53b59b983bed2ad4569b2462495157cef4ff/XBeanHelper.java/buggy/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java |
runtime.defineGlobalConstant("ENV", RubyHash.newHash(runtime, envs, null)); | runtime.defineGlobalConstant("ENV", RubyHash.newHash(runtime, envs, runtime.getNil())); | public static void createGlobals(IRuby runtime) { // Version information: IRubyObject version = runtime.newString(Constants.RUBY_VERSION).freeze(); IRubyObject release = runtime.newString(Constants.COMPILE_DATE).freeze(); IRubyObject platform = runtime.newString(Constants.PLATFORM).freeze(); runtime.defineGlobalConstant("RUBY_VERSION", version); runtime.defineGlobalConstant("RUBY_RELEASE_DATE", release); runtime.defineGlobalConstant("RUBY_PLATFORM", platform); runtime.defineGlobalConstant("VERSION", version); runtime.defineGlobalConstant("RELEASE_DATE", release); runtime.defineGlobalConstant("PLATFORM", platform); // FIXME: ENV Not really a RubyHash (but close) // FIXME: ENV Should not copy system properties, but should reference them instead HashMap envs = new HashMap(); envs.put(runtime.newString("HOME"), runtime.newString(System.getProperty("user.home"))); runtime.defineGlobalConstant("ENV", RubyHash.newHash(runtime, envs, null)); runtime.defineVariable(new StringGlobalVariable(runtime, "$KCODE", runtime.newString("UTF8"))); runtime.defineVariable(new StringGlobalVariable(runtime, "$/", runtime.newString("\n"))); runtime.defineVariable(new StringGlobalVariable(runtime, "$\\", runtime.getNil())); runtime.defineVariable(new StringGlobalVariable(runtime, "$,", runtime.getNil())); runtime.defineVariable(new LineNumberGlobalVariable(runtime, "$.", RubyFixnum.one(runtime))); runtime.defineVariable(new LastlineGlobalVariable(runtime, "$_")); runtime.defineVariable(new ErrorInfoGlobalVariable(runtime, "$!", runtime.getNil())); runtime.defineVariable(new SafeGlobalVariable(runtime, "$SAFE")); runtime.defineVariable(new BacktraceGlobalVariable(runtime, "$@")); IRubyObject stdin = RubyIO.fdOpen(runtime, RubyIO.STDIN); IRubyObject stdout = RubyIO.fdOpen(runtime, RubyIO.STDOUT); IRubyObject stderr = RubyIO.fdOpen(runtime, RubyIO.STDERR); runtime.defineVariable(new InputGlobalVariable(runtime, "$stdin", stdin)); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", stdout)); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", stderr)); runtime.defineVariable(new OutputGlobalVariable(runtime, "$>", stdout)); runtime.defineVariable(new OutputGlobalVariable(runtime, "$defout", stdout)); runtime.defineVariable(new OutputGlobalVariable(runtime, "$deferr", stderr)); runtime.defineGlobalConstant("STDIN", stdin); runtime.defineGlobalConstant("STDOUT", stdout); runtime.defineGlobalConstant("STDERR", stderr); runtime.defineVariable(new LoadedFeatures(runtime, "$\"")); runtime.defineVariable(new LoadPath(runtime, "$:")); runtime.defineVariable(new LoadPath(runtime, "$-I")); runtime.defineVariable(new LoadPath(runtime, "$LOAD_PATH")); // ARGF, $< object RubyArgsFile argsFile = new RubyArgsFile(runtime); argsFile.initArgsFile(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/ebc655285fa55c939b42b33be335d9f4b2040047/RubyGlobal.java/buggy/src/org/jruby/RubyGlobal.java |
model.setCaseSensitive(source.isSelected()); | finder.setCaseSensitive(source.isSelected()); | private void initComponents() { createMenuBar(); createLeftMenuBar(); caseSensitive = new JCheckBox("Match case"); caseSensitive.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JCheckBox source = (JCheckBox) e.getSource(); model.setCaseSensitive(source.isSelected()); } }); infoComponent = new JPanel(); findArea = new JTextField(); findArea.setBorder(BorderFactory.createBevelBorder( BevelBorder.LOWERED)); findArea.setBackground(Color.WHITE); findArea.setOpaque(true); findArea.setEditable(true); int h = getFontMetrics(getFont()).getHeight()+4; findArea.setPreferredSize(new Dimension(WIDTH, h)); findArea.addKeyListener(new KeyAdapter() { /** Finds the phrase. */ public void keyPressed(KeyEvent e) { if ((e.getKeyCode() == KeyEvent.VK_ENTER)) { Object source = e.getSource(); if (source instanceof JTextField) { JTextField field = (JTextField) source; if (field.getText() != null && field.getText().length() > 0) finder.find(); } } } }); findArea.getDocument().addDocumentListener(new DocumentListener() { /** * Sets the finder's controls enabled if no phrase entered. * @see DocumentListener#removeUpdate(DocumentEvent) */ public void insertUpdate(DocumentEvent de) { Document d = de.getDocument(); try { finder.setTextUpdate(d.getText(0, d.getLength())); } catch (Exception e) {} } /** * Sets the finder's controls enabled if no phrase entered. * @see DocumentListener#removeUpdate(DocumentEvent) */ public void removeUpdate(DocumentEvent de) { Document d = de.getDocument(); try { finder.setTextUpdate(d.getText(0, d.getLength())); } catch (Exception e) {} } /** * Required by I/F but no-op implementation in our case. * @see DocumentListener#changedUpdate(DocumentEvent) */ public void changedUpdate(DocumentEvent de) {} }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/8ab0ebced6045585fe427d0aa4302d96454e7266/FinderUI.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/finder/FinderUI.java |
model.setCaseSensitive(source.isSelected()); | finder.setCaseSensitive(source.isSelected()); | public void stateChanged(ChangeEvent e) { JCheckBox source = (JCheckBox) e.getSource(); model.setCaseSensitive(source.isSelected()); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/8ab0ebced6045585fe427d0aa4302d96454e7266/FinderUI.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/finder/FinderUI.java |
found = false; | void setCaseSensitive(boolean b) { if (b == model.isCaseSensitive()) return; model.setCaseSensitive(b); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/8ab0ebced6045585fe427d0aa4302d96454e7266/Finder.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/finder/Finder.java |
|
String baseDir = "."; Vector filesToMerge = new Vector(); | File baseDir = null; List filesToMerge = new ArrayList(); | public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/1b806796294e95c04fa1265325392bcf191c20fb/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/merge/Main.java |
baseDir = args[++i]; | baseDir = new File(args[++i]); | public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/1b806796294e95c04fa1265325392bcf191c20fb/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/merge/Main.java |
filesToMerge.add(baseDir + File.separator + args[i]); | filesToMerge.add( new File(baseDir, args[i])); | public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/1b806796294e95c04fa1265325392bcf191c20fb/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/merge/Main.java |
if (filesToMerge.size() == 0) | if (filesToMerge.isEmpty()) | public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/1b806796294e95c04fa1265325392bcf191c20fb/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/merge/Main.java |
String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); | File newDataFile = (File)iter.next(); | public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/1b806796294e95c04fa1265325392bcf191c20fb/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/merge/Main.java |
outBuffer = ByteBuffer.allocate(BLOCK_SIZE); | public IOHandlerNio(IRuby runtime, Channel channel) throws IOException { super(runtime); String mode = ""; this.channel = channel; if (channel instanceof ReadableByteChannel) { mode += "r"; isOpen = true; } if (channel instanceof WritableByteChannel) { mode += "w"; isOpen = true; } if ("rw".equals(mode)) { modes = new IOModes(runtime, IOModes.RDWR); isOpen = true; } else { if (!isOpen) { // Neither stream exists? // throw new IOException("Opening nothing?"); // Hack to cover the ServerSocketChannel case mode = "r"; isOpen = true; } modes = new IOModes(runtime, mode); } fileno = RubyIO.getNewFileno(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
|
if (bufferedIO) { /* flush output buffer before close */ if (outBuffer.position() > 0) { outBuffer.flip(); flushOutBuffer(); } } | /* flush output buffer before close */ if (outBuffer.position() > 0) { outBuffer.flip(); flushOutBuffer(); } | public void close() throws IOException { if (bufferedIO) { /* flush output buffer before close */ if (outBuffer.position() > 0) { outBuffer.flip(); flushOutBuffer(); } } channel.close(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
setupBufferedIO(); | public void putc(int c) throws IOException, BadDescriptorException { checkWritable(); setupBufferedIO(); if (!outBuffer.hasRemaining()) { outBuffer.flip(); flushOutBuffer(); } outBuffer.put((byte) (c & 0xff)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
|
outBuffer = ByteBuffer.allocate(BLOCK_SIZE); | private void setupBufferedIO() { if (bufferedIO) { return; } outBuffer = ByteBuffer.allocate(BLOCK_SIZE); inBuffer = ByteBuffer.allocate(BLOCK_SIZE); flushInBuffer(); bufferedIO = true; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
|
checkBuffered(); | outBuffer.flip(); flushOutBuffer(); | public int syswrite(String string) throws BadDescriptorException, IOException { checkWritable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.wrap(RubyString.stringToBytes(string)); while (buffer.hasRemaining()) { if (((WritableByteChannel) channel).write(buffer) < 0) { // does this ever happen?? throw new IOException("write returned less than zero"); } } return buffer.capacity(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
setupBufferedIO(); | public void ungetc(int c) { ungotc = c; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
|
setupBufferedIO(); | public int write(String string) throws IOException, BadDescriptorException { setupBufferedIO(); checkWritable(); ByteBuffer buffer = ByteBuffer.wrap(RubyString.stringToBytes(string)); byte[] trigger; IRubyObject dollar_backslash = getRuntime().getGlobalVariables().get("$\\"); if (dollar_backslash instanceof RubyString) { trigger = ((RubyString) dollar_backslash).toByteArray(); } else { trigger = RubyString.stringToBytes("\n"); } loop: while (buffer.hasRemaining()) { /* append data */ while (buffer.hasRemaining() && outBuffer.hasRemaining()) { outBuffer.put(buffer.get()); } int idx; outBuffer.flip(); if (!outBuffer.hasRemaining() || isSync()) { flushOutBuffer(); } else if ((idx = buffer_rindex(outBuffer, trigger)) >= 0) { int oldLimit = outBuffer.limit(); outBuffer.limit(idx + trigger.length); flushOutBuffer(); outBuffer.position(idx + trigger.length); outBuffer.limit(oldLimit); int i; for (i = 0; outBuffer.hasRemaining(); i++) { outBuffer.put(i, outBuffer.get()); } outBuffer.position(i); outBuffer.limit(outBuffer.capacity()); } else { // unflip outBuffer.position(outBuffer.limit()); outBuffer.limit(outBuffer.capacity()); } } return buffer.capacity(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6049d13f9eab0fce512fac5890ac20bf9ba9a27/IOHandlerNio.java/buggy/src/org/jruby/util/IOHandlerNio.java |
|
public EnumType(Properties attrs){super(attrs);} | public EnumType(Properties attrs){ super(attrs); Properties props = new Properties(); props.setProperty("name","value"); props.setProperty("type","string"); RequiredField value = new RequiredField(props); getProperties().add(value); } | public EnumType(Properties attrs){super(attrs);} | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/8910db2ba599cde3137140fc7a57bdfc3361117f/SemanticType.java/clean/components/dsl/src/ome/dsl/SemanticType.java |
new DOInfo(details, model)); | new DOInfo(details, model, true)); | private JComponent buildCenterComponent() { switch (model.getEditorType()) { case Editor.CREATE_EDITOR: return doBasic; case Editor.PROPERTIES_EDITOR: IconManager im = IconManager.getInstance(); JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT); tabs.setAlignmentX(LEFT_ALIGNMENT); tabs.addTab(PROPERTIES_TITLE, im.getIcon(IconManager.PROPERTIES), doBasic); ExperimenterData exp = model.getExperimenterData(); Map details = EditorUtil.transformExperimenterData(exp); tabs.addTab(OWNER_TITLE, im.getIcon(IconManager.OWNER), new DOInfo(details, model)); DataObject hierarchyObject = model.getHierarchyObject(); if (hierarchyObject instanceof ImageData) { details = EditorUtil.transformPixelsData( ((ImageData) hierarchyObject).getDefaultPixels()); tabs.addTab(INFO_TITLE, im.getIcon(IconManager.IMAGE), new DOInfo(details, null)); } return tabs; } return null; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0f24af159634bdc4228febad328548fbedecdb1d/EditorUI.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/EditorUI.java |
new DOInfo(details, null)); | new DOInfo(details, model, false)); | private JComponent buildCenterComponent() { switch (model.getEditorType()) { case Editor.CREATE_EDITOR: return doBasic; case Editor.PROPERTIES_EDITOR: IconManager im = IconManager.getInstance(); JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT); tabs.setAlignmentX(LEFT_ALIGNMENT); tabs.addTab(PROPERTIES_TITLE, im.getIcon(IconManager.PROPERTIES), doBasic); ExperimenterData exp = model.getExperimenterData(); Map details = EditorUtil.transformExperimenterData(exp); tabs.addTab(OWNER_TITLE, im.getIcon(IconManager.OWNER), new DOInfo(details, model)); DataObject hierarchyObject = model.getHierarchyObject(); if (hierarchyObject instanceof ImageData) { details = EditorUtil.transformPixelsData( ((ImageData) hierarchyObject).getDefaultPixels()); tabs.addTab(INFO_TITLE, im.getIcon(IconManager.IMAGE), new DOInfo(details, null)); } return tabs; } return null; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0f24af159634bdc4228febad328548fbedecdb1d/EditorUI.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/EditorUI.java |
lensMenu = LensMenu.getMenu(lensComponent); | lensMenu = new LensMenu(lensComponent); | ZoomWindowUI(JFrame parent, LensComponent lensComponent) { super(parent); this.lensComponent = lensComponent; setTitle("Zoom Window"); setSize(300,300); setLocation(900,200); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { public void windowClosing( WindowEvent e ) { close(); } }); zoomPanel = new ZoomPanel(); scrollPanel = new JScrollPane(zoomPanel); statusPanel = new StatusPanel(); this.setLayout(new BorderLayout()); this.add(scrollPanel, BorderLayout.CENTER); this.add(statusPanel, BorderLayout.SOUTH); lensMenu = LensMenu.getMenu(lensComponent); menu = lensMenu.getMenubar(); this.setJMenuBar(menu); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/29b0b8d77292efe37e6130bac1e4416901230654/ZoomWindowUI.java/buggy/SRC/org/openmicroscopy/shoola/util/ui/lens/ZoomWindowUI.java |
fail(); | public void test_multi_txs() throws Exception { ReadWriteLock rwl = null; fail(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/59b11883b95c926d6706e6d30b4cdb898088683c/RenderingEngineTest.java/buggy/components/server/test/ome/server/itests/RenderingEngineTest.java |
|
Criteria c = session.createCriteria((Class) value(CLASS)); | Criteria c = session.createCriteria(Image.class); | protected void buildQuery(Session session) throws HibernateException, SQLException { Criteria c = session.createCriteria((Class) value(CLASS)); c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); c.add(Restrictions.in("id",(Collection) value(IDS))); Hierarchy.fetchChildren(c,(Class) value(CLASS),Integer.MAX_VALUE); setCriteria( c ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b0d9b08448464cb80e12bda271a852daf0e5bd6a/PojosGetImagesQueryDefinition.java/clean/components/server/src/ome/services/query/PojosGetImagesQueryDefinition.java |
c.add(Restrictions.in("id",(Collection) value(IDS))); Hierarchy.fetchChildren(c,(Class) value(CLASS),Integer.MAX_VALUE); | Criteria[] hy = Hierarchy.fetchParents(c,(Class) value(CLASS),Integer.MAX_VALUE); hy[hy.length-1].add(Restrictions.in("id",(Collection) value(IDS))); | protected void buildQuery(Session session) throws HibernateException, SQLException { Criteria c = session.createCriteria((Class) value(CLASS)); c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); c.add(Restrictions.in("id",(Collection) value(IDS))); Hierarchy.fetchChildren(c,(Class) value(CLASS),Integer.MAX_VALUE); setCriteria( c ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b0d9b08448464cb80e12bda271a852daf0e5bd6a/PojosGetImagesQueryDefinition.java/clean/components/server/src/ome/services/query/PojosGetImagesQueryDefinition.java |
result.callMethod(recv.getRuntime().getCurrentContext(),"initialize",args); | result.callInit(args); | public static IRubyObject newInstance(IRubyObject recv, IRubyObject[] args) { Cipher result = new Cipher(recv.getRuntime(), (RubyClass)recv); result.callMethod(recv.getRuntime().getCurrentContext(),"initialize",args); return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/3514dc67abeb8cd25e5ebb1dc300ffbba6dcf5a4/Cipher.java/clean/src/org/jruby/ext/openssl/Cipher.java |
magFactor); | magFactor, abstraction.getImageWidth(), abstraction.getImageHeight()); | public void showInspector() { if (imageInspector == null) imageInspector = new ImageInspector(this, presentation.getCanvas(), magFactor); presentation.getCanvas().getManager().setClick(true); UIUtilities.centerAndShow(imageInspector); if (roiOnOff) imageInspector.getManager().setLensEnabled(false); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/8846f7da5fbaf4d3fb83aa43b5616bcd13483654/ViewerCtrl.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/ViewerCtrl.java |
scope.setValues(args, false); | scope.setValues(args, expectedArgsCount, false); | private void prepareArguments(ThreadContext context, IRuby runtime, Scope scope, IRubyObject receiver, IRubyObject[] args) { int expectedArgsCount = argsNode.getArgsCount(); int restArg = argsNode.getRestArg(); boolean hasOptArgs = argsNode.getOptArgs() != null; // FIXME: This seems redundant with the arity check in internalCall...is it actually different? if (expectedArgsCount > args.length) { throw runtime.newArgumentError("Wrong # of arguments(" + args.length + " for " + expectedArgsCount + ")"); } if (scope.hasLocalVariables() && expectedArgsCount > 0) { scope.setValues(args, false); } // optArgs and restArgs require more work, so isolate them and ArrayList creation here if (hasOptArgs || restArg != -1) { args = prepareOptOrRestArgs(context, runtime, scope, args, expectedArgsCount, restArg, hasOptArgs); } context.setFrameArgs(args); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/dc464e41f4cc61e7250cbd6b2013e49cf87db7f2/DefaultMethod.java/buggy/src/org/jruby/internal/runtime/methods/DefaultMethod.java |
else { | else | private String handleError( Variable variable, Context context, Exception problem ) { String strError; ArrayList arlErrors = null; PropertyException propEx = null; if (problem instanceof PropertyException) propEx = (PropertyException)problem; else { propEx = new PropertyException( "Error expanding $" + variable.getVariableName()); propEx.setContextLocation(context.getCurrentLocation()); } strError = propEx.getMessage(); if ( context.containsKey( "WMERROR" ) ) { arlErrors = ( ArrayList ) context.get( "WMERROR" ); } else { arlErrors = new ArrayList(); context.put( "WMERROR", arlErrors ); } arlErrors.add( strError ); if ( _log != null ) { _log.warning( strError, problem ); } return errorString( strError ); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/e89ac338b1d6e0befa14e4104331a063c633f3d6/DebugEvaluationExceptionHandler.java/clean/webmacro/src/org/webmacro/engine/DebugEvaluationExceptionHandler.java |
propEx.setContextLocation(context.getCurrentLocation()); } | propEx.setContextLocation(context.getCurrentLocation()); | private String handleError( Variable variable, Context context, Exception problem ) { String strError; ArrayList arlErrors = null; PropertyException propEx = null; if (problem instanceof PropertyException) propEx = (PropertyException)problem; else { propEx = new PropertyException( "Error expanding $" + variable.getVariableName()); propEx.setContextLocation(context.getCurrentLocation()); } strError = propEx.getMessage(); if ( context.containsKey( "WMERROR" ) ) { arlErrors = ( ArrayList ) context.get( "WMERROR" ); } else { arlErrors = new ArrayList(); context.put( "WMERROR", arlErrors ); } arlErrors.add( strError ); if ( _log != null ) { _log.warning( strError, problem ); } return errorString( strError ); } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/e89ac338b1d6e0befa14e4104331a063c633f3d6/DebugEvaluationExceptionHandler.java/clean/webmacro/src/org/webmacro/engine/DebugEvaluationExceptionHandler.java |
public List getList() { | public ArrayList getList() { | public List getList() { return list; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f629550c5947df9c1dbe414645f3dc76bcb70df4/RubyArray.java/clean/org/jruby/RubyArray.java |
assertNotNull("Root has to be define.",root); | assertNotNull("Root has to be defined.",root); | public void testExperimenterShouldAlwaysExist() throws Exception { Experimenter root = (Experimenter) iQuery.findByQuery(Experimenter.class.getName(), new Parameters().addId(0L)); assertNotNull("Root has to be define.",root); // FIXME assertNotNull("And it should have details",root.getDetails()); List<Experimenter> l = iQuery.findAllByQuery("from Experimenter",null); assertTrue("If root is defined, can't be empty",l.size()>0); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/59b11883b95c926d6706e6d30b4cdb898088683c/InvariantsTest.java/clean/components/server/test/ome/server/itests/query/InvariantsTest.java |
if (headingItem != null) headingItem.setEnabled(enabled); | if (headingItem != null && !headingItem.isDisposed()) headingItem.setEnabled(enabled); | public void setEnabled(boolean enabled) { if (this.enabled != enabled) { this.enabled = enabled; if (headingItem != null) headingItem.setEnabled(enabled); } } | 57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/102d4072e61256869ff46cb3e5a08b2ccd94465d/DisableableMenuManager.java/buggy/trunk/src/de/berlios/koalanotes/display/menus/DisableableMenuManager.java |
if (headingItem != null && headingItem.isEnabled() != enabled) { | if (headingItem != null && !headingItem.isDisposed() && headingItem.isEnabled() != enabled) { | public void update() { super.update(); if (headingItem != null && headingItem.isEnabled() != enabled) { headingItem.setEnabled(enabled); } } | 57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/102d4072e61256869ff46cb3e5a08b2ccd94465d/DisableableMenuManager.java/buggy/trunk/src/de/berlios/koalanotes/display/menus/DisableableMenuManager.java |
if (headingItem != null && headingItem.isEnabled() != enabled) { | if (headingItem != null && !headingItem.isDisposed() && headingItem.isEnabled() != enabled) { | public void updateAll(boolean arg0) { super.updateAll(arg0); if (headingItem != null && headingItem.isEnabled() != enabled) { headingItem.setEnabled(enabled); } } | 57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/102d4072e61256869ff46cb3e5a08b2ccd94465d/DisableableMenuManager.java/buggy/trunk/src/de/berlios/koalanotes/display/menus/DisableableMenuManager.java |
register(result); | private IRubyObject defaultObjectUnmarshal() throws IOException { RubySymbol className = (RubySymbol) unmarshalObject(); // ... FIXME: handle if class doesn't exist ... RubyClass type = (RubyClass) runtime.getClasses().getClassFromPath(className.toId()); Asserts.assertNotNull(type, "type shouldn't be null."); IRubyObject result = runtime.getFactory().newObject(type); for (int i = 0, count = unmarshalInt(); i < count; i++) { result.setInstanceVariable(unmarshalObject().toId(), unmarshalObject()); } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9db4d278a734c4fdfd9a83ed95575a45577f1e1b/UnmarshalStream.java/buggy/org/jruby/runtime/marshal/UnmarshalStream.java |
|
cache.register(result); | public IRubyObject unmarshalObject() throws IOException { int type = readUnsignedByte(); IRubyObject result; if (type == '@') { result = cache.linkedByIndex(unmarshalInt()); } else if (type == ';') { result = cache.symbolByIndex(unmarshalInt()); } else { result = unmarshalObjectDirectly(type); } cache.register(result); return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9db4d278a734c4fdfd9a83ed95575a45577f1e1b/UnmarshalStream.java/buggy/org/jruby/runtime/marshal/UnmarshalStream.java |
|
return classInstance.callMethod( | IRubyObject result = classInstance.callMethod( | private IRubyObject userUnmarshal() throws IOException { String className = ((RubySymbol) unmarshalObject()).toId(); String marshaled = unmarshalString(); RubyModule classInstance = runtime.getRubyModule(className); return classInstance.callMethod( "_load", RubyString.newString(runtime, marshaled)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9db4d278a734c4fdfd9a83ed95575a45577f1e1b/UnmarshalStream.java/buggy/org/jruby/runtime/marshal/UnmarshalStream.java |
register(result); return result; | private IRubyObject userUnmarshal() throws IOException { String className = ((RubySymbol) unmarshalObject()).toId(); String marshaled = unmarshalString(); RubyModule classInstance = runtime.getRubyModule(className); return classInstance.callMethod( "_load", RubyString.newString(runtime, marshaled)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9db4d278a734c4fdfd9a83ed95575a45577f1e1b/UnmarshalStream.java/buggy/org/jruby/runtime/marshal/UnmarshalStream.java |
|
return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); | String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { lang = "n"; } else if((opts & 48) != 0) { lang = "s"; } else if((opts & 64) != 0) { lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); | 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; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } 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); return receiver.callMethod(context, iVisited.getName(), args, callType); } 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); 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 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()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } 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; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } 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(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; context.preIterEval(Block.createBlock(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; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } 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) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } 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) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a99c8643e2996a04338dcb2ea5ad169c29e5f798/EvaluationState.java/buggy/src/org/jruby/evaluator/EvaluationState.java |
return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); | String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { lang = "n"; } else if((opts & 48) != 0) { lang = "s"; } else if((opts & 64) != 0) { lang = "u"; } return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); | 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; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } 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); return receiver.callMethod(context, iVisited.getName(), args, callType); } 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); 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 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()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } 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; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } 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(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; context.preIterEval(Block.createBlock(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; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } 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) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } 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) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a99c8643e2996a04338dcb2ea5ad169c29e5f798/EvaluationState.java/buggy/src/org/jruby/evaluator/EvaluationState.java |
public DisplayOption(Integer attributeId, Boolean redOn, Integer ZStart, Boolean blueOn, String colorMap, Integer ZStop, Float zoom, Integer TStop, Integer TStart, Boolean greenOn, Boolean displayRgb, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ImagePixel imagePixel, org.openmicroscopy.omero.model.ModuleExecution moduleExecution, Set displayRois) { this.attributeId = attributeId; this.redOn = redOn; this.ZStart = ZStart; this.blueOn = blueOn; this.colorMap = colorMap; this.ZStop = ZStop; this.zoom = zoom; this.TStop = TStop; this.TStart = TStart; this.greenOn = greenOn; this.displayRgb = displayRgb; this.image = image; this.imagePixel = imagePixel; this.moduleExecution = moduleExecution; this.displayRois = displayRois; | public DisplayOption() { | public DisplayOption(Integer attributeId, Boolean redOn, Integer ZStart, Boolean blueOn, String colorMap, Integer ZStop, Float zoom, Integer TStop, Integer TStart, Boolean greenOn, Boolean displayRgb, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ImagePixel imagePixel, org.openmicroscopy.omero.model.ModuleExecution moduleExecution, Set displayRois) { this.attributeId = attributeId; this.redOn = redOn; this.ZStart = ZStart; this.blueOn = blueOn; this.colorMap = colorMap; this.ZStop = ZStop; this.zoom = zoom; this.TStop = TStop; this.TStart = TStart; this.greenOn = greenOn; this.displayRgb = displayRgb; this.image = image; this.imagePixel = imagePixel; this.moduleExecution = moduleExecution; this.displayRois = displayRois; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public org.openmicroscopy.omero.model.Image getImage() { | public Image getImage() { | public org.openmicroscopy.omero.model.Image getImage() { return this.image; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public org.openmicroscopy.omero.model.ImagePixel getImagePixel() { | public ImagePixel getImagePixel() { | public org.openmicroscopy.omero.model.ImagePixel getImagePixel() { return this.imagePixel; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() { | public ModuleExecution getModuleExecution() { | public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() { return this.moduleExecution; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public void setImage(org.openmicroscopy.omero.model.Image image) { | public void setImage(Image image) { | public void setImage(org.openmicroscopy.omero.model.Image image) { this.image = image; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public void setImagePixel(org.openmicroscopy.omero.model.ImagePixel imagePixel) { | public void setImagePixel(ImagePixel imagePixel) { | public void setImagePixel(org.openmicroscopy.omero.model.ImagePixel imagePixel) { this.imagePixel = imagePixel; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { | public void setModuleExecution(ModuleExecution moduleExecution) { | public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.moduleExecution = moduleExecution; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayOption.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayOption.java |
types.add(type); | types.put(type.getId(),type); | private void handleExit(String element){ if (Property.FIELDS.contains(element)){ if (null==property){ throw new IllegalStateException("Exiting non-extant property!\n"+"Element:"+element+"\nType:"+type+"\nProperty:"+property); } if (null==type){ throw new IllegalStateException("Inside of non-extant type!!\n"+"Element:"+element+"\nType:"+type); } property.validate(); type.getProperties().add(property); property=null; } else if (SemanticType.TYPES.contains(element)){ if (null==type){ throw new IllegalStateException("Exiting non-extent type!\n"+"Element:"+element+"\nType:"+type); } type.validate(); types.add(type); type=null; } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SaxReader.java/clean/components/dsl/src/ome/dsl/SaxReader.java |
public Set process(){ return types; | public Set<SemanticType> process(){ for (String id : types.keySet()) { SemanticType t = types.get(id); for (Property p : t.getProperties()) { String rev = p.getType(); String inv = p.getInverse(); if ( inv != null ) { if (types.containsKey(rev)) { SemanticType reverse = types.get(rev); for (Property inverse : reverse.getProperties()) { if ( inverse.getType().equals(id)) { inverse.setInverse(p.getName()); } } } } } } System.err.println("xxx"); for (String id : types.keySet()) { System.err.println(id); } return new HashSet<SemanticType>(types.values()); | public Set process(){ return types; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SaxReader.java/clean/components/dsl/src/ome/dsl/SaxReader.java |
public SaxReader(String filename){ xmlFile = this.getClass().getClassLoader().getResource(filename); init(); | public SaxReader(File file){ this(file, new DSLHandler()); | public SaxReader(String filename){ xmlFile = this.getClass().getClassLoader().getResource(filename); init(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SaxReader.java/clean/components/dsl/src/ome/dsl/SaxReader.java |
public Set parse(){ | public void parse(){ | public Set parse(){ try { parser.parse(xmlFile.getPath(), handler); } catch (Exception e) { throw new RuntimeException( "Error parsing "+xmlFile+" :\n"+e.getMessage(),e); } return handler.process(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SaxReader.java/clean/components/dsl/src/ome/dsl/SaxReader.java |
return handler.process(); | public Set parse(){ try { parser.parse(xmlFile.getPath(), handler); } catch (Exception e) { throw new RuntimeException( "Error parsing "+xmlFile+" :\n"+e.getMessage(),e); } return handler.process(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SaxReader.java/clean/components/dsl/src/ome/dsl/SaxReader.java |
|
public Set getProperties() { | public Set<Property> getProperties() { | public Set getProperties() { return properties; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6d9e84b0d2f71da76eba45bc713472ad607c544a/SemanticType.java/buggy/components/dsl/src/ome/dsl/SemanticType.java |
public abstract HttpMethodBase marshal() | public abstract HttpMethod marshal() | public abstract HttpMethodBase marshal() throws ImageServiceException; | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c0ee67611abddaf7c5a898ad8033ca4845e9d8fe/Request.java/clean/SRC/org/openmicroscopy/shoola/omeis/proxy/Request.java |
else if (format.equals(TEXTFilter.TEXT)) writeXMLFile(); | else if (format.equals(XMLFilter.XML)) WriterText.writeTableAsXML(f, mng.getModel()); | void saveROIResult(String format, String name, String msg) { UserNotifier un = control.getRegistry().getUserNotifier(); if (mng.getROIStats() == null) un.notifyError("Save ROI results", msg); else { name +="."+format; //Add extension File f = new File(name); try { if (format.equals(TEXTFilter.TEXT)) WriterText.writeTableAsText(f, mng.getModel()); else if (format.equals(TEXTFilter.TEXT)) writeXMLFile(); un.notifyInfo("ROI results saved", msg); } catch (Exception e) { f.delete(); un.notifyError("Save ROI result failure", "Unable to save the " + "result of the ROI analysis.", e); } } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0f84715d97fb9bad35cd75d5c742a1473fe1f109/ROIStatsSaverMng.java/clean/SRC/org/openmicroscopy/shoola/agents/roi/util/ROIStatsSaverMng.java |
String[][] getROIStats() { return control.getROIStats(); } | String[][] getROIStats() { return control.getROIStats(); } | String[][] getROIStats() { return control.getROIStats(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0f84715d97fb9bad35cd75d5c742a1473fe1f109/ROIStatsMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/roi/util/ROIStatsMng.java |
final JSlider slider = new JSlider(new DefaultBoundedRangeModel(100,10,10,200)); slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { int value = slider.getValue(); if(slider.getValueIsAdjusting()) { embeddedView.setZoomToScale(false); } embeddedView.setZoomLevel(((double)value)/100.0); } }); embeddedView.addZoomParamListener(new ZoomParamListener() { public void minZoomLevelChanged(double level) { System.err.println("minzoom change: "+level); int val = (int)Math.round(level*100); if(slider.getValue() < val) { slider.setValue(val); } slider.setMinimum(val); } public void maxZoomLevelChanged(double level) { int val = (int)Math.round(level*100); if(slider.getValue() > val) { slider.setValue(val); } slider.setMaximum(val); } public void zoomLevelChanged(double level) { System.err.println("zoom changed: "+level); if(!slider.getValueIsAdjusting()) { int val = (int)Math.round(level*100); slider.setValue(val); } } }); toolbarPanel.add(slider); | public BrowserInternalFrame(BrowserController theController) { setSize(600,600); setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); if(theController != null) { this.controller = theController; String title = controller.getName(); setTitle("Image Browser: "+title); this.embeddedView = controller.getView(); this.env = BrowserEnvironment.getInstance(); } JPanel toolbarPanel = new JPanel(); toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); IconManager manager = env.getIconManager(); JButton zoomButton = new JButton(manager.getSmallIcon(IconManager.ZOOM_BAR)); zoomButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.getOverlayModel().showPalette(UIConstants.ZOOM_PALETTE_NAME); } }); zoomButton.setToolTipText("Show Zoom Menu"); JButton optionsButton = new JButton(manager.getSmallIcon(IconManager.OPTIONS_BAR)); optionsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.getOverlayModel().showPalette(UIConstants.OPTIONS_PALETTE_NAME); } }); optionsButton.setToolTipText("Show Options Menu"); toolbarPanel.add(zoomButton); toolbarPanel.add(optionsButton); Container container = getContentPane(); container.setLayout(new BorderLayout()); final JScrollBar horizontalBar = new JScrollBar(JScrollBar.HORIZONTAL); final JScrollBar verticalBar = new JScrollBar(JScrollBar.VERTICAL); embeddedView.getViewCamera().addCameraListener(new CameraListener() { /* (non-Javadoc) * @see org.openmicroscopy.shoola.agents.browser.ui.CameraListener#cameraBoundsChanged(double, double, double, double, double, double) */ public void cameraBoundsChanged(double valueX, double valueY, double extentX, double extentY, double width, double height) { int iX = (int)Math.round(valueX); int iY = (int)Math.round(valueY); int iEX = (int)Math.round(extentX); int iEY = (int)Math.round(extentY); int iW = (int)Math.round(width); int iH = (int)Math.round(height); System.err.println("bounds: ["+iX+","+iY+","+iEX+"," +iEY+","+iW+","+iH+"]"); BoundedRangeModel horizModel = horizontalBar.getModel(); BoundedRangeModel vertModel = verticalBar.getModel(); if(iEX+iX > iW) horizontalBar.setEnabled(false); else { horizontalBar.setEnabled(true); if(iW != horizModel.getMaximum() || iEX != horizModel.getExtent()) { BoundedRangeModel hModel = new DefaultBoundedRangeModel(iX,iEX,0,iW); horizontalBar.setModel(hModel); } else { horizModel.setValue(iX); } } if(iEY+iY > iH) verticalBar.setEnabled(false); else { verticalBar.setEnabled(true); if(iH != vertModel.getMaximum() || iEY != vertModel.getExtent()) { BoundedRangeModel vModel = new DefaultBoundedRangeModel(iY,iEY,0,iH); verticalBar.setModel(vModel); } else { horizModel.setValue(iY); } } } }); horizontalBar.setEnabled(false); horizontalBar.setModel(new DefaultBoundedRangeModel(0,0,0,0)); horizontalBar.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { int value = e.getValue(); embeddedView.getViewCamera().setX(value); } }); verticalBar.setEnabled(false); verticalBar.setModel(new DefaultBoundedRangeModel(0,0,0,0)); verticalBar.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { int value = e.getValue(); embeddedView.getViewCamera().setY(value); } }); JPanel fakeScrollPane = new JPanel(); JPanel verticalPanel = new JPanel(); verticalPanel.setLayout(new BorderLayout()); verticalPanel.add(embeddedView,BorderLayout.CENTER); verticalPanel.add(verticalBar,BorderLayout.EAST); JPanel horizontalPanel = new JPanel(); horizontalPanel.setLayout(new BorderLayout()); horizontalPanel.add(horizontalBar,BorderLayout.CENTER); horizontalPanel.add(Box.createHorizontalStrut(verticalBar.getPreferredSize().width), BorderLayout.EAST); verticalPanel.add(horizontalPanel,BorderLayout.SOUTH); fakeScrollPane.setLayout(new BorderLayout()); fakeScrollPane.add(verticalPanel,BorderLayout.CENTER); container.add(fakeScrollPane,BorderLayout.CENTER); container.add(toolbarPanel,BorderLayout.NORTH); if(controller.getStatusView() != null) { container.add(controller.getStatusView(),BorderLayout.SOUTH); } this.addFocusListener(new CommonFocusAdapter(this)); final UIWrapper refCopy = this; this.addInternalFrameListener(new InternalFrameAdapter() { /* (non-Javadoc) * @see javax.swing.event.InternalFrameAdapter#internalFrameClosing(javax.swing.event.InternalFrameEvent) */ public void internalFrameClosing(InternalFrameEvent arg0) { env.getBrowserManager().removeBrowser(refCopy); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/931190c640a4d36141bc5769628dc3f10cf66641/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java |
|
} else { state.setResult(state.runtime.getNil()); | public void execute(EvaluationState state, InstructionContext ctx) { DefinedNode iVisited = (DefinedNode)ctx; String def = new DefinedVisitor(state).getDefinition(iVisited.getExpressionNode()); if (def != null) { state.setResult(state.runtime.newString(def)); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/079fa8abc94ff21e709074b13a680c91959242e6/EvaluateVisitor.java/buggy/src/org/jruby/evaluator/EvaluateVisitor.java |
|
ruby.defineGlobalFunction("iterator?", CallbackFactory.getSingletonMethod(RubyGlobal.class, "block_given")); | public static void createGlobals(Ruby ruby) { StringSetter stringSetter = new StringSetter(); LastlineAccessor lastlineAccessor = new LastlineAccessor(); SafeAccessor safeAccessor = new SafeAccessor(); ruby.defineHookedVariable("$/", RubyString.newString(ruby, "\n"), null, stringSetter); ruby.defineHookedVariable("$\\", ruby.getNil(), null, stringSetter); ruby.defineHookedVariable("$,", ruby.getNil(), null, stringSetter); ruby.defineHookedVariable("$.", RubyFixnum.one(ruby), null, new LineNumberSetter()); ruby.defineVirtualVariable("$_", lastlineAccessor, lastlineAccessor); ruby.defineHookedVariable("$!", ruby.getNil(), null, new ErrorInfoSetter()); ruby.defineVirtualVariable("$SAFE", safeAccessor, safeAccessor); RubyObject stdin = RubyIO.stdin(ruby, ruby.getClasses().getIoClass()); RubyObject stdout = RubyIO.stdout(ruby, ruby.getClasses().getIoClass()); RubyObject stderr = RubyIO.stderr(ruby, ruby.getClasses().getIoClass()); ruby.defineHookedVariable("$stdin", stdin, null, new StdInSetter()); ruby.defineHookedVariable("$stdout", stdout, null, new StdOutSetter()); ruby.defineHookedVariable("$stderr", stderr, null, new StdErrSetter()); ruby.defineHookedVariable("$>", stdout, null, new DefSetter()); ruby.defineHookedVariable("$defout", stdout, null, new DefSetter()); ruby.defineGlobalConstant("STDIN", stdin); ruby.defineGlobalConstant("STDOUT", stdout); ruby.defineGlobalConstant("STDERR", stderr); // ARGF, $< object RubyArgsFile argsFile = new RubyArgsFile(ruby); argsFile.initArgsFile(); // Global functions // IO, $_ String ruby.defineGlobalFunction("open", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "open")); ruby.defineGlobalFunction("format", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sprintf")); ruby.defineGlobalFunction("gets", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gets")); ruby.defineGlobalFunction("p", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "p")); ruby.defineGlobalFunction("print", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "print")); ruby.defineGlobalFunction("printf", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "printf")); ruby.defineGlobalFunction("puts", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "puts")); ruby.defineGlobalFunction("readline", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "readline")); ruby.defineGlobalFunction("readlines", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "readlines")); ruby.defineGlobalFunction("sprintf", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sprintf")); ruby.defineGlobalFunction("gsub!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gsub_bang")); ruby.defineGlobalFunction("gsub", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gsub")); ruby.defineGlobalFunction("sub!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sub_bang")); ruby.defineGlobalFunction("sub", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sub")); ruby.defineGlobalFunction("chop!", CallbackFactory.getSingletonMethod(RubyGlobal.class, "chop_bang")); ruby.defineGlobalFunction("chop", CallbackFactory.getSingletonMethod(RubyGlobal.class, "chop")); ruby.defineGlobalFunction("chomp!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "chomp_bang")); ruby.defineGlobalFunction("chomp", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "chomp")); ruby.defineGlobalFunction("split", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "split")); ruby.defineGlobalFunction("scan", CallbackFactory.getSingletonMethod(RubyGlobal.class, "scan", RubyObject.class)); ruby.defineGlobalFunction("load", CallbackFactory.getSingletonMethod(RubyGlobal.class, "load", RubyString.class)); //FIXME autoload method needs to be implemented //ruby.defineGlobalFunction("autoload", CallbackFactory.getSingletonMethod(RubyGlobal.class, "autoload", RubyString.class)); ruby.defineGlobalFunction("raise", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "raise")); ruby.defineGlobalFunction("require", CallbackFactory.getSingletonMethod(RubyGlobal.class, "require", RubyString.class)); ruby.defineGlobalFunction("global_variables", CallbackFactory.getSingletonMethod(RubyGlobal.class, "global_variables")); ruby.defineGlobalFunction("local_variables", CallbackFactory.getSingletonMethod(RubyGlobal.class, "local_variables")); ruby.defineGlobalFunction("block_given?", CallbackFactory.getSingletonMethod(RubyGlobal.class, "block_given")); ruby.defineGlobalFunction("lambda", CallbackFactory.getSingletonMethod(RubyGlobal.class, "lambda")); ruby.defineGlobalFunction("proc", CallbackFactory.getSingletonMethod(RubyGlobal.class, "proc")); ruby.defineGlobalFunction("loop", CallbackFactory.getSingletonMethod(RubyGlobal.class, "loop")); ruby.defineGlobalFunction("eval", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "eval", RubyString.class)); ruby.defineGlobalFunction("caller", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "caller")); ruby.defineGlobalFunction("catch", CallbackFactory.getSingletonMethod(RubyGlobal.class, "rbCatch", RubyObject.class)); ruby.defineGlobalFunction("throw", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "rbThrow", RubyObject.class)); ruby.defineGlobalFunction("singleton_method_added", CallbackFactory.getNilMethod()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/2f13ba47385b7584839c7f6f6f1abfee251cbe53/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java |
|
for( int i=0; i<annotations.size(); i++ ) f.g(annotations.get(i)).nl(); | for (JAnnotationUse annotation : annotations) f.g(annotation).nl(); | public void declare(JFormatter f) { if (jdoc != null) f.nl().g(jdoc); if (annotations != null){ for( int i=0; i<annotations.size(); i++ ) f.g(annotations.get(i)).nl(); } f.g(mods).p(classType.declarationToken).id(name).d(generifiable); if (superClass != null && superClass != owner().ref(Object.class)) f.nl().i().p("extends").g(superClass).nl().o(); if (!interfaces.isEmpty()) { if (superClass == null) f.nl(); f.i().p(classType==ClassType.INTERFACE ? "extends" : "implements"); f.g(interfaces); f.nl().o(); } declareBody(f); } | 53231 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53231/ee6618a6d0c176aa38bdc3eefc87df9f60c84554/JDefinedClass.java/buggy/trunk/codemodel/src/com/sun/codemodel/JDefinedClass.java |
JEnumConstant ec = new JEnumConstant(this, name); enumConstantsByName.put(name, ec); return ec; | JEnumConstant ec = enumConstantsByName.get(name); if (null == ec) { ec = new JEnumConstant(this, name); enumConstantsByName.put(name, ec); } return ec; | public JEnumConstant enumConstant(String name){ JEnumConstant ec = new JEnumConstant(this, name); enumConstantsByName.put(name, ec); return ec; } | 53231 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53231/ee6618a6d0c176aa38bdc3eefc87df9f60c84554/JDefinedClass.java/buggy/trunk/codemodel/src/com/sun/codemodel/JDefinedClass.java |
outer : | public JMethod getMethod(String name, JType[] argTypes) { outer : for (JMethod m : methods) { if (!m.name().equals(name)) continue; if (m.hasSignature(argTypes)) return m; } return null; } | 53231 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53231/ee6618a6d0c176aa38bdc3eefc87df9f60c84554/JDefinedClass.java/buggy/trunk/codemodel/src/com/sun/codemodel/JDefinedClass.java |
|
Map kernelMethods = getRuntime().getClasses().getKernelModule().getMethods(); | private RubyArray instance_methods(IRubyObject[] args, final Visibility visibility) { boolean includeSuper = args.length > 0 ? args[0].isTrue() : true; RubyArray ary = RubyArray.newArray(getRuntime()); Map kernelMethods = getRuntime().getClasses().getKernelModule().getMethods(); for (RubyModule p = this; p != null; p = p.getSuperClass()) { // kernel methods do not get printed out (but why?). if (p.getMethods() == kernelMethods) { continue; } for (Iterator iter = p.getMethods().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); if (method.getVisibility().is(visibility)) { RubyString name = RubyString.newString(getRuntime(), (String) entry.getKey()); if (!ary.includes(name)) { ary.append(name); } } } if (!includeSuper) { break; } } return ary; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/111ffceb6641644db641863784ba47cc459fef17/RubyModule.java/clean/src/org/jruby/RubyModule.java |
|
if (p.getMethods() == kernelMethods) { continue; } | private RubyArray instance_methods(IRubyObject[] args, final Visibility visibility) { boolean includeSuper = args.length > 0 ? args[0].isTrue() : true; RubyArray ary = RubyArray.newArray(getRuntime()); Map kernelMethods = getRuntime().getClasses().getKernelModule().getMethods(); for (RubyModule p = this; p != null; p = p.getSuperClass()) { // kernel methods do not get printed out (but why?). if (p.getMethods() == kernelMethods) { continue; } for (Iterator iter = p.getMethods().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); if (method.getVisibility().is(visibility)) { RubyString name = RubyString.newString(getRuntime(), (String) entry.getKey()); if (!ary.includes(name)) { ary.append(name); } } } if (!includeSuper) { break; } } return ary; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/111ffceb6641644db641863784ba47cc459fef17/RubyModule.java/clean/src/org/jruby/RubyModule.java |
|
if (method.getVisibility().is(visibility)) { | if (method.getVisibility().is(visibility) && method.isUndefined() == false) { | private RubyArray instance_methods(IRubyObject[] args, final Visibility visibility) { boolean includeSuper = args.length > 0 ? args[0].isTrue() : true; RubyArray ary = RubyArray.newArray(getRuntime()); Map kernelMethods = getRuntime().getClasses().getKernelModule().getMethods(); for (RubyModule p = this; p != null; p = p.getSuperClass()) { // kernel methods do not get printed out (but why?). if (p.getMethods() == kernelMethods) { continue; } for (Iterator iter = p.getMethods().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); if (method.getVisibility().is(visibility)) { RubyString name = RubyString.newString(getRuntime(), (String) entry.getKey()); if (!ary.includes(name)) { ary.append(name); } } } if (!includeSuper) { break; } } return ary; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/111ffceb6641644db641863784ba47cc459fef17/RubyModule.java/clean/src/org/jruby/RubyModule.java |
return getRuntime().getNil(); | throw new NameError(getRuntime(), "undefined method `" + name + "' for class `" + this.getName() + "'"); | public IRubyObject newMethod(IRubyObject receiver, String name, boolean bound) { CacheEntry ent = getMethodBodyCached(name); if (! ent.isDefined()) { // printUndef(); return getRuntime().getNil(); } while (ent.getMethod() instanceof EvaluateMethod && ((EvaluateMethod) ent.getMethod()).getNode() instanceof ZSuperNode) { ent = ent.getOrigin().getSuperClass().getMethodBodyCached(ent.getOriginalName()); if (! ent.isDefined()) { // printUndef(); return getRuntime().getNil(); } } Method method = null; if (bound) { method = Method.newMethod(ent.getOrigin(), ent.getOriginalName(), this, name, ent.getMethod(), receiver); } else { method = UnboundMethod.newUnboundMethod(ent.getOrigin(), ent.getOriginalName(), this, name, ent.getMethod()); } method.infectBy(this); return method; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/111ffceb6641644db641863784ba47cc459fef17/RubyModule.java/clean/src/org/jruby/RubyModule.java |
inputStreamClosed = true; | private final void FillBuff() throws java.io.IOException { // Buffer fill logic: // If there is at least 2K left in this buffer, just read some more // Otherwise, if we're processing a token and it either // (a) starts in the other buffer (meaning it's filled both part of // the other buffer and some of this one, or // (b) starts in the first 2K of this buffer (meaning its taken up // most of this buffer // we expand this buffer. Otherwise, we swap buffers. // This guarantees we will be able to back up at least 2K characters. if (curBuf.size - curBuf.dataLen < 2048) { if (tokenBeginPos >= 0 && ((tokenBeginBuf == curBuf && tokenBeginPos < 2048) || tokenBeginBuf != curBuf)) { curBuf.expand(2048); } else { swapBuf(); curBuf.curPos = curBuf.dataLen = 0; } } try { int i = inputStream.read(curBuf.buffer, curBuf.dataLen, curBuf.size - curBuf.dataLen); if (i == -1) { inputStream.close(); throw new java.io.IOException(); } else curBuf.dataLen += i; return; } catch(java.io.IOException e) { if (curBuf.curPos > 0) --curBuf.curPos; if (tokenBeginPos == -1) { tokenBeginPos = curBuf.curPos; tokenBeginBuf = curBuf; } if (e.getClass().getName().equals("sun.io.MalformedInputException")) { // it's an ugly hack, but we want to pass this exception // through the JavaCC parser, since it has a bad // exception handling throw new ParserRuntimeException("MalformedInput",e); } throw e; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/fbf02da47b28287a2fb58ba11f732d631e0446f7/BackupCharStream.java/clean/webmacro/src/org/webmacro/parser/BackupCharStream.java |
|
inputStreamClosed = false; | public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (bufA == null || bufA.size != buffersize) bufA = new Buffer(buffersize); if (bufB == null || bufB.size != buffersize) bufB = new Buffer(buffersize); curBuf = bufA; otherBuf = bufB; curBuf.curPos = otherBuf.dataLen = -1; curBuf.dataLen = otherBuf.dataLen = 0; prevCharIsLF = prevCharIsCR = false; tokenBeginPos = -1; tokenBeginBuf = null; backupChars = 0; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/fbf02da47b28287a2fb58ba11f732d631e0446f7/BackupCharStream.java/clean/webmacro/src/org/webmacro/parser/BackupCharStream.java |
|
int addlChars = amount - 1 - curBuf.curPos; | int addlChars = amount - (inputStreamClosed? 0 : 1) - curBuf.curPos; | public final void backup(int amount) { backupChars += amount; if (curBuf.curPos - amount < 0) { int addlChars = amount - 1 - curBuf.curPos; curBuf.curPos = 0; swapBuf(); curBuf.curPos = curBuf.dataLen - addlChars - 1; } else { curBuf.curPos -= amount; } } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/fbf02da47b28287a2fb58ba11f732d631e0446f7/BackupCharStream.java/clean/webmacro/src/org/webmacro/parser/BackupCharStream.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.