auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute() { if (getEnclosingCommand().getParameters().getTaskGroupSuccess()) { getReturnValue().setSucceeded(false); beforeTask(); Guid taskId = cmd.persistAsyncTaskPlaceHolder(cmd.getActionType()); addTask(taskId, Backend.getInstance().getResourceManager() .RunVdsCommand(getVDSCommandType(), getVDSParameters()), false); } ExecutionHandler.setAsyncJob(getEnclosingCommand().getExecutionContext(), true); getReturnValue().setSucceeded(true); }

Target:
public void execute() { if (getEnclosingCommand().getParameters().getTaskGroupSuccess()) { getReturnValue().setSucceeded(false); beforeTask(); Guid taskId = getEnclosingCommand().persistAsyncTaskPlaceHolder(getEnclosingCommand().getActionType()); addTask(taskId, Backend.getInstance().getResourceManager() .RunVdsCommand(getVDSCommandType(), getVDSParameters()), false); } ExecutionHandler.setAsyncJob(getEnclosingCommand().getExecutionContext(), true); getReturnValue().setSucceeded(true); }
Source:
public void appendFrom(ReadableByteChannel channel, long size) throws IOException { MessageInfo messageInfo = messageInfoList.get(messageIndex); if (messageInfo.getSize() != size) { throw new IllegalStateException("Mismatched buffer length for blob: " + messageInfo.getStoreKey().getID()); } ByteBuffer messageBuf = ByteBuffer.allocate((int) size); int bytesRead = 0; while (bytesRead < size) { bytesRead += channel.read(messageBuf); } try { cloudBlobStore.putBlob(messageInfo, messageBuf, size); messageIndex++; } catch (Exception e) { throw new IOException(e); } }

Target:
public void appendFrom(ReadableByteChannel channel, long size) throws IOException { MessageInfo messageInfo = messageInfoList.get(messageIndex); if (messageInfo.getSize() != size) { throw new IllegalStateException("Mismatched buffer length for blob: " + messageInfo.getStoreKey().getID()); } ByteBuffer messageBuf = ByteBuffer.allocate((int) size); int bytesRead = 0; while (bytesRead < size) { int readResult = channel.read(messageBuf); if (readResult == -1) { throw new IOException("Channel read returned -1 before reading expected number of bytes, blobId=" + messageInfo.getStoreKey().getID()); } bytesRead += readResult; } try { cloudBlobStore.putBlob(messageInfo, messageBuf, size); messageIndex++; } catch (Exception e) { throw new IOException(e); } }
Source:
public void doSubscribeAdvertisement(Subscriber subscriber) throws IOException { try { pckOut.end(); for (String repository : subscriber.getAllRepositories()) { write("repository " + repository); pckOut.end(); } write("done advertisement"); readResponseHeader(subscriber); } finally { close(); } }

Target:
public void doSubscribeAdvertisement(Subscriber subscriber) throws IOException { try { pckOut.writeString("advertisement"); for (String repository : subscriber.getAllRepositories()) { write("repositoryaccess " + repository); } pckOut.end(); readResponseHeader(); } finally { close(); } }
Source:
void complete() { unregisterShutdownHook(); final Object lock = loggerNode.getContext().treeLock; synchronized (publisher) { publisher.drain(); synchronized (lock) { replacePublisher(loggerNode); } } }

Target:
void complete() { if (!complete) { unregisterShutdownHook(); synchronized (publisher) { publisher.drain(); complete = true; } } }
Source:
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) { logger.info("Getting nearest structure {}", generator); if (isComplete()) { FMLLog.bigWarning("Structure Gen Test in successful", generator); } else { FMLLog.bigWarning("Structure Gen Test not successful. Spawn {}, isAt {}, generate {}, generateStructure {}", spawn, isAt, generate, generateStructure); } return new BlockPos(64, 0, 64); }

Target:
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) { logger.info("Getting nearest structure {}", generator); if (isComplete()) { logger.info("[STRUCTURE-GEN-TEST] Test in successful", generator); } else { logger.info("[STRUCTURE-GEN-TEST] Test not successful. Spawn {}, isAt {}, generate {}, generateStructure {}", spawn, isAt, generate, generateStructure); } return new BlockPos(64, 0, 64); }
Source:
private void spongeImpl$registerGoals(final MobEntity this$0) { this.initSpongeAI(); this.shadow$registerGoals(); }

Target:
private void impl$registerGoals(final MobEntity this$0) { this.initSpongeAI(); this.shadow$registerGoals(); }
Source:
public void setData_whenFileExists_updatesWidgetAnswer() { FormEntryPrompt prompt = promptWithAnswer(new StringData("blah.txt")); when(prompt.getIndex()).thenReturn(formIndex); ArbitraryFileWidget widget = createWidget(prompt); widget.setBinaryData(mockedFile); assertThat(widget.getAnswer().getDisplayText(), is("newFile.txt")); assertThat(widget.binding.answerTextView.getText(), is("newFile.txt")); }

Target:
public void setData_whenFileExists_updatesWidgetAnswer() throws IOException { File tempFile = File.createTempFile("newFile", "txt", fakeQuestionMediaManager.getDir()); tempFile.deleteOnExit(); ArbitraryFileWidget widget = createWidget(promptWithAnswer(null)); widget.setData(tempFile); assertThat(widget.getAnswer().getDisplayText(), is(tempFile.getName())); assertThat(widget.binding.answerTextView.getText(), is(tempFile.getName())); assertThat(widget.binding.answerLayout.getVisibility(), is(View.VISIBLE)); }
Source:
private static Field convertToBasicSearchField(java.lang.reflect.Field classField, ClientLogger logger) { Field searchField = new Field(); searchField.setName(classField.getName()); DataType dataType = covertToDataType(classField.getGenericType(), false, logger); searchField.setType(dataType); searchField.setKey(false); searchField.setSearchable(false); searchField.setFacetable(false); searchField.setHidden(false); searchField.setFilterable(false); searchField.setSortable(false); return searchField; }

Target:
private static Field convertToBasicSearchField(java.lang.reflect.Field classField, ClientLogger logger) { Field searchField = new Field(); searchField.setName(classField.getName()); DataType dataType = covertToDataType(classField.getGenericType(), false, logger); searchField.setType(dataType) .setKey(false) .setSearchable(false) .setFacetable(false) .setHidden(false) .setFilterable(false) .setSortable(false); return searchField; }
Source:
protected static BlobHolder doGetFromCache(String key) { ConversionCacheEntry cacheEntry = cache.get(key); if (cacheEntry != null) { if (CACHE_HITS.incrementAndGet() < 0) { CACHE_HITS.addAndGet(Long.MIN_VALUE); } BlobHolder restored = cacheEntry.restore(); if (restored.getBlob().getFile().exists()) { return restored; } else { removeFromCache(key); } } return null; }

Target:
protected static BlobHolder doGetFromCache(String key) { ConversionCacheEntry cacheEntry = cache.get(key); if (cacheEntry != null) { if (CACHE_HITS.incrementAndGet() < 0) { CACHE_HITS.addAndGet(Long.MIN_VALUE); } BlobHolder restored = cacheEntry.restore(); if (restored.getBlob().getFile().exists()) { return restored; } } return null; }
Source:
private void syncAzureObjectIds(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { String envCrn = stack.getEnvironmentCrn(); LOGGER.info("Syncing Azure Object IDs for environment {}", envCrn); Map<String, List<CloudIdentity>> userCloudIdentites = getUserCloudIdentitiesToSync(umsUsersState); Map<String, String> userToAzureObjectIdMap = getAzureObjectIdMap(userCloudIdentites); Map<String, String> groupToAzureObjectIdMap = getAzureObjectIdMap(umsUsersState.getGroupToCloudIdentityMap()); SetRangerCloudIdentityMappingRequest setRangerCloudIdentityMappingRequest = new SetRangerCloudIdentityMappingRequest(); setRangerCloudIdentityMappingRequest.setAzureUserMapping(userToAzureObjectIdMap); setRangerCloudIdentityMappingRequest.setAzureGroupMapping(groupToAzureObjectIdMap); try { sdxEndpoint.setRangerCloudIdentityMapping(envCrn, setRangerCloudIdentityMappingRequest); } catch (Exception e) { LOGGER.warn("Failed to set cloud identity mapping for environment {}", envCrn, e); warnings.accept(envCrn, "Failed to set cloud identity mapping"); } }

Target:
private void syncAzureObjectIds(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { String envCrn = stack.getEnvironmentCrn(); LOGGER.info("Syncing Azure Object IDs for environment {}", envCrn); try { Map<String, List<CloudIdentity>> userCloudIdentites = getUserCloudIdentitiesToSync(umsUsersState); Map<String, String> userToAzureObjectIdMap = getAzureObjectIdMap(userCloudIdentites); Map<String, String> groupToAzureObjectIdMap = getAzureObjectIdMap(umsUsersState.getGroupToCloudIdentityMap()); SetRangerCloudIdentityMappingRequest setRangerCloudIdentityMappingRequest = new SetRangerCloudIdentityMappingRequest(); setRangerCloudIdentityMappingRequest.setAzureUserMapping(userToAzureObjectIdMap); setRangerCloudIdentityMappingRequest.setAzureGroupMapping(groupToAzureObjectIdMap); LOGGER.debug("Setting ranger cloud identity mapping: {}", setRangerCloudIdentityMappingRequest); sdxEndpoint.setRangerCloudIdentityMapping(envCrn, setRangerCloudIdentityMappingRequest); } catch (Exception e) { LOGGER.warn("Failed to set cloud identity mapping for environment {}", envCrn, e); warnings.accept(envCrn, "Failed to set cloud identity mapping"); } }
Source:
public void initialize(Config mConfig, Config mRuntime) { this.config = Config.toClusterMode(mConfig); this.runtime = mRuntime; }

Target:
public void initialize(Config mConfig, Config mRuntime) { if (Config.toClusterMode(mConfig) != null) { this.config = Config.toClusterMode(mConfig); } else { this.config = mConfig; } this.runtime = mRuntime; }
Source:
protected void updateDefaultDisplayRelatedFields(final VmBase vmBase) { final Collection<DisplayType> displayTypes = model.getDisplayType().getItems(); if (displayTypes == null || displayTypes.isEmpty()) { return; } Frontend.getInstance().runQuery(VdcQueryType.GetGraphicsDevices, new IdQueryParameters(vmBase.getId()), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object modelFromCallback, Object returnValue) { deactivate(); DisplayType displayProtocol = displayTypes.iterator().next(); if (displayTypes.contains(vmBase.getDefaultDisplayType())) { displayProtocol = vmBase.getDefaultDisplayType(); } maybeSetSelectedItem(model.getDisplayType(), displayProtocol); Set<GraphicsType> graphicsTypes = new HashSet<GraphicsType>(); List<GraphicsDevice> graphicsDevices = ((VdcQueryReturnValue) returnValue).getReturnValue(); for (GraphicsDevice graphicsDevice : graphicsDevices) { graphicsTypes.add(graphicsDevice.getGraphicsType()); } UnitVmModel.GraphicsTypes selected = UnitVmModel.GraphicsTypes.fromGraphicsTypes(graphicsTypes); if (selected != null && getModel().getGraphicsType().getItems().contains(selected)) { maybeSetSelectedItem(getModel().getGraphicsType(), selected); } maybeSetSelectedItem(model.getDisplayType(), displayProtocol); maybeSetSelectedItem(model.getNumOfMonitors(), vmBase.getNumOfMonitors()); maybeSetSelectedItem(model.getUsbPolicy(), vmBase.getUsbPolicy()); maybeSetEntity(model.getIsSmartcardEnabled(), vmBase.isSmartcardEnabled()); maybeSetSingleQxlPci(vmBase); activate(); } })); }

Target:
protected void updateDefaultDisplayRelatedFields(final VmBase vmBase) { final Collection<DisplayType> displayTypes = model.getDisplayType().getItems(); if (displayTypes == null || displayTypes.isEmpty()) { return; } Frontend.getInstance().runQuery(VdcQueryType.GetGraphicsDevices, new IdQueryParameters(vmBase.getId()), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object modelFromCallback, Object returnValue) { deactivate(); DisplayType displayProtocol = displayTypes.iterator().next(); if (displayTypes.contains(vmBase.getDefaultDisplayType())) { displayProtocol = vmBase.getDefaultDisplayType(); } maybeSetSelectedItem(model.getDisplayType(), displayProtocol); Set<GraphicsType> graphicsTypes = new HashSet<GraphicsType>(); List<GraphicsDevice> graphicsDevices = ((VdcQueryReturnValue) returnValue).getReturnValue(); for (GraphicsDevice graphicsDevice : graphicsDevices) { graphicsTypes.add(graphicsDevice.getGraphicsType()); } UnitVmModel.GraphicsTypes selected = UnitVmModel.GraphicsTypes.fromGraphicsTypes(graphicsTypes); if (selected != null && getModel().getGraphicsType().getItems().contains(selected)) { maybeSetSelectedItem(getModel().getGraphicsType(), selected); } maybeSetSelectedItem(model.getNumOfMonitors(), vmBase.getNumOfMonitors()); maybeSetSelectedItem(model.getUsbPolicy(), vmBase.getUsbPolicy()); maybeSetEntity(model.getIsSmartcardEnabled(), vmBase.isSmartcardEnabled()); maybeSetSingleQxlPci(vmBase); activate(); } })); }
Source:
public void childRendered(MElementContainer<MUIElement> parentElement, MUIElement element) { super.childRendered(parentElement, element); processContents(parentElement); ToolBar toolbar = (ToolBar) getUIContainer(element); if (toolbar != null && !toolbar.isDisposed()) { toolbar.pack(true); toolbar.requestLayout(); } }

Target:
public void childRendered(MElementContainer<MUIElement> parentElement, MUIElement element) { super.childRendered(parentElement, element); processContents(parentElement); ToolBar toolbar = (ToolBar) getUIContainer(element); if (toolbar != null && !toolbar.isDisposed()) { toolbar.requestLayout(); } }
Source:
private void testString(final String language, final String str) throws CRException { bean.set("content", str); t.processBean(bean); String s = (String) bean.get("lang"); Assert.assertEquals("The found Language (" + s + ") should be (" + language + "). String: '" + str + "'", language, s); }

Target:
private void testString(final String language, final String str) throws CRException { bean.set("content", str); t.processBean(bean); String s = (String) bean.get("lang"); assertEquals("The found Language (" + s + ") should be (" + language + "). String: '" + str + "'", language, s); }
Source:
public <T> CompletableFuture<T> send(final Request<T> request) { final CompletableFuture<T> promise = new CompletableFuture<>(); sendHelper(request, promise, 0); return promise; }

Target:
public <T> CompletionStage<T> send(final Request<T> request) { final CompletableFuture<T> promise = new CompletableFuture<>(); sendHelper(request, promise, 0); return promise; }
Source:
public void stop_run_if_too_many_failures() throws Exception { IntStream.range(0, 10).forEach(i -> createUnindexedUser()); advanceInTime(); PartiallyFailingUserIndexer failingAboveRatioUserIndexer = new PartiallyFailingUserIndexer(1); Settings settings = new MapSettings() .setProperty("sonar.search.recovery.loopLimit", "3"); underTest = newRecoveryIndexer(failingAboveRatioUserIndexer, settings); underTest.recover(); assertThatLogsContain(ERROR, "Elasticsearch recovery - too many failures [2/3 documents], waiting for next run"); assertThatQueueHasSize(9); assertThat(failingAboveRatioUserIndexer.called).hasSize(3); }

Target:
public void stop_run_if_too_many_failures() { IntStream.range(0, 10).forEach(i -> createUnindexedUser()); advanceInTime(); PartiallyFailingUserIndexer failingAboveRatioUserIndexer = new PartiallyFailingUserIndexer(1); Settings settings = new MapSettings() .setProperty("sonar.search.recovery.loopLimit", "3"); underTest = newRecoveryIndexer(failingAboveRatioUserIndexer, mockedRuleIndexer, settings); underTest.recover(); assertThatLogsContain(ERROR, "Elasticsearch recovery - too many failures [2/3 documents], waiting for next run"); assertThatQueueHasSize(9); assertThat(failingAboveRatioUserIndexer.called).hasSize(3); }
Source:
protected boolean doExists() throws SQLException { String query = "SELECT COUNT(*) FROM " + systemSchema + ".schemata WHERE " + schemaNameField + "=?"; return jdbcTemplate.queryForInt(query, name) > 0; }

Target:
protected boolean doExists() throws SQLException { String query = "SELECT COUNT(1) FROM " + schemaTable + " WHERE " + schemaNameField + "=?"; return jdbcTemplate.queryForInt(query, name) > 0; }
Source:
public boolean isDirectoryFileConflict() { if (dfConflictPath != null) { if ((currentHead.getEntryPathString()+"/").startsWith(dfConflictPath)) return true; dfConflictPath = null; } return false; }

Target:
public boolean isDirectoryFileConflict() { return dfConflict != null; }
Source:
public void setFrameID(int frameID) { this.frameID = frameID; }

Target:
public void setFrameID(int frameID) { if (frameID < 0 || frameID > 255) throw new IllegalArgumentException("Frame ID must be between 0 and 255."); this.frameID = frameID; }
Source:
int removeExecutionLogsByTime(final long millis, final int recordCleanupLimit) throws ExecutorManagerException { final String DELETE_BY_TIME = "DELETE FROM execution_logs WHERE upload_time < ? LIMIT ?"; try { return this.dbOperator.update(DELETE_BY_TIME, millis, recordCleanupLimit); } catch (final SQLException e) { logger.error("delete execution logs failed", e); throw new ExecutorManagerException( "Error deleting old execution_logs before " + millis, e); } }

Target:
int removeExecutionLogsByTime(final long millis, final int recordCleanupLimit) throws ExecutorManagerException { int totalRecordsRemoved = 0; int removedRecords; do { removedRecords = removeExecutionLogsBatch(millis, recordCleanupLimit); logger.debug("Removed batch of execution logs. Count of records removed in this batch: " + removedRecords); totalRecordsRemoved = totalRecordsRemoved + removedRecords; } while (removedRecords == recordCleanupLimit); return totalRecordsRemoved; }
Source:
private ConnectorPageSink createPageSink() { boolean connectorCommitRequired = connectorCommitStrategy == ConnectorCommitStrategy.LIFESPAN_COMMIT || connectorCommitStrategy == ConnectorCommitStrategy.TASK_COMMIT; if (target instanceof CreateHandle) { return pageSinkManager.createPageSink(session, ((CreateHandle) target).getHandle(), PageSinkProperties.builder().setCommitRequired(connectorCommitRequired).build()); } if (target instanceof InsertHandle) { return pageSinkManager.createPageSink(session, ((InsertHandle) target).getHandle(), PageSinkProperties.builder().setCommitRequired(connectorCommitRequired).build()); } throw new UnsupportedOperationException("Unhandled target type: " + target.getClass().getName()); }

Target:
private ConnectorPageSink createPageSink() { PageSinkProperties pageSinkProperties = PageSinkProperties.builder() .setCommitRequired(pageSinkCommitStrategy.isCommitRequired()) .build(); if (target instanceof CreateHandle) { return pageSinkManager.createPageSink(session, ((CreateHandle) target).getHandle(), pageSinkProperties); } if (target instanceof InsertHandle) { return pageSinkManager.createPageSink(session, ((InsertHandle) target).getHandle(), pageSinkProperties); } throw new UnsupportedOperationException("Unhandled target type: " + target.getClass().getName()); }
Source:
public void closeAndRecycleState() { final Map<TopicPartition, Long> checkpoint = prepareClose(true); if (checkpoint != null) { stateMgr.checkpoint(checkpoint); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: stateMgr.recycle(); recordCollector.close(); break; case CLOSED: log.trace("Skip close since state is {}", state()); return; default: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); log.info("Closed clean and recycled state"); }

Target:
public void closeAndRecycleState() { final Map<TopicPartition, Long> checkpoint = prepareClose(true); if (checkpoint != null) { stateMgr.checkpoint(checkpoint); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: stateMgr.recycle(); recordCollector.close(); break; case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); log.info("Closed clean and recycled state"); }
Source:
public void postCollectionAdminGroupCreateAdminGroupDcTitleUnprocessable() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); metadataRest.put("dc.title", new MetadataValueRest("testTitle")); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionAdminGroupCreateAdminGroupDcTitleUnprocessable() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); metadataRest.put("dc.title", new MetadataValueRest("testTitle")); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isNoContent()); }
Source:
@Override public void onReceive(Context context, Intent intent) { if (null == intent) return; String action = intent.getAction(); Bundle extras = intent.getExtras(); if (ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { dispatchAirplaneModeChange(extras.getBoolean(EXTRA_AIRPLANE_STATE, false)); } else if (CONNECTIVITY_ACTION.equals(action)) { dispatchNetworkStateChange(connectivityManager.getActiveNetworkInfo()); } }

Target:
@Override public void onReceive(Context context, Intent intent) { if (null == intent) { return; } String action = intent.getAction(); Bundle extras = intent.getExtras(); if (ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { dispatchAirplaneModeChange(extras.getBoolean(EXTRA_AIRPLANE_STATE, false)); } else if (CONNECTIVITY_ACTION.equals(action)) { dispatchNetworkStateChange(connectivityManager.getActiveNetworkInfo()); } }
Source:
public void setEnabled(boolean enabled) { if (this.enabled && !enabled) { if (LOG.isTraceEnabled()) { LOG.trace("Disabling filesystem listener"); } this.enabled = false; intellijWorkspace.removeResourceListener(this); } else if (!this.enabled && enabled) { if (LOG.isTraceEnabled()) { LOG.trace("Enabling filesystem listener"); } this.enabled = true; intellijWorkspace.addResourceListener(this); } }

Target:
public void setEnabled(boolean enabled) { if (this.enabled && !enabled) { LOG.trace("Disabling filesystem listener"); this.enabled = false; intellijWorkspace.removeResourceListener(this); } else if (!this.enabled && enabled) { LOG.trace("Enabling filesystem listener"); this.enabled = true; intellijWorkspace.addResourceListener(this); } }
Source:
public void run() { KafkaCollector collector = null; try { LOG.info("Starting runner for " + this.props.getProperty(TOPIC_AND_HOUR)); collector = new KafkaCollector(props, name, topic); LOG.info("Running " + name + " for input " + props.getProperty(INPUT_PATHS)); collector.run(); } catch (Throwable e) { e.printStackTrace(); LOG.error("Failed for " + name + " ,job: " + collector == null ? null : collector.getJob() + " failed for " + props.getProperty(INPUT_PATHS) + " Exception:" + e.getLocalizedMessage()); errorQueue.add(new SweeperError(name, props.get(INPUT_PATHS).toString(), e)); } }

Target:
public void run() { KafkaCollector collector = null; try { LOG.info("Starting runner for " + this.props.getProperty(TOPIC_AND_HOUR)); collector = new KafkaCollector(props, name, topic); LOG.info("Running " + name + " for input " + props.getProperty(INPUT_PATHS)); collector.run(); } catch (Throwable e) { LOG.error("Failed for " + name + " ,job: " + collector == null ? null : collector.getJob() + " failed for " + props.getProperty(INPUT_PATHS) + " Exception:" + e.getLocalizedMessage()); errorQueue.add(new SweeperError(name, props.get(INPUT_PATHS).toString(), e)); } }
Source:
private void reconcileExternalAgents(Account account, Agent agent, Region localRegion, Map<String, Region> regions, Map<String, ExternalCredential> toAdd, Map<String, ExternalCredential> toRemove, Map<String, ExternalCredential> toRetain, Map<String, ExternalProject> externalProjects) { boolean changed = false; for (String key : toAdd.keySet()) { ExternalCredential value = toAdd.get(key); ExternalAgent externalAgent = createExternalAgent(agent, account, localRegion, regions.get(value.getRegionName()), toAdd.get(key), externalProjects); if (externalAgent != null) { value.setAgentUuid(externalAgent.getUuid()); toRetain.put(key, value); changed = true; } } for (String key : toRemove.keySet()) { ExternalCredential value = toRemove.get(key); if (deactivateAndRemoveExternalAgent(agent, value)) { changed = true; } } if (changed) { objectManager.setFields(agent, AccountConstants.FIELD_EXTERNAL_CREDENTIALS, toRetain.values()); } }

Target:
private void reconcileExternalAgents(Account account, Agent agent, Region localRegion, Map<String, Region> regions, Map<String, ExternalCredential> toAdd, Map<String, ExternalCredential> toRemove, Map<String, ExternalCredential> toRetain, Map<String, ExternalProject> externalProjects) { boolean changed = false; for (String key : toAdd.keySet()) { ExternalCredential value = toAdd.get(key); ExternalAgent externalAgent = createExternalAgent(agent, account, localRegion, regions.get(value.getRegionName()), toAdd.get(key), externalProjects); if (externalAgent != null) { value.setAgentUuid(externalAgent.getUuid()); toRetain.put(key, value); changed = true; } } for (String key : toRemove.keySet()) { ExternalCredential value = toRemove.get(key); deactivateAndRemoveExternalAgent(agent, value); changed = true; } if (changed) { objectManager.setFields(agent, AccountConstants.FIELD_EXTERNAL_CREDENTIALS, toRetain.values()); } }
Source:
public void process(TraceContext context, APMSpan span, NodeBuilder nodeBuilder) { for (Map.Entry<String, Object> entry : span.getTags().entrySet()) { if (entry.getValue() != null) { nodeBuilder.addProperty(new Property(entry.getKey(), entry.getValue().toString())); if (entry.getKey().endsWith(".url") || entry.getKey().endsWith(".uri")) { try { URL url = new URL(entry.getValue().toString()); nodeBuilder.setUri(url.getPath()); } catch (MalformedURLException e) { nodeBuilder.setUri(entry.getValue().toString()); } nodeBuilder.setEndpointType(entry.getKey().substring(0, entry.getKey().length() - 4)); } else if (entry.getKey().equals("component")) { nodeBuilder.setComponentType(entry.getValue().toString()); } else if (entry.getKey().contains("fault")) { nodeBuilder.setFault(entry.getValue().toString()); } else if (entry.getKey().contains(APMTracer.TRANSACTION_NAME)) { if (context.getBusinessTransaction() == null) { context.setBusinessTransaction(entry.getValue().toString()); } } } } }

Target:
public void process(TraceContext context, APMSpan span, NodeBuilder nodeBuilder) { for (Map.Entry<String, Object> entry : span.getTags().entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { nodeBuilder.addProperty(new Property(entry.getKey(), entry.getValue().toString())); if (entry.getKey().endsWith(".url") || entry.getKey().endsWith(".uri")) { try { URL url = new URL(entry.getValue().toString()); nodeBuilder.setUri(url.getPath()); } catch (MalformedURLException e) { nodeBuilder.setUri(entry.getValue().toString()); } nodeBuilder.setEndpointType(entry.getKey().substring(0, entry.getKey().length() - 4)); } else if (entry.getKey().equals("component")) { nodeBuilder.setComponentType(entry.getValue().toString()); } else if (entry.getKey().contains("fault")) { nodeBuilder.setFault(entry.getValue().toString()); } else if (entry.getKey().contains(APMTracer.TRANSACTION_NAME)) { if (context.getBusinessTransaction() == null) { context.setBusinessTransaction(entry.getValue().toString()); } } } } }
Source:
public static List<SchemaChange> parse(String currentDB, String sql) { if ( matchesBlacklist(sql) ) { return null; } while ( true ) { try { return parseSQL(currentDB, sql); } catch ( ReparseSQLException e ) { LOGGER.debug("rewrote SQL to " + sql); sql = e.getSQL(); } catch ( ParseCancellationException e ) { LOGGER.debug("Parse cancelled: " + e); return null; } catch ( MaxwellSQLSyntaxError e) { LOGGER.error("Error parsing SQL: '" + sql + "'"); throw (e); } } }

Target:
public static List<SchemaChange> parse(String currentDB, String sql) { if ( matchesBlacklist(sql) ) { return null; } while ( true ) { try { return parseSQL(currentDB, sql); } catch ( ReparseSQLException e ) { sql = e.getSQL(); LOGGER.debug("rewrote SQL to " + sql); } catch ( ParseCancellationException e ) { LOGGER.debug("Parse cancelled: " + e); return null; } catch ( MaxwellSQLSyntaxError e) { LOGGER.error("Error parsing SQL: '" + sql + "'"); throw (e); } } }
Source:
public void logout() throws IOException { if (this.loggedIn) { Map<String, String> params = new HashMap<>(); params.put("action", "logout"); params.put("format", "json"); params.put("token", fetchToken("csrf")); try { sendJsonRequest("POST", params); } catch (MediaWikiApiErrorException e) { throw new IOException(e.getMessage(), e); } this.loggedIn = false; this.username = ""; this.password = ""; } }

Target:
public void logout() throws IOException { if (this.loggedIn) { Map<String, String> params = new HashMap<>(); params.put("action", "logout"); params.put("format", "json"); params.put("token", getOrFetchToken("csrf")); try { sendJsonRequest("POST", params); } catch (MediaWikiApiErrorException e) { throw new IOException(e.getMessage(), e); } this.loggedIn = false; this.username = ""; this.password = ""; } }
Source:
public void end(final Xid xid, final int flags) throws XAException { if (logger.isTraceEnabled()) { logger.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); } checkXA(); try { if (rollbackOnly) { try { rollback(false, false); } catch (Throwable ignored) { logger.debug("Error on rollback during end call!", ignored); } throw new XAException(XAException.XAER_RMFAIL); } try { flushAcks(); startCall(); try { sessionContext.xaEnd(xid, flags); } catch (ActiveMQNotConnectedException ex) { ActiveMQClientLogger.LOGGER.connectionClosedWarn(ex.getType(), ex.getMessage()); } finally { endCall(); } } catch (XAException xae) { throw xae; } catch (Throwable t) { ActiveMQClientLogger.LOGGER.errorCallingEnd(t); XAException xaException = new XAException(XAException.XAER_RMFAIL); xaException.initCause(t); throw xaException; } } finally { currentXID = null; } }

Target:
public void end(final Xid xid, final int flags) throws XAException { if (logger.isTraceEnabled()) { logger.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); } checkXA(); try { if (rollbackOnly) { try { rollback(false, false); } catch (Throwable ignored) { logger.debug("Error on rollback during end call!", ignored); } throw new XAException(XAException.XAER_RMFAIL); } try { flushAcks(); startCall(); try { sessionContext.xaEnd(xid, flags); } catch (ActiveMQNotConnectedException ex) { ActiveMQClientLogger.LOGGER.connectionClosedWarn(ex.getType(), ex.getMessage()); if (logger.isDebugEnabled()) { logger.debug(ex.getMessage(), ex); } } finally { endCall(); } } catch (XAException xae) { throw xae; } catch (Throwable t) { ActiveMQClientLogger.LOGGER.errorCallingEnd(t); XAException xaException = new XAException(XAException.XAER_RMFAIL); xaException.initCause(t); throw xaException; } } finally { currentXID = null; } }
Source:
public void namespaceAwareUpsert(SavedPage savedPage) { namespaceAwareUpsert( WikipediaApp.getInstance().getDbOpenHelper().getWritableDatabase(), savedPage, getTableName(), getPrimaryKeySelection(), getPrimaryKeySelectionArgs(savedPage) ); }

Target:
public void namespaceAwareUpsert(SavedPage savedPage) { super.namespaceAwareUpsert( WikipediaApp.getInstance().getDbOpenHelper().getWritableDatabase(), savedPage, getTableName(), getPrimaryKeySelection(), getPrimaryKeySelectionArgs(savedPage) ); }
Source:
private String protectedPathInForeground(String adjustedPath, byte[] data) throws Exception { try { return pathInForeground(adjustedPath, data); } catch ( KeeperException.ConnectionLossException e ) { if ( protectedId != null ) { findAndDeleteProtectedNodeInBackground(adjustedPath, protectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } catch ( KeeperException e ) { throw e; } catch ( Exception e ) { if ( protectedId != null ) { findAndDeleteProtectedNodeInBackground(adjustedPath, protectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } }

Target:
private String protectedPathInForeground(String adjustedPath, byte[] data) throws Exception { try { return pathInForeground(adjustedPath, data); } catch ( Exception e) { if ( ( e instanceof KeeperException.ConnectionLossException || !( e instanceof KeeperException )) && protectedId != null ) { String localProtectedId = protectedId; findAndDeleteProtectedNodeInBackground(adjustedPath, localProtectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } }
Source:
void resolvePluginDependencies() throws IOException { List<Dependency> missingDependencies = new ArrayList<Dependency>(); for (Dependency d : dependencies) { if (parent.getPlugin(d.shortName) == null) missingDependencies.add(d); } if (!missingDependencies.isEmpty()) throw new MissingDependencyException(missingDependencies); for (Dependency d : optionalDependencies) { if (parent.getPlugin(d.shortName) != null) dependencies.add(d); } }

Target:
void resolvePluginDependencies() throws IOException { List<Dependency> missingDependencies = new ArrayList<>(); for (Dependency d : dependencies) { if (parent.getPlugin(d.shortName) == null) missingDependencies.add(d); } if (!missingDependencies.isEmpty()) throw new MissingDependencyException(this.shortName, missingDependencies); for (Dependency d : optionalDependencies) { if (parent.getPlugin(d.shortName) != null) dependencies.add(d); } }
Source:
private boolean hasSunlight(Player p) { World world = p.getWorld(); return (world.getTime() < 12300 || world.getTime() > 23850) && p.getEyeLocation().getBlock().getLightFromSky() == 15; }

Target:
private boolean hasSunlight(Player p) { World world = p.getWorld(); if (world.getEnvironment() != Environment.NORMAL) { return false; } return (world.getTime() < 12300 || world.getTime() > 23850) && p.getEyeLocation().getBlock().getLightFromSky() == 15; }
Source:
public static Properties getConnectionArguments(@Nullable String connectionArguments, @Nullable String user, @Nullable String password) { KeyValueListParser kvParser = new KeyValueListParser("\\s*;\\s*", "="); Map<String, String> connectionArgumentsMap = new HashMap<>(); if (!Strings.isNullOrEmpty(connectionArguments)) { for (KeyValue<String, String> keyVal : kvParser.parse(connectionArguments)) { String key = keyVal.getKey(); String val = keyVal.getValue(); connectionArgumentsMap.put(key, val); } } if (user != null) { connectionArgumentsMap.put("user", user); connectionArgumentsMap.put("password", password); } Properties properties = new Properties(); properties.putAll(connectionArgumentsMap); return properties; }

Target:
public static Properties getConnectionArguments(@Nullable String connectionArguments, @Nullable String user, @Nullable String password) { KeyValueListParser kvParser = new KeyValueListParser("\\s*;\\s*", "="); Map<String, String> connectionArgumentsMap = new HashMap<>(); if (!Strings.isNullOrEmpty(connectionArguments)) { for (KeyValue<String, String> keyVal : kvParser.parse(connectionArguments)) { connectionArgumentsMap.put(keyVal.getKey(), keyVal.getValue()); } } if (user != null) { connectionArgumentsMap.put("user", user); connectionArgumentsMap.put("password", password); } Properties properties = new Properties(); properties.putAll(connectionArgumentsMap); return properties; }
Source:
public AnalysisJobBuilder addSourceColumn(MetaModelInputColumn inputColumn) { if (!_sourceColumns.contains(inputColumn)) { _sourceColumns.add(inputColumn); List<SourceColumnChangeListener> listeners = new ArrayList<>(_sourceColumnListeners); for (SourceColumnChangeListener listener : listeners) { listener.onAdd(inputColumn); } } return this; }

Target:
public AnalysisJobBuilder addSourceColumn(MetaModelInputColumn inputColumn) { if (!_sourceColumns.contains(inputColumn)) { _sourceColumns.add(inputColumn); final List<SourceColumnChangeListener> listeners = new ArrayList<>(_sourceColumnListeners); for (SourceColumnChangeListener listener : listeners) { listener.onAdd(inputColumn); } } return this; }
Source:
public static int secondsToTicks(int seconds) { return 20 * seconds; }

Target:
public static int secondsToTicks(int seconds) { return TICKS_PER_SECOND * seconds; }
Source:
public void removeContainer(final String containerId, final boolean removeVolumes) throws DockerException, InterruptedException { removeContainer(containerId, RemoveContainerParam.removeVolumes()); }

Target:
public void removeContainer(final String containerId, final boolean removeVolumes) throws DockerException, InterruptedException { removeContainer(containerId, RemoveContainerParam.removeVolumes(removeVolumes)); }
Source:
Store getStore(PartitionId id) throws StoreException { BlobStore store = stores.get(id); if (store == null) { throw new StoreException("Could not find partition " + id + " on disk " + disk, StoreErrorCodes.Partition_Not_Found); } if (!store.isStarted()) { throw new StoreException("Store for partition " + id + " on disk " + disk + " has not been started successfully", StoreErrorCodes.Store_Not_Started); } return store; }

Target:
Store getStore(PartitionId id) { BlobStore store = stores.get(id); return (store != null && store.isStarted()) ? store : null; }
Source:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(NAME, ReadResourceNameOperationStepHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute(RELATIVE_TO, null, new PathWriteAttributeHandler(pathManager, RELATIVE_TO, services)); SimpleAttributeDefinition pathAttr = specified ? PATH_SPECIFIED : PATH_NAMED; resourceRegistration.registerReadWriteAttribute(pathAttr, null, new PathWriteAttributeHandler(pathManager, pathAttr, services)); resourceRegistration.registerReadOnlyAttribute(READ_ONLY, null); PathSizeMetricHandler.registerMetric(resourceRegistration, pathManager, PATH, RELATIVE_TO); }

Target:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(NAME, ReadResourceNameOperationStepHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute(RELATIVE_TO, null, new PathWriteAttributeHandler(pathManager, RELATIVE_TO)); SimpleAttributeDefinition pathAttr = specified ? PATH_SPECIFIED : PATH_NAMED; resourceRegistration.registerReadWriteAttribute(pathAttr, null, new PathWriteAttributeHandler(pathManager, pathAttr)); resourceRegistration.registerReadOnlyAttribute(READ_ONLY, null); }
Source:
public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IOException, IndexEntryConflictException { Map<CoordinateReferenceSystem,List<IndexEntryUpdate<?>>> batchMap = new HashMap<>(); for ( IndexEntryUpdate<?> update : updates ) { PointValue point = (PointValue) update.values()[0]; List<IndexEntryUpdate<?>> batch = batchMap.computeIfAbsent( point.getCoordinateReferenceSystem(), k -> new ArrayList<>() ); batch.add( update ); } for ( Map.Entry<CoordinateReferenceSystem,List<IndexEntryUpdate<?>>> entry : batchMap.entrySet() ) { select( entry.getKey() ).add( entry.getValue() ); } }

Target:
public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IOException, IndexEntryConflictException { Map<CoordinateReferenceSystem,List<IndexEntryUpdate<?>>> batchMap = new HashMap<>(); for ( IndexEntryUpdate<?> update : updates ) { PointValue point = (PointValue) update.values()[0]; List<IndexEntryUpdate<?>> batch = batchMap.computeIfAbsent( point.getCoordinateReferenceSystem(), k -> new ArrayList<>() ); batch.add( update ); } for ( Map.Entry<CoordinateReferenceSystem,List<IndexEntryUpdate<?>>> entry : batchMap.entrySet() ) { PartPopulator partPopulator = select( entry.getKey() ); partPopulator.add( entry.getValue() ); } }
Source:
public void uri() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest("POST", "/hotels"); MockHttpServletResponse response = new MockHttpServletResponse(); request.setQueryString("booking=42"); FilterChain filterChain = new NoOpFilterChain(); filter.doFilter(request, response, filterChain); assertThat(filter.beforeRequestMessage).isNotNull(); assertThat(filter.beforeRequestMessage.contains("/hotel")).isTrue(); assertThat(filter.beforeRequestMessage.contains("booking=42")).isFalse(); assertThat(filter.afterRequestMessage).isNotNull(); assertThat(filter.afterRequestMessage.contains("/hotel")).isTrue(); assertThat(filter.afterRequestMessage.contains("booking=42")).isFalse(); }

Target:
public void uri() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("POST", "/hotels"); MockHttpServletResponse response = new MockHttpServletResponse(); request.setQueryString("booking=42"); FilterChain filterChain = new NoOpFilterChain(); filter.doFilter(request, response, filterChain); assertThat(filter.beforeRequestMessage).contains("/hotel"); assertThat(filter.beforeRequestMessage).doesNotContain("booking=42"); assertThat(filter.afterRequestMessage).contains("/hotel"); assertThat(filter.afterRequestMessage).doesNotContain("booking=42"); }
Source:
private HttpRequest signSAS(String method, String container, String name, @Nullable GetOptions options, long expires, @Nullable Long contentLength, @Nullable String contentType) { checkNotNull(method, "method"); checkNotNull(container, "container"); checkNotNull(name, "name"); String nowString = timeStampProvider.get(); Date now = dateService.rfc1123DateParse(nowString); Date expiration = new Date(now.getTime() + TimeUnit.SECONDS.toMillis(expires)); String iso8601 = dateService.iso8601SecondsDateFormat(expiration); String signedPermission; if (method.equals("PUT")) { signedPermission = "w"; } else if (method.equals("DELETE")) { signedPermission = "d"; } else { signedPermission = "r"; } HttpRequest.Builder request = HttpRequest.builder() .method(method) .endpoint(Uris.uriBuilder(storageUrl).appendPath(container).appendPath(name).query(this.credential).build()) .replaceHeader(HttpHeaders.DATE, nowString); if (contentLength != null) { request.replaceHeader(HttpHeaders.CONTENT_LENGTH, contentLength.toString()); } if (contentType != null) { request.replaceHeader("x-ms-blob-content-type", contentType); } if (options != null) { request.headers(options.buildRequestHeaders()); } if (method.equals("PUT")) { request.replaceHeader("x-ms-blob-type", "BlockBlob"); } HttpRequest req = request.build(); return req; }

Target:
private HttpRequest signSAS(String method, String container, String name, @Nullable GetOptions options, long expires, @Nullable Long contentLength, @Nullable String contentType) { checkNotNull(method, "method"); checkNotNull(container, "container"); checkNotNull(name, "name"); String nowString = timeStampProvider.get(); HttpRequest.Builder request = HttpRequest.builder() .method(method) .endpoint(Uris.uriBuilder(storageUrl).appendPath(container).appendPath(name).query(this.credential).build()) .replaceHeader(HttpHeaders.DATE, nowString); request = setHeaders(request, method, options, contentLength, contentType); return request.build(); }
Source:
public List<ArtifactResult> getArtifactsWithDep(String dependency, Collection<String> excludes) throws RepositoryException { Artifact artifact = new DefaultArtifact(dependency); DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter(excludes); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE)); synchronized (repos) { for (RemoteRepository repo : repos) { collectRequest.addRepository(repo); } } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); try { return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); } catch (Exception ex) { throw new RepositoryException( String.format("Cannot fetch dependencies for %s", dependency), ex); } }

Target:
public List<ArtifactResult> getArtifactsWithDep(String dependency, Collection<String> excludes) throws RepositoryException { Artifact artifact = new DefaultArtifact(dependency); DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter(excludes); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE)); synchronized (repos) { for (RemoteRepository repo : repos) { collectRequest.addRepository(repo); } } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); try { return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); } catch (NullPointerException | DependencyResolutionException ex) { throw new RepositoryException( String.format("Cannot fetch dependencies for %s", dependency), ex); } }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: double otherDoubleValue = ((IntegerStateValue) object).unboxInt(); result = Double.compare(this.value, otherDoubleValue); break; case DOUBLE: otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: otherDoubleValue = ((LongStateValue) object).unboxLong(); result = Double.compare(this.value, otherDoubleValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { throw new StateValueTypeException("A Double state value cannot be compared to null."); } switch (object.getType()) { case INTEGER: double otherDoubleValue = ((IntegerStateValue) object).unboxInt(); return Double.compare(this.value, otherDoubleValue); case DOUBLE: otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); return Double.compare(this.value, otherDoubleValue); case LONG: otherDoubleValue = ((LongStateValue) object).unboxLong(); return Double.compare(this.value, otherDoubleValue); case NULL: return 1; case STRING: throw new StateValueTypeException("A Double state value cannot be compared to a String state value."); default: return 0; } }
Source:
private static boolean hasIrregularPattern(String literalValue) { List<String> groups = Arrays.asList(cleanup(literalValue).split("_")); return groups.size() > 1 && groups.subList(1, groups.size()).stream() .map(String::length) .distinct() .count() != 1; }

Target:
private static boolean hasIrregularPattern(String literalValue) { List<String> groups = Arrays.asList(cleanup(literalValue).split("_")); if (groups.size() <= 1) { return false; } int firstGroupLength = groups.get(0).length(); List<Integer> lengths = groups.stream().skip(1).map(String::length).distinct().collect(Collectors.toList()); return lengths.size() != 1 || lengths.get(0) < firstGroupLength; }