auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testSetupLayout() { <START> testInputProperties.setupProperties(); <END> testInputProperties.connection.init(); testInputProperties.datasetProperties.init(); testInputProperties.datasetProperties.main.init(); testInputProperties.inputSchema.init(); testInputProperties.setupLayout(); Form main = testInputProperties.getForm(Form.MAIN); assertNotNull(main.getWidget(testInputProperties.connection)); assertNotNull(main.getWidget(testInputProperties.criteria)); assertNull(main.getWidget(testInputProperties.maxRetrieve)); assertNull(main.getWidget(testInputProperties.pageSize)); assertNull(main.getWidget(testInputProperties.useQueryOption)); assertNull(main.getWidget(testInputProperties.queryLiteralType)); assertNull(main.getWidget(testInputProperties.queryOptionName)); assertNull(main.getWidget(testInputProperties.queryOptionLiterals)); Form advanced = testInputProperties.getForm(Form.ADVANCED); assertNotNull(advanced.getWidget(testInputProperties.maxRetrieve)); assertNotNull(advanced.getWidget(testInputProperties.pageSize)); assertNotNull(advanced.getWidget(testInputProperties.useQueryOption)); assertNotNull(advanced.getWidget(testInputProperties.queryLiteralType)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionName)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionLiterals)); }</code><technical_language>init() method I remember call setupProperties</technical_language>

Target:
public void testSetupLayout() { testInputProperties.setupProperties(); testInputProperties.connection.init(); testInputProperties.datasetProperties.init(); testInputProperties.datasetProperties.main.init(); testInputProperties.inputSchema.init(); testInputProperties.init(); Form main = testInputProperties.getForm(Form.MAIN); assertNotNull(main.getWidget(testInputProperties.connection)); assertNotNull(((Form)main.getWidget("datasetProperties").getContent()).getWidget(testInputProperties.datasetProperties.criteria)); assertNull(main.getWidget(testInputProperties.maxRetrieve)); assertNull(main.getWidget(testInputProperties.datasetProperties.pageSize)); assertNull(main.getWidget(testInputProperties.datasetProperties.useQueryOption)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryLiteralType)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryOptionName)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryOptionLiterals)); Form advanced = testInputProperties.getForm(Form.ADVANCED); assertNotNull(advanced.getWidget(testInputProperties.maxRetrieve)); Form mainDataset = advanced.getChildForm("datasetProperties"); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.pageSize)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.useQueryOption)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryLiteralType)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryOptionName)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryOptionLiterals)); }
Source:
<code>public void resetUserPassword(String username) { User user = userRepository.findUser(username); <START> if (user != null) { <END> PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String newPassword = RandomStringUtils.randomAlphanumeric(16); user.setPassword(passwordEncoder.encode(newPassword)); user.setPasswordReset(true); userRepository.updateUser(user, true); SimpleMailMessage message = new SimpleMailMessage(); message.setTo(user.getEmailId()); message.setSubject(passwordResetSubject); message.setText(String.format(passwordResetMessage, newPassword)); mailSender.send(message); } else { throw new NoResultException(); } }</code><technical_language>@tumijacob invert this logic throw if user is null. remove else block indent remaining code level less</technical_language>

Target:
public void resetUserPassword(String username) { User user = userRepository.findUser(username); if (user == null) { throw new NoResultException(); } PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String newPassword = RandomStringUtils.randomAlphanumeric(16); user.setPassword(passwordEncoder.encode(newPassword)); user.setPasswordReset(true); userRepository.updateUser(user, true); SimpleMailMessage message = new SimpleMailMessage(); message.setTo(user.getEmailId()); message.setSubject(passwordResetSubject); message.setText(String.format(passwordResetMessage, newPassword)); mailSender.send(message); }
Source:
<code>public AmbryStateModelFactoryTest(String stateModelDef) throws Exception { <START> List<com.github.ambry.utils.TestUtils.ZkInfo> zkInfoList = new ArrayList<>(); <END> zkInfoList.add(new TestUtils.ZkInfo(null, "DC0", (byte) 0, 2299, false)); JSONObject zkJson = constructZkLayoutJSON(zkInfoList); Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "AmbryTest"); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.state.model.definition", stateModelDef); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); config = new ClusterMapConfig(new VerifiableProperties(props)); this.stateModelDef = stateModelDef; }</code><technical_language>ZkInfo importing TestUtils.*</technical_language>

Target:
public AmbryStateModelFactoryTest(String stateModelDef) throws Exception { List<TestUtils.ZkInfo> zkInfoList = new ArrayList<>(); zkInfoList.add(new TestUtils.ZkInfo(null, "DC0", (byte) 0, 2299, false)); JSONObject zkJson = constructZkLayoutJSON(zkInfoList); Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "AmbryTest"); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.state.model.definition", stateModelDef); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); config = new ClusterMapConfig(new VerifiableProperties(props)); this.stateModelDef = stateModelDef; }
Source:
<code>public void deletesTempFile() throws IOException { final File file = File.createTempFile("tempfile", ".tmp"); final BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("Temp file deletion test"); <START> out.close(); <END> final InputStream body = new TempInputStream( new FileInputStream(file), file ); body.close(); MatcherAssert.assertThat( "File exists after stream closure", file.exists(), Matchers.is(false) ); }</code><technical_language>@exper0 try/finally blocks for closing instances of Closeable</technical_language>

Target:
public void deletesTempFile() throws IOException { final File file = File.createTempFile("tempfile", ".tmp"); final BufferedWriter out = new BufferedWriter(new FileWriter(file)); try { out.write("Temp file deletion test"); } finally { out.close(); } final InputStream body = new TempInputStream( new FileInputStream(file), file ); try { MatcherAssert.assertThat( "File is not created!", file.exists(), Matchers.is(true) ); } finally { body.close(); } MatcherAssert.assertThat( "File exists after stream closure", file.exists(), Matchers.is(false) ); }
Source:
<code>private SwiftApi api(String authUrl, Properties overrides) throws IOException { if (overrides == null){ overrides = new Properties(); <START> } <END> overrides.setProperty(CREDENTIAL_TYPE, "tempAuthCredentials"); return ContextBuilder.newBuilder(new SwiftApiMetadata()) .credentials("user", "password") .endpoint(authUrl) .overrides(overrides) .modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor()))) .buildApi(SwiftApi.class); }</code><technical_language>Instead of passing null, remove this check call this method a new Properties object</technical_language>

Target:
private SwiftApi api(String authUrl, Properties overrides) throws IOException { overrides.setProperty(CREDENTIAL_TYPE, "tempAuthCredentials"); return ContextBuilder.newBuilder(new SwiftApiMetadata()) .credentials("user", "password") .endpoint(authUrl) .overrides(overrides) .modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor()))) .buildApi(SwiftApi.class); }
Source:
<code>public final ASTAnyTypeDeclaration getEnclosingTypeDeclaration() { if (!isNested()) { return null; } <START> return (ASTAnyTypeDeclaration) getNthParent(3); <END> }</code><technical_language>yeah right, I isNested protected check high enough in tree</technical_language>

Target:
public final ASTAnyTypeDeclaration getEnclosingTypeDeclaration() { if (!isNested()) { return null; } Node parent = getNthParent(3); return parent instanceof ASTAnyTypeDeclaration ? (ASTAnyTypeDeclaration) parent : null; }
Source:
<code>public void setPostReceiveHook(PostReceiveHook hook) { <START> this.postReceiveHook = hook; <END> }</code><technical_language>hook != null ? hook : PostReceiveHook.NULL</technical_language>

Target:
public void setPostReceiveHook(PostReceiveHook hook) { this.postReceiveHook = hook != null ? hook : PostReceiveHook.NULL; }
Source:
<code>private Object handleRemotePutMapCommand(InvocationContext ctx, PutMapCommand command) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); <START> final ConsistentHash ch = cacheTopology.getWriteConsistentHash(); <END> final VisitableCommand.LoadType loadType = command.loadType(); if (command.isForwarded()) { return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); } sendToBackups(command, command.getMap(), cacheTopology); return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); }</code><technical_language>removed :)</technical_language>

Target:
private Object handleRemotePutMapCommand(InvocationContext ctx, PutMapCommand command) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); final VisitableCommand.LoadType loadType = command.loadType(); if (command.isForwarded()) { return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); } sendToBackups(command, command.getMap(), cacheTopology); return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); }
Source:
<code>public void shouldReturnChargeWithNoMetadataField_whenCreatedWithEmptyMetadata() { <START> String reference = UUID.randomUUID().toString(); <END> String postBody = toJson(ImmutableMap.builder() .put(JSON_AMOUNT_KEY, AMOUNT) .put(JSON_REFERENCE_KEY, reference) .put(JSON_DESCRIPTION_KEY, "Test description") .put(JSON_RETURN_URL_KEY, RETURN_URL) .put(JSON_EMAIL_KEY, EMAIL) .put(JSON_METADATA_KEY, Map.of()) .build()); ValidatableResponse response = connectorRestApiClient .postCreateCharge(postBody) .statusCode(Status.CREATED.getStatusCode()) .contentType(JSON) .body("$", not(hasKey("metadata"))); connectorRestApiClient .withChargeId(response.extract().path(JSON_CHARGE_KEY)) .getCharge() .body("$", not(hasKey("metadata"))); connectorRestApiClient .withQueryParam("reference", reference) .getChargesV1() .body("results[0]", not(hasKey("metadata"))); }</code><technical_language>a fixed here</technical_language>

Target:
public void shouldReturnChargeWithNoMetadataField_whenCreatedWithEmptyMetadata() { String reference = "no metadata reference"; String postBody = toJson(ImmutableMap.builder() .put(JSON_AMOUNT_KEY, AMOUNT) .put(JSON_REFERENCE_KEY, reference) .put(JSON_DESCRIPTION_KEY, "Test description") .put(JSON_RETURN_URL_KEY, RETURN_URL) .put(JSON_EMAIL_KEY, EMAIL) .put(JSON_METADATA_KEY, Map.of()) .build()); ValidatableResponse response = connectorRestApiClient .postCreateCharge(postBody) .statusCode(Status.CREATED.getStatusCode()) .contentType(JSON) .body("$", not(hasKey("metadata"))); String chargeExternalId = response.extract().path(JSON_CHARGE_KEY); connectorRestApiClient .withChargeId(chargeExternalId) .getCharge() .body("$", not(hasKey("metadata"))); connectorRestApiClient .withQueryParam("reference", reference) .getChargesV1() .body("results[0]", not(hasKey("metadata"))); assertNull(databaseTestHelper.getChargeByExternalId(chargeExternalId).get("metadata")); }
Source:
<code>protected String getLanguageKey(Element element) { Package rootPackage = PackageUtil.getRootPackage(element); String key = NoDefautLanguage.INSTANCE.getId(); if (rootPackage != null) { EAnnotation annotation = <START> element.getEAnnotation(LANGUAGE_ANNOTATION_SOURCE); <END> if (annotation != null) { String value = annotation.getDetails().get(LANGUAGE_ANNOTATION_VALUE); if (value != null) { key = value; } } } else { Activator.log.error("impossible to find root element for: " + element, null); } return key; }</code><technical_language>this 'rootPackage'? mixed-language models? package chain for annotation, root package</technical_language>

Target:
protected String getLanguageKey(Element element) { Package rootPackage = PackageUtil.getRootPackage(element); String key = NoDefautLanguage.INSTANCE.getId(); if (rootPackage != null) { EAnnotation annotation = rootPackage.getEAnnotation(LANGUAGE_ANNOTATION_SOURCE); if (annotation != null) { String value = annotation.getDetails().get(LANGUAGE_ANNOTATION_VALUE); if (value != null) { key = value; } } } else { Activator.log.error("impossible to find root element for: " + element, null); } return key; }
Source:
<code>public void trustedRootCA_syncShouldFailWithoutTrustedCA() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM_SECURE) .schema(StringOnly.class) .build(); realm = Realm.getInstance(config); try { <START> assertTrue(realm.isEmpty()); <END> } finally { realm.close(); } }</code><technical_language>this reporteed working else, ErrorHandler? feels problematic Sync silently fails</technical_language>

Target:
public void trustedRootCA_syncShouldFailWithoutTrustedCA() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM_SECURE) .schema(StringOnly.class) .build(); realm = Realm.getInstance(config); try { assertTrue(realm.isEmpty()); } finally { realm.close(); } }
Source:
<code>public boolean isAvailable(SourceMonitor callback) { <START> solr.isAvailable( END> (c, a) -> { if (a) { callback.setAvailable(); } else { callback.setUnavailable(); } }); return isAvailable(); }</code><technical_language>missing this called once, I recommend... 1. Change underlying implementation of listeners collection a set (LinkedHashSet if insertion order matters for some reason, I why). 2. lambdas explicit implementations of Listener interface add equals/hashcode methods. list is grow unbounded, duplicate listeners in it</technical_language>

Target:
public boolean isAvailable(SourceMonitor callback) { solr.isAvailable(new SolrClientListenerAdapter(callback)); return isAvailable(); }
Source:
<code>private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; <START> isFirstRenderingStageForCurrentFrame = currentRenderingStage == RenderingStage.MONO || currentRenderingStage == RenderingStage.LEFT_EYE; <END> if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); shadowMap.preRender(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; buffersManager.preRenderUpdate(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); }</code><technical_language>Hmmmm... of code syntactically equivalent previous version. In fact, I originally code similar suggest. However, I remember changing if/else block more readable important ifFirstRenderingStageForCurrentFrame is. So, prefer is for time being. Eventually deal a Stereoscopic setup RenderNodes pipeline</technical_language>

Target:
private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; if ((currentRenderingStage == RenderingStage.MONO) || (currentRenderingStage == RenderingStage.LEFT_EYE)) { isFirstRenderingStageForCurrentFrame = true; } else { isFirstRenderingStageForCurrentFrame = false; } if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; buffersManager.preRenderUpdate(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); }
Source:
<code>public ComputedAttributesHandler() { engine = new JexlEngine(); engine.setStrict(true); if (Context.getConfig() != null) { mapDeviceAttributes = Context.getConfig().getBoolean( <START> "processing.computedAttributes.mapDeviceAttributes.enable"); <END> } }</code><technical_language>long. name processing.computedAttributes.deviceAttributes</technical_language>

Target:
public ComputedAttributesHandler() { engine = new JexlEngine(); engine.setStrict(true); if (Context.getConfig() != null) { mapDeviceAttributes = Context.getConfig().getBoolean("processing.computedAttributes.deviceAttributes"); } }
Source:
<code>private void handleFrame(int streamId, FrameType type, ByteBuf frame) { Subscriber<Payload> receiver = receivers.get(streamId); switch (type) { case NEXT: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); break; case NEXT_COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); receiver.onComplete(); break; case COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onComplete(); receivers.remove(streamId); break; case ERROR: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onError(Exceptions.from(streamId, frame)); receivers.remove(streamId); break; case CANCEL: { Subscription sender = senders.remove(streamId); if (sender != null) { sender.cancel(); } break; } case REQUEST_N: { Subscription sender = senders.get(streamId); if (sender != null) { <START> long n = RequestNFrameFlyweight.requestN(frame); <END> sender.request(n); } break; } default: throw new IllegalStateException( "Client received supported frame on stream " + streamId + ": " + frame.toString()); } }</code><technical_language>is bug mentioning in PR body? if RequestNFrameFlyweight.requestN return a long cast int, meaning request in range Integer.MAX_VALUE..Long.MAX_VALUE previously propagated Long.MAX_VALUE ? In case, I suggest creating a dedicated issue describing this bug for reference (this PR fix partial close request bug, searchable in issues, is needed)</technical_language>

Target:
private void handleFrame(int streamId, FrameType type, ByteBuf frame) { Subscriber<Payload> receiver = receivers.get(streamId); switch (type) { case NEXT: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); break; case NEXT_COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); receiver.onComplete(); break; case COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onComplete(); receivers.remove(streamId); break; case ERROR: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onError(Exceptions.from(streamId, frame)); receivers.remove(streamId); break; case CANCEL: { Subscription sender = senders.remove(streamId); if (sender != null) { sender.cancel(); } break; } case REQUEST_N: { Subscription sender = senders.get(streamId); if (sender != null) { int n = RequestNFrameFlyweight.requestN(frame); sender.request(n >= Integer.MAX_VALUE ? Long.MAX_VALUE : n); } break; } default: throw new IllegalStateException( "Client received supported frame on stream " + streamId + ": " + frame.toString()); } }
Source:
<code>public String getId() { String id = fId; if (id == null) { <START> return UNDEFINED_ID; <END> } return id; }</code><technical_language>I see. I a guarantee unique if randomly generated, right? worth doing. BTW, in case this null? extension point XML require Id I think? If I understand correctly, this null if module is created other means. debating throw a NPE a violent solution log error return UNDEFINED_ID is done in this patch</technical_language>

Target:
public String getId() { String id = fId; if (id == null) { Activator.logError("Analysis module getId(): the id should not be null in class " + this.getClass().getSimpleName()); return UNDEFINED_ID; } return id; }
Source:
<code>public static void setup() { raising.setFalseWhen(EventMixing.filterEvent(topLimitSwitch, true, Igneous.globalPeriodic)); lowering.setFalseWhen(EventMixing.filterEvent(bottomLimitSwitch, true, Igneous.globalPeriodic)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); <START> FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.quadSelect(raising, lowering, 0.0f, -winchSpeed.get(), winchSpeed.get(), 0.0f), winch); <END> Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }</code><technical_language>here..</technical_language>

Target:
public static void setup() { raising.setFalseWhen(EventMixing.filterEvent(topLimitSwitch, true, Igneous.globalPeriodic)); lowering.setFalseWhen(EventMixing.filterEvent(bottomLimitSwitch, true, Igneous.globalPeriodic)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.select(raising, Mixing.select(lowering, FloatMixing.always(0.0f), winchSpeed), Mixing.select(lowering, FloatMixing.always(0.0f), FloatMixing.negate(winchSpeed))), winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }
Source:
<code>public void checkConstructorWithDetailMessageAndThrowable() { Throwable testThrowable = new RuntimeException("yo"); StorIOException storIOException = new StorIOException("test detail message", testThrowable); assertThat(storIOException).hasMessage("test detail message"); <START> assertThat(storIOException.getCause()).isEqualTo(testThrowable); <END> }</code><technical_language>isSameAs() instead of isEqualsTo()</technical_language>

Target:
public void checkConstructorWithDetailMessageAndThrowable() { Throwable testThrowable = new RuntimeException("yo"); StorIOException storIOException = new StorIOException("test detail message", testThrowable); assertThat(storIOException).hasMessage("test detail message"); assertThat(storIOException.getCause()).isSameAs(testThrowable); }
Source:
<code>public static synchronized void cleanDirectBuffer(ByteBuffer buffer) { Preconditions.checkNotNull(buffer, "buffer is null"); Preconditions.checkArgument(buffer.isDirect(), "buffer isn't a DirectByteBuffer"); <START> int javaVersion = Integer.parseInt(System.getProperty("java.version").split("\\D+")[0]); <END> if (javaVersion < 9) { cleanDirectBufferJava8(buffer); } else { cleanDirectBufferJava11(buffer); } }</code><technical_language>I suggest making this a static constant this is constant for life of JVM. Also, in JVM this report 1.8 for java 8, 11 for java 11. if a difference</technical_language>

Target:
public static synchronized void cleanDirectBuffer(ByteBuffer buffer) { Preconditions.checkNotNull(buffer, "buffer is null"); Preconditions.checkArgument(buffer.isDirect(), "buffer isn't a DirectByteBuffer"); int javaVersion = CommonUtils.getJavaVersion(); if (javaVersion < 9) { cleanDirectBufferJava8(buffer); } else { cleanDirectBufferJava11(buffer); } }
Source:
<code>public BeanDefinition parse(Element element, ParserContext parserContext) { this.initializeSpelFunctionRegistrarIfNecessary(parserContext); String id = element.getAttribute("id"); String className = element.getAttribute("class"); String signature = element.getAttribute("method"); Class clazz = null; try { clazz = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader()); <START> } <END> catch (ClassNotFoundException e) { parserContext.getReaderContext().error(e.getMessage(), element); } Method method = BeanUtils.resolveSignature(signature, clazz); if (method == null) { parserContext.getReaderContext().error(String.format("No declared method '%s' in class '%s'", signature, className), element); return null; } if (!Modifier.isStatic(method.getModifiers())) { parserContext.getReaderContext().error("SpEL-function method has to be 'static'", element); } this.functions.put(id, method); return null; }</code><technical_language>I do this in parser - need bean factory class loader - need defer bean creation time</technical_language>

Target:
public BeanDefinition parse(Element element, ParserContext parserContext) { this.initializeSpelFunctionRegistrarIfNecessary(parserContext); String id = element.getAttribute("id"); String className = element.getAttribute("class"); String signature = element.getAttribute("method"); Class<?> clazz = null; try { clazz = ClassUtils.forName(className, parserContext.getReaderContext().getBeanClassLoader()); } catch (ClassNotFoundException e) { parserContext.getReaderContext().error(e.getMessage(), element); } Method method = BeanUtils.resolveSignature(signature, clazz); if (method == null) { parserContext.getReaderContext().error(String.format("No declared method '%s' in class '%s'", signature, className), element); return null; } if (!Modifier.isStatic(method.getModifiers())) { parserContext.getReaderContext().error("SpEL-function method has to be 'static'", element); } this.functions.put(id, method); return null; }
Source:
<code>protected Mutation generateMutation(MutatableCode mutatableCode) { generateCachedNewInstanceInsns(mutatableCode); <START> int newInstanceIdx = rng.nextInt(newInstanceCachedInsns.size() - 1); <END> int newInstanceTypeIdx = rng.nextInt(mutatableCode.program.getTotalPoolIndicesByKind(PoolIndexKind.Type)); AssociatedMutation mutation = new AssociatedMutation(); mutation.setup(this.getClass(), mutatableCode); mutation.newInstanceToChangeIdx = newInstanceIdx; mutation.newInstanceTypeIdx = newInstanceTypeIdx; return mutation; }</code><technical_language>1? nextInt is 0..N N exclusive</technical_language>

Target:
protected Mutation generateMutation(MutatableCode mutatableCode) { generateCachedNewInstanceInsns(mutatableCode); int newInstanceIdx = rng.nextInt(newInstanceCachedInsns.size()); int newInstanceTypeIdx = rng.nextInt(mutatableCode.program.getTotalPoolIndicesByKind(PoolIndexKind.Type)); AssociatedMutation mutation = new AssociatedMutation(); mutation.setup(this.getClass(), mutatableCode); mutation.newInstanceToChangeIdx = newInstanceIdx; mutation.newInstanceTypeIdx = newInstanceTypeIdx; return mutation; }
Source:
<code>public ListInstancesOptions publicIpAddresses(String... publicIpAddresses) { String instanceIdsAsString = Joiner.on(",") .join(Iterables.transform(Arrays.asList(publicIpAddresses), new Function<String, String>() { @Override public String apply(String s) { <START> return new StringBuilder(s.length() + 1).append('"').append(s).append('"').toString(); <END> } })); queryParameters.put(PUBLIC_IP_ADDRESSES_PARAM, String.format("[%s]", instanceIdsAsString)); return this; }</code><technical_language>Extract this a quote function similar reuse properly unit test</technical_language>

Target:
public ListInstancesOptions publicIpAddresses(String... publicIpAddresses) { String instanceIdsAsString = Joiner.on(",") .join(Iterables.transform(Arrays.asList(publicIpAddresses), new PutStringInDoubleQuotes())); queryParameters.put(PUBLIC_IP_ADDRESSES_PARAM, String.format("[%s]", instanceIdsAsString)); return this; }
Source:
<code>public static State getSoundState(final float sound, final DateTime dataTimestampUTC, final Boolean preSleep) { State.Condition condition = State.Condition.IDEAL;; String idealSoundCondition = English.SOUND_ADVICE_MESSAGE; String message = (preSleep) ? English.IDEAL_SOUND_PRE_SLEEP_MESSAGE: English.IDEAL_SOUND_MESSAGE;; if (sound > 90.0) { condition = State.Condition.ALERT; idealSoundCondition += English.RECOMMENDATION_SOUND_TOO_HIGH; message = (preSleep) ? English.ALERT_SOUND_PRE_SLEEP_MESSAGE : English.ALERT_SOUND_MESSAGE; <START> } else if (sound > 55.0) { <END> condition = State.Condition.WARNING; idealSoundCondition += English.RECOMMENDATION_SOUND_TOO_HIGH; message = (preSleep) ? English.WARNING_SOUND_PRE_SLEEP_MESSAGE: English.WARNING_SOUND_MESSAGE; } return new State(sound, message, idealSoundCondition, condition, dataTimestampUTC, State.Unit.DB); }</code><technical_language>this a constant</technical_language>

Target:
public static State getSoundState(final float sound, final DateTime dataTimestampUTC, final Boolean preSleep) { State.Condition condition = State.Condition.IDEAL;; String idealSoundCondition = English.SOUND_ADVICE_MESSAGE; String message = (preSleep) ? English.IDEAL_SOUND_PRE_SLEEP_MESSAGE: English.IDEAL_SOUND_MESSAGE;; if (sound > SoundLevel.SOUND_LEVEL_ALERT) { condition = State.Condition.ALERT; idealSoundCondition += English.RECOMMENDATION_SOUND_TOO_HIGH; message = (preSleep) ? English.ALERT_SOUND_PRE_SLEEP_MESSAGE : English.ALERT_SOUND_MESSAGE; } else if (sound > SoundLevel.SOUND_LEVEL_WARNING) { condition = State.Condition.WARNING; idealSoundCondition += English.RECOMMENDATION_SOUND_TOO_HIGH; message = (preSleep) ? English.WARNING_SOUND_PRE_SLEEP_MESSAGE: English.WARNING_SOUND_MESSAGE; } return new State(sound, message, idealSoundCondition, condition, dataTimestampUTC, State.Unit.DB); }
Source:
<code>StringBasedN1qlQueryParser.N1qlSpelValues getN1qlSpelValues(ReactiveCouchbaseTemplate template, Class domainClass, boolean isCount) { String typeKey = template.getConverter().getTypeKey(); final CouchbasePersistentEntity<?> persistentEntity = template.getConverter().getMappingContext().getRequiredPersistentEntity( domainClass); MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity); String typeValue = info.getJavaType().getName(); <START> TypeInformation<?> typeInfo= ClassTypeInformation.from(info.getJavaType()); <END> Alias alias = template.getConverter().getAlias(typeInfo); if ( alias != null && alias.isPresent()){ typeValue=alias.toString(); } return StringBasedN1qlQueryParser.createN1qlSpelValues(template.getBucketName(), typeKey, typeValue, isCount); }</code><technical_language>formatting</technical_language>

Target:
StringBasedN1qlQueryParser.N1qlSpelValues getN1qlSpelValues(ReactiveCouchbaseTemplate template, Class domainClass, boolean isCount) { String typeKey = template.getConverter().getTypeKey(); final CouchbasePersistentEntity<?> persistentEntity = template.getConverter().getMappingContext() .getRequiredPersistentEntity(domainClass); MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity); String typeValue = info.getJavaType().getName(); TypeInformation<?> typeInfo = ClassTypeInformation.from(info.getJavaType()); Alias alias = template.getConverter().getTypeAlias(typeInfo); if (alias != null && alias.isPresent()) { typeValue = alias.toString(); } return StringBasedN1qlQueryParser.createN1qlSpelValues(template.getBucketName(), typeKey, typeValue, isCount); }
Source:
<code>public void adjust(Mechanism mechanism) { if (mechanism.matches("group")) { spawner.setGroup(mechanism.getValue().asString()); } else if (mechanism.matches("location") && mechanism.requireObject(LocationTag.class)) { spawner.setLocation(BukkitAdapter.adapt(mechanism.valueAsType(LocationTag.class))); } else if (mechanism.matches("cooldown") && mechanism.requireInteger()) { spawner.setCooldownSeconds(mechanism.getValue().asInt()); } else if (mechanism.matches("start_cooldown")) { spawner.setOnCooldown(); } else if (mechanism.matches("set_mob_type")) { MythicMob mob = MythicMobsBridge.getMythicMob(mechanism.getValue().asString()); if (mob == null) { Debug.echoError("MythicMob type does not exist: " + mechanism.getValue().asString()); return; } spawner.setType(mechanism.getValue().asString()); } else if (mechanism.matches("spawn")) { spawner.Spawn(); } else if (mechanism.matches("enable")) { spawner.Enable(); } else if (mechanism.matches("disable")) { spawner.Disable(); } <START> <END> }</code><technical_language>redundant newline</technical_language>

Target:
public void adjust(Mechanism mechanism) { if (mechanism.matches("group")) { spawner.setGroup(mechanism.getValue().asString()); } else if (mechanism.matches("location") && mechanism.requireObject(LocationTag.class)) { spawner.setLocation(BukkitAdapter.adapt(mechanism.valueAsType(LocationTag.class))); } else if (mechanism.matches("cooldown") && mechanism.requireObject(DurationTag.class)) { spawner.setCooldownSeconds(mechanism.valueAsType(DurationTag.class).getSecondsAsInt()); } else if (mechanism.matches("start_cooldown")) { spawner.setOnCooldown(); } else if (mechanism.matches("mob_type")) { MythicMob mob = MythicMobsBridge.getMythicMob(mechanism.getValue().asString()); if (mob == null) { Debug.echoError("MythicMob type does not exist: " + mechanism.getValue().asString()); return; } spawner.setType(mechanism.getValue().asString()); } else if (mechanism.matches("spawn")) { spawner.Spawn(); } else if (mechanism.matches("enable")) { spawner.Enable(); } else if (mechanism.matches("disable")) { spawner.Disable(); } }
Source:
<code>public void testExtractParentDataSingleParent() { <START> final ReportServiceImpl unitUnderTest = Mockito.mock(ReportServiceImpl.class); <END> Mockito.doReturn(this.germplasmDataManager).when(unitUnderTest).getGermplasmDataManager(); final List<MeasurementRow> measurementRowList = createMeasurementList(); final Map<Integer, GermplasmPedigreeTreeNode> pedigreeTreeNodeMap = GermplasmDataManagerDataInitializer.createTreeNodeMap(true); Mockito.doReturn(pedigreeTreeNodeMap).when(this.germplasmDataManager).getDirectParentsForStudy(TEST_STUDY_ID); Mockito.doCallRealMethod().when(unitUnderTest).appendParentsInformation(TEST_STUDY_ID, measurementRowList); unitUnderTest.appendParentsInformation(TEST_STUDY_ID, measurementRowList); final MeasurementRow row = measurementRowList.get(0); Assert.assertEquals("Female selection history should be blank if female parent information is not provided in database", "", row .getMeasurementData(AbstractReporter.FEMALE_SELECTION_HISTORY_KEY).getValue()); Assert.assertEquals("Male selection history not properly filled in from provided information", GermplasmDataManagerDataInitializer.MALE_SELECTION_HISTORY, row.getMeasurementData(AbstractReporter.MALE_SELECTION_HISTORY_KEY).getValue()); }</code><technical_language>Partial mocking is a code smell (<LINK_1>, <LINK_0> This is equivalant Mockito.spy. Please refactor code do need partially mock test class. If need reach out Skype</technical_language>

Target:
public void testExtractParentDataSingleParent() { final ReportServiceImpl unitUnderTest = Mockito.mock(ReportServiceImpl.class); Mockito.doReturn(this.germplasmDataManager).when(unitUnderTest).getGermplasmDataManager(); final List<MeasurementRow> measurementRowList = createMeasurementList(); final Map<Integer, GermplasmPedigreeTreeNode> pedigreeTreeNodeMap = GermplasmDataManagerDataInitializer.createTreeNodeMap(true); Mockito.doReturn(pedigreeTreeNodeMap).when(this.germplasmDataManager).getDirectParentsForStudy(TEST_STUDY_ID); Mockito.doCallRealMethod().when(unitUnderTest).appendParentsInformation(TEST_STUDY_ID, measurementRowList); Mockito.doCallRealMethod().when(unitUnderTest).provideParentInformation(Mockito.any(GermplasmPedigreeTreeNode.class), Mockito.anyList()); unitUnderTest.appendParentsInformation(TEST_STUDY_ID, measurementRowList); final MeasurementRow row = measurementRowList.get(0); Assert.assertEquals("Female selection history should be blank if female parent information is not provided in database", ReportServiceImpl.BLANK_STRING_VALUE, row .getMeasurementData(AbstractReporter.FEMALE_SELECTION_HISTORY_KEY).getValue()); Assert.assertEquals("Male selection history not properly filled in from provided information", GermplasmDataManagerDataInitializer.MALE_SELECTION_HISTORY, row.getMeasurementData(AbstractReporter.MALE_SELECTION_HISTORY_KEY).getValue()); }
Source:
<code>public void onPackageRemoved(String packageName) { int uid; synchronized (mPackageNameUidMap) { if (!mPackageNameUidMap.containsKey(packageName)) { return; } uid = mPackageNameUidMap.get(packageName); mPackageNameUidMap.remove(packageName); } SparseIntArray netdPermissionsAppIds = new SparseIntArray(); netdPermissionsAppIds.put(uid, INetd.NO_PERMISSIONS); <START> sendPackagePermissionsToNetd(netdPermissionsAppIds); <END> }</code><technical_language>Actually, thinking this some more, I this is correct, of shared UIDs. If existing code, assumption is a UID permissions of *all* packages in UID. for example apps shared UID "android.uid.phone" (1001), UID 1001 permissions of apps. In current code, if app UID 1001 is uninstalled, remove permissions for UID 1001. instead re-examine permissions of apps installed UID 1001 inform netd if is change in permissions.The current code handle this - for example, highestPermissionForUid. do this. try fix code in this CL, if work of refactoring existing code support new permissions. Basically I turn permissions bits a Boolean (where null = permissions, false = NETWORK, true = SYSTEM) a bitmask 1 << 0 = INTERNET, 1 << 1 = NETWORK, 1 << 2 = SYSTEM, 1 << 3 = UPDATE_DEVICE_STATS, rename highestPermissionForUid getPermissionsForUid. If need code merged soon, simpler modify refactor later</technical_language>

Target:
public void onPackageRemoved(String packageName) { int uid; synchronized (mPackageNameUidMap) { if (!mPackageNameUidMap.containsKey(packageName)) { return; } uid = mPackageNameUidMap.get(packageName); mPackageNameUidMap.remove(packageName); } int permission = 0; String[] packages = mPackageManager.getPackagesForUid(uid); if (packages != null && packages.length > 0) { for (String name : packages) { final PackageInfo app = getPackageInfo(name); if (app != null && app.requestedPermissions != null) { permission |= filterPermission(Arrays.asList(app.requestedPermissions)); } } } sendPackagePermissionsForUid(uid, permission); }
Source:
<code>private Schema getOutputSchema() { List<Schema.Field> fields = new ArrayList<>(); String[] mappings = fieldTypeMapping.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); String fieldName = params[0].trim(); if (Strings.isNullOrEmpty(fieldName)) { throw new IllegalArgumentException("Field name cannot be null or empty."); } else if (params.length < 2 || Strings.isNullOrEmpty(params[1])) { throw new IllegalArgumentException("Type cannot be null. Please specify type for " + fieldName); } Schema.Field field = Schema.Field.of(fieldName, Schema.nullableOf(Schema.of(Schema.Type.valueOf( params[1].trim().toUpperCase())))); if (fields.contains(field)) { <START> throw new IllegalArgumentException("Field " + fieldName + " already has type specified. Check the mapping."); <END> } else { fields.add(field); } } return Schema.recordOf("record", fields); }</code><technical_language>mapping checked</technical_language>

Target:
private Schema getOutputSchema() { List<Schema.Field> fields = new ArrayList<>(); String[] mappings = fieldTypeMapping.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); String fieldName = params[0].trim(); if (Strings.isNullOrEmpty(fieldName)) { throw new IllegalArgumentException("Field name cannot be null or empty."); } else if (params.length < 2 || Strings.isNullOrEmpty(params[1])) { throw new IllegalArgumentException("Type cannot be null. Please specify type for " + fieldName); } Schema.Field field = Schema.Field.of(fieldName, Schema.nullableOf(Schema.of(Schema.Type.valueOf( params[1].trim().toUpperCase())))); if (fields.contains(field)) { throw new IllegalArgumentException(String.format("Field %s already has type specified. Duplicate field %s", fieldName, fieldName)); } else { fields.add(field); } } return Schema.recordOf("record", fields); }
Source:
<code>public void onBackPressed() { if (narrowedList == null) { <START> <END> if (backPressedOnce) { finish(); } backPressedOnce = true; Toast.makeText(this, R.string.press_again_to_exit, Toast.LENGTH_SHORT).show(); statusUpdateRunnable = new Runnable() { @Override public void run() { backPressedOnce = false; } }; statusUpdateHandler.postDelayed(statusUpdateRunnable, 2000); } else { narrowedList = null; getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); clearSearch(); } }</code><technical_language>Is this whitespace change intended</technical_language>

Target:
public void onBackPressed() { if (narrowedList == null) { if (backPressedOnce) { finish(); } backPressedOnce = true; Toast.makeText(this, R.string.press_again_to_exit, Toast.LENGTH_SHORT).show(); statusUpdateRunnable = new Runnable() { @Override public void run() { backPressedOnce = false; } }; statusUpdateHandler.postDelayed(statusUpdateRunnable, 2000); } else { narrowedList = null; getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); } }
Source:
<code>public void runScript(String scriptContent, Consumer<Exception> errorCallback) { final String language = Locale.getDefault().getLanguage(); final String i18nextInit = "i18next.init({ " <START> + String.format(" lng: '%s', ", language) <END> + " debug: true, " + " resources: { " + " en: { " + " translation: { " + " \"Please enter the name of your application\": \"Please enter the name of your application.\"" + " } " + " }, " + " de: { " + " translation: { " + " \"Please enter the name of your application\": \"Bitte geben Sie den Namen Ihrer Anwendung ein.\"" + " } " + " } " + " } " + "}, function(err, t) { " + " if (err) { " + " print('Could not load translation', err); " + " } " + "}); "; final String scriptContenti18n = "include([\"Functions\", \"i18n\", \"i18next\"]);" + i18nextInit + scriptContent; nashornEngineFactory.createEngine().eval(scriptContenti18n, errorCallback); }</code><technical_language>I define code a String. This ugly hard maintain. Is another set this</technical_language>

Target:
public void runScript(String scriptContent, Consumer<Exception> errorCallback) { final String language = Locale.getDefault().getLanguage(); StringBuilder translationsBuilder = new StringBuilder(); for (TranslationDTO translationDTO : this.translations) { translationsBuilder.append(translationDTO.getLanguage()); translationsBuilder.append(":{"); translationsBuilder.append("translation:"); translationsBuilder.append(translationDTO.getJson()); translationsBuilder.append("},"); } final String i18nextInit = "i18next.init({ " + String.format(" lng: '%s', ", language) + " debug: true, " + " resources: { " + translationsBuilder.toString() + " } " + "}, function(err, t) { " + " if (err) { " + " print('Could not load translation', err); " + " } " + "}); "; final String scriptContenti18n = "include([\"Functions\", \"i18n\", \"i18next\"]);" + i18nextInit + scriptContent; nashornEngineFactory.createEngine().eval(scriptContenti18n, errorCallback); }
Source:
<code>public void setTimeoutFuture(Future<?> timeoutFuture) { <START> this.timeoutFuture = timeoutFuture; <END> }</code><technical_language>a small edge case if timeout future is set right task completes held in memory for full duration. Thinking check completion state setting future if complete notify timeout future manually</technical_language>

Target:
public void setTimeoutFuture(Future<?> timeoutFuture) { this.timeoutFuture = timeoutFuture; if (isDone()) { timeoutFuture.cancel(false); } }
Source:
<code>public boolean apply(GitHubPRCause cause) { try { cause.setPollingLog(trigger.getPollingLogAction().getLogFile()); StringBuilder sb = new StringBuilder(); sb.append("Jenkins queued the run (").append(cause.getReason()).append(")"); if (trigger.isCancelQueued() && cancelQueuedBuildByPrNumber(cause.getNumber())) { sb.append(". Queued builds aborted"); } QueueTaskFuture<?> queueTaskFuture = startJob(cause); if (isNull(queueTaskFuture)) { LOGGER.error("{} job didn't start", job.getFullName()); } LOGGER.info(sb.toString()); if (trigger.isPreStatus()) { if (job instanceof MatrixProject) { Collection<? extends MatrixConfiguration> configs = ((MatrixProject) job).getActiveConfigurations(); <START> for (MatrixConfiguration config : configs) { <END> trigger.getRemoteRepo() .createCommitStatus(cause.getHeadSha(), GHCommitState.PENDING, config.getAbsoluteUrl(), sb.toString(), config.getFullName()); } } else { trigger.getRemoteRepo() .createCommitStatus(cause.getHeadSha(), GHCommitState.PENDING, job.getAbsoluteUrl(), sb.toString(), job.getFullName()); } } } catch (IOException e) { LOGGER.error("Can't trigger build ({})", e.getMessage(), e); return false; } return true; }</code><technical_language>![MAJOR](<LINK_1> Refactor this code nest more 3 if/for/while/switch/try statements. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public boolean apply(GitHubPRCause cause) { try { cause.setPollingLog(trigger.getPollingLogAction().getPollingLogFile()); StringBuilder sb = new StringBuilder(); sb.append("Jenkins queued the run (").append(cause.getReason()).append(")"); if (trigger.isCancelQueued() && cancelQueuedBuildByPrNumber(cause.getNumber())) { sb.append(". Queued builds aborted"); } QueueTaskFuture<?> queueTaskFuture = startJob(cause); if (isNull(queueTaskFuture)) { LOGGER.error("{} job didn't start", job.getFullName()); } LOGGER.info(sb.toString()); if (trigger.isPreStatus()) { if (job instanceof MatrixProject) { Collection<? extends MatrixConfiguration> configs = ((MatrixProject) job).getActiveConfigurations(); for (MatrixConfiguration config : configs) { trigger.getRemoteRepo() .createCommitStatus(cause.getHeadSha(), GHCommitState.PENDING, config.getAbsoluteUrl(), sb.toString(), config.getFullName()); } } else { trigger.getRemoteRepo() .createCommitStatus(cause.getHeadSha(), GHCommitState.PENDING, job.getAbsoluteUrl(), sb.toString(), job.getFullName()); } } } catch (IOException e) { LOGGER.error("Can't trigger build ({})", e.getMessage(), e); return false; } return true; }