auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private HealthCheckResult doHealthCheck(ZookeeperClient zookeeperClient) { try { <START> final String timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); <END> zookeeperClient.getCuratorFramework() .setData() .forPath(healthCheckPath, objectMapper.writeValueAsBytes(timestamp)); LOGGER.info("ZooKeeper healthy.", zookeeperClient.getDcName()); return HealthCheckResult.HEALTHY; } catch (Exception e) { LOGGER.error("Cannot connect to ZooKeeper {}.", zookeeperClient.getDcName(), e); return HealthCheckResult.UNHEALTHY; } }</code><technical_language>this line of try-catch</technical_language>

Target:
private HealthCheckResult doHealthCheck(ZookeeperClient zookeeperClient) { final String timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); try { zookeeperClient.ensurePathExists(healthCheckPath); zookeeperClient.getCuratorFramework() .setData() .forPath(healthCheckPath, objectMapper.writeValueAsBytes(timestamp)); logger.info("Storage healthy for datacenter {}", zookeeperClient.getDatacenterName()); return HealthCheckResult.HEALTHY; } catch (Exception e) { logger.error("Storage health check failed for datacenter {}", zookeeperClient.getDatacenterName(), e); return HealthCheckResult.UNHEALTHY; } }
Source:
<code>public void testIntegrationNoFailureTag() throws Exception { jenkinsRule.createOnlineSlave(new LabelAtom("windows")); WorkflowJob job = jenkinsRule.jenkins.createProject(WorkflowJob.class, "pipelineIntegrationSuccess"); String definition = IOUtils.toString( this.getClass().getResourceAsStream("testPipelineSuccess.txt"), "UTF-8" ); job.setDefinition(new CpsFlowDefinition(definition, true)); WorkflowRun run = job.scheduleBuild2(0).get(); BufferedReader br = new BufferedReader(run.getLogReader()); String s; while ((s = br.readLine()) != null) { System.out.println(s); } br.close(); String hostname = DatadogUtilities.getHostname(null); String[] tags = new String[]{ "jenkins_url:" + DatadogUtilities.getJenkinsUrl(), "user_id:anonymous", "job:pipelineIntegrationSuccess", <START> "result:UNKNOWN", <END> "stage_depth:0", "stage_name:test", "parent_stage_name:root" }; clientStub.assertMetric("jenkins.job.stage_duration", hostname, tags); }</code><technical_language>This SUCCESS right</technical_language>

Target:
public void testIntegrationNoFailureTag() throws Exception { jenkinsRule.createOnlineSlave(new LabelAtom("windows")); WorkflowJob job = jenkinsRule.jenkins.createProject(WorkflowJob.class, "pipelineIntegrationSuccess"); String definition = IOUtils.toString( this.getClass().getResourceAsStream("testPipelineSuccess.txt"), "UTF-8" ); job.setDefinition(new CpsFlowDefinition(definition, true)); job.scheduleBuild2(0).get(); String hostname = DatadogUtilities.getHostname(null); String[] tags = new String[]{ "jenkins_url:" + DatadogUtilities.getJenkinsUrl(), "user_id:anonymous", "job:pipelineIntegrationSuccess", "result:SUCCESS", "stage_depth:0", "stage_name:test", "parent_stage_name:root" }; clientStub.assertMetric("jenkins.job.stage_duration", hostname, tags); }
Source:
<code>public static Collection<Integer> getLostPacketsFci(ByteArrayBuffer fciBuffer) { Collection<Integer> lostPackets = new LinkedList<>(); if (fciBuffer == null) { return lostPackets; } byte[] fci = fciBuffer.getBuffer(); int off = fciBuffer.getOffset(), len = fciBuffer.getLength(); for (int i = 0; i < (len / 4); i++) { int pid = (0xFF & fci[off + i * 4 + 0]) << 8 | (0xFF & fci[off + i * 4 + 1]); lostPackets.add(pid); <START> for (int j = 0; j < 8; j++) <END> if (0 != (fci[off + i * 4 + 2] & (1 << j))) lostPackets.add((pid + 1 + 8 + j) % (1 << 16)); for (int j = 0; j < 8; j++) if (0 != (fci[off + i * 4 + 3] & (1 << j))) lostPackets.add((pid + 1 + j) % (1 << 16)); } return lostPackets; }</code><technical_language>i this copy-pasting code (?), add braces for loop if</technical_language>

Target:
public static Collection<Integer> getLostPacketsFci(ByteArrayBuffer fciBuffer) { Collection<Integer> lostPackets = new LinkedList<>(); if (fciBuffer == null) { return lostPackets; } byte[] fci = fciBuffer.getBuffer(); int off = fciBuffer.getOffset(), len = fciBuffer.getLength(); for (int i = 0; i < (len / 4); i++) { int pid = (0xFF & fci[off + i * 4 + 0]) << 8 | (0xFF & fci[off + i * 4 + 1]); lostPackets.add(pid); for (int j = 0; j < 8; j++) { if (0 != (fci[off + i * 4 + 2] & (1 << j))) { lostPackets.add((pid + 1 + 8 + j) % (1 << 16)); } } for (int j = 0; j < 8; j++) { if (0 != (fci[off + i * 4 + 3] & (1 << j))) { lostPackets.add((pid + 1 + j) % (1 << 16)); } } } return lostPackets; }
Source:
<code>public static boolean isNumber(Class<?> clazz) { if ( clazz == null ) { return false; } else if ( clazz.isPrimitive() ) { return NUMBER_TYPES.contains( clazz ); } else { <START> return Number.class.isAssignableFrom( clazz ); <END> } }</code><technical_language>covered NUMBER_TYPES already</technical_language>

Target:
public static boolean isNumber(Class<?> clazz) { if ( clazz == null ) { return false; } else { return NUMBER_TYPES.contains( clazz ); } }
Source:
<code>protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.of(22); for (ConfigKey k: getEntityType().getConfigKeys()) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } Map<String, Object> provisioningProperties = getConfig(PROVISIONING_PROPERTIES); if(provisioningProperties.containsKey("required.ports")){ Object requiredPorts = provisioningProperties.get("required.ports"); if (requiredPorts instanceof Integer){ ports.add((Integer)requiredPorts); <START> }else if (requiredPorts instanceof List) { <END> for(Object o : (List<?>)requiredPorts){ if(o instanceof Integer) ports.add((Integer)o); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }</code><technical_language>accept Iterable list</technical_language>

Target:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.of(22); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } else if(k.getName().matches(".*\\.port")){ Object value = getConfig(k); if (value instanceof Integer){ ports.add((Integer)value); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }
Source:
<code>public void testFunctionIsAppliedToExistingMessageSource() { <START> ApplicationContext context = <END> new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)) .web(WebApplicationType.NONE) .run("--spring.cloud.stream.function.name=toUpperCase", "--spring.jmx.enabled=false"); OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo("HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); }</code><technical_language>ApplicationContext closed in end of test. wrap instantiation try-with-resource also. assertions in body</technical_language>

Target:
public void testFunctionIsAppliedToExistingMessageSource() { try(ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)) .web(WebApplicationType.NONE) .run("--spring.cloud.stream.function.name=toUpperCase", "--spring.jmx.enabled=false")){ OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo("HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); } }
Source:
<code>public ViewResultsFullVisualizer() { super(); final int maxResults = JMeterUtils.getPropDefault("view.results.tree.max_results", 500); if (maxResults > 0) { buffer = new CircularFifoQueue<>(maxResults); } else { <START> buffer = new LinkedList<>(); <END> } init(); new Timer(REFRESH_PERIOD, e -> updateGui()).start(); }</code><technical_language>please stop LinkedList? Joshua Bloch (LinkedList author) says: <LINK_0></technical_language>

Target:
public ViewResultsFullVisualizer() { super(); final int maxResults = JMeterUtils.getPropDefault("view.results.tree.max_results", 500); if (maxResults > 0) { buffer = new CircularFifoQueue<>(maxResults); } else { buffer = new ArrayDeque<>(); } init(); new Timer(REFRESH_PERIOD, e -> updateGui()).start(); }
Source:
<code>private void ensureNotCallingFromPartitionOperationThread() { if (Thread.currentThread() instanceof PartitionOperationThread) { <START> throw new IllegalThreadStateException(Thread.currentThread() + " cannot block on InvocationFuture!"); <END> } }</code><technical_language>include invocation-future toString in exception message</technical_language>

Target:
private void ensureNotCallingFromPartitionOperationThread() { if (Thread.currentThread() instanceof PartitionOperationThread) { throw new IllegalThreadStateException(Thread.currentThread() + " cannot block on " + this); } }
Source:
<code>private void writeMemoryBacking() { if (!HugePageUtils.isBackedByHugepages(vm.getStaticData())) { return; } writer.writeStartElement("memoryBacking"); writer.writeStartElement("hugepages"); writer.writeStartElement("page"); int hugepageSize = Integer.parseInt(HugePageUtils.getHugePageSize(vm.getStaticData())); List<Integer> hugepageSizes = hostStatisticsSupplier.get().getHugePages().stream() .map(HugePage::getSizeKB) .collect(Collectors.toList()); if (!hugepageSizes.contains(hugepageSizes)) { switch(vm.getClusterArch().getFamily()) { case x86: hugepageSize = <START> 2048; <END> break; case ppc: hugepageSize = 16384; break; } } writer.writeAttributeString("size", String.valueOf(hugepageSize)); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); }</code><technical_language>a constant/enum a fit for page size architecture</technical_language>

Target:
private void writeMemoryBacking() { if (!HugePageUtils.isBackedByHugepages(vm.getStaticData())) { return; } writer.writeStartElement("memoryBacking"); writer.writeStartElement("hugepages"); writer.writeStartElement("page"); int hugepageSize = Integer.parseInt(HugePageUtils.getHugePageSize(vm.getStaticData())); List<Integer> hugepageSizes = hostStatisticsSupplier.get().getHugePages().stream() .map(HugePage::getSizeKB) .collect(Collectors.toList()); if (!hugepageSizes.contains(hugepageSizes)) { switch(vm.getClusterArch().getFamily()) { case x86: hugepageSize = DEFAULT_HUGEPAGESIZE_X86_64; break; case ppc: hugepageSize = DEFAULT_HUGEPAGESIZE_PPC64LE; break; } } writer.writeAttributeString("size", String.valueOf(hugepageSize)); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); }
Source:
<code>protected String browseWorkspace(String description) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setAllowMultiple(false); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject || element instanceof IFolder) { return true; } if(element instanceof IFile) { return true; } return false; } }); dialog.setTitle(Messages.LAUNCH_CONFIGURATION_MAIN_TAB_SELECT_MAIN_FILE_TITLE); dialog.setMessage(description); dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length > 0 && selection[0] instanceof IFile){ return new Status(IStatus.OK, NodePlugin.PLUGIN_ID, IStatus.OK, NodeConstants.EMPTY, null); } return new Status(IStatus.ERROR, NodePlugin.PLUGIN_ID, IStatus.ERROR, NodeConstants.EMPTY, null); } }); if (dialog.open() == Window.OK) { IFile file = (IFile) dialog.getFirstResult(); if (file != null) { IPath path = file.getLocation(); String wsRelativePath = path.makeRelativeTo(ResourcesPlugin.getWorkspace().getRoot().getLocation()) .toString(); <START> return "${workspace_loc}/" + wsRelativePath; END> } } return null; }</code><technical_language>Consider VariablesPlugin.getDefault().getStringVariableManager()</technical_language>

Target:
protected String browseWorkspace(String description) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setAllowMultiple(false); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject || element instanceof IFolder) { return true; } if(element instanceof IFile) { return true; } return false; } }); dialog.setTitle(Messages.LAUNCH_CONFIGURATION_MAIN_TAB_SELECT_MAIN_FILE_TITLE); dialog.setMessage(description); dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length > 0 && selection[0] instanceof IFile){ return new Status(IStatus.OK, NodePlugin.PLUGIN_ID, IStatus.OK, NodeConstants.EMPTY, null); } return new Status(IStatus.ERROR, NodePlugin.PLUGIN_ID, IStatus.ERROR, NodeConstants.EMPTY, null); } }); if (dialog.open() == Window.OK) { IFile file = (IFile) dialog.getFirstResult(); if (file != null) { IPath path = file.getLocation(); String wsRelativePath = path.makeRelativeTo(ResourcesPlugin.getWorkspace().getRoot().getLocation()) .toString(); return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression( "workspace_loc", wsRelativePath); } } return null; }
Source:
<code>public void testDataProvider() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 0, 5, null); List<Long> <START> expectedColumnsId = <END> Arrays.asList(TIMESTAMP_COLUMN_ID, EVENT_TYPE_COLUMN_ID, CONTENTS_COLUMN_ID); List<EventTableLine> expectedData = Arrays.asList( new EventTableLine(Arrays.asList("19:00:00.001 000 000", "Type-0", ""), 0, TmfTimestamp.fromMillis(1), 0, 0), new EventTableLine(Arrays.asList("19:00:00.002 000 000", "Type-1", ""), 1, TmfTimestamp.fromMillis(2), 1, 0), new EventTableLine(Arrays.asList("19:00:00.003 000 000", "Type-2", ""), 2, TmfTimestamp.fromMillis(3), 2, 0), new EventTableLine(Arrays.asList("19:00:00.004 000 000", "Type-3", ""), 3, TmfTimestamp.fromMillis(4), 3, 0), new EventTableLine(Arrays.asList("19:00:00.005 000 000", "Type-4", ""), 4, TmfTimestamp.fromMillis(5), 4, 0)); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetch(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); ITmfVirtualTableModel<EventTableLine> expectedModel = new TmfVirtualTableModel<>(expectedColumnsId, expectedData, 0, fTrace.getNbEvents()); assertEquals(expectedModel, currentModel); }</code><technical_language>fetch columns first, assert names get IDs ids generated hard coded</technical_language>

Target:
public void testDataProvider() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 0, 5, null); List<EventTableLine> expectedData = Arrays.asList( new EventTableLine(Arrays.asList("19:00:00.001 000 000", "Type-0", ""), 0, TmfTimestamp.fromMillis(1), 0, 0), new EventTableLine(Arrays.asList("19:00:00.002 000 000", "Type-1", ""), 1, TmfTimestamp.fromMillis(2), 1, 0), new EventTableLine(Arrays.asList("19:00:00.003 000 000", "Type-2", ""), 2, TmfTimestamp.fromMillis(3), 2, 0), new EventTableLine(Arrays.asList("19:00:00.004 000 000", "Type-3", ""), 3, TmfTimestamp.fromMillis(4), 3, 0), new EventTableLine(Arrays.asList("19:00:00.005 000 000", "Type-4", ""), 4, TmfTimestamp.fromMillis(5), 4, 0)); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetchLines(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); ITmfVirtualTableModel<EventTableLine> expectedModel = new TmfVirtualTableModel<>(fColumnId, expectedData, 0, fTrace.getNbEvents()); assertEquals(expectedModel, currentModel); }
Source:
<code>protected void checkConstructorResult( AnnotatedExecutableType constructorType, ExecutableElement constructorElement) { QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); Set<AnnotationMirror> constructorAnnotations = constructorType.getReturnType().getAnnotations(); Set<? extends AnnotationMirror> tops = qualifierHierarchy.getTopAnnotations(); for (AnnotationMirror top : tops) { AnnotationMirror constructorAnno = qualifierHierarchy.findAnnotationInHierarchy(constructorAnnotations, top); if (!qualifierHierarchy.isSubtype(top, constructorAnno)) { checker.report( Result.warning( "inconsistent.constructor.type", constructorAnno, <START> qualifierHierarchy.getTopAnnotation(constructorAnno)), <END> constructorElement); } } }</code><technical_language>this top? I missing something</technical_language>

Target:
protected void checkConstructorResult( AnnotatedExecutableType constructorType, ExecutableElement constructorElement) { QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); Set<AnnotationMirror> constructorAnnotations = constructorType.getReturnType().getAnnotations(); Set<? extends AnnotationMirror> tops = qualifierHierarchy.getTopAnnotations(); for (AnnotationMirror top : tops) { AnnotationMirror constructorAnno = qualifierHierarchy.findAnnotationInHierarchy(constructorAnnotations, top); if (!qualifierHierarchy.isSubtype(top, constructorAnno)) { checker.report( Result.warning("inconsistent.constructor.type", constructorAnno, top), constructorElement); } } }
Source:
<code>public void onCreate(Connection connection) { TopicExchange exchange = new TopicExchange("amq.rabbitmq.event"); try { this.admin.declareQueue(this.eventQueue); Arrays.stream(this.eventKeys).forEach(k -> { Binding binding = BindingBuilder.bind(this.eventQueue).to(exchange).with(k); this.admin.declareBinding(binding); }); } catch (Exception e) { <START> logger.error("failed to declare event queue/bindings - is the plugin enabled?"); <END> this.bindingsFailed = true; } }</code><technical_language>Missed e in error()</technical_language>

Target:
public void onCreate(Connection connection) { this.bindingsFailedException = null; TopicExchange exchange = new TopicExchange("amq.rabbitmq.event"); try { this.admin.declareQueue(this.eventQueue); Arrays.stream(this.eventKeys).forEach(k -> { Binding binding = BindingBuilder.bind(this.eventQueue).to(exchange).with(k); this.admin.declareBinding(binding); }); } catch (Exception e) { logger.error("failed to declare event queue/bindings - is the plugin enabled?", e); this.bindingsFailedException = e; } }
Source:
<code>public void closeDirty() { try { close(false); } catch (final RuntimeException e) { <START> log.warn(String.format("Ignoring uncaught error in unclean close of standby task %s", id), e); <END> } log.info("Closed dirty"); }</code><technical_language>exception is possibly thrown this close(false) call</technical_language>

Target:
public void closeDirty() { close(false); log.info("Closed dirty"); }
Source:
<code>public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> create(ITmfTrace trace) { Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>(); List<ITmfStateSystem> sss = new ArrayList<>(); if (fAnalysisIds.isEmpty()) { Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class)); } else { for (String moduleId : fAnalysisIds) { IAnalysisModule module = trace.getAnalysisModule(moduleId); if (module instanceof ITmfAnalysisModuleWithStateSystems) { stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module); } } } for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) { if (module.schedule().isOK() && module.waitForInitialization()) { module.getStateSystems().forEach(sss::add); } } return (sss.isEmpty() ? null : <START> new DataDrivenXYDataProvider(trace, sss, fEntries, null)); <END> }</code><technical_language>create</technical_language>

Target:
public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> create(ITmfTrace trace) { Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>(); List<ITmfStateSystem> sss = new ArrayList<>(); if (fAnalysisIds.isEmpty()) { Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class)); } else { for (String moduleId : fAnalysisIds) { IAnalysisModule module = trace.getAnalysisModule(moduleId); if (module instanceof ITmfAnalysisModuleWithStateSystems) { stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module); } } } for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) { if (module.schedule().isOK() && module.waitForInitialization()) { module.getStateSystems().forEach(sss::add); } } return (sss.isEmpty() ? null : create(trace, sss, fEntries, null)); }
Source:
<code>@Override public void onReadyForWrite(DistributedMetaStorage metastorage) { this.metastorage = metastorage; metastorage.listen( (k) -> k.equals(CLUSTER_ID_TAG_KEY), (String k, ClusterIdAndTag oldVal, ClusterIdAndTag newVal) -> { if (log.isInfoEnabled()) log.info( "Cluster tag will be set to new value: " + <START> newVal != null ? newVal.tag() : "null" + <END> ", previous value was: " + oldVal != null ? oldVal.tag() : "null"); cluster.setTag(newVal != null ? newVal.tag() : null); if (compatibilityMode) { assert oldVal == null; if (log.isInfoEnabled()) log.info("Cluster ID will be initialized to the value: " + newVal.id()); cluster.setId(newVal.id()); compatibilityMode = false; } } ); if (!compatibilityMode) { ctx.closure().runLocalSafe( () -> { try { ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag()); if (log.isInfoEnabled()) log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag); metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag); } catch (IgniteCheckedException e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } } ); } }</code><technical_language>nice put ternaries (parens) precedence is obvious</technical_language>

Target:
@Override public void onReadyForWrite(DistributedMetaStorage metastorage) { this.metastorage = metastorage; metastorage.listen( (k) -> k.equals(CLUSTER_ID_TAG_KEY), (String k, ClusterIdAndTag oldVal, ClusterIdAndTag newVal) -> { if (log.isInfoEnabled()) { log.info( "Cluster tag will be set to new value: " + (newVal != null ? newVal.tag() : "null") + ", previous value was: " + (oldVal != null ? oldVal.tag() : "null")); } cluster.setTag(newVal != null ? newVal.tag() : null); } ); ctx.closure().runLocalSafe( () -> { try { ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag()); if (log.isInfoEnabled()) log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag); metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag); } catch (IgniteCheckedException e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } } ); }
Source:
<code>private Optional<TableReference> logDecision( Optional<TableReference> chosenTable, Map<TableReference, Double> scores, SweepPriorityOverrideConfig sweepPriorityOverrideConfig) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from scores: {}, unsafeScores: {}, overrides: {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("scores", safeTableNamesToScore), UnsafeArg.of("unsafeScores", scores), <START> SafeArg.of("overrides", sweepPriorityOverrideConfig)); <END> return chosenTable; }</code><technical_language>overrides contains table names treat unsafe, sanitize do safeTableNamesToScore . set of people able view safe logs set of people able view edit config (and table names)</technical_language>

Target:
private Optional<TableReference> logDecision( Optional<TableReference> chosenTable, Map<TableReference, Double> scores, SweepPriorityOverrideConfig sweepPriorityOverrideConfig) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from scores: {}, unsafeScores: {}, overrides: {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("scores", safeTableNamesToScore), UnsafeArg.of("unsafeScores", scores), UnsafeArg.of("overrides", sweepPriorityOverrideConfig)); return chosenTable; }
Source:
<code>public void onPistonRetract(BlockPistonRetractEvent e) { <START> if(BlockStorage.check(e.getBlock()) != null) { <END> e.setCancelled(true); } else if (e.isSticky()) { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); return; } } } }</code><technical_language>Please BlockStorage#hasBlockInfo() instead. Also, formatting (put a space if)</technical_language>

Target:
public void onPistonRetract(BlockPistonRetractEvent e) { if (BlockStorage.hasBlockInfo(e.getBlock())) { e.setCancelled(true); } else if (e.isSticky()) { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); break; } } } }
Source:
<code>protected Long toLong(BooleanWritable writable) throws IOException { <START> return (long)( writable.get() ? 1:0); <END> }</code><technical_language>tiny nitpick: just: return writable.get() ? 1L : 0L;</technical_language>

Target:
protected Long toLong(BooleanWritable writable) throws IOException { return writable.get() ? 1L : 0L; }
Source:
<code>public List<HasMetadata> parse(InternalRecipe recipe) throws ValidationException, InfrastructureException { String content = recipe.getContent(); String contentType = recipe.getContentType(); checkNotNull(contentType, "Recipe content type must not be null"); switch (contentType) { case "application/x-yaml": <START> case "text/yaml": <END> case "text/x-yaml": break; default: throw new ValidationException( "Provided environment recipe content type '" + contentType + "' is unsupported. Supported values are: " + "application/x-yaml, text/yaml, text/x-yaml"); } return parse(content); }</code><technical_language>elaborate this parser works in a case recipe location instead of content</technical_language>

Target:
public List<HasMetadata> parse(InternalRecipe recipe) throws ValidationException, InfrastructureException { String content = recipe.getContent(); String contentType = recipe.getContentType(); checkNotNull(contentType, "Recipe content type must not be null"); if (!SUPPORTED_CONTENT_TYPES.contains(contentType)) { throw new ValidationException( format( "Provided environment recipe content type '%s' is unsupported. Supported values are: %s", contentType, String.join(", ", SUPPORTED_CONTENT_TYPES))); } return parse(content); }
Source:
<code>public final void show() { Gdx.input.setInputProcessor(cStage); TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(); style.font = new BitmapFont(); cButtonResetInterval = new TextButton("Reset interval", style); cButtonResetStroll = new TextButton("Reset stroll", style); cButtonBack = new TextButton("Back", style); int width = Gdx.graphics.getWidth(); int height = Gdx.graphics.getHeight(); cButtonResetInterval.setPosition(width / 2f - cButtonResetInterval.getWidth() / 2f, height / 2f + 10); cButtonResetStroll.setPosition(width / 2f - cButtonResetStroll.getWidth() / 2f, height / 2f - 10); cButtonBack.setPosition(width / 2f - cButtonBack.getWidth() / 2f, 20); cButtonResetInterval.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { TimeKeeper.getInstance().getTimer("INTERVAL").reset(); } }); cButtonResetStroll.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { TimeKeeper.getInstance().getTimer("STROLL").reset(); } }); cButtonBack.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { <START> ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); <END> Gdx.app.debug("Button", "MainMenu"); } }); cStage.addActor(cButtonResetInterval); cStage.addActor(cButtonResetStroll); cStage.addActor(cButtonBack); }</code><technical_language>Main menu exists, new instance</technical_language>

Target:
public final void show() { cStage = new Stage(); Gdx.input.setInputProcessor(cStage); TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(); style.font = new BitmapFont(); cButtonResetInterval = new TextButton("Reset interval", style); cButtonResetStroll = new TextButton("Reset stroll", style); cButtonBack = new TextButton("Back", style); int width = Gdx.graphics.getWidth(); int height = Gdx.graphics.getHeight(); final int offset = 10; cButtonResetInterval.setPosition(width / 2f - cButtonResetInterval.getWidth() / 2f, height / 2f + offset); cButtonResetStroll.setPosition(width / 2f - cButtonResetStroll.getWidth() / 2f, height / 2f - offset); cButtonBack.setPosition(width / 2f - cButtonBack.getWidth() / 2f, 2 * offset); cButtonResetInterval.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { TimeKeeper.getInstance().getTimer("INTERVAL").reset(); } }); cButtonResetStroll.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { TimeKeeper.getInstance().getTimer("STROLL").reset(); } }); cButtonBack.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); Gdx.app.debug("Button", "MainMenu"); } }); cStage.addActor(cButtonResetInterval); cStage.addActor(cButtonResetStroll); cStage.addActor(cButtonBack); }
Source:
<code>public void testWithNoArgs() { String[] args = {}; exit.expectSystemExitWithStatus(0); exit.checkAssertionAfterwards( new Assertion() { @Override public void checkAssertion() throws Exception { Mockito.verifyZeroInteractions(executor); assertTrue("Error output should be clean, but it was " <START> + mio.getSysErr().toString(), mio.getSysErr().isEmpty()); <END> assertContains(helpText, mio.getSysOut()); } }); Main.main(args); }</code><technical_language>I return type of getSysErr is a String</technical_language>

Target:
public void testWithNoArgs() { String[] args = {}; exit.expectSystemExitWithStatus(0); exit.checkAssertionAfterwards( new Assertion() { @Override public void checkAssertion() throws Exception { Mockito.verifyZeroInteractions(executor); assertTrue("Error output should be clean, but it was " + mio.getSysErr(), mio.getSysErr().isEmpty()); assertContains(helpText, mio.getSysOut()); } }); Main.main(args); }
Source:
<code>public Set<Integer> getSegments() { synchronized (segments) { Set<Integer> segmentsCopy = new HashSet<Integer>(segments); <START> segmentsCopy.addAll(segments); <END> return segmentsCopy; } }</code><technical_language>addAll()</technical_language>

Target:
public Set<Integer> getSegments() { synchronized (segments) { return new HashSet<Integer>(segments); } }
Source:
<code>public ArrayList<Property> getWorkpieceProperties() { if (Objects.isNull(workpieceProperties)) { <START> return new ArrayList<>(); <END> } return workpieceProperties; }</code><technical_language>assign this empty list return it</technical_language>

Target:
public ArrayList<Property> getWorkpieceProperties() { if (Objects.isNull(workpieceProperties)) { workpieceProperties = new ArrayList<>(); } return workpieceProperties; }
Source:
<code>private void createAndSaveNewDraft(String subject, List<String> addressReceiver, List<String> groupReceiver, String content) { AdminEmailAttributes newDraft = AdminEmailAttributes .builder(subject, addressReceiver, groupReceiver, new Text(content)) <START> .withSendDate(null) <END> .build(); try { logic.createAdminEmail(newDraft); } catch (InvalidParametersException e) { isError = true; setStatusForException(e, e.getMessage()); } }</code><technical_language>remove</technical_language>

Target:
private void createAndSaveNewDraft(String subject, List<String> addressReceiver, List<String> groupReceiver, String content) { AdminEmailAttributes newDraft = AdminEmailAttributes .builder(subject, addressReceiver, groupReceiver, new Text(content)) .build(); try { logic.createAdminEmail(newDraft); } catch (InvalidParametersException e) { isError = true; setStatusForException(e, e.getMessage()); } }
Source:
<code>private static Asset persistenceXml() { String persistenceXml = Descriptors.create( PersistenceDescriptor.class ) .version( "2.0" ) .createPersistenceUnit() .name( "primary" ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .getOrCreateProperties() .createProperty() .name( "hibernate.hbm2ddl.auto" ) .value( "create-drop" ) .up() .createProperty() .name( "hibernate.search.default.lucene_version" ) .value( "LUCENE_CURRENT" ) .up() .createProperty() .name( "hibernate.search.default.directory_provider" ) .value( "infinispan" ) .up() .createProperty() .name( "hibernate.search.infinispan.configuration_resourcename" ) <START> .value( "user-provided-infinispan.xml" ) <END> .up() .up() .up() .exportAsString(); return new StringAsset( persistenceXml ); }</code><technical_language>change? is changes. XML files</technical_language>

Target:
private static Asset persistenceXml() { String persistenceXml = Descriptors.create( PersistenceDescriptor.class ) .version( "2.0" ) .createPersistenceUnit() .name( "primary" ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .getOrCreateProperties() .createProperty() .name( "hibernate.hbm2ddl.auto" ) .value( "create-drop" ) .up() .createProperty() .name( "hibernate.search.default.lucene_version" ) .value( "LUCENE_CURRENT" ) .up() .createProperty() .name( "hibernate.search.default.directory_provider" ) .value( "infinispan" ) .up() .createProperty() .name( "hibernate.search.default.exclusive_index_use" ) .value( "false" ) .up() .createProperty() .name( "hibernate.search.infinispan.configuration_resourcename" ) .value( "user-provided-infinispan.xml" ) .up() .up() .up() .exportAsString(); return new StringAsset( persistenceXml ); }
Source:
<code>private void markSweepTaskStore(File taskStoreDir) throws IOException { String taskStorePath = taskStoreDir.getAbsolutePath(); File offsetFile = new File(taskStoreDir, OFFSET_FILE_NAME); if (!offsetFile.exists()) { LOG.info("Deleting the task store : {}, since it has no offset file.", taskStorePath); FileUtils.deleteDirectory(taskStoreDir); <START> localStoreMonitorMetrics.diskSpaceFreedInBytes.inc(taskStoreDir.getTotalSpace()); <END> localStoreMonitorMetrics.noOfDeletedTaskPartitionStores.inc(); } else if ((CLOCK.currentTimeMillis() - offsetFile.lastModified()) >= config.getOffsetFileTTL()) { LOG.info("Deleting the offset file from the store : {}, since the last modified timestamp : " + "of the offset file is older than config file ttl : {}.", taskStorePath, offsetFile.lastModified(), config.getOffsetFileTTL()); offsetFile.delete(); } }</code><technical_language>getTotalSpace() return dir deleted (line 147)? this tested</technical_language>

Target:
private void markSweepTaskStore(File taskStoreDir) throws IOException { String taskStorePath = taskStoreDir.getAbsolutePath(); File offsetFile = new File(taskStoreDir, OFFSET_FILE_NAME); if (!offsetFile.exists()) { LOG.info("Deleting the task store : {}, since it has no offset file.", taskStorePath); long taskStoreSizeInBytes = taskStoreDir.getTotalSpace(); FileUtils.deleteDirectory(taskStoreDir); localStoreMonitorMetrics.diskSpaceFreedInBytes.inc(taskStoreSizeInBytes); localStoreMonitorMetrics.noOfDeletedTaskPartitionStores.inc(); } else if ((CLOCK.currentTimeMillis() - offsetFile.lastModified()) >= config.getOffsetFileTTL()) { LOG.info("Deleting the offset file from the store : {}, since the last modified timestamp : " + "of the offset file is older than config file ttl : {}.", taskStorePath, offsetFile.lastModified(), config.getOffsetFileTTL()); offsetFile.delete(); } }
Source:
<code>private static HandlerDecorator buildDecorator(Class<? extends HandlerDecorator> decoratorClass) { HandlerDecorator decorator; try { <START> decorator = decoratorClass.getConstructor().newInstance(); <END> } catch (ReflectiveOperationException e) { throw new IllegalStateException("Decorator class " + decoratorClass + "cannot be instantiated", e); } return decorator; }</code><technical_language>variable declaration return decoratorClass.getConstructor().newInstance();</technical_language>

Target:
private static HandlerDecorator buildDecorator(Class<? extends HandlerDecorator> decoratorClass) { try { return decoratorClass.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Decorator class " + decoratorClass + "cannot be instantiated", e); } }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; String runas = req.getHeader(RUN_AS); if (runas != null) { if (!enabled) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, RUN_AS + " disabled by auth.enableRunAs = false", <START> null); <END> return; } CurrentUser self = session.get().getCurrentUser(); if (!self.getCapabilities().canRunAs()) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, "not permitted to use " + RUN_AS, null); return; } Account target; try { target = accountResolver.find(runas); } catch (OrmException e) { log.warn("cannot resolve account for " + RUN_AS, e); RestApiServlet.replyError(req, res, SC_INTERNAL_SERVER_ERROR, "cannot resolve " + RUN_AS, e); return; } if (target == null) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, "no account matches " + RUN_AS, null); return; } session.get().setUserAccountId(target.getId()); } chain.doFilter(req, res); }</code><technical_language>Add another replyError err parameter, call existing replyError err=null? necessary change calls in this file</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; String runas = req.getHeader(RUN_AS); if (runas != null) { if (!enabled) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, RUN_AS + " disabled by auth.enableRunAs = false"); return; } CurrentUser self = session.get().getCurrentUser(); if (!self.getCapabilities().canRunAs()) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, "not permitted to use " + RUN_AS); return; } Account target; try { target = accountResolver.find(runas); } catch (OrmException e) { log.warn("cannot resolve account for " + RUN_AS, e); RestApiServlet.replyError(req, res, SC_INTERNAL_SERVER_ERROR, "cannot resolve " + RUN_AS, e); return; } if (target == null) { RestApiServlet.replyError(req, res, SC_FORBIDDEN, "no account matches " + RUN_AS); return; } session.get().setUserAccountId(target.getId()); } chain.doFilter(req, res); }
Source:
<code>public ChannelOutput receive() throws IOException { channelPromise.awaitUninterruptibly(3, TimeUnit.SECONDS); DataInputStream dataInputStream = new NettyByteBufDataInputStream(responseByteBuf); <START> return new ChannelOutput(dataInputStream, dataInputStream.readLong()); <END> }</code><technical_language>this is run out of sync callback in send method. If awaitUninterruptedly returns false, dataInputStream reuse responseByteBuf set send</technical_language>

Target:
public ChannelOutput receive() throws IOException { ByteBuf responseByteBuf; try { responseByteBuf = responsePromise.get(3, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException("No response received in 3 seconds."); } DataInputStream dataInputStream = new NettyByteBufDataInputStream(responseByteBuf); return new ChannelOutput(dataInputStream, dataInputStream.readLong()); }
Source:
<code><START> public void testToFlowElement_case() throws Exception { <END> final BaseReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setIsCase(new IsCase(true)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertTrue(CustomElement.isCase.of(propertyWriter.getFlowElement()).get()); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testToFlowElement_case() { final BaseReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setIsCase(new IsCase(true)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertTrue(CustomElement.isCase.of(propertyWriter.getFlowElement()).get()); }
Source:
<code>public void doSystemCancel_chargeStatusDuringAuthorisation_needsCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; Long gatewayAccountId = nextLong(); ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); <START> <END> WorldpayCancelResponse worldpayResponse = mock(WorldpayCancelResponse.class); when(worldpayResponse.cancelStatus()).thenReturn(BaseCancelResponse.CancelStatus.CANCELLED); GatewayResponse.GatewayResponseBuilder<WorldpayCancelResponse> gatewayResponseBuilder = responseBuilder(); GatewayResponse cancelResponse = gatewayResponseBuilder.withResponse(worldpayResponse).build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockChargeDao.findByExternalIdAndGatewayAccount(externalChargeId, gatewayAccountId)).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProviders.byName(chargeEntity.getPaymentGatewayName())).thenReturn(mockPaymentProvider); when(mockPaymentProvider.cancel(argThat(aCancelGatewayRequestMatching(chargeEntity)))).thenReturn(cancelResponse); chargeCancelService.doSystemCancel(externalChargeId, gatewayAccountId); verify(mockPaymentProvider).cancel(argThat(aCancelGatewayRequestMatching(chargeEntity))); verify(chargeService).transitionChargeState(externalChargeId, SYSTEM_CANCELLED); verifyNoMoreInteractions(ignoreStubs(mockChargeDao)); }</code><technical_language>real classes mocks possible, real more confidence. In this case hard do WorldpayCancelResponse worldpayResponse = new WorldpayCancelResponse()</technical_language>

Target:
public void doSystemCancel_chargeStatusDuringAuthorisation_needsCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; Long gatewayAccountId = nextLong(); ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); WorldpayCancelResponse worldpayResponse = new WorldpayCancelResponse(); GatewayResponse.GatewayResponseBuilder<WorldpayCancelResponse> gatewayResponseBuilder = responseBuilder(); GatewayResponse cancelResponse = gatewayResponseBuilder.withResponse(worldpayResponse).build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockChargeDao.findByExternalIdAndGatewayAccount(externalChargeId, gatewayAccountId)).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProviders.byName(chargeEntity.getPaymentGatewayName())).thenReturn(mockPaymentProvider); when(mockPaymentProvider.cancel(argThat(aCancelGatewayRequestMatching(chargeEntity)))).thenReturn(cancelResponse); chargeCancelService.doSystemCancel(externalChargeId, gatewayAccountId); verify(mockPaymentProvider).cancel(argThat(aCancelGatewayRequestMatching(chargeEntity))); verify(chargeService).transitionChargeState(externalChargeId, SYSTEM_CANCELLED); }
Source:
<code>protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); if (timeout == 0) { ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); timeout = MAXIMUM_TIMEOUT.resolveModelAttribute(context, model).asInt(); TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } <START> arjPropertyManager.getCoordinatorEnvironmentBean().setDefaultTimeout(timeout); <END> TxControl.setDefaultTimeout(timeout); ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }</code><technical_language>lines moved checking timeout equal 0, TxControl allow 0 timeout means timeout all</technical_language>

Target:
protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); arjPropertyManager.getCoordinatorEnvironmentBean().setDefaultTimeout(timeout); TxControl.setDefaultTimeout(timeout); if (timeout == 0) { ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); timeout = MAXIMUM_TIMEOUT.resolveModelAttribute(context, model).asInt(); TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }