auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static FunctionBlock newInstance(int numberOfArguments){ FunctionBlock functionBlock; try{ functionBlock = (FunctionBlock) FXMLLoader.load(Main.class.getResource("/ui/FunctionBlock.fxml"), null, new TactileBuilderFactory()); functionBlock.initializeArguments(numberOfArguments); }catch(IOException e){ e.printStackTrace(); functionBlock = null; } return functionBlock; }

Target:
public static FunctionBlock newInstance(int numberOfArguments) throws IOException { FunctionBlock functionBlock = (FunctionBlock) FXMLLoader.load(Main.class.getResource("/ui/FunctionBlock.fxml"), null, new TactileBuilderFactory()); functionBlock.initializeArguments(numberOfArguments); return functionBlock; }
Source:
public static String guessContentTypeFromData(byte[] data) { String contentType = null; ByteArrayInputStream input = null; try { input = new ByteArrayInputStream(data); contentType = URLConnection.guessContentTypeFromStream(input); if (contentType != null && contentType.isEmpty()) { contentType = null; } } catch (IOException e) { logger.debug("Failed to determine content type: {}", e.getMessage()); contentType = null; } finally { IOUtils.closeQuietly(input); } return contentType; }

Target:
public static String guessContentTypeFromData(byte[] data) { String contentType = null; try (final ByteArrayInputStream input = new ByteArrayInputStream(data)) { try { contentType = URLConnection.guessContentTypeFromStream(input); if (contentType != null && contentType.isEmpty()) { contentType = null; } } catch (final IOException e) { logger.debug("Failed to determine content type: {}", e.getMessage()); } } catch (final IOException ex) { } return contentType; }
Source:
SshPushConnection() throws TransportException { super(TransportGitSsh.this); try { process = getSession().exec(commandFor(getOptionReceivePack()), getTimeout()); final MessageWriter msg = new MessageWriter(); setMessageWriter(msg); final InputStream rpErr = process.getErrorStream(); errorThread = new StreamCopyThread(rpErr, msg.getRawStream()); errorThread.start(); init(process.getInputStream(), process.getOutputStream()); } catch (final TransportException err) { close(); throw err; } catch (final IOException err) { close(); throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); } try { readAdvertisedRefs(); } catch (final NoRemoteRepositoryException notFound) { final String msgs = getMessages(); checkExecFailure(process.exitValue(), getOptionReceivePack(), msgs); throw cleanNotFound(notFound, msgs); } }

Target:
SshPushConnection() throws TransportException { super(TransportGitSsh.this); try { process = getSession().exec(commandFor(getOptionReceivePack()), getTimeout()); final MessageWriter msg = new MessageWriter(); setMessageWriter(msg); final InputStream rpErr = process.getErrorStream(); errorThread = new StreamCopyThread(rpErr, msg.getRawStream()); errorThread.start(); init(process.getInputStream(), process.getOutputStream()); } catch (TransportException err) { close(); throw err; } catch (IOException err) { close(); throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); } try { readAdvertisedRefs(); } catch (NoRemoteRepositoryException notFound) { final String msgs = getMessages(); checkExecFailure(process.exitValue(), getOptionReceivePack(), msgs); throw cleanNotFound(notFound, msgs); } }
Source:
public static Map<String, Object> cohortMemberParameters(String cohortQueryUuid, CohortQueryReportMember member) { Map<String, Object> parameters = new HashMap<>(); parameters.put(EventKeys.COHORT_QUERY_ID, cohortQueryUuid); parameters.put(EventKeys.PATIENT_ID, member.getUuid()); parameters.put(EventKeys.PATIENT_DISPLAY, member.getDisplay()); return parameters; }

Target:
public static Map<String, Object> cohortMemberParameters(String cohortQueryUuid, CohortQueryReportMember member) { Map<String, Object> parameters = new HashMap<>(); parameters.put(Keys.COHORT_QUERY_UUID, cohortQueryUuid); parameters.put(Keys.PATIENT_UUID, member.getUuid()); parameters.put(Keys.PATIENT_DISPLAY, member.getDisplay()); return parameters; }
Source:
private static Key getKey(String filePath) { if (filePath == null || "".equals(filePath)) { handleException("File path cannot be empty or null"); } File keyFile = new File(filePath); if (!keyFile.exists()) { handleException("File cannot be found in : " + filePath); } ObjectInputStream in = null; try { in = new ObjectInputStream(new FileInputStream(keyFile)); in = new LookAheadObjectInputStream(new FileInputStream(keyFile), Key.class); Object object = in.readObject(); if (object instanceof Key) { return (Key) object; } } catch (IOException e) { handleException("Error reading key from given path : " + filePath, e); } catch (ClassNotFoundException e) { handleException("Cannot load a key from the file : " + filePath, e); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } return null; }

Target:
private static Key getKey(String filePath) { if (filePath == null || "".equals(filePath)) { handleException("File path cannot be empty or null"); } File keyFile = new File(filePath); if (!keyFile.exists()) { handleException("File cannot be found in : " + filePath); } ObjectInputStream in = null; try { in = new LookAheadObjectInputStream(new FileInputStream(keyFile), Key.class); Object object = in.readObject(); if (object instanceof Key) { return (Key) object; } } catch (IOException e) { handleException("Error reading key from given path : " + filePath, e); } catch (ClassNotFoundException e) { handleException("Cannot load a key from the file : " + filePath, e); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } return null; }
Source:
private void handleRootBbox(Iterator<LayerInfo> layers, Iterator<LayerGroupInfo> layersGroups) { final Envelope world = new Envelope(-180, 180, -90, 90); Envelope latlonBbox = new Envelope(); LOGGER.finer("Collecting summarized latlonbbox and common SRS..."); while (layers.hasNext()) { if (expandEnvelopeToContain(world, latlonBbox, layers.next().getResource().getLatLonBoundingBox())) { break; } } while (layersGroups.hasNext()) { LayerGroupInfo layerGroup = layersGroups.next(); ReferencedEnvelope referencedEnvelope = layerGroup.getBounds(); if (referencedEnvelope == null) { continue; } if (!referencedEnvelope.getCoordinateReferenceSystem().equals(DefaultGeographicCRS.WGS84)) { try { referencedEnvelope = referencedEnvelope.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception exception) { LOGGER.log(Level.WARNING, String.format( "Failed to transform layer group '%s' bounds to WGS84.", layerGroup.getName()), exception); } } if (expandEnvelopeToContain(world, latlonBbox, referencedEnvelope)) { break; } } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Summarized LatLonBBox is " + latlonBbox); } handleGeographicBoundingBox(latlonBbox); handleBBox(latlonBbox, "CRS:84"); handleAdditionalBBox( new ReferencedEnvelope(latlonBbox, DefaultGeographicCRS.WGS84), null, null); }

Target:
private void handleRootBbox(Iterator<LayerInfo> layers, Iterator<LayerGroupInfo> layersGroups) { final Envelope world = new Envelope(-180, 180, -90, 90); Envelope latlonBbox = new Envelope(); LOGGER.finer("Collecting summarized latlonbbox and common SRS..."); while (layers.hasNext()) { if (expandEnvelopeToContain(world, latlonBbox, layers.next().getResource().getLatLonBoundingBox())) { break; } } while (layersGroups.hasNext()) { LayerGroupInfo layerGroup = layersGroups.next(); ReferencedEnvelope referencedEnvelope = layerGroup.getBounds(); if (referencedEnvelope == null) { continue; } if (!CRS.equalsIgnoreMetadata(referencedEnvelope, DefaultGeographicCRS.WGS84)) { try { referencedEnvelope = referencedEnvelope.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception exception) { LOGGER.log(Level.WARNING, String.format( "Failed to transform layer group '%s' bounds to WGS84.", layerGroup.getName()), exception); } } if (expandEnvelopeToContain(world, latlonBbox, referencedEnvelope)) { break; } } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Summarized LatLonBBox is " + latlonBbox); } handleGeographicBoundingBox(latlonBbox); handleBBox(latlonBbox, "CRS:84"); handleAdditionalBBox( new ReferencedEnvelope(latlonBbox, DefaultGeographicCRS.WGS84), null, null); }
Source:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); output.writeInt(topologyId); output.writeLong(Flag.copyWithoutRemotableFlags(getFlagsBitSet())); }

Target:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); output.writeLong(Flag.copyWithoutRemotableFlags(getFlagsBitSet())); }
Source:
public static long hashCode(@SqlType(StandardTypes.IPADDRESS) Slice value) { return xxHash64(value); }

Target:
public static long hashCode(@SqlType(StandardTypes.IPADDRESS) Slice value) { return XxHash64.hash(value); }
Source:
private static LoadedKey loadKeyFile(File file) { if (!file.canRead()) { throw new SignatureException("Unknown signing key id"); } try { return new LoadedKey(PemReader.loadPublicKey(file)); } catch (Exception ignored) { } try { String base64Key = asCharSource(file, US_ASCII).read(); byte[] rawKey = getMimeDecoder().decode(base64Key.getBytes(US_ASCII)); return new LoadedKey(rawKey); } catch (IOException ignored) { } throw new SignatureException("Unknown signing key id"); }

Target:
private static LoadedKey loadKeyFile(File file) { if (!file.canRead()) { throw new SignatureException("Unknown signing key ID"); } try { return new LoadedKey(PemReader.loadPublicKey(file)); } catch (Exception ignored) { } try { String base64Key = asCharSource(file, US_ASCII).read(); byte[] rawKey = getMimeDecoder().decode(base64Key.getBytes(US_ASCII)); return new LoadedKey(rawKey); } catch (IOException ignored) { } throw new SignatureException("Unknown signing key id"); }
Source:
private void confirmSSLCertificateDialog() { try { new WaitUntil(new ShellWithTextIsAvailable("Untrusted SSL Certificate"), TimePeriod.VERY_LONG); new DefaultShell("Untrusted SSL Certificate"); new PushButton("Yes").click(); new WaitWhile(new ShellWithTextIsAvailable("Untrusted SSL Certificate")); } catch (WaitTimeoutExpiredException ex) { log.info("WaitTimeoutExpiredException occured when handling Certificate dialog."); } }

Target:
private void confirmSSLCertificateDialog() { try { new WaitUntil(new ShellWithTextIsAvailable("Untrusted SSL Certificate"), TimePeriod.VERY_LONG); new DefaultShell("Untrusted SSL Certificate"); new PushButton("Yes").click(); new WaitWhile(new ShellWithTextIsAvailable("Untrusted SSL Certificate")); } catch (WaitTimeoutExpiredException ex) { log.info("WaitTimeoutExpiredException occured when handling Certificate dialog. " + "Dialog has not been shown"); } }
Source:
public boolean addConfig(String name, YamlParser config) { if (name.length() > AUTO_DISCOVERY_PREFIX.length() + AD_MAX_NAME_LEN + AD_MAX_MAG_INSTANCES + 2) { LOGGER.debug("Name too long - skipping: " + name); return false; } String patternText = AUTO_DISCOVERY_PREFIX+"_(.{1," + AD_MAX_NAME_LEN + "})_(\\d{0,"+ AD_MAX_MAG_INSTANCES +"})"; Pattern pattern = Pattern.compile(patternText); Matcher matcher = pattern.matcher(name); if (!matcher.find()) { return false; } String check = matcher.group(1); if (this.configs.containsKey(check)) { return false; } this.adConfigs.put(name, config); this.setReinit(true); return true; }

Target:
public boolean addConfig(String name, YamlParser config) { if (name.length() > AUTO_DISCOVERY_PREFIX.length() + AD_MAX_NAME_LEN + AD_MAX_MAG_INSTANCES + 2) { LOGGER.debug("Name too long - skipping: " + name); return false; } String patternText = AUTO_DISCOVERY_PREFIX+"(.{1," + AD_MAX_NAME_LEN + "})_(\\d{0,"+ AD_MAX_MAG_INSTANCES +"})"; Pattern pattern = Pattern.compile(patternText); Matcher matcher = pattern.matcher(name); if (!matcher.find()) { LOGGER.debug("Cannot match instance name: " + name); return false; } String check = matcher.group(1); if (this.configs.containsKey(check)) { LOGGER.debug("Key already present - skipping: " + name); return false; } this.adConfigs.put(name, config); this.setReinit(true); return true; }
Source:
private void purgeDeviceFileJobQueueRecords() { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.YEAR, -2); log.info("Starting scan for DFJQ entries, fulfilled or older than: " + deadline.getTime()); DeviceFileJobQueueDAO dfjqDao = new DeviceFileJobQueueDAO(); List<DeviceFileJobQueue> dfjqList = dfjqDao.list("all"); int retirees = 0; for (DeviceFileJobQueue item : dfjqList) { if (item.getCreatedDateTime() != null && deadline.getTime().after(item.getCreatedDateTime())) { log.info("Deleting old DFJQ entry: " + item.getKey().getId()); SurveyTaskUtil.spawnDeleteTask(SurveyTaskRequest.DELETE_DFJQ_ACTION, item.getKey().getId()); retirees++; } else { try { String bucket = com.gallatinsystems.common.util.PropertyUtil.getProperty("s3bucket"); HttpURLConnection conn = (HttpURLConnection) S3Util.getConnection(bucket, "images/" + item.getFileName()); log.info("Checking for " + item.getFileName() + " : " + conn.getResponseCode() + " " + conn.getResponseMessage()); if (conn.getResponseCode() == 200) { log.info("Deleting fulfilled DFJQ entry: " + item.getKey().getId()); SurveyTaskUtil.spawnDeleteTask(SurveyTaskRequest.DELETE_DFJQ_ACTION, item.getKey().getId()); retirees++; } } catch (Exception e) { log.warning("Error while connecing to " + item.getFileName() +"\n\n" + e.getMessage()); } } } log.info("Attempted to retire "+retirees+" of " + dfjqList.size()); }

Target:
private void purgeDeviceFileJobQueueRecords() { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.YEAR, TWO_YEARS_AGO); log.info("Starting scan for DFJQ entries, fulfilled or older than: " + deadline.getTime()); DeviceFileJobQueueDAO dfjqDao = new DeviceFileJobQueueDAO(); List<DeviceFileJobQueue> dfjqList = dfjqDao.list("all"); int retirees = 0; for (DeviceFileJobQueue item : dfjqList) { if (item.getCreatedDateTime() != null && deadline.getTime().after(item.getCreatedDateTime())) { log.info("Deleting old DFJQ entry: " + item.getKey().getId()); SurveyTaskUtil.spawnDeleteTask(SurveyTaskRequest.DELETE_DFJQ_ACTION, item.getKey().getId()); retirees++; } else { try { String bucket = com.gallatinsystems.common.util.PropertyUtil.getProperty("s3bucket"); HttpURLConnection conn = (HttpURLConnection) S3Util.getConnection(bucket, "images/" + item.getFileName()); log.info("Checking for " + item.getFileName() + " : " + conn.getResponseCode() + " " + conn.getResponseMessage()); if (conn.getResponseCode() == 200) { log.info("Deleting fulfilled DFJQ entry: " + item.getKey().getId()); SurveyTaskUtil.spawnDeleteTask(SurveyTaskRequest.DELETE_DFJQ_ACTION, item.getKey().getId()); retirees++; } } catch (Exception e) { log.warning("Error while connecing to " + item.getFileName() +"\n" + e.getMessage()); } } } log.info("Attempted to retire " + retirees + " of " + dfjqList.size()); }
Source:
public Pair<RuleResult, Boolean> process(PacketContext pktCtx) { if (condition.matches(pktCtx)) { pktCtx.jlog().debug( "Condition matched on device chain with action and condition {}", pktCtx.currentDevice(), chainId, action, condition); if (meter != null) pktCtx.addFlowTag(meter); if (apply(pktCtx)) return Pair.of(result, true); } return Pair.of(Chain.CONTINUE(), false); }

Target:
public RuleResult process(PacketContext pktCtx) { if (condition.matches(pktCtx)) { pktCtx.jlog().debug( "Condition matched on device chain with action and condition {}", pktCtx.currentDevice(), chainId, action, condition); if (meter != null) pktCtx.addFlowTag(meter); if (apply(pktCtx)) { pktCtx.recordTraversedRule(id, result, true ); return result; } } pktCtx.recordTraversedRule(id, result, false ); return Chain.CONTINUE(); }
Source:
public WriteTxnMarkersResponse getErrorResponse(int throttleTimeMs, Throwable e) { Errors error = Errors.forException(e); final Map<Long, Map<TopicPartition, Errors>> errors = new HashMap<>(data.markers().size()); for (WritableTxnMarker markerEntry : data.markers()) { Map<TopicPartition, Errors> errorsPerPartition = new HashMap<>(); for (WritableTxnMarkerTopic topic : markerEntry.topics()) { for (Integer partitionIdx : topic.partitionIndexes()) errorsPerPartition.put(new TopicPartition(topic.name(), partitionIdx), error); } errors.put(markerEntry.producerId(), errorsPerPartition); } return new WriteTxnMarkersResponse(errors); }

Target:
public WriteTxnMarkersResponse getErrorResponse(int throttleTimeMs, Throwable e) { Errors error = Errors.forException(e); final Map<Long, Map<TopicPartition, Errors>> errors = new HashMap<>(data.markers().size()); for (WritableTxnMarker markerEntry : data.markers()) { Map<TopicPartition, Errors> errorsPerPartition = new HashMap<>(); for (WritableTxnMarkerTopic topic : markerEntry.topics()) { for (Integer partitionIdx : topic.partitionIndexes()) { errorsPerPartition.put(new TopicPartition(topic.name(), partitionIdx), error); } } errors.put(markerEntry.producerId(), errorsPerPartition); } return new WriteTxnMarkersResponse(errors); }
Source:
public int run(String[] args) throws Exception { String crawlId = null; String batchId = null; String usage = "Usage: DeduplicatorJob (<batchId> | -all) [-crawlId <id>] " + " <batchId> - crawl identifier returned by Generator, or -all for all \n \t \t generated batchId-s\n" + " -crawlId <id> - the id with which to prefix the schemas to operate on, \n \t \t (default: storage.crawl.id)\n"; if (args.length == 0) { System.err.println(usage); return -1; } batchId = args[0]; if (!batchId.equals("-all") && batchId.startsWith("-")) { System.err.println(usage); return -1; } for (int i = 1; i < args.length; i++) { if ("-crawlId".equals(args[i])) { crawlId = args[++i]; getConf().set(Nutch.CRAWL_ID_KEY, crawlId); } else { throw new IllegalArgumentException("arg " + args[i] + " not recognized"); } } return deduplicate(crawlId, batchId); }

Target:
public int run(String[] args) throws Exception { String crawlId = null; String batchId = null; String usage = "Usage: DeduplicatorJob (<batchId> | -all) [-crawlId <id>] " + " <batchId> - crawl identifier returned by Generator, or -all for all \n \t \t generated batchId-s\n" + " -crawlId <id> - the id with which to prefix the schemas to operate on, \n \t \t (default: storage.crawl.id)\n"; if (args.length == 0) { System.err.println(usage); return -1; } batchId = args[0]; if (!"-all".equals(batchId) && batchId.startsWith("-")) { System.err.println(usage); return -1; } for (int i = 1; i < args.length; i++) { if ("-crawlId".equals(args[i])) { crawlId = args[++i]; getConf().set(Nutch.CRAWL_ID_KEY, crawlId); } else { throw new IllegalArgumentException("arg " + args[i] + " not recognized"); } } return deduplicate(crawlId, batchId); }
Source:
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GuiGraphics.drawGuiBackGround(mc, guiLeft, guiTop, right, bottom, zLevel, true); GL11.glTranslated(guiLeft, guiTop, 0); for(int i=0; i<_chassiPipe.getChassiSize(); i++) GuiGraphics.drawSlotBackground(mc, 17, 8+20*i); GuiGraphics.drawPlayerInventoryBackground(mc, 18, 9 + 20* _chassiPipe.getChassiSize()); GL11.glTranslated(-guiLeft, -guiTop, 0); if (hasUpgradeModuleUpgarde) { for (int i = 0; i < _chassiPipe.getChassiSize(); i++) { GuiGraphics.drawSlotBackground(mc, guiLeft + 144, guiTop + 8 + i * 20); GuiGraphics.drawSlotBackground(mc, guiLeft + 164, guiTop + 8 + i * 20); } } }

Target:
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GuiGraphics.drawGuiBackGround(mc, guiLeft, guiTop, right, bottom, zLevel, true); for (int i = 0; i < _chassiPipe.getChassiSize(); i++) GuiGraphics.drawSlotBackground(mc, guiLeft + 17, guiTop + 8 + 20 * i); GuiGraphics.drawPlayerInventoryBackground(mc, guiLeft + 18, guiTop + 9 + 20 * _chassiPipe.getChassiSize()); if (hasUpgradeModuleUpgarde) { for (int i = 0; i < _chassiPipe.getChassiSize(); i++) { GuiGraphics.drawSlotBackground(mc, guiLeft + 144, guiTop + 8 + i * 20); GuiGraphics.drawSlotBackground(mc, guiLeft + 164, guiTop + 8 + i * 20); } } }
Source:
protected void processTuple(byte[] tuple) { inputRecords++; if (tuple == null) { if (error.isConnected()) { error.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); errorRecords++; } return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, header)) { if (error.isConnected()) { error.emit(new KeyValPair<String, String>(incomingString, "Blank/header tuple")); errorRecords++; } return; } try { csvStringReader.open(incomingString); Map<String, Object> map = csvMapReader.read(nameMapping, processors); if (output.isConnected()) { parsedRecords++; output.emit(map); } if (validatedData.isConnected()) { validRecords++; validatedData.emit(tuple); } } catch (SuperCsvCellProcessorException e) { if (error.isConnected()) { errorRecords++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); error.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } } catch (SuperCsvException e) { if (error.isConnected()) { errorRecords++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); error.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } } catch (IOException e) { logger.error("Exception in process method {}", e.getMessage()); DTThrowable.rethrow(e); } }

Target:
protected void processTuple(byte[] tuple) { inputRecords++; if (tuple == null) { if (error.isConnected()) { error.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); } errorRecords++; return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, header)) { if (error.isConnected()) { error.emit(new KeyValPair<String, String>(incomingString, "Blank/header tuple")); } errorRecords++; return; } try { csvStringReader.open(incomingString); Map<String, Object> map = csvMapReader.read(nameMapping, processors); if (output.isConnected()) { output.emit(map); } parsedRecords++; if (validatedData.isConnected()) { validatedData.emit(tuple); } validRecords++; } catch (SuperCsvException e) { if (error.isConnected()) { error.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } errorRecords++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); } catch (IOException e) { logger.error("Exception in process method {}", e.getMessage()); DTThrowable.rethrow(e); } }
Source:
public void request(@NonNull Context context, int age, final FeedCoordinator.FeedClientCallback cb) { cb.success(this, new IntegerListCard()); }

Target:
public void request(@NonNull Context context, int age, final FeedCoordinator.FeedClientCallback cb) { cb.success(new IntegerListCard()); }
Source:
protected boolean canDoAction() { return diskExists() && diskIsNotTemplateDisk() && diskIsNotFromTemplateNotOnTargetDomain() && vmIsDown() && vmIsUnlocked() && sourceDomainExists() && sourceDomainIsUp() && sourceDomainIsValidSource() && sourceAndTargetAreDifferent() && targetDomainExists() && targetDomainIsUp() && targetDomainHasSpace() && targetDomainIsValidTarget(); }

Target:
protected boolean canDoAction() { initializeObjectState(); return diskExists() && diskIsNotTemplateDisk() && diskIsNotFromTemplateNotOnTargetDomain() && vmIsDown() && sourceDomainExists() && sourceDomainIsUp() && sourceDomainIsValidSource() && sourceAndTargetAreDifferent() && targetDomainExists() && targetDomainIsUp() && targetDomainHasSpace() && targetDomainIsValidTarget(); }
Source:
private void deleteExcessEntitlements(List<Pool> existingPools) { boolean lifo = !config .getBoolean(ConfigProperties.REVOKE_ENTITLEMENT_IN_FIFO_ORDER); if (existingPools != null && !existingPools.isEmpty()) { List<Pool> overFlowingPools = new ArrayList<Pool>(); for (Pool pool : existingPools) { if (pool.isOverflowing()) { overFlowingPools.add(pool); } } if (!overFlowingPools.isEmpty()) { List<Entitlement> freeEntitlements = this.poolCurator.retrieveFreeEntitlementsOfPools( overFlowingPools, lifo); List<Entitlement> entitlementsToDelete = new ArrayList<Entitlement>(); Map<String, List<Entitlement>> poolSortedEntitlements = new HashMap<String, List<Entitlement>>(); for (Entitlement entitlement : freeEntitlements) { Pool pool = entitlement.getPool(); if (!poolSortedEntitlements.containsKey(pool.getId())) { poolSortedEntitlements.put(pool.getId(), new ArrayList<Entitlement>()); } poolSortedEntitlements.get(pool.getId()).add(entitlement); } for (Pool pool : overFlowingPools) { List<Entitlement> freeEntitlementsForPool = poolSortedEntitlements.get(pool.getId()); if (freeEntitlementsForPool != null && !freeEntitlementsForPool.isEmpty()) { long consumed = pool.getConsumed(); long existing = pool.getQuantity(); Iterator<Entitlement> iter = freeEntitlementsForPool.iterator(); while (consumed > existing && iter.hasNext()) { Entitlement e = iter.next(); entitlementsToDelete.add(e); consumed -= e.getQuantity(); } } } revokeEntitlements(entitlementsToDelete); } } }

Target:
private void deleteExcessEntitlements(List<Pool> existingPools) { boolean lifo = !config .getBoolean(ConfigProperties.REVOKE_ENTITLEMENT_IN_FIFO_ORDER); if (CollectionUtils.isEmpty(existingPools)) { return; } List<Pool> overFlowingPools = new ArrayList<Pool>(); for (Pool pool : existingPools) { if (pool.isOverflowing()) { overFlowingPools.add(pool); } } if (overFlowingPools.isEmpty()) { return; } List<Entitlement> freeEntitlements = this.poolCurator.retrieveFreeEntitlementsOfPools( overFlowingPools, lifo); List<Entitlement> entitlementsToDelete = new ArrayList<Entitlement>(); Map<String, List<Entitlement>> poolSortedEntitlements = new HashMap<String, List<Entitlement>>(); for (Entitlement entitlement : freeEntitlements) { Pool pool = entitlement.getPool(); List<Entitlement> ents = poolSortedEntitlements.get(pool.getId()); if (ents == null) { ents = new ArrayList<Entitlement>(); poolSortedEntitlements.put(pool.getId(), ents); } ents.add(entitlement); } for (Pool pool : overFlowingPools) { List<Entitlement> freeEntitlementsForPool = poolSortedEntitlements.get(pool.getId()); if (CollectionUtils.isEmpty(freeEntitlementsForPool)) { continue; } long consumed = pool.getConsumed(); long existing = pool.getQuantity(); Iterator<Entitlement> iter = freeEntitlementsForPool.iterator(); while (consumed > existing && iter.hasNext()) { Entitlement e = iter.next(); entitlementsToDelete.add(e); consumed -= e.getQuantity(); } } revokeEntitlements(entitlementsToDelete); }
Source:
public List<TokenCacheItem> getTokensAboutToExpire() { Iterator<TokenCacheItem> results = this.getAll(); final List<TokenCacheItem> tokenItems = new ArrayList<>(); while (results.hasNext()) { final TokenCacheItem tokenCacheItem = results.next(); if (tokenCacheItem.getExtendedExpiresOn() != null) { if (isAboutToExpire(tokenCacheItem.getExtendedExpiresOn())) { tokenItems.add(tokenCacheItem); } } else if (isAboutToExpire(tokenCacheItem.getExpiresOn())) { tokenItems.add(tokenCacheItem); } } return tokenItems; }

Target:
public List<TokenCacheItem> getTokensAboutToExpire() { Iterator<TokenCacheItem> results = this.getAll(); final List<TokenCacheItem> tokenItems = new ArrayList<>(); while (results.hasNext()) { final TokenCacheItem tokenCacheItem = results.next(); if (isAboutToExpire(tokenCacheItem.getExpiresOn())) { tokenItems.add(tokenCacheItem); } } return tokenItems; }
Source:
public void temporalOrderingIsPreservedForBatchedStartTransactionRequests() { UUID requestor = UUID.randomUUID(); List<Long> allTimestams = new ArrayList<>(); allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 1)); allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 4)); allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 20)); assertThat(allTimestams).isSorted(); }

Target:
public void temporalOrderingIsPreservedForBatchedStartTransactionRequests() { UUID requestor = UUID.randomUUID(); List<Long> allTimestamps = new ArrayList<>(); allTimestamps.addAll(getSortedBatchedStartTimestamps(requestor, 1)); allTimestamps.addAll(getSortedBatchedStartTimestamps(requestor, 4)); allTimestamps.addAll(getSortedBatchedStartTimestamps(requestor, 20)); assertThat(allTimestamps).isSorted(); }
Source:
public boolean equals(Object obj) { if (obj != null && obj instanceof ParameterizedFrameworkMethod) { return super.equals(obj) && m_paramsIndex == ((ParameterizedFrameworkMethod) obj).m_paramsIndex; } return false; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } ParameterizedFrameworkMethod other = (ParameterizedFrameworkMethod) obj; if (m_paramsIndex != other.m_paramsIndex) { return false; } return true; }
Source:
public void testCreateTokenAt() { GenericEventMessage.clock = Clock.fixed(Instant.parse("2007-12-03T10:15:00.01Z"), Clock.systemUTC().getZone()); DomainEventMessage<String> event1 = createEvent(0); testSubject.appendEvents(event1); GenericEventMessage.clock = Clock.fixed(Instant.parse("2007-12-03T10:15:40.00Z"), Clock.systemUTC().getZone()); DomainEventMessage<String> event2 = createEvent(1); testSubject.appendEvents(event2); GenericEventMessage.clock = Clock.fixed(Instant.parse("2007-12-03T10:15:35.00Z"), Clock.systemUTC().getZone()); DomainEventMessage<String> event3 = createEvent(2); testSubject.appendEvents(event3); TrackingToken tokenAt = testSubject.createTokenAt(Instant.parse("2007-12-03T10:15:30.00Z")); List<EventMessage<?>> readEvents = testSubject.readEvents(tokenAt, false) .collect(toList()); assertEventStreamsById(Arrays.asList(event3, event2), readEvents); }

Target:
public void testCreateTokenAt() { DomainEventMessage<String> event1 = createEvent(0, Instant.parse("2007-12-03T10:15:00.01Z")); testSubject.appendEvents(event1); DomainEventMessage<String> event2 = createEvent(1, Instant.parse("2007-12-03T10:15:40.00Z")); testSubject.appendEvents(event2); DomainEventMessage<String> event3 = createEvent(2, Instant.parse("2007-12-03T10:15:35.00Z")); testSubject.appendEvents(event3); TrackingToken tokenAt = testSubject.createTokenAt(Instant.parse("2007-12-03T10:15:30.00Z")); List<EventMessage<?>> readEvents = testSubject.readEvents(tokenAt, false) .collect(toList()); assertEventStreamsById(Arrays.asList(event3, event2), readEvents); }
Source:
private void compareStyleRanges(Position[] expected, StyleRange[] actual, String fileName, String fileParentPath) { assertEquals("Length of StyleRanges is incorrect: " + printStyleRanges(actual), expected.length + 1, actual.length); int i; for (i = 0; i < actual.length - 1; i++) { assertEquals("Start of StyleRange at index " + i + " is incorrect.", expected[i].offset, actual[i].start); assertEquals("Length of StyleRange at index " + i + " is incorrect.", expected[i].length, actual[i].length); } assertEquals("Start of file path StyleRange is incorrect.", expected[i].offset, fileName.length()); assertEquals("Length of file path StyleRange at index is incorrect.", expected[i].length, 3 + project.getName().length() + fileParentPath.length()); }

Target:
private void compareStyleRanges(Position[] expected, StyleRange[] actual, String fileName, String fileParentPath) { assertEquals("Length of StyleRanges is incorrect: " + printStyleRanges(actual), expected.length + 1, actual.length); int i; for (i = 0; i < actual.length - 1; i++) { assertEquals("Start of StyleRange at index " + i + " is incorrect.", expected[i].offset, actual[i].start); assertEquals("Length of StyleRange at index " + i + " is incorrect.", expected[i].length, actual[i].length); } assertEquals("Start of file path StyleRange is incorrect.", fileName.length(), actual[i].start); assertEquals("Length of file path StyleRange at index is incorrect.", 3 + project.getName().length() + fileParentPath.length(), actual[i].length); }
Source:
public void all_composed_assertions_should_pass() { SoftAssertions delegate = new SoftAssertions(); delegate.assertThat(1).isEqualTo(1); delegate.assertAll(); softly.assertThat(1).isEqualTo(1); softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 2); softly.assertAlso(delegate); softly.assertAll(); assertThat(softly.wasSuccess()).isTrue(); }

Target:
public void all_composed_assertions_should_pass() { SoftAssertions delegate = new SoftAssertions(); delegate.assertThat(1).isEqualTo(1); delegate.assertAll(); softly.assertThat(1).isEqualTo(1); softly.assertThat(list(1, 2)).containsOnly(1, 2); softly.assertAlso(delegate); softly.assertAll(); assertThat(softly.wasSuccess()).isTrue(); }
Source:
public void tearDown() throws Exception { admin1.removeReplicationPeer(PEER_ID); Thread.sleep(SLEEP_TIME); Thread.sleep(SLEEP_TIME); admin1.disableTable(NORMAL_TABLE); admin1.deleteTable(NORMAL_TABLE); admin2.disableTable(NORMAL_TABLE); admin2.deleteTable(NORMAL_TABLE); }

Target:
public void tearDown() throws Exception { admin1.removeReplicationPeer(PEER_ID); admin1.disableTable(NORMAL_TABLE); admin1.deleteTable(NORMAL_TABLE); admin2.disableTable(NORMAL_TABLE); admin2.deleteTable(NORMAL_TABLE); }
Source:
private boolean isEligibleForShuffle(SingularityTaskId task) { return ( isLongRunning(task) && !configuration.getDoNotShuffleRequests().contains(task.getRequestId()) && (TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - task.getStartedAt()) > configuration.getMinutesBeforeNewTaskEligibleForShuffle()) ); }

Target:
private boolean isEligibleForShuffle(SingularityTaskId task) { Optional<SingularityTaskHistoryUpdate> taskRunning = taskManager.getTaskHistoryUpdate(task, ExtendedTaskState.TASK_RUNNING); return ( !configuration.getDoNotShuffleRequests().contains(task.getRequestId()) && isLongRunning(task) && ( configuration.getMinutesBeforeNewTaskEligibleForShuffle() == 0 || (taskRunning.isPresent() && TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - taskRunning.get() .getTimestamp()) >= configuration.getMinutesBeforeNewTaskEligibleForShuffle()) ) ); }
Source:
private void prepareUploadAnalytics(String postContent) { synchronized (sQueuedPostsList) { sCurrentUploadingPostAnalyticsProperties = new HashMap<>(); sCurrentUploadingPostAnalyticsProperties .put("word_count", AnalyticsUtils.getWordCount(mPost.getContent())); sCurrentUploadingPostAnalyticsProperties.put("editor_source", AppPrefs.isAztecEditorEnabled() ? "aztec" : AppPrefs.isVisualEditorEnabled() ? "hybrid" : "legacy"); if (hasGallery()) { sCurrentUploadingPostAnalyticsProperties.put("with_galleries", true); } if (!mHasImage) { String imageTagsPattern = "<img[^>]+src\\s*=\\s*[\"]([^\"]+)[\"][^>]*>"; Pattern pattern = Pattern.compile(imageTagsPattern); Matcher matcher = pattern.matcher(postContent); mHasImage = matcher.find(); } if (mHasImage) { sCurrentUploadingPostAnalyticsProperties.put("with_photos", true); } if (!mHasVideo) { String videoTagsPattern = "<video[^>]+src\\s*=\\s*[\"]([^\"]+)[\"][^>]*>|\\[wpvideo\\s+([^\\]]+)\\]"; Pattern pattern = Pattern.compile(videoTagsPattern); Matcher matcher = pattern.matcher(postContent); mHasVideo = matcher.find(); } if (mHasVideo) { sCurrentUploadingPostAnalyticsProperties.put("with_videos", true); } if (mHasCategory) { sCurrentUploadingPostAnalyticsProperties.put("with_categories", true); } if (!mPost.getTagNameList().isEmpty()) { sCurrentUploadingPostAnalyticsProperties.put("with_tags", true); } } }

Target:
private void prepareUploadAnalytics(String postContent) { synchronized (sQueuedPostsList) { sCurrentUploadingPostAnalyticsProperties = new HashMap<>(); sCurrentUploadingPostAnalyticsProperties .put("word_count", AnalyticsUtils.getWordCount(mPost.getContent())); sCurrentUploadingPostAnalyticsProperties.put("editor_source", AppPrefs.isAztecEditorEnabled() ? "aztec" : AppPrefs.isVisualEditorEnabled() ? "hybrid" : "legacy"); if (hasGallery()) { sCurrentUploadingPostAnalyticsProperties.put("with_galleries", true); } if (!mHasImage) { String imageTagsPattern = "<img[^>]+src\\s*=\\s*[\"]([^\"]+)[\"][^>]*>"; Pattern pattern = Pattern.compile(imageTagsPattern); Matcher matcher = pattern.matcher(postContent); mHasImage = matcher.find(); } if (mHasImage) { sCurrentUploadingPostAnalyticsProperties.put("with_photos", true); } if (!mHasVideo) { String videoTagsPattern = "<video[^>]+src\\s*=\\s*[\"]([^\"]+)[\"][^>]*>|\\[wpvideo\\s+([^\\]]+)\\]"; Pattern pattern = Pattern.compile(videoTagsPattern); Matcher matcher = pattern.matcher(postContent); mHasVideo = matcher.find(); } if (mHasVideo) { sCurrentUploadingPostAnalyticsProperties.put("with_videos", true); } if (mHasCategory) { sCurrentUploadingPostAnalyticsProperties.put("with_categories", true); } if (!mPost.getTagNameList().isEmpty()) { sCurrentUploadingPostAnalyticsProperties.put("with_tags", true); } sCurrentUploadingPostAnalyticsProperties.put("via_new_editor", AppPrefs.isVisualEditorEnabled()); } }
Source:
private <T, O> AsyncFuture<O> entries( final FindSeries.Request seriesRequest, final Function<SearchHit, T> converter, final Transform<SearchTransformResult<T>, O> collector, final Consumer<SearchRequest> modifier ) { final QueryBuilder f = filter(seriesRequest.getFilter()); OptionalLimit limit = seriesRequest.getLimit(); return doto(c -> { SearchRequest request = c.getIndex().search(METADATA_TYPE); request.source() .size(limit.asMaxInteger(scrollSize)) .query(new BoolQueryBuilder().must(f)) .sort(new FieldSortBuilder("_doc")); modifier.accept(request); if (seriesRequest.getFeatures().hasFeature(Feature.METADATA_LIVE_CURSOR)) { request.scroll(SCROLL_TIME); return scrollEntries(c, request, limit, converter) .onResolved(r -> ofNullable(r.getLastScrollId()).ifPresent(c::clearSearchScroll)) .directTransform(collector); } else { return pageEntries(c, request, limit, converter) .directTransform(collector); } }); }

Target:
private <T, O> AsyncFuture<O> entries( final FindSeries.Request seriesRequest, final Function<SearchHit, T> converter, final Transform<SearchTransformResult<T>, O> collector, final Consumer<SearchRequest> modifier ) { final QueryBuilder f = filter(seriesRequest.getFilter()); OptionalLimit limit = seriesRequest.getLimit(); return doto(c -> { SearchRequest request = c.getIndex().search(METADATA_TYPE); request.source() .size(limit.asMaxInteger(scrollSize)) .query(new BoolQueryBuilder().must(f)) .sort(new FieldSortBuilder("_doc")); modifier.accept(request); if (seriesRequest.getFeatures().hasFeature(Feature.METADATA_LIVE_CURSOR)) { return pageEntries(c, request, limit, converter) .directTransform(collector); } else { request.scroll(SCROLL_TIME); return scrollEntries(c, request, limit, converter) .onResolved(r -> ofNullable(r.getLastScrollId()).ifPresent(c::clearSearchScroll)) .directTransform(collector); } }); }
Source:
public LoadTestDataSimpleResponseMessageType deleteAddress(DeleteAddressRequestMessageType request) { Address record = new Address(request.getAddress(), loadTestDataService.getPatientBy(request.getAddress().getPatientId())); if (null == record) { return buildSimpleResponse(Boolean.FALSE, ACT_FAIL); } loadTestDataService.deleteAddress(record); return buildSimpleResponse(Boolean.TRUE, ACT_SUCCESSFUL); }

Target:
public LoadTestDataSimpleResponseMessageType deleteAddress(DeleteAddressRequestMessageType request) { Address record = new Address(request.getAddress(), loadTestDataService.getPatientBy(request.getAddress().getPatientId())); boolean result = loadTestDataService.deleteAddress(record); if (result) { return buildSimpleResponse(Boolean.TRUE, ACT_SUCCESSFUL); } return buildSimpleResponse(Boolean.FALSE, ACT_FAIL); }
Source:
public Expression string(JSONArray json, int index) { Object obj = json.get(index); if (obj == null) { return ff.literal(null); } else if (obj instanceof String) { String str = (String) obj; return ff.literal(str); } else if (obj instanceof Number) { Number number = (Number) obj; return ff.literal(number); } else if (obj instanceof Boolean) { Boolean bool = (Boolean) obj; return ff.literal(bool); } else if (obj instanceof JSONObject) { MBFunction function = new MBFunction(this, (JSONObject) obj); return function.function(String.class); } else if (obj instanceof JSONArray) { JSONArray array = (JSONArray) obj; if (isString(array, 0)) { String expressionName = get(array, 0); if (MBExpression.canCreate(expressionName)) { return MBExpression.transformExpression(array); } else { throw new MBFormatException( context + " string unavailable: expression' " + expressionName + "' not supported."); } } else { throw new MBFormatException(context + " string from JSONArray not a supported"); } } else { throw new IllegalArgumentException( "json contents invalid, " + context + " value limited to String, Number, Boolean, JSONArray or JSONObject but was " + obj.getClass().getSimpleName()); } }

Target:
public Expression string(JSONArray json, int index) { Object obj = json.get(index); if (obj == null) { return ff.literal(null); } else if (obj instanceof String) { String str = (String) obj; return ff.literal(str); } else if (obj instanceof Number) { Number number = (Number) obj; return ff.literal(number); } else if (obj instanceof Boolean) { Boolean bool = (Boolean) obj; return ff.literal(bool); } else if (obj instanceof JSONObject) { MBFunction function = new MBFunction(this, (JSONObject) obj); return function.function(String.class); } else if (obj instanceof JSONArray) { JSONArray array = (JSONArray) obj; if (isString(array, 0)) { String expressionName = get(array, 0); if (MBExpression.canCreate(expressionName)) { return MBExpression.transformExpression(array); } else { throw new MBFormatException( context + " string unavailable: data expression \"" + expressionName + "\" invalid. It may be misspelled or not supported by this implementation"); } } else { throw new MBFormatException( context + " string unavailable: Conversion from a JSONArray not a supported: " + array); } } else { throw new IllegalArgumentException( context + " string unavailable: json contents invalid - value limited to String, Number, Boolean, JSONArray or JSONObject but was " + obj.getClass().getSimpleName()); } }
Source:
public static ArgumentFilter createFilter(Method method) { Subscribe annotation = method.getAnnotation(Subscribe.class); checkAnnotated(method, annotation); @Nullable Where where = filterAnnotationOf(method); @Nullable ByField byField = annotation.filter(); boolean byFieldEmpty = byField.path().isEmpty(); String fieldPath; String value; if (where != null) { fieldPath = where.field(); value = where.equals(); checkState( byFieldEmpty, "The subscriber method `%s()` has `@%s` and `@%s`" + " annotations at the same time." + " Please use only one, preferring `%s` because `%s` is deprecated.", method.getName(), ByField.class.getName(), Where.class.getName(), Where.class.getName(), ByField.class.getName() ); } else { if (byFieldEmpty) { return acceptingAll(); } fieldPath = byField.path(); value = byField.value(); } Class<Message> paramType = firstParamType(method); Field field = Field.parse(fieldPath); Class<?> fieldType = field.findType(paramType).orElseThrow( () -> newIllegalStateException( "The message with the type `%s` does not have the field `%s`.", paramType.getName(), field) ); Object expectedValue = fromString(value, fieldType); return acceptingOnly(field.path(), expectedValue); }

Target:
public static ArgumentFilter createFilter(Method method) { Subscribe annotation = method.getAnnotation(Subscribe.class); checkAnnotated(method, annotation); @Nullable Where where = filterAnnotationOf(method); ByField byField = annotation.filter(); boolean byFieldEmpty = byField.path().isEmpty(); String fieldPath; String value; if (where != null) { fieldPath = where.field(); value = where.equals(); checkNoByFieldAnnotation(byFieldEmpty, method); } else { if (byFieldEmpty) { return acceptingAll(); } fieldPath = byField.path(); value = byField.value(); } return createFilter(method, fieldPath, value); }
Source:
public void plotGraphMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ChartUtil.awtProblemCause != null) { rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); return; } setWidth(req); setHeight(req); setNumBuilds(req); setRightBuildNum(req); setHasLegend(req); setTitle(req); setStyle(req); setUseDescr(req); setDescription(req); generatePlot(false); ChartRenderingInfo info = new ChartRenderingInfo(); plot.createBufferedImage(getWidth(), getHeight(), info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap(getCsvFileName(), info)); }

Target:
public void plotGraphMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ChartUtil.awtProblemCause != null) { rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); return; } setWidth(req); setHeight(req); setNumBuilds(req); setRightBuildNum(req); setHasLegend(req); setTitle(req); setStyle(req); setUseDescr(req); generatePlot(false); ChartRenderingInfo info = new ChartRenderingInfo(); plot.createBufferedImage(getWidth(), getHeight(), info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap(getCsvFileName(), info)); }
Source:
public boolean equals(Object other, boolean deepCompare) { if (other == this) { return true; } if (other == null || other.getClass() != getClass()) { return false; } boolean result = true; SystemTreeItemModel otherModel = (SystemTreeItemModel) other; if (getChildren().size() > 0 && deepCompare) { if (otherModel.getChildren().size() == getChildren().size()) { for (int i = 0; i < getChildren().size(); i++) { result = getChildren().get(i).equals(otherModel.getChildren().get(i), deepCompare); if (!result) { break; } } } else { result = false; } } if (result) { if ((otherModel.getEntity() == null && getEntity() == null) || (otherModel.getEntity() != null && otherModel.getEntity().equals(getEntity()) && otherModel.getTitle().equals(getTitle()))) { result = true; } else { result = false; } } return result; }

Target:
public boolean equals(Object other, boolean deepCompare) { if (other == this) { return true; } if (other == null || other.getClass() != getClass()) { return false; } boolean result = true; SystemTreeItemModel otherModel = (SystemTreeItemModel) other; if (getChildren().size() > 0 && deepCompare) { if (otherModel.getChildren().size() == getChildren().size()) { for (int i = 0; i < getChildren().size(); i++) { result = getChildren().get(i).equals(otherModel.getChildren().get(i), deepCompare); if (!result) { break; } } } else { result = false; } } if (result) { if (!((otherModel.getEntity() == null && getEntity() == null) || (otherModel.getEntity() != null && otherModel.getEntity().equals(getEntity()) && ((otherModel.getTitle() == null && getTitle() == null) || (otherModel.getTitle() != null && otherModel.getTitle().equals(getTitle())))))) { result = false; } } return result; }
Source:
public CatalogDatabase getDatabase(String databaseName) throws DatabaseNotExistException, CatalogException { Database hiveDatabase = getHiveDatabase(databaseName); Map<String, String> properties = hiveDatabase.getParameters(); boolean isGeneric = getObjectIsGeneric(properties); if (!isGeneric) { properties.put(SqlCreateHiveDatabase.DATABASE_LOCATION_URI, hiveDatabase.getLocationUri()); } return new CatalogDatabaseImpl(properties, hiveDatabase.getDescription()); }

Target:
public CatalogDatabase getDatabase(String databaseName) throws DatabaseNotExistException, CatalogException { Database hiveDatabase = getHiveDatabase(databaseName); Map<String, String> properties = hiveDatabase.getParameters(); boolean isGeneric = isGenericForGet(properties); if (!isGeneric) { properties.put(SqlCreateHiveDatabase.DATABASE_LOCATION_URI, hiveDatabase.getLocationUri()); } return new CatalogDatabaseImpl(properties, hiveDatabase.getDescription()); }
Source:
public ListenableFuture getCloseFuture() { if (mReleaseFuture == null) { synchronized (mReleaseLock) { mReleaseFuture = CallbackToFutureAdapter.getFuture( new CallbackToFutureAdapter.Resolver<Void>() { @Override public Object attachCompleter(@NonNull CallbackToFutureAdapter.Completer<Void> completer) { Preconditions.checkState(Thread.holdsLock(mReleaseLock)); Preconditions.checkState(mReleaseCompleter == null, "Release completer expected to be null"); mReleaseCompleter = completer; return "Release[imageProxy=" + FakeImageProxy.this + "]"; } }); return mReleaseFuture; } } else { return Futures.immediateFuture(null); } }

Target:
public ListenableFuture getCloseFuture() { synchronized (mReleaseLock) { if (mReleaseFuture == null) { mReleaseFuture = CallbackToFutureAdapter.getFuture( new CallbackToFutureAdapter.Resolver<Void>() { @Override public Object attachCompleter(@NonNull CallbackToFutureAdapter.Completer<Void> completer) { Preconditions.checkState(Thread.holdsLock(mReleaseLock)); Preconditions.checkState(mReleaseCompleter == null, "Release completer expected to be null"); mReleaseCompleter = completer; return "Release[imageProxy=" + FakeImageProxy.this + "]"; } }); } return mReleaseFuture; } }