auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public JsonNode getDefault(FieldDescriptor f) { <END> if (f.isRequired() || f.isRepeated()) return null; if (f.hasDefaultValue()) { Object value = f.getDefaultValue(); switch (f.getType()) { case ENUM: value = ((EnumValueDescriptor) value).getName(); break; } String json = toString(value); try { return MAPPER.readTree(FACTORY.createParser(json)); } catch (IOException e) { throw new RuntimeException(e); } } switch (f.getType()) { case BOOL: return NODES.booleanNode(false); case FLOAT: case DOUBLE: case INT32: case UINT32: case SINT32: case FIXED32: case SFIXED32: case INT64: case UINT64: case SINT64: case FIXED64: case SFIXED64: return NODES.numberNode(0); case STRING: case BYTES: return NODES.textNode(""); case ENUM: return NODES.textNode(f.getEnumType().getValues().get(0).getName()); case MESSAGE: return NODES.nullNode(); case GROUP: default: throw new RuntimeException("Unexpected type: " + f.getType()); } }</code><technical_language>this one. For 1.9, of methods Jackson/JSON private expose detail. Making this public reverse that</technical_language>

Target:
private JsonNode getDefault(FieldDescriptor f) { if (f.isRequired() || f.isRepeated()) return null; if (f.hasDefaultValue()) { Object value = f.getDefaultValue(); switch (f.getType()) { case ENUM: value = ((EnumValueDescriptor) value).getName(); break; } String json = toString(value); try { return MAPPER.readTree(FACTORY.createParser(json)); } catch (IOException e) { throw new RuntimeException(e); } } switch (f.getType()) { case BOOL: return NODES.booleanNode(false); case FLOAT: case DOUBLE: case INT32: case UINT32: case SINT32: case FIXED32: case SFIXED32: case INT64: case UINT64: case SINT64: case FIXED64: case SFIXED64: return NODES.numberNode(0); case STRING: case BYTES: return NODES.textNode(""); case ENUM: return NODES.textNode(f.getEnumType().getValues().get(0).getName()); case MESSAGE: return NODES.nullNode(); case GROUP: default: throw new RuntimeException("Unexpected type: " + f.getType()); } }
Source:
<code>public void testValidSelectionKey() throws Exception { final ZooKeeper zk = createClient(); try { Iterable<ServerCnxn> connections = serverFactory.getConnections(); for (ServerCnxn serverCnxn : connections) { MockNIOServerCnxn mock = new MockNIOServerCnxn((NIOServerCnxn) serverCnxn); ((NIOServerCnxn) serverCnxn).sock.keyFor(((NIOServerCnxnFactory) serverFactory).selector).cancel();; mock.mockSendBuffer( ByteBuffer.allocate(8) ); } } catch (CancelledKeyException e) { <START> e.printStackTrace(); <END> Assert.fail(e.toString()); } finally { zk.close(); } }</code><technical_language>Instead of printStackTrace, LOG.error("Exception while sending bytes!", e);</technical_language>

Target:
public void testValidSelectionKey() throws Exception { final ZooKeeper zk = createZKClient(hostPort, 3000); try { Iterable<ServerCnxn> connections = serverFactory.getConnections(); for (ServerCnxn serverCnxn : connections) { MockNIOServerCnxn mock = new MockNIOServerCnxn((NIOServerCnxn) serverCnxn); ((NIOServerCnxn) serverCnxn).sock.keyFor(((NIOServerCnxnFactory) serverFactory).selector).cancel();; mock.mockSendBuffer(ByteBuffer.allocate(8)); } } catch (CancelledKeyException e) { LOG.error("Exception while sending bytes!", e); Assert.fail(e.toString()); } finally { zk.close(); } }
Source:
<code>boolean firstToken(UUID playerId) { <START> return playerIds.get(playerId) == TokenState.FirstToken; <END> }</code><technical_language>getOrDefault instead get</technical_language>

Target:
boolean firstToken(UUID playerId) { return playerIds.getOrDefault(playerId, TokenState.NoToken) == TokenState.FirstToken; }
Source:
<code>InitializeCheckingWrapper(TransactionManager manager, Supplier<Boolean> initializationPrerequisite, Callback<TransactionManager> callBack, ScheduledExecutorService initializer) { this.txManager = manager; this.initializationPrerequisite = initializationPrerequisite; this.callback = callBack; this.executorService = initializer; <START> if (isInitializedInternal()) { <END> runCallback(); } else { scheduleInitializationCheckAndCallback(); } }</code><technical_language>is this doing? extract a method? a side note: scheduleInitializationCheckAndCallback scheduling itself, is unnecessary executor service is a ScheduledExecutorService</technical_language>

Target:
InitializeCheckingWrapper(TransactionManager manager, Supplier<Boolean> initializationPrerequisite, Callback<TransactionManager> callBack, ScheduledExecutorService initializer) { this.txManager = manager; this.initializationPrerequisite = initializationPrerequisite; this.callback = callBack; this.executorService = initializer; runCallbackIfInitializedOrScheduleForLater(this::attemptCallbackSynchronously); }
Source:
<code>public void write(DataOutput output) throws IOException { Map<String, byte[][]> snapShots = ImmutableMap.copyOf(regionGuidePosts); WritableUtils.writeVInt(output, snapShots.size()); for (String key: snapShots.keySet()) { <START> Gson gson = new Gson(); <END> WritableUtils.writeString(output, key); WritableUtils.writeString(output, gson.toJson(snapShots.get(key))); } }</code><technical_language>Json is overkill. Bytes utilities this: WritableUtils.writeVInt(output, snapShots.size()); for map entry WritableUtils.writeString(output, key); WritableUtils.writeVInt(output, values.length); for Bytes.writeByteArray(output, value);</technical_language>

Target:
public void write(DataOutput output) throws IOException { if (regionGuidePosts == null) { WritableUtils.writeVInt(output, 0); return; } WritableUtils.writeVInt(output, regionGuidePosts.size()); for (Entry<String, byte[][]> entry : regionGuidePosts.entrySet()) { WritableUtils.writeString(output, entry.getKey()); byte[][] value = entry.getValue(); WritableUtils.writeVInt(output, value.length); for (int i=0; i<value.length; i++) { Bytes.writeByteArray(output, value[i]); } } }
Source:
<code>public HdfsSplitInfo build() { <START> assert (inputPath != null && inputSplit != null && inputFormatClassName != null); <END> return new HdfsSplitInfo(inputPath, inputSplit, inputFormatClassName); }</code><technical_language>BuilderUtils.notNull()</technical_language>

Target:
public HdfsSplitInfo build() { BuilderUtils.notNull(inputPath); BuilderUtils.notNull(inputSplit); BuilderUtils.notNull(inputFormatClassName); return new HdfsSplitInfo(inputPath, inputSplit, inputFormatClassName); }
Source:
<code>public void handlerAdded(ChannelHandlerContext ctx) { ChannelPipeline cp = ctx.pipeline(); if (cp.get(WebSocketServerProtocolHandshakeHandler.class) == null) { ctx.pipeline().addBefore(ctx.name(), WebSocketServerProtocolHandshakeHandler.class.getName(), new WebSocketServerProtocolHandshakeHandler(websocketPath, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch, checkStartsWith) <START> .handshakeTimeoutMillis(handshakeTimeoutMillis)); <END> } if (cp.get(Utf8FrameValidator.class) == null) { ctx.pipeline().addBefore(ctx.name(), Utf8FrameValidator.class.getName(), new Utf8FrameValidator()); } }</code><technical_language>Ditto - need a mutable state</technical_language>

Target:
public void handlerAdded(ChannelHandlerContext ctx) { ChannelPipeline cp = ctx.pipeline(); if (cp.get(WebSocketServerProtocolHandshakeHandler.class) == null) { ctx.pipeline().addBefore(ctx.name(), WebSocketServerProtocolHandshakeHandler.class.getName(), new WebSocketServerProtocolHandshakeHandler(websocketPath, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch, checkStartsWith, handshakeTimeoutMillis)); } if (cp.get(Utf8FrameValidator.class) == null) { ctx.pipeline().addBefore(ctx.name(), Utf8FrameValidator.class.getName(), new Utf8FrameValidator()); } }
Source:
<code>public void offerStatement(SQLStmt stmt, int offset, ByteBuffer psetBuffer) { int stmtHash = SQLStmtAdHocHelper.getHash(stmt); m_inputCRC.update(stmtHash); if (m_stmtCount < MAX_STATEMENTS_WITH_DETAIL) { m_stmtParamCRC.reset(); m_stmtParamCRC.updateFromPosition(offset, psetBuffer); int perStmtCRC = (int) m_stmtParamCRC.getValue(); <START> m_hashes[m_stmtCount * 2] = stmtHash; <END> m_hashes[m_stmtCount * 2 + 1] = perStmtCRC; m_inputCRC.update(perStmtCRC); } else { m_inputCRC.updateFromPosition(offset, psetBuffer); } m_stmtCount++; }</code><technical_language>if index offset, save a shift statement</technical_language>

Target:
public void offerStatement(SQLStmt stmt, int offset, ByteBuffer psetBuffer) { int stmtHash = SQLStmtAdHocHelper.getHash(stmt); m_inputCRC.update(stmtHash); if (m_hashCount < MAX_HASHES_COUNT) { m_stmtParamCRC.reset(); m_stmtParamCRC.updateFromPosition(offset, psetBuffer); int perStmtCRC = (int) m_stmtParamCRC.getValue(); m_hashes[m_hashCount] = stmtHash; m_hashes[m_hashCount + 1] = perStmtCRC; m_inputCRC.update(perStmtCRC); } else { m_inputCRC.updateFromPosition(offset, psetBuffer); } m_hashCount += 2; }
Source:
<code>public synchronized void notify(RecordsDeliveryAck recordsDeliveryAck) { final RecordsRetrieved recordsToCheck = peekNextResult(); <START> if (recordsToCheck != null && recordsToCheck.batchUniqueIdentifier() <END> .equals(recordsDeliveryAck.batchUniqueIdentifier())) { evictPublishedEvent(); drainQueueForRequests(); } else { final BatchUniqueIdentifier peekedBatchUniqueIdentifier = recordsToCheck == null ? null : recordsToCheck.batchUniqueIdentifier(); log.info("{} : Received a stale notification with id instead of expected id at {}. Will ignore.", shardId, recordsDeliveryAck.batchUniqueIdentifier(), peekedBatchUniqueIdentifier, Instant.now()); } takeDelayedDeliveryActionIfRequired(shardId, lastEventDeliveryTime, log); }</code><technical_language>this if/else logic moved session? i.e. handleRecordsDeliveryAck(RecordsDeliveryAck ack) I checking for illegalState in evictPublishedEvent, do calling handleRecordsDeliveryAck() This simplify code a bit, need methods/access queue directly</technical_language>

Target:
public synchronized void notify(RecordsDeliveryAck recordsDeliveryAck) { publisherSession.handleRecordsDeliveryAck(recordsDeliveryAck, shardId, () -> drainQueueForRequests()); takeDelayedDeliveryActionIfRequired(shardId, lastEventDeliveryTime, log); }
Source:
<code>public byte[] getCacheKey() { <START> return new byte[]{0x1}; <END> }</code><technical_language>store byte arrays static fields in subclass of ColumnIncluderator</technical_language>

Target:
public byte[] getCacheKey() { return ALL_CACHE_PREFIX; }
Source:
<code>public void testAospFileContexts() throws Exception { checkFc = copyResourceToTempFile("/checkfc"); checkFc.setExecutable(true); deviceFcFile = File.createTempFile("file_contexts", ".bin"); deviceFcFile.deleteOnExit(); mDevice.pullFile("/file_contexts.bin", deviceFcFile); aospFcFile = copyResourceToTempFile("/general_file_contexts.bin"); ProcessBuilder pb = new ProcessBuilder(checkFc.getAbsolutePath(), "-c", aospFcFile.getAbsolutePath(), deviceFcFile.getAbsolutePath()); pb.redirectOutput(ProcessBuilder.Redirect.PIPE); pb.redirectErrorStream(true); Process p = pb.start(); p.waitFor(); BufferedReader result = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = result.readLine(); if(line.equals("equal") || line.equals("subset")) { CLog.d("The file_contexts.bin file includes the latest AOSP entries.\n"); } else { CLog.d("The file_contexts.bin file did not include the latest AOSP entries:\n" + line + "\n"); <START> aospFcFile = copyResourceToTempFile("/ab3857191_file_contexts.bin"); ProcessBuilder pb1 = new ProcessBuilder(checkFc.getAbsolutePath(), "-c", aospFcFile.getAbsolutePath(), deviceFcFile.getAbsolutePath()); pb1.redirectOutput(ProcessBuilder.Redirect.PIPE); pb1.redirectErrorStream(true); Process p1 = pb1.start(); p1.waitFor(); BufferedReader result1 = new BufferedReader(new InputStreamReader(p1.getInputStream())); String line1 = result1.readLine(); <END> assertTrue("The file_contexts.bin file did not include the AOSP entries:\n" + line1 + "\n", line1.equals("equal") || line1.equals("subset")); } }</code><technical_language>This is essentially a duplicate of lines 325-336. move this function avoid duplication</technical_language>

Target:
public void testAospFileContexts() throws Exception { checkFc = copyResourceToTempFile("/checkfc"); checkFc.setExecutable(true); deviceFcFile = File.createTempFile("file_contexts", ".bin"); deviceFcFile.deleteOnExit(); mDevice.pullFile("/file_contexts.bin", deviceFcFile); String line = checkFileContexts("/general_file_contexts.bin"); if(line.equals("equal") || line.equals("subset")) { CLog.d("The file_contexts.bin file includes the latest AOSP entries.\n"); } else { CLog.d("The file_contexts.bin file did not include the latest AOSP entries:\n" + line + "\n"); line = checkFileContexts("/ab3857191_file_contexts.bin"); assertTrue("The file_contexts.bin file did not include the AOSP entries:\n" + line + "\n", line.equals("equal") || line.equals("subset")); } }
Source:
<code>public void createMOTOPayment() { <START> int minimumAmount = 1; <END> publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); connectorMockClient.respondOk_whenCreateCharge(CHARGE_TOKEN_ID, GATEWAY_ACCOUNT_ID, aCreateOrGetChargeResponseFromConnector() .withAmount(minimumAmount) .withChargeId(CHARGE_ID) .withState(CREATED) .withReturnUrl(RETURN_URL) .withDescription(DESCRIPTION) .withReference(REFERENCE) .withPaymentProvider(PAYMENT_PROVIDER) .withGatewayTransactionId(GATEWAY_TRANSACTION_ID) .withCreatedDate(CREATED_DATE) .withLanguage(SupportedLanguage.ENGLISH) .withDelayedCapture(false) .withMoto(true) .withRefundSummary(REFUND_SUMMARY) .withCardDetails(CARD_DETAILS) .build()); CreateChargeRequestParams params = aCreateChargeRequestParams() .withAmount(minimumAmount) .withDescription(DESCRIPTION) .withReference(REFERENCE) .withReturnUrl(RETURN_URL) .withMoto(true) .build(); postPaymentResponse(paymentPayload(params)) .statusCode(201) .contentType(JSON) .body("payment_id", is(CHARGE_ID)) .body("amount", is(minimumAmount)) .body("reference", is(REFERENCE)) .body("description", is(DESCRIPTION)) .body("return_url", is(RETURN_URL)) .body("moto", is(true)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)); connectorMockClient.verifyCreateChargeConnectorRequest(GATEWAY_ACCOUNT_ID, params); }</code><technical_language>this renamed "amount"</technical_language>

Target:
public void createMOTOPayment() { int amount = 1; publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); connectorMockClient.respondOk_whenCreateCharge(CHARGE_TOKEN_ID, GATEWAY_ACCOUNT_ID, aCreateOrGetChargeResponseFromConnector() .withAmount(amount) .withChargeId(CHARGE_ID) .withState(CREATED) .withReturnUrl(RETURN_URL) .withDescription(DESCRIPTION) .withReference(REFERENCE) .withPaymentProvider(PAYMENT_PROVIDER) .withGatewayTransactionId(GATEWAY_TRANSACTION_ID) .withCreatedDate(CREATED_DATE) .withLanguage(SupportedLanguage.ENGLISH) .withDelayedCapture(false) .withMoto(true) .withRefundSummary(REFUND_SUMMARY) .withCardDetails(CARD_DETAILS) .build()); CreateChargeRequestParams params = aCreateChargeRequestParams() .withAmount(amount) .withDescription(DESCRIPTION) .withReference(REFERENCE) .withReturnUrl(RETURN_URL) .withMoto(true) .build(); postPaymentResponse(paymentPayload(params)) .statusCode(201) .contentType(JSON) .body("payment_id", is(CHARGE_ID)) .body("amount", is(amount)) .body("reference", is(REFERENCE)) .body("description", is(DESCRIPTION)) .body("return_url", is(RETURN_URL)) .body("moto", is(true)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)); connectorMockClient.verifyCreateChargeConnectorRequest(GATEWAY_ACCOUNT_ID, params); }
Source:
<code>public void afterPropertiesSet() { eventBus.register(this); fafService.addOnMessageListener(JoinGameMessage.class, message -> iceAdapterProxy.joinGame(message.getUsername(), message.getPeerUid())); fafService.addOnMessageListener(HostGameMessage.class, message -> iceAdapterProxy.hostGame(message.getMap())); fafService.addOnMessageListener(ConnectToPeerMessage.class, message -> iceAdapterProxy.connectToPeer(message.getUsername(), message.getPeerUid(), message.isOffer())); fafService.addOnMessageListener(GameLaunchMessage.class, this::updateLobbyModeFromGameInfo); fafService.addOnMessageListener(DisconnectFromPeerMessage.class, message -> iceAdapterProxy.disconnectFromPeer(message.getUid())); fafService.addOnMessageListener(IceServerMessage.class, message -> iceAdapterProxy.iceMsg(message.getSender(), message.getRecord())); <START> iceAdapterProxy = newIceAdapterProxy(); <END> }</code><technical_language>depends method depends in constructor if in declaration</technical_language>

Target:
public void afterPropertiesSet() { eventBus.register(this); fafService.addOnMessageListener(JoinGameMessage.class, message -> iceAdapterProxy.joinGame(message.getUsername(), message.getPeerUid())); fafService.addOnMessageListener(HostGameMessage.class, message -> iceAdapterProxy.hostGame(message.getMap())); fafService.addOnMessageListener(ConnectToPeerMessage.class, message -> iceAdapterProxy.connectToPeer(message.getUsername(), message.getPeerUid(), message.isOffer())); fafService.addOnMessageListener(GameLaunchMessage.class, this::updateLobbyModeFromGameInfo); fafService.addOnMessageListener(DisconnectFromPeerMessage.class, message -> iceAdapterProxy.disconnectFromPeer(message.getUid())); fafService.addOnMessageListener(IceServerMessage.class, message -> iceAdapterProxy.iceMsg(message.getSender(), message.getRecord())); }
Source:
<code>public void invalidateToken(Integer connectionHash){ <START> tokens.put(connectionHash, null); <END> }</code><technical_language>remove token map put null</technical_language>

Target:
public void invalidateToken(Integer connectionHash) { tokens.remove(connectionHash); }
Source:
<code><START> public boolean isExactSort() { <END> return true; }</code><technical_language>a big deal, I final</technical_language>

Target:
public final boolean isExactSort() { return true; }
Source:
<code><START> public int hashCode() { <END> final int prime = 31; int result = 1; result = prime * result + this.a; result = prime * result + this.b; result = prime * result + this.c; result = prime * result + this.d; result = prime * result + this.e; result = prime * result + this.f; return result; }</code><technical_language>In some other parts of code a while simplified hashCode() implementation making a liner like: return Objects.hash(this.a, this.b, this.c, this.d, this.e, this.f);</technical_language>

Target:
public int hashCode() { return Objects.hash(this.a, this.b, this.c, this.d, this.e, this.f); }
Source:
<code>public JobStatus schedule(@PathParam("task") String task) { String className = "org.candlepin.pinsetter.tasks." + task; try { boolean isCron = false; for (String cronJob : ConfigProperties.DEFAULT_TASK_LIST) { if (className.equalsIgnoreCase(cronJob)) { isCron = true; className = cronJob; } } if (isCron) { Class<? extends KingpinJob> taskClass = (Class<? extends KingpinJob>) Class .forName(className); <START> return pk.scheduleSingleJob(taskClass, Util.generateUUID()); <END> } else { throw new BadRequestException("Not a cron job:" + task); } } catch (ClassNotFoundException e) { throw new IseException(i18n.tr("Error trying to schedule {}: {}", className, e.getMessage())); } catch (PinsetterException e) { throw new IseException(i18n.tr("Error trying to schedule {}: {}", className, e.getMessage())); } }</code><technical_language>clean this a bit save line wrapping declaring class generically, casting in schedule line: Class taskClass = Class.forName(className); return pk.scheduleSingleJob((Class<? extends KingpinJob>) taskClass, Util.generateUUID());</technical_language>

Target:
public JobStatus schedule(@PathParam("task") String task) { String className = "org.candlepin.pinsetter.tasks." + task; try { boolean allowed = false; for (String permissibleJob : ConfigProperties.DEFAULT_TASK_LIST) { if (className.equalsIgnoreCase(permissibleJob)) { allowed = true; className = permissibleJob; } } if (allowed) { Class taskClass = Class.forName(className); return pk.scheduleSingleJob((Class<? extends KingpinJob>) taskClass, Util.generateUUID()); } else { throw new BadRequestException(i18n.tr("Not a permissible job: {0}", task)); } } catch (ClassNotFoundException e) { throw new IseException(i18n.tr("Error trying to schedule {0}: {1}", className, e.getMessage())); } catch (PinsetterException e) { throw new IseException(i18n.tr("Error trying to schedule {0}: {1}", className, e.getMessage())); } }
Source:
<code>public Response processPostLogout( @FormParam(SAML_REQ) final String samlRequest, @FormParam(SAML_RESPONSE) final String samlResponse, @FormParam(RELAY_STATE) final String relayState, @Context final HttpServletRequest request) throws WSSecurityException, IdpException { LogoutState logoutState = getLogoutState(request); Cookie cookie = getCookie(request); try { if (samlRequest != null) { LogoutRequest logoutRequest = <START> logoutMessage.extractSamlLogoutRequest( <END> new String(Base64.getMimeDecoder().decode(samlRequest), StandardCharsets.UTF_8)); validatePost(request, logoutRequest); return handleLogoutRequest( cookie, logoutState, logoutRequest, SamlProtocol.Binding.HTTP_POST, relayState); } else if (samlResponse != null) { LogoutResponse logoutResponse = logoutMessage.extractSamlLogoutResponse(RestSecurity.inflateBase64(samlResponse)); String requestId = logoutState != null ? logoutState.getCurrentRequestId() : null; validatePost(request, logoutResponse, requestId); return handleLogoutResponse( cookie, logoutState, logoutResponse, SamlProtocol.Binding.HTTP_POST); } } catch (IOException | XMLStreamException e) { throw new IdpException("Unable to inflate Saml Object", e); } catch (ValidationException e) { throw new IdpException("Unable to validate Saml Object", e); } throw new IdpException("Unable to process logout"); }</code><technical_language>Ah. This wrong with. DEFLATE encoding is for Redirect binding, POST re-inflate SAML request parameter. I update RestSecurity moving this functionality base64 decode there. Also, inflateBase64 method in RestSecurity updated rely for internal decoding prior re-inflation</technical_language>

Target:
public Response processPostLogout( @FormParam(SAML_REQ) final String samlRequest, @FormParam(SAML_RESPONSE) final String samlResponse, @FormParam(RELAY_STATE) final String relayState, @Context final HttpServletRequest request) throws WSSecurityException, IdpException { LogoutState logoutState = getLogoutState(request); Cookie cookie = getCookie(request); try { if (samlRequest != null) { LogoutRequest logoutRequest = logoutMessage.extractSamlLogoutRequest( new String(RestSecurity.base64Decode(samlRequest), StandardCharsets.UTF_8)); validatePost(request, logoutRequest); return handleLogoutRequest( cookie, logoutState, logoutRequest, SamlProtocol.Binding.HTTP_POST, relayState); } else if (samlResponse != null) { LogoutResponse logoutResponse = logoutMessage.extractSamlLogoutResponse(RestSecurity.inflateBase64(samlResponse)); String requestId = logoutState != null ? logoutState.getCurrentRequestId() : null; validatePost(request, logoutResponse, requestId); return handleLogoutResponse( cookie, logoutState, logoutResponse, SamlProtocol.Binding.HTTP_POST); } } catch (IOException | XMLStreamException e) { throw new IdpException("Unable to inflate Saml Object", e); } catch (ValidationException e) { throw new IdpException("Unable to validate Saml Object", e); } throw new IdpException("Unable to process logout"); }
Source:
<code>public Builder() { this.eventName = null; this.condition = null; this.continuity = null; this.classType = null; this.optional = false; this.times = false; this.minTimes = -1; this.maxTimes = -1; <START> this.stopCondition = null; <END> }</code><technical_language>I this DEFAULT_STOPCONDITION, null</technical_language>

Target:
public Builder() { this.eventName = null; this.condition = null; this.contiguity = null; this.classType = null; this.optional = false; this.times = false; this.minTimes = -1; this.maxTimes = -1; this.innerContiguity = DEFAULT_INNER_CONTIGUITY; this.stopCondition = DEFAULT_STOPCONDITION; }
Source:
<code>private GraphiteReporter startGraphiteReporter() { metrics.registerAll( new GarbageCollectorMetricSet(ManagementFactory.getGarbageCollectorMXBeans()) ); metrics.registerAll(new MemoryUsageGaugeSet()); metrics.registerAll(new ThreadStatesGaugeSet()); metrics.registerAll(new JvmAttributeGaugeSet()); try { GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics) .prefixedWith("atlas-owl-api.".concat(InetAddress.getLocalHost().getHostName())) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .build(new Graphite(new InetSocketAddress( graphiteHost, graphitePort ))); <START> if (!IS_PROCESSING && graphiteReportingEnabled) { <END> reporter.start(30, TimeUnit.SECONDS); System.out.println("Started Graphite reporter"); } return reporter; } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>Wait, do report metrics for processing...? I missing...</technical_language>

Target:
private GraphiteReporter startGraphiteReporter() { metrics.registerAll( new GarbageCollectorMetricSet(ManagementFactory.getGarbageCollectorMXBeans()) ); metrics.registerAll(new MemoryUsageGaugeSet()); metrics.registerAll(new ThreadStatesGaugeSet()); metrics.registerAll(new JvmAttributeGaugeSet()); try { GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics) .prefixedWith("atlas-owl-api.".concat(InetAddress.getLocalHost().getHostName())) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .build(new Graphite(GRAPHITE_ADDRESS)); if (!IS_PROCESSING && GRAPHITE_REPORTING_ENABLED) { reporter.start(30, TimeUnit.SECONDS); System.out.println("Started Graphite reporter"); } return reporter; } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void delay() { <START> final AtomicBoolean bookedForRunning = this.bookedForRunning; <END> if (bookedForRunning == null || bookedForRunning.compareAndSet(false, true)) { try { scheduledExecutorService.schedule(() -> delayedRunForScheduler(bookedForRunning), nsPeriod, TimeUnit.NANOSECONDS); } catch (RejectedExecutionException e) { if (bookedForRunning == null) { bookedForRunning.set(false); } throw e; } } }</code><technical_language>simpler follow variable shadowing (here in called methods)</technical_language>

Target:
public boolean delay() { final AtomicBoolean booked = this.bookedForRunning; if (!booked.compareAndSet(false, true)) { return false; } try { scheduledExecutorService.schedule(() -> bookedRunForScheduler(booked), period, timeUnit); return true; } catch (RejectedExecutionException e) { booked.set(false); throw e; } }
Source:
<code>private OrganizationDto getOrganization(DbSession dbSession, @Nullable String organizationParam) { String organizationKey = Optional.ofNullable(organizationParam) .orElseGet(organizationProvider.get()::getKey); return checkFoundWithOptional( dbClient.organizationDao().selectByKey(dbSession, organizationKey), <START> "No organizationDto with key '%s'", organizationKey); <END> }</code><technical_language>Type : "organizationDto" -> "organization"</technical_language>

Target:
private OrganizationDto getOrganization(DbSession dbSession, @Nullable String organizationParam) { String organizationKey = Optional.ofNullable(organizationParam) .orElseGet(organizationProvider.get()::getKey); return checkFoundWithOptional( dbClient.organizationDao().selectByKey(dbSession, organizationKey), "No organization with key '%s'", organizationKey); }
Source:
<code>private boolean isAuthorized(HttpServletRequest request) { String cognitoIdToken = request.getHeader(CuCamsConstants.CapAssetApi.COGNITO_ID_TOKEN); PublicKey cognitoUserPoolPublicKey = getPublicKeyFromFile(); if (ObjectUtils.isNull(cognitoUserPoolPublicKey)) { return false; } Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) cognitoUserPoolPublicKey, null); JWTVerifier verifier = JWT.require(algorithm) .withIssuer(CuCamsConstants.CapAssetApi.COGNITO_USER_POOL_ISSUER_URL) .withClaim(CuCamsConstants.CapAssetApi.TOKEN_USE, CuCamsConstants.CapAssetApi.ID) .build(); <START> DecodedJWT jwt = verifier.verify(cognitoIdToken); <END> String email = jwt.getClaim(CuCamsConstants.CapAssetApi.EMAIL).asString(); LOG.info("CapAssetInventory Authorized {}", email); return true; }</code><technical_language>If user is unauthorized this fail exeption</technical_language>

Target:
private boolean isAuthorized(HttpServletRequest request) { String cognitoIdToken = request.getHeader(CuCamsConstants.CapAssetApi.COGNITO_ID_TOKEN); PublicKey cognitoUserPoolPublicKey = getCognitoUserPoolPublicKey(); if (ObjectUtils.isNull(cognitoUserPoolPublicKey)) { return false; } String cognitoUserPoolIssuerUrl = getConfigurationService().getPropertyValueAsString(CuCamsConstants.CapAssetApi.ConfigurationProperties.COGNITO_USER_POOL_ISSUER_URL); Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) cognitoUserPoolPublicKey, null); JWTVerifier verifier = JWT.require(algorithm) .withIssuer(cognitoUserPoolIssuerUrl) .withClaim(CuCamsConstants.CapAssetApi.TOKEN_USE, CuCamsConstants.CapAssetApi.ID) .build(); DecodedJWT jwt = verifier.verify(cognitoIdToken); String email = jwt.getClaim(CuCamsConstants.CapAssetApi.EMAIL).asString(); LOG.info("CapAssetInventory Authorized {}", email); return true; }
Source:
<code>private ReconcilerWithAutoSave getAutoSave(){ Reconciler reconciler = getConfiguration().getReconciler(); <START> if(reconciler == null){ <END> return null; } if(reconciler instanceof ReconcilerWithAutoSave) { return ((ReconcilerWithAutoSave)reconciler); } return null; }</code><technical_language>simplify this method removing this <code>if</code> statement & block</technical_language>

Target:
private ReconcilerWithAutoSave getAutoSave() { Reconciler reconciler = getConfiguration().getReconciler(); if (reconciler != null && reconciler instanceof ReconcilerWithAutoSave) { return ((ReconcilerWithAutoSave)reconciler); } return null; }
Source:
<code>public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRebalanceStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity rebalanceStatusEntity =vdcValue.getReturnValue(); <START> showStatus(rebalanceStatusEntity); <END> } }), volumeEntity.getClusterId(), volumeEntity.getId()); }</code><technical_language>a null check for rebalanceStatusEntity</technical_language>

Target:
public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRebalanceStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity rebalanceStatusEntity =vdcValue.getReturnValue(); if (rebalanceStatusEntity != null) { showStatus(rebalanceStatusEntity); } } }), volumeEntity.getClusterId(), volumeEntity.getId()); }
Source:
<code>public RawPacket reverseTransform(RawPacket pkt) { if (extensionId != -1) { RawPacket.HeaderExtension he = pkt.getHeaderExtension((byte) extensionId); if (he != null && he.getExtLength() == 2) { int seq = RTPUtils.readUint16AsInt( he.getBuffer(), he.getOffset() + 1); <START> packetReceived( <END> seq, pkt.getPayloadType(), pkt.isPacketMarked()); } } return pkt; }</code><technical_language>I pt is in logging, implicitly converted a byte int</technical_language>

Target:
public RawPacket reverseTransform(RawPacket pkt) { if (extensionId != -1) { RawPacket.HeaderExtension he = pkt.getHeaderExtension((byte) extensionId); if (he != null && he.getExtLength() == 2) { int seq = RTPUtils.readUint16AsInt( he.getBuffer(), he.getOffset() + 1); packetReceived( seq, RawPacket.getPayloadType(pkt), pkt.isPacketMarked()); } } return pkt; }
Source:
<code>public static Block stPoints(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Geometry geometry = deserialize(input); <START> validateType("ST_Points", geometry, VALID_TYPES_FOR_ST_POINTS); <END> if (geometry.isEmpty()) { return null; } int pointCount = geometry.getNumPoints(); BlockBuilder blockBuilder = GEOMETRY.createBlockBuilder(null, pointCount); buildPointsBlock(geometry, blockBuilder); return blockBuilder.build(); }</code><technical_language>this is current geometries, method work for additional geometry JTS supports, remove this (and bit in lines 150-152</technical_language>

Target:
public static Block stPoints(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Geometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } BlockBuilder blockBuilder = GEOMETRY.createBlockBuilder(null, geometry.getNumPoints()); buildPointsBlock(geometry, blockBuilder); return blockBuilder.build(); }
Source:
<code>public Object getValue(String paramName) throws IllegalArgumentException { if (values.containsKey(paramName)) { return values.get(paramName); } Expression expression = null; if (parameterExpressions.containsKey(paramName)) { if (input instanceof Collection<?>) { expression = parameterExpressions.get(paramName)[1]; } else { expression = parameterExpressions.get(paramName)[0]; } } else { String expr = input instanceof Collection<?> ? "#root.![" + paramName + "]" : paramName; <START> expression = PARSER.parseExpression(expr); <END> } Object value = evaluateExpression(expression, input); values.put(paramName, value); if (logger.isDebugEnabled()) { logger.debug("Resolved expression " + expression + " to " + value); } return value; }</code><technical_language>Hmmm - add dynamically map? get lots of paramName ?</technical_language>

Target:
public Object getValue(String paramName) throws IllegalArgumentException { if (values.containsKey(paramName)) { return values.get(paramName); } if (!parameterExpressions.containsKey(paramName)) { Expression[] expressions = new Expression[] { PARSER.parseExpression(paramName), PARSER.parseExpression("#root.![" + paramName + "]") }; ExpressionEvaluatingSqlParameterSourceFactory.this.parameterExpressions.put(paramName, expressions); this.parameterExpressions.put(paramName, expressions); } Expression expression = null; if (input instanceof Collection<?>) { expression = parameterExpressions.get(paramName)[1]; } else { expression = parameterExpressions.get(paramName)[0]; } Object value = evaluateExpression(expression, input); values.put(paramName, value); if (logger.isDebugEnabled()) { logger.debug("Resolved expression " + expression + " to " + value); } return value; }
Source:
<code>public void setSingleBlockMode(boolean singleBlockMode) { <START> logger.log(Level.INFO, "Setting singleBlockMode to ".concat((singleBlockMode)?"true":"false")); <END> this.singleBlockMode = singleBlockMode; changed(); }</code><technical_language>a matter of taste of course, prefer Boolean.toString(singleBlockMode) here</technical_language>

Target:
public void setSingleBlockMode(boolean singleBlockMode) { logger.log(Level.INFO, "Setting singleBlockMode to ".concat( ((Boolean)singleBlockMode).toString() )); this.singleBlockMode = singleBlockMode; changed(); }
Source:
<code>private static void addRangeToNeighbors(List<CommonRange> neighborRangeList, Range<Token> range, EndpointsForRange neighbors) { Set<InetAddressAndPort> endpoints = neighbors.endpoints(); Set<InetAddressAndPort> transEndpoints = neighbors.filter(Replica::isTransient).endpoints(); for (CommonRange cr : neighborRangeList) { <START> if (Sets.difference(cr.endpoints, endpoints).isEmpty() && Sets.difference(cr.transEndpoints, transEndpoints).isEmpty()) <END> { cr.ranges.add(range); return; } } List<Range<Token>> ranges = new ArrayList<>(); ranges.add(range); neighborRangeList.add(new CommonRange(endpoints, transEndpoints, ranges)); }</code><technical_language>equals() here. Set equality right thing</technical_language>

Target:
private static void addRangeToNeighbors(List<CommonRange> neighborRangeList, Range<Token> range, EndpointsForRange neighbors) { Set<InetAddressAndPort> endpoints = neighbors.endpoints(); Set<InetAddressAndPort> transEndpoints = neighbors.filter(Replica::isTransient).endpoints(); for (CommonRange commonRange : neighborRangeList) { if (commonRange.matchesEndpoints(endpoints, transEndpoints)) { commonRange.ranges.add(range); return; } } List<Range<Token>> ranges = new ArrayList<>(); ranges.add(range); neighborRangeList.add(new CommonRange(endpoints, transEndpoints, ranges)); }
Source:
<code>@Override public void actionPerformed(final ActionEvent actionEvent) { final TargetEnvironment env = obsComp.getTargetEnvironment(); final GuideEnvironment ge = env.getGuideEnvironment(); final Option<IndexedGuideGroup> iggOpt = positionTable.getSelectedGroupOrParentGroup(env) .filter(igg -> !igg.group().isAutomatic()) <START> .orElse(() -> { return appendNewGroup(obsComp, positionTable); }); <END> final TargetEnvironment newEnv = obsComp.getTargetEnvironment(); Option<GuideProbeTargets> opt = iggOpt.flatMap(igg -> igg.group().get(probe)); final Integer groupIndex = iggOpt.map(IndexedGuideGroup::index).getOrElse(ge.getPrimaryIndex()); final SPTarget target = new SPTarget(); final GuideProbeTargets targets = opt .map(gpt -> gpt.update(OptionsList.UpdateOps.appendAsPrimary(target))) .getOrElse(GuideProbeTargets.create(probe, target)); obsComp.setTargetEnvironment(newEnv.setGuideEnvironment( newEnv.getGuideEnvironment().putGuideProbeTargets(groupIndex, targets))); positionTable.selectTarget(target); SwingUtilities.invokeLater(EdCompTargetList.this::showTargetTag); }</code><technical_language>do need block return here? enough do .orElse(() -> appendNewGroup(obsComp, positionTable));</technical_language>

Target:
@Override public void actionPerformed(final ActionEvent actionEvent) { final TargetEnvironment env = obsComp.getTargetEnvironment(); final GuideEnvironment ge = env.getGuideEnvironment(); final Option<Tuple2<TargetEnvironment,IndexedGuideGroup>> resultOpt = positionTable.getSelectedGroupOrParentGroup(env) .filter(igg -> !igg.group().isAutomatic()) .map(igg -> (Tuple2<TargetEnvironment,IndexedGuideGroup>) new Pair<>(env, igg)) .orElse(() -> appendNewGroup(obsComp, positionTable)); resultOpt.foreach(result -> { final TargetEnvironment newEnv = result._1(); final IndexedGuideGroup igg = result._2(); final Option<GuideProbeTargets> gptOpt = igg.group().get(probe); final Integer groupIndex = igg.index(); final SPTarget target = new SPTarget(); final GuideProbeTargets targets = gptOpt .map(gpt -> gpt.update(OptionsList.UpdateOps.appendAsPrimary(target))) .getOrElse(GuideProbeTargets.create(probe, target)); final TargetEnvironment newEnvWithTarget = newEnv.setGuideEnvironment(newEnv.getGuideEnvironment() .putGuideProbeTargets(groupIndex, targets)); obsComp.setTargetEnvironment(newEnvWithTarget); positionTable.selectTarget(target); SwingUtilities.invokeLater(EdCompTargetList.this::showTargetTag); }); }
Source:
<code>private void populateArticle(ViewHolder mViewHolder, ViewGroup container, final Activity.PlusObject.Attachments attachment) { if(attachment == null) return; View attachmentView = createAttachmentView(mViewHolder, container, R.layout.news_item_article, 1); mViewHolder.title.setText(attachment.getDisplayName()); try { mViewHolder.attachmentContent.setText(new URL(attachment.getUrl()).getHost()); } catch (MalformedURLException e) { e.printStackTrace(); } if (attachment.getImage() == null && attachment.getFullImage() == null) { mViewHolder.articleImage.setVisibility(View.GONE); } else { String imageUrl = null; if (attachment.getFullImage() != null) { imageUrl = attachment.getFullImage().getUrl(); } <START> if (attachment.getImage() != null) { <END> imageUrl = attachment.getImage().getUrl(); } mViewHolder.articleImage.setImageDrawable(null); if (imageUrl != null) { mViewHolder.articleImage.setVisibility(View.VISIBLE); App.getInstance().getPicasso() .load(imageUrl) .into(mViewHolder.articleImage); } else { mViewHolder.articleImage.setVisibility(View.GONE); } } attachmentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(attachment.getUrl())); mContext.startActivity(i); } }); }</code><technical_language>else if</technical_language>

Target:
private void populateArticle(ViewHolder mViewHolder, ViewGroup container, final Activity.PlusObject.Attachments attachment) { if (attachment == null) return; View attachmentView = createAttachmentView(mViewHolder, container, R.layout.news_item_article, 1); mViewHolder.title.setText(attachment.getDisplayName()); try { mViewHolder.attachmentContent.setText(new URL(attachment.getUrl()).getHost()); } catch (MalformedURLException e) { e.printStackTrace(); } if (attachment.getImage() == null && attachment.getFullImage() == null) { mViewHolder.articleImage.setVisibility(View.GONE); } else { mViewHolder.articleImage.setImageDrawable(null); String imageUrl = getAttachmentImageUrl(attachment); if (imageUrl != null) { mViewHolder.articleImage.setVisibility(View.VISIBLE); App.getInstance().getPicasso() .load(imageUrl) .into(mViewHolder.articleImage); } else { mViewHolder.articleImage.setVisibility(View.GONE); } } attachmentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(attachment.getUrl())); mContext.startActivity(i); } }); }
Source:
<code>boolean wouldPushProject(Project.NameKey project) { if (projectMatch != null) { if (projectMatch.endsWith("/*")) { return project.get().startsWith( projectMatch.substring(0, projectMatch.length() - 1)); } String projectPattern; if (isRE(projectMatch)) { <START> projectPattern = projectMatch.substring(1); <END> } else { projectPattern = projectMatch; } return (new RegExp(projectPattern, RegExp.NONE)). toAutomaton().run(project.get()); } return true; }</code><technical_language>^ is real, anchors start. trim it</technical_language>

Target:
boolean wouldPushProject(Project.NameKey project) { if (projectMatch != null) { if (isRE(projectMatch)) { return (new RegExp(projectMatch, RegExp.NONE)). toAutomaton().run(project.get()); } else if (projectMatch.endsWith("/*")) { return project.get().startsWith( projectMatch.substring(0, projectMatch.length() - 1)); } else { return project.get().equals(projectMatch); } } return true; }
Source:
<code>protected Span[] assertSpansReportedKindInAnyOrder(@Nullable Span.Kind kind1, @Nullable Span.Kind kind2) throws InterruptedException { if (Objects.equals(kind1, kind2)) { throw new AssertionError("Expected test to pass different span kinds"); } Span span1 = takeSpan(), span2 = takeSpan(); <START> Stream.of(span1, span2).forEach(span -> assertThat(span.kind()) <END> .withFailMessage("Expected %s to have kind=%s or %s", span, kind1, kind2) .isIn(kind1, kind2)); if (Objects.equals(span1.kind(), span2.kind())) { throw new AssertionError("Expected span " + span1 + " to have different kind than " + span2); } Span[] result = new Span[] {span1, span2}; return result[0].kind() == kind1 ? result : new Span[] {span2, span1}; }</code><technical_language>Recommend a normal loop Arrays.asList similar code a lambda in stack trace if failure</technical_language>

Target:
protected Span[] assertSpansReportedKindInAnyOrder(@Nullable Span.Kind kind1, @Nullable Span.Kind kind2) throws InterruptedException { if (Objects.equals(kind1, kind2)) { throw new AssertionError("Expected test to pass different span kinds"); } Span span1 = takeSpan(), span2 = takeSpan(); for (Span span : Arrays.asList(span1, span2)) { assertThat(span.kind()) .withFailMessage("Expected %s to have kind=%s or %s", span, kind1, kind2) .isIn(kind1, kind2); } if (Objects.equals(span1.kind(), span2.kind())) { throw new AssertionError("Expected span " + span1 + " to have different kind than " + span2); } Span[] result = new Span[] {span1, span2}; return result[0].kind() == kind1 ? result : new Span[] {span2, span1}; }
Source:
<code><START> public SortedSet<Fun.Tuple2<String, Fun.Tuple2>> getStopTimesForStop (String stop_id) { <END> SortedSet<Fun.Tuple2<String, Fun.Tuple2>> index = this.stopStopTimeSet .subSet(new Fun.Tuple2<>(stop_id, null), new Fun.Tuple2(stop_id, Fun.HI)); return index; }</code><technical_language>returning StopTime objects directly</technical_language>

Target:
public List<StopTime> getStopTimesForStop (String stop_id) { SortedSet<Tuple2<String, Tuple2>> index = this.stopStopTimeSet .subSet(new Tuple2<>(stop_id, null), new Tuple2(stop_id, Fun.HI)); return index.stream() .map(tuple -> this.stop_times.get(tuple.b)) .sorted((a, b) -> Integer.compare(a.arrival_time, b.arrival_time)) .collect(Collectors.toList()); }
Source:
<code>private void notifyAndMigrateDataSetObservers() { Adapter adapter = contributionsListFragment.getAdapter(); for (DataSetObserver observer : observersWaitingForLoad) { adapter.registerDataSetObserver(observer); } observersWaitingForLoad.clear(); for (DataSetObserver observer : observersWaitingForLoad) { observer.onChanged(); } <START> if (!ConfigUtils.isBetaFlavour()) { <END> setUploadCount(); } else { betaSetUploadCount(getTotalMediaCount()); } }</code><technical_language>I suggest removing ! inverting sections, for increased readability</technical_language>

Target:
private void notifyAndMigrateDataSetObservers() { Adapter adapter = contributionsListFragment.getAdapter(); for (DataSetObserver observer : observersWaitingForLoad) { adapter.registerDataSetObserver(observer); } observersWaitingForLoad.clear(); for (DataSetObserver observer : observersWaitingForLoad) { observer.onChanged(); } if (ConfigUtils.isBetaFlavour()) { betaSetUploadCount(getTotalMediaCount()); } else { setUploadCount(); } }
Source:
<code>public <C extends JdbiConfig<C>> C get(Class<C> configClass) { <START> return (C) cache.computeIfAbsent(configClass, c -> <END> createFromParent(configClass) .orElseGet(() -> create(configClass))); }</code><technical_language>avoid unchecked cast configClass.cast()</technical_language>

Target:
public <C extends JdbiConfig<C>> C get(Class<C> configClass) { JdbiConfig<?> config = cache.computeIfAbsent(configClass, c -> createFromParent(configClass) .orElseGet(() -> create(configClass))); return configClass.cast(config); }
Source:
<code>public void theDeviceShouldBeRemoved(final String deviceIdentification) throws Throwable { final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); Assert.assertNull(device); <START> final List<DeviceAuthorization> devAuths = this.deviceAuthorizationRepository.findByDevice(device); <END> Assert.assertTrue(devAuths.size() == 0); }</code><technical_language>this code do, fact device == null (because of Assert.assertNull(device); above). removed</technical_language>

Target:
public void theDeviceShouldBeRemoved(final String deviceIdentification) throws Throwable { final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); Assert.assertNotNull(device); final List<DeviceAuthorization> devAuths = this.deviceAuthorizationRepository.findByDevice(device); Assert.assertTrue(devAuths.size() == 0); }
Source:
<code>DiskImageBase getDisk() { if (_disk == null) { <START> _disk = (DiskImageBase) getDbFacade().getDiskDao().get(getParameters().getObjectId()); <END> } return _disk; }</code><technical_language>DiskImageDao</technical_language>

Target:
private DiskImageBase getDisk() { return _disk; }
Source:
<code>private List<String> getListOfIpAddresses(String ipAddressesAsString) { if (ipAddressesAsString == null) { <START> return Collections.emptyList(); <END> } return Arrays.asList(StringUtils.split(ipAddressesAsString,DELIMITER)); }</code><technical_language>return null</technical_language>

Target:
private List<String> getListOfIpAddresses(String ipAddressesAsString) { return ipAddressesAsString == null ? null : Arrays.asList(StringUtils.split(ipAddressesAsString, DELIMITER)); }
Source:
<code>public <T extends EhcacheEntityResponse> void removeResponseListener(Class<T> responseType, ResponseListener<T> responseListener) { List<ResponseListener<? extends EhcacheEntityResponse>> responseListeners = this.responseListeners.get(responseType); <START> if (responseListener != null) { <END> responseListeners.remove(responseListener); } }</code><technical_language>typo here, pretty want responseListeners s for null check</technical_language>

Target:
public <T extends EhcacheEntityResponse> void removeResponseListener(Class<T> responseType, ResponseListener<T> responseListener) { List<ResponseListener<? extends EhcacheEntityResponse>> responseListeners = this.responseListeners.get(responseType); if (responseListeners != null) { responseListeners.remove(responseListener); } }