auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CheckpointManager(String ownerId, PartitionContext partitionContext, PartitionManager partitionManager, <START> String eTag) { <END> this.ownerId = ownerId; this.partitionContext = partitionContext; this.partitionManager = partitionManager; this.eTag = new AtomicReference<>(eTag); }</code><technical_language>this constructed publicly, add some error checking</technical_language>

Target:
public CheckpointManager(String ownerId, PartitionContext partitionContext, PartitionManager partitionManager, String eTag) { this.ownerId = Objects.requireNonNull(ownerId, "ownerId cannot be null"); this.partitionContext = Objects.requireNonNull(partitionContext, "partitionContext cannot be null"); this.partitionManager = Objects.requireNonNull(partitionManager, "partitionManager cannot be null"); this.eTag = new AtomicReference<>(eTag); }
Source:
<code>private DeribitAuthentication authOverClientSignature(String clientId, String clientSecret) throws DeribitException, IOException { if (clientId == null || clientId.isEmpty()) { <START> throw new ExchangeException("API key must not be empty."); <END> } if (clientSecret == null || clientSecret.isEmpty()) { throw new ExchangeException("API secret must not be empty."); } Mac mac; try { mac = Mac.getInstance(BaseParamsDigest.HMAC_SHA_256); final SecretKey secretKey = new SecretKeySpec(clientSecret.getBytes("UTF-8"), BaseParamsDigest.HMAC_SHA_256); mac.init(secretKey); } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new ExchangeException("Invalid API secret", e); } String timestamp = "" + System.currentTimeMillis(); String nonce = timestamp; String data = ""; String toSign = timestamp + "\n" + nonce + "\n" + data; String signature = DigestUtils.bytesToHex(mac.doFinal(toSign.getBytes("UTF-8"))).toLowerCase(); return deribit .auth( GrantType.client_signature, null, null, clientId, null, null, timestamp, signature, nonce, null, null) .getResult(); }</code><technical_language>ExchangeSecurityException in this method</technical_language>

Target:
private DeribitAuthentication authOverClientSignature(String clientId, String clientSecret) throws DeribitException, IOException { if (clientId == null || clientId.isEmpty()) { throw new ExchangeSecurityException("API key must not be empty."); } if (clientSecret == null || clientSecret.isEmpty()) { throw new ExchangeException("API secret must not be empty."); } Mac mac; try { mac = Mac.getInstance(BaseParamsDigest.HMAC_SHA_256); final SecretKey secretKey = new SecretKeySpec(clientSecret.getBytes("UTF-8"), BaseParamsDigest.HMAC_SHA_256); mac.init(secretKey); } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new ExchangeException("Invalid API secret", e); } String timestamp = "" + System.currentTimeMillis(); String nonce = timestamp; String data = ""; String toSign = timestamp + "\n" + nonce + "\n" + data; String signature = DigestUtils.bytesToHex(mac.doFinal(toSign.getBytes("UTF-8"))).toLowerCase(); return deribit .auth( GrantType.client_signature, null, null, clientId, null, null, timestamp, signature, nonce, null, null) .getResult(); }
Source:
<code>public Response send(final Request req, final String home, final String method, final Collection<Map.Entry<String, String>> headers, final byte[] content) throws IOException { final Response resp = this.origin .send(req, home, method, headers, content); final int remaining = Integer.parseInt( resp.headers().get("X-RateLimit-Remaining").get(0) ); if (remaining < this.threshold) { final long reset = Long.parseLong( resp.headers().get("X-RateLimit-Reset").get(0) ); final long now = System.currentTimeMillis() / 1000L; if (reset > now) { final long length = reset - now; Logger.info( this, "Remaining number of requests per hour is less than %d. Waiting for %d seconds.", this.threshold, length ); try { <START> Thread.sleep(length * 1000L); <END> } catch (final InterruptedException ex) { throw new IOException(ex); } } } return resp; }</code><technical_language>TimeUnit.SECONDS.sleep(length) nicer</technical_language>

Target:
public Response send(final Request req, final String home, final String method, final Collection<Map.Entry<String, String>> headers, final byte[] content) throws IOException { final Response resp = this.origin .send(req, home, method, headers, content); final int remaining = Integer.parseInt( resp.headers().get("X-RateLimit-Remaining").get(0) ); if (remaining < this.threshold) { final long reset = Long.parseLong( resp.headers().get("X-RateLimit-Reset").get(0) ); final long now = TimeUnit.MILLISECONDS .toSeconds(System.currentTimeMillis()); if (reset > now) { final long length = reset - now; Logger.info( this, "Remaining number of requests per hour is less than %d. Waiting for %d seconds.", this.threshold, length ); try { TimeUnit.SECONDS.sleep(length); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); throw new IllegalStateException(ex); } } } return resp; }
Source:
<code>public void accept(PubSubMessage pubSubMessage, Context context) { OcrTranslateApiMessage ocrMessage = OcrTranslateApiMessage.fromPubsubData( pubSubMessage.getData().getBytes()); String targetLang = ocrMessage.getLang(); LOGGER.info("Translating text into " + targetLang); String text = ocrMessage.getText(); TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(LOCATION_NAME.toString()) .setMimeType("text/plain") .setTargetLanguageCode(targetLang) .addContents(text) .build(); TranslateTextResponse response; try (TranslationServiceClient client = TranslationServiceClient.create()) { response = client.translateText(request); } catch (IOException e) { throw new RuntimeException(e); } if (response == null || response.getTranslationsCount() == 0) { return; } String translatedText = response.getTranslations(0).getTranslatedText(); LOGGER.info("Translated text: " + translatedText); String filename = ocrMessage.getFilename(); OcrTranslateApiMessage translateMessage = new OcrTranslateApiMessage( translatedText, filename, targetLang); try { ByteString byteStr = ByteString.copyFrom(translateMessage.toPubsubData()); PubsubMessage pubsubApiMessage = PubsubMessage.newBuilder().setData(byteStr).build(); publisher.publish(pubsubApiMessage).get(); LOGGER.info("Text translated to " + targetLang); <START> } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } <END> }</code><technical_language>Why</technical_language>

Target:
public void accept(PubSubMessage pubSubMessage, Context context) { OcrTranslateApiMessage ocrMessage = OcrTranslateApiMessage.fromPubsubData( pubSubMessage.getData().getBytes(StandardCharsets.UTF_8)); String targetLang = ocrMessage.getLang(); LOGGER.info("Translating text into " + targetLang); String text = ocrMessage.getText(); TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(LOCATION_NAME.toString()) .setMimeType("text/plain") .setTargetLanguageCode(targetLang) .addContents(text) .build(); TranslateTextResponse response; try (TranslationServiceClient client = TranslationServiceClient.create()) { response = client.translateText(request); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error translating text: " + e.getMessage(), e); return; } if (response.getTranslationsCount() == 0) { return; } String translatedText = response.getTranslations(0).getTranslatedText(); LOGGER.info("Translated text: " + translatedText); String filename = ocrMessage.getFilename(); OcrTranslateApiMessage translateMessage = new OcrTranslateApiMessage( translatedText, filename, targetLang); try { ByteString byteStr = ByteString.copyFrom(translateMessage.toPubsubData()); PubsubMessage pubsubApiMessage = PubsubMessage.newBuilder().setData(byteStr).build(); publisher.publish(pubsubApiMessage).get(); LOGGER.info("Text translated to " + targetLang); } catch (InterruptedException | ExecutionException e) { LOGGER.log(Level.SEVERE, "Error publishing translation save request: " + e.getMessage(), e); } }
Source:
<code>public String handledTypeMismatchException() { try { throw new TypeMismatchException("Test", String.class); } catch (TypeMismatchException ex) { bugsnag.notify(ex); } <START> return "The exception was handled"; <END> }</code><technical_language>returns anywhere? If not, method void. Applies throughout</technical_language>

Target:
public void handledTypeMismatchException() { try { throw new TypeMismatchException("Test", String.class); } catch (TypeMismatchException ex) { bugsnag.notify(ex); } }
Source:
<code>public void clean(String name, byte[] pattern) { Assert.notNull(name, "Name must not be null!"); Assert.notNull(pattern, "Pattern must not be null!"); execute(name, connection -> { boolean wasLocked = false; try { if (isLockingCacheWriter()) { doLock(name, connection); wasLocked = true; } List<byte[]> keys = new ArrayList<byte[]>(); Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(new String(pattern)).build()); while (cursor.hasNext()) { byte[] bytes = cursor.next(); keys.add(bytes); } if (!keys.isEmpty()) { <START> connection.del(keys.toArray(new byte[][]{})); <END> } } finally { if (wasLocked && isLockingCacheWriter()) { doUnlock(name, connection); } } return "OK"; }); }</code><technical_language>complexity of DEL is O(N), if number of keys is huge, DEL command time out well, right? do batch batch well? I thinking of [UNLINK](<LINK_0>, supported in higher Redis version a change of behavior (from sync async)..</technical_language>

Target:
public void clean(String name, byte[] pattern) { Assert.notNull(name, "Name must not be null!"); Assert.notNull(pattern, "Pattern must not be null!"); execute(name, connection -> { boolean wasLocked = false; try { if (isLockingCacheWriter()) { doLock(name, connection); wasLocked = true; } Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(new String(pattern)).build()); while (cursor.hasNext()) { connection.del(cursor.next()); } } finally { if (wasLocked && isLockingCacheWriter()) { doUnlock(name, connection); } } return "OK"; }); }
Source:
<code>public static void main(String[] args) { System.out.println(" +----------------------------------------------+"); System.out.println(" | XBee Java Library Get/Set Remote DIO Sample |"); System.out.println(" +----------------------------------------------+\n"); XBeeDevice localDevice = new XBeeDevice(PORT, BAUD_RATE); <START> Timer readADCTimer = new Timer(); <END> try { localDevice.open(); RemoteXBeeDevice remoteDevice = new RemoteXBeeDevice(localDevice, REMOTE_64_BIT_ADDRESS); remoteDevice.setIOConfiguration(IOLINE_IN, IOMode.DIGITAL_IN); localDevice.setIOConfiguration(IOLINE_OUT, IOMode.DIGITAL_OUT_LOW); readADCTimer.schedule(new UpdateOutputTask(localDevice, remoteDevice), 0, READ_TIMEOUT); } catch (XBeeException e) { e.printStackTrace(); localDevice.close(); System.exit(1); } }</code><technical_language>rename this variable **readDIOTimer**</technical_language>

Target:
public static void main(String[] args) { System.out.println(" +----------------------------------------------+"); System.out.println(" | XBee Java Library Get/Set Remote DIO Sample |"); System.out.println(" +----------------------------------------------+\n"); XBeeDevice localDevice = new XBeeDevice(PORT, BAUD_RATE); Timer readDIOTimer = new Timer(); try { localDevice.open(); RemoteXBeeDevice remoteDevice = new RemoteXBeeDevice(localDevice, REMOTE_64_BIT_ADDRESS); remoteDevice.setIOConfiguration(IOLINE_IN, IOMode.DIGITAL_IN); localDevice.setIOConfiguration(IOLINE_OUT, IOMode.DIGITAL_OUT_LOW); readDIOTimer.schedule(new UpdateOutputTask(localDevice, remoteDevice), 0, READ_TIMEOUT); } catch (XBeeException e) { e.printStackTrace(); localDevice.close(); System.exit(1); } }
Source:
<code>private void deleteNode2RpcAddressFromNode1() throws Exception { InetSocketAddress firstHost = ccm().addressOfNode(1); Cluster cluster = register( Cluster.builder() .addContactPoints(firstHost.getAddress()) .withPort(ccm().getBinaryPort()) .withLoadBalancingPolicy( new WhiteListPolicy( Policies.defaultLoadBalancingPolicy(), Lists.newArrayList(firstHost))) .build()); Session session = cluster.connect(); String deleteStmt; if (ccm().getCassandraVersion().nextStable().compareTo(VersionNumber.parse("4.0")) < 0) { <START> deleteStmt = <END> String.format( "DELETE rpc_address FROM system.peers WHERE peer = '%s'", ccm().addressOfNode(2).getHostName()); } else { deleteStmt = String.format( "DELETE native_address, native_port FROM system.peers_v2 WHERE peer = '%s' and peer_port = %d", ccm().addressOfNode(2).getHostName(), ccm().getStoragePort()); } session.execute(deleteStmt); session.close(); cluster.close(); }</code><technical_language>instead delete system.peers, additionally, delete system.peers_v2 if this table exists</technical_language>

Target:
private void deleteNode2RpcAddressFromNode1() throws Exception { InetSocketAddress firstHost = ccm().addressOfNode(1); Cluster cluster = register( Cluster.builder() .addContactPoints(firstHost.getAddress()) .withPort(ccm().getBinaryPort()) .withLoadBalancingPolicy( new WhiteListPolicy( Policies.defaultLoadBalancingPolicy(), Lists.newArrayList(firstHost))) .build()); Session session = cluster.connect(); String deleteStmt = String.format( "DELETE rpc_address FROM system.peers WHERE peer = '%s'", ccm().addressOfNode(2).getHostName()); session.execute(deleteStmt); if (ccm().getCassandraVersion().nextStable().compareTo(VersionNumber.parse("4.0")) >= 0) { deleteStmt = String.format( "DELETE native_address, native_port FROM system.peers_v2 WHERE peer = '%s' and peer_port = %d", ccm().addressOfNode(2).getHostName(), ccm().getStoragePort()); session.execute(deleteStmt); } session.close(); cluster.close(); }
Source:
<code>private void mergeCategories(Installation entity) { if (entity.getCategories() != null) { if(!entity.getCategories().isEmpty()) { final List<String> categoryNames = convertToNames(entity.getCategories()); final List<Category> categories = categoryDao.findByNames(categoryNames); entity.getCategories().removeAll(categories); entity.getCategories().addAll(categories); } else { <START> entity.getCategories().clear(); <END> } } }</code><technical_language>is actaully needed</technical_language>

Target:
private void mergeCategories(Installation entity) { if (entity.getCategories() != null) { final List<String> categoryNames = convertToNames(entity.getCategories()); final List<Category> categories = categoryDao.findByNames(categoryNames); entity.getCategories().removeAll(categories); entity.getCategories().addAll(categories); } }
Source:
<code>private @Nullable HostThread getCurrentHostThread(ITmfEvent event, long ts) { String hostId = event.getTrace().getHostId(); LttngKernelAnalysis module = TmfExperimentUtils.getAnalysisModuleOfClassForHost(getTrace(), hostId, LttngKernelAnalysis.class); if (module == null) { return null; } Integer cpu = null; Iterable<TmfCpuAspect> aspects = TmfTraceUtils.getEventAspectsOfClass(event.getTrace(), TmfCpuAspect.class); for (TmfCpuAspect aspect : aspects) { if (!aspect.resolve(event).equals(TmfCpuAspect.CPU_UNAVAILABLE)) { cpu = aspect.resolve(event); break; } } if (cpu == null) { return null; } int currentTid = module.getThreadOnCpu(cpu, ts); if (currentTid == LttngKernelAnalysis.NO_TID) { return null; } <START> HostThread ht = new HostThread(hostId, currentTid); <END> return ht; }</code><technical_language>inline</technical_language>

Target:
private @Nullable HostThread getCurrentHostThread(ITmfEvent event, long ts) { String hostId = event.getTrace().getHostId(); LttngKernelAnalysis module = TmfExperimentUtils.getAnalysisModuleOfClassForHost(getTrace(), hostId, LttngKernelAnalysis.class); if (module == null) { return null; } Integer cpu = null; Iterable<TmfCpuAspect> aspects = TmfTraceUtils.getEventAspectsOfClass(event.getTrace(), TmfCpuAspect.class); for (TmfCpuAspect aspect : aspects) { if (!aspect.resolve(event).equals(TmfCpuAspect.CPU_UNAVAILABLE)) { cpu = aspect.resolve(event); break; } } if (cpu == null) { return null; } Integer currentTid = LttngKernelThreadInformationProvider.getThreadOnCpu(module, cpu, ts); if (currentTid == null) { return null; } return new HostThread(hostId, currentTid); }
Source:
<code>private void setLeaderMigrationState(MigratePartitionLeaderMessage message) { if (message.isStatusReset()) { m_leaderMigrationState.set(LeaderMigrationState.TXN_DRAINED); m_newLeaderHSID = Long.MIN_VALUE; return; } if (m_leaderMigrationState.get() == LeaderMigrationState.NONE) { m_leaderMigrationState.compareAndSet(LeaderMigrationState.NONE ,LeaderMigrationState.TXN_DRAINED); <START> } else if (m_leaderMigrationState.get() == LeaderMigrationState.TXN_RESTART) { <END> m_leaderMigrationState.compareAndSet(LeaderMigrationState.TXN_RESTART ,LeaderMigrationState.NONE); } tmLog.info("MigratePartitionLeader new leader " + CoreUtils.hsIdToString(m_hsId) + " is notified by previous leader " + CoreUtils.hsIdToString(message.getPriorLeaderHSID()) + ". status:" + m_leaderMigrationState); }</code><technical_language>migration state changed 2 tests: is ok</technical_language>

Target:
private void setLeaderMigrationState(MigratePartitionLeaderMessage message) { if (message.isStatusReset()) { m_leaderMigrationState.set(LeaderMigrationState.TXN_DRAINED); m_newLeaderHSID.set(Long.MIN_VALUE); return; } if (m_leaderMigrationState.get() == LeaderMigrationState.NONE) { m_leaderMigrationState.compareAndSet(LeaderMigrationState.NONE ,LeaderMigrationState.TXN_DRAINED); } else if (m_leaderMigrationState.get() == LeaderMigrationState.TXN_RESTART) { m_leaderMigrationState.compareAndSet(LeaderMigrationState.TXN_RESTART ,LeaderMigrationState.NONE); } tmLog.info("MigratePartitionLeader new leader " + CoreUtils.hsIdToString(m_hsId) + " is notified by previous leader " + CoreUtils.hsIdToString(message.getPriorLeaderHSID()) + ". status:" + m_leaderMigrationState); }
Source:
<code>public boolean process() { checkState(!finished); finished = prerequisite.process(); if (!finished) { return false; } <START> result = transform.apply(prerequisite.getResult()); <END> return true; }</code><technical_language>read if rename transform transformation</technical_language>

Target:
public boolean process() { checkState(!finished); finished = work.process(); if (!finished) { return false; } result = transformation.apply(work.getResult()); return true; }
Source:
<code>public void parse(String location, IScriptLocation entry) { final IRepositoryService repositoryService = PlatformUI.getWorkbench().getService(IRepositoryService.class); final Map<String, String> scripts = fetchRemoteScripts(location, entry.isRecursive()); final Iterator<Map.Entry<String, String>> iterator = scripts.entrySet().iterator(); <START> while (iterator.hasNext()) { <END> final Map.Entry<String, String> script = iterator.next(); final String scriptUrl = getRawContentUrl(location, script.getValue()); repositoryService.updateLocation(entry, scriptUrl, new Date().getTime()); } }</code><technical_language>foreach loop nicer here, do need explicit iterator. I guess operate a map do want store commit hashes, do long timestamp field get changed</technical_language>

Target:
public void parse(String location, IScriptLocation entry) { final IRepositoryService repositoryService = PlatformUI.getWorkbench().getService(IRepositoryService.class); final Map<String, String> scripts = fetchRemoteScripts(location, entry.isRecursive()); for (final Map.Entry<String, String> script : scripts.entrySet()) { final String scriptUrl = getRawContentUrl(location, script.getValue()).replaceAll(" ", "%20"); repositoryService.updateLocation(entry, scriptUrl, new Date().getTime()); } }
Source:
<code>public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { <START> if (request.getRequestURI().equals("/favicon.ico")) { <END> String faviconPath = brandingManager.getBrandedFaviconPath(); if (faviconPath == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else { ServletUtils.sendFile(request, response, getFile(brandingManager.getBrandingRootPath(), faviconPath), null); } } else { ServletUtils.sendFile(request, response, getFile(brandingManager.getBrandingRootPath(), request.getPathInfo()), null); } }</code><technical_language>this is bad magic. please do relay file names, paths files. a proper entry in branding.properties point icon. thanks</technical_language>

Target:
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { ServletUtils.sendFile(request, response, BrandingUtils.getFile(brandingManager.getBrandingRootPath(), request.getPathInfo()), null); }
Source:
<code>public void testTokens() throws Exception { String partitionPath = "666"; InputStream input = this.getClass().getClassLoader().getResourceAsStream(tokenFileName); if (input == null) { throw new IllegalStateException("Could not find resource: " + tokenFileName); } byte[] tokenBytes = new byte[2000]; int tokensLength = input.read(tokenBytes, 0, 2000); tokenBytes = Arrays.copyOf(tokenBytes, tokensLength); InputStream tokenStream = new ByteArrayInputStream(tokenBytes); azureDest.persistTokens(partitionPath, tokenFileName, tokenStream); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(tokensLength); assertTrue("Retrieve tokens returned false", azureDest.retrieveTokens(partitionPath, tokenFileName, outputStream)); assertTrue("Retrieved token did not match sent", Arrays.equals(outputStream.toByteArray(), tokenBytes)); outputStream.reset(); <START> assertFalse("Expected retrive to return false for nonexistent path", <END> azureDest.retrieveTokens("unknown-path", tokenFileName, outputStream)); }</code><technical_language>"retrieve"</technical_language>

Target:
public void testTokens() throws Exception { String partitionPath = "666"; InputStream input = this.getClass().getClassLoader().getResourceAsStream(tokenFileName); if (input == null) { throw new IllegalStateException("Could not find resource: " + tokenFileName); } byte[] tokenBytes = new byte[2000]; int tokensLength = input.read(tokenBytes, 0, 2000); tokenBytes = Arrays.copyOf(tokenBytes, tokensLength); InputStream tokenStream = new ByteArrayInputStream(tokenBytes); azureDest.persistTokens(partitionPath, tokenFileName, tokenStream); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(tokensLength); assertTrue("Retrieve tokens returned false", azureDest.retrieveTokens(partitionPath, tokenFileName, outputStream)); assertTrue("Retrieved token did not match sent", Arrays.equals(outputStream.toByteArray(), tokenBytes)); outputStream.reset(); assertFalse("Expected retrieve to return false for nonexistent path", azureDest.retrieveTokens("unknown-path", tokenFileName, outputStream)); }
Source:
<code>public int hashCode() { <START> return Objects.hash(getName(), getFieldName(), getEstimator(), isVariancePop); <END> }</code><technical_language>direct field accesses, match equals does</technical_language>

Target:
public int hashCode() { return Objects.hash(name, fieldName, estimator, isVariancePop); }
Source:
<code>public void run() { try { while (running.get()) { try { <START> if (paused.get()) { <END> synchronized (lock) { while (paused.get()) { try { lock.wait(); } catch (InterruptedException e) { logger.warn("InterruptedException thrown while hard delete is paused ", e); } } } } synchronized (lock) { if (!hardDelete()) { isCaughtUp = true; if (!running.get()) { break; } time.wait(lock, hardDeleterSleepTimeWhenCaughtUpMs); } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } lock.notify(); } } catch (StoreException e) { if (e.getErrorCode() != StoreErrorCodes.Store_Shutting_Down) { logger.error("Caught store exception: ", e); } else { logger.trace("Caught exception during hard deletes", e); } } catch (InterruptedException e) { logger.trace("Caught exception during hard deletes", e); } } } finally { close(); } }</code><technical_language>questions this logic. 1. this synchronized(lock) { while(paused) { // this a "while" "if" wait(); } // hard delete code } lock in a row? Code a bit more complicated be. 2. object (in essence condition) notify() requirement pause/unpause fact pause completed? I if is a correctness issue code confusing. a ReentrantLock Condition instances attached it</technical_language>

Target:
public void run() { try { while (enabled.get()) { hardDeleteLock.lock(); try { while (enabled.get() && isPaused()) { pauseCondition.await(); } if (enabled.get()) { if (!hardDelete()) { isCaughtUp = true; time.await(pauseCondition, HARD_DELETE_SLEEP_TIME_ON_CAUGHT_UP); } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } } } catch (StoreException e) { if (e.getErrorCode() != StoreErrorCodes.Store_Shutting_Down) { logger.error("Caught store exception: ", e); } else { logger.trace("Caught exception during hard deletes", e); } } catch (InterruptedException e) { logger.trace("Caught exception during hard deletes", e); } finally { hardDeleteLock.unlock(); } } } finally { close(); } }
Source:
<code>public Object deserialize(ByteBuf b, CorfuRuntime rt) { int classNameLength = b.readShort(); byte[] classNameBytes = new byte[classNameLength]; b.readBytes(classNameBytes, 0, classNameLength); String className = new String(classNameBytes); if (className.equals("null")) { return null; } <START> int jsonStringLen = b.readInt(); <END> String jsonString = b.readCharSequence(jsonStringLen, StandardCharsets.UTF_8).toString(); try { return JSON.parseObject(jsonString, Class.forName(className)); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } }</code><technical_language>numJsonBytes</technical_language>

Target:
public Object deserialize(ByteBuf b, CorfuRuntime rt) { int classNameLength = b.readShort(); byte[] classNameBytes = new byte[classNameLength]; b.readBytes(classNameBytes, 0, classNameLength); String className = new String(classNameBytes); if (className.equals("null")) { return null; } int numJsonBytes = b.readInt(); String jsonString = b.readCharSequence(numJsonBytes, StandardCharsets.UTF_8).toString(); try { return JSON.parseObject(jsonString, Class.forName(className)); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
Source:
<code><START> public GlowHorse(Location location) { <END> super(location, EntityType.HORSE); Random rand = new Random(); this.variant = Variant.HORSE; this.horseStyle = Style.values()[rand.nextInt(4)]; this.horseColor = Color.values()[rand.nextInt(6)]; }</code><technical_language>call other constructor</technical_language>

Target:
public GlowHorse(Location location) { this(location, null); }
Source:
<code>public Category getCategory() { <START> return Category.MODEL; <END> }</code><technical_language>thought "Case Management" more akin PROCESS MODEL</technical_language>

Target:
public Category getCategory() { return this.category; }
Source:
<code>public void shouldReturnNullForEmptyFilename() { S3FileMapper s3FileMapper = new S3FileMapper(mockFileBrowser, mockFileHelper); <START> S3File file = s3FileMapper.transform(null); <END> assertNull(file); }</code><technical_language>test is for empty filename I expecting this transform("")</technical_language>

Target:
public void shouldReturnNullForEmptyFilename() { S3FileMapper s3FileMapper = new S3FileMapper(mockFileBrowser, mockFileHelper); S3File file = s3FileMapper.transform(""); assertNull(file); }
Source:
<code>protected void populate(final int row, final DashboardInfo k) { if (k.isDefault()) { table.setWidget(row, 1, new Image(Gerrit.RESOURCES.greenCheck())); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.getElement(row, 1).setTitle(Util.C.dashboardDefaultToolTip()); } table.setWidget(row, 2, new Anchor(k.name(), "#" + link(k))); table.setText(row, 3, k.description()); <START> if (project.get().equals(k.projectName())) { <END> table.setText(row, 4, k.projectName()); } setRowItem(row, k); }</code><technical_language>be: if (!project.get().equals(k.projectName())) {</technical_language>

Target:
protected void populate(final int row, final DashboardInfo k) { if (k.isDefault()) { table.setWidget(row, 1, new Image(Gerrit.RESOURCES.greenCheck())); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.getElement(row, 1).setTitle(Util.C.dashboardDefaultToolTip()); } table.setWidget(row, 2, new Anchor(k.name(), "#" + link(k))); table.setText(row, 3, k.description()); if (!project.get().equals(k.projectName())) { table.setText(row, 4, k.projectName()); } setRowItem(row, k); }
Source:
<code>private void waitForAllTasks() { <START> while ( writerTaskCounter.get() > 0 ) <END> { LockSupport.parkNanos( TimeUnit.MILLISECONDS.toNanos( 10 ) ); } }</code><technical_language>sense Predicates.await() limit max wait time somehow</technical_language>

Target:
private void waitForAllTasks() { try { Predicates.await( () -> writerTaskCounter.get() == 0, 10, TimeUnit.MINUTES, 10, TimeUnit.MILLISECONDS ); } catch ( Throwable t ) { throw new RuntimeException( t ); } }
Source:
<code>public Iterator<SegmentWithOvershadowedStatus> getPublishedSegments() { if (isCacheEnabled) { Preconditions.checkState( lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS) && cachePopulated.get(), "hold on, still syncing published segments" ); <START> synchronized (lock) { <END> return publishedSegments.iterator(); } } else { return getMetadataSegments( coordinatorDruidLeaderClient, jsonMapper, responseHandler, segmentWatcherConfig.getWatchedDataSources() ); } }</code><technical_language>This lock is needed. If publishedSegments a mutable collection, lock prevent a race: <LINK_0> immutable, need a lock all. publishedSegments field volatile if wish</technical_language>

Target:
public Iterator<SegmentWithOvershadowedStatus> getPublishedSegments() { if (isCacheEnabled) { Uninterruptibles.awaitUninterruptibly(cachePopulated); return publishedSegments.iterator(); } else { return getMetadataSegments( coordinatorDruidLeaderClient, jsonMapper, responseHandler, segmentWatcherConfig.getWatchedDataSources() ); } }
Source:
<code>public void processRightWatermark(final MistWatermarkEvent event) { if (event.getTimestamp() < recentRightWatermark.getTimestamp()) { throw new RuntimeException("The timestamp of watermark should be greater or equal " + "than the previous event timestamp."); } recentRightWatermark = event; <START> final long leftWatermarkTimestamp = recentLeftWatermark.getTimestamp(); <END> final long rightWatermarkTimestamp = recentRightWatermark.getTimestamp(); final long minimumWatermark = getMinimumWatermark(leftWatermarkTimestamp, rightWatermarkTimestamp); drainUntilTimestamp(minimumWatermark); emitWatermarkUntilTimestamp(leftWatermarkTimestamp, rightWatermarkTimestamp, minimumWatermark); }</code><technical_language>lines 217-223 201-207</technical_language>

Target:
public void processRightWatermark(final MistWatermarkEvent event) { if (event.getTimestamp() < recentRightWatermark.getTimestamp()) { throw new RuntimeException("The timestamp of watermark should be greater or equal " + "than the previous event timestamp."); } recentRightWatermark = event; drainUntilMinimumWatermark(); }
Source:
<code>public void testJWTExpirationToken() throws Exception { String url = getContextBaseUrl() + "/users"; String expiredToken = securityTokenProvider.getToken("admin", Collections.emptyMap(), 1); Thread.sleep(1500); given().header(HttpHeaders.AUTHORIZATION, expiredToken) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() <START> .statusCode(HttpStatus.UNAUTHORIZED.value()) <END> .body("error", equalTo(UNAUTHORIZED_MESSAGE)); }</code><technical_language>need checked token expired beginning expired expected time passed</technical_language>

Target:
public void testJWTExpirationToken() throws Exception { String url = getContextBaseUrl() + "/users"; String expiredToken = securityTokenProvider.getToken("admin", Collections.emptyMap(), 3); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(expiredToken)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.OK.value()) .body(notNullValue()); Thread.sleep(3000); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(expiredToken)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.UNAUTHORIZED.value()) .body("error", equalTo("expired")); }
Source:
<code>public void testAnalysisExecution() { LttngKernelAnalysisModule module = new LttngKernelAnalysisModule(); module.setId("test"); try { module.setTrace(fTrace); } catch (TmfAnalysisException e) { fail(e.getMessage()); } ITmfStateSystem ss = module.getStateSystem(); assertNull(ss); assertTrue(TmfTestHelper.executeAnalysis(module)); ss = module.getStateSystem(); <START> assertNotNull(ss); <END> }</code><technical_language>this check a bit more stuff after? List<Integer> quarks = ss.getQuarks("*"); assertFalse(quarks.isEmpty());</technical_language>

Target:
public void testAnalysisExecution() { LttngKernelAnalysisModule module = new LttngKernelAnalysisModule(); module.setId("test"); try { module.setTrace(fTrace); } catch (TmfAnalysisException e) { fail(e.getMessage()); } ITmfStateSystem ss = module.getStateSystem(); assertNull(ss); assertTrue(TmfTestHelper.executeAnalysis(module)); ss = module.getStateSystem(); assertNotNull(ss); List<Integer> quarks = ss.getQuarks("*"); assertFalse(quarks.isEmpty()); }
Source:
<code>public List<String> getAllDatabases() { if (replay) { if (allDatabases.isPresent()) { return allDatabases.get(); } <START> throw new PrestoException(NOT_FOUND, "Missing entry for all databases"); <END> } List<String> result = delegate.getAllDatabases(); allDatabases = Optional.of(result); return result; }</code><technical_language>return allDatabases.orElseThrow(() -> new PrestoException(NOT_FOUND, "Missing entry for databases")) - is getAllDatabases handling special</technical_language>

Target:
public List<String> getAllDatabases() { if (replay) { return allDatabases.orElseThrow(() -> new PrestoException(NOT_FOUND, "Missing entry for all databases")); } List<String> result = delegate.getAllDatabases(); allDatabases = Optional.of(result); return result; }
Source:
<code>private synchronized void onReceiverFinished(final String receiverId) { stateMachine.checkState(RECEIVERS_COMPLETED); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.COMPLETED, PushShuffleReceiverState.FINISHED); numFinishedReceivers++; <START> if (numFinishedSenders == totalNumSenders && numFinishedReceivers == totalNumReceivers) { <END> LOG.log(Level.INFO, "The StaticPushShuffleManager is finished"); stateMachine.checkAndSetState(RECEIVERS_COMPLETED, FINISHED); } }</code><technical_language>This code is repeated, please extract logic method</technical_language>

Target:
private synchronized void onReceiverFinished(final String receiverId) { stateMachine.checkState(RECEIVERS_COMPLETED); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.COMPLETED, PushShuffleReceiverState.FINISHED); numFinishedReceivers++; if (isAllSendersAndReceiversFinished()) { finishManager(); } }
Source:
<code>private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) { SuiteRunner result = new SuiteRunner(getConfiguration(), xmlSuite, m_outputDir, m_testRunnerFactory, m_useDefaultListeners, m_methodInterceptors, <START> Lists.newArrayList(m_invokedMethodListeners.values()), <END> Lists.newArrayList(m_testListeners.values()), Lists.newArrayList(m_classListeners.values())); for (ISuiteListener isl : m_suiteListeners.values()) { result.addListener(isl); } for (IReporter r : result.getReporters()) { addListener(r); } for (IConfigurationListener cl : m_configuration.getConfigurationListeners()) { result.addConfigurationListener(cl); } return result; }</code><technical_language>change add a new signature for SuiteRunner constructor collections instead of lists. avoid useless objects creation</technical_language>

Target:
private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) { SuiteRunner result = new SuiteRunner(getConfiguration(), xmlSuite, m_outputDir, m_testRunnerFactory, m_useDefaultListeners, m_methodInterceptors, m_invokedMethodListeners.values(), m_testListeners.values(), m_classListeners.values()); for (ISuiteListener isl : m_suiteListeners.values()) { result.addListener(isl); } for (IReporter r : result.getReporters()) { addListener(r); } for (IConfigurationListener cl : m_configuration.getConfigurationListeners()) { result.addConfigurationListener(cl); } return result; }
Source:
<code>EagerQueryResult() { <START> fields = originalResult.columns().toArray( new String[originalResult.columns().size()] ); <END> }</code><technical_language>Change new String[0], shorter</technical_language>

Target:
EagerQueryResult() { fields = originalResult.columns().toArray( new String[0] ); }
Source:
<code>public int getItemViewType(int position) { if (isPlaying) { <START> if (position >= getItemCount() - 2) { <END> return EMPTY_VIEW_TYPE; } return TACT_VIEW_TYPE; } if (position == getItemCount() - 1) { return PLUS_VIEW_TYPE; } else { return TACT_VIEW_TYPE; } }</code><technical_language>I suggest replace 2 a constant named EMPTY_VIEW_COUNT_ON_END..</technical_language>

Target:
public int getItemViewType(int position) { if (isPlaying) { if (position >= getItemCount() - EMPTY_VIEW_COUNT_ON_END) { return EMPTY_VIEW_TYPE; } return TACT_VIEW_TYPE; } if (position == getItemCount() - 1) { return PLUS_VIEW_TYPE; } else { return TACT_VIEW_TYPE; } }
Source:
<code>public String toString() { <START> return "NonTerminalAroundInvokeInvocationContext [method=" + method + ", interceptor=" + chain.get(position) + "]"; <END> }</code><technical_language>slight character: java return "NonTerminalAroundInvokeInvocationContext [method=" + method + ", interceptor=" + chain.get(position) + ']';</technical_language>

Target:
public String toString() { return "NonTerminalAroundInvokeInvocationContext [method=" + method + ", interceptor=" + chain.get(position) + ']'; }
Source:
<code>private static void showFilterDialog(Context context, Feed selectedFeed) { FilterDialog filterDialog = new FilterDialog(context, selectedFeed.getItemFilter()) { @Override protected void updateFilter(Set<String> filterValues) { selectedFeed.setItemFilter(filterValues.toArray(new String[0])); DBWriter.setFeedItemsFilter(selectedFeed.getId(), filterValues); } }; <START> filterDialog.openCustomDialog(); <END> }</code><technical_language>add a method instead of replacing one? Do need one</technical_language>

Target:
private static void showFilterDialog(Context context, Feed selectedFeed) { FilterDialog filterDialog = new FilterDialog(context, selectedFeed.getItemFilter()) { @Override protected void updateFilter(Set<String> filterValues) { selectedFeed.setItemFilter(filterValues.toArray(new String[0])); DBWriter.setFeedItemsFilter(selectedFeed.getId(), filterValues); } }; filterDialog.openDialog(); }
Source:
<code>private String createColumn(Type type, int position) { String column = format("s._%d", position + 1); <START> if (type.equals(BIGINT)) { <END> return formatPredicate(column, "INT"); } if (type.equals(INTEGER)) { return formatPredicate(column, "INT"); } if (type.equals(SMALLINT)) { return formatPredicate(column, "INT"); } if (type.equals(TINYINT)) { return formatPredicate(column, "INT"); } if (type.equals(DoubleType.DOUBLE)) { return formatPredicate(column, "FLOAT"); } if (type.equals(RealType.REAL)) { return formatPredicate(column, "FLOAT"); } if (type.equals(BOOLEAN)) { return formatPredicate(column, "BOOL"); } if (type.equals(DATE)) { return formatPredicate(column, "TIMESTAMP"); } if (type instanceof DecimalType) { DecimalType decimalType = (DecimalType) type; return formatPredicate(column, format("DECIMAL(%s,%s)", decimalType.getPrecision(), decimalType.getScale())); } return column; }</code><technical_language>merge branches for types if (type.equals(BIGINT) || type.equals(INTEGER) .... ) {</technical_language>

Target:
private String createColumn(Type type, int position) { String column = format("s._%d", position + 1); if (type.equals(BIGINT) || type.equals(INTEGER) || type.equals(SMALLINT) || type.equals(TINYINT)) { return formatPredicate(column, "INT"); } if (type.equals(BOOLEAN)) { return formatPredicate(column, "BOOL"); } if (type.equals(DATE)) { return formatPredicate(column, "TIMESTAMP"); } if (type instanceof DecimalType) { DecimalType decimalType = (DecimalType) type; return formatPredicate(column, format("DECIMAL(%s,%s)", decimalType.getPrecision(), decimalType.getScale())); } return column; }
Source:
<code>public static List<Integer> getDefaultSupportedVersions() { return <START> Arrays.asList(0, 2, 3, 4); <END> }</code><technical_language>this method return List<StorageFormatType>. conversion Integer done it</technical_language>

Target:
public static List<StorageFormatType> getDefaultSupportedVersions() { return Arrays.asList(V1, V2, V3, V4); }
Source:
<code>protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) { super.entityPropertyChanged(sender, e); if (e.PropertyName.equals("status")) <START> { <END> getSearchCommand().execute(); } }</code><technical_language>need worry status of host</technical_language>

Target:
protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) { super.entityPropertyChanged(sender, e); getSearchCommand().execute(); }
Source:
<code>private static boolean hasSourceGenTasks(@NotNull Project project) { <START> return hasTask(project, new Function<JpsAndroidModuleProperties, String>() { <END> @Override public String fun(JpsAndroidModuleProperties androidFacetState) { return androidFacetState.SOURCE_GEN_TASK_NAME; } }); }</code><technical_language>Instead of a function hasTask a boolean SOURCE_GEN_TASK_NAME COMPILE_JAVA_TASK_NAME for specific cases</technical_language>

Target:
private static boolean hasSourceGenTasks(@NotNull Project project) { Module[] modules = ModuleManager.getInstance(project).getModules(); for (Module module : modules) { AndroidFacet androidFacet = Facets.getFirstFacetOfType(module, AndroidFacet.ID); if (androidFacet != null) { JpsAndroidModuleProperties androidFacetState = androidFacet.getProperties(); String taskName = androidFacetState.SOURCE_GEN_TASK_NAME; if (taskName != null && !taskName.isEmpty() && !"TODO".equalsIgnoreCase(taskName)) { return true; } } } return false; }
Source:
<code>public IMarkerResolution[] getResolutions(IMarker marker) { WorkbenchMarkerResolution workbenchMarkerResolution = new WorkbenchMarkerResolution() { @Override public void run(IMarker marker) { if (marker.getResource() instanceof IProject) { try { IProject project = (IProject) marker.getResource(); ModelingProjectManager.INSTANCE.removeModelingNature(project, new NullProgressMonitor()); <START> ModelingProjectManager.INSTANCE.createLocalRepresentationsFile(project, <END> new NullProgressMonitor()); ModelingProjectManager.INSTANCE.convertToModelingProject(project, new NullProgressMonitor()); } catch (CoreException e) { SiriusEditPlugin.getPlugin().getLog().log(e.getStatus()); } } } @Override public String getLabel() { return Messages.CreateMissingRepresentationFileResolution_label; } @Override public Image getImage() { return null; } @Override public String getDescription() { return Messages.CreateMissingRepresentationFileResolution_description; } @Override public IMarker[] findOtherMarkers(IMarker[] markers) { return new IMarker[0]; } }; return new IMarkerResolution[] { workbenchMarkerResolution }; }</code><technical_language>i is useful</technical_language>

Target:
public IMarkerResolution[] getResolutions(IMarker marker) { WorkbenchMarkerResolution workbenchMarkerResolution = new WorkbenchMarkerResolution() { @Override public void run(IMarker marker) { if (marker.getResource() instanceof IProject) { try { IProject project = (IProject) marker.getResource(); ModelingProjectManager.INSTANCE.removeModelingNature(project, new NullProgressMonitor()); ModelingProjectManager.INSTANCE.convertToModelingProject(project, new NullProgressMonitor()); } catch (CoreException e) { SiriusEditPlugin.getPlugin().getLog().log(e.getStatus()); } } } @Override public String getLabel() { return Messages.CreateMissingRepresentationFileResolution_label; } @Override public Image getImage() { return null; } @Override public String getDescription() { return Messages.CreateMissingRepresentationFileResolution_description; } @Override public IMarker[] findOtherMarkers(IMarker[] markers) { return new IMarker[0]; } }; return new IMarkerResolution[] { workbenchMarkerResolution }; }
Source:
<code>static <T> InstanceFactory<T> findFactoryFor(Class<T> type) { @SuppressWarnings("unchecked") final Constructor<T>[] constructors = (Constructor<T>[]) type.getDeclaredConstructors(); List<InstanceFactory<T>> annotatedFactories = Stream.concat( Stream.of(constructors) .filter(constructor -> constructor.isAnnotationPresent(JdbiConstructor.class)) .map(ConstructorInstanceFactory::new), Stream.of(type.getDeclaredMethods()) .filter(method -> method.isAnnotationPresent(JdbiConstructor.class)) .map(method -> new StaticMethodInstanceFactory<>(type, method))) .collect(Collectors.toList()); <START> if (annotatedFactories.size() > 1) { <END> throw new IllegalArgumentException(type + " must have at most one constructor or static factory method annotated @JdbiConstructor"); } if (annotatedFactories.size() == 1) { return annotatedFactories.get(0); } return new ConstructorInstanceFactory<>(findImplicitConstructorFor(type)); }</code><technical_language>a switch express exclusive branching based result size. Case 0, case 1, default</technical_language>

Target:
static <T> InstanceFactory<T> findFactoryFor(Class<T> type) { @SuppressWarnings("unchecked") final Constructor<T>[] constructors = (Constructor<T>[]) type.getDeclaredConstructors(); List<Constructor<T>> explicitConstructors = Stream.of(constructors) .filter(constructor -> constructor.isAnnotationPresent(JdbiConstructor.class)) .collect(Collectors.toList()); List<Method> explicitFactoryMethods = Stream.of(type.getDeclaredMethods()) .filter(method -> method.isAnnotationPresent(JdbiConstructor.class)) .collect(Collectors.toList()); if (explicitConstructors.size() + explicitFactoryMethods.size() > 1) { throw new IllegalArgumentException(type + " may have at most one constructor or static factory method annotated @JdbiConstructor"); } if (explicitConstructors.size() == 1) { return new ConstructorInstanceFactory<>(explicitConstructors.get(0)); } if (explicitFactoryMethods.size() == 1) { return new StaticMethodInstanceFactory<>(type, explicitFactoryMethods.get(0)); } return new ConstructorInstanceFactory<>(findImplicitConstructorFor(type)); }
Source:
<code>public void add(Key k, Value v) { if (key == null) { key = k; timeStamps.add(k.getTimestamp()); values.add(v); size++; } else if (key.compareRow(k.getRow()) == 0 <START> && key.compareColumnFamily(k.getColumnFamily()) == 0) { <END> timeStamps.add(k.getTimestamp()); values.add(v); } else { } }</code><technical_language>(did check column qualifier visibility), key.equals(k, PartialKey.ROW_COLFAM_COLQUAL_COLVIS) checks row column fields</technical_language>

Target:
public void add(Key k, Value v) throws IllegalArgumentException { add(k, v.get()); }
Source:
<code>protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); path.reset(); rect.set(0, 0, w, h); <START> int maxModalWidthPx = getResources().getDimensionPixelSize(R.dimen.swrve__conversation_max_modal_width); <END> float radiusToApply = getWidth() >= maxModalWidthPx ? radius : 0; path.addRoundRect(rect, radiusToApply, radiusToApply, Path.Direction.CW); path.close(); }</code><technical_language>~ ~ move this constructor? read</technical_language>

Target:
protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); path.reset(); rect.set(0, 0, w, h); float radiusToApply = getWidth() >= maxModalWidthPx ? radius : 0; path.addRoundRect(rect, radiusToApply, radiusToApply, Path.Direction.CW); path.close(); }
Source:
<code>private void deleteIfExists(File file) { if (!file.exists()) { return; } if (file.isDirectory()) { for (File sub : file.listFiles()) { deleteIfExists(sub); } } <START> file.delete(); <END> }</code><technical_language>if .delete() returns false? handle somehow</technical_language>

Target:
private void deleteIfExists(File file) throws IOException { if (!file.exists()) { return; } if (file.isDirectory()) { for (File sub : file.listFiles()) { deleteIfExists(sub); } } if (!file.delete()) { throw new IOException("Failed to delete file: " + file); } }