auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void init() { bigDoors = (BigDoors) Bukkit.getPluginManager().getPlugin("BigDoors"); commander = bigDoors.getCommander(); ObjectFetcher.registerWithObjectFetcher(BigDoorsDoorTag.class); <START> TagManager.registerTagHandler(new TagRunnable.RootForm() { <END> @Override public void run(ReplaceableTagEvent event) { bigdoorTagEvent(event); } }, "bigdoor"); PropertyParser.registerProperty(BigDoorsWorldProperties.class, WorldTag.class); PropertyParser.registerProperty(BigDoorsPlayerProperties.class, PlayerTag.class); ScriptEvent.registerScriptEvent(new BigDoorsDoorTogglesScriptEvent()); }</code><technical_language>Please modern tagbase registration format, this legacy format</technical_language>

Target:
public void init() { bigDoors = (BigDoors) Bukkit.getPluginManager().getPlugin("BigDoors"); commander = bigDoors.getCommander(); ObjectFetcher.registerWithObjectFetcher(BigDoorsDoorTag.class, BigDoorsDoorTag.tagProcessor); PropertyParser.registerProperty(BigDoorsWorldProperties.class, WorldTag.class); PropertyParser.registerProperty(BigDoorsPlayerProperties.class, PlayerTag.class); ScriptEvent.registerScriptEvent(new BigDoorsDoorTogglesScriptEvent()); TagManager.registerTagHandler("bigdoor", (attribute) -> { if (!attribute.hasContext(1)) { attribute.echoError("Big Doors door tag base must have input."); return null; } return BigDoorsDoorTag.valueOf(attribute.getContext(1), attribute.context); }); }
Source:
<code>public CPPLanguageServer() { List<String> commands = new ArrayList<>(); <START> File defaultLSLocation = getDefaultLSLocation(store.getString(PreferenceConstants.P_SERVER_CHOICE)); <END> store.setDefault(PreferenceConstants.P_SERVER_PATH, defaultLSLocation.getAbsolutePath()); File languageServerLocation = getLanguageServerLocation(); String parent = ""; String flags = store.getString(PreferenceConstants.P_SERVER_OPTIONS); if (languageServerLocation != null) { commands.add(languageServerLocation.getAbsolutePath()); if (!flags.isEmpty()) { commands.add(flags); } parent = languageServerLocation.getParent(); } setWorkingDirectory(parent); setCommands(commands); }</code><technical_language>Another issue I noticed while this out: getDefaultLSLocation() return null (e.g. if chosen language server is in PATH), in case next line throw a NullPointerException. need add a check here</technical_language>

Target:
public CPPLanguageServer() { List<String> commands = new ArrayList<>(); File defaultLSLocation = getDefaultLSLocation(store.getString(PreferenceConstants.P_SERVER_CHOICE)); if(defaultLSLocation != null) { store.setDefault(PreferenceConstants.P_SERVER_PATH, defaultLSLocation.getAbsolutePath()); } File languageServerLocation = getLanguageServerLocation(); String parent = ""; String flags = store.getString(PreferenceConstants.P_SERVER_OPTIONS); if (languageServerLocation != null) { commands.add(languageServerLocation.getAbsolutePath()); if (!flags.isEmpty()) { commands.add(flags); } parent = languageServerLocation.getParent(); } setWorkingDirectory(parent); setCommands(commands); }
Source:
<code>private KijiTableKeyValueStore(Builder builder) { <START> mTableName = builder.mTableName; <END> mColumn = builder.mColumn; mMinTs = builder.mMinTs; mMaxTs = builder.mMaxTs; mMaxObjectsToCache = builder.mMaxObjectsToCache; mReaderSchema = builder.mReaderSchema; mConf = builder.mConf; }</code><technical_language>check if Kiji table exists this point, users wait a job launches discover a non-existent table</technical_language>

Target:
private KijiTableKeyValueStore(Builder builder) { mTableUri = builder.mTableUri; mColumn = builder.mColumn; mMinTs = builder.mMinTs; mMaxTs = builder.mMaxTs; mMaxObjectsToCache = builder.mMaxObjectsToCache; mReaderSchema = builder.mReaderSchema; mConf = builder.mConf; }
Source:
<code>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(); <START> functionBlock = null; <END> } return functionBlock; }</code><technical_language>I this catch. this do is NullPointerExceptions line, catch all</technical_language>

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:
<code>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 { <START> IOUtils.closeQuietly(input); <END> } return contentType; }</code><technical_language>If try-with-resources, need IOUtils all: try(ByteArrayInputStream input = new ByteArrayInputStream(data)) { ... }</technical_language>

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:
<code>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()); <START> } catch (final TransportException err) { <END> 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); } }</code><technical_language>Style-nit: Remove added final keyword</technical_language>

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:
<code><START> public static Map<String, Object> cohortMemberParameters(String cohortQueryUuid, CohortQueryReportMember member) { <END> 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; }</code><technical_language>I send this event in task action logic Additionally string constants added task package class</technical_language>

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:
<code>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 { <START> in = new ObjectInputStream(new FileInputStream(keyFile)); <END> 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; }</code><technical_language>do nee line 390</technical_language>

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:
<code>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)) { <START> break; <END> } } 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); }</code><technical_language>CRS.equalsIgnoreMetadata instead</technical_language>

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:
<code>public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); <START> output.writeInt(topologyId); <END> output.writeLong(Flag.copyWithoutRemotableFlags(getFlagsBitSet())); }</code><technical_language>topologyId is written/read in ReplicableCommandExternalizer. need write/read again</technical_language>

Target:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); output.writeLong(Flag.copyWithoutRemotableFlags(getFlagsBitSet())); }
Source:
<code>public static long hashCode(@SqlType(StandardTypes.IPADDRESS) Slice value) { <START> return xxHash64(value); <END> }</code><technical_language>nit: I point a delegation call xxHash64. a simple function, inline return XxHash64.hash(value). Thoughts? @haozhun</technical_language>

Target:
public static long hashCode(@SqlType(StandardTypes.IPADDRESS) Slice value) { return XxHash64.hash(value); }
Source:
<code>private static LoadedKey loadKeyFile(File file) { if (!file.canRead()) { <START> throw new SignatureException("Unknown signing key id"); <END> } 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"); }</code><technical_language>Nit: uppercase ID in user messages</technical_language>

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:
<code>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) { <START> log.info("WaitTimeoutExpiredException occured when handling Certificate dialog."); <END> } }</code><technical_language>Do want log this happens? This exception happen for example shell is closed pressing "Yes" button. In case test fail, able continue correctly (the shell remained open)</technical_language>

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:
<code>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); <START> if (!matcher.find()) { <END> return false; } String check = matcher.group(1); if (this.configs.containsKey(check)) { return false; } this.adConfigs.put(name, config); this.setReinit(true); return true; }</code><technical_language>love debug output too, in case happen</technical_language>

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:
<code>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()); } } } <START> log.info("Attempted to retire "+retirees+" of " + dfjqList.size()); <END> }</code><technical_language>spaces missing, ...retire " + retirees + "</technical_language>

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:
<code>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); } <START> return Pair.of(Chain.CONTINUE(), false); <END> }</code><technical_language>allocations, please. i move call context.recordTraversedRule here: if (condition.matches(pktCtx)) { context.recordMatchedRule(id) .... } else { context.recordUnmatchedRule(id) }</technical_language>

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:
<code>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()) <START> errorsPerPartition.put(new TopicPartition(topic.name(), partitionIdx), error); <END> } errors.put(markerEntry.producerId(), errorsPerPartition); } return new WriteTxnMarkersResponse(errors); }</code><technical_language>fix indentation</technical_language>

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:
<code>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]; <START> if (!batchId.equals("-all") && batchId.startsWith("-")) { <END> 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); }</code><technical_language>In instances, string LHS of equation</technical_language>

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:
<code>protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GuiGraphics.drawGuiBackGround(mc, guiLeft, guiTop, right, bottom, zLevel, true); <START> GL11.glTranslated(guiLeft, guiTop, 0); <END> 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); } } }</code><technical_language>Please GL11 methods here, put "guiLeft + 17" instead of 17 below, on..</technical_language>

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:
<code>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()) { <START> parsedRecords++; <END> 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); } }</code><technical_language>if output is connected, parsedRecords zero? for validRecords. incremented if is exception.. parsedRecords validRecords same</technical_language>

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:
<code>public void request(@NonNull Context context, int age, final FeedCoordinator.FeedClientCallback cb) { <START> cb.success(this, new IntegerListCard()); <END> }</code><technical_language>This is a nice test! safe for clients cache return results immediately</technical_language>

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

Target:
protected boolean canDoAction() { initializeObjectState(); return diskExists() && diskIsNotTemplateDisk() && diskIsNotFromTemplateNotOnTargetDomain() && vmIsDown() && sourceDomainExists() && sourceDomainIsUp() && sourceDomainIsValidSource() && sourceAndTargetAreDifferent() && targetDomainExists() && targetDomainIsUp() && targetDomainHasSpace() && targetDomainIsValidTarget(); }
Source:
<code>private void deleteExcessEntitlements(List<Pool> existingPools) { boolean lifo = !config .getBoolean(ConfigProperties.REVOKE_ENTITLEMENT_IN_FIFO_ORDER); <START> if (existingPools != null && !existingPools.isEmpty()) { <END> 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); } } }</code><technical_language>nesting basically entire method in a negated condition, if (existingPools == null || existingPools.isEmpty()) { return; } // Actual logic</technical_language>

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:
<code>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())) { <START> tokenItems.add(tokenCacheItem); <END> } } return tokenItems; }</code><technical_language>if token extended expiresOn, expired(expiresOn), return it</technical_language>

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:
<code>public void temporalOrderingIsPreservedForBatchedStartTransactionRequests() { UUID requestor = UUID.randomUUID(); <START> List<Long> allTimestams = new ArrayList<>(); <END> allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 1)); allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 4)); allTimestams.addAll(getSortedBatchedStartTimestamps(requestor, 20)); assertThat(allTimestams).isSorted(); }</code><technical_language>allTimestams -> allTimestamps</technical_language>

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:
<code><START> public boolean equals(Object obj) { <END> if (obj != null && obj instanceof ParameterizedFrameworkMethod) { return super.equals(obj) && m_paramsIndex == ((ParameterizedFrameworkMethod) obj).m_paramsIndex; } return false; }</code><technical_language>equals & hashCode generated in eclipse</technical_language>

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:
<code>public void testCreateTokenAt() { <START> GenericEventMessage.clock = Clock.fixed(Instant.parse("2007-12-03T10:15:00.01Z"), Clock.systemUTC().getZone()); <END> 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); }</code><technical_language>Clocks set, reset normal time test..</technical_language>

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:
<code>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.", <START> expected[i].offset, fileName.length()); <END> assertEquals("Length of file path StyleRange at index is incorrect.", expected[i].length, 3 + project.getName().length() + fileParentPath.length()); }</code><technical_language>mistake in recommendation, fileName.length, actual[i].offset. switch next assert</technical_language>

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:
<code>public void all_composed_assertions_should_pass() { SoftAssertions delegate = new SoftAssertions(); delegate.assertThat(1).isEqualTo(1); delegate.assertAll(); softly.assertThat(1).isEqualTo(1); <START> softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 2); <END> softly.assertAlso(delegate); softly.assertAll(); assertThat(softly.wasSuccess()).isTrue(); }</code><technical_language>Minor: AssertJ org.assertj.core.util.List.list static import for readability</technical_language>

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:
<code>public void tearDown() throws Exception { admin1.removeReplicationPeer(PEER_ID); Thread.sleep(SLEEP_TIME); <START> Thread.sleep(SLEEP_TIME); <END> admin1.disableTable(NORMAL_TABLE); admin1.deleteTable(NORMAL_TABLE); admin2.disableTable(NORMAL_TABLE); admin2.deleteTable(NORMAL_TABLE); }</code><technical_language>sleeps intentional? If so, SLEEP_TIME * 2</technical_language>

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:
<code>private boolean isEligibleForShuffle(SingularityTaskId task) { return ( isLongRunning(task) && !configuration.getDoNotShuffleRequests().contains(task.getRequestId()) <START> && (TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - task.getStartedAt()) > configuration.getMinutesBeforeNewTaskEligibleForShuffle()) <END> ); }</code><technical_language>I if task running timestamp instead? out delay caused mesos/singularity</technical_language>

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:
<code>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); <START> } <END> if (mHasCategory) { sCurrentUploadingPostAnalyticsProperties.put("with_categories", true); } if (!mPost.getTagNameList().isEmpty()) { sCurrentUploadingPostAnalyticsProperties.put("with_tags", true); } } }</code><technical_language>ditching this var here, if need it? remove in this PR, wdyt</technical_language>

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:
<code>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); <START> if (seriesRequest.getFeatures().hasFeature(Feature.METADATA_LIVE_CURSOR)) { <END> 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); } }); }</code><technical_language>this !seriesRequest.getFeatures().hasFeature(Feature.METADATA_LIVE_CURSOR) ? this scroll feature METADATA_LIVE_CURSOR is enabled</technical_language>

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:
<code>public LoadTestDataSimpleResponseMessageType deleteAddress(DeleteAddressRequestMessageType request) { Address record = new Address(request.getAddress(), loadTestDataService.getPatientBy(request.getAddress().getPatientId())); <START> if (null == record) { <END> return buildSimpleResponse(Boolean.FALSE, ACT_FAIL); } loadTestDataService.deleteAddress(record); return buildSimpleResponse(Boolean.TRUE, ACT_SUCCESSFUL); }</code><technical_language>null checks for? null - creating object in lines above</technical_language>

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); }