rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
getRuntime().getClasses().putClass(name, newClass);
runtime.getClasses().putClass(name, newClass, parentModule);
public RubyClass newSubClass(String name, RubyModule parentModule) { RubyClass newClass = new RubyClass(getRuntime(), getRuntime().getClasses().getClassClass(), this, parentModule, name); newClass.makeMetaClass(getMetaClass()); newClass.inheritedBy(this); getRuntime().getClasses().putClass(name, newClass); return newClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/750e66982e97bcb72545a39ceacf6ee32a52a135/RubyClass.java/clean/src/org/jruby/RubyClass.java
IconManager icons = IconManager.getInstance(); putValue(Action.SMALL_ICON, icons.getIcon(IconManager.FLAT_LAYOUT));
public FlatLayoutAction(HiViewer model) { super(model); setEnabled(true); putValue(Action.NAME, NAME); //String description = // LayoutFactory.getLayoutDescription(LayoutFactory.FLAT_LAYOUT); putValue(Action.SHORT_DESCRIPTION, ""); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ea7509babe2344eb702969105eb77096cc5b6bcf/FlatLayoutAction.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/actions/FlatLayoutAction.java
GroupData g = (GroupData) it.next(); e.linkExperimenterGroup((ExperimenterGroup) mapper.map(g));
GroupData gd = (GroupData) it.next(); ExperimenterGroup g = (ExperimenterGroup) mapper.map( gd ); if ( ! linked( g.findGroupExperimenterMap( e ))) e.linkExperimenterGroup( g );
public IObject fillIObject( IObject obj, ReverseModelMapper mapper) { if ( obj instanceof Experimenter) { Experimenter e = (Experimenter) obj; if (super.fill(e)) { e.setFirstName(this.getFirstName()); e.setLastName(this.getLastName()); e.setEmail(this.getEmail()); e.setInstitution(this.getInstitution()); if (this.getGroups() != null) { for (Iterator it = this.getGroups().iterator(); it.hasNext();) { GroupData g = (GroupData) it.next(); e.linkExperimenterGroup((ExperimenterGroup) mapper.map(g)); } } } return e; } else { throw new IllegalArgumentException( "ExperimenterData can only fill Experimenter."); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b7d44d4a82558acd2336a661072dda1f38cfc0b3/ExperimenterData.java/buggy/components/shoola-adapter/src/pojos/ExperimenterData.java
System.err.println(attributes.get(0)); getAnnotationManager().annotateAttributes(attributes);
getAnnotationManager().annotateAttributes(attributes);
void annotateAttributesData(List attributes) throws DSOutOfServiceException, DSAccessException { try { System.err.println(attributes.get(0)); getAnnotationManager().annotateAttributes(attributes); } catch (RemoteConnectionException rce) { throw new DSOutOfServiceException("Can't connect to OMEDS", rce); } catch (RemoteAuthenticationException rae) { throw new DSOutOfServiceException("Not logged in", rae); } catch (RemoteServerErrorException rsee) { rsee.printStackTrace(); throw new DSAccessException("Can't load data", rsee); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/f5113c7a4ff99bcbee06e1b48554259a952e1a44/OMEDSGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEDSGateway.java
rsee.printStackTrace();
Object retrieveData(Class dto, Criteria c) throws DSOutOfServiceException, DSAccessException { Object retVal; try { retVal = getDataFactory().retrieve(dto, c); } catch (RemoteConnectionException rce) { throw new DSOutOfServiceException("Can't connect to OMEDS", rce); } catch (RemoteAuthenticationException rae) { throw new DSOutOfServiceException("Not logged in", rae); } catch (RemoteServerErrorException rsee) { rsee.printStackTrace(); throw new DSAccessException("Can't load data", rsee); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/f5113c7a4ff99bcbee06e1b48554259a952e1a44/OMEDSGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEDSGateway.java
rsee.printStackTrace();
Object retrieveListSTSData(String semanticTypeName, Criteria c) throws DSOutOfServiceException, DSAccessException { Object retVal; try { retVal = getDataFactory().retrieveList(semanticTypeName, c); } catch (RemoteConnectionException rce) { throw new DSOutOfServiceException("Can't connect to OMEDS", rce); } catch (RemoteAuthenticationException rae) { throw new DSOutOfServiceException("Not logged in", rae); } catch (RemoteServerErrorException rsee) { rsee.printStackTrace(); throw new DSAccessException("Can't load data", rsee); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/f5113c7a4ff99bcbee06e1b48554259a952e1a44/OMEDSGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEDSGateway.java
rsee.printStackTrace();
Object retrieveSTSData(String semanticTypeName, Criteria c) throws DSOutOfServiceException, DSAccessException { Object retVal; try { retVal = getDataFactory().retrieve(semanticTypeName, c); } catch (RemoteConnectionException rce) { throw new DSOutOfServiceException("Can't connect to OMEDS", rce); } catch (RemoteAuthenticationException rae) { throw new DSOutOfServiceException("Not logged in", rae); } catch (RemoteServerErrorException rsee) { rsee.printStackTrace(); throw new DSAccessException("Can't load data", rsee); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/f5113c7a4ff99bcbee06e1b48554259a952e1a44/OMEDSGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEDSGateway.java
public ImagePlate(Integer attributeId, String well, Integer sample, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.attributeId = attributeId; this.well = well; this.sample = sample; this.image = image; this.moduleExecution = moduleExecution;
public ImagePlate() {
public ImagePlate(Integer attributeId, String well, Integer sample, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.attributeId = attributeId; this.well = well; this.sample = sample; this.image = image; this.moduleExecution = moduleExecution; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/ImagePlate.java/buggy/components/common/src/org/openmicroscopy/omero/model/ImagePlate.java
return new RangeDefinition(ruby).getType();
RubyClass result = ruby.defineClass("Range", ruby.getClasses().getObjectClass()); CallbackFactory callbackFactory = ruby.callbackFactory(); result.includeModule(ruby.getClasses().getEnumerableModule()); result.defineMethod("==", callbackFactory.getMethod(RubyRange.class, "equal", IRubyObject.class)); result.defineMethod("===", callbackFactory.getMethod(RubyRange.class, "op_eqq", IRubyObject.class)); result.defineMethod("begin", callbackFactory.getMethod(RubyRange.class, "first")); result.defineMethod("each", callbackFactory.getMethod(RubyRange.class, "each")); result.defineMethod("end", callbackFactory.getMethod(RubyRange.class, "last")); result.defineMethod("exclude_end?", callbackFactory.getMethod(RubyRange.class, "exclude_end_p")); result.defineMethod("first", callbackFactory.getMethod(RubyRange.class, "first")); result.defineMethod("initialize", callbackFactory.getOptMethod(RubyRange.class, "initialize")); result.defineMethod("inspect", callbackFactory.getMethod(RubyRange.class, "inspect")); result.defineMethod("last", callbackFactory.getMethod(RubyRange.class, "last")); result.defineMethod("length", callbackFactory.getMethod(RubyRange.class, "length")); result.defineMethod("size", callbackFactory.getMethod(RubyRange.class, "length")); result.defineMethod("to_s", callbackFactory.getMethod(RubyRange.class, "inspect")); return result;
public static RubyClass createRangeClass(Ruby ruby) { return new RangeDefinition(ruby).getType(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1c602493a83e2050f401fa6925ec7e9269b45e4e/RubyRange.java/clean/src/org/jruby/RubyRange.java
buf.append(sep.getValue());
buf.append(sep.toString());
public RubyString join(RubyString sep) { StringBuffer buf = new StringBuffer(); int length = getLength(); if (length == 0) { getRuntime().newString(""); } boolean taint = isTaint() || sep.isTaint(); RubyString str; IRubyObject tmp = null; for (long i = 0; i < length; i++) { tmp = entry(i); taint |= tmp.isTaint(); if (tmp instanceof RubyString) { // do nothing } else if (tmp instanceof RubyArray) { tmp = ((RubyArray) tmp).join(sep); } else { tmp = RubyString.objAsString(tmp); } if (i > 0 && !sep.isNil()) { buf.append(sep.getValue()); } buf.append(((RubyString)tmp).getValue()); } str = RubyString.newString(getRuntime(), buf.toString()); str.setTaint(taint); return str; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyArray.java/clean/src/org/jruby/RubyArray.java
buf.append(((RubyString)tmp).getValue());
buf.append(((RubyString)tmp).toString());
public RubyString join(RubyString sep) { StringBuffer buf = new StringBuffer(); int length = getLength(); if (length == 0) { getRuntime().newString(""); } boolean taint = isTaint() || sep.isTaint(); RubyString str; IRubyObject tmp = null; for (long i = 0; i < length; i++) { tmp = entry(i); taint |= tmp.isTaint(); if (tmp instanceof RubyString) { // do nothing } else if (tmp instanceof RubyArray) { tmp = ((RubyArray) tmp).join(sep); } else { tmp = RubyString.objAsString(tmp); } if (i > 0 && !sep.isNil()) { buf.append(sep.getValue()); } buf.append(((RubyString)tmp).getValue()); } str = RubyString.newString(getRuntime(), buf.toString()); str.setTaint(taint); return str; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyArray.java/clean/src/org/jruby/RubyArray.java
createFixnumCache();
private void callInits() { classes = new RubyClasses(this); classes.initCoreClasses(); exceptions = new RubyExceptions(this); exceptions.initDefaultExceptionClasses(); rubyTopSelf = new RubyObject(this, classes.getObjectClass()); /*rubyTopSelf.defineSingletonMethod("to_s", new RubyCallbackMethod() { public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { return RubyString.m_newString(ruby, "main"); } });*/ createFixnumCache(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/Ruby.java/clean/org/jruby/Ruby.java
} catch (BreakException bExcptn) {
} catch (BreakJump bExcptn) {
public RubyObject iterate(Callback iterateMethod, RubyObject data1, Callback blockMethod, RubyObject data2) { Node node = new NodeFactory(this).newIFunc(blockMethod, data2); // VALUE self = ruby_top_self; getIter().push(RubyIter.ITER_PRE); getBlock().push(null, node, getRubyTopSelf()); try { while (true) { try { return iterateMethod.execute(data1, null, this); } catch (BreakException bExcptn) { return getNil(); } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (RetryException rExcptn) { } } } finally { getIter().pop(); getBlock().pop(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/Ruby.java/clean/org/jruby/Ruby.java
sb.append(_content[i].toString());
sb.append(_content[i] == null ? "null" : _content[i].toString());
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("("); for (int i = 0; i < _content.length; i++) { if (i != 0) { sb.append(", "); } sb.append(_content[i].toString()); } sb.append(")"); return sb.toString(); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/8c5d4a5eb42f1bccebd7bbb160d17c0002a8e147/ListBuilder.java/buggy/webmacro/src/org/webmacro/engine/ListBuilder.java
private BufferedImage createBufferedImage(RGBBuffer buf, int sizeX, int sizeY)
private BufferedImage createBufferedImage(int[] buf, int sizeX, int sizeY)
private BufferedImage createBufferedImage(RGBBuffer buf, int sizeX, int sizeY) { RGBByteBuffer j2DBuf = new RGBByteBuffer(buf, sizeX, sizeY); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); BufferedImage image = new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_RGB); image.setData(Raster.createWritableRaster(csm, j2DBuf, null)); return image; /* Unfortunately, the following creates "CUSTOM" buffered images which with some VM's cannot be used in the ImagingLib. Nasty. ColorModel cm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster r = Raster.createWritableRaster(csm, j2DBuf, null); return new BufferedImage(cm, r, false, null); */ }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/64e6d912272b039f986c1a36d1ca930cc5578578/ThumbImpl.java/clean/components/server/src/ome/logic/ThumbImpl.java
RGBByteBuffer j2DBuf = new RGBByteBuffer(buf, sizeX, sizeY); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3);
DataBuffer j2DBuf = new DataBufferInt(buf, sizeX * sizeY, 0); SinglePixelPackedSampleModel sampleModel = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT, sizeX, sizeY, sizeX, new int[] { 0x00ff0000, 0x0000ff00, 0x000000ff, }); WritableRaster raster = new IntegerInterleavedRaster(sampleModel, j2DBuf, new Point(0, 0)); ColorModel colorModel = new DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff );
private BufferedImage createBufferedImage(RGBBuffer buf, int sizeX, int sizeY) { RGBByteBuffer j2DBuf = new RGBByteBuffer(buf, sizeX, sizeY); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); BufferedImage image = new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_RGB); image.setData(Raster.createWritableRaster(csm, j2DBuf, null)); return image; /* Unfortunately, the following creates "CUSTOM" buffered images which with some VM's cannot be used in the ImagingLib. Nasty. ColorModel cm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster r = Raster.createWritableRaster(csm, j2DBuf, null); return new BufferedImage(cm, r, false, null); */ }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/64e6d912272b039f986c1a36d1ca930cc5578578/ThumbImpl.java/clean/components/server/src/ome/logic/ThumbImpl.java
new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_RGB); image.setData(Raster.createWritableRaster(csm, j2DBuf, null));
new BufferedImage(colorModel, raster, false, null);
private BufferedImage createBufferedImage(RGBBuffer buf, int sizeX, int sizeY) { RGBByteBuffer j2DBuf = new RGBByteBuffer(buf, sizeX, sizeY); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); BufferedImage image = new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_RGB); image.setData(Raster.createWritableRaster(csm, j2DBuf, null)); return image; /* Unfortunately, the following creates "CUSTOM" buffered images which with some VM's cannot be used in the ImagingLib. Nasty. ColorModel cm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster r = Raster.createWritableRaster(csm, j2DBuf, null); return new BufferedImage(cm, r, false, null); */ }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/64e6d912272b039f986c1a36d1ca930cc5578578/ThumbImpl.java/clean/components/server/src/ome/logic/ThumbImpl.java
/* Unfortunately, the following creates "CUSTOM" buffered images which with some VM's cannot be used in the ImagingLib. Nasty. ColorModel cm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster r = Raster.createWritableRaster(csm, j2DBuf, null); return new BufferedImage(cm, r, false, null); */
private BufferedImage createBufferedImage(RGBBuffer buf, int sizeX, int sizeY) { RGBByteBuffer j2DBuf = new RGBByteBuffer(buf, sizeX, sizeY); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); BufferedImage image = new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_RGB); image.setData(Raster.createWritableRaster(csm, j2DBuf, null)); return image; /* Unfortunately, the following creates "CUSTOM" buffered images which with some VM's cannot be used in the ImagingLib. Nasty. ColorModel cm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster r = Raster.createWritableRaster(csm, j2DBuf, null); return new BufferedImage(cm, r, false, null); */ }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/64e6d912272b039f986c1a36d1ca930cc5578578/ThumbImpl.java/clean/components/server/src/ome/logic/ThumbImpl.java
RGBBuffer buf = re.render(pd);
int[] buf = re.renderAsPackedInt(pd);
private BufferedImage createScaledImage(Pixels pixels, RenderingDef def, Integer sizeX, Integer sizeY) { // Original sizes and thumbnail metadata int origSizeX = pixels.getSizeX(); int origSizeY = pixels.getSizeY(); // Retrieve our rendered data and translate to a buffered image initializeRenderingEngine(pixels); PlaneDef pd = new PlaneDef(PlaneDef.XY, re.getDefaultT()); pd.setZ(re.getDefaultZ()); RGBBuffer buf = re.render(pd); BufferedImage image = createBufferedImage(buf, origSizeX, origSizeY); // Finally, scale our image using scaling factors (percentage). log.info("Setting xScale factor: " + sizeX + "/" + origSizeX); float xScale = (float) sizeX / origSizeX; log.info("Setting yScale factor: " + sizeX + "/" + origSizeX); float yScale = (float) sizeY / origSizeY; return iScale.scaleBufferedImage(image, xScale, yScale); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/64e6d912272b039f986c1a36d1ca930cc5578578/ThumbImpl.java/clean/components/server/src/ome/logic/ThumbImpl.java
if (y != null && y > getSizeY())
if (y != null && (y > getSizeY() - 1 || y < 0))
private void checkBounds(Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException { if (y != null && y > getSizeY()) throw new DimensionsOutOfBoundsException("Y '" + y + "' greater than height '" + getSizeY() + "'."); if (z != null && z > getSizeZ()) throw new DimensionsOutOfBoundsException("Z '" + z + "' greater than height '" + getSizeZ() + "'."); if (c != null && c > getSizeC()) throw new DimensionsOutOfBoundsException("C '" + c + "' greater than height '" + getSizeC() + "'."); if (t != null && t > getSizeT()) throw new DimensionsOutOfBoundsException("T '" + t + "' greater than height '" + getSizeT() + "'."); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ece0c50ab6ed7bb25e80ce4af99ead35eda41b0d/PixelBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/PixelBuffer.java
if (z != null && z > getSizeZ())
if (z != null && (z > getSizeZ() - 1 || z < 0))
private void checkBounds(Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException { if (y != null && y > getSizeY()) throw new DimensionsOutOfBoundsException("Y '" + y + "' greater than height '" + getSizeY() + "'."); if (z != null && z > getSizeZ()) throw new DimensionsOutOfBoundsException("Z '" + z + "' greater than height '" + getSizeZ() + "'."); if (c != null && c > getSizeC()) throw new DimensionsOutOfBoundsException("C '" + c + "' greater than height '" + getSizeC() + "'."); if (t != null && t > getSizeT()) throw new DimensionsOutOfBoundsException("T '" + t + "' greater than height '" + getSizeT() + "'."); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ece0c50ab6ed7bb25e80ce4af99ead35eda41b0d/PixelBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/PixelBuffer.java
if (c != null && c > getSizeC())
if (c != null && (c > getSizeC() - 1 || c < 0))
private void checkBounds(Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException { if (y != null && y > getSizeY()) throw new DimensionsOutOfBoundsException("Y '" + y + "' greater than height '" + getSizeY() + "'."); if (z != null && z > getSizeZ()) throw new DimensionsOutOfBoundsException("Z '" + z + "' greater than height '" + getSizeZ() + "'."); if (c != null && c > getSizeC()) throw new DimensionsOutOfBoundsException("C '" + c + "' greater than height '" + getSizeC() + "'."); if (t != null && t > getSizeT()) throw new DimensionsOutOfBoundsException("T '" + t + "' greater than height '" + getSizeT() + "'."); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ece0c50ab6ed7bb25e80ce4af99ead35eda41b0d/PixelBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/PixelBuffer.java
if (t != null && t > getSizeT())
if (t != null && (t > getSizeT() - 1 || t < 0))
private void checkBounds(Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException { if (y != null && y > getSizeY()) throw new DimensionsOutOfBoundsException("Y '" + y + "' greater than height '" + getSizeY() + "'."); if (z != null && z > getSizeZ()) throw new DimensionsOutOfBoundsException("Z '" + z + "' greater than height '" + getSizeZ() + "'."); if (c != null && c > getSizeC()) throw new DimensionsOutOfBoundsException("C '" + c + "' greater than height '" + getSizeC() + "'."); if (t != null && t > getSizeT()) throw new DimensionsOutOfBoundsException("T '" + t + "' greater than height '" + getSizeT() + "'."); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ece0c50ab6ed7bb25e80ce4af99ead35eda41b0d/PixelBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/PixelBuffer.java
return RubyFixnum.newFixnum(getRuby(), symbol.hashCode());
return id();
public RubyFixnum hash() { return RubyFixnum.newFixnum(getRuby(), symbol.hashCode()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0d05f52f4b20deb7938755dd220bb81c2c2b208e/RubySymbol.java/clean/org/jruby/RubySymbol.java
if (args != null && args.length == 0) {
if (args == null || args.length == 0) {
public IRubyObject insert(RubyNumeric index, IRubyObject[] args) { // ruby does not bother to bounds check index, if no elements are // to be added. if (args != null && args.length == 0) { return this; } // too negative of an offset will throw an IndexError long offset = index.getLongValue(); if (offset < 0 && getLength() + offset < 0) { throw new IndexError(getRuntime(), "index " + (getLength() + offset) + " out of array"); } // An offset larger than the current length will pad with nils // to length if (offset > getLength()) { long difference = offset - getLength(); IRubyObject nil = getRuntime().getNil(); for (long i = 0; i < difference; i++) { list.add(nil); } } if (offset < 0) { offset += getLength() + 1; } for (int i = 0; i < args.length; i++) { list.add((int) (offset + i), args[i]); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/e0528a07eb03eecc6125079c5ce22e3246ea0358/RubyArray.java/buggy/src/org/jruby/RubyArray.java
public void unmarshal(HttpMethodBase response, HttpChannel context)
public void unmarshal(HttpMethod response, HttpChannel context)
public void unmarshal(HttpMethodBase response, HttpChannel context) throws ImageServiceException, IOException { //Make sure we actually got a binary stream. checkStatusCode(response); checkContentType(response, MIME_TYPE); //Read the stream into buffer. readResponseStream(response.getResponseBodyAsStream(), buffer, context.getBlockSize()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c0ee67611abddaf7c5a898ad8033ca4845e9d8fe/GetStackReply.java/clean/SRC/org/openmicroscopy/shoola/omeis/proxy/GetStackReply.java
loginUser( e1.getOmeName() ); iAdmin.changePermissions(i, Permissions.EMPTY); iAdmin.changePermissions(i, Permissions.DEFAULT); loginRoot(); iAdmin.changePermissions(i, Permissions.EMPTY); iAdmin.changePermissions(i, Permissions.DEFAULT);
public void testUserCanOnlySetDetailsOnOwnObject() throws Exception { Experimenter e1 = testExperimenter(); iAdmin.createUser( e1 ); loginUser( e1.getOmeName() ); Image i = new Image(); i.setName( "test" ); i = iUpdate.saveAndReturnObject( i ); // this user should not be able to change things Experimenter e2 = testExperimenter(); iAdmin.createUser( e2 ); loginUser( e2.getOmeName() ); try { iAdmin.changeOwner(i, e2.getOmeName() ); fail ("secvio!"); } catch (SecurityViolation sv) {} try { iAdmin.changeGroup(i, "system" ); fail ("secvio!"); } catch (SecurityViolation sv) {} try { iAdmin.changePermissions(i, Permissions.EMPTY ); fail ("secvio!"); } catch (SecurityViolation sv) {} }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/7e7c45d25ea1bbef3485ae116b3eb108d9f6f5ef/AdminTest.java/buggy/components/server/test/ome/server/itests/sec/AdminTest.java
delegate = (RenderingEngine) applicationContext.getBean( RenderingEngine.class.getName());
delegate = serviceFactory.createRenderingEngine();
public void create() { super.create(); delegate = (RenderingEngine) applicationContext.getBean( RenderingEngine.class.getName()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/RenderingBean.java/clean/components/ejb/src/ome/ro/ejb/RenderingBean.java
return wrap( context, "&renderService" );
return wrap( context, RenderingEngine.class );
public Object invoke( InvocationContext context ) throws Exception { return wrap( context, "&renderService" ); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/RenderingBean.java/clean/components/ejb/src/ome/ro/ejb/RenderingBean.java
fixnumClass.defineMethod("==", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("eql?", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("equal?", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class));
fixnumClass.defineMethod("==", CallbackFactory.getMethod(RubyFixnum.class, "equal", RubyObject.class)); fixnumClass.defineMethod("eql?", CallbackFactory.getMethod(RubyFixnum.class, "equal", RubyObject.class)); fixnumClass.defineMethod("equal?", CallbackFactory.getMethod(RubyFixnum.class, "equal", RubyObject.class));
public static RubyClass createFixnumClass(Ruby ruby) { RubyClass fixnumClass = ruby.defineClass("Fixnum", ruby.getClasses().getIntegerClass()); fixnumClass.includeModule(ruby.getClasses().getPrecisionModule()); fixnumClass.defineSingletonMethod("induced_from", CallbackFactory.getSingletonMethod(RubyFixnum.class, "induced_from", RubyObject.class)); fixnumClass.defineMethod("to_f", CallbackFactory.getMethod(RubyFixnum.class, "to_f")); fixnumClass.defineMethod("to_s", CallbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("to_str", CallbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("taint", CallbackFactory.getSelfMethod(0)); fixnumClass.defineMethod("freeze", CallbackFactory.getSelfMethod(0)); fixnumClass.defineMethod("<<", CallbackFactory.getMethod(RubyFixnum.class, "op_lshift", RubyObject.class)); fixnumClass.defineMethod(">>", CallbackFactory.getMethod(RubyFixnum.class, "op_rshift", RubyObject.class)); fixnumClass.defineMethod("+", CallbackFactory.getMethod(RubyFixnum.class, "op_plus", RubyObject.class)); fixnumClass.defineMethod("-", CallbackFactory.getMethod(RubyFixnum.class, "op_minus", RubyObject.class)); fixnumClass.defineMethod("*", CallbackFactory.getMethod(RubyFixnum.class, "op_mul", RubyObject.class)); fixnumClass.defineMethod("/", CallbackFactory.getMethod(RubyFixnum.class, "op_div", RubyObject.class)); fixnumClass.defineMethod("%", CallbackFactory.getMethod(RubyFixnum.class, "op_mod", RubyObject.class)); fixnumClass.defineMethod("**", CallbackFactory.getMethod(RubyFixnum.class, "op_pow", RubyObject.class)); fixnumClass.defineMethod("==", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("eql?", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("equal?", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("<=>", CallbackFactory.getMethod(RubyFixnum.class, "op_cmp", RubyObject.class)); fixnumClass.defineMethod(">", CallbackFactory.getMethod(RubyFixnum.class, "op_gt", RubyObject.class)); fixnumClass.defineMethod(">=", CallbackFactory.getMethod(RubyFixnum.class, "op_ge", RubyObject.class)); fixnumClass.defineMethod("<", CallbackFactory.getMethod(RubyFixnum.class, "op_lt", RubyObject.class)); fixnumClass.defineMethod("<=", CallbackFactory.getMethod(RubyFixnum.class, "op_le", RubyObject.class)); fixnumClass.defineMethod("&", CallbackFactory.getMethod(RubyFixnum.class, "op_and", RubyObject.class)); fixnumClass.defineMethod("|", CallbackFactory.getMethod(RubyFixnum.class, "op_or", RubyInteger.class)); fixnumClass.defineMethod("^", CallbackFactory.getMethod(RubyFixnum.class, "op_xor", RubyInteger.class)); fixnumClass.defineMethod("size", CallbackFactory.getMethod(RubyFixnum.class, "size")); fixnumClass.defineMethod("[]", CallbackFactory.getMethod(RubyFixnum.class, "aref", RubyInteger.class)); return fixnumClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/06e8c0888351efa411cfdddbdf48771ce7f584c0/RubyFixnum.java/clean/org/jruby/RubyFixnum.java
public RubyBoolean equal(RubyObject obj) { return RubyBoolean.newBoolean(ruby, obj instanceof RubyFixnum && ((RubyFixnum)obj).getLongValue() == getLongValue());
public RubyBoolean equal(RubyObject other) { if (!(other instanceof RubyNumeric)) { return getRuby().getFalse(); } else { return RubyBoolean.newBoolean(getRuby(), compareValue((RubyNumeric) other) == 0); }
public RubyBoolean equal(RubyObject obj) { return RubyBoolean.newBoolean(ruby, obj instanceof RubyFixnum && ((RubyFixnum)obj).getLongValue() == getLongValue()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/06e8c0888351efa411cfdddbdf48771ce7f584c0/RubyFixnum.java/clean/org/jruby/RubyFixnum.java
void finish() { String s = doBasic.getNameText(); if (s == null || s.length() == 0) { doBasic.resetNameArea(); handleNameAreaRemove(0); return; } if (s.length() > 255) { UserNotifier un = TreeViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo("Editor", "The name is too long. Cannot be more " + "than 255 characters long."); doBasic.resetName(); return; } switch (model.getEditorType()) { case Editor.CREATE_EDITOR: controller.createObject(fillDataObject()); break; case Editor.PROPERTIES_EDITOR: finishEdit(); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/95ab942c5bc5a0d5f1ca657d5fcd197d44c5f34c/EditorUI.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/EditorUI.java
return args[0].eval( args[1], self.getRuntime().getNil(), ((RubyString) args[2]).getValue(), RubyNumeric.fix2int(args[3]));
IRubyObject under = args[0]; IRubyObject src = args[1]; IRubyObject file = args[2]; IRubyObject line = args[3]; return under.eval(src, self.getRuntime().getNil(), ((RubyString) file).getValue(), RubyNumeric.fix2int(line));
public IRubyObject evalUnder(RubyModule under, IRubyObject src, IRubyObject file, IRubyObject line) { /* if (ruby_safe_level >= 4) { Check_Type(src, T_STRING); } else { Check_SafeStr(src); } */ return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { return args[0].eval( args[1], self.getRuntime().getNil(), ((RubyString) args[2]).getValue(), RubyNumeric.fix2int(args[3])); } public Arity getArity() { return Arity.optional(); } }, new IRubyObject[] { this, src, file, line }); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
return args[0].eval( args[1], self.getRuntime().getNil(), ((RubyString) args[2]).getValue(), RubyNumeric.fix2int(args[3]));
IRubyObject under = args[0]; IRubyObject src = args[1]; IRubyObject file = args[2]; IRubyObject line = args[3]; return under.eval(src, self.getRuntime().getNil(), ((RubyString) file).getValue(), RubyNumeric.fix2int(line));
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { return args[0].eval( args[1], self.getRuntime().getNil(), ((RubyString) args[2]).getValue(), RubyNumeric.fix2int(args[3])); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC);
ThreadContext context = runtime.getCurrentContext(); Block currentBlock = context.getBlockStack().getCurrent(); Namespace savedNamespace = currentBlock.getFrame().getNamespace(); Visibility savedVisibility = currentBlock.getScope().getVisibility(); currentBlock.getFrame().setNamespace(context.getCurrentFrame().getNamespace()); currentBlock.getScope().setVisibility(Visibility.PUBLIC);
private IRubyObject yieldUnder(RubyModule under) { return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } } public Arity getArity() { return Arity.optional(); } }, new IRubyObject[] { this }); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
return runtime.yield(args[0], args[0], runtime.getRubyClass(), false);
IRubyObject valueInYield = args[0]; IRubyObject selfInYield = args[0]; return context.yield(valueInYield, selfInYield, context.getRubyClass(), false);
private IRubyObject yieldUnder(RubyModule under) { return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } } public Arity getArity() { return Arity.optional(); } }, new IRubyObject[] { this }); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
runtime.getBlockStack().setCurrent(savedBlock);
currentBlock.getFrame().setNamespace(savedNamespace); currentBlock.getScope().setVisibility(savedVisibility);
private IRubyObject yieldUnder(RubyModule under) { return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } } public Arity getArity() { return Arity.optional(); } }, new IRubyObject[] { this }); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC);
ThreadContext context = runtime.getCurrentContext(); Block currentBlock = context.getBlockStack().getCurrent(); Namespace savedNamespace = currentBlock.getFrame().getNamespace(); Visibility savedVisibility = currentBlock.getScope().getVisibility(); currentBlock.getFrame().setNamespace(context.getCurrentFrame().getNamespace()); currentBlock.getScope().setVisibility(Visibility.PUBLIC);
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
return runtime.yield(args[0], args[0], runtime.getRubyClass(), false);
IRubyObject valueInYield = args[0]; IRubyObject selfInYield = args[0]; return context.yield(valueInYield, selfInYield, context.getRubyClass(), false);
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
runtime.getBlockStack().setCurrent(savedBlock);
currentBlock.getFrame().setNamespace(savedNamespace); currentBlock.getScope().setVisibility(savedVisibility);
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // Fixme: What good is this copying, when it is referenced frame and scope objects // that are modified here? Some other modifications? Block savedBlock = runtime.getBlockStack().getCurrent().cloneBlock(); Namespace ns = runtime.getCurrentFrame().getNamespace(); runtime.getBlockStack().getCurrent().getFrame().setNamespace(ns); runtime.getBlockStack().getCurrent().getScope().setVisibility(Visibility.PUBLIC); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(savedBlock); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0044a3b88a0afa22dcced1c8213002b0fb16faf4/RubyObject.java/clean/src/org/jruby/RubyObject.java
RubyClass superClass = getSuperClassFromNode(context, iVisited.getSuperNode(), self);
Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self);
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; RubyClass superClass = getSuperClassFromNode(context, iVisited.getSuperNode(), 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 def = new DefinedVisitor(runtime).getDefinition(iVisited.getExpressionNode()); if (def != null) { return runtime.newString(def); } 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 = new DefinedVisitor(runtime).getDefinition(iVisited.getFirstNode()); 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("True"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("False"); } 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/8bc77fd935108392c0bf8a671462f28f423e48c1/EvaluationState.java/clean/src/org/jruby/evaluator/EvaluationState.java
return "AnalysisChainLink"+(analysisChainLinkId==null ? ":Hash"+this.hashCode() : ":"+analysisChainLinkId);
return "AnalysisChainLink"+(analysisChainLinkId==null ? ":Hash_"+this.hashCode() : ":Id_"+analysisChainLinkId);
public String toString(){ return "AnalysisChainLink"+(analysisChainLinkId==null ? ":Hash"+this.hashCode() : ":"+analysisChainLinkId); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/51a3c546dfc7a7a98b29771a459df19094fc5b51/AnalysisChainLink.java/clean/components/common/src/ome/model/AnalysisChainLink.java
psrv = factory.getPojosService(); q = factory.getQueryService(); u = factory.getUpdateService();
iPojos = factory.getPojosService(); iQuery = factory.getQueryService(); iUpdate = factory.getUpdateService();
protected void setUp() throws Exception { DataSource dataSource = (DataSource) factory.ctx.getBean("dataSource"); data = new OMEData(); data.setDataSource(dataSource); psrv = factory.getPojosService(); q = factory.getQueryService(); u = factory.getUpdateService(); mapper = new Model2PojosMapper(); reverse = new ReverseModelMapper(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
Pixels pix = (Pixels) q.getByClass(Pixels.class).get(0);
Pixels pix = (Pixels) iQuery.getByClass(Pixels.class).get(0);
public void testAndForTheFunOfItLetsGetTheREWorking() throws Exception { Pixels pix = (Pixels) q.getByClass(Pixels.class).get(0); IPixels pixDB = factory.getPixelsService(); PixelsService pixFS = new PixelsService( PixelsService.ROOT_DEFAULT); PixelBuffer pixBF = pixFS.createPixelBuffer(pix); StatsFactory sf = new StatsFactory(); PixelsStats pixST = sf.compute(pix,pixBF); // TODO RenderingEngine re = factory.getRenderingService(); Renderer r = new Renderer(pix,null,pixBF,pixST); PlaneDef pd = new PlaneDef(0,0); pd.setX(0); pd.setY(0); pd.setZ(0); r.render(pd); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
img = (Image) u.saveAndReturnObject(img);
img = (Image) iUpdate.saveAndReturnObject(img);
public void testAndSaveSomtheingWithParents() throws Exception { DatasetData dd = simpleDatasetData(); Set dss = new HashSet(); dss.add(dd); imgData = simpleImageData(); imgData.setDatasets(dss); img = (Image) reverse.map(imgData); img = (Image) u.saveAndReturnObject(img); assertTrue("It better have a dataset link", img.getDatasetLinks().size()>0); ILink link = (ILink) img.getDatasetLinks().iterator().next(); ds = (Dataset) link.getParent(); Long id = ds.getId(); // another copy Image img2 = (Image) q.queryUnique( "select i from Image i " + "left outer join fetch i.datasetLinks " + "where i.id = ?", new Object[]{img.getId()}); assertTrue("It better have a dataset link too", img2.getDatasetLinks().size()>0); ILink link2 = (ILink) img2.getDatasetLinks().iterator().next(); Dataset ds2 = (Dataset) link2.getParent(); assertTrue("And the ids have to be the same",id.equals(ds2.getId())); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
Image img2 = (Image) q.queryUnique(
Image img2 = (Image) iQuery.queryUnique(
public void testAndSaveSomtheingWithParents() throws Exception { DatasetData dd = simpleDatasetData(); Set dss = new HashSet(); dss.add(dd); imgData = simpleImageData(); imgData.setDatasets(dss); img = (Image) reverse.map(imgData); img = (Image) u.saveAndReturnObject(img); assertTrue("It better have a dataset link", img.getDatasetLinks().size()>0); ILink link = (ILink) img.getDatasetLinks().iterator().next(); ds = (Dataset) link.getParent(); Long id = ds.getId(); // another copy Image img2 = (Image) q.queryUnique( "select i from Image i " + "left outer join fetch i.datasetLinks " + "where i.id = ?", new Object[]{img.getId()}); assertTrue("It better have a dataset link too", img2.getDatasetLinks().size()>0); ILink link2 = (ILink) img2.getDatasetLinks().iterator().next(); Dataset ds2 = (Dataset) link2.getParent(); assertTrue("And the ids have to be the same",id.equals(ds2.getId())); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
List l = q.getListByExample(new Experimenter());
List l = iQuery.getListByExample(new Experimenter());
public void testGetSomethingThatsAlwaysThere() throws Exception { List l = q.getListByExample(new Experimenter()); assertTrue("Root has to exist.",l.size()>0); Experimenter exp = (Experimenter) l.get(0); assertNotNull("Must have an id",exp.getId()); assertNotNull("And a name",exp.getFirstName()); // Now let's try to map it. ExperimenterData expData = (ExperimenterData) mapper.map((Experimenter)l.get(0)); assertNotNull("And something should still be there",expData); assertTrue("And it should have an id",expData.getId()>-1); assertNotNull("And various other things",expData.getFirstName()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
ILink test = psrv.link(new ILink[]{link},null)[0];
ILink test = iPojos.link(new ILink[]{link},null)[0];
public void testLetsTryToLinkTwoThingsTogether() throws Exception { imgData = simpleImageData(); dsData = simpleDatasetData(); img = (Image) reverse.map(imgData); ds = (Dataset) reverse.map(dsData); DatasetImageLink link = new DatasetImageLink(); link.link(ds,img); ILink test = psrv.link(new ILink[]{link},null)[0]; assertNotNull("ILink should be there",test); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
img = (Image) psrv.createDataObject(img,null);
img = (Image) iPojos.createDataObject(img,null);
public void testNowLetsTryToSaveSomething() throws Exception { imgData = simpleImageData(); img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId().longValue()); assertNotNull("And we should be able to find it again.",img2); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
Image img2 = (Image) q.getById(Image.class,img.getId().longValue());
Image img2 = (Image) iQuery.getById(Image.class,img.getId().longValue());
public void testNowLetsTryToSaveSomething() throws Exception { imgData = simpleImageData(); img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId().longValue()); assertNotNull("And we should be able to find it again.",img2); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
img = (Image) psrv.createDataObject(img,null);
img = (Image) iPojos.createDataObject(img,null);
public void testNowOnToSavingAndDeleting() throws Exception { imgData = simpleImageData(); img = (Image) reverse.map(imgData); assertNull("Image doesn't have an id.",img.getId()); img = (Image) psrv.createDataObject(img,null); assertNotNull("Presto change-o, now it does.",img.getId()); psrv.deleteDataObject(img,null); img = (Image) q.getById(Image.class,img.getId().longValue()); assertNull("we should have deleted it ",img); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
psrv.deleteDataObject(img,null);
iPojos.deleteDataObject(img,null);
public void testNowOnToSavingAndDeleting() throws Exception { imgData = simpleImageData(); img = (Image) reverse.map(imgData); assertNull("Image doesn't have an id.",img.getId()); img = (Image) psrv.createDataObject(img,null); assertNotNull("Presto change-o, now it does.",img.getId()); psrv.deleteDataObject(img,null); img = (Image) q.getById(Image.class,img.getId().longValue()); assertNull("we should have deleted it ",img); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
img = (Image) q.getById(Image.class,img.getId().longValue());
img = (Image) iQuery.getById(Image.class,img.getId().longValue());
public void testNowOnToSavingAndDeleting() throws Exception { imgData = simpleImageData(); img = (Image) reverse.map(imgData); assertNull("Image doesn't have an id.",img.getId()); img = (Image) psrv.createDataObject(img,null); assertNotNull("Presto change-o, now it does.",img.getId()); psrv.deleteDataObject(img,null); img = (Image) q.getById(Image.class,img.getId().longValue()); assertNull("we should have deleted it ",img); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0b36a8e77f5bacb7e122d76ffce01866205b09d7/PojosServiceTest.java/buggy/components/shoola-adapter/test/ome/adapters/pojos/itests/PojosServiceTest.java
boolean[] la1tokens = new boolean[33]; for (int i = 0; i < 33; i++) {
boolean[] la1tokens = new boolean[35]; for (int i = 0; i < 35; i++) {
final public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[33]; for (int i = 0; i < 33; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1<<j)) != 0) { la1tokens[32+j] = true; } } } } for (int i = 0; i < 33; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.addElement(jj_expentry); } } int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = (int[])jj_expentries.elementAt(i); } return new ParseException(token, exptokseq, tokenImage); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/2e6a5e583cccdc19c543caf9a1fb259181c98cb6/WikiParser.java/buggy/wiki/src/org/tcdi/opensource/wiki/parser/WikiParser.java
for (int i = 0; i < 33; i++) {
for (int i = 0; i < 35; i++) {
final public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[33]; for (int i = 0; i < 33; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1<<j)) != 0) { la1tokens[32+j] = true; } } } } for (int i = 0; i < 33; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.addElement(jj_expentry); } } int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = (int[])jj_expentries.elementAt(i); } return new ParseException(token, exptokseq, tokenImage); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/2e6a5e583cccdc19c543caf9a1fb259181c98cb6/WikiParser.java/buggy/wiki/src/org/tcdi/opensource/wiki/parser/WikiParser.java
break; case LI: t = jj_consume_token(LI); builder.li();
final public WikiPage parse(WikiPageBuilder builder) throws ParseException { Token t; label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case QUOTED_BLOCK: case BOLD: case UNDERLINE: case ITALIC: case LT: case GT: case COLOR: case HEADER: case COLOR_HEADER_TERMINATE: case RULE: case EMAIL: case URL: case WIKI_TERM: case SHORT_WIKI_TERM: case WORD: case NEW_PARAGRAPH: case LINE_BREAK: case INDENT: case WHITESPACE: case ASTERISK: case UNDERSCORE: case CARET: case DOUBLE_LBRACKET: case DELIMITERS: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LT: t = jj_consume_token(LT); builder.lt(); break; case GT: t = jj_consume_token(GT); builder.gt(); break; case BOLD: t = jj_consume_token(BOLD); builder.bold(); break; case UNDERLINE: t = jj_consume_token(UNDERLINE); builder.underline(); break; case ITALIC: t = jj_consume_token(ITALIC); builder.italic(); break; case COLOR: t = jj_consume_token(COLOR); if (_headerName != null || _colorName != null) { builder.endColorOrHeader(); String word = t.image.substring(1); if (builder.isWikiTermReference (word)) builder.wikiTerm (word); else builder.word (word); _colorName = null; _headerName = null; } else { _colorName = t.image.substring(1); builder.color (_colorName); } break; case HEADER: t = jj_consume_token(HEADER); _headerName = t.image.substring(2); builder.header (_headerName); break; case COLOR_HEADER_TERMINATE: t = jj_consume_token(COLOR_HEADER_TERMINATE); if (_headerName == null && _colorName == null) builder.word ("^"); else { builder.endColorOrHeader (); _headerName = null; _colorName = null; } break; case RULE: t = jj_consume_token(RULE); builder.ruler(); break; case EMAIL: t = jj_consume_token(EMAIL); builder.email(t.image); break; case WIKI_TERM: t = jj_consume_token(WIKI_TERM); if (builder.isWikiTermReference (t.image)) builder.wikiTerm (t.image); else builder.word (t.image); break; case SHORT_WIKI_TERM: t = jj_consume_token(SHORT_WIKI_TERM); if (builder.isWikiTermReference (t.image)) builder.wikiTerm (t.image.substring(0, t.image.length()-1)); else builder.word (t.image); break; case WORD: t = jj_consume_token(WORD); builder.word (t.image); break; case NEW_PARAGRAPH: t = jj_consume_token(NEW_PARAGRAPH); builder.paragraph (); break; case LINE_BREAK: t = jj_consume_token(LINE_BREAK); builder.newline(); break; case INDENT: t = jj_consume_token(INDENT); builder.indent(2); break; case WHITESPACE: t = jj_consume_token(WHITESPACE); builder.space(); break; case ASTERISK: t = jj_consume_token(ASTERISK); builder.word ("*"); break; case UNDERSCORE: t = jj_consume_token(UNDERSCORE); builder.word ("_"); break; case CARET: t = jj_consume_token(CARET); builder.word ("^"); break; case DOUBLE_LBRACKET: t = jj_consume_token(DOUBLE_LBRACKET); builder.word ("[["); break; case DELIMITERS: t = jj_consume_token(DELIMITERS); builder.word (t.image); break; case URL: t = jj_consume_token(URL); builder.url (t.image); break; case QUOTED_BLOCK: t = jj_consume_token(QUOTED_BLOCK); builder.quotedBlock (t.image.substring(2, t.image.length()-2)); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return builder.getPage ();} throw new Error("Missing return statement in function"); }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/2e6a5e583cccdc19c543caf9a1fb259181c98cb6/WikiParser.java/buggy/wiki/src/org/tcdi/opensource/wiki/parser/WikiParser.java
this.support = new ParserSupport(); this.lexer = new RubyYaccLexer(); this.lexer.setParserSupport(support);
support = new ParserSupport(); lexer = new RubyYaccLexer(); lexer.setParserSupport(support);
public DefaultRubyParser() { this.support = new ParserSupport(); this.lexer = new RubyYaccLexer(); // lame this.lexer.setParserSupport(support); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b1293eda8454686e846e2a9837b348e2983bb423/DefaultRubyParser.java/clean/src/org/jruby/parser/DefaultRubyParser.java
if (start != null) { return lexer.getPosition(start.getPosition()); } return lexer.getPosition(null);
return getPosition(start, false);
private ISourcePosition getPosition(ISourcePositionHolder start) { if (start != null) { return lexer.getPosition(start.getPosition()); } return lexer.getPosition(null); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b1293eda8454686e846e2a9837b348e2983bb423/DefaultRubyParser.java/clean/src/org/jruby/parser/DefaultRubyParser.java
support.setPositionFactory(lexer.getPositionFactory());
public RubyParserResult parse(LexerSource source) { support.reset(); support.setResult(new RubyParserResult()); lexer.reset(); lexer.setSource(source); try { //yyparse(lexer, new jay.yydebug.yyAnim("JRuby", 9)); //yyparse(lexer, new jay.yydebug.yyDebugAdapter()); yyparse(lexer, null); } catch (IOException e) { e.printStackTrace(); } catch (yyException e) { e.printStackTrace(); } return support.getResult(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b1293eda8454686e846e2a9837b348e2983bb423/DefaultRubyParser.java/clean/src/org/jruby/parser/DefaultRubyParser.java
int n = Integer.parseInt(args[0]);
public static void main(String args[]) throws IOException { //@START int n = Integer.parseInt(args[0]); String hello = "hello\n"; StringBuffer stringBuffer = new StringBuffer(32); for (int i=0; i<n; i++) { stringBuffer.append(hello); } System.out.println(stringBuffer.length()); //@END }
53330 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53330/eb6c850277407b38bcaefb81155941da0f27b849/strcat.java/buggy/tests/shootout/java-start/strcat.java
ChatPreferences chatPref = (ChatPreferences)SparkManager.getPreferenceManager().getPreferenceData(ChatPreference.NAMESPACE); chatRoom.create(chatPref.getNickname());
LocalPreferences pref = SettingsManager.getLocalPreferences(); chatRoom.create(pref.getNickname());
public ChatRoom createConferenceRoom(String roomName, String serviceName) { final MultiUserChat chatRoom = new MultiUserChat(SparkManager.getConnection(), roomName + "@" + serviceName); final GroupChatRoom room = new GroupChatRoom(chatRoom); try { ChatPreferences chatPref = (ChatPreferences)SparkManager.getPreferenceManager().getPreferenceData(ChatPreference.NAMESPACE); chatRoom.create(chatPref.getNickname()); // Send an empty room configuration form which indicates that we want // an instant room chatRoom.sendConfigurationForm(new Form(Form.TYPE_SUBMIT)); } catch (XMPPException e1) { Log.error("Unable to send conference room chat configuration form.", e1); return null; } getChatContainer().addChatRoom(room); return room; }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/f678f06c6fbc4a84079c230a0a7461759cb20755/ChatManager.java/buggy/src/java/org/jivesoftware/spark/ChatManager.java
private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); // I don't think the containment is correct here (parent cref) RubyClass metaClass = objectClass.makeMetaClass(classClass, objectMetaClass.getCRef()); metaClass = moduleClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); metaClass = classClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); kernelModule = RubyKernel.createKernelModule(this); objectClass.includeModule(kernelModule); RubyClass.createClassClass(classClass); nilClass = RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); RubyEnumerable.createEnumerableModule(this); stringClass = new StringMetaClass(this); stringClass.initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); RubyPrecision.createPrecisionModule(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); fixnumClass = new FixnumMetaClass(this); fixnumClass.initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); Java.createJavaModule(this); RubyClass structClass = RubyStruct.createStructClass(this); tmsStruct = RubyStruct.newInstance(structClass, new IRubyObject[] { newString("Tms"), newSymbol("utime"), newSymbol("stime"), newSymbol("cutime"), newSymbol("cstime")}); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); new BindingMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyProcess.createProcessModule(this); new TimeMetaClass(this).initializeClass(); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = RubyNameError.createNameErrorClass(this, standardError); RubyClass rangeError = defineClass("RangeError", standardError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemoryError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); defineClass("ZeroDivisionError", standardError); // FIXME: Actually this somewhere defineClass("FloatDomainError", rangeError); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d9e453ef8491a951e06ecccb3e27137fa7aaccee/Ruby.java/clean/src/org/jruby/Ruby.java
defineClass("Data",objectClass);
private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); // I don't think the containment is correct here (parent cref) RubyClass metaClass = objectClass.makeMetaClass(classClass, objectMetaClass.getCRef()); metaClass = moduleClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); metaClass = classClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); kernelModule = RubyKernel.createKernelModule(this); objectClass.includeModule(kernelModule); RubyClass.createClassClass(classClass); nilClass = RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); RubyEnumerable.createEnumerableModule(this); stringClass = new StringMetaClass(this); stringClass.initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); RubyPrecision.createPrecisionModule(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); fixnumClass = new FixnumMetaClass(this); fixnumClass.initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); Java.createJavaModule(this); RubyClass structClass = RubyStruct.createStructClass(this); tmsStruct = RubyStruct.newInstance(structClass, new IRubyObject[] { newString("Tms"), newSymbol("utime"), newSymbol("stime"), newSymbol("cutime"), newSymbol("cstime")}); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); new BindingMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyProcess.createProcessModule(this); new TimeMetaClass(this).initializeClass(); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = RubyNameError.createNameErrorClass(this, standardError); RubyClass rangeError = defineClass("RangeError", standardError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemoryError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); defineClass("ZeroDivisionError", standardError); // FIXME: Actually this somewhere defineClass("FloatDomainError", rangeError); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d9e453ef8491a951e06ecccb3e27137fa7aaccee/Ruby.java/clean/src/org/jruby/Ruby.java
flater = new Inflater(true);
flater = new Inflater(false);
public ZlibInflate(IRubyObject caller) { super(); flater = new Inflater(true); collected = new StringBuffer(); runtime = caller.getRuntime(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c9e16f0d2d769c555189a2e11bfe3a4c8b098650/ZlibInflate.java/buggy/src/org/jruby/util/ZlibInflate.java
public JContactItemField(List items) {
public JContactItemField(List items, Window parentWindow) {
public JContactItemField(List items) { setLayout(new BorderLayout()); this.items = items; add(textField, BorderLayout.CENTER); textField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { char ch = keyEvent.getKeyChar(); if (validateChar(ch)) { showPopupMenu(); } if (ch == KeyEvent.VK_ENTER) { int index = list.getSelectedIndex(); if (index >= 0) { ContactItem selection = (ContactItem)list.getSelectedValue(); textField.setText(selection.getNickname()); popup.setVisible(false); } } if (ch == KeyEvent.VK_ESCAPE) { popup.setVisible(false); } dispatchEvent(keyEvent); } public void keyPressed(KeyEvent e) { if (isArrowKey(e)) { list.dispatchEvent(e); } } }); popup = new JWindow(new JFrame()); popup.getContentPane().add(new JScrollPane(list)); list.setCellRenderer(new PopupRenderer()); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/bb9bf59720a1ef585641bebe31110d3b4a034d3c/JContactItemField.java/clean/src/java/org/jivesoftware/spark/component/JContactItemField.java
popup = new JWindow(new JFrame());
list.addKeyListener(this); addKeyListener(this); popup = new JWindow(parentWindow);
public JContactItemField(List items) { setLayout(new BorderLayout()); this.items = items; add(textField, BorderLayout.CENTER); textField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { char ch = keyEvent.getKeyChar(); if (validateChar(ch)) { showPopupMenu(); } if (ch == KeyEvent.VK_ENTER) { int index = list.getSelectedIndex(); if (index >= 0) { ContactItem selection = (ContactItem)list.getSelectedValue(); textField.setText(selection.getNickname()); popup.setVisible(false); } } if (ch == KeyEvent.VK_ESCAPE) { popup.setVisible(false); } dispatchEvent(keyEvent); } public void keyPressed(KeyEvent e) { if (isArrowKey(e)) { list.dispatchEvent(e); } } }); popup = new JWindow(new JFrame()); popup.getContentPane().add(new JScrollPane(list)); list.setCellRenderer(new PopupRenderer()); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/bb9bf59720a1ef585641bebe31110d3b4a034d3c/JContactItemField.java/clean/src/java/org/jivesoftware/spark/component/JContactItemField.java
&& ch != '.' && ch != ',' && ch != ' ' && ch != KeyEvent.VK_BACK_SPACE && ch != KeyEvent.CTRL_DOWN_MASK && ch != KeyEvent.CTRL_MASK) {
&& ch != '.' && ch != ',' && ch != ' ' && ch != KeyEvent.VK_BACK_SPACE && ch != KeyEvent.CTRL_DOWN_MASK && ch != KeyEvent.CTRL_MASK) {
public boolean validateChar(char ch) { if (!Character.isLetterOrDigit(ch) && ch != '@' && ch != '-' && ch != '_' && ch != '.' && ch != ',' && ch != ' ' && ch != KeyEvent.VK_BACK_SPACE && ch != KeyEvent.CTRL_DOWN_MASK && ch != KeyEvent.CTRL_MASK) { return false; } return true; }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/bb9bf59720a1ef585641bebe31110d3b4a034d3c/JContactItemField.java/clean/src/java/org/jivesoftware/spark/component/JContactItemField.java
&& ch != '.' && ch != ',' && ch != ' ') {
&& ch != '.' && ch != ',' && ch != ' ') {
public boolean validateChars(String text) { if (!ModelUtil.hasLength(text)) { return false; } for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); if (!Character.isLetterOrDigit(ch) && ch != '@' && ch != '-' && ch != '_' && ch != '.' && ch != ',' && ch != ' ') { return false; } } return true; }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/bb9bf59720a1ef585641bebe31110d3b4a034d3c/JContactItemField.java/clean/src/java/org/jivesoftware/spark/component/JContactItemField.java
System.err.println(attribute);
public static double parseElement(Attribute attribute, String elementName) throws IllegalArgumentException { if(attribute == null || elementName == null) { throw new IllegalArgumentException("Null parameters at " + "AbstractHeatMapMode.parseElement(Attribute,String)"); } int index = 0; while((index = elementName.indexOf(".")) != -1) { String child = elementName.substring(0,index); attribute = attribute.getAttributeElement(child); elementName = elementName.substring(index+1); } try { System.err.println(attribute); double val = attribute.getDoubleElement(elementName).doubleValue(); return val; } catch(NullPointerException npe) { throw new IllegalArgumentException("Invalid element parsed: "+ elementName); } catch(ClassCastException cce) { throw new IllegalArgumentException("Non-numeric element parsed."); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/28e98417641b00a2e12a791f10f204dc4562dec1/HeatMapUtils.java/clean/SRC/org/openmicroscopy/shoola/agents/browser/heatmap/HeatMapUtils.java
lensController = new LensController(lensModel , lens, zoomWindow);
lensController = new LensController(lensModel, lens, zoomWindow);
public LensComponent(JFrame parent, BufferedImage planeImage) { lensModel = new LensModel(planeImage); zoomWindow = new ZoomWindow(parent, this); lens = new LensUI(this, LENS_DEFAULT_WIDTH, LENS_DEFAULT_HEIGHT); lensController = new LensController(lensModel , lens, zoomWindow); lensModel.setWidth(LENS_DEFAULT_WIDTH); lensModel.setHeight(LENS_DEFAULT_HEIGHT); lensModel.setImageZoomFactor(1.0f); lens.addController(lensController); lens.setLensColour(lensModel.getLensPreferredColour()); zoomWindow.addController(lensController); menu = new LensMenu(this); lens.setPopupMenu(menu.getPopupMenu()); zoomWindow.setMenu(menu.getMenubar()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/54a6dc1cc81e06c2190546075a6c5a04f18d9bb5/LensComponent.java/buggy/SRC/org/openmicroscopy/shoola/util/ui/lens/LensComponent.java
public void setLensSize(int lensSize)
void setLensSize(int lensSize)
public void setLensSize(int lensSize) { switch (lensSize) { case LensAction.LENSDEFAULTSIZE: lensController.setLensSize(LensComponent.LENS_DEFAULT_WIDTH, LensComponent.LENS_DEFAULT_HEIGHT); break; case LensAction.LENS40x40: lensController.setLensSize(40, 40); break; case LensAction.LENS50x50: lensController.setLensSize(50, 50); break; case LensAction.LENS60x60: lensController.setLensSize(60, 60); break; case LensAction.LENS70x70: lensController.setLensSize(70, 70); break; case LensAction.LENS80x80: lensController.setLensSize(80, 80); break; case LensAction.LENS90x90: lensController.setLensSize(90, 90); break; case LensAction.LENS100x100: lensController.setLensSize(100, 100); break; case LensAction.LENS120x120: lensController.setLensSize(120, 120); break; case LensAction.LENS150x150: lensController.setLensSize(150, 150); break; default: throw new IllegalArgumentException("Index not supported."); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/54a6dc1cc81e06c2190546075a6c5a04f18d9bb5/LensComponent.java/buggy/SRC/org/openmicroscopy/shoola/util/ui/lens/LensComponent.java
try { currentDirectory = JRubyFile.getFileProperty("user.dir"); } catch (AccessControlException accessEx) { currentDirectory = "/"; }
private Ruby(InputStream in, PrintStream out, PrintStream err) { this.in = in; this.out = out; this.err = err; objectSpaceEnabled = true; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d38821551a58969cd2593b463d93df5f32bf3c14/Ruby.java/clean/src/org/jruby/Ruby.java
defineMethod("to_s", Arity.noArguments());
defineMethod("to_s", Arity.optional());
protected void initializeClass() { defineMethod("quo", Arity.singleArgument()); defineMethod("to_f", Arity.noArguments()); defineMethod("to_i", Arity.noArguments()); defineMethod("to_s", Arity.noArguments()); defineMethod("taint", Arity.noArguments()); defineMethod("freeze", Arity.noArguments()); defineMethod("<<", Arity.singleArgument(), "op_lshift"); defineMethod(">>", Arity.singleArgument(), "op_rshift"); defineMethod("+", Arity.singleArgument(), "op_plus"); defineMethod("-", Arity.singleArgument(), "op_minus"); defineMethod("*", Arity.singleArgument(), "op_mul"); defineMethod("/", Arity.singleArgument(), "op_div"); defineAlias("div", "/"); defineMethod("%", Arity.singleArgument(), "op_mod"); defineMethod("**", Arity.singleArgument(), "op_pow"); defineMethod("&", Arity.singleArgument(), "op_and"); defineMethod("|", Arity.singleArgument(), "op_or"); defineMethod("^", Arity.singleArgument(), "op_xor"); defineMethod("size", Arity.noArguments()); defineMethod("[]", Arity.singleArgument(), "aref"); defineMethod("hash", Arity.noArguments()); defineMethod("id2name", Arity.noArguments()); defineMethod("~", Arity.noArguments(), "invert"); defineMethod("id", Arity.noArguments()); defineSingletonMethod("induced_from", Arity.singleArgument(), "induced_from"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/5ab345ee94c86afde157cfadd32a78d5899d489f/FixnumMetaClass.java/buggy/src/org/jruby/runtime/builtin/meta/FixnumMetaClass.java
return buf == null ? getRuntime().newString("") : getRuntime().newString(buf);
if (buf == null) { if (args.length > 0) { return getRuntime().getNil(); } return getRuntime().newString(""); } return getRuntime().newString(buf);
public IRubyObject read(IRubyObject[] args) { try { String buf = args.length > 0 ? handler.read(RubyNumeric.fix2int(args[0])) : handler.getsEntireStream(); return buf == null ? getRuntime().newString("") : getRuntime().newString(buf); } catch (IOHandler.BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } catch (IOException e) { throw getRuntime().newIOError(e.getMessage()); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/58ae97d80464087e7fd608ca0ec391c8cf84bce1/RubyIO.java/clean/src/org/jruby/RubyIO.java
protected DataLoader createHierarchyLoader()
protected DataLoader createHierarchyLoader(boolean refresh)
protected DataLoader createHierarchyLoader() { Set ids = new HashSet(images.size()); Iterator i = images.iterator(); while (i.hasNext()) ids.add(new Long(((ImageData) i.next()).getId())); switch (type) { case HiViewer.PDI_HIERARCHY: return new PDILoader(component, ids); case HiViewer.CGCI_HIERARCHY: return new CGCILoader(component, ids); } return null; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/fb3743d6f75abbf12f788b3b2925f4a6f4606dd6/HierarchyModel.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/HierarchyModel.java
return new PDILoader(component, ids);
return new PDILoader(component, ids, refresh);
protected DataLoader createHierarchyLoader() { Set ids = new HashSet(images.size()); Iterator i = images.iterator(); while (i.hasNext()) ids.add(new Long(((ImageData) i.next()).getId())); switch (type) { case HiViewer.PDI_HIERARCHY: return new PDILoader(component, ids); case HiViewer.CGCI_HIERARCHY: return new CGCILoader(component, ids); } return null; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/fb3743d6f75abbf12f788b3b2925f4a6f4606dd6/HierarchyModel.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/HierarchyModel.java
return new CGCILoader(component, ids);
return new CGCILoader(component, ids, refresh);
protected DataLoader createHierarchyLoader() { Set ids = new HashSet(images.size()); Iterator i = images.iterator(); while (i.hasNext()) ids.add(new Long(((ImageData) i.next()).getId())); switch (type) { case HiViewer.PDI_HIERARCHY: return new PDILoader(component, ids); case HiViewer.CGCI_HIERARCHY: return new CGCILoader(component, ids); } return null; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/fb3743d6f75abbf12f788b3b2925f4a6f4606dd6/HierarchyModel.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/HierarchyModel.java
symbolClass.defineMethod("hash", CallbackFactory.getMethod(RubySymbol.class, "hash"));
public static RubyClass createSymbolClass(Ruby ruby) { RubyClass symbolClass = ruby.defineClass("Symbol", ruby.getClasses().getObjectClass()); symbolClass.getRubyClass().undefMethod("new"); symbolClass.defineMethod("id", CallbackFactory.getMethod(RubySymbol.class, "id")); symbolClass.defineMethod("to_i", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("to_int", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("id2name", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("to_s", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("==", CallbackFactory.getMethod(RubySymbol.class, "equal", RubyObject.class)); symbolClass.defineMethod("inspect", CallbackFactory.getMethod(RubySymbol.class, "inspect")); symbolClass.defineMethod("dup", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("clone", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("freeze", CallbackFactory.getSelfMethod(0)); symbolClass.defineMethod("taint", CallbackFactory.getSelfMethod(0)); return symbolClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/7f0907240b4b4a4379424377e971ed0ca23f1dcb/RubySymbol.java/clean/org/jruby/RubySymbol.java
if (response.getDrawingCanvas() != null) { if (control.getDrawingCanvas() == null) control.setDrawingCanvas(response.getDrawingCanvas());
control.setDrawingCanvas(response.getDrawingCanvas());
private void handleDisplayROI(DisplayROI response) { if (response.getDrawingCanvas() != null) { //close window if (control.getDrawingCanvas() == null) control.setDrawingCanvas(response.getDrawingCanvas()); if (presentation == null) buildPresentation(); presentation.deIconify(); } else removePresentation(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/975d69b756654b3d3810faba1b0e148d7fecd46d/ROIAgt.java/clean/SRC/org/openmicroscopy/shoola/agents/roi/ROIAgt.java
} else removePresentation();
private void handleDisplayROI(DisplayROI response) { if (response.getDrawingCanvas() != null) { //close window if (control.getDrawingCanvas() == null) control.setDrawingCanvas(response.getDrawingCanvas()); if (presentation == null) buildPresentation(); presentation.deIconify(); } else removePresentation(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/975d69b756654b3d3810faba1b0e148d7fecd46d/ROIAgt.java/clean/SRC/org/openmicroscopy/shoola/agents/roi/ROIAgt.java
pref.setHideChatHistory(panel.isChatHistoryHidden());
pref.setChatHistoryEnabled(!panel.isChatHistoryHidden());
public void commit() { LocalPreferences pref = SettingsManager.getLocalPreferences(); pref.setTimeDisplayedInChat(panel.getShowTime()); pref.setSpellCheckerEnabled(panel.isSpellCheckerOn()); pref.setChatRoomNotifications(panel.isGroupChatNotificationsOn()); pref.setHideChatHistory(panel.isChatHistoryHidden()); SettingsManager.saveSettings(); // Do not commit if not changed. if (ModelUtil.hasLength(panel.getPassword()) && ModelUtil.hasLength(panel.getConfirmationPassword())) { try { SparkManager.getConnection().getAccountManager().changePassword(panel.getPassword()); } catch (XMPPException passwordEx) { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to change password. Please see your server admin.", "Password Change Error", JOptionPane.ERROR_MESSAGE); Log.error("Unable to change password", passwordEx); } } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/741ee521da25f1d1608a575dbda0a84d216ed278/ChatPreference.java/clean/src/java/org/jivesoftware/sparkimpl/preference/chat/ChatPreference.java
boolean chatHistoryHidden = pref.isHideChatHistory();
boolean chatHistoryHidden = !pref.isChatHistoryEnabled();
public void load() { SwingWorker thread = new SwingWorker() { LocalPreferences pref; public Object construct() { pref = SettingsManager.getLocalPreferences(); return pref; } public void finished() { String nickname = pref.getDefaultNickname(); if (nickname == null) { nickname = SparkManager.getSessionManager().getUsername(); } boolean showTime = pref.isTimeDisplayedInChat(); boolean spellCheckerOn = pref.isSpellCheckerEnabled(); boolean notificationsOn = pref.isChatRoomNotificationsOn(); boolean chatHistoryHidden = pref.isHideChatHistory(); panel.setShowTime(showTime); panel.setSpellCheckerOn(spellCheckerOn); panel.setGroupChatNotificationsOn(notificationsOn); panel.setChatHistoryHidden(chatHistoryHidden); } }; thread.start(); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/741ee521da25f1d1608a575dbda0a84d216ed278/ChatPreference.java/clean/src/java/org/jivesoftware/sparkimpl/preference/chat/ChatPreference.java
boolean chatHistoryHidden = pref.isHideChatHistory();
boolean chatHistoryHidden = !pref.isChatHistoryEnabled();
public void finished() { String nickname = pref.getDefaultNickname(); if (nickname == null) { nickname = SparkManager.getSessionManager().getUsername(); } boolean showTime = pref.isTimeDisplayedInChat(); boolean spellCheckerOn = pref.isSpellCheckerEnabled(); boolean notificationsOn = pref.isChatRoomNotificationsOn(); boolean chatHistoryHidden = pref.isHideChatHistory(); panel.setShowTime(showTime); panel.setSpellCheckerOn(spellCheckerOn); panel.setGroupChatNotificationsOn(notificationsOn); panel.setChatHistoryHidden(chatHistoryHidden); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/741ee521da25f1d1608a575dbda0a84d216ed278/ChatPreference.java/clean/src/java/org/jivesoftware/sparkimpl/preference/chat/ChatPreference.java
return RubyString.newString(input.getRuntime(), input.unmarshalString());
RubyString result = RubyString.newString(input.getRuntime(), input.unmarshalString()); input.register(result); return result;
public static RubyString unmarshalFrom(UnmarshalStream input) throws java.io.IOException { return RubyString.newString(input.getRuntime(), input.unmarshalString()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9db4d278a734c4fdfd9a83ed95575a45577f1e1b/RubyString.java/buggy/org/jruby/RubyString.java
protected void onPlayerStateChange() { switch (state) { case START: if (historyState == Player.PAUSE) { switch (index) { case ACROSS_Z: //if (movieType == BACKWARD) frameNumberZ = endZ; //else frameNumberZ = startZ; break; case ACROSS_T: //if (movieType == BACKWARD) frameNumberT = endT; //else frameNumberT = startT; break; } } timer.start(); break; case STOP: timer.stop(); setFrameNumbers(); up = true; } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/10741ce22be9051166109de0c40e67fef675822e/MoviePlayer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/MoviePlayer.java
break; case PAUSE: parent.setMoviePlay(false); timer.stop();
protected void onPlayerStateChange() { switch (state) { case START: if (historyState == Player.PAUSE) { switch (index) { case ACROSS_Z: //if (movieType == BACKWARD) frameNumberZ = endZ; //else frameNumberZ = startZ; break; case ACROSS_T: //if (movieType == BACKWARD) frameNumberT = endT; //else frameNumberT = startT; break; } } timer.start(); break; case STOP: timer.stop(); setFrameNumbers(); up = true; } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/10741ce22be9051166109de0c40e67fef675822e/MoviePlayer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/MoviePlayer.java
LOG_DIRECTORY = new File(workingDir, "logs").getAbsoluteFile();
if (!Spark.isWindows()) { LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); } else { LOG_DIRECTORY = new File(workingDir, "logs").getAbsoluteFile(); }
public static void main(final String[] args) { /* * EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true; * EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10; * XMPPConnection.DEBUG_ENABLED = true; */ String current = System.getProperty("java.library.path"); String classPath = System.getProperty("java.class.path"); // Set UIManager properties for JTree System.setProperty("apple.laf.useScreenMenuBar", "true"); /** Update Library Path **/ StringBuffer buf = new StringBuffer(); buf.append(current); buf.append(";"); final String workingDirectory = System.getProperty("appdir"); if (workingDirectory == null) { RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile(); BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile(); LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); RESOURCE_DIRECTORY.mkdirs(); LOG_DIRECTORY.mkdirs(); if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) { JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } // This is the Spark.exe or Spark.dmg installed executable. else { // This is the installed executable. File workingDir = new File(workingDirectory); RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile(); BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile(); LOG_DIRECTORY = new File(workingDir, "logs").getAbsoluteFile(); LOG_DIRECTORY.mkdirs(); try { buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";"); } catch (IOException e) { e.printStackTrace(); } } buf.append(classPath); // Update System Properties System.setProperty("java.library.path", buf.toString()); System.setProperty("sun.java2d.noddraw", "true"); SwingUtilities.invokeLater(new Runnable() { public void run() { // Start Application new Spark(); } }); // Handle arguments if (args.length > 0) { argument = args[0]; } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/82176bff8d40a7851002b5e69ea1601964f06975/Spark.java/clean/src/java/org/jivesoftware/Spark.java
if (!(other instanceof RubyNumeric)) { return getRuntime().getNil(); } return getRuntime().newFixnum(compareValue((RubyNumeric) other));
if (other instanceof RubyNumeric) { return getRuntime().newFixnum(compareValue((RubyNumeric) other)); } return other.respondsTo("to_int") ? callCoerced("<=>", other) : getRuntime().getNil();
public IRubyObject cmp(IRubyObject other) { if (!(other instanceof RubyNumeric)) { return getRuntime().getNil(); } return getRuntime().newFixnum(compareValue((RubyNumeric) other)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/14d28170b3c3f50bc56c58974a99b52f44d23730/RubyNumeric.java/buggy/src/org/jruby/RubyNumeric.java
public HTMLReport(Coverage coverage, File outputDir, File sourceDir)
public HTMLReport(CoverageReport coverage, File outputDir, File sourceDir)
public HTMLReport(Coverage coverage, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = coverage; removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/100512ee483a0d8eebc3eb78a5d8913b7b64ddb6/HTMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
public ImageCanvas(ViewerUIF view) { this.view = view;
public ImageCanvas(ViewerUIF view, ViewerCtrl control) { this.view = view; this.control = control; filters = new ArrayList(); manager = new ImageCanvasMng(this);
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
int sizeX = displayImage.getWidth(); int sizeY = displayImage.getHeight(); DataBufferByte buffer = new DataBufferByte(sizeX*sizeY, 3); DataBuffer dataBuf = displayImage.getRaster().getDataBuffer(); ColorModel cm = displayImage.getColorModel(); int v; for (int y = 0; y < sizeY; ++y) { for (int x = 0; x < sizeX; ++x) { v = dataBuf.getElem(0, sizeX*y+x); buffer.setElem(0, sizeX*y+x, cm.getRed(v)); buffer.setElem(1, sizeX*y+x, cm.getGreen(v)); buffer.setElem(2, sizeX*y+x, cm.getBlue(v)); } } ComponentColorModel ccm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); return new BufferedImage(ccm, Raster.createWritableRaster(csm, buffer, null), false, null);
if (displayImage == null) return null; return ImageFactory.getImage(displayImage);
public BufferedImage getDisplayImage() { //Now we only need to tell Java2D how to handle the RGB buffer. int sizeX = displayImage.getWidth(); int sizeY = displayImage.getHeight(); DataBufferByte buffer = new DataBufferByte(sizeX*sizeY, 3); DataBuffer dataBuf = displayImage.getRaster().getDataBuffer(); ColorModel cm = displayImage.getColorModel(); int v; for (int y = 0; y < sizeY; ++y) { for (int x = 0; x < sizeX; ++x) { v = dataBuf.getElem(0, sizeX*y+x); buffer.setElem(0, sizeX*y+x, cm.getRed(v)); buffer.setElem(1, sizeX*y+x, cm.getGreen(v)); buffer.setElem(2, sizeX*y+x, cm.getBlue(v)); } } ComponentColorModel ccm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); return new BufferedImage(ccm, Raster.createWritableRaster(csm, buffer, null), false, null); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
{ super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
{ super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); control.setDrawingArea(x+ViewerUIF.START, y+ViewerUIF.START, (int)(image.getWidth()*magFactor), (int)(image.getHeight()*magFactor));
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
g2D.setColor(Color.black);
paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2D.setColor(Color.black);
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
}
if (lensImage != null) g2D.drawImage(lensImage, null, xLens, yLens); }
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
{ this.image = image;
{ this.image = image; resetLens();
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
}
}
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
{ FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/4; int x1 = ViewerUIF.START-ViewerUIF.ORIGIN; int y1 = ViewerUIF.START-ViewerUIF.ORIGIN; g2D.drawLine(x1, y1, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1-ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1+ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1, y1, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1-ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1+ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawString("o", x1-hFont, y1-hFont); g2D.drawString("x", x1+ViewerUIF.LENGTH/2, y1-hFont); g2D.drawString("y", x1-2*hFont, y1+ViewerUIF.LENGTH-hFont); }
{ FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/4; int x1 = ViewerUIF.START-ViewerUIF.ORIGIN; int y1 = ViewerUIF.START-ViewerUIF.ORIGIN; g2D.drawLine(x1, y1, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1-ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1+ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1, y1, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1-ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1+ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawString("o", x1-hFont, y1-hFont); g2D.drawString("x", x1+ViewerUIF.LENGTH/2, y1-hFont); g2D.drawString("y", x1-2*hFont, y1+ViewerUIF.LENGTH-hFont); }
private void paintXYFrame(Graphics2D g2D) { FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/4; //x-axis int x1 = ViewerUIF.START-ViewerUIF.ORIGIN; int y1 = ViewerUIF.START-ViewerUIF.ORIGIN; g2D.drawLine(x1, y1, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1-ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1+ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); //y-axis g2D.drawLine(x1, y1, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1-ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1+ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); //name g2D.drawString("o", x1-hFont, y1-hFont); g2D.drawString("x", x1+ViewerUIF.LENGTH/2, y1-hFont); g2D.drawString("y", x1-2*hFont, y1+ViewerUIF.LENGTH-hFont); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
{ Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0;
{ Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0;
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java
}
}
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/659f158c2dfd21d045b383412baa0586d50ef8d8/ImageCanvas.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/canvas/ImageCanvas.java