auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target) { String kind = determineKind(optionContext); SpringXDOperations springXDOperations = xdShell.getSpringXDOperations(); DeployedCriteria criteria = DeployedCriteria.parse(optionContext); boolean kindSupported = true; try { if ("stream".equals(kind)) { populate(completions, springXDOperations.streamOperations().list(), criteria, "Streams"); } else if ("job".equals(kind)) { populate(completions, springXDOperations.jobOperations().list(), criteria, "Jobs"); } else if ("counter".equals(kind)) { populate(completions, springXDOperations.counterOperations().list(), criteria, "Counters"); } else if ("fvc".equals(kind)) { populate(completions, springXDOperations.fvcOperations().list(), criteria, "Field Value Counters"); } else if ("gauge".equals(kind)) { populate(completions, springXDOperations.gaugeOperations().list(), criteria, "Gauges"); } else if ("rich-gauge".equals(kind)) { populate(completions, springXDOperations.richGaugeOperations().list(), criteria, "Rich Gauges"); } else if ("aggregate-counter".equals(kind)) { populate(completions, springXDOperations.aggrCounterOperations().list(), criteria, "Aggregate Counters"); } else { kindSupported = false; } } <START> catch (Exception e) { <END> return false; } Assert.isTrue(kindSupported, "Unsupported kind: " + kind); return true; }</code><technical_language>Granted this is a catchall for exception occur. want log a debug, in future catch specific exceptions</technical_language>

Target:
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target) { String kind = determineKind(optionContext); SpringXDOperations springXDOperations = xdShell.getSpringXDOperations(); DeployedCriteria criteria = DeployedCriteria.parse(optionContext); boolean kindSupported = true; try { if ("stream".equals(kind)) { populate(completions, springXDOperations.streamOperations().list(), criteria, "Streams"); } else if ("job".equals(kind)) { populate(completions, springXDOperations.jobOperations().list(), criteria, "Jobs"); } else if ("counter".equals(kind)) { populate(completions, springXDOperations.counterOperations().list(), criteria, "Counters"); } else if ("fvc".equals(kind)) { populate(completions, springXDOperations.fvcOperations().list(), criteria, "Field Value Counters"); } else if ("gauge".equals(kind)) { populate(completions, springXDOperations.gaugeOperations().list(), criteria, "Gauges"); } else if ("rich-gauge".equals(kind)) { populate(completions, springXDOperations.richGaugeOperations().list(), criteria, "Rich Gauges"); } else if ("aggregate-counter".equals(kind)) { populate(completions, springXDOperations.aggrCounterOperations().list(), criteria, "Aggregate Counters"); } else { kindSupported = false; } } catch (Exception e) { LOGGER.warning(String.format("Completion unavailable (%s)", e.getMessage())); return false; } Assert.isTrue(kindSupported, "Unsupported kind: " + kind); return true; }
Source:
<code><START> public synchronized void upgradeAttributes( final boolean force ) <END> { if ( isUpgradeRunning() ) { return; } if ( !isLegacyAttributesDirectoryPresent() ) { getLogger().debug( "Legacy attribute directory not present, no need for attribute upgrade." ); } else { if ( isUpgradeDone( getLegacyAttributesDirectory(), null ) ) { getLogger().info( "Legacy attribute directory present, but is marked already as upgraded. Please delete, move or rename the \"{}\" folder.", getLegacyAttributesDirectory().getAbsolutePath() ); } else { if ( force || UPGRADE ) { if ( force ) { getLogger().info( "Legacy attribute directory present, and upgrade is needed and if forced. Starting background upgrade." ); } else { getLogger().info( "Legacy attribute directory present, and upgrade is needed. Starting background upgrade." ); } this.upgraderThread = new AttributeUpgraderThread( getLegacyAttributesDirectory(), repositoryRegistry, upgradeThrottleUps ); this.upgraderThread.start(); } else { getLogger().info( "Legacy attribute directory present, but upgrade prevented by system property. Not upgrading it." ); } } } }</code><technical_language>amount of locking required for correctness? this method acquire dreaded configuration lock getLegacyAttributesDirectory() call? If need sync entire method, want external calls lock</technical_language>

Target:
public synchronized void upgradeAttributes( final boolean force ) { if ( isUpgradeRunning() ) { return; } if ( !isLegacyAttributesDirectoryPresent() ) { getLogger().debug( "Legacy attribute directory not present, no need for attribute upgrade." ); } else { if ( isUpgradeFinished() ) { getLogger().info( "Legacy attribute directory present, but is marked already as upgraded. Please delete, move or rename the \"{}\" directory.", getLegacyAttributesDirectory().getAbsolutePath() ); } else { if ( force || UPGRADE ) { if ( force ) { getLogger().info( "Legacy attribute directory present, and upgrade is needed and if forced. Starting background upgrade." ); } else { getLogger().info( "Legacy attribute directory present, and upgrade is needed. Starting background upgrade." ); } this.upgraderThread = new AttributeUpgraderThread( getLegacyAttributesDirectory(), repositoryRegistry, upgradeThrottleUps ); this.upgraderThread.start(); } else { getLogger().info( "Legacy attribute directory present, but upgrade prevented by system property. Not upgrading it." ); } } } }
Source:
<code>public static BlockingTimeLimitedLockService create(CloseableLockService lockService, long blockingTimeLimitMillis) { return new BlockingTimeLimitedLockService( lockService, <START> SimpleTimeLimiter.create(Executors.newCachedThreadPool()), <END> blockingTimeLimitMillis); }</code><technical_language>PtExecutors</technical_language>

Target:
public static BlockingTimeLimitedLockService create(CloseableLockService lockService, long blockingTimeLimitMillis) { return new BlockingTimeLimitedLockService( lockService, SimpleTimeLimiter.create(PTExecutors.newCachedThreadPool()), blockingTimeLimitMillis); }
Source:
<code>public void retryIncBootstrapExternalTablesFromDifferentDumpWithoutCleanTablesConfig() throws Throwable { List<String> dumpWithClause = Collections.singletonList( "'" + HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES.varname + "'='false'" ); List<String> loadWithClause = externalTableBasePathWithClause(); WarehouseInstance.Tuple tupleBootstrapWithoutExternal = primary .run("use " + primaryDbName) .run("create external table t1 (id int)") <START> .run("insert into table t1 values (1)") <END> .run("create table t2 as select * from t1") .dump(primaryDbName, null, dumpWithClause); replica.load(replicatedDbName, tupleBootstrapWithoutExternal.dumpLocation, loadWithClause); dumpWithClause = Arrays.asList("'" + HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES.varname + "'='true'", "'" + HiveConf.ConfVars.REPL_BOOTSTRAP_EXTERNAL_TABLES.varname + "'='true'"); WarehouseInstance.Tuple tupleIncWithExternalBootstrap = primary.run("use " + primaryDbName) .run("create table t3 as select * from t1") .dump(primaryDbName, tupleBootstrapWithoutExternal.lastReplicationId, dumpWithClause); WarehouseInstance.Tuple tupleNewIncWithExternalBootstrap = primary.dump(primaryDbName, tupleBootstrapWithoutExternal.lastReplicationId, dumpWithClause); replica.load(replicatedDbName, tupleIncWithExternalBootstrap.dumpLocation, loadWithClause); replica.loadFailure(replicatedDbName, tupleNewIncWithExternalBootstrap.dumpLocation, loadWithClause, ErrorMsg.REPL_BOOTSTRAP_LOAD_PATH_NOT_VALID.getErrorCode()); }</code><technical_language>if dump is out external for load need of external</technical_language>

Target:
public void retryIncBootstrapExternalTablesFromDifferentDumpWithoutCleanTablesConfig() throws Throwable { List<String> dumpWithClause = Collections.singletonList( "'" + HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES.varname + "'='false'" ); List<String> loadWithClause = externalTableBasePathWithClause(); WarehouseInstance.Tuple tupleBootstrapWithoutExternal = primary .dump(primaryDbName, null, dumpWithClause); replica.load(replicatedDbName, tupleBootstrapWithoutExternal.dumpLocation, loadWithClause); dumpWithClause = Arrays.asList("'" + HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES.varname + "'='true'", "'" + HiveConf.ConfVars.REPL_BOOTSTRAP_EXTERNAL_TABLES.varname + "'='true'"); WarehouseInstance.Tuple tupleIncWithExternalBootstrap = primary.run("use " + primaryDbName) .run("create external table t1 (id int)") .run("insert into table t1 values (1)") .run("create table t2 as select * from t1") .dump(primaryDbName, tupleBootstrapWithoutExternal.lastReplicationId, dumpWithClause); WarehouseInstance.Tuple tupleNewIncWithExternalBootstrap = primary.dump(primaryDbName, tupleBootstrapWithoutExternal.lastReplicationId, dumpWithClause); replica.load(replicatedDbName, tupleIncWithExternalBootstrap.dumpLocation, loadWithClause); replica.loadFailure(replicatedDbName, tupleNewIncWithExternalBootstrap.dumpLocation, loadWithClause, ErrorMsg.REPL_BOOTSTRAP_LOAD_PATH_NOT_VALID.getErrorCode()); }
Source:
<code>public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(String className, String bdaId) { try { final ClassFileInfo classFileInfo = classFileServices.getClassFileInfo(className); <START> final boolean checkTypeModifiers = isJandexSetFlagsAvailable(); <END> if ((classFileInfo.getModifiers() & BytecodeUtils.ANNOTATION) != 0) { return null; } if (classFileInfo.isVetoed()) { return null; } if(!checkTypeModifiers){ BootstrapLogger.LOG.usingOldJandexVersion(); } Set<ExtensionObserverMethodImpl<?, ?>> observerMethods = Collections.emptySet(); if (containerLifecycleEvents.isProcessAnnotatedTypeObserved()) { observerMethods = resolver.resolveProcessAnnotatedTypeObservers(classFileServices, className); if (!observerMethods.isEmpty()) { return createContext(className, classFileInfo, observerMethods, bdaId); } } if (Beans.isDecoratorDeclaringInAppropriateConstructor(classFileInfo)) { BootstrapLogger.LOG.decoratorWithNonCdiConstructor(classFileInfo.getClassName()); } if (Beans.isTypeManagedBeanOrDecoratorOrInterceptor(classFileInfo, checkTypeModifiers)) { return createContext(className, classFileInfo, observerMethods, bdaId); } return null; } catch (ClassFileInfoException e) { BootstrapLogger.LOG.exceptionLoadingAnnotatedType(e.getMessage()); return fallback.loadAnnotatedType(className, bdaId); } }</code><technical_language>I more efficient declare this FastAnnotatedTypeLoader class. applies BootstrapLogger.LOG.usingOldJandexVersion()</technical_language>

Target:
public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(String className, String bdaId) { try { final ClassFileInfo classFileInfo = classFileServices.getClassFileInfo(className); if ((classFileInfo.getModifiers() & BytecodeUtils.ANNOTATION) != 0) { return null; } if (classFileInfo.isVetoed()) { return null; } Set<ExtensionObserverMethodImpl<?, ?>> observerMethods = Collections.emptySet(); if (containerLifecycleEvents.isProcessAnnotatedTypeObserved()) { observerMethods = resolver.resolveProcessAnnotatedTypeObservers(classFileServices, className); if (!observerMethods.isEmpty()) { return createContext(className, classFileInfo, observerMethods, bdaId); } } if (Beans.isDecoratorDeclaringInAppropriateConstructor(classFileInfo)) { BootstrapLogger.LOG.decoratorWithNonCdiConstructor(classFileInfo.getClassName()); } if (Beans.isTypeManagedBeanOrDecoratorOrInterceptor(classFileInfo, checkTypeModifiers)) { return createContext(className, classFileInfo, observerMethods, bdaId); } return null; } catch (ClassFileInfoException e) { BootstrapLogger.LOG.exceptionLoadingAnnotatedType(e.getMessage()); return fallback.loadAnnotatedType(className, bdaId); } }
Source:
<code>public void init() { super.initialize(); initFileSystem(); registerAppDefinitions(); final Collection<Diagram> diagrams = getAllDiagrams(); if ( null != diagrams && !diagrams.isEmpty() ) { <START> for ( Diagram diagram : diagrams ) { <END> getRegistry().register( diagram ); } } }</code><technical_language>start Java8. diagrams.forEach..</technical_language>

Target:
public void init() { super.initialize(); initFileSystem(); registerAppDefinitions(); final Collection<Diagram> diagrams = getAllDiagrams(); if ( null != diagrams ) { diagrams.forEach( diagram -> getRegistry().register( diagram ) ); } }
Source:
<code>public void generateCompiledAlphaNetwork(KieBaseModelImpl kBaseModel, InternalKieModule kModule, InternalKnowledgeBase kBase) { final String configurationProperty = kBaseModel.getKModule().getConfigurationProperty("drools.alphaNetworkCompiler"); final Boolean isAlphaNetworkEnabled; <START> if(configurationProperty != null) { <END> isAlphaNetworkEnabled = Boolean.valueOf(configurationProperty); } else { isAlphaNetworkEnabled = false; } if (isAlphaNetworkEnabled) { KnowledgeBuilder kbuilder = kModule.getKnowledgeBuilderForKieBase(kBaseModel.getName()); kBase.getRete().getEntryPointNodes().values().stream() .flatMap(ep -> ep.getObjectTypeNodes().values().stream()) .filter(f -> !InitialFact.class.isAssignableFrom(f.getObjectType().getClassType())) .forEach(otn -> otn.setCompiledNetwork(ObjectTypeNodeCompiler.compile(((KnowledgeBuilderImpl) kbuilder), otn))); } }</code><technical_language>Nullcheck needed here, Boolean.valueOf(String) handles that</technical_language>

Target:
public void generateCompiledAlphaNetwork(KieBaseModelImpl kBaseModel, InternalKieModule kModule, InternalKnowledgeBase kBase) { final String configurationProperty = kBaseModel.getKModule().getConfigurationProperty(ALPHA_NETWORK_COMPILER_OPTION); final Boolean isAlphaNetworkEnabled = Boolean.valueOf(configurationProperty); if (isAlphaNetworkEnabled) { KnowledgeBuilder kbuilder = kModule.getKnowledgeBuilderForKieBase(kBaseModel.getName()); kBase.getRete().getEntryPointNodes().values().stream() .flatMap(ep -> ep.getObjectTypeNodes().values().stream()) .filter(f -> !InitialFact.class.isAssignableFrom(f.getObjectType().getClassType())) .forEach(otn -> otn.setCompiledNetwork(ObjectTypeNodeCompiler.compile(((KnowledgeBuilderImpl) kbuilder), otn))); } }
Source:
<code>public void checkAbilityToBuildServiceWithDefinedParametersAndNodeSetInProperties(){ try { String definedNode = findDefaultNode().getAbsolutePath(); System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode); AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1"). usingPort(4000).withArgument(GeneralServerFlag.TEMP_DIRECTORY, <START> "C:/Windows/Temp")); <END> } finally { System.clearProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY); } }</code><technical_language>Is this test pass non-windows</technical_language>

Target:
public void checkAbilityToBuildServiceWithDefinedParametersAndNodeSetInProperties(){ try { String definedNode = findCustomNode().getAbsolutePath(); System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode); AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1"). usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,"")); } finally { System.clearProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY); } }
Source:
<code>protected void postConnect(OneTimeCallback callback) throws ClientConnectionException { try { <START> final int interestedOps = SelectionKey.OP_READ; <END> reactor.wakeup(); final ReactorClient client = this; final FutureTask<SelectionKey> task = scheduleTask(new Retryable<SelectionKey>( new Callable<SelectionKey>() { @Override public SelectionKey call() throws ClosedChannelException { int ops = interestedOps | SelectionKey.OP_WRITE; return channel.register(selector, ops , client); } }, this.policy)); key = task.get(); this.nioEngine = new SSLEngineNioHelper(channel, createSSLEngine(this.client), callback, this); this.nioEngine.beginHandshake(); } catch (SSLException | InterruptedException | ExecutionException e) { log.error("Connection issues during ssl client creation", e); throw new ClientConnectionException(e); } if (key == null) { throw new ClientConnectionException("Connection issue during post connect"); } }</code><technical_language>interestedOps is redundant. enum parameter</technical_language>

Target:
protected void postConnect(OneTimeCallback callback) throws ClientConnectionException { try { final ReactorClient client = this; final FutureTask<SelectionKey> task = scheduleTask(new Retryable<SelectionKey>( new Callable<SelectionKey>() { @Override public SelectionKey call() throws ClosedChannelException { return channel.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE , client); } }, this.policy)); key = task.get(); this.nioEngine = new SSLEngineNioHelper(channel, createSSLEngine(this.client), callback, this); this.nioEngine.beginHandshake(); } catch (SSLException | InterruptedException | ExecutionException e) { log.error("Connection issues during ssl client creation", e); throw new ClientConnectionException(e); } if (key == null) { throw new ClientConnectionException("Connection issue during post connect"); } }
Source:
<code>private void start() { synchronized (lock) { if (manager != null) { throw new IllegalStateException("Cache pool has already been started"); } try { System.setProperty("net.sf.ehcache.skipUpdateCheck", "" + true); } catch (SecurityException e) { } manager = new CacheManager(new Factory().toConfiguration()); for (CacheProvider<?, ?> p : caches.values()) { Ehcache eh = manager.getEhcache(p.getName()); EntryCreator<?, ?> c = p.getEntryCreator(); if (c != null) { if (p.disk()) { <START> p.bind(new PopulatingProtobufCache(eh, c, p.getKeyClass(), p <END> .getValueClass(), p.getValueProvider())); } else { p.bind(new PopulatingCache(eh, c)); } } else { if (p.disk()) { p.bind(new SimpleProtobufCache(eh, p.getKeyClass(), p .getValueClass(), p.getValueProvider())); } else { p.bind(new SimpleCache(eh)); } } } } }</code><technical_language>classes virtual identical. cleaner one, ProtobufCache wrapping/unwrapping for us, takes a Cache<K,V> backing store. if (c != null && p.disk()) { c = new ProtobufEntryCreator(p.getValueClass(), c); } Cache<?,?> m; if (c != null) { m = new PopulatingCache(eh, c); } else { m = new SimpleCache(eh); } if (p.disk()) { m = new ProtobufCache(p.getKeyClass(), p.getValueClass(), p.getValueProvider(), m); } p.bind(m); ProtobufEntryCreator is working SerializableProtobuf input key result types wrapping user's EntryCreator, ProtobufCache is wrapping keys values in SimpleProtobufCache. effect is same, ehcache sees SerializableProtobuf type, a lot code duplication</technical_language>

Target:
private void start() { synchronized (lock) { if (manager != null) { throw new IllegalStateException("Cache pool has already been started"); } try { System.setProperty("net.sf.ehcache.skipUpdateCheck", "" + true); } catch (SecurityException e) { } manager = new CacheManager(new Factory().toConfiguration()); for (CacheProvider<?, ?> p : caches.values()) { Ehcache eh = manager.getEhcache(p.getName()); EntryCreator<?, ?> c = p.getEntryCreator(); if (c != null && p.disk()) { c = new ProtobufEntryCreator(c, p.getKeyClass(), p.getValueClass()); } Cache m; if (c != null) { m = new PopulatingCache(eh, c); } else { m = new SimpleCache(eh); } if (p.disk()) { m = new ProtobufCache(m, p.getKeyClass(), p.getValueClass(), p .getValueProvider()); } p.bind(m); } } }
Source:
<code>public boolean testFinished(final Class<?> testClass) { <START> return finishedTests.contains(testClass.getName()); <END> }</code><technical_language>missing something, testFinished(class) == testStarted(class) (either a test starts finishes, starts). method (perhaps named wasRun)</technical_language>

Target:
private boolean testFinished(final Class<?> testClass) { return finishedTests.contains(testClass.getName()); }
Source:
<code>public ProjectCacheCleaner(final File projectCacheDir, final double percentageOfDisk, final double throttlePercentage) { Preconditions.checkNotNull(projectCacheDir); Preconditions.checkArgument(projectCacheDir.exists()); Preconditions.checkArgument(percentageOfDisk > 0 && percentageOfDisk <= 1); this.projectCacheDir = projectCacheDir; this.percentageOfDisk = percentageOfDisk; this.throttlePercentage = throttlePercentage; log.info("ProjectCacheCleaner constructor called. ProjectCacheDir = {}, thresh-hold = %, throttle at %", projectCacheDir.toPath(), this.percentageOfDisk, this.throttlePercentage); cachedProjects = new HashMap<>(); projectsUnderDeletion = new ConcurrentHashMap<>(); barrier = new ReentrantLock(); emptyQCond = barrier.newCondition(); <START> deletionService = Executors.newFixedThreadPool(CLEANING_SERVICE_THREAD_NUM); <END> }</code><technical_language>I this defined time declaration well. Please final</technical_language>

Target:
public ProjectCacheCleaner(final File projectCacheDir, final double percentageOfDisk, final double throttlePercentage) { Preconditions.checkNotNull(projectCacheDir); Preconditions.checkArgument(projectCacheDir.exists()); Preconditions.checkArgument(percentageOfDisk > 0 && percentageOfDisk <= 1); this.projectCacheDir = projectCacheDir; this.percentageOfDisk = percentageOfDisk; this.throttlePercentage = throttlePercentage; log.info("ProjectCacheCleaner constructor called. ProjectCacheDir = {}, thresh-hold = %, throttle at %", projectCacheDir.toPath(), this.percentageOfDisk, this.throttlePercentage); emptyQCond = barrier.newCondition(); deletionService = Executors.newFixedThreadPool(CLEANING_SERVICE_THREAD_NUM); }
Source:
<code>public static void setup() { try { <START> privateKey = KeyFactory.getInstance("RSA") <END> .generatePrivate(new PKCS8EncodedKeySpec( SignatureHeaderUtils.loadPEM(privateKeyString.getBytes()))); } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { e.printStackTrace(); } messageVerifier = new MessageVerifier(true); messageVerifier.setPublicKeyProvider(new MockPublicKeyProvider()); messageVerifier.setExceptionHandler(new MockExceptionHandler()); messageVerifier.setSecurityProvider(new MockSecurityProvider()); messageVerifier.setAlgorithmProvider(new MockAlgorithmProvider()); messageSigner = new MessageSigner(DefaultSignatureConstants.SIGNING_ALGORITHM, DefaultSignatureConstants.DIGEST_ALGORITHM); }</code><technical_language>generate a KeyPair instead KeyPairGenerator instead of hard-coding private key</technical_language>

Target:
public static void setup() { try { final KeyPair keyPair = KeyPairGenerator.getInstance(KEY_PAIR_GENERATOR_ALGORITHM) .generateKeyPair(); messageVerifier = new MessageVerifier(new MockPublicKeyProvider(keyPair.getPublic())); messageVerifier.setSecurityProvider(new MockSecurityProvider()); messageVerifier.setAlgorithmProvider(new MockAlgorithmProvider()); messageSigner = new MessageSigner(keyPair.getPrivate(), KEY_ID); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } }
Source:
<code>public boolean testBytes(byte[] value, int offset, int length) { long hashCode = hash(value, offset, length); if (!testBloom(hashCode)) { return false; } <START> int position = (int) (hashCode & (hashTableSizeMask)); <END> for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & (hashTableSizeMask); byte[] entry = hashTable[index]; if (entry == null) { return false; } if (compareRanges(value, offset, length, entry, 0, entry.length) == 0) { return true; } } return false; }</code><technical_language>unnecessary parentheses hashTableSizeMask: int position = (int) (hashCode & hashTableSizeMask);</technical_language>

Target:
public boolean testBytes(byte[] value, int offset, int length) { long hashCode = hash(value, offset, length); if (!testBloom(hashCode)) { return false; } int position = (int) (hashCode & hashTableSizeMask); for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & hashTableSizeMask; byte[] entry = hashTable[index]; if (entry == null) { return false; } if (compareRanges(value, offset, length, entry, 0, entry.length) == 0) { return true; } } return false; }
Source:
<code>public void testRequiredTypeAdapterNull() { RequiredTypeAdapterModel expected = new RequiredTypeAdapterModel(); expected.uri = null; <START> RequiredTypeAdapterModel result = unmarshal(RequiredTypeAdapterModel.class, marshal(expected)); <END> assertThat(result, nullValue()); }</code><technical_language>"{field: null}" remark</technical_language>

Target:
public void testRequiredTypeAdapterNull() { RequiredTypeAdapterModel expected = new RequiredTypeAdapterModel(); RequiredTypeAdapterModel result = unmarshal(gson, RequiredTypeAdapterModel.class, marshal(gson, expected)); assertThat(result, nullValue()); }
Source:
<code>public List<ValidationMessage> validate( final Path resourcePath, final String content ) { final KieProject kieProject = projectService.resolveProject( resourcePath ); final Validator validator = new Validator( new ValidatorFileSystemProvider( resourcePath, <START> new ByteArrayInputStream( content != null ? content.getBytes( Charsets.UTF_8 ) : content.getBytes() ), <END> kieProject, ioService, new JavaFileFilter() ) ); final List<ValidationMessage> validationMessages = validator.validate(); if ( validationMessages.isEmpty() ) { final ValidationMessage validationMessage = createSolverFactory( resourcePath, validator, kieProject ); if ( validationMessage != null ) { validationMessages.add( validationMessage ); } } return validationMessages; }</code><technical_language>content != null ? ... : content.getBytes() I pretty NPE :)</technical_language>

Target:
public List<ValidationMessage> validate( final Path resourcePath, final String content ) { try { final KieProject kieProject = projectService.resolveProject( resourcePath ); final Validator validator = getValidator( resourcePath, content, kieProject ); final List<ValidationMessage> validationMessages = validator.validate(); if ( validationMessages.isEmpty() ) { return buildSolver( resourcePath, kieProject, validator ); } else { return validationMessages; } } catch ( NoProjectException e ) { return new ArrayList<ValidationMessage>(); } }
Source:
<code>public BridgeHandler getHandler() { BridgeHandler bridgeHandler = null; if (super.getHandler() instanceof BridgeHandler) { bridgeHandler = (BridgeHandler) super.getHandler(); } else if (super.getHandler() != null) { logger.warn("Handler of bridge '{}' must implement BridgeHandler interface.", getUID()); } <START> return bridgeHandler; <END> }</code><technical_language>change code super.getHandler() is called once</technical_language>

Target:
public BridgeHandler getHandler() { BridgeHandler bridgeHandler = null; ThingHandler thingHandler = super.getHandler(); if (thingHandler instanceof BridgeHandler) { bridgeHandler = (BridgeHandler) thingHandler; } else if (thingHandler != null) { logger.warn("Handler of bridge '{}' must implement BridgeHandler interface.", getUID()); } return bridgeHandler; }
Source:
<code><START> public static void clearProperty(Enum<? extends ConfigDefaults> name) { <END> clearProperty(name.toString()); }</code><technical_language>Do need static</technical_language>

Target:
public void clearProperty(Enum<? extends ConfigDefaults> name) { clearProperty(name.toString()); }
Source:
<code>public <C> List<Validation<E, C>> traverseList(F<T, List<C>> f){ return isSuccess() ? f.f(success()).map(c -> Validation.<E, C>success(c)) : list(Validation.<E, C>fail(e.left().value())); <START> } <END></code><technical_language>Method reference for success here, e.g. map(Validation::success) I this need types. return isSuccess() ? f.f(success()).map(Validation::success) : List.list(Validation.fail(e.left().value()));</technical_language>

Target:
public <C> List<Validation<E, C>> traverseList(F<T, List<C>> f){ return isSuccess() ? f.f(success()).map(Validation::success) : list(fail(e.left().value())); }
Source:
<code>public void populateDAG(DAG dag, Configuration conf) { JMSStringInputOperator amqInput = dag.addOperator("amqIn", new JMSStringInputOperator()); amqInput.setSubject(conf.get(QUEUE_NAME_PROPERTY)); <START> amqInput.getConnectionFactoryProperties().put("brokerURL", "vm://localhost"); <END> LineOutputOperator out = dag.addOperator("fileOut", new LineOutputOperator()); dag.addStream("data", amqInput.output, out.input); }</code><technical_language>If possible, configure properties file</technical_language>

Target:
public void populateDAG(DAG dag, Configuration conf) { JMSStringInputOperator amqInput = dag.addOperator("amqIn", new JMSStringInputOperator()); LineOutputOperator out = dag.addOperator("fileOut", new LineOutputOperator()); dag.addStream("data", amqInput.output, out.input); }
Source:
<code>public static byte[] createQRCodeWithDescription(String text, String description) { try { <START> InputStream fi = new ClassPathResource("/alfio/font/DejaVuSansMono.ttf").getInputStream(); <END> ByteArrayOutputStream baos = new ByteArrayOutputStream(); QrCode qr = QrCode.encodeText(text, QrCode.Ecc.HIGH); int paddedSize = qr.size + BORDER * 2; int scale = Math.min(WIDTH, HEIGHT) / paddedSize; BufferedImage bufferedImage = qr.toImage(scale, BORDER); BufferedImage scaled = new BufferedImage(200, 230, BufferedImage.TYPE_INT_ARGB); Graphics g = scaled.createGraphics(); g.drawImage(bufferedImage, (WIDTH - paddedSize * scale) / 2, (HEIGHT - paddedSize * scale) / 2, null); g.dispose(); Graphics2D graphics = (Graphics2D) scaled.getGraphics(); graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.drawImage(bufferedImage, 0, 0, null); graphics.setColor(Color.WHITE); graphics.fillRect(0, 200, 200, 30); graphics.setColor(Color.BLACK); graphics.setFont(Font.createFont(Font.TRUETYPE_FONT, fi).deriveFont(14f)); graphics.drawString(center(truncate(description, 23), 25), 0, 215); ImageIO.write(scaled, "png", baos); return baos.toByteArray(); } catch (IOException | FontFormatException e) { throw new IllegalStateException(e); } }</code><technical_language>noticed now, remove "try resource"</technical_language>

Target:
public static byte[] createQRCodeWithDescription(String text, String description) { try(InputStream fi = new ClassPathResource("/alfio/font/DejaVuSansMono.ttf").getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream()) { QrCode qr = QrCode.encodeText(text, QrCode.Ecc.HIGH); int paddedSize = qr.size + BORDER * 2; int scale = Math.min(WIDTH, HEIGHT) / paddedSize; BufferedImage bufferedImage = qr.toImage(scale, BORDER); BufferedImage scaled = new BufferedImage(200, 230, BufferedImage.TYPE_INT_ARGB); Graphics g = scaled.createGraphics(); g.drawImage(bufferedImage, (WIDTH - paddedSize * scale) / 2, (HEIGHT - paddedSize * scale) / 2, null); g.dispose(); Graphics2D graphics = (Graphics2D) scaled.getGraphics(); graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.drawImage(bufferedImage, 0, 0, null); graphics.setColor(Color.WHITE); graphics.fillRect(0, 200, 200, 30); graphics.setColor(Color.BLACK); graphics.setFont(Font.createFont(Font.TRUETYPE_FONT, fi).deriveFont(14f)); graphics.drawString(center(truncate(description, 23), 25), 0, 215); ImageIO.write(scaled, "png", baos); return baos.toByteArray(); } catch (IOException | FontFormatException e) { throw new IllegalStateException(e); } }
Source:
<code>private void populateAboutThisCourse() { getCourseDetailCall = courseApi.getCourseDetail(courseDetail.course_id); getCourseDetailCall.enqueue(new ErrorHandlingCallback<CourseDetail>( <START> getActivity(), new SnackbarErrorNotification(courseAbout)) { <END> @Override protected void onResponse(@NonNull final CourseDetail courseDetail) { if (courseDetail.overview != null && !courseDetail.overview.isEmpty()) { populateAboutThisCourse(courseDetail.overview); } else { courseAbout.setVisibility(View.GONE); } } }); }</code><technical_language>**Issue:** passing a snackbar error notification in params means server call error shown in snackbar is design. implementing new offline error design in CourseDetailFragment this time. Replacing DialogErrorNotification fulfill requirement</technical_language>

Target:
private void populateAboutThisCourse() { getCourseDetailCall = courseApi.getCourseDetail(courseDetail.course_id); final Activity activity = getActivity(); final TaskProgressCallback pCallback = activity instanceof TaskProgressCallback ? (TaskProgressCallback) activity : null; final TaskMessageCallback mCallback = activity instanceof TaskMessageCallback ? (TaskMessageCallback) activity : null; getCourseDetailCall.enqueue(new ErrorHandlingCallback<CourseDetail>(getActivity(), pCallback, mCallback, CallTrigger.LOADING_CACHED) { @Override protected void onResponse(@NonNull final CourseDetail courseDetail) { if (courseDetail.overview != null && !courseDetail.overview.isEmpty()) { populateAboutThisCourse(courseDetail.overview); } else { courseAbout.setVisibility(View.GONE); } } }); }
Source:
<code>public void testOsgiServiceProxy() throws Exception { ConnectorProvider proxy = getServiceUtils().getOsgiServiceProxy( <START> getServiceUtils().makeFilter(ConnectorProvider.class, "(connector=example)"), ConnectorProvider.class); <END> assertThat(proxy.getId(), is("example")); }</code><technical_language>connector belongs Constants</technical_language>

Target:
public void testOsgiServiceProxy() throws Exception { ConnectorProvider proxy = getServiceUtils().getOsgiServiceProxy( getServiceUtils().makeFilter(ConnectorProvider.class, String.format("(%s=example)", org.openengsb.core.api.Constants.CONNECTOR_KEY)), ConnectorProvider.class); assertThat(proxy.getId(), is("example")); }
Source:
<code>private void processVmJobs(Guid vmId, List<VmJob> jobs, List<VmJob> jobsToUpdate, List<Guid> jobIdsToRemove) { if (jobs == null) { log.debug("No vmJob data returned from VDSM, preserving existing jobs"); return; } Map<Guid, VmJob> jobIdToReportedJob = jobs.stream().collect(toMap(VmJob::getId, identity())); getExistingJobsForVm(vmId).forEach(job -> { VmJob reportedJob = jobIdToReportedJob.get(job.getId()); if (reportedJob != null) { if (reportedJob.equals(job)) { log.info("VM job '{}': In progress (no change)", job.getId()); } else { jobsToUpdate.add(reportedJob); log.info("VM job '{}': In progress, updating", job.getId()); } } else if (!job.isMonitored()) { log.info("VM job is not monitored", job.getId()); <START> processNotMonitoredVmJobs(jobs, job, jobIdsToRemove); <END> } else { jobIdsToRemove.add(job.getId()); log.info("VM job '{}': Deleting", job.getId()); } }); }</code><technical_language>If monitoring a large amount of jobs, this costly, linearly search a matching job matching. Consider following: public class VmJob { JobMatchKey getMatchKey() {..} } add another map above: Map<Guid, VmJob> jobIdToReportedJob = jobs.stream().collect(toMap(VmJob::getId, j -> j.getMatchKey()));</technical_language>

Target:
private void processVmJobs(Guid vmId, List<VmJob> jobs, List<VmJob> jobsToUpdate, List<Guid> jobIdsToRemove) { if (jobs == null) { log.debug("No vmJob data returned from VDSM, preserving existing jobs"); return; } Map<Guid, VmJob> jobIdToReportedJob = jobs.stream().collect(toMap(VmJob::getId, identity())); Map<VmJobKey, VmJob> jobKeyToReportedJob = jobs.stream().collect(toMap(VmJob::getKey, identity())); getExistingJobsForVm(vmId).forEach(job -> { VmJob reportedJob = jobIdToReportedJob.get(job.getId()); if (reportedJob != null) { if (reportedJob.equals(job)) { log.info("VM job '{}': In progress (no change)", job.getId()); } else { jobsToUpdate.add(reportedJob); log.info("VM job '{}': In progress, updating", job.getId()); } } else if (!job.isMonitored() && jobKeyToReportedJob.get(job.getKey()) != null) { log.info("VM job is not monitored", job.getId()); processNotMonitoredVmJob(jobKeyToReportedJob.get(job.getKey()), job, jobIdsToRemove); } else { jobIdsToRemove.add(job.getId()); log.info("VM job '{}': Deleting", job.getId()); } }); }
Source:
<code>private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testDuplicateQuestionAction(); testCopyQuestion(); testChangeFeedbackGiver(); testChangeFeedbackRecipient(); testVisibilityOptionsCorrespondToFeedbackPath(); testVisibilityOptionsUncheckedWhenHidden(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testEditWithEmptyQuestionTextThenDeleteQuestionAction(1); testEditWithInvalidNumericalTextThenDeleteQuestionAction(); testEditNonExistentQuestion(); testResponseRate(); testAddTemplateQuestionLink(); <START> testAddTemplateQuestionAction(); <END> }</code><technical_language>Separate @Test? Is hard</technical_language>

Target:
private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testDuplicateQuestionAction(); testCopyQuestion(); testChangeFeedbackGiver(); testChangeFeedbackRecipient(); testVisibilityOptionsCorrespondToFeedbackPath(); testVisibilityOptionsUncheckedWhenHidden(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testEditWithEmptyQuestionTextThenDeleteQuestionAction(1); testEditWithInvalidNumericalTextThenDeleteQuestionAction(); testEditNonExistentQuestion(); testResponseRate(); }
Source:
<code>public void defaultParser() { assertEquals(spp.getKeyValuePairSeparators(), "&"); assertEquals(spp.getKeyValueSeparators(), "="); assertEquals(spp.getStructuralParameters().size(), 0); List<NameValuePair> res = spp.parseParameters("a=b&b=c&d=f&d=g"); <START> assertEquals(res.size(), 4); <END> assertEquals(res.get(0).getName(), "a"); assertEquals(res.get(0).getValue(), "b"); assertEquals(res.get(1).getName(), "b"); assertEquals(res.get(1).getValue(), "c"); assertEquals(res.get(2).getName(), "d"); assertEquals(res.get(2).getValue(), "f"); assertEquals(res.get(3).getName(), "d"); assertEquals(res.get(3).getValue(), "g"); }</code><technical_language>suppress deprecations, continue checking working properly</technical_language>

Target:
public void defaultParser() { assertEquals(spp.getKeyValuePairSeparators(), "&"); assertEquals(spp.getKeyValueSeparators(), "="); assertEquals(spp.getStructuralParameters().size(), 0); @SuppressWarnings("deprecation") Map<String, String> res = spp.parse("a=b&b=c&d=f"); assertEquals(res.size(), 3); assertEquals(res.get("a"), "b"); assertEquals(res.get("b"), "c"); assertEquals(res.get("d"), "f"); List<NameValuePair> res2 = spp.parseParameters("a=b&b=c&d=f&d=g"); assertEquals(res2.size(), 4); assertEquals(res2.get(0).getName(), "a"); assertEquals(res2.get(0).getValue(), "b"); assertEquals(res2.get(1).getName(), "b"); assertEquals(res2.get(1).getValue(), "c"); assertEquals(res2.get(2).getName(), "d"); assertEquals(res2.get(2).getValue(), "f"); assertEquals(res2.get(3).getName(), "d"); assertEquals(res2.get(3).getValue(), "g"); }
Source:
<code>private PojoUtils.Setter generateSettersForField(Class<?> klass, String outputFieldName) throws NoSuchFieldException, SecurityException { Field f = outputClass.getDeclaredField(outputFieldName); Class c = ClassUtils.primitiveToWrapper(f.getType()); <START> PojoUtils.Setter classSetter = PojoUtils.createSetter(klass, outputFieldName, c); <END> return classSetter; }</code><technical_language>return directly</technical_language>

Target:
private PojoUtils.Setter generateSettersForField(Class<?> klass, String outputFieldName) throws NoSuchFieldException, SecurityException { Field f = klass.getDeclaredField(outputFieldName); Class c = ClassUtils.primitiveToWrapper(f.getType()); return PojoUtils.createSetter(klass, outputFieldName, c); }
Source:
<code>public void start(Map<String, String> props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); boolean hiveIntegration = connectorConfig.getBoolean(HdfsSinkConnectorConfig.HIVE_INTEGRATION_CONFIG); if (hiveIntegration) { Compatibility compatibility = SchemaUtils.getCompatibility( connectorConfig.getString(HdfsSinkConnectorConfig.SCHEMA_COMPATIBILITY_CONFIG)); if (compatibility == Compatibility.NONE) { throw new ConfigException("Hive Integration requires schema compatibility to be BACKWARD, FORWARD or FULL"); } } boolean secureHadoop = connectorConfig.getBoolean(HdfsSinkConnectorConfig.SECURE_HADOOP_CONFIG); if (secureHadoop) { String principal = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_CONNECTOR_PRINCIPAL_CONFIG); String keytab = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_CONNECTOR_KEYTAB_CONFIG); <START> UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal, <END> keytab); log.info("Login as: " + ugi.getUserName()); } int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new DataWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); if (hiveIntegration) { syncWithHive(); } } catch (ConfigException e) { throw new ConnectException("Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (ConnectException | IOException e) { log.info("Couldn't start HdfsSinkConnector:", e); log.info("Shutting down HdfsSinkConnector."); if (hdfsWriter != null) { hdfsWriter.close(); } } }</code><technical_language>validate this renews</technical_language>

Target:
public void start(Map<String, String> props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); boolean hiveIntegration = connectorConfig.getBoolean(HdfsSinkConnectorConfig.HIVE_INTEGRATION_CONFIG); if (hiveIntegration) { Compatibility compatibility = SchemaUtils.getCompatibility( connectorConfig.getString(HdfsSinkConnectorConfig.SCHEMA_COMPATIBILITY_CONFIG)); if (compatibility == Compatibility.NONE) { throw new ConfigException("Hive Integration requires schema compatibility to be BACKWARD, FORWARD or FULL"); } } int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new DataWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); if (hiveIntegration) { syncWithHive(); } } catch (ConfigException e) { throw new ConnectException("Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (ConnectException e) { log.info("Couldn't start HdfsSinkConnector:", e); log.info("Shutting down HdfsSinkConnector."); if (hdfsWriter != null) { hdfsWriter.close(); } } }
Source:
<code>public void initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor, HibernateConstraintValidatorInitializationContext initializationContext) { ParameterScriptAssert constraintAnnotation = constraintDescriptor.getAnnotation(); validateParameters( constraintAnnotation ); this.languageName = constraintAnnotation.lang(); this.script = constraintAnnotation.script(); <START> this.escapedScript = InterpolationHelper.escapeMessageParameter( constraintAnnotation.script() ); <END> initializeScriptContext( initializationContext ); }</code><technical_language>mentioned above, move 3 super initialize() method</technical_language>

Target:
public void initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor, HibernateConstraintValidatorInitializationContext initializationContext) { ParameterScriptAssert constraintAnnotation = constraintDescriptor.getAnnotation(); validateParameters( constraintAnnotation ); initialize( constraintAnnotation.lang(), constraintAnnotation.script(), initializationContext ); }
Source:
<code>public Ample.TabletMutator putTime(String time) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); <START> TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(time.getBytes())); <END> return this; }</code><technical_language>getBytes is called a String in Accumulo, UTF_8 passed getBytes(). encoding is dependent system config possibly differ time nodes. this data is persisted important encoding for strings. a constructor takes Strings encodes UTF8, that</technical_language>

Target:
public Ample.TabletMutator putTime(String time) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(time)); return this; }
Source:
<code>public void testRemoveSecurityGroup() { HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint( URI.create("<LINK_0>")) .headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json") .put("X-Auth-Token", authToken).build()).build(); HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build(); HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse); requestResponseMap.put(delete, deleteResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); <START> assertTrue(extension.removeSecurityGroup(zone + "/160")); <END> }</code><technical_language>assertTrue(..., "Expected removeSecurityGroup successful")</technical_language>

Target:
public void testRemoveSecurityGroup() { HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint( URI.create("<LINK_0>")) .headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json") .put("X-Auth-Token", authToken).build()).build(); HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build(); HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse); requestResponseMap.put(delete, deleteResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); assertTrue(extension.removeSecurityGroup(zone + "/160"), "Expected removal of securitygroup to be successful"); }
Source:
<code>protected void onInit() { Assert.notNull(getFile(), "File cannot be null"); super.onInit(); String command = "tail"; <START> this.command = command + " " + this.options + " " + this.getFile().getAbsolutePath(); <END> }</code><technical_language>is a setter for command, this line simplified si NPE check for options</technical_language>

Target:
protected void onInit() { Assert.notNull(getFile(), "File cannot be null"); super.onInit(); this.command = "tail " + this.options + " " + this.getFile().getAbsolutePath(); }