auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ZkBaseDataAccessor(String zkAddress, ZkSerializer zkSerializer) { _zkClient = new ZkClient.Builder() .setConnection(new ZkConnection(zkAddress, ZkClient.DEFAULT_SESSION_TIMEOUT)) .setZkSerializer(zkSerializer).build(); }

Target:
public ZkBaseDataAccessor(String zkAddress, ZkSerializer zkSerializer) { _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(zkSerializer)); }
Source:
private ImmutableMap<String, String> parseAttributeAndValuePairs(List<String> pairs) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); pairs .stream() .map(str -> str.split("=", 2)) .filter( (list) -> { if (list.length <= 1) { LOGGER.debug("Filtered out invalid attribute/value pair: {}", list[0]); return false; } return true; }) .forEach(list -> builder.put(list[0].trim(), list[1].trim())); return builder.build(); }

Target:
private ImmutableMap<String, String> parseAttributeAndValuePairs(List<String> pairs) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); pairs .stream() .map(str -> str.split("=", 2)) .filter(AttributeAliasesImpl::isValidConfig) .forEach(list -> builder.put(list[0].trim(), list[1].trim())); return builder.build(); }
Source:
Mono<Response<ConfigurationSetting>> clearReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.unlockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnRequest(ignoredValue -> logger.info("Clearing read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Cleared read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.info("Failed to clear read only ConfigurationSetting - {}", setting, error)); }

Target:
Mono<Response<ConfigurationSetting>> clearReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.unlockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnSubscribe(ignoredValue -> logger.verbose("Clearing read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Cleared read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to clear read only ConfigurationSetting - {}", setting, error)); }
Source:
public void cancel() { try { Field field = FileWatchdog.class.getDeclaredField("interrupted"); field.setAccessible(true); field.set(this, true); } catch (ReflectiveOperationException cause) { throw new Error("Cannot cancel log4j watchdog", cause); } }

Target:
public void cancel() { try { Field field = FileWatchdog.class.getDeclaredField("interrupted"); field.setAccessible(true); field.set(this, true); } catch (ReflectiveOperationException cause) { throw new RuntimeException("Cannot cancel log4j watchdog", cause); } }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (!(receiver instanceof IResource)) return false; IResource res = (IResource) receiver; if ("isShared".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && mapping.getRepository() != null; } else if ("isSafe".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return SAFE == mapping.getRepository().getRepositoryState(); } return false; }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (!(receiver instanceof IResource)) return false; IResource res = (IResource) receiver; if ("isShared".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && mapping.getRepository() != null; } else if ("isSafe".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && SAFE == mapping.getRepository().getRepositoryState(); } return false; }
Source:
public static boolean isNumber(@Nullable ASTNode t) { if (t != null) { String text = t.getText(); char firstChar = text.charAt(0); if (Character.isDigit(firstChar) || '+' == firstChar || '-' == firstChar) { return isInteger(text) || isFloat(text); } } return false; }

Target:
public static boolean isNumber(@Nullable ASTNode t) { if (t != null) { String text = t.getText(); char firstChar = text.charAt(0); if (Character.isDigit(firstChar) || '.' == firstChar || '-' == firstChar || '+' == firstChar) { return isInteger(text) || isFloat(text); } } return false; }
Source:
public void returnsMethodIsNotAllowedForUnsupportedMethods() throws IOException { new FtRemote(new TkMethods(new TkEmpty(), "PUT")).exec( url -> new JdkRequest(url) .method("POST") .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_BAD_METHOD) ); }

Target:
public void returnsMethodIsNotAllowedForUnsupportedMethods() throws IOException { new FtRemote(new TkMethods(new TkEmpty(), RqMethod.PUT)).exec( url -> new JdkRequest(url) .method(RqMethod.POST) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_BAD_METHOD) ); }
Source:
public InputStream body() throws IOException { return new ByteArrayInputStream( this.body.getBytes(StandardCharsets.UTF_8) ); }

Target:
public InputStream body() { return new ByteArrayInputStream( this.body.getBytes(StandardCharsets.UTF_8) ); }
Source:
public List<ReplicaId> getPeerReplicaIds() { List<ReplicaId> replicasOfPartition = new ArrayList<>(); for (ReplicaId replicaId : partitionId.getReplicaIds()) { if (replicaId.getDataNodeId().getHostname().equals(dataNodeId.getHostname()) && replicaId.getDataNodeId().getPort() == dataNodeId.getPort()) { continue; } replicasOfPartition.add(replicaId); } return replicasOfPartition; }

Target:
public List<ReplicaId> getPeerReplicaIds() { List<ReplicaId> replicasOfPartition = partitionId.getReplicaIds() .stream() .filter(replica -> replica.getDataNodeId().compareTo(dataNodeId) != 0) .collect(Collectors.toList()); return replicasOfPartition; }
Source:
public void test_switchToBranchWithBinaryAttributes() throws Exception { Git git = Git.wrap(db); setupGitAndDoHardReset(AutoCRLF.FALSE, EOL.LF, null, null, "file1.txt binary\nfile2.txt binary\nfile3.txt binary"); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); createAndAddFile(git, ".gitattributes", "file1.txt text\nfile2.txt binary\nfile3.txt binary"); git.commit().setMessage("switchedToTextFor1").call(); recreateWorktree(git); collectRepositoryState(); assertEquals("text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryLF.attrs); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryMixed.attrs); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); git.checkout().setName(db.resolve("HEAD^").getName()).call(); recreateWorktree(git); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); }

Target:
public void test_switchToBranchWithBinaryAttributes() throws Exception { Git git = Git.wrap(db); setupGitAndDoHardReset(AutoCRLF.FALSE, EOL.LF, null, null, "file1.txt binary\nfile2.txt binary\nfile3.txt binary"); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); createAndAddFile(git, ".gitattributes", "file1.txt text\nfile2.txt binary\nfile3.txt binary"); gitCommit(git, "switchedToTextFor1"); recreateWorktree(git); collectRepositoryState(); assertEquals("text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryLF.attrs); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryMixed.attrs); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); gitCheckout(git, "HEAD^"); recreateWorktree(git); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); }
Source:
private <T> T getReference(String refName) throws NamingException { if (cachedJNDIReferences.containsKey(refName)) { return (T) cachedJNDIReferences.get(refName); } Object reference = getInitialContext().lookup(refName); cachedJNDIReferences.put(refName, reference); return (T) reference; }

Target:
private synchronized <T> T getReference(String refName) throws NamingException { T reference = (T) cachedJNDIReferences.get(refName); if (reference != null) { return reference; } reference = (T) getInitialContext().lookup(refName); cachedJNDIReferences.put(refName, reference); return reference; }
Source:
public void search() { if (getEntity() != null) super.search(); }

Target:
public void search() { if (getEntity() != null) { super.search(); } }
Source:
public JMXConnection(@Nullable JMXConnector connector, @Nonnull MBeanServerConnection mBeanServerConnection) { this.connector = connector; this.mBeanServerConnection = mBeanServerConnection; this.markedAsDestroyed = false; executor = Executors.newSingleThreadExecutor(); }

Target:
public JMXConnection(@Nullable JMXConnector connector, @Nonnull MBeanServerConnection mBeanServerConnection) { this.connector = connector; this.mBeanServerConnection = mBeanServerConnection; this.markedAsDestroyed = false; }
Source:
public Object execute() throws Exception { final CompletableFuture<Requisition> future = client.requisition() .withRequisitionProviderType(type) .withParameters(parse(parameters)) .withLocation(location) .withSystemId(systemId) .withTimeToLive(ttlInMs) .execute(); while (true) { try { try { Requisition requisition = future.get(1, TimeUnit.SECONDS); if (xmlOutput && !Strings.isNullOrEmpty(requisition.getForeignSource())) { return JaxbUtils.marshal(requisition); } else { return requisition; } } catch (InterruptedException e) { System.out.println("\nInterrupted."); } catch (ExecutionException e) { System.out.printf("\nRequisition retrieval failed with: %s\n", e); } break; } catch (TimeoutException e) { } System.out.print("."); System.out.flush(); } return null; }

Target:
public Object execute() throws Exception { final CompletableFuture<Requisition> future = client.requisition() .withRequisitionProviderType(type) .withParameters(parse(parameters)) .withLocation(location) .withSystemId(systemId) .withTimeToLive(ttlInMs) .execute(); while (true) { try { try { Requisition requisition = future.get(1, TimeUnit.SECONDS); if(importRequisition) { System.out.println(); ImportRequisition.sendImportRequisitionEvent(eventForwarder, type, parameters, null); System.out.println(); } if (xmlOutput) { return JaxbUtils.marshal(requisition); } else { return requisition; } } catch (InterruptedException e) { System.out.println("\nInterrupted."); } catch (ExecutionException e) { System.out.printf("\nRequisition retrieval failed with: %s\n", e); e.printStackTrace(); } break; } catch (TimeoutException e) { } System.out.print("."); System.out.flush(); } return null; }
Source:
private void finalizeFile( File file, File processFile ) throws IOException { if ( isKeepBackup() && !isDryRun() ) { File backupFile = FileUtil.getBackupFile( file ); if ( backupFile.exists() ) { FileUtil.deleteFile( backupFile ); } if ( isVerbose() ) { LOG.debug( " - backup original file {}", file ); } Files.copy( file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES ); } if ( isDryRun() ) { FileUtil.deleteFile( processFile ); } else { try { String updatedContent = FileUtil.readAsString( processFile, getEncoding() ); FileUtil.printString( file, updatedContent, getEncoding() ); FileUtil.deleteFile( processFile ); } catch ( IOException e ) { LOG.warn( "Error updating -> {}", processFile, file, e ); } } }

Target:
private void finalizeFile( File file, File processFile ) throws IOException { if ( isKeepBackup() && !isDryRun() ) { File backupFile = FileUtil.getBackupFile( file ); if ( backupFile.exists() ) { FileUtil.deleteFile( backupFile ); } LOG.debug( " - backup original file {}", file ); Files.copy( file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES ); } if ( isDryRun() ) { FileUtil.deleteFile( processFile ); } else { try { String updatedContent = FileUtil.readAsString( processFile, getEncoding() ); FileUtil.printString( file, updatedContent, getEncoding() ); FileUtil.deleteFile( processFile ); } catch ( IOException e ) { LOG.warn( "Error updating -> {}", processFile, file, e ); } } }
Source:
public List<WorkspaceMetacardImpl> getWorkspaceMetacards() { final QueryRequest queryRequest = createQueryRequestForSubscribedToWorkspaces(); if (queryRequest != null) { try { return createWorkspaceMetacards(query(queryRequest)); } catch (CatalogQueryException e) { LOGGER.warn("Error querying for workspaces", e); } } return Collections.emptyList(); }

Target:
public List<WorkspaceMetacardImpl> getWorkspaceMetacards() { return createQueryRequestForSubscribedToWorkspaces() .map(this::queryRequestToWorkspaceMetacards) .orElse(Collections.emptyList()); }
Source:
public TypeSpec createTypeAdapter(ClassName className, ClassName autoValueClassName, List<Property> properties) { ClassName jsonAdapter = ClassName.get(JsonAdapter.class); TypeName typeAdapterClass = ParameterizedTypeName.get(jsonAdapter, autoValueClassName); ImmutableMap<Property, FieldSpec> adapters = createFields(properties); FieldSpec moshiField = FieldSpec.builder(Moshi.class, "moshi", PRIVATE, FINAL).build(); MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addParameter(Moshi.class, "moshi") .addStatement("this.$N = moshi", moshiField); for (Map.Entry<Property, FieldSpec> entry : adapters.entrySet()) { Property prop = entry.getKey(); FieldSpec field = entry.getValue(); if (entry.getKey().type instanceof ParameterizedTypeName) { constructor.addStatement("this.$N = moshi.adapter($L)", field, makeType((ParameterizedTypeName) prop.type)); } else { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; constructor.addStatement("this.$N = moshi.adapter($T.class)", field, type); } } String customTypeAdapterClass = String.format("AutoValue_%sJsonAdapter", autoValueClassName.simpleName()); TypeSpec.Builder classBuilder = TypeSpec.classBuilder(customTypeAdapterClass) .addModifiers(PUBLIC, STATIC, FINAL) .addModifiers(PUBLIC, STATIC, FINAL) .superclass(typeAdapterClass) .addField(moshiField) .addFields(adapters.values()) .addMethod(constructor.build()) .addMethod(createReadMethod(moshiField, className, autoValueClassName, adapters)) .addMethod(createWriteMethod(moshiField, autoValueClassName, adapters)); return classBuilder.build(); }

Target:
public TypeSpec createTypeAdapter(ClassName className, ClassName autoValueClassName, List<Property> properties) { ClassName jsonAdapter = ClassName.get(JsonAdapter.class); TypeName typeAdapterClass = ParameterizedTypeName.get(jsonAdapter, autoValueClassName); ImmutableMap<Property, FieldSpec> adapters = createFields(properties); MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addParameter(Moshi.class, "moshi"); for (Map.Entry<Property, FieldSpec> entry : adapters.entrySet()) { Property prop = entry.getKey(); FieldSpec field = entry.getValue(); if (entry.getKey().type instanceof ParameterizedTypeName) { constructor.addStatement("this.$N = moshi.adapter($L)", field, makeType((ParameterizedTypeName) prop.type)); } else { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; constructor.addStatement("this.$N = moshi.adapter($T.class)", field, type); } } String customTypeAdapterClass = String.format("AutoValue_%sJsonAdapter", autoValueClassName.simpleName()); TypeSpec.Builder classBuilder = TypeSpec.classBuilder(customTypeAdapterClass) .addModifiers(PUBLIC, STATIC, FINAL) .addModifiers(PUBLIC, STATIC, FINAL) .superclass(typeAdapterClass) .addFields(adapters.values()) .addMethod(constructor.build()) .addMethod(createReadMethod(className, autoValueClassName, adapters)) .addMethod(createWriteMethod(autoValueClassName, adapters)); return classBuilder.build(); }
Source:
private void addModule(File script, String extension) { final String METHOD_NAME = "addModule(File)"; ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (null == engine) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.WARNING, "Could not find script engine for extension " + extension); return; } try { Reader fileReader = new FileReader(script); engine.eval(fileReader); Iterable<?> plugins = (Iterable<?>) engine.eval("getPlugins()"); for (Object p : plugins) { if (p instanceof MekHQModule) { modules.add((MekHQModule) p); } } fileReader.close(); } catch (IOException | ScriptException e) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "While parsing script " + script.getName()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e); } }

Target:
private void addModule(File script, String extension) { final String METHOD_NAME = "addModule(File)"; ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (null == engine) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.WARNING, "Could not find script engine for extension " + extension); return; } try (Reader fileReader = new FileReader(script)) { engine.eval(fileReader); Iterable<?> plugins = (Iterable<?>) engine.eval("getPlugins()"); for (Object p : plugins) { if (p instanceof MekHQModule) { modules.add((MekHQModule) p); } } } catch (IOException | ScriptException e) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "While parsing script " + script.getName()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e); } }
Source:
public void setProperty( String key, Object value ) { KernelTransaction transaction = actions.kernelTransaction(); int propertyKeyId; try { propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key ); } catch ( IllegalTokenNameException e ) { throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e ); } try ( Statement ignore = transaction.acquireStatement() ) { transaction.dataWrite().relationshipSetProperty( id, propertyKeyId, Values.of( value, false ) ); } catch ( ConstraintValidationException e ) { throw new ConstraintViolationException( e.getUserMessage( new SilentTokenNameLookup( transaction.tokenRead() ) ), e ); } catch ( IllegalArgumentException e ) { actions.failTransaction(); throw e; } catch ( EntityNotFoundException e ) { throw new NotFoundException( e ); } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while setting property: " + e.getMessage(), e ); } catch ( KernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } }

Target:
public void setProperty( String key, Object value ) { KernelTransaction transaction = actions.kernelTransaction(); int propertyKeyId; try { propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key ); } catch ( IllegalTokenNameException e ) { throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e ); } try ( Statement ignore = transaction.acquireStatement() ) { transaction.dataWrite().relationshipSetProperty( id, propertyKeyId, Values.of( value, false ) ); } catch ( IllegalArgumentException e ) { actions.failTransaction(); throw e; } catch ( EntityNotFoundException e ) { throw new NotFoundException( e ); } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while setting property: " + e.getMessage(), e ); } }
Source:
public void onStarted(Run<?, ?> build, TaskListener listener) { if (build instanceof MatrixBuild) return; Job<?, ?> proj = Utils.getProject(build); List<LockableResource> required = new ArrayList<LockableResource>(); if (proj != null) { LockableResourcesStruct resources = Utils.requiredResources(proj); if (resources != null) { if (resources.requiredNumber != null || !resources.label.isEmpty()) { required = LockableResourcesManager.get(). getResourcesFromProject(proj.getFullName()); } else { required = resources.required; } if (LockableResourcesManager.get().lock(required, build, null)) { build.addAction(LockedResourcesBuildAction .fromResources(required)); listener.getLogger().printf("%s acquired lock on %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " acquired lock on " + required); if (resources.requiredVar != null) { build.addAction(new ResourceVariableNameAction(new StringParameterValue( resources.requiredVar, required.toString().replaceAll("[\\]\\[]", "")))); } } else { listener.getLogger().printf("%s failed to lock %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " failed to lock " + required); } } } }

Target:
public void onStarted(Run<?, ?> build, TaskListener listener) { if (build instanceof MatrixBuild) return; if (build instanceof AbstractBuild) { Job<?, ?> proj = Utils.getProject(build); List<LockableResource> required = new ArrayList<LockableResource>(); if (proj != null) { LockableResourcesStruct resources = Utils.requiredResources(proj); if (resources != null) { if (resources.requiredNumber != null || !resources.label.isEmpty()) { required = LockableResourcesManager.get(). getResourcesFromProject(proj.getFullName()); } else { required = resources.required; } if (LockableResourcesManager.get().lock(required, build, null)) { build.addAction(LockedResourcesBuildAction .fromResources(required)); listener.getLogger().printf("%s acquired lock on %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " acquired lock on " + required); if (resources.requiredVar != null) { build.addAction(new ResourceVariableNameAction(new StringParameterValue( resources.requiredVar, required.toString().replaceAll("[\\]\\[]", "")))); } } else { listener.getLogger().printf("%s failed to lock %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " failed to lock " + required); } } } } return; }
Source:
private OperationResult applyCommand(long index, long sequence, long timestamp, RaftOperation operation, RaftSessionContext session) { if (nextRevision != null) { switch (nextRevision.revision().propagationStrategy()) { case VERSION: return OperationResult.failed( index, session.getEventIndex(), new RaftException.ReadOnly(serviceName() + " revision " + revision.revision() + " is read-only")); case PROPAGATE: locked = true; nextRevision.applyCommand(index, sequence, timestamp, operation, session); locked = false; break; default: break; } } tick(index, timestamp); Commit<byte[]> commit = new DefaultCommit<>(index, operation.id(), operation.value(), session, timestamp); long eventIndex = session.getEventIndex(); OperationResult result; try { byte[] output = service.apply(commit); result = OperationResult.succeeded(index, eventIndex, output); } catch (Exception e) { result = OperationResult.failed(index, eventIndex, e); } commit(); session.registerResult(sequence, result); session.setCommandSequence(sequence); return result; }

Target:
private OperationResult applyCommand(long index, long sequence, long timestamp, RaftOperation operation, RaftSessionContext session) { if (nextRevision != null) { switch (nextRevision.revision().propagationStrategy()) { case VERSION: return OperationResult.failed( index, session.getEventIndex(), new RaftException.ReadOnly(serviceName() + " revision " + revision.revision() + " is read-only")); case PROPAGATE: locked = true; try { nextRevision.applyCommand(index, sequence, timestamp, operation, session); } finally { locked = false; } break; default: break; } } tick(index, timestamp); Commit<byte[]> commit = new DefaultCommit<>(index, operation.id(), operation.value(), session, timestamp); long eventIndex = session.getEventIndex(); OperationResult result; try { byte[] output = service.apply(commit); result = OperationResult.succeeded(index, eventIndex, output); } catch (Exception e) { result = OperationResult.failed(index, eventIndex, e); } commit(); session.registerResult(sequence, result); session.setCommandSequence(sequence); return result; }
Source:
public void testAppendStreamDoesNotOverwriteTableConfig() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Integer> elements = env.fromElements(1, 2, 3); StreamTableEnvironmentImpl tEnv = getStreamTableEnvironment(env, elements); Time minRetention = Time.minutes(1); Time maxRetention = Time.minutes(10); tEnv.getConfig().setIdleStateRetentionTime(minRetention, maxRetention); Table table = tEnv.fromDataStream(elements); tEnv.toAppendStream(table, Row.class); assertThat( tEnv.getConfig().getMinIdleStateRetentionTime(), equalTo(minRetention.toMilliseconds())); assertThat( tEnv.getConfig().getMaxIdleStateRetentionTime(), equalTo(minRetention.toMilliseconds() * 3 / 2)); }

Target:
public void testAppendStreamDoesNotOverwriteTableConfig() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Integer> elements = env.fromElements(1, 2, 3); StreamTableEnvironmentImpl tEnv = getStreamTableEnvironment(env, elements); Duration minRetention = Duration.ofMinutes(1); tEnv.getConfig().setIdleStateRetention(minRetention); Table table = tEnv.fromDataStream(elements); tEnv.toAppendStream(table, Row.class); assertEquals(minRetention, tEnv.getConfig().getIdleStateRetention()); }
Source:
private Sniffer createSniffer(String scopeName, RestClient client, Properties properties) { String propertyPrefix = propertyPrefix( scopeName ); boolean discoveryEnabled = ConfigurationParseHelper.getBooleanValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_ENABLED, ElasticsearchEnvironment.Defaults.DISCOVERY_ENABLED ); if ( discoveryEnabled ) { SnifferBuilder builder = Sniffer.builder( client ) .setSniffIntervalMillis( ConfigurationParseHelper.getIntValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_REFRESH_INTERVAL, ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL ) * 1_000 ); String scheme = ConfigurationParseHelper.getString(properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_SCHEME, "http"); if ( scheme.equals(ElasticsearchHostsSniffer.Scheme.HTTPS.toString()) ) { HostsSniffer hostsSniffer = new ElasticsearchHostsSniffer( client, ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL * 1_000, ElasticsearchHostsSniffer.Scheme.HTTPS ); builder.setHostsSniffer( hostsSniffer ); } return builder.build(); } else { return null; } }

Target:
private Sniffer createSniffer(String scopeName, RestClient client, Properties properties) { String propertyPrefix = propertyPrefix( scopeName ); boolean discoveryEnabled = ConfigurationParseHelper.getBooleanValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_ENABLED, ElasticsearchEnvironment.Defaults.DISCOVERY_ENABLED ); if ( discoveryEnabled ) { SnifferBuilder builder = Sniffer.builder( client ) .setSniffIntervalMillis( ConfigurationParseHelper.getIntValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_REFRESH_INTERVAL, ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL ) * 1_000 ); String scheme = ConfigurationParseHelper.getString(properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_SCHEME, "http"); if ( scheme.equals(ElasticsearchHostsSniffer.Scheme.HTTPS.toString()) ) { HostsSniffer hostsSniffer = new ElasticsearchHostsSniffer( client, ElasticsearchHostsSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT, ElasticsearchHostsSniffer.Scheme.HTTPS ); builder.setHostsSniffer( hostsSniffer ); } return builder.build(); } else { return null; } }
Source:
public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments) throws EntryProcessorException { checkNotClosed(); checkNotNull(key, "key"); checkNotNull(entryProcessor, "entryProcessor"); if (log.isTraceEnabled()) log.tracef("Invoke entry processor %s for key=%s", entryProcessor, key); V oldValue = cacheWithCacheStore.get(key); MutableJCacheEntry<K, V> mutable = createMutableCacheEntry(oldValue, key); T ret = processEntryProcessor(mutable, entryProcessor, arguments); switch (mutable.getOperation()) { case NONE: Thread.dumpStack(); break; case ACCESS: Thread.dumpStack(); updateTTLForAccessed(cache, key, oldValue); break; case UPDATE: Thread.dumpStack(); V newValue = mutable.getNewValue(); if (newValue == null) { throw new EntryProcessorException(); } if (oldValue != null) { replace(cache, cache, key, oldValue, newValue, true); } else { put(cache, cache, key, newValue, true); } writeToCacheWriter(key, newValue); break; case REMOVE: cache.remove(key); removeFromCacheWriter(key); break; } return ret; }

Target:
public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments) throws EntryProcessorException { checkNotClosed(); checkNotNull(key, "key"); checkNotNull(entryProcessor, "entryProcessor"); if (log.isTraceEnabled()) log.tracef("Invoke entry processor %s for key=%s", entryProcessor, key); V oldValue = cacheWithCacheStore.get(key); MutableJCacheEntry<K, V> mutable = createMutableCacheEntry(oldValue, key); T ret = processEntryProcessor(mutable, entryProcessor, arguments); switch (mutable.getOperation()) { case NONE: break; case ACCESS: updateTTLForAccessed(cache, key, oldValue); break; case UPDATE: V newValue = mutable.getNewValue(); if (newValue == null) { throw new EntryProcessorException(); } if (oldValue != null) { replace(cache, cache, key, oldValue, newValue, true); } else { put(cache, cache, key, newValue, true); } writeToCacheWriter(key, newValue); break; case REMOVE: cache.remove(key); removeFromCacheWriter(key); break; } return ret; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(event).getFirstElement(); final Repository repo = getRepository(event); try { PushBranchWizard wizard = null; Ref localBranch = null; for (int i = 0; i < commit.getRefCount(); i++) { Ref currentRef = commit.getRef(i); if (localBranch == null && currentRef.getName().startsWith(Constants.R_HEADS)) { localBranch = currentRef; } } if (localBranch == null) { wizard = new PushBranchWizard(repo, commit.getId()); } else { wizard = new PushBranchWizard(repo, localBranch); } WizardDialog dlg = new WizardDialog( HandlerUtil.getActiveShellChecked(event), wizard); dlg.setHelpAvailable(true); dlg.open(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, true); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(event).getFirstElement(); final Repository repo = getRepository(event); try { PushBranchWizard wizard = null; Ref localBranch = null; for (int i = 0; i < commit.getRefCount(); i++) { Ref currentRef = commit.getRef(i); if (localBranch == null && currentRef.getName().startsWith(Constants.R_HEADS)) localBranch = currentRef; } if (localBranch == null) wizard = new PushBranchWizard(repo, commit.getId()); else wizard = new PushBranchWizard(repo, localBranch); WizardDialog dlg = new WizardDialog( HandlerUtil.getActiveShellChecked(event), wizard); dlg.setHelpAvailable(true); dlg.open(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, true); } return null; }
Source:
public String getPrefixedText() { return namespace == null || namespace.length() == 2 ? getText() : StringUtil.addUnderscores(namespace) + ":" + getText(); }

Target:
public String getPrefixedText() { return namespace == null ? getText() : StringUtil.addUnderscores(namespace) + ":" + getText(); }
Source:
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) { ValidationResult result = new ValidationResult(); try { javaBuilder = new JavaBuilder(); javaBuilder.setSavedProject(resource.getProject()); javaBuilder.build(kind, null, monitor); } catch (CoreException e) { e.printStackTrace(); } return result; }

Target:
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) { ValidationResult result = new ValidationResult(); JavaProject project = (JavaProject) JavaScriptCore.create(resource.getProject()); INameEnvironment nameEnvironment = new NameEnvironment(project); Compiler compiler = newCompiler(project, nameEnvironment); if (resource instanceof IFile && resource.getFileExtension().equalsIgnoreCase("js")) { SourceFile sf = findSourceFile((IFile) resource, true, nameEnvironment); compiler.compile(new ICompilationUnit[]{ sf }); for (CategorizedProblem problem : resourceProblems) { ValidatorMessage vm = ValidatorMessage.create(problem.getMessage(), resource); vm.setAttribute(IMarker.SEVERITY, problem.isError() ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING); vm.setType(problem.getMarkerType()); vm.setAttribute(IMarker.LINE_NUMBER, problem.getSourceLineNumber()); vm.setAttribute(IMarker.CHAR_START, problem.getSourceStart()); vm.setAttribute(IMarker.CHAR_END, problem.getSourceEnd() + 1); result.add(vm); } } return result; }
Source:
private Status waitForJobFinish(String jobId, long timeoutInSeconds) { long timeout = 1000L * timeoutInSeconds; long checkInterval = 1000L * 1; long startTime = System.currentTimeMillis(); List<Status> jobFinishedStatuses = Lists.newArrayList(Status.SUCCEEDED, Status.FAILED, Status.KILLED, Status.SUSPENDED); while ((System.currentTimeMillis()-startTime)<timeout) { Status status; try { Thread.sleep(checkInterval); status = oozieClient.getJobInfo(jobId).getStatus(); } catch (OozieClientException e) { throw new RuntimeException("Unable to check oozie job status", e); } catch (InterruptedException e) { throw new RuntimeException(e); } if (jobFinishedStatuses.contains(status)) { return status; } System.out.println("Job " + jobId + " is still running with status: " + status + " [" + (System.currentTimeMillis()-startTime) + " ms]"); } try { log.info(oozieClient.getJobLog(jobId)); } catch (OozieClientException e) { log.warn("Unable to check job log"); } Assert.fail("Execution of job " + jobId + " exceeded waiting time limit"); return null; }

Target:
private Status waitForJobFinish(String jobId, long timeoutInSeconds) { long timeout = 1000L * timeoutInSeconds; long checkInterval = 1000L * 1; long startTime = System.currentTimeMillis(); List<Status> jobFinishedStatuses = Lists.newArrayList(Status.SUCCEEDED, Status.FAILED, Status.KILLED, Status.SUSPENDED); while ((System.currentTimeMillis()-startTime)<timeout) { Status status; try { Thread.sleep(checkInterval); status = oozieClient.getJobInfo(jobId).getStatus(); } catch (OozieClientException e) { throw new RuntimeException("Unable to check oozie job status", e); } catch (InterruptedException e) { throw new RuntimeException(e); } if (jobFinishedStatuses.contains(status)) { return status; } System.out.println("Job " + jobId + " is still running with status: " + status + " [" + (System.currentTimeMillis()-startTime) + " ms]"); } printOozieJobLog(jobId); Assert.fail("Execution of job " + jobId + " exceeded waiting time limit"); return null; }
Source:
void receiveTwoMessagesAutoComplete(MessagingEntityType entityType, boolean isSessionEnabled) { final int entityIndex = 0; setSenderAndReceiver(entityType, entityIndex, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); Mono.when(sendMessage(message), sendMessage(message)).block(TIMEOUT); StepVerifier.create(receiver.receiveMessages()) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); }) .thenCancel() .verify(); }

Target:
void receiveTwoMessagesAutoComplete(MessagingEntityType entityType, boolean isSessionEnabled) { final int entityIndex = 0; final boolean shareConnection = false; final boolean useCredentials = false; this.sender = getSenderBuilder(useCredentials, entityType, entityIndex, isSessionEnabled, shareConnection) .buildAsyncClient(); if (isSessionEnabled) { assertNotNull(sessionId, "'sessionId' should have been set."); this.receiver = getSessionReceiverBuilder(useCredentials, entityType, entityIndex, shareConnection) .buildAsyncClient().acceptSession(sessionId).block(); } else { this.receiver = getReceiverBuilder(useCredentials, entityType, entityIndex, shareConnection) .buildAsyncClient(); } final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); Mono.when(sendMessage(message), sendMessage(message)).block(TIMEOUT); StepVerifier.create(receiver.receiveMessages()) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); }) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); }) .thenCancel() .verify(); }
Source:
Function<Integer,Boolean> getPropertyPermissions( Set<String> roles, Token token ) { if ( propertyAuthorization ) { PrimitiveIntSet blackListed = Primitive.intSet(); for ( String role : roles ) { if ( roleToPropertyBlacklist.containsKey( role ) ) { assert roleToPropertyBlacklist.get( role ) != null : "Blacklist has to contain properties"; for ( String propName : roleToPropertyBlacklist.get( role ) ) { try { blackListed.add( token.propertyKeyGetOrCreateForName( propName ) ); } catch ( IllegalTokenNameException e ) { e.printStackTrace(); } } } } return property -> !blackListed.contains( property ); } else { return property -> true; } }

Target:
IntPredicate getPropertyPermissions( Set<String> roles, Token token ) { if ( propertyAuthorization ) { PrimitiveIntSet blackListed = Primitive.intSet(); for ( String role : roles ) { if ( roleToPropertyBlacklist.containsKey( role ) ) { assert roleToPropertyBlacklist.get( role ) != null : "Blacklist has to contain properties"; for ( String propName : roleToPropertyBlacklist.get( role ) ) { try { blackListed.add( token.propertyKeyGetOrCreateForName( propName ) ); } catch ( IllegalTokenNameException e ) { securityLog.error( "Error in setting up property permissions, '" + propName + "' is not a valid property name." ); } } } } return property -> !blackListed.contains( property ); } else { return property -> true; } }
Source:
public void makeDirectoryTestCallHostPlugingReturningSomething() { boolean makeDirectoryReturn = configureAndExecuteMakeDirectoryMethodForTest(pathMock, "Soemthing"); assertTrue(makeDirectoryReturn); }

Target:
public void makeDirectoryTestCallHostPlugingReturningSomething() { boolean makeDirectoryReturn = configureAndExecuteMakeDirectoryMethodForTest(pathMock, "/fictitious/path/to/use/in/unit/test"); assertTrue(makeDirectoryReturn); }
Source:
public Set<String> getUnmatchedLabels() { return Collections.unmodifiableSet(unmatchedLabels); }

Target:
public synchronized Set<String> getUnmatchedLabels() { return Collections.unmodifiableSet(unmatchedLabels); }
Source:
public void afterClass() throws IOException { if(BooleanUtils.isTrue(bucketsEnabled)) { IntegrationTestHelper.cleanupTestBucket(mantaClient, bucketsTestPathPrefix); } else { IntegrationTestConfigContext.cleanupTestDirectory(mantaClient, testPathPrefix); } }

Target:
public void afterClass() throws IOException { IntegrationTestHelper.cleanupTestBucketOrDirectory(mantaClient, testPathPrefix); }
Source:
private Boolean isVideoPaused() { return Boolean.valueOf(usingImaBridge(webDriver -> { final JavascriptActions js = new JavascriptActions(); return js.execute("document.querySelector('video') && document.querySelector('video').paused").toString(); })); }

Target:
private Boolean isVideoPaused() { return isDesktop() ? isDesktopVideoPaused() : isMobileVideoPaused(); }
Source:
public void initialize(TransformContext context) throws Exception { super.initialize(context); parseConfiguration(config.decompressor); try { outSchema = Schema.parseJson(config.schema); List<Field> outFields = outSchema.getFields(); for (Field field : outFields) { outSchemaMap.put(field.getName(), field.getSchema().getType()); } } catch (IOException e) { throw new IllegalArgumentException("Format of schema specified is invalid. Please check the format."); } }

Target:
public void initialize(TransformContext context) throws Exception { super.initialize(context); parseConfiguration(config.decompressor); try { outSchema = Schema.parseJson(config.schema); List<Field> outFields = outSchema.getFields(); for (Field field : outFields) { outSchemaMap.put(field.getName(), field.getSchema().getType()); } } catch (IOException e) { throw new IllegalArgumentException("Format of schema specified is invalid. Please check the format." + e.getMessage()); } }
Source:
private boolean isLoggedStoreValid(String storeName, File loggedStoreDir) { long changeLogDeleteRetentionInMs = StorageConfig.DEFAULT_CHANGELOG_DELETE_RETENTION_MS(); if (new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).isDefined()) { changeLogDeleteRetentionInMs = (long) new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).get(); } SystemStreamPartition changelogSSP = null; if (changelogSystemStreams.containsKey(storeName)) changelogSSP = new SystemStreamPartition(changelogSystemStreams.get(storeName), taskModel.getChangelogPartition()); return this.taskStores.get(storeName).getStoreProperties().isPersistedToDisk() && StorageManagerUtil.isOffsetFileValid(loggedStoreDir, Collections.singleton(changelogSSP)) && !StorageManagerUtil.isStaleStore( loggedStoreDir, changeLogDeleteRetentionInMs, clock.currentTimeMillis()); }

Target:
private boolean isLoggedStoreValid(String storeName, File loggedStoreDir) { long changeLogDeleteRetentionInMs = StorageConfig.DEFAULT_CHANGELOG_DELETE_RETENTION_MS(); if (new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).isDefined()) { changeLogDeleteRetentionInMs = (long) new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).get(); } if (changelogSystemStreams.containsKey(storeName)) { SystemStreamPartition changelogSSP = new SystemStreamPartition(changelogSystemStreams.get(storeName), taskModel.getChangelogPartition()); return this.taskStores.get(storeName).getStoreProperties().isPersistedToDisk() && StorageManagerUtil.isOffsetFileValid(loggedStoreDir, Collections.singleton(changelogSSP)) && !StorageManagerUtil.isStaleStore(loggedStoreDir, changeLogDeleteRetentionInMs, clock.currentTimeMillis()); } return false; }
Source:
public void testMultipartChunkedInputStream() throws InterruptedException, IOException { String container = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); long countBefore = blobStore.countBlobs(container); blobStore.createContainerInLocation(null, container); File testFile = createFileBiggerThan(PART_SIZE); InputStream contentToUpload = new FileInputStream(testFile); Blob blob = blobStore.blobBuilder("const.txt").payload(contentToUpload).contentLength(testFile.length()).build(); blobStore.putBlob(container, blob, PutOptions.Builder.multipart()); long countAfter = blobStore.countBlobs(container); assertNotEquals(countBefore, countAfter, "No blob was created"); assertTrue(countAfter - countBefore > 1, "expected 2 or more parts for a multipart blob"); } finally { returnContainer(container); } }

Target:
public void testMultipartChunkedInputStream() throws InterruptedException, IOException { String container = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); blobStore.createContainerInLocation(null, container); File inFile = createFileBiggerThan(PART_SIZE); File outFile = new File("target/lots-of-const-readback.txt"); InputStream contentToUpload = new FileInputStream(inFile); Blob write = blobStore.blobBuilder("const.txt").payload(contentToUpload).contentLength(inFile.length()).build(); blobStore.putBlob(container, write, PutOptions.Builder.multipart()); Blob read = blobStore.getBlob(container, "const.txt"); read.getPayload().writeTo(new FileOutputStream(outFile)); assertEquals(Files.hash(outFile, Hashing.md5()), Files.hash(inFile, Hashing.md5())); } finally { returnContainer(container); } }
Source:
public void maybeResolveSequences() { for (Iterator<TopicPartition> iter = partitionsWithUnresolvedSequences.keySet().iterator(); iter.hasNext(); ) { TopicPartition topicPartition = iter.next(); if (!hasInflightBatches(topicPartition)) { if (isNextSequence(topicPartition, sequenceNumber(topicPartition))) { iter.remove(); } else { if (isTransactional()) { String unackedMessagesErr = "The client hasn't received acknowledgment for some previously " + "sent messages and can no longer retry them."; if (canBumpEpoch()) { epochBumpRequired = true; KafkaException exception = new KafkaException(unackedMessagesErr + "It is safe to abort " + "the transaction and continue."); transitionToAbortableError(exception); } else { KafkaException exception = new KafkaException(unackedMessagesErr + "It isn't safe to continue."); transitionToFatalError(exception); } } else { log.info("No inflight batches remaining for {}, last ack'd sequence for partition is {}, next sequence is {}. " + "Going to bump epoch and reset sequence numbers.", topicPartition, lastAckedSequence(topicPartition).orElse(NO_LAST_ACKED_SEQUENCE_NUMBER), sequenceNumber(topicPartition)); requestEpochBumpForPartition(topicPartition); } this.partitionsWithUnresolvedSequences.remove(topicPartition); } } } }

Target:
synchronized void maybeResolveSequences() { for (Iterator<TopicPartition> iter = partitionsWithUnresolvedSequences.keySet().iterator(); iter.hasNext(); ) { TopicPartition topicPartition = iter.next(); if (!hasInflightBatches(topicPartition)) { if (isNextSequence(topicPartition, sequenceNumber(topicPartition))) { iter.remove(); } else { if (isTransactional()) { String unackedMessagesErr = "The client hasn't received acknowledgment for some previously " + "sent messages and can no longer retry them. "; if (canBumpEpoch()) { epochBumpRequired = true; KafkaException exception = new KafkaException(unackedMessagesErr + "It is safe to abort " + "the transaction and continue."); transitionToAbortableError(exception); } else { KafkaException exception = new KafkaException(unackedMessagesErr + "It isn't safe to continue."); transitionToFatalError(exception); } } else { log.info("No inflight batches remaining for {}, last ack'd sequence for partition is {}, next sequence is {}. " + "Going to bump epoch and reset sequence numbers.", topicPartition, lastAckedSequence(topicPartition).orElse(NO_LAST_ACKED_SEQUENCE_NUMBER), sequenceNumber(topicPartition)); requestEpochBumpForPartition(topicPartition); } iter.remove(); } } } }
Source:
protected boolean validate() { if (!validate(isTemplateExists())) { return false; } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); if (!validate(validator.isDomainExistAndActive())) { return false; } if (getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } return true; }

Target:
protected boolean validate() { if (!validate(isTemplateExists())) { return false; } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); if (!validate(validator.isDomainExistAndActive())) { return false; } if (!validate(validator.isDataDomain())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } return true; }