auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Integer compareOncogenicity(Oncogenicity o1, Oncogenicity o2, Boolean asc) { if (o1 == null) { if (o2 == null) return 0; <START> return 1; <END> } if (o2 == null) return -1; return (PRIORITIZED_ONCOGENICITY.indexOf(o2) - PRIORITIZED_ONCOGENICITY.indexOf(o1)) * (asc ? 1 : -1); }</code><technical_language>Firstly, asc effect function instead of statement. Secondly, need do null check asc</technical_language>

Target:
public static Integer compareOncogenicity(Oncogenicity o1, Oncogenicity o2, Boolean asc) { if (asc == null) { asc = true; } if (o1 == null) { if (o2 == null) return 0; return asc ? 1 : -1; } if (o2 == null) return asc ? -1 : 1; return (PRIORITIZED_ONCOGENICITY.indexOf(o2) - PRIORITIZED_ONCOGENICITY.indexOf(o1)) * (asc ? 1 : -1); }
Source:
<code>public void testReplaceVariableWithTTLFirstCancelThenScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); <START> EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), anyObject())).andReturn(requestId); <END> EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expectLastCall(); requestId.cancel(); EasyMock.expectLastCall(); EasyMock.expect(herder.restartConnector(eq(10L), eq(MY_CONNECTOR), anyObject())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithLongerTTL}")); assertEquals(TEST_RESULT_WITH_LONGER_TTL, result.get(MY_KEY)); }</code><technical_language>nit: extra space anyObject</technical_language>

Target:
public void testReplaceVariableWithTTLFirstCancelThenScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), notNull())).andReturn(requestId); EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expectLastCall(); requestId.cancel(); EasyMock.expectLastCall(); EasyMock.expect(herder.restartConnector(eq(10L), eq(MY_CONNECTOR), notNull())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithLongerTTL}")); assertEquals(TEST_RESULT_WITH_LONGER_TTL, result.get(MY_KEY)); }
Source:
<code>private boolean isDuplicate(ChangeMessage msg) { try { ChangeMessage last = Iterables.getLast(db.changeMessages().byChange( msg.getPatchSetId().getParentKey()), null); if (last != null) { long lastMs = last.getWrittenOn().getTime(); long msgMs = msg.getWrittenOn().getTime(); if (last.getAuthor() == null && Objects.equal(last.getMessage(), msg.getMessage()) <START> && msgMs - lastMs > DUPLICATE_MESSAGE_INTERVAL) { <END> return true; } } } catch (OrmException err) { log.warn("Cannot check previous merge failure message", err); } return false; }</code><technical_language><</technical_language>

Target:
private boolean isDuplicate(ChangeMessage msg) { try { ChangeMessage last = Iterables.getLast(db.changeMessages().byChange( msg.getPatchSetId().getParentKey()), null); if (last != null) { long lastMs = last.getWrittenOn().getTime(); long msgMs = msg.getWrittenOn().getTime(); if (last.getAuthor() == null && Objects.equal(last.getMessage(), msg.getMessage()) && msgMs - lastMs < DUPLICATE_MESSAGE_INTERVAL) { return true; } } } catch (OrmException err) { log.warn("Cannot check previous merge failure message", err); } return false; }
Source:
<code>public void registerFunction( @Nonnull final String name, @Nonnull final String description, @Nonnull final String outputType, @Nonnull final Boolean isMultiValued, @Nonnull final FunctionLanguage lang) throws CatalogException { Objects.requireNonNull(name, "function name"); Objects.requireNonNull(description, "function definition"); <START> Objects.requireNonNull(outputType, "function output schema"); <END> Objects.requireNonNull(isMultiValued, "is function a flatmap"); Objects.requireNonNull(lang, "function language"); if (isClosed) { throw new CatalogException("Catalog is closed."); } try { queue .execute( new SQLiteJob<Void>() { @Override protected Void job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException, IOException { try { SQLiteStatement statement = sqliteConnection.prepare( "INSERT OR REPLACE INTO registered_functions (function_name, function_description, function_outputType, function_isMultiValued, function_lang) VALUES (?,?,?,?,?);"); statement.bind(1, name); statement.bind(2, description); statement.bind(3, outputType); statement.bind(4, ((isMultiValued == true) ? 1 : 0)); statement.bind(5, lang.ordinal()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } return null; } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }</code><technical_language>Function output type</technical_language>

Target:
public void registerFunction( @Nonnull final String name, @Nonnull final String description, @Nonnull final String outputType, @Nonnull final Boolean isMultiValued, @Nonnull final FunctionLanguage lang) throws CatalogException { Objects.requireNonNull(name, "function name"); Objects.requireNonNull(description, "function definition"); Objects.requireNonNull(outputType, "function output type"); Objects.requireNonNull(isMultiValued, "is function a flatmap"); Objects.requireNonNull(lang, "function language"); if (isClosed) { throw new CatalogException("Catalog is closed."); } try { queue .execute( new SQLiteJob<Void>() { @Override protected Void job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException, IOException { try { SQLiteStatement statement = sqliteConnection.prepare( "INSERT OR REPLACE INTO registered_functions (function_name, function_description, function_outputType, function_isMultiValued, function_lang) VALUES (?,?,?,?,?);"); statement.bind(1, name); statement.bind(2, description); statement.bind(3, outputType); statement.bind(4, ((isMultiValued == true) ? 1 : 0)); statement.bind(5, lang.ordinal()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } return null; } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }
Source:
<code>public OzoneAcl(ACLIdentityType type, String name, ACLType acl) { this.name = name; <START> this.aclBitSet = new BitSet(ACLType.values().length); <END> aclBitSet.set(acl.ordinal(), true); this.type = type; if (type == ACLIdentityType.WORLD && name.length() != 0) { throw new IllegalArgumentException("Unexpected name part in world type"); } if (((type == ACLIdentityType.USER) || (type == ACLIdentityType.GROUP)) && (name.length() == 0)) { throw new IllegalArgumentException("User or group name is required"); } }</code><technical_language>ACLType#getNoOfAcls()</technical_language>

Target:
public OzoneAcl(ACLIdentityType type, String name, ACLType acl) { this.name = name; this.aclBitSet = new BitSet(ACLType.getNoOfAcls()); aclBitSet.set(acl.ordinal(), true); this.type = type; if (type == ACLIdentityType.WORLD && name.length() != 0) { throw new IllegalArgumentException("Unexpected name part in world type"); } if (((type == ACLIdentityType.USER) || (type == ACLIdentityType.GROUP)) && (name.length() == 0)) { throw new IllegalArgumentException("User or group name is required"); } }
Source:
<code>public void tick(MinecraftServer minecraftServer) { <START> electricNetworks.addAll(pendingNetworks); pendingNetworks.clear(); <END> electricNetworks.removeIf(network -> { network.tick(); if (network.isEmpty()) { TechReborn.LOGGER.debug("Electric Network is empty, removed", network); } return network.isEmpty(); }); }</code><technical_language>Whats pendingNetworks? added right electricNetworks</technical_language>

Target:
public void tick(MinecraftServer minecraftServer) { electricNetworks.removeIf(network -> { network.tick(); if (network.isEmpty()) { TechReborn.LOGGER.debug("Electric Network is empty, removed", network); } return network.isEmpty(); }); }
Source:
<code>public AuthenticationResult authenticate(HttpServletRequest request) { HttpSession session; AuthenticationResult authResult = null; try { session = request.getSession(); if (session != null) { if (session.isNew()) { session.setMaxInactiveInterval(MAX_SESSION_INACTIVITY_SECONDS); } authResult = (AuthenticationResult )session.getAttribute(AUTH_USER_SESSION_KEY); } } catch (Exception ex) { session = null; <START> m_rate_limited_log.log(EstTime.currentTimeMillis(), Level.ERROR, ex, "failed to get or create HTTP Session. authenticating user explicitely."); <END> } if (authResult == null) { authResult = getAuthenticationResult(request); if (!authResult.isAuthenticated()) { if (session != null) { session.removeAttribute(AUTH_USER_SESSION_KEY); } m_rate_limited_log.log("JSON interface exception: " + authResult.m_message, EstTime.currentTimeMillis()); } else { if (session != null) { session.setAttribute(AUTH_USER_SESSION_KEY, authResult); } } } return authResult; }</code><technical_language>Nit, capitalize "f"</technical_language>

Target:
public AuthenticationResult authenticate(HttpServletRequest request) { HttpSession session = null; AuthenticationResult authResult = null; if (!HTTP_DONT_USE_SESSION) { try { session = request.getSession(); if (session != null) { if (session.isNew()) { session.setMaxInactiveInterval(MAX_SESSION_INACTIVITY_SECONDS); } authResult = (AuthenticationResult )session.getAttribute(AUTH_USER_SESSION_KEY); } } catch (Exception ex) { session = null; m_rate_limited_log.log(EstTime.currentTimeMillis(), Level.ERROR, ex, "Failed to get or create HTTP Session. authenticating user explicitely."); } } if (authResult == null) { authResult = getAuthenticationResult(request); if (!authResult.isAuthenticated()) { if (session != null) { session.removeAttribute(AUTH_USER_SESSION_KEY); } m_rate_limited_log.log("JSON interface exception: " + authResult.m_message, EstTime.currentTimeMillis()); } else { if (session != null) { session.setAttribute(AUTH_USER_SESSION_KEY, authResult); } } } return authResult; }
Source:
<code>public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } <START> dir.deleteOnExit(); <END> return path; }</code><technical_language>weird</technical_language>

Target:
public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } return path; }
Source:
<code>public void smokes() throws Exception { AtomicReference<Proc> proc = new AtomicReference<>(); try { JNLPLauncher launcher = new JNLPLauncher(true); launcher.setWebSocket(true); DumbSlave s = new DumbSlave("remote", tmp.newFolder("agent").getAbsolutePath(), launcher); r.jenkins.addNode(s); String secret = ((SlaveComputer) s.toComputer()).getJnlpMac(); File slaveJar = tmp.newFile(); FileUtils.copyURLToFile(new Slave.JnlpJar("slave.jar").getURL(), slaveJar); proc.set(r.createLocalLauncher().launch().cmds( JavaEnvUtils.getJreExecutable("java"), "-jar", slaveJar.getAbsolutePath(), "-jnlpUrl", r.getURL() + "computer/remote/slave-agent.jnlp", "-secret", secret ).stdout(System.out).start()); r.waitOnline(s); assertEquals("response", s.getChannel().call(new DummyTask())); assertNotNull(s.getChannel().call(new FatTask())); FreeStyleProject p = r.createFreeStyleProject(); p.setAssignedNode(s); <START> p.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo hello") : new Shell("dd if=/dev/random of=file.txt count=1024 bs=200;cat file.txt")); <END> r.buildAndAssertSuccess(p); s.toComputer().getLogText().writeLogTo(0, System.out); } finally { if (proc.get() != null) { proc.get().kill(); while (r.jenkins.getComputer("remote").isOnline()) { LOGGER.info("waiting for computer to go offline"); Thread.sleep(250); } } } }</code><technical_language>suggestion p.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo hello") : new Shell("dd if=/dev/random count=1024 bs=200"));</technical_language>

Target:
public void smokes() throws Exception { AtomicReference<Proc> proc = new AtomicReference<>(); try { JNLPLauncher launcher = new JNLPLauncher(true); launcher.setWebSocket(true); DumbSlave s = new DumbSlave("remote", tmp.newFolder("agent").getAbsolutePath(), launcher); r.jenkins.addNode(s); String secret = ((SlaveComputer) s.toComputer()).getJnlpMac(); File slaveJar = tmp.newFile(); FileUtils.copyURLToFile(new Slave.JnlpJar("slave.jar").getURL(), slaveJar); proc.set(r.createLocalLauncher().launch().cmds( JavaEnvUtils.getJreExecutable("java"), "-jar", slaveJar.getAbsolutePath(), "-jnlpUrl", r.getURL() + "computer/remote/slave-agent.jnlp", "-secret", secret ).stdout(System.out).start()); r.waitOnline(s); assertEquals("response", s.getChannel().call(new DummyTask())); assertNotNull(s.getChannel().call(new FatTask())); FreeStyleProject p = r.createFreeStyleProject(); p.setAssignedNode(s); p.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo hello") : new Shell("dd if=/dev/random count=1024 bs=200")); r.buildAndAssertSuccess(p); s.toComputer().getLogText().writeLogTo(0, System.out); } finally { if (proc.get() != null) { proc.get().kill(); while (r.jenkins.getComputer("remote").isOnline()) { LOGGER.info("waiting for computer to go offline"); Thread.sleep(250); } } } }
Source:
<code>void merge(List<InputFile> inputFiles, final long maxRowGroupSize, ParquetFileWriter writer) throws IOException { SizeEstimator estimator = new SizeEstimator(compressor.getCodecName() != CompressionCodecName.UNCOMPRESSED); MutableMergedBlock mergedBlock = null; for (InputFile file : inputFiles) { try (ParquetFileReader reader = ParquetFileReader.open(file)) { for (BlockMetaData blockMeta : reader.getRowGroups()) { PageReadStore group = reader.readNextRowGroup(); Preconditions.checkState(group != null, "number of groups returned by FileReader does not match metadata"); if (mergedBlock != null && mergedBlock.getCompressedBytesSize() + estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(mergedBlock, writer); mergedBlock = null; } if (mergedBlock == null && estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(ReadOnlyMergedBlock.of(blockMeta, group, schema, compressor), writer); continue; } if (mergedBlock == null) { mergedBlock = new MutableMergedBlock(schema); } long sizeBeforeMerge = mergedBlock.getCompressedBytesSize(); mergedBlock.merge(blockMeta, group); long currentBlockEffect = mergedBlock.getCompressedBytesSize() - sizeBeforeMerge; estimator.update(currentBlockEffect, blockMeta); } } } <START> if (mergedBlock != null) <END> saveBlockTo(mergedBlock, writer); }</code><technical_language>add '{' '}'</technical_language>

Target:
void merge(List<InputFile> inputFiles, final long maxRowGroupSize, ParquetFileWriter writer) throws IOException { SizeEstimator estimator = new SizeEstimator(compressor.getCodecName() != CompressionCodecName.UNCOMPRESSED); MutableMergedBlock mergedBlock = null; for (InputFile file : inputFiles) { try (ParquetFileReader reader = ParquetFileReader.open(file)) { for (BlockMetaData blockMeta : reader.getRowGroups()) { PageReadStore group = reader.readNextRowGroup(); Preconditions.checkState(group != null, "number of groups returned by FileReader does not match metadata"); if (mergedBlock != null && mergedBlock.getCompressedSize() + estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(mergedBlock, writer); mergedBlock = null; } if (mergedBlock == null && estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(ReadOnlyMergedBlock.of(blockMeta, group, schema, compressor), writer); continue; } if (mergedBlock == null) { mergedBlock = new MutableMergedBlock(schema); } long sizeBeforeMerge = mergedBlock.getCompressedSize(); mergedBlock.merge(blockMeta, group); long currentBlockEffect = mergedBlock.getCompressedSize() - sizeBeforeMerge; estimator.update(currentBlockEffect, blockMeta); } } } if (mergedBlock != null) saveBlockTo(mergedBlock, writer); }
Source:
<code>AuroraHeronShellController( String jobName, String cluster, String role, String env, String auroraFilename, boolean isVerbose) { this.topologyName = jobName; this.cliController = new AuroraCLIController( jobName, cluster, role, env, auroraFilename, isVerbose); stateMgrAdaptor = null; Config config = Config.toClusterMode(Config.newBuilder().putAll(ConfigLoader.loadClusterConfig()).build()); String stateMgrClass = Context.stateManagerClass(config); IStateManager stateMgr = null; try { stateMgr = ReflectionUtils.newInstance(stateMgrClass); stateMgr.initialize(config); stateMgrAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 5000); } catch (ClassNotFoundException e) { LOG.severe(e.getMessage()); } catch (InstantiationException e) { LOG.severe(e.getMessage()); } catch (IllegalAccessException e) { LOG.severe(e.getMessage()); <START> } <END> }</code><technical_language>Need throw exception if initialize stateMgr stateMgrAdaptor? Otherwise, AuroraHeronShellController is in a wrong state</technical_language>

Target:
AuroraHeronShellController(String jobName, String cluster, String role, String env, String auroraFilename, boolean isVerbose) throws ClassNotFoundException, InstantiationException, IllegalAccessException { this.topologyName = jobName; this.cliController = new AuroraCLIController(jobName, cluster, role, env, auroraFilename, isVerbose); Config config = Config.toClusterMode(Config.newBuilder().putAll(ConfigLoader.loadClusterConfig()).build()); String stateMgrClass = Context.stateManagerClass(config); IStateManager stateMgr = ReflectionUtils.newInstance(stateMgrClass); stateMgr.initialize(config); stateMgrAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 5000); }
Source:
<code>public void testRegister() { ApplicationContext context = mock(ApplicationContext.class); DynamicRepositoryDecoratorRegistry repositoryDecoratorRegistry = mock(DynamicRepositoryDecoratorRegistry.class); DynamicRepositoryDecoratorFactory decoratorFactory1 = mock(DynamicRepositoryDecoratorFactory.class); DynamicRepositoryDecoratorFactory decoratorFactory2 = mock(DynamicRepositoryDecoratorFactory.class); Map<String, DynamicRepositoryDecoratorFactory> map = new HashMap<>(); map.put("decoratorFactory1", decoratorFactory1); <START> map.put("decoratorFactory2", decoratorFactory2); <END> when(context.getBeansOfType(DynamicRepositoryDecoratorFactory.class)).thenReturn(map); DynamicRepositoryDecoratorFactoryRegistrar dynamicRepositoryDecoratorFactoryRegistrar = new DynamicRepositoryDecoratorFactoryRegistrar( repositoryDecoratorRegistry); dynamicRepositoryDecoratorFactoryRegistrar.register(context); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory1); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory2); }</code><technical_language>Remove newline</technical_language>

Target:
public void testRegister() { Map<String, DynamicRepositoryDecoratorFactory> map = new HashMap<>(); map.put("decoratorFactory1", decoratorFactory1); map.put("decoratorFactory2", decoratorFactory2); when(context.getBeansOfType(DynamicRepositoryDecoratorFactory.class)).thenReturn(map); DynamicRepositoryDecoratorFactoryRegistrar dynamicRepositoryDecoratorFactoryRegistrar = new DynamicRepositoryDecoratorFactoryRegistrar( repositoryDecoratorRegistry); dynamicRepositoryDecoratorFactoryRegistrar.register(context); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory1); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory2); }
Source:
<code>public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsCompletable() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.LowLevel lowLevel = mock(StorIOContentResolver.LowLevel.class); when(storIOContentResolver.lowLevel()).thenReturn(lowLevel); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare() .asRxCompletable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) <START> .hasCauseInstanceOf(IllegalStateException.class); <END> verify(storIOContentResolver).delete(); verify(storIOContentResolver).lowLevel(); verify(lowLevel).typeMapping(TestItem.class); verify(lowLevel, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, lowLevel); }</code><technical_language>nit: great check exception message some similar tests</technical_language>

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsCompletable() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.LowLevel lowLevel = mock(StorIOContentResolver.LowLevel.class); when(storIOContentResolver.lowLevel()).thenReturn(lowLevel); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare() .asRxCompletable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class) .hasMessage("Error has occurred during Delete operation. object = TestItem{data='null'}"); verify(storIOContentResolver).delete(); verify(storIOContentResolver).lowLevel(); verify(lowLevel).typeMapping(TestItem.class); verify(lowLevel, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, lowLevel); }
Source:
<code>public boolean isTrue(State state, String[] params) { if (!params[1].equalsIgnoreCase("")) { ObjectInstance container = state.getObject(params[1]); Set<String> contents = ContainerFactory.getContentNames(container); if (contents.isEmpty()) { return false; } ObjectInstance toPeel = null; for (String name : contents) { toPeel = state.getObject(name); boolean match = false; for (IngredientRecipe content : this.topLevelIngredient.getConstituentIngredients()) { if (content.getName().equals(toPeel.getName())) { <START> if (!content.hasToolAttribute("peeled")) { <END> return false; } match = true; break; } } if (!match) { AbstractMap<String, IngredientRecipe> necessaryTraits = this.topLevelIngredient.getNecessaryTraits(); Set<String> toMeltTraits = IngredientFactory.getTraits(toPeel); for (String trait : necessaryTraits.keySet()) { if (toMeltTraits.contains(trait)) { if (necessaryTraits.get(trait).hasToolAttribute("peeled")) { match = true; break; } } } if (!match) { return false; } } } return true; } else { for (IngredientRecipe content : topLevelIngredient.getConstituentIngredients()) { if (content.hasToolAttribute("peeled")) { return true; } } AbstractMap<String, IngredientRecipe> traitMap = topLevelIngredient.getConstituentNecessaryTraits(); for (String trait : traitMap.keySet()) { if (traitMap.get(trait).hasToolAttribute("peeled")) { return true; } } return false; } }</code><technical_language>define a static final string for peeled attribute. change in place</technical_language>

Target:
public boolean isTrue(State state, String[] params) { if (!params[1].equalsIgnoreCase("")) { ObjectInstance container = state.getObject(params[1]); Set<String> contents = ContainerFactory.getContentNames(container); if (contents.isEmpty()) { return false; } ObjectInstance toPeel = null; for (String name : contents) { toPeel = state.getObject(name); boolean match = false; List<IngredientRecipe> ingredientContents = this.topLevelIngredient.getConstituentIngredients(); for (IngredientRecipe content: ingredientContents) { if (content.getName().equals(toPeel.getName())) { if (!content.hasToolAttribute(PeelAction.PEELED)) { return false; } match = true; break; } } if (!match) { AbstractMap<String, IngredientRecipe> necessaryTraits = this.topLevelIngredient.getNecessaryTraits(); Set<String> toMeltTraits = IngredientFactory.getTraits(toPeel); for (Entry<String, IngredientRecipe> entry : necessaryTraits.entrySet()) { String trait = entry.getKey(); if (toMeltTraits.contains(trait)) { if (entry.getValue().hasToolAttribute(PeelAction.PEELED)) { match = true; break; } } } if (!match) { return false; } } } return true; } else { List<IngredientRecipe> contents = topLevelIngredient.getConstituentIngredients(); for (IngredientRecipe content : contents) { if (content.hasToolAttribute(PeelAction.PEELED)) { return true; } } AbstractMap<String, IngredientRecipe> traitMap = topLevelIngredient.getConstituentNecessaryTraits(); for (IngredientRecipe ing : traitMap.values()) { if (ing.hasToolAttribute(PeelAction.PEELED)) { return true; } } return false; } }
Source:
<code>public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; Collections.sort(list, new Comparator<PhysicalLocation>() { public int compare(final PhysicalLocation lhs, final PhysicalLocation rhs) { int retval = lhs.getReadGroup() - rhs.getReadGroup(); if (retval == 0) retval = lhs.getTile() - rhs.getTile(); if (retval == 0) retval = lhs.getX() - rhs.getX(); if (retval == 0) retval = lhs.getY() - rhs.getY(); return retval; } }); outer: for (int i = 0; i < length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs.getTile() < 0) continue; for (int j = i + 1; j < length; ++j) { final PhysicalLocation rhs = list.get(j); if ((rhs == keeper && opticalDuplicateFlags[i]) || opticalDuplicateFlags[j]) continue; if (lhs.getReadGroup() != rhs.getReadGroup()) continue outer; if (lhs.getTile() != rhs.getTile()) continue outer; if (rhs.getX() > lhs.getX() + this.opticalDuplicatePixelDistance) continue outer; if (Math.abs(lhs.getY() - rhs.getY()) <= this.opticalDuplicatePixelDistance) { if (rhs == keeper) opticalDuplicateFlags[i] = true; <START> else opticalDuplicateFlags[j] = true; <END> } } } return opticalDuplicateFlags; }</code><technical_language>logic right. a bit messy....would good another pair of eyes specific tests</technical_language>

Target:
public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { if (list.size() < 2) return new boolean[list.size()]; final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; final int distance = this.opticalDuplicatePixelDistance; final PhysicalLocation actualKeeper = keeperOrNull(list, keeper); if (actualKeeper != null) { for (int i=0; i<length; ++i) { final PhysicalLocation other = list.get(i); opticalDuplicateFlags[i] = closeEnough(actualKeeper, other, distance); } } for (int i=0; i<length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs == actualKeeper) continue; for (int j =i+1; j<length; ++j) { final PhysicalLocation rhs = list.get(j); if (rhs == actualKeeper) continue; if (opticalDuplicateFlags[i] && opticalDuplicateFlags[j]) continue; if (closeEnough(lhs, rhs, distance)) { final int index = opticalDuplicateFlags[j] ? i : j; opticalDuplicateFlags[index] = true; } } } return opticalDuplicateFlags; }
Source:
<code>private Example createExample(JsonNode node) { if (node instanceof ObjectNode) { ObjectExample obj = new ObjectExample(); ObjectNode on = (ObjectNode) node; for (Iterator<Entry<String, JsonNode>> x = on.fields(); x.hasNext(); ) { Entry<String, JsonNode> i = x.next(); String key = i.getKey(); JsonNode value = i.getValue(); obj.put(key, createExample(value)); } return obj; } else if (node instanceof ArrayNode) { ArrayExample arr = new ArrayExample(); ArrayNode an = (ArrayNode) node; for (JsonNode childNode : an) { arr.add(createExample(childNode)); } return arr; } else if (node instanceof DoubleNode) { return new DoubleExample(node.doubleValue()); } else if (node instanceof IntNode || node instanceof ShortNode) { return new IntegerExample(node.intValue()); } else if (node instanceof FloatNode) { return new FloatExample(node.floatValue()); } else if (node instanceof BigIntegerNode) { return new BigIntegerExample(node.bigIntegerValue()); } else if (node instanceof DecimalNode) { return new DecimalExample(node.decimalValue()); } else if (node instanceof LongNode) { return new LongExample(node.longValue()); <START> } else if (node instanceof NullNode) { <END> return new NullExample(); } else if (node instanceof BooleanNode) { return new BooleanExample(node.booleanValue()); } else { return new StringExample(node.asText()); } }</code><technical_language>above, support for null</technical_language>

Target:
private Example createExample(JsonNode node) { if (node instanceof ObjectNode) { ObjectExample obj = new ObjectExample(); ObjectNode on = (ObjectNode) node; for (Iterator<Entry<String, JsonNode>> x = on.fields(); x.hasNext(); ) { Entry<String, JsonNode> i = x.next(); String key = i.getKey(); JsonNode value = i.getValue(); obj.put(key, createExample(value)); } return obj; } else if (node instanceof ArrayNode) { ArrayExample arr = new ArrayExample(); ArrayNode an = (ArrayNode) node; for (JsonNode childNode : an) { arr.add(createExample(childNode)); } return arr; } else if (node instanceof DoubleNode) { return new DoubleExample(node.doubleValue()); } else if (node instanceof IntNode || node instanceof ShortNode) { return new IntegerExample(node.intValue()); } else if (node instanceof FloatNode) { return new FloatExample(node.floatValue()); } else if (node instanceof BigIntegerNode) { return new BigIntegerExample(node.bigIntegerValue()); } else if (node instanceof DecimalNode) { return new DecimalExample(node.decimalValue()); } else if (node instanceof LongNode) { return new LongExample(node.longValue()); } else if (node instanceof BooleanNode) { return new BooleanExample(node.booleanValue()); } else { return new StringExample(node.asText()); } }
Source:
<code><START> public Access(String accessType) { <END> value = accessType; }</code><technical_language>@RequiredArgConstructor</technical_language>

Target:
public Access(String accessType) { if (Strings.isNullOrEmpty(accessType) || accessType.equalsIgnoreCase("null")) { value = CONTROLLED; } else { value = accessType; } }
Source:
<code>protected void unfoldModules(JSONObject modules, String[] resultArray) throws IOException, JSONException { final String sourceMethod = "unfoldModules"; if (isTraceLogging) { log.entering(RequestedModuleNames.class.getName(), sourceMethod, new Object[]{modules, Arrays.asList(resultArray)}); } Iterator<?> it = modules.keys(); String[] prefixes = null; <START> if (modules.has(PLUGIN_PREFIXES_PROP_NAME)) { <END> @SuppressWarnings("unchecked") Map<String, String> oPrefixes = (Map<String, String>) modules.get(PLUGIN_PREFIXES_PROP_NAME); prefixes = new String[oPrefixes.size()]; for (String key : oPrefixes.keySet()) { prefixes[Integer.parseInt(oPrefixes.get(key))] = key; } } while (it.hasNext()) { String key = (String) it.next(); if (!NON_PATH_PROP_PATTERN.matcher(key).find()) { unfoldModulesHelper(modules.get(key), key, prefixes, resultArray); } } if (isTraceLogging) { log.exiting(RequestedModuleNames.class.getName(), sourceMethod, Arrays.asList(resultArray)); } }</code><technical_language>this change from? do changes in common.lang3 affect JSONObject API</technical_language>

Target:
protected void unfoldModules(JSONObject modules, String[] resultArray) throws IOException, JSONException { final String sourceMethod = "unfoldModules"; if (isTraceLogging) { log.entering(RequestedModuleNames.class.getName(), sourceMethod, new Object[]{modules, Arrays.asList(resultArray)}); } Iterator<?> it = modules.keys(); String[] prefixes = null; if (modules.containsKey(PLUGIN_PREFIXES_PROP_NAME)) { @SuppressWarnings("unchecked") Map<String, String> oPrefixes = (Map<String, String>) modules.get(PLUGIN_PREFIXES_PROP_NAME); prefixes = new String[oPrefixes.size()]; for (String key : oPrefixes.keySet()) { prefixes[Integer.parseInt(oPrefixes.get(key))] = key; } } while (it.hasNext()) { String key = (String) it.next(); if (!NON_PATH_PROP_PATTERN.matcher(key).find()) { unfoldModulesHelper(modules.get(key), key, prefixes, resultArray); } } if (isTraceLogging) { log.exiting(RequestedModuleNames.class.getName(), sourceMethod, Arrays.asList(resultArray)); } }
Source:
<code>public static By byAttribute(String attributeName, String attributeValue) { <START> return By.cssSelector(String.format("[%s=\"%s\"]", attributeName, attributeValue)); <END> }</code><technical_language>doesn' solve problem yet. replace existing "-s '-s \" \'</technical_language>

Target:
public static By byAttribute(String attributeName, String attributeValue) { return By.cssSelector(String.format("[%s=\"%s\"]", attributeName, attributeValue.replaceAll("\"", "\\\\\""))); }
Source:
<code><START> public void run(String step, MigrationContext migrationContext) { <END> TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); state = "after"; }</code><technical_language>Missing @Override</technical_language>

Target:
public void run(String step, MigrationContext migrationContext) { state = "after"; }
Source:
<code>public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<String> repoNames = new HashSet<String>(projects.length); String lastBranch = null; String lastBranchStatus = null; for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repoNames.add(DecoratableResourceHelper .getRepositoryName(repository)); lastBranch = DecoratableResourceHelper.getShortBranch(repository); lastBranchStatus = DecoratableResourceHelper <START> .getBranchStatus(repository); <END> } if(repoNames.size() == 1) { repositoryName = repoNames.iterator().next(); branch = lastBranch; branchStatus = lastBranchStatus; } }</code><technical_language>lastBranch lastBranchStatus done costly</technical_language>

Target:
public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<String> repoNames = new HashSet<String>(projects.length); String discoveredBranch = null; String discoveredBranchStatus = null; for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repoNames.add(DecoratableResourceHelper .getRepositoryName(repository)); if (discoveredBranch == null) { discoveredBranch = DecoratableResourceHelper .getShortBranch(repository); discoveredBranchStatus = DecoratableResourceHelper .getBranchStatus(repository); } } if(repoNames.size() == 1) { repositoryName = repoNames.iterator().next(); branch = discoveredBranch; branchStatus = discoveredBranchStatus; } }
Source:
<code><START> public static @CheckForNull User get(String idOrFullName, boolean create) { <END> return get(idOrFullName, create, Collections.emptyMap()); }</code><technical_language>@Nullable I think. (Nullability varies create parameter, a caller passing true need check for null.)</technical_language>

Target:
public static @Nullable User get(String idOrFullName, boolean create) { return get(idOrFullName, create, Collections.emptyMap()); }
Source:
<code>private Script getScript(byte[] scriptBytes) { Script script = null; try { script = new Script(scriptBytes); } catch (Exception e) { <START> log.warn("Enable to parse script. ", scriptBytes); <END> } return script; }</code><technical_language>log.warn("_Unable_ parse script") missing means scriptBytes anyway, turning a string is worth here</technical_language>

Target:
private Script getScript(byte[] scriptBytes) { Script script = null; try { script = new Script(scriptBytes); } catch (Exception e) { log.warn("Unable to parse script"); } return script; }
Source:
<code>public static void main(String[] args) { <START> final String STREAM_NAME = "exampleStream"; <END> try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = null; try { streamClient.create(STREAM_NAME); streamWriter = streamClient.createWriter(STREAM_NAME); long currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Get TTL for stream: {}", currentTTL, STREAM_NAME); long newTTL = 18000; streamClient.setTTL(STREAM_NAME, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, STREAM_NAME); currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", STREAM_NAME); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { if (streamWriter != null) { streamWriter.close(); } streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }</code><technical_language>STREAM_NAME moved out a static member variable is a constant</technical_language>

Target:
public static void main(String[] args) { try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = null; try { streamClient.create(STREAM_NAME); streamWriter = streamClient.createWriter(STREAM_NAME); long currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Get TTL for stream: {}", currentTTL, STREAM_NAME); long newTTL = 18000; streamClient.setTTL(STREAM_NAME, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, STREAM_NAME); currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", STREAM_NAME); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { if (streamWriter != null) { streamWriter.close(); } streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }
Source:
<code>public static int ceilPowerOfTwo(int val) { <START> if(val == Integer.MIN_VALUE) <END> return 0; int result = val - 1; result = (result >> 1) | result; result = (result >> 2) | result; result = (result >> 4) | result; result = (result >> 8) | result; result = (result >> 16) | result; result++; return result; }</code><technical_language>I admit I considered negative numbers all. min max integer suffer overflow though, matters</technical_language>

Target:
public static int ceilPowerOfTwo(int val) { int result = val - 1; result = (result >> 1) | result; result = (result >> 2) | result; result = (result >> 4) | result; result = (result >> 8) | result; result = (result >> 16) | result; result++; return (result & ~(Integer.MIN_VALUE)); }
Source:
<code>public PipelineResult run() throws IOException { boolean runInParallel = true; if (isLocal(from.getDataset()) || isLocal(to.getDataset())) { runInParallel = false; } if (runInParallel) { TaskUtil.configure(getConf()) .addJarPathForClass(HiveConf.class) .addJarForClass(AvroKeyInputFormat.class); Pipeline pipeline = new MRPipeline(getClass(), getConf()); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); <START> if (compact) { <END> collection = TaskUtil.partition(collection, to.getDataset().getDescriptor(), numWriters); } pipeline.write(collection, CrunchDatasets.asTarget(to)); PipelineResult result = pipeline.done(); StageResult sr = Iterables.getFirst(result.getStageResults(), null); if (sr != null && MAP_INPUT_RECORDS != null) { this.count = sr.getCounterValue(MAP_INPUT_RECORDS); } return result; } else { Pipeline pipeline = MemPipeline.getInstance(); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); boolean threw = true; DatasetWriter<E> writer = to.newWriter(); try { writer.open(); for (E entity : collection.materialize()) { writer.write(entity); count += 1; } threw = false; } finally { Closeables.close(writer, threw); } return pipeline.done(); } }</code><technical_language>Remove TODO line ("Add reduce phase allow control number of reducers")</technical_language>

Target:
public PipelineResult run() throws IOException { boolean runInParallel = true; if (isLocal(from.getDataset()) || isLocal(to.getDataset())) { runInParallel = false; } if (runInParallel) { TaskUtil.configure(getConf()) .addJarPathForClass(HiveConf.class) .addJarForClass(AvroKeyInputFormat.class); Pipeline pipeline = new MRPipeline(getClass(), getConf()); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); if (compact) { collection = partition(collection, to.getDataset().getDescriptor(), numWriters); } pipeline.write(collection, CrunchDatasets.asTarget(to)); PipelineResult result = pipeline.done(); StageResult sr = Iterables.getFirst(result.getStageResults(), null); if (sr != null && MAP_INPUT_RECORDS != null) { this.count = sr.getCounterValue(MAP_INPUT_RECORDS); } return result; } else { Pipeline pipeline = MemPipeline.getInstance(); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); boolean threw = true; DatasetWriter<E> writer = to.newWriter(); try { writer.open(); for (E entity : collection.materialize()) { writer.write(entity); count += 1; } threw = false; } finally { Closeables.close(writer, threw); } return pipeline.done(); } }
Source:
<code>public void actionPerformed(ActionEvent e) { Preferences prefs = NbPreferences.forModule(CloudStorageSettingsPanel.class); String id = prefs.get(S3_ID, ""); String secret = prefs.get(S3_SECRET, ""); try { S3FileSystemView viewer = new S3FileSystemView(id, secret); JFileChooser chooser = new JFileChooser("", viewer); int returnVal = chooser.showOpenDialog(new JFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); <START> System.out.println("Found a file! It is " + f); <END> copyAndOpenFile(viewer, f); } else { System.out.println("No file selected..."); } } catch (Exception ex) { GUIHelpers.displayErrorDialog("There was a problem setting up the S3 viewer, check your settings."); logger.log(Level.WARNING, "Problem working with S3.", ex); } }</code><technical_language>logger instead</technical_language>

Target:
public void actionPerformed(ActionEvent e) { Preferences prefs = NbPreferences.forModule(CloudStorageSettingsPanel.class); String id = prefs.get(S3_ID, ""); String secret = prefs.get(S3_SECRET, ""); try { S3FileSystemView viewer = new S3FileSystemView(id, secret); JFileChooser chooser = new JFileChooser("", viewer); int returnVal = chooser.showOpenDialog(new JFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); logger.log(Level.INFO, "Opened S3 file", f); copyAndOpenFile(viewer, f); } } catch (Exception ex) { GUIHelpers.displayErrorDialog("There was a problem setting up the S3 viewer, check your settings."); logger.log(Level.WARNING, "Problem working with S3.", ex); } }
Source:
<code>public boolean canExecute(@NonNull ITmfTrace trace) { <START> if (trace instanceof IKernelTrace) { <END> IKernelTrace kernelTrace = (IKernelTrace) trace; if (kernelTrace instanceof ITmfTraceWithPreDefinedEvents) { ITmfTraceWithPreDefinedEvents traceWithPreDefinedEvents = (ITmfTraceWithPreDefinedEvents) kernelTrace; IKernelAnalysisEventLayout layout = kernelTrace.getKernelEventLayout(); Set<@NonNull ? extends ITmfEventType> containedEventTypes = traceWithPreDefinedEvents.getContainedEventTypes(); Set<@NonNull String> eventNames = containedEventTypes.stream().map(eventType -> eventType.getName()).collect(Collectors.toSet()); if (eventNames.contains(layout.eventNetworkSend())) { return true; } eventNames.retainAll(layout.eventNetworkReceive()); return !eventNames.isEmpty(); } return true; } return false; }</code><technical_language>a requirement instead override getAnalysisRequirements instead (that provide a free text if analysis execute, I ;-) layout requirement do support events return Collections, hard add</technical_language>

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { if (trace instanceof IKernelTrace) { IKernelTrace kernelTrace = (IKernelTrace) trace; if (kernelTrace instanceof ITmfTraceWithPreDefinedEvents) { ITmfTraceWithPreDefinedEvents traceWithPreDefinedEvents = (ITmfTraceWithPreDefinedEvents) kernelTrace; IKernelAnalysisEventLayout layout = kernelTrace.getKernelEventLayout(); Set<@NonNull ? extends ITmfEventType> containedEventTypes = traceWithPreDefinedEvents.getContainedEventTypes(); Set<@NonNull String> eventNames = containedEventTypes.stream().map(eventType -> eventType.getName()).collect(Collectors.toSet()); if (eventNames.contains(layout.eventsNetworkSend())) { return true; } eventNames.retainAll(layout.eventsNetworkReceive()); return !eventNames.isEmpty(); } return true; } return false; }
Source:
<code>private static InputSource[] loadXsds(String beansXmlAsString) { List<InputSource> xsds = new ArrayList<InputSource>(); String beans11 = "beans_1_1.xsd"; <START> for (XmlSchema schema : XmlSchema.getSchemas(beansXmlAsString != null && beansXmlAsString.contains(beans11))) { <END> InputSource source = loadXsd(schema.getFileName(), schema.getClassLoader()); if (source != null) { xsds.add(source); } } return xsds.toArray(EMPTY_INPUT_SOURCE_ARRAY); }</code><technical_language>beans11 variable is needed - XmlSchema.CDI11.getFileName() instead</technical_language>

Target:
private static InputSource[] loadXsds(String beansXmlAsString) { List<InputSource> xsds = new ArrayList<InputSource>(); for (XmlSchema schema : XmlSchema.getSchemas(beansXmlAsString != null && beansXmlAsString.contains(XmlSchema.CDI11.getFileName()))) { InputSource source = loadXsd(schema.getFileName(), schema.getClassLoader()); if (source != null) { xsds.add(source); } } return xsds.toArray(EMPTY_INPUT_SOURCE_ARRAY); }
Source:
<code>private void setText(final String value) { if (isEmpty(value)) { valueText.classList.add("none"); valueText.textContent = none(); } else { <START> valueText.classList.remove("none"); <END> valueText.textContent = value; } }</code><technical_language>please introduce constant for CSS_HIGHLIGHTED</technical_language>

Target:
private void setText(final String value) { if (isNULL(value)) { valueText.classList.add(NONE_CSS_CLASS); valueText.textContent = none(); } else { valueText.classList.remove(NONE_CSS_CLASS); valueText.textContent = value; } }