auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void init() throws IOException { <START> kafkaConfig.put("group.id", minionIdentity.getLocation()); <END> kafkaConfig.put("enable.auto.commit", "true"); kafkaConfig.put("key.deserializer", StringDeserializer.class.getCanonicalName()); kafkaConfig.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put("auto.commit.interval.ms", "1000"); kafkaConfig.put("key.serializer", StringSerializer.class.getCanonicalName()); kafkaConfig.put("value.serializer", ByteArraySerializer.class.getCanonicalName()); final Dictionary<String, Object> properties = configAdmin.getConfiguration(KAFKA_CLIENT_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); kafkaConfig.put(key, properties.get(key)); } } LOG.info("initializing the Kafka producer with: {}", kafkaConfig); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(kafkaConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } String cacheConfig = kafkaConfig.getProperty("rpcid.cache.config", "maximumSize=1000,expireAfterWrite=10m"); rpcIdCache = CacheBuilder.from(cacheConfig).build(); }</code><technical_language>constant too</technical_language>

Target:
public void init() throws IOException { kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, minionIdentity.getLocation()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000"); kafkaConfig.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); kafkaConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getCanonicalName()); kafkaConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getCanonicalName()); final Dictionary<String, Object> properties = configAdmin.getConfiguration(KafkaRpcConstants.KAFKA_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); kafkaConfig.put(key, properties.get(key)); } } LOG.info("initializing the Kafka producer with: {}", kafkaConfig); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(kafkaConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } String cacheConfig = kafkaConfig.getProperty("rpcid.cache.config", "maximumSize=1000,expireAfterWrite=10m"); rpcIdCache = CacheBuilder.from(cacheConfig).build(); }
Source:
<code>protected void synchingToTime(final long time) { if(fJob!= null ) { fJob.cancel(); } fJob = new Job("Synching to " + time) { @Override protected IStatus run(IProgressMonitor monitor) { List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return Status.OK_STATUS; } Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() { @Override public void accept(TimeGraphEntry entry) { if (monitor.isCanceled()) { return; } if (entry instanceof FlameChartEntry) { FlameChartEntry callStackEntry = (FlameChartEntry) entry; ICalledFunction currentFunction = callStackEntry.updateAt(time); if <START> (fSyncSelection && <END> currentFunction != null) { if (time == currentFunction.getStart()) { fSyncSelection = false; Display.getDefault().asyncExec(() -> { getTimeGraphViewer().setSelection(callStackEntry, true); getTimeGraphViewer().getTimeGraphControl().fireSelectionChanged(); }); } } return; } entry.getChildren().forEach(this); } }; traceEntries.forEach(consumer); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } Display.getDefault().asyncExec(() -> { getTimeGraphViewer().refresh(); }); return Status.OK_STATUS; } }; fJob.schedule(); }</code><technical_language>is in a Job, synchronization problem this field. is set in selectionRangeUpdated in UI thread set true for another 'time' enter this loop. instead of a fSyncSelection boolean, a fSyncTime = time if time == fSyncTime. sync is done, synchronize this variable set <0</technical_language>

Target:
protected void synchingToTime(final long time) { if(fJob!= null ) { fJob.cancel(); } long syncTime = fSyncTime; fJob = new Job("Flame Chart: Synching to " + time) { @Override protected IStatus run(IProgressMonitor monitor) { List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return Status.OK_STATUS; } Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() { private long fLocalSyncTime = syncTime; @Override public void accept(TimeGraphEntry entry) { if (monitor.isCanceled()) { return; } if (!(entry instanceof FlameChartEntry)) { entry.getChildren().forEach(this); return; } FlameChartEntry callStackEntry = (FlameChartEntry) entry; ICalledFunction currentFunction = callStackEntry.updateAt(time); if (fLocalSyncTime == time && currentFunction != null) { if (time == currentFunction.getStart()) { fLocalSyncTime = -1; Display.getDefault().asyncExec(() -> { getTimeGraphViewer().setSelection(callStackEntry, true); getTimeGraphViewer().getTimeGraphControl().fireSelectionChanged(); }); } } } }; traceEntries.forEach(consumer); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } Display.getDefault().asyncExec(() -> { getTimeGraphViewer().refresh(); }); return Status.OK_STATUS; } }; fJob.schedule(); }
Source:
<code>public void testExecuteLargeUpdateStatementSELECT() throws Exception { try (Statement stmt = con.createStatement()) { long count = stmt.executeLargeUpdate("select true from generate_series(1, 5)"); Assert.fail("A result was returned when none was expected. Returned: " + count); } catch (SQLException e) { <START> Assert.assertEquals("0100E", e.getSQLState()); <END> } }</code><technical_language>org.postgresql.util.PSQLState enum values, I TOO_MANY_RESULTS sounds strange for case</technical_language>

Target:
public void testExecuteLargeUpdateStatementSELECT() throws Exception { try (Statement stmt = con.createStatement()) { long count = stmt.executeLargeUpdate("select true from generate_series(1, 5)"); Assert.fail("A result was returned when none was expected. Returned: " + count); } catch (SQLException e) { Assert.assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); } }
Source:
<code>public DB2WeekDiffFunction() { <START> super("(select sign(i1) * floor(abs(i1)) from lateral(values (trunc(-(cast(?1 as date) - cast(?2 as date))) / 7)) as temp(i1))"); <END> }</code><technical_language>a cast int enough</technical_language>

Target:
public DB2WeekDiffFunction() { super("-int((days(cast(?1 as timestamp)) - days(cast(?2 as timestamp))) / 7)"); }
Source:
<code>public Map<?, ListenableFuture<Void>> execute(final String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { Integer locationId = Integer.valueOf(template.getHardware().getLocation().getId()); VirtualDatacenter vdc = cloudService.getVirtualDatacenter(locationId); Iterable<VirtualAppliance> existingGroups = vdc.listVirtualAppliances(); Optional<VirtualAppliance> vapp = tryFind(existingGroups, new Predicate<VirtualAppliance>() { @Override public boolean apply(VirtualAppliance input) { return input.getName().equals(group); } }); if (!vapp.isPresent()) { logger.debug(">> Creating group %s", group); VirtualAppliance newVapp = VirtualAppliance.builder(context, vdc).name(group).build(); newVapp.save(); logger.debug("<< group(%s) created", newVapp.getId()); } else { logger.debug(">> Using existing group(%s)", vapp.get().getId()); } <START> return super.execute(group, count, template, goodNodes, badNodes, customizationResponses); <END> }</code><technical_language>OK, other I imagine is put vapp vdc in template somehow, object pass eventual createNode... call. I promises template object evil consider be, "recipe" for making object vapp vdc part of recipe (albeit user about) closest fit..</technical_language>

Target:
public Map<?, ListenableFuture<Void>> execute(final String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { Integer locationId = Integer.valueOf(template.getHardware().getLocation().getId()); VirtualDatacenter vdc = cloudService.getVirtualDatacenter(locationId); Iterable<VirtualAppliance> existingGroups = vdc.listVirtualAppliances(); Optional<VirtualAppliance> vapp = tryFind(existingGroups, new Predicate<VirtualAppliance>() { @Override public boolean apply(VirtualAppliance input) { return input.getName().equals(group); } }); VirtualAppliance newVapp = null; if (!vapp.isPresent()) { logger.debug(">> Creating group %s", group); newVapp = VirtualAppliance.builder(context, vdc).name(group).build(); newVapp.save(); logger.debug("<< group(%s) created", newVapp.getId()); } else { logger.debug(">> Using existing group(%s)", vapp.get().getId()); } VirtualApplianceCachingTemplate abiquoTemplate = VirtualApplianceCachingTemplate .from(template) .withVirtualDatacenter(vdc) .withVirtualAppliance(vapp.or(newVapp)) .build(); return super.execute(group, count, abiquoTemplate, goodNodes, badNodes, customizationResponses); }
Source:
<code>public void confirmShellAddProjectUsingExistProject(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_RESOURCES), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_RESOURCES); shell.activate(); shell.bot().radio(RADIO_USING_EXISTING_DIRECTORY).click(); <START> bot.sleep(1000); <END> shell.bot().textWithLabel(LABEL_EXISTING_DIRECTORY_PATH, 0).setText(projectName); shell.bot().button(FINISH).click(); int timeout = 5; confirmDialogs: while (timeout-- > 0) { bot.sleep(2000); for (SWTBotShell currentShell : bot.shells()) { if (currentShell.getText().equals(SHELL_WARNING_LOCAL_CHANGES_DELETED) || currentShell.getText().equals(SHELL_SAVE_RESOURCE)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); break confirmDialogs; } else if (currentShell.getText().equals(SHELL_CONFIRM_SAVE_UNCHANGED_CHANGES)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); shell.bot().button(FINISH).click(); continue confirmDialogs; } } } shell.bot().waitUntil(Conditions.shellCloses(shell)); }</code><technical_language>? Is some "magic involved" ?! (and never) need sleep is done in a background thread change UI in "near" future</technical_language>

Target:
public void confirmShellAddProjectUsingExistProject(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_RESOURCES), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_RESOURCES); shell.activate(); shell.bot().radio(RADIO_USING_EXISTING_DIRECTORY).click(); shell.bot().textWithLabel(LABEL_EXISTING_DIRECTORY_PATH, 0).setText(projectName); shell.bot().button(FINISH).click(); int timeout = 5; confirmDialogs: while (timeout-- > 0) { bot.sleep(2000); for (SWTBotShell currentShell : bot.shells()) { if (currentShell.getText().equals(SHELL_WARNING_LOCAL_CHANGES_DELETED) || currentShell.getText().equals(SHELL_SAVE_RESOURCE)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); break confirmDialogs; } else if (currentShell.getText().equals(SHELL_CONFIRM_SAVE_UNCHANGED_CHANGES)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); shell.bot().button(FINISH).click(); continue confirmDialogs; } } } shell.bot().waitUntil(Conditions.shellCloses(shell)); }
Source:
<code>public void send(HttpClient client) throws IOException { org.eclipse.jetty.client.api.Request.Listener listener = new Request.Listener.Adapter() { @Override public void onSuccess(Request request) { onRequestComplete(); } @Override public void onFailure(Request request, Throwable failure) { onConnectionFailed(failure); } }; InputStreamResponseListener responseListener = new InputStreamResponseListener() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @Override public void onContent(Response response, ByteBuffer content, Callback callback) { if (response.getStatus() != SC_OK) { LOG.warn("Response received {}: {}", response.getStatus(), response.getReason()); } byte[] buffer = new byte[content.limit()]; content.get(buffer); baos.write(buffer, 0, buffer.length); callback.succeeded(); } @Override public void onComplete(Result result) { if (result.isFailed()) { doTaskCompleted(result.getFailure()); } else { <START> onResponseComplete(result, baos.toByteArray(), null); <END> } } }; request.followRedirects(supportRedirect).listener(listener).send(responseListener); }</code><technical_language>Is a reason for null media Type? curiosity :-) Thanks, I test merge</technical_language>

Target:
public void send(HttpClient client) throws IOException { org.eclipse.jetty.client.api.Request.Listener listener = new Request.Listener.Adapter() { @Override public void onSuccess(Request request) { onRequestComplete(); } @Override public void onFailure(Request request, Throwable failure) { onConnectionFailed(failure); } }; InputStreamResponseListener responseListener = new InputStreamResponseListener() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @Override public void onContent(Response response, ByteBuffer content, Callback callback) { byte[] buffer = new byte[content.limit()]; content.get(buffer); baos.write(buffer, 0, buffer.length); callback.succeeded(); } @Override public void onComplete(Result result) { if (result.isFailed()) { doTaskCompleted(result.getFailure()); } else { onResponseComplete(result, baos.toByteArray()); } } }; request.followRedirects(supportRedirect).listener(listener).send(responseListener); }
Source:
<code>public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); Map<String, Ref> refsBefore = repo.getAllRefs(); for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) refsBefore.put(ref.getName(), ref); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); List<ReflogEntry> rlEntries = repo.getReflogReader(ref.getName()) .getReverseEntries(); if (rlEntries != null) for (ReflogEntry e : rlEntries) <START> nonHeads.add(e.getNewId()); <END> } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); if (!allHeads.isEmpty()) { PackFile heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets); if (heads != null) ret.add(heads); } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); return ret; }</code><technical_language>I git-core adds new ids if id zeroId. rationale is logging enabled reference created id mentioned in log. I wrong. :-)</technical_language>

Target:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); Map<String, Ref> refsBefore = repo.getAllRefs(); for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) refsBefore.put(ref.getName(), ref); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); List<ReflogEntry> rlEntries = repo.getReflogReader(ref.getName()) .getReverseEntries(); if (rlEntries != null) for (ReflogEntry e : rlEntries) { nonHeads.add(e.getNewId()); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) nonHeads.add(oldId); } } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, null); if (heads != null) ret.add(heads); } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, (heads == null) ? null : Collections.singleton(heads .getIndex())); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); return ret; }
Source:
<code>Analyzer(@Nonnull List<JField> fields, @Nonnull JMethod constructor) { this.constructor = constructor; this.field2id = Maps.newHashMap(); for (JField field : fields) { if (!field.isFinal() && !field.isVolatile() && NotEffectivelyFinalField.checkIfCanBeFinal(field)) { this.field2id.put(field, <START> new Integer(this.field2id.size())); <END> } } }</code><technical_language>findbugs recommend Integer.valueOf(...)</technical_language>

Target:
Analyzer(@Nonnull List<JField> fields, @Nonnull JMethod constructor) { this.constructor = constructor; this.field2id = Maps.newHashMap(); for (JField field : fields) { if (!field.isFinal() && !field.isVolatile() && NotEffectivelyFinalField.checkIfCanBeFinal(field)) { this.field2id.put(field, Integer.valueOf(this.field2id.size())); } } }
Source:
<code>private static <T> List<T> runAllInParallel(int parallelism, List<Callable<T>> toRun) throws ExecutionException { <START> if (toRun.isEmpty()) { <END> return Collections.emptyList(); } else if (toRun.size() == 1) { try { return Collections.singletonList(toRun.get(0).call()); } catch (Exception e) { throw new ExecutionException(e); } } int limitedParallelism = Math.min(parallelism, toRun.size()); LOG.info("Initiating action with parallelism: {}", limitedParallelism); ExecutorService threadPool = Executors.newFixedThreadPool(limitedParallelism); try { List<Future<T>> futures = new ArrayList<Future<T>>(); for (Callable<T> callable : toRun) { futures.add(threadPool.submit(callable)); } List<T> result = new ArrayList<T>(toRun.size()); for (Future<T> future : futures) { try { result.add(future.get()); } catch (InterruptedException e) { throw new RuntimeException("The thread was interrupted", e); } } return result; } finally { threadPool.shutdownNow(); } }</code><technical_language>I this is a reasonable safe optimization. If is run, is need create a threadpool</technical_language>

Target:
private static <T> List<T> runAllInParallel(int parallelism, List<Callable<T>> toRun) throws ExecutionException { if (toRun.isEmpty()) { return Collections.emptyList(); } int limitedParallelism = Math.min(parallelism, toRun.size()); LOG.info("Initiating action with parallelism: {}", limitedParallelism); ExecutorService threadPool = Executors.newFixedThreadPool(limitedParallelism); try { List<Future<T>> futures = new ArrayList<Future<T>>(); for (Callable<T> callable : toRun) { futures.add(threadPool.submit(callable)); } List<T> result = new ArrayList<T>(toRun.size()); for (Future<T> future : futures) { try { result.add(future.get()); } catch (InterruptedException e) { throw new RuntimeException("The thread was interrupted", e); } } return result; } finally { threadPool.shutdownNow(); } }
Source:
<code>public KafkaCollector.Builder toBuilder() { return KafkaCollector.builder() .bootstrapServers(bootstrapServers) .groupId(groupId) .topic(topic) <START> .streams(streams) <END> .overrides(overrides); }</code><technical_language>this need public else it</technical_language>

Target:
public KafkaCollector.Builder toBuilder() { final KafkaCollector.Builder result = KafkaCollector.builder(); if (bootstrapServers != null) result.bootstrapServers(bootstrapServers); if (groupId != null) result.groupId(groupId); if (topic != null) result.topic(topic); if (streams != null) result.streams(streams); if (overrides != null) result.overrides(overrides); return result; }
Source:
<code>protected void registerBundle(BundleInfo bundle) { String groupId = bundle.getGroupId(); if (groupId != null) { groupId = BundleGroup.PREFIX + groupId; } String artifactId = bundle.getArtifactId(); if (groupId == null || artifactId == null) { groupId = VIRTUAL_BUNDLE_GROUP; ((BundleInfoImpl) bundle).setGroupId(groupId); } <START> if (!mavenGroups.containsKey(groupId)) { mavenGroups.put(groupId, new ArrayList<String>()); } mavenGroups.get(groupId).add(bundle.getId()); <END> }</code><technical_language>computeIfAbsent: java mavenGroups.computeIfAbsent(groupId, -> new ArrayList<>()).add(bundle.getId()));</technical_language>

Target:
protected void registerBundle(BundleInfo bundle) { String groupId = bundle.getGroupId(); if (groupId != null) { groupId = BundleGroup.PREFIX + groupId; } String artifactId = bundle.getArtifactId(); if (groupId == null || artifactId == null) { groupId = VIRTUAL_BUNDLE_GROUP; ((BundleInfoImpl) bundle).setGroupId(groupId); } mavenGroups.computeIfAbsent(groupId, k -> new ArrayList<>()).add(bundle.getId()); }
Source:
<code>public void testGitHubReleaseNoWorkflowOnDockstoreNoUser() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient(BasicIT.USER_2_USERNAME, testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); try { <START> client.handleGitHubRelease(workflowRepo, "thisisafakeuser", "0.1", installationId); <END> } catch (ApiException ex) { assertEquals("Should not be able to add a workflow when user does not exist on Dockstore.", LAMBDA_ERROR, ex.getCode()); } }</code><technical_language>missing assert fail. test skip apiexception perfectly fine. other places too</technical_language>

Target:
public void testGitHubReleaseNoWorkflowOnDockstoreNoUser() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient(BasicIT.USER_2_USERNAME, testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); try { client.handleGitHubRelease(workflowRepo, "thisisafakeuser", "0.1", installationId); Assert.fail("Should not reach this statement."); } catch (ApiException ex) { assertEquals("Should not be able to add a workflow when user does not exist on Dockstore.", LAMBDA_ERROR, ex.getCode()); } }
Source:
<code>public void define_search() { WebService.Action search = controller.action("search"); assertThat(search).isNotNull(); assertThat(search.isPost()).isFalse(); <START> assertThat(search.params()).hasSize(5); <END> assertThat(search.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key); assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4"); }</code><technical_language>assertion new param itself</technical_language>

Target:
public void define_search() { WebService.Action search = controller.action("search"); assertThat(search).isNotNull(); assertThat(search.isPost()).isFalse(); assertThat(search.params()).hasSize(5); assertThat(search.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key); assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("organization").since()).isEqualTo("6.4"); }
Source:
<code>RestAdapter provideRestAdapter() { return new Builder() .setLogLevel(LogLevel.BASIC) .setEndpoint( new Endpoint() { @Override public String getUrl() { <START> return "<LINK_0>"; <END> } @Override public String getName() { return "KazakAPI"; } }) .build(); }</code><technical_language>x: this belongs in BuildConfig --> create a field in base.properties file read in BuildProperties#configure. do for other fields in a reference</technical_language>

Target:
RestAdapter provideRestAdapter() { return new Builder() .setLogLevel(LogLevel.BASIC) .setEndpoint( new Endpoint() { @Override public String getUrl() { return BuildConfig.ENDPOINT_URL; } @Override public String getName() { return "KazakAPI"; } }) .build(); }
Source:
<code>public JSONObject createDecorationJson(ArrayList<UUID> comp_uuids, MotionDisplayer motionDisplayer) { JSONObject expMarker_json = new JSONObject(); UUID mesh_uuid = UUID.randomUUID(); expMarker_json.put("uuid", mesh_uuid.toString()); expMarker_json.put("type", "Mesh"); expMarker_json.put("opensimtype", "ExperimentalMarker"); expMarker_json.put("name", getName()); expMarker_json.put("geometry", motionDisplayer.getExperimentalMarkerGeometryJson().get("uuid")); expMarker_json.put("material", motionDisplayer.getExperimentalMarkerMaterialJson().get("uuid")); StateVector dataAtStartTime = motionDisplayer.getSimmMotionData().getStateVector(0); ArrayDouble interpolatedStates = dataAtStartTime.getData(); int idx = getStartIndexInFileNotIncludingTime(); <START> AnnotatedMotion mot = (AnnotatedMotion)motionDisplayer.getSimmMotionData(); <END> conversion = mot.getUnitConversion(); JSONArray pos = new JSONArray(); for (int i = 0; i < 3; i++) { pos.add(interpolatedStates.get(idx+i)/conversion); } expMarker_json.put("position", pos); expMarker_json.put("castShadow", false); expMarker_json.put("userData", "NonEditable"); comp_uuids.add(mesh_uuid); return expMarker_json; }</code><technical_language>this construct AnnotatedMotion a getSimmMotionData() Storage this a cast</technical_language>

Target:
public JSONObject createDecorationJson(ArrayList<UUID> comp_uuids, MotionDisplayer motionDisplayer) { JSONObject expMarker_json = new JSONObject(); UUID mesh_uuid = UUID.randomUUID(); expMarker_json.put("uuid", mesh_uuid.toString()); expMarker_json.put("type", "Mesh"); expMarker_json.put("opensimtype", "ExperimentalMarker"); expMarker_json.put("name", getName()); expMarker_json.put("geometry", motionDisplayer.getExperimentalMarkerGeometryJson().get("uuid")); expMarker_json.put("material", motionDisplayer.getExperimentalMarkerMaterialJson().get("uuid")); StateVector dataAtStartTime = motionDisplayer.getSimmMotionData().getStateVector(0); ArrayDouble interpolatedStates = dataAtStartTime.getData(); int idx = getStartIndexInFileNotIncludingTime(); AnnotatedMotion mot = (AnnotatedMotion)motionDisplayer.getSimmMotionData(); conversion = mot.getUnitConversion(); JSONArray pos = new JSONArray(); for (int i = 0; i < 3; i++) { pos.add(interpolatedStates.get(idx+i)*conversion); } expMarker_json.put("position", pos); expMarker_json.put("castShadow", false); expMarker_json.put("userData", "NonEditable"); comp_uuids.add(mesh_uuid); return expMarker_json; }
Source:
<code>public void analyzer(String analyzerName) { <START> this.analyzerName = analyzerName; <END> }</code><technical_language>I if interpreted analyzer name right in this method. way, throw exception exact method user overrode analyzer name. debugging easier for users. store analyzer instead of analyzer name: this.analyzer = analysisDefinitionRegistry.getAnalyzerDefinition( analyzerName ); Of this sense for Lucene backend</technical_language>

Target:
public void analyzer(String analyzerName) { this.analyzer = analysisDefinitionRegistry.getAnalyzerDefinition( analyzerName ); if ( analyzer == null ) { throw log.unknownAnalyzer( analyzerName, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } }
Source:
<code>public void testDifferenceDays() { Date day1_10am = new Date(2018, 4, 6, 10, 0); Date day1_11pm55 = new Date(2018, 4, 6, 23, 55); Date day2_01am = new Date(2018, 4, 7, 1, 0); Date day2_11pm = new Date(2018, 4, 7, 1, 0); <START> Date day3_08am = new Date(2018, 4, 8, 8, 0); <END> assertEquals(0, Util.differenceInCalendarDay(day1_10am, day1_11pm55)); assertEquals(1, Util.differenceInCalendarDay(day1_10am, day2_01am)); assertEquals(1, Util.differenceInCalendarDay(day1_11pm55, day2_01am)); assertEquals(2, Util.differenceInCalendarDay(day1_10am, day3_08am)); assertEquals(1, Util.differenceInCalendarDay(day2_11pm, day3_08am)); assertEquals(-1, Util.differenceInCalendarDay(day3_08am, day2_11pm)); }</code><technical_language>Add some Dates years, dates more a month :)</technical_language>

Target:
public void testDifferenceDays() throws Exception { Date may_6_10am = parseDate("2018-05-06 10:00:00"); Date may_6_11pm55 = parseDate("2018-05-06 23:55:00"); Date may_7_01am = parseDate("2018-05-07 01:00:00"); Date may_7_11pm = parseDate("2018-05-07 11:00:00"); Date may_8_08am = parseDate("2018-05-08 08:00:00"); Date june_3_08am = parseDate("2018-06-03 08:00:00"); Date june_9_08am = parseDate("2018-06-09 08:00:00"); Date june_9_08am_nextYear = parseDate("2019-06-09 08:00:00"); assertEquals(0, Util.daysBetween(may_6_10am, may_6_11pm55)); assertEquals(1, Util.daysBetween(may_6_10am, may_7_01am)); assertEquals(1, Util.daysBetween(may_6_11pm55, may_7_01am)); assertEquals(2, Util.daysBetween(may_6_10am, may_8_08am)); assertEquals(1, Util.daysBetween(may_7_11pm, may_8_08am)); assertEquals(28, Util.daysBetween(may_6_10am, june_3_08am)); assertEquals(34, Util.daysBetween(may_6_10am, june_9_08am)); assertEquals(365 + 34, Util.daysBetween(may_6_10am, june_9_08am_nextYear)); assertEquals(-1, Util.daysBetween(may_8_08am, may_7_11pm)); }
Source:
<code>private void add(String... searchStrings) { if (searchStrings != null) { for (String searchString : searchStrings) { if (searchString == null || searchString.isEmpty()) { <START> return; <END> } Node node= root; for (char c : searchString.toCharArray()) { node= node.add(c); } node.match= searchString; } } }</code><technical_language>True, thoughtless while inlining..</technical_language>

Target:
private void add(String... searchStrings) { if (searchStrings != null) { for (String searchString : searchStrings) { if (searchString == null || searchString.isEmpty()) { continue; } Node node= root; for (char c : searchString.toCharArray()) { node= node.add(c); } node.match= searchString; } } }
Source:
<code><START> public JSONMetricsContainer(String tenantId, List<JSONMetric> metrics) { <END> this.tenantId = tenantId; this.jsonMetrics = metrics; }</code><technical_language>I proposing this. In constructor of JSONMetricsContainer, parse JSONMetric organize buckets/lists of metrics: - valid JSON Metrics - invalid JSON Metrics - delayed Metrics getValidMetrics() simply fetch list of valid metrics. Is do</technical_language>

Target:
public JSONMetricsContainer(String tenantId, List<JSONMetric> metrics) { this.tenantId = tenantId; this.jsonMetrics = metrics; processJson(); }
Source:
<code>static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(name.length()); if (!name.isEmpty() && Character.isDigit(name.charAt(0))) { <START> safeNameBuilder.append("l"); <END> } for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_')) { if (prevCharIsUnderscore) { continue; } else { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }</code><technical_language>I this is meant</technical_language>

Target:
static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(name.length()); if (!name.isEmpty() && Character.isDigit(name.charAt(0))) { safeNameBuilder.append("_"); } for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_')) { if (prevCharIsUnderscore) { continue; } else { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }
Source:
<code>CloudBigtableConnectionPool(ExecutorService executorService) { <START> this.connectionStartupExecutor = executorService; <END> }</code><technical_language>executorService? connectionStartupExecutor? closeConnectionExecutor</technical_language>

Target:
CloudBigtableConnectionPool(ExecutorService executorService) { this.connectionCloseExecutor = executorService; }
Source:
<code><START> public void addAttribute(ICPPASTAttribute attribute) { <END> attributes = ArrayUtil.append(attributes, attribute); }</code><technical_language>assertNotFrozen(); call is required</technical_language>

Target:
public void addAttribute(ICPPASTAttribute attribute) { assertNotFrozen(); attributes = ArrayUtil.append(attributes, attribute); }
Source:
<code>private byte[] getByteArray() { if ( data.hasArray() ) { <START> return data.array(); END> } else { byte[] arr = new byte[data.capacity()]; int originalPosition = data.position(); int originalLimit = data.limit(); data.get( arr, 0, data.limit() ); data.position( originalPosition ); data.limit( originalLimit ); return arr; } }</code><technical_language>This expensive...but if this in readers need worry maintaining reader-local positions, reading subsections of a block..</technical_language>

Target:
private byte[] getByteArray() { byte[] arr = new byte[data.capacity()]; int originalPosition = data.position(); int originalLimit = data.limit(); data.get( arr, 0, data.limit() ); data.position( originalPosition ); data.limit( originalLimit ); return arr; }
Source:
<code>public void testOutOfOrderStack() throws Exception { mApp = new MockApp("/session-tests-template/"); SessionWrapper session = mApp.getSession(); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0"); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0-f3"); session.setDatum("case_id", "case_id_value"); session.setDatum("usercase_id", "usercase_id_value"); Assert.assertEquals(SessionFrame.STATE_DATUM_COMPUTED, session.getNeededData()); <START> Assert.assertEquals("case_id_new_visit_0", session.getNeededDatum().getDataId()); <END> }</code><technical_language>I add this datum frame confirm session successfully moves (just ensure end-to-end is working)</technical_language>

Target:
public void testOutOfOrderStack() throws Exception { mApp = new MockApp("/session-tests-template/"); SessionWrapper session = mApp.getSession(); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0"); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0-f3"); session.setDatum("case_id", "case_id_value"); session.setDatum("usercase_id", "usercase_id_value"); Assert.assertEquals(SessionFrame.STATE_DATUM_COMPUTED, session.getNeededData()); Assert.assertEquals("case_id_new_visit_0", session.getNeededDatum().getDataId()); session.setDatum("case_id_new_visit_0", "visit_id_value"); Assert.assertEquals(null, session.getNeededData()); }
Source:
<code>public Table get_table(final String dbname, final String name) throws MetaException, NoSuchObjectException { String[] parsedDbName = parseDbName(dbname, conf); return getTableInternal( <START> parsedDbName[CAT_NAME], parsedDbName[DB_NAME], name, null, null, false, null); <END> }</code><technical_language>this null? internally default "hive" in getTableColumnStatistics()? is this safe column stats in this case</technical_language>

Target:
public Table get_table(final String dbname, final String name) throws MetaException, NoSuchObjectException { String[] parsedDbName = parseDbName(dbname, conf); return getTableInternal( parsedDbName[CAT_NAME], parsedDbName[DB_NAME], name, null, null, false, null, null, null); }
Source:
<code>public Collection<URI> getDependencies(URI uri) { Set<URI> uris = new LinkedHashSet<URI>(); uris.add(uri); for (DependencyProviderDescriptor descriptor : registeredDescriptors.values()) { IDependencyProvider provider = descriptor.getDependencyProvider(); if (provider != null && provider.apply(uri)) { Collection<URI> dependencies = provider.getDependencies(uri); if (dependencies != null) { <START> uris.addAll(dependencies); <END> } } } return uris; }</code><technical_language>guava filter null entries (once protect client code called extensions)</technical_language>

Target:
public Collection<URI> getDependencies(URI uri) { Set<URI> uris = new LinkedHashSet<URI>(); uris.add(uri); for (DependencyProviderDescriptor descriptor : registeredDescriptors.values()) { IDependencyProvider provider = descriptor.getDependencyProvider(); if (provider != null && provider.apply(uri)) { Collection<URI> dependencies = provider.getDependencies(uri); if (dependencies != null) { addAll(uris, Iterables.filter(dependencies, notNull())); } } } return uris; }
Source:
<code>public UpdateCalibrationResponse putBatchForceCalibration(@Auth final AccessToken accessToken, final List<Calibration> calibrations) { if (calibrations.size() > CalibrationDynamoDB.MAX_PUT_FORCE_SIZE){ <START> throw new WebApplicationException(Response.status(400).entity(new JsonError(400, String.format("Batch size shhould be less than %s", CalibrationDynamoDB.MAX_PUT_FORCE_SIZE))).build()); <END> } final Map<String, Boolean> putBatchForceResponse = calibrationDAO.putBatchForce(calibrations); return UpdateCalibrationResponse.createFromPutBatchForceResponse(putBatchForceResponse); }</code><technical_language>typo</technical_language>

Target:
public UpdateCalibrationResponse putBatchForceCalibration(@Auth final AccessToken accessToken, final List<Calibration> calibrations) { if (calibrations.size() > CalibrationDynamoDB.MAX_PUT_FORCE_SIZE){ throw new WebApplicationException(Response.status(400).entity(new JsonError(400, String.format("Batch size should be less than %s", CalibrationDynamoDB.MAX_PUT_FORCE_SIZE))).build()); } final Map<String, Boolean> putBatchForceResponse = calibrationDAO.putBatchForce(calibrations); return UpdateCalibrationResponse.createFromPutBatchForceResponse(putBatchForceResponse); }
Source:
<code>private SMREntryList next(OpaqueStreamIterator stream) { List<SMREntry> smrList = new ArrayList<>(); int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastEntry != null) { List<SMREntry> smrEntries = lastEntry.getEntries().get(stream.uuid); if (smrEntries != null) { int currentEntrySize = calculateSize(smrEntries); <START> if (currentEntrySize > DEFAULT_LOG_REPLICATION_DATA_MSG_SIZE) { <END> log.error("The current entry size is bigger than the maxDataSizePerMsg supported", currentEntrySize, DEFAULT_LOG_REPLICATION_DATA_MSG_SIZE); } else if (currentEntrySize > maxDataSizePerMsg) { log.warn("The current entry size is bigger than the configured maxDataSizePerMsg {}", currentEntrySize, maxDataSizePerMsg); } if (currentEntrySize + currentMsgSize > maxDataSizePerMsg && currentMsgSize != 0) { break; } smrList.addAll(smrEntries); currentMsgSize += currentEntrySize; stream.maxVersion = Math.max(stream.maxVersion, lastEntry.getVersion()); } lastEntry = null; } if (stream.iterator.hasNext()) { lastEntry = (OpaqueEntry) stream.iterator.next(); } if (lastEntry == null) { break; } } } catch (TrimmedException e) { log.error("Catch an TrimmedException exception ", e); throw e; } log.trace("CurrentMsgSize lastEntrySize maxDataSizePerMsg {}", currentMsgSize, lastEntry == null ? 0 : calculateSize(lastEntry.getEntries().get(stream.uuid)), maxDataSizePerMsg); return new SMREntryList(currentMsgSize, smrList); }</code><technical_language>do check for default size user-configured size? one, right</technical_language>

Target:
private SMREntryList next(OpaqueStreamIterator stream) { List<SMREntry> smrList = new ArrayList<>(); int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastEntry != null) { List<SMREntry> smrEntries = lastEntry.getEntries().get(stream.uuid); if (smrEntries != null) { int currentEntrySize = ReaderUtility.calculateSize(smrEntries); if (currentEntrySize > MAX_DATA_MSG_SIZE_SUPPORTED) { log.error("The current entry size is bigger than the maxDataSizePerMsg supported", currentEntrySize, MAX_DATA_MSG_SIZE_SUPPORTED); throw new IllegalSnapshotEntrySizeException(" The snapshot entry is bigger than the system supported"); } else if (currentEntrySize > maxDataSizePerMsg) { observeBiggerMsg.setValue(observeBiggerMsg.getValue()+1); log.warn("The current entry size is bigger than the configured maxDataSizePerMsg {}", currentEntrySize, maxDataSizePerMsg); } if (currentEntrySize + currentMsgSize > maxDataSizePerMsg && currentMsgSize != 0) { break; } smrList.addAll(smrEntries); currentMsgSize += currentEntrySize; stream.maxVersion = Math.max(stream.maxVersion, lastEntry.getVersion()); } lastEntry = null; } if (stream.iterator.hasNext()) { lastEntry = (OpaqueEntry) stream.iterator.next(); } if (lastEntry == null) { break; } } } catch (TrimmedException e) { log.error("Catch an TrimmedException exception ", e); throw e; } log.trace("CurrentMsgSize lastEntrySize maxDataSizePerMsg {}", currentMsgSize, lastEntry == null ? 0 : ReaderUtility.calculateSize(lastEntry.getEntries().get(stream.uuid)), maxDataSizePerMsg); return new SMREntryList(currentMsgSize, smrList); }
Source:
<code>public Bitmap createImage() { Bitmap resultBitmap = drawBackground(leadImageBitmap, leadImageFocusY); Canvas canvas = new Canvas(resultBitmap); final int gradientStartColor = 0x20000000; final int gradientStopColor = 0x60000000; Shader shader = new LinearGradient(0, 0, 0, canvas.getHeight(), gradientStartColor, gradientStopColor, Shader.TileMode.CLAMP); Paint paint = new Paint(); paint.setShader(shader); <START> canvas.drawRect(new Rect(0, 0, canvas.getWidth(), canvas.getHeight()), paint); <END> Layout textLayout = drawTextSnippet(canvas, textSnippet); isArticleRTL = textLayout.getParagraphDirection(0) == Layout.DIR_RIGHT_TO_LEFT; int top = drawLicenseIcons(canvas, context); if (!TextUtils.isEmpty(description)) { top = drawDescription(canvas, description, top); } drawTitle(canvas, title, top); drawWordmark(canvas, context); return resultBitmap; }</code><technical_language>this new block another method, drawGradient()</technical_language>

Target:
public Bitmap createImage() { Bitmap resultBitmap = drawBackground(leadImageBitmap, leadImageFocusY); Canvas canvas = new Canvas(resultBitmap); if (leadImageBitmap != null) { drawGradient(canvas); } Layout textLayout = drawTextSnippet(canvas, textSnippet); isArticleRTL = textLayout.getParagraphDirection(0) == Layout.DIR_RIGHT_TO_LEFT; int top = drawLicenseIcons(canvas, context); if (!TextUtils.isEmpty(description)) { top = drawDescription(canvas, description, top); } drawTitle(canvas, title, top); drawWordmark(canvas, context); return resultBitmap; }
Source:
<code>public boolean isHostControllerStarted() { try { ModelNode address = new ModelNode(); address.add("host", configuration.getHostName()); ControlledProcessState.State status = Enum.valueOf(ControlledProcessState.State.class, readAttribute("host-state", address).asString().toUpperCase(Locale.ENGLISH)); <START> log.warning("status: " + status); <END> return status == ControlledProcessState.State.RUNNING; } catch (Exception ignored) { log.severe(ignored.getLocalizedMessage()); } return false; }</code><technical_language>Please remove</technical_language>

Target:
public boolean isHostControllerStarted() { try { ModelNode address = new ModelNode(); address.add("host", configuration.getHostName()); ControlledProcessState.State status = Enum.valueOf(ControlledProcessState.State.class, readAttribute("host-state", address).asString().toUpperCase(Locale.ENGLISH)); return status == ControlledProcessState.State.RUNNING; } catch (Exception ignored) { } return false; }
Source:
<code>public Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); for (Map.Entry<String, String> entry : labels.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (value == null) { continue; } if (!key.startsWith(CHE_SERVER_LABEL_PREFIX)) { <START> LOG.warn("Expected CreateContainerParams label key " + entry.getKey() + <END> " to start with " + CHE_SERVER_LABEL_PREFIX); } else if (key.contains(".") || key.contains("_") || value.contains("_")) { LOG.error(String.format("Cannot convert label %s to DNS Name: " + "'-' and '.' are used as escape characters", entry.toString())); continue; } key = key.replaceAll(":", ".").replaceAll("/", "_"); value = value.replaceAll("/", "_"); key = String.format(CHE_SERVER_LABEL_PADDING, key); value = String.format(CHE_SERVER_LABEL_PADDING, value); if (!key.matches(KUBERNETES_ANNOTATION_REGEX) || !value.matches(KUBERNETES_ANNOTATION_REGEX)) { LOG.error(String.format("Could not convert label %s into Kubernetes annotation: " + "labels must be alphanumeric with ':' and '/'", entry.toString())); continue; } names.put(key, value); } return names; }</code><technical_language>do + +</technical_language>

Target:
public Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); for (Map.Entry<String, String> label : labels.entrySet()) { if (!hasConversionProblems(label)) { String key = label.getKey(); String value = label.getValue(); key = convertLabelKey(key); value = convertLabelValue(value); key = addPadding(key); value = addPadding(value); if (matchesKubernetesLabelRegex(key) && matchesKubernetesLabelRegex(value)) { names.put(key, value); } else { LOG.error( "Could not convert label into Kubernetes annotation: labels must be alphanumeric with ':' and '/'", label.toString()); } } } return names; }
Source:
<code>protected void checkBounds( PageCursor cursor ) { if ( cursor.checkAndClearBoundsFlag() ) { <START> throw new IllegalStateException(); <END> } }</code><technical_language>this exception provide a bit more details, pageId offset</technical_language>

Target:
protected void checkBounds( PageCursor cursor ) { if ( cursor.checkAndClearBoundsFlag() ) { throw new IllegalStateException( String.format( "Cursor %s access out of bounds, page id %d, offset %d", cursor.toString(), cursor.getCurrentPageId(), cursor.getOffset() ) ); } }
Source:
<code>public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (!enabled) { return super.setBlock(location, block); } BlockState existing = getBlock(location); int priority = getPlacementPriority(block); int srcPriority = getPlacementPriority(existing); <START> if (srcPriority == 1 || srcPriority == 2) { <END> super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); } stages.get(priority).add(location, block); return !existing.equalsFuzzy(block); }</code><technical_language>This is starting feel a RemovalPriority -- this mirror placement priority, refactored < > in case, 0 3 excluded here. intend include 3, this srcPriority > 0</technical_language>

Target:
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (!enabled) { return super.setBlock(location, block); } BlockState existing = getBlock(location); PlacementPriority priority = getPlacementPriority(block); PlacementPriority srcPriority = getPlacementPriority(existing); if (srcPriority != PlacementPriority.FIRST) { BlockStateHolder replacement = block.getBlockType().getMaterial().isAir() ? block : BlockTypes.AIR.getDefaultState(); switch (srcPriority) { case FINAL: stages.get(PlacementPriority.CLEAR_FINAL).add(location, replacement); break; case LATE: stages.get(PlacementPriority.CLEAR_LATE).add(location, replacement); break; case LAST: stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement); break; } if (block.getBlockType().getMaterial().isAir()) { return !existing.equalsFuzzy(block); } } stages.get(priority).add(location, block); return !existing.equalsFuzzy(block); }