rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
listenerSupport.downloadCompleted(new TransferManagerEvent( this, (Download) transfer));
listenerSupport.downloadCompleted(new TransferManagerEvent(this, (Download) transfer));
void setCompleted(Transfer transfer) { boolean transferFound = false; if (transfer instanceof Download) { Download download = (Download) transfer; transferFound = downloads.remove(transfer.getFile()) != null; if (transferFound) { // Add to list of completed downloads completedDownloads.add((Download) transfer); FileInfo fInfo = transfer.getFile(); // Inform other folder member of added file Folder folder = fInfo.getFolder(getController() .getFolderRepository()); if (folder != null) { folder.broadcastMessage(new FolderFilesChanged( (Download) transfer)); // scan in new downloaded file folder.scanDownloadFile(fInfo, download.getTempFile()); } // Fire event listenerSupport.downloadCompleted(new TransferManagerEvent( this, (Download) transfer)); // Trigger filerequestor getController().getFolderRepository().getFileRequestor() .triggerFileRequesting(); // Autostart torrents File diskFile = fInfo.getDiskFile(getController() .getFolderRepository()); boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); // Autostart bittorento! if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e); // unableToStart(fInfo, ex); } } } } else if (transfer instanceof Upload) { transferFound = queuedUploads.remove(transfer); transferFound = activeUploads.remove(transfer) || transferFound; if (transferFound) { // Fire event listenerSupport.uploadCompleted(new TransferManagerEvent(this, (Upload) transfer)); } } log().debug("Transfer completed: " + transfer); if (transfer instanceof Upload) { // Now trigger, to start next upload triggerTransfersCheck(); } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
getController().getFolderRepository().getFileRequestor() .triggerFileRequesting();
getController().getFolderRepository().getFileRequestor() .triggerFileRequesting();
void setCompleted(Transfer transfer) { boolean transferFound = false; if (transfer instanceof Download) { Download download = (Download) transfer; transferFound = downloads.remove(transfer.getFile()) != null; if (transferFound) { // Add to list of completed downloads completedDownloads.add((Download) transfer); FileInfo fInfo = transfer.getFile(); // Inform other folder member of added file Folder folder = fInfo.getFolder(getController() .getFolderRepository()); if (folder != null) { folder.broadcastMessage(new FolderFilesChanged( (Download) transfer)); // scan in new downloaded file folder.scanDownloadFile(fInfo, download.getTempFile()); } // Fire event listenerSupport.downloadCompleted(new TransferManagerEvent( this, (Download) transfer)); // Trigger filerequestor getController().getFolderRepository().getFileRequestor() .triggerFileRequesting(); // Autostart torrents File diskFile = fInfo.getDiskFile(getController() .getFolderRepository()); boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); // Autostart bittorento! if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e); // unableToStart(fInfo, ex); } } } } else if (transfer instanceof Upload) { transferFound = queuedUploads.remove(transfer); transferFound = activeUploads.remove(transfer) || transferFound; if (transferFound) { // Fire event listenerSupport.uploadCompleted(new TransferManagerEvent(this, (Upload) transfer)); } } log().debug("Transfer completed: " + transfer); if (transfer instanceof Upload) { // Now trigger, to start next upload triggerTransfersCheck(); } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
File diskFile = fInfo.getDiskFile(getController() .getFolderRepository());
File diskFile = fInfo.getDiskFile(getController() .getFolderRepository());
void setCompleted(Transfer transfer) { boolean transferFound = false; if (transfer instanceof Download) { Download download = (Download) transfer; transferFound = downloads.remove(transfer.getFile()) != null; if (transferFound) { // Add to list of completed downloads completedDownloads.add((Download) transfer); FileInfo fInfo = transfer.getFile(); // Inform other folder member of added file Folder folder = fInfo.getFolder(getController() .getFolderRepository()); if (folder != null) { folder.broadcastMessage(new FolderFilesChanged( (Download) transfer)); // scan in new downloaded file folder.scanDownloadFile(fInfo, download.getTempFile()); } // Fire event listenerSupport.downloadCompleted(new TransferManagerEvent( this, (Download) transfer)); // Trigger filerequestor getController().getFolderRepository().getFileRequestor() .triggerFileRequesting(); // Autostart torrents File diskFile = fInfo.getDiskFile(getController() .getFolderRepository()); boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); // Autostart bittorento! if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e); // unableToStart(fInfo, ex); } } } } else if (transfer instanceof Upload) { transferFound = queuedUploads.remove(transfer); transferFound = activeUploads.remove(transfer) || transferFound; if (transferFound) { // Fire event listenerSupport.uploadCompleted(new TransferManagerEvent(this, (Upload) transfer)); } } log().debug("Transfer completed: " + transfer); if (transfer instanceof Upload) { // Now trigger, to start next upload triggerTransfersCheck(); } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e); }
boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e);
void setCompleted(Transfer transfer) { boolean transferFound = false; if (transfer instanceof Download) { Download download = (Download) transfer; transferFound = downloads.remove(transfer.getFile()) != null; if (transferFound) { // Add to list of completed downloads completedDownloads.add((Download) transfer); FileInfo fInfo = transfer.getFile(); // Inform other folder member of added file Folder folder = fInfo.getFolder(getController() .getFolderRepository()); if (folder != null) { folder.broadcastMessage(new FolderFilesChanged( (Download) transfer)); // scan in new downloaded file folder.scanDownloadFile(fInfo, download.getTempFile()); } // Fire event listenerSupport.downloadCompleted(new TransferManagerEvent( this, (Download) transfer)); // Trigger filerequestor getController().getFolderRepository().getFileRequestor() .triggerFileRequesting(); // Autostart torrents File diskFile = fInfo.getDiskFile(getController() .getFolderRepository()); boolean isLeechFile = diskFile != null && fInfo.getFilenameOnly().endsWith(".torrent"); // Autostart bittorento! if (folder.getSyncProfile().isAutostartLeechPrograms() && isLeechFile) { log().warn("Auto starting: " + diskFile.getAbsolutePath()); try { Util.executeFile(diskFile); } catch (IOException e) { log().error(e); // unableToStart(fInfo, ex); } } } } else if (transfer instanceof Upload) { transferFound = queuedUploads.remove(transfer); transferFound = activeUploads.remove(transfer) || transferFound; if (transferFound) { // Fire event listenerSupport.uploadCompleted(new TransferManagerEvent(this, (Upload) transfer)); } } log().debug("Transfer completed: " + transfer); if (transfer instanceof Upload) { // Now trigger, to start next upload triggerTransfersCheck(); } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
log().warn(
log().verbose(
private void storeDownloads() { // Store pending downloads try { // Collect all download infos List<Download> storedDownloads = new ArrayList(pendingDownloads); int nPending = downloads.size(); int nCompleted = completedDownloads.size(); synchronized (downloads) { storedDownloads.addAll(downloads.values()); } synchronized (completedDownloads) { storedDownloads.addAll(completedDownloads); } log().warn( "Storing " + storedDownloads.size() + " downloads (" + nPending + " pending, " + nCompleted + " completed)"); File transferFile = new File(Controller.getMiscFilesLocation(), getController().getConfigName() + ".transfers"); // for testing we should support getConfigName() with subdirs new File(transferFile.getParent()).mkdirs(); OutputStream fOut = new BufferedOutputStream(new FileOutputStream( transferFile)); ObjectOutputStream oOut = new ObjectOutputStream(fOut); oOut.writeObject(storedDownloads); oOut.close(); } catch (IOException e) { log().error("Unable to store pending downloads", e); } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
boolean transfer(Upload upload) { try { if (upload == null) { throw new NullPointerException("Upload is null"); } if (upload.getPartner() == null) { throw new NullPointerException("Upload member is null"); } if (upload.getFile() == null) { throw new NullPointerException("Upload file is null"); } if (upload.isBroken()) { throw new TransferException("Upload broken: " + upload); } Member member = upload.getPartner(); FileInfo file = upload.getFile(); // connection still alive ? if (!member.isConnected()) { log().error("Upload broken, member disconnected: " + upload); return false; } // TODO: check if member is in folder of file File f = file.getDiskFile(getController().getFolderRepository()); if (f == null) { throw new TransferException(upload + ": Myself not longer on " + file.getFolderInfo()); } if (!f.exists()) { throw new TransferException(file + " not found, download canceled. '" + f.getAbsolutePath() + "'"); } if (!f.canRead()) { throw new TransferException("Cannot read file. '" + f.getAbsolutePath() + "'"); } log().info( "Upload started " + upload + " starting at " + upload.getStartOffset()); long startTime = System.currentTimeMillis(); try { if (f.length() == 0) { // Handle files with zero size. // Just send one empty FileChunk FileChunk chunk = new FileChunk(file, 0, new byte[]{}); member.sendMessage(chunk); } else { // Handle usual files. size > 0 // Chunk size int chunkSize = member.isOnLAN() ? MAX_CHUNK_SIZE : (int) getAllowedUploadCPSForWAN(); // Keep care of maximum chunk size chunkSize = Math.min(chunkSize, MAX_CHUNK_SIZE); // log().warn("Chunk size: " + chunkSize); InputStream fin = new BufferedInputStream( new FileInputStream(f)); // starting at offset fin.skip(upload.getStartOffset()); long offset = upload.getStartOffset(); byte[] buffer = new byte[chunkSize]; int read; do { if (upload.isAborted()) { // Abort upload return false; } if (upload.isBroken()) { throw new TransferException("Upload broken: " + upload); } read = fin.read(buffer); if (read < 0) { // stop ul break; } byte[] data; if (read == buffer.length) { // Take buffer unchanged as data data = buffer; } else { // We have read less bytes then our buffer, copy // data data = new byte[read]; System.arraycopy(buffer, 0, data, 0, read); } FileChunk chunk = new FileChunk(file, offset, data); offset += data.length; long start = System.currentTimeMillis(); member.sendMessage(chunk); upload.getCounter().chunkTransferred(chunk); uploadCounter.chunkTransferred(chunk); if (logVerbose) { log().verbose( "Chunk, " + Format.NUMBER_FORMATS.format(chunkSize) + " bytes, uploaded in " + (System.currentTimeMillis() - start) + "ms to " + member.getNick()); } } while (read >= 0); fin.close(); } long took = System.currentTimeMillis() - startTime; logTransfer(false, took, file, member); // upload completed successfully return true; } catch (FileNotFoundException e) { throw new TransferException( "File not found to upload. " + file, e); } catch (IOException e) { throw new TransferException("Problem reading file. " + file, e); } catch (ConnectionException e) { throw new TransferException("Connection problem to " + upload.getPartner(), e); } } catch (TransferException e) { // problems on upload log().error(e); return false; } }
51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/652e070779285a419392fff7d375d332ec5d1c17/TransferManager.java/buggy/src/main/de/dal33t/powerfolder/transfer/TransferManager.java
IWorkbenchActivitySupport support = (IWorkbenchActivitySupport) PlatformUI.getWorkbench().getAdapter( IWorkbenchActivitySupport.class);
IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
private ActivityPersistanceHelper() { loadEnabledStates(); // TODO kim: shouldn't you want to check for any activities (not // categories)? IWorkbenchActivitySupport support = (IWorkbenchActivitySupport) PlatformUI.getWorkbench().getAdapter( IWorkbenchActivitySupport.class); if (support == null) return; boolean noRoles = support.getActivityManager().getDefinedCategoryIds().isEmpty(); if (noRoles) { IActivityManager activityManager = support.getActivityManager(); support.setEnabledActivityIds( activityManager.getDefinedActivityIds()); } }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3da242efa16cbe4e5f0247ec1d33995ee1b9bd88/ActivityPersistanceHelper.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java
try { return arefWithErrors(args); } catch (IndexError e) { } catch (RangeError e) {
if (argCount(args, 1, 2) == 2) { return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1]));
public IRubyObject aref(IRubyObject[] args) { try { return arefWithErrors(args); } catch (IndexError e) { } catch (RangeError e) { } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
return getRuntime().getNil();
if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx)); } else if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0 ? RubyRegexp.last_match(getRuntime().getBackref()) : getRuntime().getNil(); } else if (args[0] instanceof RubyString) { return getValue().indexOf(stringValue(args[0]).getValue()) != -1 ? args[0] : getRuntime().getNil(); } else if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); return begLen == null ? getRuntime().getNil() : substr((int) begLen[0], (int) begLen[1]); } int idx = (int) RubyNumeric.num2long(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx));
public IRubyObject aref(IRubyObject[] args) { try { return arefWithErrors(args); } catch (IndexError e) { } catch (RangeError e) { } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString result = (RubyString) rbClone(); result.capitalize_bang(); return result;
return ((RubyString) rbClone()).capitalize_bang();
public RubyString capitalize() { RubyString result = (RubyString) rbClone(); result.capitalize_bang(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { char c = (char) ((RubyFixnum) other).getLongValue(); return cat("" + c);
if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { return cat("" + (char) ((RubyFixnum) other).getLongValue());
public RubyString concat(IRubyObject other) { if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { char c = (char) ((RubyFixnum) other).getLongValue(); return cat("" + c); } return append(other); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
stringClass.defineMethod("intern", callbackFactory.getMethod(RubyString.class, "intern"));
public static RubyClass createStringClass(Ruby ruby) { RubyClass stringClass = ruby.defineClass("String", ruby.getClasses().getObjectClass()); stringClass.includeModule(ruby.getClasses().getComparableModule()); stringClass.includeModule(ruby.getClasses().getEnumerableModule()); CallbackFactory callbackFactory = ruby.callbackFactory(); stringClass.defineSingletonMethod("new", callbackFactory.getOptSingletonMethod(RubyString.class, "newInstance")); stringClass.defineMethod("initialize", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("clone", callbackFactory.getMethod(RubyString.class, "rbClone")); stringClass.defineMethod("dup", callbackFactory.getMethod(RubyString.class, "dup")); stringClass.defineMethod("<=>", callbackFactory.getMethod(RubyString.class, "op_cmp", IRubyObject.class)); stringClass.defineMethod("casecmp", callbackFactory.getMethod(RubyString.class, "casecmp", IRubyObject.class)); stringClass.defineMethod("==", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("===", callbackFactory.getMethod(RubyString.class, "veryEqual", IRubyObject.class)); stringClass.defineMethod("eql?", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("hash", callbackFactory.getMethod(RubyString.class, "hash")); stringClass.defineMethod("+", callbackFactory.getMethod(RubyString.class, "op_plus", IRubyObject.class)); stringClass.defineMethod("*", callbackFactory.getMethod(RubyString.class, "op_mul", IRubyObject.class)); stringClass.defineMethod("%", callbackFactory.getMethod(RubyString.class, "format", IRubyObject.class)); stringClass.defineMethod("[]", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("[]=", callbackFactory.getOptMethod(RubyString.class, "aset")); stringClass.defineMethod("length", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("size", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("empty?", callbackFactory.getMethod(RubyString.class, "empty")); stringClass.defineMethod("=~", callbackFactory.getMethod(RubyString.class, "match", IRubyObject.class)); stringClass.defineMethod("~", callbackFactory.getMethod(RubyString.class, "match2")); stringClass.defineMethod("succ", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("succ!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("next", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("next!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("upto", callbackFactory.getMethod(RubyString.class, "upto", IRubyObject.class)); stringClass.defineMethod("index", callbackFactory.getOptMethod(RubyString.class, "index")); stringClass.defineMethod("rindex", callbackFactory.getOptMethod(RubyString.class, "rindex")); stringClass.defineMethod("replace", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("to_i", callbackFactory.getMethod(RubyString.class, "to_i")); stringClass.defineMethod("to_f", callbackFactory.getMethod(RubyString.class, "to_f")); stringClass.defineMethod("to_s", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("to_str", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("inspect", callbackFactory.getMethod(RubyString.class, "inspect")); stringClass.defineMethod("dump", callbackFactory.getMethod(RubyString.class, "dump")); stringClass.defineMethod("upcase", callbackFactory.getMethod(RubyString.class, "upcase")); stringClass.defineMethod("downcase", callbackFactory.getMethod(RubyString.class, "downcase")); stringClass.defineMethod("capitalize", callbackFactory.getMethod(RubyString.class, "capitalize")); stringClass.defineMethod("swapcase", callbackFactory.getMethod(RubyString.class, "swapcase")); stringClass.defineMethod("upcase!", callbackFactory.getMethod(RubyString.class, "upcase_bang")); stringClass.defineMethod("downcase!", callbackFactory.getMethod(RubyString.class, "downcase_bang")); stringClass.defineMethod("capitalize!", callbackFactory.getMethod(RubyString.class, "capitalize_bang")); stringClass.defineMethod("swapcase!", callbackFactory.getMethod(RubyString.class, "swapcase_bang")); stringClass.defineMethod("hex", callbackFactory.getMethod(RubyString.class, "hex")); stringClass.defineMethod("oct", callbackFactory.getMethod(RubyString.class, "oct")); stringClass.defineMethod("split", callbackFactory.getOptMethod(RubyString.class, "split")); stringClass.defineMethod("reverse", callbackFactory.getMethod(RubyString.class, "reverse")); stringClass.defineMethod("reverse!", callbackFactory.getMethod(RubyString.class, "reverse_bang")); stringClass.defineMethod("concat", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("<<", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("intern", callbackFactory.getMethod(RubyString.class, "intern")); stringClass.defineMethod("include?", callbackFactory.getMethod(RubyString.class, "include", IRubyObject.class)); stringClass.defineMethod("scan", callbackFactory.getMethod(RubyString.class, "scan", IRubyObject.class)); stringClass.defineMethod("ljust", callbackFactory.getMethod(RubyString.class, "ljust", IRubyObject.class)); stringClass.defineMethod("rjust", callbackFactory.getMethod(RubyString.class, "rjust", IRubyObject.class)); stringClass.defineMethod("center", callbackFactory.getMethod(RubyString.class, "center", IRubyObject.class)); stringClass.defineMethod("sub", callbackFactory.getOptMethod(RubyString.class, "sub")); stringClass.defineMethod("gsub", callbackFactory.getOptMethod(RubyString.class, "gsub")); stringClass.defineMethod("chop", callbackFactory.getMethod(RubyString.class, "chop")); stringClass.defineMethod("chomp", callbackFactory.getOptMethod(RubyString.class, "chomp")); stringClass.defineMethod("strip", callbackFactory.getMethod(RubyString.class, "strip")); stringClass.defineMethod("lstrip", callbackFactory.getMethod(RubyString.class, "lstrip")); stringClass.defineMethod("rstrip", callbackFactory.getMethod(RubyString.class, "rstrip")); stringClass.defineMethod("sub!", callbackFactory.getOptMethod(RubyString.class, "sub_bang")); stringClass.defineMethod("gsub!", callbackFactory.getOptMethod(RubyString.class, "gsub_bang")); stringClass.defineMethod("chop!", callbackFactory.getMethod(RubyString.class, "chop_bang")); stringClass.defineMethod("chomp!", callbackFactory.getOptMethod(RubyString.class, "chomp_bang")); stringClass.defineMethod("strip!", callbackFactory.getMethod(RubyString.class, "strip_bang")); stringClass.defineMethod("lstrip!", callbackFactory.getMethod(RubyString.class, "lstrip_bang")); stringClass.defineMethod("rstrip!", callbackFactory.getMethod(RubyString.class, "rstrip_bang")); stringClass.defineMethod("tr", callbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", callbackFactory.getOptMethod(RubyString.class, "tr_s")); stringClass.defineMethod("delete", callbackFactory.getOptMethod(RubyString.class, "delete")); stringClass.defineMethod("squeeze", callbackFactory.getOptMethod(RubyString.class, "squeeze")); stringClass.defineMethod("count", callbackFactory.getOptMethod(RubyString.class, "count")); stringClass.defineMethod("tr!", callbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", callbackFactory.getOptMethod(RubyString.class, "tr_s_bang")); stringClass.defineMethod("delete!", callbackFactory.getOptMethod(RubyString.class, "delete_bang")); stringClass.defineMethod("squeeze!", callbackFactory.getOptMethod(RubyString.class, "squeeze_bang")); stringClass.defineMethod("each_line", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each_byte", callbackFactory.getMethod(RubyString.class, "each_byte")); stringClass.defineMethod("sum", callbackFactory.getOptMethod(RubyString.class, "sum")); stringClass.defineMethod("slice", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("slice!", callbackFactory.getOptMethod(RubyString.class, "slice_bang")); stringClass.defineMethod("unpack", callbackFactory.getMethod(RubyString.class, "unpack", IRubyObject.class)); return stringClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
stringClass.defineMethod("tr", callbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", callbackFactory.getOptMethod(RubyString.class, "tr_s"));
stringClass.defineMethod("tr", callbackFactory.getMethod(RubyString.class, "tr", RubyString.class, RubyString.class)); stringClass.defineMethod("tr_s", callbackFactory.getMethod(RubyString.class, "tr_s", RubyString.class, RubyString.class));
public static RubyClass createStringClass(Ruby ruby) { RubyClass stringClass = ruby.defineClass("String", ruby.getClasses().getObjectClass()); stringClass.includeModule(ruby.getClasses().getComparableModule()); stringClass.includeModule(ruby.getClasses().getEnumerableModule()); CallbackFactory callbackFactory = ruby.callbackFactory(); stringClass.defineSingletonMethod("new", callbackFactory.getOptSingletonMethod(RubyString.class, "newInstance")); stringClass.defineMethod("initialize", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("clone", callbackFactory.getMethod(RubyString.class, "rbClone")); stringClass.defineMethod("dup", callbackFactory.getMethod(RubyString.class, "dup")); stringClass.defineMethod("<=>", callbackFactory.getMethod(RubyString.class, "op_cmp", IRubyObject.class)); stringClass.defineMethod("casecmp", callbackFactory.getMethod(RubyString.class, "casecmp", IRubyObject.class)); stringClass.defineMethod("==", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("===", callbackFactory.getMethod(RubyString.class, "veryEqual", IRubyObject.class)); stringClass.defineMethod("eql?", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("hash", callbackFactory.getMethod(RubyString.class, "hash")); stringClass.defineMethod("+", callbackFactory.getMethod(RubyString.class, "op_plus", IRubyObject.class)); stringClass.defineMethod("*", callbackFactory.getMethod(RubyString.class, "op_mul", IRubyObject.class)); stringClass.defineMethod("%", callbackFactory.getMethod(RubyString.class, "format", IRubyObject.class)); stringClass.defineMethod("[]", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("[]=", callbackFactory.getOptMethod(RubyString.class, "aset")); stringClass.defineMethod("length", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("size", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("empty?", callbackFactory.getMethod(RubyString.class, "empty")); stringClass.defineMethod("=~", callbackFactory.getMethod(RubyString.class, "match", IRubyObject.class)); stringClass.defineMethod("~", callbackFactory.getMethod(RubyString.class, "match2")); stringClass.defineMethod("succ", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("succ!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("next", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("next!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("upto", callbackFactory.getMethod(RubyString.class, "upto", IRubyObject.class)); stringClass.defineMethod("index", callbackFactory.getOptMethod(RubyString.class, "index")); stringClass.defineMethod("rindex", callbackFactory.getOptMethod(RubyString.class, "rindex")); stringClass.defineMethod("replace", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("to_i", callbackFactory.getMethod(RubyString.class, "to_i")); stringClass.defineMethod("to_f", callbackFactory.getMethod(RubyString.class, "to_f")); stringClass.defineMethod("to_s", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("to_str", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("inspect", callbackFactory.getMethod(RubyString.class, "inspect")); stringClass.defineMethod("dump", callbackFactory.getMethod(RubyString.class, "dump")); stringClass.defineMethod("upcase", callbackFactory.getMethod(RubyString.class, "upcase")); stringClass.defineMethod("downcase", callbackFactory.getMethod(RubyString.class, "downcase")); stringClass.defineMethod("capitalize", callbackFactory.getMethod(RubyString.class, "capitalize")); stringClass.defineMethod("swapcase", callbackFactory.getMethod(RubyString.class, "swapcase")); stringClass.defineMethod("upcase!", callbackFactory.getMethod(RubyString.class, "upcase_bang")); stringClass.defineMethod("downcase!", callbackFactory.getMethod(RubyString.class, "downcase_bang")); stringClass.defineMethod("capitalize!", callbackFactory.getMethod(RubyString.class, "capitalize_bang")); stringClass.defineMethod("swapcase!", callbackFactory.getMethod(RubyString.class, "swapcase_bang")); stringClass.defineMethod("hex", callbackFactory.getMethod(RubyString.class, "hex")); stringClass.defineMethod("oct", callbackFactory.getMethod(RubyString.class, "oct")); stringClass.defineMethod("split", callbackFactory.getOptMethod(RubyString.class, "split")); stringClass.defineMethod("reverse", callbackFactory.getMethod(RubyString.class, "reverse")); stringClass.defineMethod("reverse!", callbackFactory.getMethod(RubyString.class, "reverse_bang")); stringClass.defineMethod("concat", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("<<", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("intern", callbackFactory.getMethod(RubyString.class, "intern")); stringClass.defineMethod("include?", callbackFactory.getMethod(RubyString.class, "include", IRubyObject.class)); stringClass.defineMethod("scan", callbackFactory.getMethod(RubyString.class, "scan", IRubyObject.class)); stringClass.defineMethod("ljust", callbackFactory.getMethod(RubyString.class, "ljust", IRubyObject.class)); stringClass.defineMethod("rjust", callbackFactory.getMethod(RubyString.class, "rjust", IRubyObject.class)); stringClass.defineMethod("center", callbackFactory.getMethod(RubyString.class, "center", IRubyObject.class)); stringClass.defineMethod("sub", callbackFactory.getOptMethod(RubyString.class, "sub")); stringClass.defineMethod("gsub", callbackFactory.getOptMethod(RubyString.class, "gsub")); stringClass.defineMethod("chop", callbackFactory.getMethod(RubyString.class, "chop")); stringClass.defineMethod("chomp", callbackFactory.getOptMethod(RubyString.class, "chomp")); stringClass.defineMethod("strip", callbackFactory.getMethod(RubyString.class, "strip")); stringClass.defineMethod("lstrip", callbackFactory.getMethod(RubyString.class, "lstrip")); stringClass.defineMethod("rstrip", callbackFactory.getMethod(RubyString.class, "rstrip")); stringClass.defineMethod("sub!", callbackFactory.getOptMethod(RubyString.class, "sub_bang")); stringClass.defineMethod("gsub!", callbackFactory.getOptMethod(RubyString.class, "gsub_bang")); stringClass.defineMethod("chop!", callbackFactory.getMethod(RubyString.class, "chop_bang")); stringClass.defineMethod("chomp!", callbackFactory.getOptMethod(RubyString.class, "chomp_bang")); stringClass.defineMethod("strip!", callbackFactory.getMethod(RubyString.class, "strip_bang")); stringClass.defineMethod("lstrip!", callbackFactory.getMethod(RubyString.class, "lstrip_bang")); stringClass.defineMethod("rstrip!", callbackFactory.getMethod(RubyString.class, "rstrip_bang")); stringClass.defineMethod("tr", callbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", callbackFactory.getOptMethod(RubyString.class, "tr_s")); stringClass.defineMethod("delete", callbackFactory.getOptMethod(RubyString.class, "delete")); stringClass.defineMethod("squeeze", callbackFactory.getOptMethod(RubyString.class, "squeeze")); stringClass.defineMethod("count", callbackFactory.getOptMethod(RubyString.class, "count")); stringClass.defineMethod("tr!", callbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", callbackFactory.getOptMethod(RubyString.class, "tr_s_bang")); stringClass.defineMethod("delete!", callbackFactory.getOptMethod(RubyString.class, "delete_bang")); stringClass.defineMethod("squeeze!", callbackFactory.getOptMethod(RubyString.class, "squeeze_bang")); stringClass.defineMethod("each_line", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each_byte", callbackFactory.getMethod(RubyString.class, "each_byte")); stringClass.defineMethod("sum", callbackFactory.getOptMethod(RubyString.class, "sum")); stringClass.defineMethod("slice", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("slice!", callbackFactory.getOptMethod(RubyString.class, "slice_bang")); stringClass.defineMethod("unpack", callbackFactory.getMethod(RubyString.class, "unpack", IRubyObject.class)); return stringClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
stringClass.defineMethod("tr!", callbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", callbackFactory.getOptMethod(RubyString.class, "tr_s_bang"));
stringClass.defineMethod("tr!", callbackFactory.getMethod(RubyString.class, "tr_bang", RubyString.class, RubyString.class)); stringClass.defineMethod("tr_s!", callbackFactory.getMethod(RubyString.class, "tr_s_bang", RubyString.class, RubyString.class));
public static RubyClass createStringClass(Ruby ruby) { RubyClass stringClass = ruby.defineClass("String", ruby.getClasses().getObjectClass()); stringClass.includeModule(ruby.getClasses().getComparableModule()); stringClass.includeModule(ruby.getClasses().getEnumerableModule()); CallbackFactory callbackFactory = ruby.callbackFactory(); stringClass.defineSingletonMethod("new", callbackFactory.getOptSingletonMethod(RubyString.class, "newInstance")); stringClass.defineMethod("initialize", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("clone", callbackFactory.getMethod(RubyString.class, "rbClone")); stringClass.defineMethod("dup", callbackFactory.getMethod(RubyString.class, "dup")); stringClass.defineMethod("<=>", callbackFactory.getMethod(RubyString.class, "op_cmp", IRubyObject.class)); stringClass.defineMethod("casecmp", callbackFactory.getMethod(RubyString.class, "casecmp", IRubyObject.class)); stringClass.defineMethod("==", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("===", callbackFactory.getMethod(RubyString.class, "veryEqual", IRubyObject.class)); stringClass.defineMethod("eql?", callbackFactory.getMethod(RubyString.class, "equal", IRubyObject.class)); stringClass.defineMethod("hash", callbackFactory.getMethod(RubyString.class, "hash")); stringClass.defineMethod("+", callbackFactory.getMethod(RubyString.class, "op_plus", IRubyObject.class)); stringClass.defineMethod("*", callbackFactory.getMethod(RubyString.class, "op_mul", IRubyObject.class)); stringClass.defineMethod("%", callbackFactory.getMethod(RubyString.class, "format", IRubyObject.class)); stringClass.defineMethod("[]", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("[]=", callbackFactory.getOptMethod(RubyString.class, "aset")); stringClass.defineMethod("length", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("size", callbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("empty?", callbackFactory.getMethod(RubyString.class, "empty")); stringClass.defineMethod("=~", callbackFactory.getMethod(RubyString.class, "match", IRubyObject.class)); stringClass.defineMethod("~", callbackFactory.getMethod(RubyString.class, "match2")); stringClass.defineMethod("succ", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("succ!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("next", callbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("next!", callbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("upto", callbackFactory.getMethod(RubyString.class, "upto", IRubyObject.class)); stringClass.defineMethod("index", callbackFactory.getOptMethod(RubyString.class, "index")); stringClass.defineMethod("rindex", callbackFactory.getOptMethod(RubyString.class, "rindex")); stringClass.defineMethod("replace", callbackFactory.getMethod(RubyString.class, "replace", IRubyObject.class)); stringClass.defineMethod("to_i", callbackFactory.getMethod(RubyString.class, "to_i")); stringClass.defineMethod("to_f", callbackFactory.getMethod(RubyString.class, "to_f")); stringClass.defineMethod("to_s", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("to_str", callbackFactory.getSelfMethod(0)); stringClass.defineMethod("inspect", callbackFactory.getMethod(RubyString.class, "inspect")); stringClass.defineMethod("dump", callbackFactory.getMethod(RubyString.class, "dump")); stringClass.defineMethod("upcase", callbackFactory.getMethod(RubyString.class, "upcase")); stringClass.defineMethod("downcase", callbackFactory.getMethod(RubyString.class, "downcase")); stringClass.defineMethod("capitalize", callbackFactory.getMethod(RubyString.class, "capitalize")); stringClass.defineMethod("swapcase", callbackFactory.getMethod(RubyString.class, "swapcase")); stringClass.defineMethod("upcase!", callbackFactory.getMethod(RubyString.class, "upcase_bang")); stringClass.defineMethod("downcase!", callbackFactory.getMethod(RubyString.class, "downcase_bang")); stringClass.defineMethod("capitalize!", callbackFactory.getMethod(RubyString.class, "capitalize_bang")); stringClass.defineMethod("swapcase!", callbackFactory.getMethod(RubyString.class, "swapcase_bang")); stringClass.defineMethod("hex", callbackFactory.getMethod(RubyString.class, "hex")); stringClass.defineMethod("oct", callbackFactory.getMethod(RubyString.class, "oct")); stringClass.defineMethod("split", callbackFactory.getOptMethod(RubyString.class, "split")); stringClass.defineMethod("reverse", callbackFactory.getMethod(RubyString.class, "reverse")); stringClass.defineMethod("reverse!", callbackFactory.getMethod(RubyString.class, "reverse_bang")); stringClass.defineMethod("concat", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("<<", callbackFactory.getMethod(RubyString.class, "concat", IRubyObject.class)); stringClass.defineMethod("intern", callbackFactory.getMethod(RubyString.class, "intern")); stringClass.defineMethod("include?", callbackFactory.getMethod(RubyString.class, "include", IRubyObject.class)); stringClass.defineMethod("scan", callbackFactory.getMethod(RubyString.class, "scan", IRubyObject.class)); stringClass.defineMethod("ljust", callbackFactory.getMethod(RubyString.class, "ljust", IRubyObject.class)); stringClass.defineMethod("rjust", callbackFactory.getMethod(RubyString.class, "rjust", IRubyObject.class)); stringClass.defineMethod("center", callbackFactory.getMethod(RubyString.class, "center", IRubyObject.class)); stringClass.defineMethod("sub", callbackFactory.getOptMethod(RubyString.class, "sub")); stringClass.defineMethod("gsub", callbackFactory.getOptMethod(RubyString.class, "gsub")); stringClass.defineMethod("chop", callbackFactory.getMethod(RubyString.class, "chop")); stringClass.defineMethod("chomp", callbackFactory.getOptMethod(RubyString.class, "chomp")); stringClass.defineMethod("strip", callbackFactory.getMethod(RubyString.class, "strip")); stringClass.defineMethod("lstrip", callbackFactory.getMethod(RubyString.class, "lstrip")); stringClass.defineMethod("rstrip", callbackFactory.getMethod(RubyString.class, "rstrip")); stringClass.defineMethod("sub!", callbackFactory.getOptMethod(RubyString.class, "sub_bang")); stringClass.defineMethod("gsub!", callbackFactory.getOptMethod(RubyString.class, "gsub_bang")); stringClass.defineMethod("chop!", callbackFactory.getMethod(RubyString.class, "chop_bang")); stringClass.defineMethod("chomp!", callbackFactory.getOptMethod(RubyString.class, "chomp_bang")); stringClass.defineMethod("strip!", callbackFactory.getMethod(RubyString.class, "strip_bang")); stringClass.defineMethod("lstrip!", callbackFactory.getMethod(RubyString.class, "lstrip_bang")); stringClass.defineMethod("rstrip!", callbackFactory.getMethod(RubyString.class, "rstrip_bang")); stringClass.defineMethod("tr", callbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", callbackFactory.getOptMethod(RubyString.class, "tr_s")); stringClass.defineMethod("delete", callbackFactory.getOptMethod(RubyString.class, "delete")); stringClass.defineMethod("squeeze", callbackFactory.getOptMethod(RubyString.class, "squeeze")); stringClass.defineMethod("count", callbackFactory.getOptMethod(RubyString.class, "count")); stringClass.defineMethod("tr!", callbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", callbackFactory.getOptMethod(RubyString.class, "tr_s_bang")); stringClass.defineMethod("delete!", callbackFactory.getOptMethod(RubyString.class, "delete_bang")); stringClass.defineMethod("squeeze!", callbackFactory.getOptMethod(RubyString.class, "squeeze_bang")); stringClass.defineMethod("each_line", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each", callbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each_byte", callbackFactory.getMethod(RubyString.class, "each_byte")); stringClass.defineMethod("sum", callbackFactory.getOptMethod(RubyString.class, "sum")); stringClass.defineMethod("slice", callbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("slice!", callbackFactory.getOptMethod(RubyString.class, "slice_bang")); stringClass.defineMethod("unpack", callbackFactory.getMethod(RubyString.class, "unpack", IRubyObject.class)); return stringClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString newStr = newString(getDelete(args)); newStr.infectBy(this); return newStr;
return newString(getDelete(args)).infectBy(this);
public IRubyObject delete(IRubyObject[] args) { RubyString newStr = newString(getDelete(args)); newStr.infectBy(this); return newStr; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString newStr = newString(getValue()); newStr.infectBy(this); return newStr;
return newString(getValue()).infectBy(this);
public IRubyObject dup() { RubyString newStr = newString(getValue()); newStr.infectBy(this); return newStr; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
String sep = RubyRegexp.quote(getRuntime().getGlobalVariables().get("$/").asSymbol());
String sep;
public IRubyObject each_line(IRubyObject[] args) { int strLen = getValue().length(); if (strLen == 0) { return this; } String sep = RubyRegexp.quote(getRuntime().getGlobalVariables().get("$/").asSymbol()); if (argCount(args, 0, 1) == 1) { sep = RubyRegexp.quote(stringValue(args[0]).getValue()); } if (sep == null) { sep = "(?:\\n|\\r\\n?)"; } else if (sep.length() == 0) { sep = "(?:\\n|\\r\\n?){2,}"; } RubyRegexp pat = RubyRegexp.newRegexp(getRuntime(), ".*?" + sep, RubyRegexp.RE_OPTION_MULTILINE); int start = 0; while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getBackref(); getRuntime().yield(md.group(0)); start = md.matchEndPosition(); } if (start < strLen) { getRuntime().yield(substr(start, strLen - start)); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyRegexp pat = RubyRegexp.newRegexp(getRuntime(), ".*?" + sep, RubyRegexp.RE_OPTION_MULTILINE);
RubyRegexp pat = RubyRegexp.newRegexp(getRuntime(), ".*?" + sep, RubyRegexp.RE_OPTION_MULTILINE, null);
public IRubyObject each_line(IRubyObject[] args) { int strLen = getValue().length(); if (strLen == 0) { return this; } String sep = RubyRegexp.quote(getRuntime().getGlobalVariables().get("$/").asSymbol()); if (argCount(args, 0, 1) == 1) { sep = RubyRegexp.quote(stringValue(args[0]).getValue()); } if (sep == null) { sep = "(?:\\n|\\r\\n?)"; } else if (sep.length() == 0) { sep = "(?:\\n|\\r\\n?){2,}"; } RubyRegexp pat = RubyRegexp.newRegexp(getRuntime(), ".*?" + sep, RubyRegexp.RE_OPTION_MULTILINE); int start = 0; while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getBackref(); getRuntime().yield(md.group(0)); start = md.matchEndPosition(); } if (start < strLen) { getRuntime().yield(substr(start, strLen - start)); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
return getValue().equals(((RubyString) other).getValue()) ? getRuntime().getTrue() : getRuntime().getFalse();
return RubyBoolean.newBoolean(getRuntime(), getValue().equals(((RubyString) other).getValue()));
public IRubyObject equal(IRubyObject other) { if (other == this) { return getRuntime().getTrue(); } else if (!(other instanceof RubyString)) { return getRuntime().getNil(); } /* use Java implementation */ return getValue().equals(((RubyString) other).getValue()) ? getRuntime().getTrue() : getRuntime().getFalse(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
return this.value;
return value;
public String getValue() { return this.value; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
return RubyRegexp.newRegexp((RubyString) other, 0).match(this);
return RubyRegexp.newRegexp((RubyString) other, 0, null).match(this);
public IRubyObject match(IRubyObject other) { if (other instanceof RubyRegexp) { return ((RubyRegexp) other).match(this); } else if (other instanceof RubyString) { return RubyRegexp.newRegexp((RubyString) other, 0).match(this); } return other.callMethod("=~", this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
return RubyRegexp.newRegexp(this, 0).match2();
return RubyRegexp.newRegexp(this, 0, null).match2();
public IRubyObject match2() { return RubyRegexp.newRegexp(this, 0).match2(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
if (obj instanceof RubyString) { return (RubyString) obj; } return (RubyString) obj.callMethod("to_s");
return (RubyString) (obj instanceof RubyString ? obj : obj.callMethod("to_s"));
public static RubyString objAsString(IRubyObject obj) { if (obj instanceof RubyString) { return (RubyString) obj; } return (RubyString) obj.callMethod("to_s"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString newString = newString(getValue() + str.getValue()); newString.infectBy(str); return newString;
return (RubyString) newString(getValue()+str.getValue()).infectBy(str);
public RubyString op_plus(IRubyObject other) { RubyString str = stringValue(other); RubyString newString = newString(getValue() + str.getValue()); newString.infectBy(str); return newString; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
infectBy(str); return this;
return (RubyString) infectBy(str);
public RubyString replace(IRubyObject other) { RubyString str = stringValue(other); if (this == other || getValue().equals(str.getValue())) { return this; } setValue(str.getValue()); infectBy(str); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
IRubyObject result = arefWithErrors(args);
IRubyObject result = aref(args); if (result.isNil()) { return result; }
public IRubyObject slice_bang(IRubyObject[] args) { int argc = argCount(args, 1, 2); IRubyObject[] newArgs = new IRubyObject[argc + 1]; newArgs[0] = args[0]; if (argc > 1) { newArgs[1] = args[1]; } newArgs[argc] = newString(""); IRubyObject result = arefWithErrors(args); aset(newArgs); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString newStr = newString(getSqueeze(args)); newStr.infectBy(this); return newStr;
return newString(getSqueeze(args)).infectBy(this);
public IRubyObject squeeze(IRubyObject[] args) { RubyString newStr = newString(getSqueeze(args)); newStr.infectBy(this); return newStr; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
public static RubyString stringValue(IRubyObject anObject) { if (anObject instanceof RubyString) { return (RubyString) anObject; } else { return (RubyString) anObject.convertType(RubyString.class, "String", "to_str"); }
public static RubyString stringValue(IRubyObject object) { return (RubyString) (object instanceof RubyString ? object : object.convertType(RubyString.class, "String", "to_str"));
public static RubyString stringValue(IRubyObject anObject) { if (anObject instanceof RubyString) { return (RubyString) anObject; } else { return (RubyString) anObject.convertType(RubyString.class, "String", "to_str"); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyString newStr = newString(getValue().substring(beg, end)); newStr.infectBy(this); return newStr;
return newString(getValue().substring(beg, end)).infectBy(this);
private IRubyObject substr(int beg, int len) { int strLen = getValue().length(); if (len < 0 || beg > strLen) { return getRuntime().getNil(); } if (beg < 0) { beg += strLen; if (beg < 0) { return getRuntime().getNil(); } } int end = Math.min(strLen, beg + len); RubyString newStr = newString(getValue().substring(beg, end)); newStr.infectBy(this); return newStr; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
RubyInteger sizeArgument = (RubyInteger) args[0].convertType(RubyInteger.class, "Integer", "to_i"); bitSize = sizeArgument.getLongValue();
bitSize = ((RubyInteger) args[0].convertType(RubyInteger.class, "Integer", "to_i")).getLongValue();
public RubyInteger sum(IRubyObject[] args) { long bitSize = 16; if (args.length > 0) { RubyInteger sizeArgument = (RubyInteger) args[0].convertType(RubyInteger.class, "Integer", "to_i"); bitSize = sizeArgument.getLongValue(); } int result = 0; char[] characters = value.toCharArray(); for (int i = 0; i < characters.length; i++) { result += characters[i]; } return RubyFixnum.newFixnum(getRuntime(), result % (2 * bitSize - 1)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
if (swappedString.isNil() == true) { return newString; } return (RubyString) swappedString;
return (RubyString) (swappedString.isNil() == true ? newString : swappedString);
public RubyString swapcase() { RubyString newString = newString(getValue()); IRubyObject swappedString = newString.swapcase_bang(); if (swappedString.isNil() == true) { return newString; } return (RubyString) swappedString; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
private String tr(IRubyObject[] args, boolean squeeze) { if (args.length != 2) { throw new ArgumentError(getRuntime(), "wrong number of arguments"); } String srchSpec = stringValue(args[0]).getValue();
private String tr(RubyString search, RubyString replace, boolean squeeze) { String srchSpec = search.getValue();
private String tr(IRubyObject[] args, boolean squeeze) { if (args.length != 2) { throw new ArgumentError(getRuntime(), "wrong number of arguments"); } String srchSpec = stringValue(args[0]).getValue(); String srch = expandTemplate(srchSpec, true); if (srchSpec.startsWith("^")) { StringBuffer sbuf = new StringBuffer(256); for (int i = 0; i < 256; i++) { char c = (char) i; if (srch.indexOf(c) == -1) { sbuf.append(c); } } srch = sbuf.toString(); } String repl = expandTemplate(stringValue(args[1]).getValue(), false); int strLen = getValue().length(); if (strLen == 0 || srch.length() == 0) { return getValue(); } int repLen = repl.length(); StringBuffer sbuf = new StringBuffer(strLen); char cs, cr; int last = -1; int pos; for (int i = 0; i < strLen; i++) { cs = getValue().charAt(i); pos = srch.indexOf(cs); if (pos == -1) { sbuf.append(cs); last = -1; } else if (repLen > 0) { cr = repl.charAt(Math.min(pos, repLen - 1)); if (squeeze && (int) cr == last) { continue; } sbuf.append(cr); last = cr; } } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
String repl = expandTemplate(stringValue(args[1]).getValue(), false);
String repl = expandTemplate(replace.getValue(), false);
private String tr(IRubyObject[] args, boolean squeeze) { if (args.length != 2) { throw new ArgumentError(getRuntime(), "wrong number of arguments"); } String srchSpec = stringValue(args[0]).getValue(); String srch = expandTemplate(srchSpec, true); if (srchSpec.startsWith("^")) { StringBuffer sbuf = new StringBuffer(256); for (int i = 0; i < 256; i++) { char c = (char) i; if (srch.indexOf(c) == -1) { sbuf.append(c); } } srch = sbuf.toString(); } String repl = expandTemplate(stringValue(args[1]).getValue(), false); int strLen = getValue().length(); if (strLen == 0 || srch.length() == 0) { return getValue(); } int repLen = repl.length(); StringBuffer sbuf = new StringBuffer(strLen); char cs, cr; int last = -1; int pos; for (int i = 0; i < strLen; i++) { cs = getValue().charAt(i); pos = srch.indexOf(cs); if (pos == -1) { sbuf.append(cs); last = -1; } else if (repLen > 0) { cr = repl.charAt(Math.min(pos, repLen - 1)); if (squeeze && (int) cr == last) { continue; } sbuf.append(cr); last = cr; } } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
public IRubyObject tr_bang(IRubyObject[] args) { String newStr = tr(args, false);
public IRubyObject tr_bang(RubyString search, RubyString replace) { String newStr = tr(search, replace, false);
public IRubyObject tr_bang(IRubyObject[] args) { String newStr = tr(args, false); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
public IRubyObject tr_s(IRubyObject[] args) { RubyString newStr = newString(tr(args, true)); newStr.infectBy(this); return newStr;
public IRubyObject tr_s(RubyString search, RubyString replace) { return newString(tr(search, replace, true)).infectBy(this);
public IRubyObject tr_s(IRubyObject[] args) { RubyString newStr = newString(tr(args, true)); newStr.infectBy(this); return newStr; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
public IRubyObject tr_s_bang(IRubyObject[] args) { String newStr = tr(args, true);
public IRubyObject tr_s_bang(RubyString search, RubyString replace) { String newStr = tr(search, replace, true);
public IRubyObject tr_s_bang(IRubyObject[] args) { String newStr = tr(args, true); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/c3988bcedc9973ff7f8c24ac6423ecb89f3ada35/RubyString.java/buggy/src/org/jruby/RubyString.java
setModified(true);
public void setCompanyId(String companyId) { if (((companyId == null) && (_companyId != null)) || ((companyId != null) && (_companyId == null)) || ((companyId != null) && (_companyId != null) && !companyId.equals(_companyId))) { if (!XSS_ALLOW_COMPANYID) { companyId = XSSUtil.strip(companyId); } _companyId = companyId; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setCreateDate(Date createDate) { if (((createDate == null) && (_createDate != null)) || ((createDate != null) && (_createDate == null)) || ((createDate != null) && (_createDate != null) && !createDate.equals(_createDate))) { _createDate = createDate; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setDescription(String description) { if (((description == null) && (_description != null)) || ((description != null) && (_description == null)) || ((description != null) && (_description != null) && !description.equals(_description))) { if (!XSS_ALLOW_DESCRIPTION) { description = XSSUtil.strip(description); } _description = description; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setFolderId(String folderId) { if (((folderId == null) && (_folderId != null)) || ((folderId != null) && (_folderId == null)) || ((folderId != null) && (_folderId != null) && !folderId.equals(_folderId))) { if (!XSS_ALLOW_FOLDERID) { folderId = XSSUtil.strip(folderId); } _folderId = folderId; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setModifiedDate(Date modifiedDate) { if (((modifiedDate == null) && (_modifiedDate != null)) || ((modifiedDate != null) && (_modifiedDate == null)) || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate.equals(_modifiedDate))) { _modifiedDate = modifiedDate; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setName(String name) { if (((name == null) && (_name != null)) || ((name != null) && (_name == null)) || ((name != null) && (_name != null) && !name.equals(_name))) { if (!XSS_ALLOW_NAME) { name = XSSUtil.strip(name); } _name = name; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setReadCount(int readCount) { if (readCount != _readCount) { _readCount = readCount; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setSize(int size) { if (size != _size) { _size = size; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setTitle(String title) { if (((title == null) && (_title != null)) || ((title != null) && (_title == null)) || ((title != null) && (_title != null) && !title.equals(_title))) { if (!XSS_ALLOW_TITLE) { title = XSSUtil.strip(title); } _title = title; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setUserId(String userId) { if (((userId == null) && (_userId != null)) || ((userId != null) && (_userId == null)) || ((userId != null) && (_userId != null) && !userId.equals(_userId))) { if (!XSS_ALLOW_USERID) { userId = XSSUtil.strip(userId); } _userId = userId; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setUserName(String userName) { if (((userName == null) && (_userName != null)) || ((userName != null) && (_userName == null)) || ((userName != null) && (_userName != null) && !userName.equals(_userName))) { if (!XSS_ALLOW_USERNAME) { userName = XSSUtil.strip(userName); } _userName = userName; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setVersion(double version) { if (version != _version) { _version = version; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setVersionUserId(String versionUserId) { if (((versionUserId == null) && (_versionUserId != null)) || ((versionUserId != null) && (_versionUserId == null)) || ((versionUserId != null) && (_versionUserId != null) && !versionUserId.equals(_versionUserId))) { if (!XSS_ALLOW_VERSIONUSERID) { versionUserId = XSSUtil.strip(versionUserId); } _versionUserId = versionUserId; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
setModified(true);
public void setVersionUserName(String versionUserName) { if (((versionUserName == null) && (_versionUserName != null)) || ((versionUserName != null) && (_versionUserName == null)) || ((versionUserName != null) && (_versionUserName != null) && !versionUserName.equals(_versionUserName))) { if (!XSS_ALLOW_VERSIONUSERNAME) { versionUserName = XSSUtil.strip(versionUserName); } _versionUserName = versionUserName; setModified(true); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DLFileEntryModel.java/buggy/portal-ejb/src/com/liferay/portlet/documentlibrary/model/DLFileEntryModel.java
for (int i = 0; i < EMOTICON_MAPPING.length; i++) { String imgTag = "<img src='" + EMOTICON_MAPPING[i][0] + "' />"; html = StringUtil.replace(html, EMOTICON_MAPPING[i][1], imgTag);
for (int i = 0; i < _EMOTICONS.length; i++) { String imgTag = "<img src='" + _EMOTICONS[i][0] + "' />"; html = StringUtil.replace(html, _EMOTICONS[i][1], imgTag);
public static String getHTML(String bbcode) { String html = StringUtil.replace(bbcode, _BBCODE_TAGS, _HTML_TAGS); for (int i = 0; i < EMOTICON_MAPPING.length; i++) { String imgTag = "<img src='" + EMOTICON_MAPPING[i][0] + "' />"; html = StringUtil.replace(html, EMOTICON_MAPPING[i][1], imgTag); } BBCodeTag tag = null; StringBuffer sb = null; while ((tag = getFirstTag(html, "code")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); String code = tag.getElement().replaceAll("\t", " "); String[] lines = Html.escape(code, false).split("\\n"); int digits = Integer.toString(lines.length + 1).length(); sb = new StringBuffer(preTag); sb.append("<div class='message-board-code'>"); for (int i = 0; i < lines.length; i++) { String index = Integer.toString(i + 1); int ld = index.length(); sb.append("<span class='message-board-code-lines'>"); for (int j = 0; j < digits - ld; j++) { sb.append("&nbsp;"); } lines[i] = StringUtil.replace(lines[i], " ", StringPool.NBSP + StringPool.SPACE + StringPool.NBSP); lines[i] = StringUtil.replace(lines[i], " ", StringPool.NBSP + StringPool.SPACE); sb.append(index + "</span>"); sb.append(lines[i]); if (index.length() < lines.length) { sb.append("<br />"); } } sb.append("</div>"); sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "color")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); sb = new StringBuffer(preTag); if (tag.hasParameter()) { sb.append("<span style='color: "); sb.append(tag.getParameter() + ";'>"); sb.append(tag.getElement() + "</span>"); } else { sb.append(tag.getElement()); } sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "email")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); String mailto = GetterUtil.getString( tag.getParameter(), tag.getElement().trim()); sb = new StringBuffer(preTag); sb.append("<a href='mailto: " + mailto + "'>"); sb.append(tag.getElement() + "</a>"); sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "font")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); sb = new StringBuffer(preTag); if (tag.hasParameter()) { sb.append("<span style='font-family: "); sb.append(tag.getParameter() + "';>"); sb.append(tag.getElement() + "</span>"); } else { sb.append(tag.getElement()); } sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "img")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); sb = new StringBuffer(preTag); sb.append("<img src='" + tag.getElement().trim() + "' />"); sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "list")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); String[] items = StringUtil.split(tag.getElement(), "[*]"); sb = new StringBuffer(preTag); if (tag.hasParameter() && listStyles.containsKey(tag.getParameter())) { sb.append(listStyles.get(tag.getParameter())); for (int i = 0; i < items.length; i++) { if (items[i].trim().length() > 0) { sb.append("<li>" + items[i].trim() + "</li>"); } } sb.append("</ol>"); } else { sb.append("<ul style='list-style-type: disc';>"); for (int i = 0; i < items.length; i++) { if (items[i].trim().length() > 0) { sb.append("<li>" + items[i].trim() + "</li>"); } } sb.append("</ul>"); } sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "quote")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); sb = new StringBuffer(preTag); if (tag.hasParameter()) { sb.append("<div class='message-board-quote-title'>"); sb.append(tag.getParameter() + ":</div>"); } sb.append("<div class='message-board-quote'>"); sb.append("<div class='message-board-quote-content'>"); sb.append(tag.getElement()); sb.append("</div></div>"); sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "size")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); sb = new StringBuffer(preTag); if (tag.hasParameter()) { Integer size = new Integer( GetterUtil.getInteger(tag.getParameter())); if (size.intValue() > 7) { size = new Integer(7); } if (fontSizes.containsKey(size)) { sb.append(fontSizes.get(size)); sb.append(tag.getElement() + "</span>"); } else { sb.append(tag.getElement()); } } else { sb.append(tag.getElement()); } sb.append(postTag); html = sb.toString(); } while ((tag = getFirstTag(html, "url")) != null) { String preTag = html.substring(0, tag.getStartPos()); String postTag = html.substring(tag.getEndPos()); String url = GetterUtil.getString( tag.getParameter(), tag.getElement().trim()); sb = new StringBuffer(preTag); sb.append("<a href='" + url + "'>"); sb.append(tag.getElement() + "</a>"); sb.append(postTag); html = sb.toString(); } html = StringUtil.replace(html, "\n", "<br />"); return html; }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/c21650dcdd391ebbbd0de53499242fd7f83e386d/BBCodeUtil.java/clean/portal-ejb/src/com/liferay/portlet/messageboards/util/BBCodeUtil.java
String topicId = message.getTopicId();
public void reIndex(String[] ids) throws SystemException { try { String companyId = ids[0]; Iterator itr1 = MBCategoryUtil.findByCompanyId( companyId).iterator(); while (itr1.hasNext()) { MBCategory category = (MBCategory)itr1.next(); String categoryId = category.getCategoryId(); Iterator itr2 = MBMessageUtil.findByCategoryId( categoryId).iterator(); while (itr2.hasNext()) { MBMessage message = (MBMessage)itr2.next(); String groupId = category.getGroupId(); String topicId = message.getTopicId(); String threadId = message.getThreadId(); String messageId = message.getMessageId(); String title = message.getSubject(); String content = message.getBody(); try { Indexer.addMessage( companyId, groupId, categoryId, topicId, threadId, messageId, title, content); } catch (Exception e1) { // Continue indexing even if one message fails _log.error(e1.getMessage()); } } } } catch (SystemException se) { throw se; } catch (Exception e2) { throw new SystemException(e2); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/d6b02fdb73be07a1fc7332713e89293b3822dfb8/MBCategoryLocalServiceImpl.java/buggy/portal-ejb/src/com/liferay/portlet/messageboards/service/impl/MBCategoryLocalServiceImpl.java
companyId, groupId, categoryId, topicId, threadId, messageId, title, content);
companyId, groupId, categoryId, threadId, messageId, title, content);
public void reIndex(String[] ids) throws SystemException { try { String companyId = ids[0]; Iterator itr1 = MBCategoryUtil.findByCompanyId( companyId).iterator(); while (itr1.hasNext()) { MBCategory category = (MBCategory)itr1.next(); String categoryId = category.getCategoryId(); Iterator itr2 = MBMessageUtil.findByCategoryId( categoryId).iterator(); while (itr2.hasNext()) { MBMessage message = (MBMessage)itr2.next(); String groupId = category.getGroupId(); String topicId = message.getTopicId(); String threadId = message.getThreadId(); String messageId = message.getMessageId(); String title = message.getSubject(); String content = message.getBody(); try { Indexer.addMessage( companyId, groupId, categoryId, topicId, threadId, messageId, title, content); } catch (Exception e1) { // Continue indexing even if one message fails _log.error(e1.getMessage()); } } } } catch (SystemException se) { throw se; } catch (Exception e2) { throw new SystemException(e2); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/d6b02fdb73be07a1fc7332713e89293b3822dfb8/MBCategoryLocalServiceImpl.java/buggy/portal-ejb/src/com/liferay/portlet/messageboards/service/impl/MBCategoryLocalServiceImpl.java
box.border = c.css.getStyle(box.getRealElement()).getBorderWidth();
box.border = box.getContent().getStyle().getBorderWidth();
public static Border getBorder(Context c, Box box) { if (isBlockOrInlineElementBox(c, box)) { // u.p("setting border for: " + box); if (box.border == null) { box.border = c.css.getStyle(box.getRealElement()).getBorderWidth(); } } else { // u.p("skipping border for: " + box); } return box.border; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
public static String getPosition(Context c, Box box) { String position = c.css.getStyle(box.getRealElement()).getStringProperty("position");
public static String getPosition(CalculatedStyle style) { String position = style.getStringProperty("position");
public static String getPosition(Context c, Box box) { String position = c.css.getStyle(box.getRealElement()).getStringProperty("position"); if (position == null) { position = "static"; } return position; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
public static String getPosition(Context c, Box box) { String position = c.css.getStyle(box.getRealElement()).getStringProperty("position"); if (position == null) { position = "static"; } return position; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
public static boolean isBlockNode(Node child, Context c) { //need this as a sensible default if (child == child.getOwnerDocument().getDocumentElement()) return true; if (child instanceof Element) { CalculatedStyle style = c.css.getStyle(child); String display = getDisplay(style); if (display != null && (display.equals("block") || display.equals("table") || //TODO:table cell should not be block according to spec. What did I miss? tobe display.equals("table-cell") || display.equals("list-item")) ) { return true; } } return false; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
if(box.isElement()) { return true; } if ( box.getNode().getNodeType() == Node.TEXT_NODE && !LayoutUtil.isBlockNode(box.getRealElement(), c) ) { return true; } return false;
return !(box.getContent() instanceof TextContent);
public static boolean isBlockOrInlineElementBox(Context c, Box box) { if(box.isElement()) { return true; } if ( box.getNode().getNodeType() == Node.TEXT_NODE && !LayoutUtil.isBlockNode(box.getRealElement(), c) ) { // u.p("box = " + box); // u.p("node type = " + box.getNode().getNodeType()); // u.p("text node == " + Node.TEXT_NODE); // u.p("real element = " + box.getRealElement()); // u.p("is block node = " + isBlockNode(box.getRealElement(),c)); // u.p("is element = " + box.isElement()); return true; } return false; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
public static boolean isFixed(Context c, Box box) { if (getPosition(c, box).equals("fixed")) {
public static boolean isFixed(CalculatedStyle style) { if (getPosition(style).equals("fixed")) {
public static boolean isFixed(Context c, Box box) { if (getPosition(c, box).equals("fixed")) { return true; } return false; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
CalculatedStyle style = c.css.getStyle(inline.getNode());
CalculatedStyle style = inline.getContent().getStyle();
public static boolean isFloated(Box inline, Context c) { CalculatedStyle style = c.css.getStyle(inline.getNode()); return isFloated(style); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
public static boolean isListItem(Context c, Box box) { CalculatedStyle style = c.css.getStyle(box.getNode());
public static boolean isListItem(Box box) { CalculatedStyle style = box.getContent().getStyle();
public static boolean isListItem(Context c, Box box) { CalculatedStyle style = c.css.getStyle(box.getNode()); String display = getDisplay(style); if (display.equals("list-item")) { return true; } return false; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/LayoutUtil.java/clean/src/java/org/xhtmlrenderer/layout/LayoutUtil.java
if (!block.isElement()) {
if (!(block.getContent() instanceof BlockContent)) {
private void adjustHeight(Context c, Box block) { if (!block.isElement()) { return; } Element elem = block.getElement(); if (c.css.getStyle(elem).hasProperty("height")) { //float new_height = c.css.getFloatProperty(elem, "height", c.getExtents().height); float new_height = c.css.getStyle(elem).getFloatPropertyRelative("height", c.getExtents().height); c.getExtents().height = (int) new_height; block.height = (int) new_height; block.auto_height = false; u.p("set height to: " + block.height); } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (c.css.getStyle(elem).hasProperty("height")) {
CalculatedStyle style = block.getContent().getStyle(); if (style.hasProperty("height")) {
private void adjustHeight(Context c, Box block) { if (!block.isElement()) { return; } Element elem = block.getElement(); if (c.css.getStyle(elem).hasProperty("height")) { //float new_height = c.css.getFloatProperty(elem, "height", c.getExtents().height); float new_height = c.css.getStyle(elem).getFloatPropertyRelative("height", c.getExtents().height); c.getExtents().height = (int) new_height; block.height = (int) new_height; block.auto_height = false; u.p("set height to: " + block.height); } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
float new_height = c.css.getStyle(elem).getFloatPropertyRelative("height", c.getExtents().height);
float new_height = style.getFloatPropertyRelative("height", c.getExtents().height);
private void adjustHeight(Context c, Box block) { if (!block.isElement()) { return; } Element elem = block.getElement(); if (c.css.getStyle(elem).hasProperty("height")) { //float new_height = c.css.getFloatProperty(elem, "height", c.getExtents().height); float new_height = c.css.getStyle(elem).getFloatPropertyRelative("height", c.getExtents().height); c.getExtents().height = (int) new_height; block.height = (int) new_height; block.auto_height = false; u.p("set height to: " + block.height); } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (!block.isElement()) {
if (!(block.getContent() instanceof BlockContent)) {
private void adjustWidth(Context c, Box block) { if (!block.isElement()) { return; } // initalize the width to all the available space //block.width = c.getExtents().width; Element elem = block.getElement(); //if (c.css.hasProperty(elem, "width", false)) { if (c.css.getStyle(elem).hasProperty("width")) { // if it is a sub block then don't mess with the width if (c.isSubBlock()) { if (!elem.getNodeName().equals("td")) { u.p("ERRRRRRRRRRORRRR!!! in a sub block that's not a TD!!!!"); } return; } //float new_width = c.css.getFloatProperty(elem, "width", c.getExtents().width, false); float new_width = c.css.getStyle(elem).getFloatPropertyRelative("width", c.getExtents().width); c.getExtents().width = (int) new_width; block.width = (int) new_width; block.auto_width = false; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (c.css.getStyle(elem).hasProperty("width")) {
if (style.hasProperty("width")) {
private void adjustWidth(Context c, Box block) { if (!block.isElement()) { return; } // initalize the width to all the available space //block.width = c.getExtents().width; Element elem = block.getElement(); //if (c.css.hasProperty(elem, "width", false)) { if (c.css.getStyle(elem).hasProperty("width")) { // if it is a sub block then don't mess with the width if (c.isSubBlock()) { if (!elem.getNodeName().equals("td")) { u.p("ERRRRRRRRRRORRRR!!! in a sub block that's not a TD!!!!"); } return; } //float new_width = c.css.getFloatProperty(elem, "width", c.getExtents().width, false); float new_width = c.css.getStyle(elem).getFloatPropertyRelative("width", c.getExtents().width); c.getExtents().width = (int) new_width; block.width = (int) new_width; block.auto_width = false; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
float new_width = c.css.getStyle(elem).getFloatPropertyRelative("width", c.getExtents().width);
float new_width = style.getFloatPropertyRelative("width", c.getExtents().width);
private void adjustWidth(Context c, Box block) { if (!block.isElement()) { return; } // initalize the width to all the available space //block.width = c.getExtents().width; Element elem = block.getElement(); //if (c.css.hasProperty(elem, "width", false)) { if (c.css.getStyle(elem).hasProperty("width")) { // if it is a sub block then don't mess with the width if (c.isSubBlock()) { if (!elem.getNodeName().equals("td")) { u.p("ERRRRRRRRRRORRRR!!! in a sub block that's not a TD!!!!"); } return; } //float new_width = c.css.getFloatProperty(elem, "width", c.getExtents().width, false); float new_width = c.css.getStyle(elem).getFloatPropertyRelative("width", c.getExtents().width); c.getExtents().width = (int) new_width; block.width = (int) new_width; block.auto_width = false; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
Element elem = (Element) box.getNode();
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i);
java.util.List contentList = box.getContent().getContent(c); if (contentList.size() == 0) return box; Iterator contentIterator = contentList.iterator();
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
Layout layout = c.getLayout(child); if (layout == null) {
CascadedStyle firstLineStyle = null; CascadedStyle firstLetterStyle = null; while (contentIterator.hasNext()) { Object o = contentIterator.next(); if (o instanceof FirstLineStyle) { firstLineStyle = ((FirstLineStyle) o).getStyle();
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (layout instanceof NullLayout) {
if (o instanceof FirstLetterStyle) { firstLetterStyle = ((FirstLetterStyle) o).getStyle();
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; }
Content currentContent = (Content) o;
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (child.getNodeType() == Node.ELEMENT_NODE) {
if (!(currentContent instanceof AnonymousBlockContent)) { Layout layout = c.getLayout(currentContent.getElement());
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
Element child_elem = (Element) child;
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem)));
child_box = layout.layout(c, currentContent);
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
} else { child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child);
} else { AnonymousBlockContent anonymous = (AnonymousBlockContent) currentContent; Layout layout = new AnonymousBoxLayout(); child_box = layout.layout(c, anonymous); }
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
Node last_node = ((AnonymousBlockBox) child_box).last_node; if (child != last_node) { while (true) { i++; Node ch = nl.item(i); if (ch == last_node) { break; } } } }
public Box layoutChildren(Context c, Box box) { BlockBox block = (BlockBox) box; c.shrinkExtents(block); // save the original height in case it // has a fixed height //not used: int original_height = block.height; Element elem = (Element) box.getNode(); // prepare for the list items int old_counter = c.getListCounter(); c.setListCounter(0); // for each child NodeList nl = elem.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); // get the layout for this child //Aha! if child is not an element, we get a NullLayout or an AnonymousBlockLayout back Layout layout = c.getLayout(child); if (layout == null) { continue; } if (layout instanceof NullLayout) { continue; } if (c.getRenderingContext().getLayoutFactory().isBreak(child)) { continue; } if (child.getNodeType() == Node.COMMENT_NODE) { continue; } Box child_box = null; if (child.getNodeType() == Node.ELEMENT_NODE) { // update the counter for printing OL list items c.setListCounter(c.getListCounter() + 1); Element child_elem = (Element) child; // execute the layout and get the return bounds //c.parent_box = box; c.placement_point = new Point(0, box.height); c.getBlockFormattingContext().translate(0, box.height); //TODO: below is a temporary hack child_box = layout.layout(c, new BlockContent(child_elem, c.css.getStyle(child_elem))); c.getBlockFormattingContext().translate(0, -box.height); child_box.list_count = c.getListCounter(); } else { // create anonymous block box // prepare the node list of the text children // call layout //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor. child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child); // skip text children if the prev_child == anonymous block box // because that means they were sucked into this block Node last_node = ((AnonymousBlockBox) child_box).last_node; // if anonymous box is only one node wide then skip this // junk if (child != last_node) { while (true) { i++; Node ch = nl.item(i); //u.p("trying to skip: " + ch); if (ch == last_node) { break; } } } } box.addChild(child_box); // set the child_box location child_box.x = 0; child_box.y = box.height; //joshy fix the 'fixed' stuff later // if fixed or abs then don't modify the final layout bounds // because fixed elements are removed from normal flow if (child_box.fixed) { // put fixed positioning in later Fixed.positionFixedChild(c, child_box); } if (child_box.isAbsolute()) { Absolute.positionAbsoluteChild(c, child_box); } // skip adjusting the parent box if the child // doesn't affect flow layout if (LayoutUtil.isOutsideNormalFlow(child_box)) { continue; } // increase the final layout width if the child was greater if (child_box.width > box.width) { box.width = child_box.width; } // increase the final layout height by the height of the child box.height += child_box.height; } c.addMaxWidth(box.width); c.setListCounter(old_counter); c.unshrinkExtents(block); return block; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/BoxLayout.java
if (name .equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) { loadActionSetPartAssociation(ext); return; }
private void appear(IExtensionPoint extPt, IExtension ext) { String name = extPt.getSimpleIdentifier(); if (name .equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) { loadActionSetPartAssociation(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_WORKINGSETS)) { loadWorkingSets(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_FONT_DEFINITIONS)) { loadFontDefinitions(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_THEMES)) { loadThemes(ext); return; } }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b97ada8a49178173d33f907e1eb89e1b33e5ddcd/ExtensionEventHandler.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
revoke(extpt, ext);
Shell parentShell = null; IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window == null) { if (workbench.getWorkbenchWindowCount() == 0) return; window = workbench.getWorkbenchWindows()[0]; } parentShell = window.getShell(); if (MessageDialog .openQuestion( parentShell, ExtensionEventHandlerMessages.ExtensionEventHandler_reset_perspective, message.toString())) { IWorkbenchPage page = window.getActivePage(); if (page == null) return; page.resetPerspective(); }
public void run() { revoke(extpt, ext); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b97ada8a49178173d33f907e1eb89e1b33e5ddcd/ExtensionEventHandler.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
if (name.equalsIgnoreCase(IWorkbenchConstants.PL_VIEWS)) { unloadView(ext); return; }
private void revoke(IExtensionPoint extPt, IExtension ext) { String name = extPt.getSimpleIdentifier(); if (name.equalsIgnoreCase(IWorkbenchConstants.PL_VIEWS)) { unloadView(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_PERSPECTIVES)) { unloadPerspective(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SETS)) { unloadActionSets(ext); return; } if (name .equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) { unloadActionSetPartAssociation(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_WORKINGSETS)) { unloadWorkingSets(ext); return; } }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b97ada8a49178173d33f907e1eb89e1b33e5ddcd/ExtensionEventHandler.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
if (name.equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SETS)) { unloadActionSets(ext); return; } if (name .equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) { unloadActionSetPartAssociation(ext); return; }
private void revoke(IExtensionPoint extPt, IExtension ext) { String name = extPt.getSimpleIdentifier(); if (name.equalsIgnoreCase(IWorkbenchConstants.PL_VIEWS)) { unloadView(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_PERSPECTIVES)) { unloadPerspective(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SETS)) { unloadActionSets(ext); return; } if (name .equalsIgnoreCase(IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) { unloadActionSetPartAssociation(ext); return; } if (name.equalsIgnoreCase(IWorkbenchConstants.PL_WORKINGSETS)) { unloadWorkingSets(ext); return; } }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b97ada8a49178173d33f907e1eb89e1b33e5ddcd/ExtensionEventHandler.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
sb.append(StringPool.SPACE); Properties extraSettingsProps = fileEntry.getExtraSettingsProperties(); Iterator itr = (Iterator)extraSettingsProps.entrySet().iterator(); while (itr.hasNext()) { Map.Entry entry = (Map.Entry)itr.next(); String value = GetterUtil.getString( (String)entry.getValue()); sb.append(value); }
public static void addFile( String companyId, String portletId, String groupId, String repositoryId, String fileName) throws IOException { synchronized (IndexWriter.class) { if (_log.isDebugEnabled()) { _log.debug( "Indexing document " + companyId + " " + portletId + " " + groupId + " " + repositoryId + " " + fileName); } String fileExt = fileName; int fileExtPos = fileExt.indexOf(DLServiceImpl.VERSION); if (fileExtPos != -1) { fileExt = fileExt.substring( fileExt.lastIndexOf(StringPool.PERIOD, fileExtPos), fileExtPos); } else { fileExt = fileExt.substring( fileExt.lastIndexOf(StringPool.PERIOD), fileExt.length()); } InputStream is = null; Session session = null; try { session = JCRFactoryUtil.createSession(); Node contentNode = DLLocalServiceUtil.getFileContentNode( session, companyId, repositoryId, fileName, 0); is = contentNode.getProperty(JCRConstants.JCR_DATA).getStream(); } catch (Exception e) { } finally { if (session != null) { session.logout(); } } if (is == null) { if (_log.isDebugEnabled()) { _log.debug( "Document " + companyId + " " + portletId + " " + groupId + " " + repositoryId + " " + fileName + " does not have any content"); } return; } IndexWriter writer = LuceneUtil.getWriter(companyId); Document doc = new Document(); doc.add( LuceneFields.getKeyword( LuceneFields.UID, LuceneFields.getUID(portletId, repositoryId, fileName))); doc.add( LuceneFields.getKeyword(LuceneFields.COMPANY_ID, companyId)); doc.add( LuceneFields.getKeyword(LuceneFields.PORTLET_ID, portletId)); doc.add(LuceneFields.getKeyword(LuceneFields.GROUP_ID, groupId)); doc.add(LuceneFields.getFile(LuceneFields.CONTENT, is, fileExt)); if (portletId.equals(PortletKeys.DOCUMENT_LIBRARY)) { try { DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntry( repositoryId, fileName); StringBuffer sb = new StringBuffer(); sb.append(fileEntry.getTitle()); sb.append(StringPool.SPACE); sb.append(fileEntry.getDescription()); doc.add(LuceneFields.getText(LuceneFields.PROPERTIES, sb)); } catch (PortalException pe) { throw new IOException(pe.getMessage()); } catch (SystemException se) { throw new IOException(se.getMessage()); } } doc.add(LuceneFields.getDate(LuceneFields.MODIFIED)); doc.add(LuceneFields.getKeyword("repositoryId", repositoryId)); doc.add(LuceneFields.getKeyword("path", fileName)); writer.addDocument(doc); LuceneUtil.write(writer); if (_log.isDebugEnabled()) { _log.debug( "Document " + companyId + " " + portletId + " " + groupId + " " + repositoryId + " " + fileName + " indexed successfully"); } } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f25025f0648f33d965cb91b9b97205c282524460/IndexerImpl.java/buggy/documentlibrary-ejb/src/com/liferay/documentlibrary/util/IndexerImpl.java
box.underline = false; box.strikethrough = false; box.overline = false;
public static void setupTextDecoration( Context c, Node node, InlineBox box ) { Element el = null; if ( node instanceof Element ) { el = (Element)node; } else { el = (Element)node.getParentNode(); } String text_decoration = c.css.getStringProperty( el, "text-decoration" ); if ( text_decoration != null && text_decoration.equals( "underline" ) ) { box.underline = true; } if ( text_decoration != null && text_decoration.equals( "line-through" ) ) { box.strikethrough = true; } if ( text_decoration != null && text_decoration.equals( "overline" ) ) { box.overline = true; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/95d146365b773a18a7e529af5965f0a6034c5e7b/FontUtil.java/buggy/src/java/org/xhtmlrenderer/layout/FontUtil.java
public void addLeftFloat(Box block) { // Uu.p("adding a left float: " + block); //Uu.dump_stack(); left_floats.add(block); offset_map.put(block, getOffset()); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public void addRightFloat(Box block) { right_floats.add(block); offset_map.put(block, getOffset()); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
private int getFloatDistance(Box line, List floatsList) { int xoff = 0; if (floatsList.size() == 0) { return 0; } for (int i = 0; i < floatsList.size(); i++) { Box floater = (Box) floatsList.get(i); Point fpt = (Point) offset_map.get(floater); Point lpt = new Point(this.x, this.y); lpt.y -= line.y; if (lpt.y > fpt.y - floater.height) { xoff = Math.max(xoff, floater.width); } } return xoff; }
private int getFloatDistance(Box line, List float_list) { return this._float_manager.getFloatDistance(line,float_list, this); }
private int getFloatDistance(Box line, List floatsList) { int xoff = 0; if (floatsList.size() == 0) { return 0; } for (int i = 0; i < floatsList.size(); i++) { Box floater = (Box) floatsList.get(i); Point fpt = (Point) offset_map.get(floater); Point lpt = new Point(this.x, this.y); lpt.y -= line.y; if (lpt.y > fpt.y - floater.height) { xoff = Math.max(xoff, floater.width); } } return xoff; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
/* Uu.p("in get left down distance: " + box); for(int i=0; i< left_floats.size(); i++) { Box floater = (Box) left_floats.get(i); Uu.p("looking at floater: " + floater); Uu.p("floater parent = " + floater.getParent()); Uu.p("floater parent parent = " + floater.getParent().getParent()); Point fpt = (Point) offset_map.get(floater); Uu.p("offset = " + fpt); if(floater.y + floater.height - fpt.y > box.y) { return floater.y + floater.height - fpt.y; } } return 0; */
public int getLeftDownDistance(Box box) { /* Uu.p("in get left down distance: " + box); for(int i=0; i< left_floats.size(); i++) { Box floater = (Box) left_floats.get(i); Uu.p("looking at floater: " + floater); Uu.p("floater parent = " + floater.getParent()); Uu.p("floater parent parent = " + floater.getParent().getParent());Point fpt = (Point) offset_map.get(floater); Uu.p("offset = " + fpt); if(floater.y + floater.height - fpt.y > box.y) { return floater.y + floater.height - fpt.y; } } return 0; */ return getDownDistance(box, left_floats); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box getLeftFloatX(Box box) { // count backwards through the floats int x = 0; for (int i = left_floats.size() - 1; i >= 0; i--) { Box floater = (Box) left_floats.get(i); // Uu.p("box = " + box); // Uu.p("testing against float = " + floater); x = floater.x + floater.width; if (floater.y + floater.height > box.y) { // Uu.p("float["+i+"] blocks the box vertically"); return floater; } else { // Uu.p("float["+i+"] doesn't block. moving to next"); } } return null; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box getLeftFloatX(Box box) { // count backwards through the floats int x = 0; for (int i = left_floats.size() - 1; i >= 0; i--) { Box floater = (Box) left_floats.get(i); // Uu.p("box = " + box); // Uu.p("testing against float = " + floater); x = floater.x + floater.width; if (floater.y + floater.height > box.y) { // Uu.p("float["+i+"] blocks the box vertically"); return floater; } else { // Uu.p("float["+i+"] doesn't block. moving to next"); } } return null; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box getLeftFloatX(Box box) { // count backwards through the floats int x = 0; for (int i = left_floats.size() - 1; i >= 0; i--) { Box floater = (Box) left_floats.get(i); // Uu.p("box = " + box); // Uu.p("testing against float = " + floater); x = floater.x + floater.width; if (floater.y + floater.height > box.y) { // Uu.p("float["+i+"] blocks the box vertically"); return floater; } else { // Uu.p("float["+i+"] doesn't block. moving to next"); } } return null; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box getLeftFloatX(Box box) { // count backwards through the floats int x = 0; for (int i = left_floats.size() - 1; i >= 0; i--) { Box floater = (Box) left_floats.get(i); // Uu.p("box = " + box); // Uu.p("testing against float = " + floater); x = floater.x + floater.width; if (floater.y + floater.height > box.y) { // Uu.p("float["+i+"] blocks the box vertically"); return floater; } else { // Uu.p("float["+i+"] doesn't block. moving to next"); } } return null; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Point getOffset() { return new Point(x, y); }
public Point getOffset(Box box) { return (Point) offset_map.get(box); }
public Point getOffset() { //return new Point(x, y); return new Point(x, y); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public int getRightFloatDistance(LineBox line) { return getFloatDistance(line, right_floats); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box getRightFloatX(Box box) { // count backwards through the floats int x = 0; for (int i = right_floats.size() - 1; i >= 0; i--) { Box floater = (Box) right_floats.get(i); // Uu.p("box = " + box); // Uu.p("testing against float = " + floater); x = floater.x; if (floater.y + floater.height > box.y) { // Uu.p("float["+i+"] blocks the box vertically"); return floater; } else { // Uu.p("float["+i+"] doesn't block. moving to next"); } } return null; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
public Box pushDownRight(Box box) { return pushDownLeftRight(box, right_floats); }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3f7f1ad563975d526a941d1eb9629a543d42be24/BlockFormattingContext.java/buggy/src/java/org/xhtmlrenderer/layout/BlockFormattingContext.java
viewMenuAddition = new AbstractContributionFactory("menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) {
viewMenuAddition = new AbstractContributionFactory( "menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) {
public void addMenuContribution() { if (!PlatformUI.isWorkbenchRunning()) { return; } IMenuService menuService = (IMenuService) PlatformUI.getWorkbench() .getService(IMenuService.class); viewMenuAddition = new AbstractContributionFactory("menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX20", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X20", null); additions.add(item); MenuManager submenu = new MenuManager("Menu X21", "org.eclipse.ui.tests.menus.menuX21"); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX22", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X22", null); submenu.add(item); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX23", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X23", null); submenu.add(item); additions.add(submenu); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX24", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X24", null); additions.add(item); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewMenuAddition); viewToolbarAddition = new AbstractContributionFactory("toolbar:org.eclipse.ui.tests.api.MenuTestHarness") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX25", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X25", null); additions.add(item); WidgetContributionItem widget = new WidgetContributionItem( "org.eclipse.ui.tests.menus.itemX26") { public IWorkbenchWidget createWidget() { return new TextWidget(); } }; additions.add(widget); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewToolbarAddition); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/bfd6eb25a2e56f373b64dbce6d194d946bbcc597/TestPlugin.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
"Item X20", null);
null, null, "Item X20", null, null);
public void addMenuContribution() { if (!PlatformUI.isWorkbenchRunning()) { return; } IMenuService menuService = (IMenuService) PlatformUI.getWorkbench() .getService(IMenuService.class); viewMenuAddition = new AbstractContributionFactory("menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX20", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X20", null); additions.add(item); MenuManager submenu = new MenuManager("Menu X21", "org.eclipse.ui.tests.menus.menuX21"); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX22", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X22", null); submenu.add(item); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX23", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X23", null); submenu.add(item); additions.add(submenu); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX24", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X24", null); additions.add(item); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewMenuAddition); viewToolbarAddition = new AbstractContributionFactory("toolbar:org.eclipse.ui.tests.api.MenuTestHarness") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX25", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X25", null); additions.add(item); WidgetContributionItem widget = new WidgetContributionItem( "org.eclipse.ui.tests.menus.itemX26") { public IWorkbenchWidget createWidget() { return new TextWidget(); } }; additions.add(widget); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewToolbarAddition); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/bfd6eb25a2e56f373b64dbce6d194d946bbcc597/TestPlugin.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
"Item X22", null);
null, null, "Item X22", null, null);
public void addMenuContribution() { if (!PlatformUI.isWorkbenchRunning()) { return; } IMenuService menuService = (IMenuService) PlatformUI.getWorkbench() .getService(IMenuService.class); viewMenuAddition = new AbstractContributionFactory("menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX20", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X20", null); additions.add(item); MenuManager submenu = new MenuManager("Menu X21", "org.eclipse.ui.tests.menus.menuX21"); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX22", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X22", null); submenu.add(item); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX23", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X23", null); submenu.add(item); additions.add(submenu); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX24", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X24", null); additions.add(item); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewMenuAddition); viewToolbarAddition = new AbstractContributionFactory("toolbar:org.eclipse.ui.tests.api.MenuTestHarness") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX25", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X25", null); additions.add(item); WidgetContributionItem widget = new WidgetContributionItem( "org.eclipse.ui.tests.menus.itemX26") { public IWorkbenchWidget createWidget() { return new TextWidget(); } }; additions.add(widget); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewToolbarAddition); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/bfd6eb25a2e56f373b64dbce6d194d946bbcc597/TestPlugin.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
"Item X23", null);
null, null, "Item X23", null, null);
public void addMenuContribution() { if (!PlatformUI.isWorkbenchRunning()) { return; } IMenuService menuService = (IMenuService) PlatformUI.getWorkbench() .getService(IMenuService.class); viewMenuAddition = new AbstractContributionFactory("menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX20", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X20", null); additions.add(item); MenuManager submenu = new MenuManager("Menu X21", "org.eclipse.ui.tests.menus.menuX21"); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX22", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X22", null); submenu.add(item); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX23", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X23", null); submenu.add(item); additions.add(submenu); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX24", "org.eclipse.ui.tests.menus.enabledWorld", null, null, "Item X24", null); additions.add(item); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewMenuAddition); viewToolbarAddition = new AbstractContributionFactory("toolbar:org.eclipse.ui.tests.api.MenuTestHarness") { public void createContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.itemX25", "org.eclipse.ui.tests.menus.updateWorld", null, null, "Item X25", null); additions.add(item); WidgetContributionItem widget = new WidgetContributionItem( "org.eclipse.ui.tests.menus.itemX26") { public IWorkbenchWidget createWidget() { return new TextWidget(); } }; additions.add(widget); } public void releaseContributionItems(IMenuService menuService, List items) { // for us this is a no-op } }; menuService.addContributionFactory(viewToolbarAddition); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/bfd6eb25a2e56f373b64dbce6d194d946bbcc597/TestPlugin.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java