auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void logSummary(StringBuilder sb, Deque<Item> log, String indentStr) { final int txnIdsPerLine = 15; Iterator<Item> itemator = log.iterator(); for (int lineCnt = 0; lineCnt <= (log.size() / txnIdsPerLine); lineCnt++) { sb.append(indentStr); for(int i = 0; i < txnIdsPerLine; i++) { if (itemator.hasNext()) { Item item = itemator.next(); long txnId = item.getTxnId(); String msgType = "U"; <START> if (item.getMessage() instanceof FragmentTaskMessage) { <END> msgType = "F"; } else if (item.getMessage() instanceof Iv2InitiateTaskMessage) { msgType = "I"; } else if (item.getMessage() instanceof CompleteTransactionMessage) { CompleteTransactionMessage ctm = (CompleteTransactionMessage)item.getMessage(); if (ctm.getTimestamp() == CompleteTransactionMessage.INITIAL_TIMESTAMP) { msgType = "C(I)"; } else if (ctm.isRollback()) { msgType = "C(R)"; } else { msgType = "C"; } } else if (item.getMessage() instanceof DummyTransactionTaskMessage) { msgType = "D"; } sb.append(" ").append(TxnEgo.txnIdSeqToString(txnId)).append(msgType); } } } }</code><technical_language>Style: call getMessage() once, multiple times. supposed a method call is cheap expensive</technical_language>

Target:
private void logSummary(StringBuilder sb, Deque<Item> log, String indentStr) { final int txnIdsPerLine = 15; Iterator<Item> itemator = log.iterator(); for (int lineCnt = 0; lineCnt <= (log.size() / txnIdsPerLine); lineCnt++) { sb.append(indentStr); for(int i = 0; i < txnIdsPerLine; i++) { if (itemator.hasNext()) { Item item = itemator.next(); long txnId = item.getTxnId(); String msgType = "U"; VoltMessage msg = item.getMessage(); if (msg instanceof FragmentTaskMessage) { msgType = "F"; } else if (msg instanceof Iv2InitiateTaskMessage) { msgType = "I"; } else if (msg instanceof CompleteTransactionMessage) { CompleteTransactionMessage ctm = (CompleteTransactionMessage)msg; if (ctm.getTimestamp() == CompleteTransactionMessage.INITIAL_TIMESTAMP) { msgType = "C(I)"; } else if (ctm.isRollback()) { msgType = "C(R)"; } else { msgType = "C"; } } else if (msg instanceof DummyTransactionTaskMessage) { msgType = "D"; } sb.append(" ").append(TxnEgo.txnIdSeqToString(txnId)).append(msgType); } } } }
Source:
<code><START> public void ifSubschemaSuccessThenSubschemaFailure() { <END> ConditionalSchema subject = buildWithLocation(ConditionalSchema.builder().ifSchema(MAX_LENGTH_STRING_SCHEMA).thenSchema(PATTERN_STRING_SCHEMA)); TestSupport.failureOf(subject) .expectedKeyword("then") .expectedPointer("#") .expectedViolatedSchema(subject) .input("bar") .expect(); }</code><technical_language>If pass a Schema.Builder failureOf() call buildWithLocation() set expected pointer. explicitly pass expectedViolatedSchema if is root schema (it matters check sub-schema failures). this test written ConditionalSchema.Builder subject = ConditionalSchema.builder().ifSchema(MAX_LENGTH_STRING_SCHEMA).thenSchema(PATTERN_STRING_SCHEMA); TestSupport.failureOf(subject) .expectedKeyword("then") .input("bar") .expect(); if prefer more explicit leave as-is</technical_language>

Target:
public void ifSubschemaSuccessThenSubschemaFailure() { ConditionalSchema.Builder subject = ConditionalSchema.builder().ifSchema(MAX_LENGTH_STRING_SCHEMA).thenSchema(PATTERN_STRING_SCHEMA); TestSupport.failureOf(subject) .expectedKeyword("then") .expectedPointer("#") .input("bar") .expect(); }
Source:
<code>public EC2AutoScaler( @JsonProperty("minNumWorkers") int minNumWorkers, @JsonProperty("maxNumWorkers") int maxNumWorkers, @JsonProperty("envConfig") EC2EnvironmentConfig envConfig, @JacksonInject AmazonEC2 amazonEC2Client, @JacksonInject SimpleResourceManagementConfig config ) { this.minNumWorkers = minNumWorkers; this.maxNumWorkers = maxNumWorkers; this.envConfig = envConfig; this.amazonEC2Client = amazonEC2Client; this.config = config; try { <START> amazonEC2Client.setRegion(RegionUtils.getRegion(envConfig.getRegion())); <END> } catch (Exception e) { log.warn(String.format("Attempting to set an invalid region: %s", envConfig.getRegion()), e); } }</code><technical_language>Suggest region config simply skipping this step if is null. retains prior behavior. java final String region = envConfig.getRegion(); if(region != null) { amazonEC2Client.setRegion(RegionUtils.getRegion(region)); }</technical_language>

Target:
public EC2AutoScaler( @JsonProperty("minNumWorkers") int minNumWorkers, @JsonProperty("maxNumWorkers") int maxNumWorkers, @JsonProperty("envConfig") EC2EnvironmentConfig envConfig, @JacksonInject AmazonEC2 amazonEC2Client, @JacksonInject SimpleResourceManagementConfig config ) { this.minNumWorkers = minNumWorkers; this.maxNumWorkers = maxNumWorkers; this.envConfig = envConfig; this.amazonEC2Client = amazonEC2Client; this.config = config; }
Source:
<code>public void close() { closed = true; <START> super.close(); <END> }</code><technical_language>if FixedChannelPool#close is idempotent not, if closed AtomicBoolean call super.close() if called before, closed.compareAndSet(false, true)</technical_language>

Target:
public void close() { if ( closed.compareAndSet( false, true ) ) { super.close(); } }
Source:
<code>public CopyImageToHMDNode(Context context) { <START> displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); <END> worldRenderer = context.get(WorldRenderer.class); vrProvider = context.get(OpenVRProvider.class); renderingConfig = context.get(Config.class).getRendering(); requiresCondition(() -> (renderingConfig.isVrSupport() && vrProvider.isInitialized())); requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }</code><technical_language>move this line update() line</technical_language>

Target:
public CopyImageToHMDNode(Context context) { super(context); worldRenderer = context.get(WorldRenderer.class); vrProvider = context.get(OpenVRProvider.class); requiresCondition(() -> (context.get(Config.class).getRendering().isVrSupport() && vrProvider.isInitialized())); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); update(); displayResolutionDependentFBOs.subscribe(this); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
<code>public static Term sub(Term term1, Term term2, TermContext context) { if (term1.equals(UninterpretedToken.of("#Float","0.0"))) { Context context1 = context.definition().context(); return new KItem( KLabelConstant.of("'--Float_",context1), new KList(ImmutableList.<Term>of(term2),null), <START> context).evaluate(context); <END> } if (term2.equals(UninterpretedToken.of("#Float","0.0"))) return term1; return null; }</code><technical_language>comfortable KItem KLabelConstant Context classes</technical_language>

Target:
public static Term sub(Term term1, Term term2, TermContext context) { if (term1.equals(UninterpretedToken.of("#Float","0.0"))) { return new KItem( KLabelConstant.of("'--Float_",context), new KList(ImmutableList.<Term>of(term2),null), context).evaluate(context); } if (term2.equals(UninterpretedToken.of("#Float","0.0"))) return term1; return null; }
Source:
<code>private void createKerberosConfiguration(DomainsConfigurationEntry gssapiDomains, Map<String, List<String>> ldapServersPerGSSAPIDomains) throws ManageDomainsResult { if (!gssapiDomains.isEntryEmpty()) { String gssapiDomainsString = gssapiDomains.getDomainsConfigurationEntry(); KrbConfCreator krbConfCreator; try { log.info("Creating kerberos configuration for domain(s): " + gssapiDomainsString); useDnsLookup = utilityConfiguration.getUseDnsLookup(); if (args.contains(ARG_LDAP_SERVERS)) { krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, ldapServersPerGSSAPIDomains); } else { krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, Collections.EMPTY_MAP); <START> } <END> StringBuffer buffer = null; buffer = krbConfCreator.parse("y"); krbConfCreator.toFile(utilityConfiguration.getkrb5confFilePath() + TESTING_KRB5_CONF_SUFFIX, buffer); log.info("Successfully created kerberos configuration for domain(s): " + gssapiDomainsString); } catch (Exception ex) { ManageDomainsResult result = new ManageDomainsResult(ManageDomainsResultEnum.FAILURE_CREATING_KERBEROS_CONFIGURATION, ex.getMessage()); throw result; } } }</code><technical_language>I prefer this: if (args.contains(ARG_LDAP_SERVERS)) { // LDAP server manually specified, create Kerberos configuration // useDnsLookup configuration parameter ldapServersPerGSSAPIDomains = Collections.emptyMap(); } krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, ldapServersPerGSSAPIDomains);</technical_language>

Target:
private void createKerberosConfiguration(DomainsConfigurationEntry gssapiDomains, Map<String, List<String>> ldapServersPerGSSAPIDomains) throws ManageDomainsResult { if (!gssapiDomains.isEntryEmpty()) { String gssapiDomainsString = gssapiDomains.getDomainsConfigurationEntry(); KrbConfCreator krbConfCreator; try { log.info("Creating kerberos configuration for domain(s): " + gssapiDomainsString); useDnsLookup = utilityConfiguration.getUseDnsLookup(); if (!args.contains(ARG_LDAP_SERVERS) && useDnsLookup) { ldapServersPerGSSAPIDomains = Collections.emptyMap(); } krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, ldapServersPerGSSAPIDomains); StringBuffer buffer = null; buffer = krbConfCreator.parse("y"); krbConfCreator.toFile(utilityConfiguration.getkrb5confFilePath() + TESTING_KRB5_CONF_SUFFIX, buffer); log.info("Successfully created kerberos configuration for domain(s): " + gssapiDomainsString); } catch (Exception ex) { ManageDomainsResult result = new ManageDomainsResult(ManageDomainsResultEnum.FAILURE_CREATING_KERBEROS_CONFIGURATION, ex.getMessage()); throw result; } } }
Source:
<code>protected void parseReverseMethod(String output) { <START> if (output.toString().contains("Processor")) { END> fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.toString().contains("Branch")) { fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.toString().contains("full")) { fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }</code><technical_language>toString()? output is a String. pushed a new patch removes reformats some stuff</technical_language>

Target:
protected void parseReverseMethod(String output) { if (output.contains("Processor")) { fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.contains("Branch")) { fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.contains("full")) { fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }
Source:
<code>public void countByIdAfter() { Long count = this.personRepository.countByIdAfter("2000"); <START> assertThat("Oscars began in 1928", count, equalTo(15L)); <END> }</code><technical_language>Oscars began in 1928 leftover of copy/paste</technical_language>

Target:
public void countByIdAfter() { Long count = this.personRepository.countByIdAfter("2000"); assertThat("> 2000 & <= 2015 ", count, equalTo(15L)); }
Source:
<code>public ITmfStateValue getValue(ITmfEvent event) throws AttributeNotFoundException { ITmfStateValue value = TmfStateValue.nullValue(); int quarkQuery = -1; <START> ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); <END> for (TmfXmlStateAttribute attribute : fQueryValue) { quarkQuery = attribute.getAttributeQuark(event, quarkQuery); if (quarkQuery == -1) { break; } } if (quarkQuery != -1) { value = ss.queryOngoingState(quarkQuery); } return value; }</code><technical_language>'ITmfStateSystem' interface safer (since for reading only)</technical_language>

Target:
public ITmfStateValue getValue(ITmfEvent event) throws AttributeNotFoundException { ITmfStateValue value = TmfStateValue.nullValue(); int quarkQuery = XmlStateProvider.ROOT_QUARK; ITmfStateSystem ss = fProvider.getAssignedStateSystem(); for (TmfXmlStateAttribute attribute : fQueryValue) { quarkQuery = attribute.getAttributeQuark(event, quarkQuery); if (quarkQuery == XmlStateProvider.ERROR_QUARK) { break; } } if (quarkQuery != XmlStateProvider.ERROR_QUARK) { value = ss.queryOngoingState(quarkQuery); } return value; }
Source:
<code>private static VerifiableProperties buildFrontendVProps(File trustStoreFile) throws IOException, GeneralSecurityException { Properties properties = new Properties(); properties.put("rest.server.blob.storage.service.factory", "com.github.ambry.frontend.AmbryBlobStorageServiceFactory"); properties.put("rest.server.router.factory", "com.github.ambry.router.InMemoryRouterFactory"); properties.put("rest.server.account.service.factory", "com.github.ambry.account.InMemAccountServiceFactory"); properties.put("netty.server.port", Integer.toString(PLAINTEXT_SERVER_PORT)); properties.put("netty.server.ssl.port", Integer.toString(SSL_SERVER_PORT)); properties.put("netty.server.enable.ssl", "true"); properties.put(NettyConfig.SSL_FACTORY_KEY, NettySslFactory.class.getName()); properties.put("netty.server.request.buffer.watermark", "1"); properties.put("netty.multipart.post.max.size.bytes", Long.toString(MAX_MULTIPART_POST_SIZE_BYTES)); CommonTestUtils.populateRequiredRouterProps(properties); <START> TestSSLUtils.addSSLProperties(properties, "", SSLFactory.Mode.SERVER, trustStoreFile, "frontend", null); <END> properties.put("kms.default.container.key", TestUtils.getRandomKey(32)); properties.setProperty("clustermap.cluster.name", CLUSTER_NAME); properties.setProperty("clustermap.datacenter.name", DATA_CENTER_NAME); properties.setProperty("clustermap.host.name", HOST_NAME); return new VerifiableProperties(properties); }</code><technical_language>Minor: calling addSSLProperties null argument a lot of times. overload function call another</technical_language>

Target:
private static VerifiableProperties buildFrontendVProps(File trustStoreFile) throws IOException, GeneralSecurityException { Properties properties = new Properties(); properties.put("rest.server.blob.storage.service.factory", "com.github.ambry.frontend.AmbryBlobStorageServiceFactory"); properties.put("rest.server.router.factory", "com.github.ambry.router.InMemoryRouterFactory"); properties.put("rest.server.account.service.factory", "com.github.ambry.account.InMemAccountServiceFactory"); properties.put("netty.server.port", Integer.toString(PLAINTEXT_SERVER_PORT)); properties.put("netty.server.ssl.port", Integer.toString(SSL_SERVER_PORT)); properties.put("netty.server.enable.ssl", "true"); properties.put(NettyConfig.SSL_FACTORY_KEY, NettySslFactory.class.getName()); properties.put("netty.server.request.buffer.watermark", "1"); properties.put("netty.multipart.post.max.size.bytes", Long.toString(MAX_MULTIPART_POST_SIZE_BYTES)); CommonTestUtils.populateRequiredRouterProps(properties); TestSSLUtils.addSSLProperties(properties, "", SSLFactory.Mode.SERVER, trustStoreFile, "frontend"); properties.put("kms.default.container.key", TestUtils.getRandomKey(32)); properties.setProperty("clustermap.cluster.name", CLUSTER_NAME); properties.setProperty("clustermap.datacenter.name", DATA_CENTER_NAME); properties.setProperty("clustermap.host.name", HOST_NAME); return new VerifiableProperties(properties); }
Source:
<code>private PatchSetComplexDisclosurePanel(final ChangeScreen parent, final ChangeDetail detail, final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); changeScreen = parent; changeDetail = detail; patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getConfig().getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null) { final Anchor revlink = new Anchor("(gitweb)", false, gw.toRevision(detail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { <START> final InlineLabel draftLabel = new InlineLabel(" (DRAFT) "); <END> draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } }</code><technical_language>This localized in a constants interface</technical_language>

Target:
private PatchSetComplexDisclosurePanel(final ChangeScreen parent, final ChangeDetail detail, final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); changeScreen = parent; changeDetail = detail; patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getConfig().getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null) { final Anchor revlink = new Anchor("(gitweb)", false, gw.toRevision(detail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } }
Source:
<code><START> private String decodeDigest(byte[] digest) { <END> val hexString = new StringBuffer(); for (int i = 0; i < digest.length; i++) { val hex = Integer.toHexString(0xFF & digest[i]); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); }</code><technical_language>Guava: java BaseEncoding.base16().encode(bytes);</technical_language>

Target:
private String decodeDigest(byte[] digest) { return BaseEncoding.base16().lowerCase().encode(digest); }
Source:
<code>void notifyForFirstChunkCreation() { <START> if (firstChunkIdAndProperties != null) { <END> String chunkId = firstChunkIdAndProperties.getFirst().getID(); BlobProperties chunkProperties = firstChunkIdAndProperties.getSecond(); notificationSystem.onBlobCreated(chunkId, chunkProperties, userMetadata, NotificationBlobType.DataChunk); } }</code><technical_language>omit this check this method called if is for is a chunk needs notification (which is is longer prefixed "maybe")</technical_language>

Target:
void notifyForFirstChunkCreation() { String chunkId = firstChunkIdAndProperties.getFirst().getID(); BlobProperties chunkProperties = firstChunkIdAndProperties.getSecond(); notificationSystem.onBlobCreated(chunkId, chunkProperties, userMetadata, NotificationBlobType.DataChunk); }
Source:
<code>public void beforeCompletion() { <START> log.infof("beforeCompletion called"); <END> checker.setSynchronizedBefore(); }</code><technical_language>log.trace if</technical_language>

Target:
public void beforeCompletion() { log.tracef("beforeCompletion called"); checker.setSynchronizedBefore(); }
Source:
<code>public ZapLabel() { <START> this.setEditable(false); <END> setDefaults(); }</code><technical_language>removed (already set in setDefaults)</technical_language>

Target:
public ZapLabel() { setDefaults(); }
Source:
<code>public CssHeaderItem setNonce(String nonce) { <START> Args.notNull(nonce, "nonce"); <END> this.nonce = nonce; return this; }</code><technical_language>Args.nonEmpty() ?</technical_language>

Target:
public CssHeaderItem setNonce(String nonce) { this.nonce = nonce; return this; }
Source:
<code>public static boolean isCurrentAdministrator() { NuxeoPrincipal principal = getCurrentPrincipal(); return principal != null && principal.isAdministrator() || Framework.isTestModeSet() <START> && (principal == null END> || ADMINISTRATOR.equals(principal.getName()) ); }</code><technical_language>Please add parentheses clarify precedence && ||</technical_language>

Target:
public static boolean isCurrentAdministrator() { NuxeoPrincipal principal = getCurrentPrincipal(); boolean isAdministrator = principal != null && principal.isAdministrator(); boolean isAdministratorInTests = principal == null || ADMINISTRATOR.equals(principal.getName()); return isAdministrator || (Framework.isTestModeSet() && isAdministratorInTests); }
Source:
<code>private URL buildAllureDownloadUrl(String version) throws MalformedURLException { return new URL( <START> "<LINK_0>" + version + "/allure-" + version + ".zip" <END> ); }</code><technical_language>sysprop for url</technical_language>

Target:
private URL buildAllureDownloadUrl(String version) throws MalformedURLException { return fromPath(settingsManager.getSettings().getDownloadBaseUrl()) .path(Paths.get(version, "allure-" + version + ".zip").toString()) .build().toURL(); }
Source:
<code>private void onEvent(CoreEvent event, ExecutorCallback executorCallback) { try { SdkInternalContext sdkInternalContext = from(event); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(getLocation()); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(getLocation()); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(getLocation(), configuration, parameters, operationEvent, callback); fluxSupplier.get().next(operationEvent); }; if (getLocation() != null) { ((DefaultFlowCallStack) event.getFlowCallStack()) .setCurrentProcessorPath(resolvedProcessorRepresentation); <START> sdkInternalContext.getPolicyToApply(getLocation()) <END> .process(event, operationExecutionFunction, () -> resolutionResult, getLocation(), executorCallback); } else { operationExecutionFunction.execute(resolutionResult, event, executorCallback); } } catch (Throwable t) { executorCallback.error(unwrap(t)); } }</code><technical_language>IIRC, getLocation() kind of expensive. invoked in line 390, I extract a variable</technical_language>

Target:
private void onEvent(CoreEvent event, ExecutorCallback executorCallback) { try { SdkInternalContext sdkInternalContext = from(event); final ComponentLocation location = getLocation(); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(location); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(location); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(location, configuration, parameters, operationEvent, callback); fluxSupplier.get().next(operationEvent); }; if (location != null) { ((DefaultFlowCallStack) event.getFlowCallStack()) .setCurrentProcessorPath(resolvedProcessorRepresentation); sdkInternalContext.getPolicyToApply(location) .process(event, operationExecutionFunction, () -> resolutionResult, location, executorCallback); } else { operationExecutionFunction.execute(resolutionResult, event, executorCallback); } } catch (Throwable t) { executorCallback.error(unwrap(t)); } }
Source:
<code>private boolean updatePubKeysToRemoteHosts(final List<String> pubKeys, Set<Guid> remoteServersSet, final String userName) { List<Callable<Boolean>> slaveWritePubKeyList = new ArrayList<>(); <START> for (final Guid currentRemoteHost : remoteServersSet) { <END> slaveWritePubKeyList.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return getBackend().runInternalAction(VdcActionType.UpdateGlusterHostPubKeyToSlaveInternal, new UpdateGlusterHostPubKeyToSlaveParameters(currentRemoteHost, pubKeys, userName)).getSucceeded(); } }); } List<Boolean> returnStatuses = ThreadPoolUtil.invokeAll(slaveWritePubKeyList); for (Boolean currentReturnStatus : returnStatuses) { if (!currentReturnStatus) { return false; } } return true; }</code><technical_language>currentRemoteHostId</technical_language>

Target:
private boolean updatePubKeysToRemoteHosts(final List<String> pubKeys, Set<Guid> remoteServersSet, final String userName) { List<Callable<Boolean>> slaveWritePubKeyList = new ArrayList<>(); for (final Guid currentRemoteHostId : remoteServersSet) { slaveWritePubKeyList.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return getBackend().runInternalAction(VdcActionType.UpdateGlusterHostPubKeyToSlaveInternal, new UpdateGlusterHostPubKeyToSlaveParameters(currentRemoteHostId, pubKeys, userName)).getSucceeded(); } }); } List<Boolean> returnStatuses = ThreadPoolUtil.invokeAll(slaveWritePubKeyList); for (Boolean currentReturnStatus : returnStatuses) { if (!currentReturnStatus) { return false; } } return true; }
Source:
<code>public Map<String, ServiceUserInfo> apply(ConfigResource rscr) throws OrmException { Map<String, ServiceUserInfo> accounts = Maps.newTreeMap(); Config db = storage.get(); for (String username : db.getSubsections(USER)) { String createdBy = db.getString(USER, username, KEY_CREATED_BY); if <START> (userProvider.get().getCapabilities().canAdministrateServer() <END> || userProvider.get().getUserName().equals(createdBy)) { AccountState account = accountCache.getByUsername(username); if (account != null) { ServiceUserInfo info = new ServiceUserInfo(getAccount.get().apply( new AccountResource(userFactory.create(account.getAccount().getId())))); info.username = null; info.createdBy = createdBy; info.createdAt = db.getString(USER, username, KEY_CREATED_AT); accounts.put(username, info); } } } return accounts; }</code><technical_language>Call this loop store in a variable</technical_language>

Target:
public Map<String, ServiceUserInfo> apply(ConfigResource rscr) throws OrmException { Map<String, ServiceUserInfo> accounts = Maps.newTreeMap(); Config db = storage.get(); boolean isAdmin = userProvider.get().getCapabilities().canAdministrateServer(); String currentUser = userProvider.get().getUserName(); for (String username : db.getSubsections(USER)) { String createdBy = db.getString(USER, username, KEY_CREATED_BY); if (isAdmin || currentUser.equals(createdBy)) { AccountState account = accountCache.getByUsername(username); if (account != null) { ServiceUserInfo info = new ServiceUserInfo(getAccount.get().apply( new AccountResource(userFactory.create(account.getAccount().getId())))); info.username = null; info.createdBy = createdBy; info.createdAt = db.getString(USER, username, KEY_CREATED_AT); accounts.put(username, info); } } } return accounts; }
Source:
<code>public void testBadTableConfigJoinType() { <START> assertThrows(NullPointerException.class, () -> DynamicConfigValidator <END> .main(new String[] { "--configDir", "src/test/resources/validator/bad_table_join_type" })); }</code><technical_language>is this change needed</technical_language>

Target:
public void testBadTableConfigJoinType() { assertThrows(IOException.class, () -> DynamicConfigValidator .main(new String[] { "--configDir", "src/test/resources/validator/bad_table_join_type" })); }
Source:
<code>public FetchConnection openFetch() throws TransportException { try { <START> final String service = "git-upload-pack"; <END> final HttpURLConnection c = connect(service); final InputStream in = new BufferedInputStream(c.getInputStream()); try { String expType = "application/x-" + service + "-advertisement"; String actType = c.getContentType(); if (expType.equals(actType)) { checkPacketLineStream(in, service); return new SmartHttpFetchConnection(in); } else { HttpObjectDB d = new HttpObjectDB(objectsUrl); WalkFetchConnection r = new WalkFetchConnection(this, d); BufferedReader br = new BufferedReader( new InputStreamReader(in, Constants.CHARSET)); try { r.available(d.readAdvertisedImpl(br)); } finally { br.close(); } return r; } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, "error reading info/refs", err); } }</code><technical_language>define services in some kind of constants/Interface static final in a future change</technical_language>

Target:
public FetchConnection openFetch() throws TransportException { try { final String service = "git-upload-pack"; final HttpURLConnection c = connect(service); final InputStream in = new BufferedInputStream(c.getInputStream()); try { String expType = "application/x-" + service + "-advertisement"; String actType = c.getContentType(); if (expType.equals(actType)) { checkPacketLineStream(in, service); return new SmartHttpFetchConnection(in); } else { HttpObjectDB d = new HttpObjectDB(objectsUrl); WalkFetchConnection wfc = new WalkFetchConnection(this, d); BufferedReader br = new BufferedReader( new InputStreamReader(in, Constants.CHARSET)); try { wfc.available(d.readAdvertisedImpl(br)); } finally { br.close(); } return wfc; } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, "error reading info/refs", err); } }
Source:
<code>public void testWithMergedRegions() throws Exception { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(TABLE_NAME); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(TABLE_NAME); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(TABLE_NAME)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { <START> LOG.debug("Unloading " + regionServer.getServerName()); <END> rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded\nNow Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }</code><technical_language>nit: parameter substitution</technical_language>

Target:
public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }
Source:
<code>static IllegalStateException missingRejectionHandler( Class<?> cls, Class<? extends Message> rejectionClass) { final String msg = format( "Missing handler for rejection class %s in the class %s", rejectionClass, cls ); <START> return new IllegalStateException(msg); <END> }</code><technical_language>newIllegalStateException() format a string code more compact</technical_language>

Target:
static IllegalStateException missingRejectionHandler( Class<?> cls, Class<? extends Message> rejectionClass) { return newIllegalStateException("Missing handler for rejection class %s in the class %s", rejectionClass, cls); }
Source:
<code>public void handleDataDeleted(String dataPath) { if (_zkClientForListener == null || _zkClientForListener.isClosed()) { return; } _zkClientForListener.unsubscribeAll(); ZkRoutingDataReader.subscribeRoutingDataChanges(_zkClientForListener, this, this); <START> resetZkResources(); <END> }</code><technical_language>Is reduce duplication handle functions</technical_language>

Target:
public void handleDataDeleted(String dataPath) { }
Source:
<code>private static List<List<Path>> buildChildPaths(VirtualFile cur, Locale locale) throws IOException { List<List<Path>> r = new ArrayList<List<Path>>(); VirtualFile[] files = cur.list(); Arrays.sort(files,new FileComparator(locale)); for( VirtualFile f : files ) { Path p = new Path(Util.rawEncode(f.getName()), f.getName(), f.isDirectory(), f.length(), f.canRead(), f.lastModified()); if(!f.isDirectory()) { r.add(Collections.singletonList(p)); } else { List<Path> l = new ArrayList<Path>(); l.add(p); String relPath = Util.rawEncode(f.getName()); while(true) { List<VirtualFile> sub = new ArrayList<VirtualFile>(); for (VirtualFile vf : f.list()) { String name = vf.getName(); if (!name.startsWith(".") && !name.equals("CVS") && !name.equals(".svn")) { sub.add(vf); } } if (sub.size() !=1 || !sub.get(0).isDirectory()) break; f = sub.get(0); relPath += '/'+Util.rawEncode(f.getName()); <START> l.add(new Path(relPath,f.getName(),true,0, f.canRead(),0)); <END> } r.add(l); } } return r; }</code><technical_language>0</technical_language>

Target:
private static List<List<Path>> buildChildPaths(VirtualFile cur, Locale locale) throws IOException { List<List<Path>> r = new ArrayList<List<Path>>(); VirtualFile[] files = cur.list(); Arrays.sort(files,new FileComparator(locale)); for( VirtualFile f : files ) { Path p = new Path(Util.rawEncode(f.getName()), f.getName(), f.isDirectory(), f.length(), f.canRead(), f.lastModified()); if(!f.isDirectory()) { r.add(Collections.singletonList(p)); } else { List<Path> l = new ArrayList<Path>(); l.add(p); String relPath = Util.rawEncode(f.getName()); while(true) { List<VirtualFile> sub = new ArrayList<VirtualFile>(); for (VirtualFile vf : f.list()) { String name = vf.getName(); if (!name.startsWith(".") && !name.equals("CVS") && !name.equals(".svn")) { sub.add(vf); } } if (sub.size() !=1 || !sub.get(0).isDirectory()) break; f = sub.get(0); relPath += '/'+Util.rawEncode(f.getName()); l.add(new Path(relPath,f.getName(),true, f.length(), f.canRead(), f.lastModified())); } r.add(l); } } return r; }
Source:
<code><START> protected VdcActionParametersBase getAddParameters(VmWatchdog entity, WatchDog device) { <END> WatchdogParameters watchdogParameters = new WatchdogParameters(); watchdogParameters.setAction(getMapper(WatchdogAction.class, VmWatchdogAction.class).map(WatchdogAction.valueOf(StringUtils.upperCase(device.getAction())), null)); watchdogParameters.setModel(getMapper(WatchdogModel.class, VmWatchdogType.class).map(WatchdogModel.valueOf(StringUtils.upperCase(device.getModel())), null)); watchdogParameters.setId(parentId); watchdogParameters.setVm(isVm(parentId)); return watchdogParameters; }</code><technical_language>validating enums [1], if user string (action/model) incorrect thrown bad-request + enum members. [1] example in BackendVmsResource.add(){validateEnums()}</technical_language>

Target:
protected VdcActionParametersBase getAddParameters(VmWatchdog entity, WatchDog device) { WatchdogParameters watchdogParameters = new WatchdogParameters(); validateEnums(WatchDog.class, device); watchdogParameters.setAction(getMapper(WatchdogAction.class, VmWatchdogAction.class).map(WatchdogAction.valueOf(StringUtils.upperCase(device.getAction())), null)); watchdogParameters.setModel(getMapper(WatchdogModel.class, VmWatchdogType.class).map(WatchdogModel.valueOf(StringUtils.upperCase(device.getModel())), null)); watchdogParameters.setId(parentId); watchdogParameters.setVm(isVm(parentId)); return watchdogParameters; }
Source:
<code>public long getCheckAllLedgersCTime() throws UnavailableException { <START> LOG.debug("getCheckAllLedgersCTime"); <END> try { byte[] data = zkc.getData(checkAllLedgersCtimeZnode, false, null); return Long.parseLong(new String(data, UTF_8)); } catch (KeeperException.NoNodeException ne) { LOG.warn("checkAllLedgersCtimeZnode is not yet available"); return -1; } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } }</code><technical_language>add if (LOG.isDebugEnabled())</technical_language>

Target:
public long getCheckAllLedgersCTime() throws UnavailableException { if (LOG.isDebugEnabled()) { LOG.debug("setCheckAllLedgersCTime"); } try { byte[] data = zkc.getData(checkAllLedgersCtimeZnode, false, null); CheckAllLedgersFormat checkAllLedgersFormat = CheckAllLedgersFormat.parseFrom(data); return checkAllLedgersFormat.hasCheckAllLedgersCTime() ? checkAllLedgersFormat.getCheckAllLedgersCTime() : -1; } catch (KeeperException.NoNodeException ne) { LOG.warn("checkAllLedgersCtimeZnode is not yet available"); return -1; } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } catch (InvalidProtocolBufferException ipbe) { throw new ReplicationException.UnavailableException("Error while parsing ZK protobuf binary data", ipbe); } }
Source:
<code>private TransportClient createClient() { final Settings.Builder settings = getSettings(); try { <START> Class clazz = Class.forName("org.elasticsearch.xpack.client.PreBuiltXPackTransportClient"); <END> Constructor<?> ctor = clazz.getConstructor(Settings.class, Class[].class); settings.put("xpack.security.user", configuration.getUser() + ":" + configuration.getPassword()) .put("xpack.security.transport.ssl.enabled", configuration.getEnableSSL()); return (TransportClient) ctor.newInstance(new Object[] {settings.build(), new Class[0]}); } catch (Exception e) { LOG.info("XPack Client was not found on the classpath, using the standard client"); return new PreBuiltTransportClient(settings.build()); } }</code><technical_language>Camel's ClassResolver API, CamelContext get load classes classpath</technical_language>

Target:
private TransportClient createClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Settings.Builder settings = getSettings(); final CamelContext camelContext = getEndpoint().getCamelContext(); final Class<?> clazz = camelContext.getClassResolver().resolveClass("org.elasticsearch.xpack.client.PreBuiltXPackTransportClient"); if (clazz != null) { Constructor<?> ctor = clazz.getConstructor(Settings.class, Class[].class); settings.put("xpack.security.user", configuration.getUser() + ":" + configuration.getPassword()) .put("xpack.security.transport.ssl.enabled", configuration.getEnableSSL()); LOG.debug("XPack Client was found on the classpath"); return (TransportClient) ctor.newInstance(new Object[] {settings.build(), new Class[0]}); } else { LOG.debug("XPack Client was not found on the classpath, using the standard client"); return new PreBuiltTransportClient(settings.build()); } }
Source:
<code>private TabletServerMutations<QCMutation> dequeue(String location) { BlockingQueue<TabletServerMutations<QCMutation>> queue = getServerQueue(location).queue; ArrayList<TabletServerMutations<QCMutation>> mutations = new ArrayList<>(); queue.drainTo(mutations); if (mutations.size() == 0) return null; if (mutations.size() == 1) { return mutations.get(0); } else { TabletServerMutations<QCMutation> tsm = mutations.get(0); for (int i = 1; i < mutations.size(); i++) { for (Entry<KeyExtent,List<QCMutation>> entry : mutations.get(i).getMutations().entrySet()) { <START> List<QCMutation> list = tsm.getMutations().computeIfAbsent(entry.getKey(), <END> k -> new ArrayList<>()); list.addAll(entry.getValue()); } } return tsm; } }</code><technical_language>this point, need assign a variable... call addAll result</technical_language>

Target:
private TabletServerMutations<QCMutation> dequeue(String location) { BlockingQueue<TabletServerMutations<QCMutation>> queue = getServerQueue(location).queue; ArrayList<TabletServerMutations<QCMutation>> mutations = new ArrayList<>(); queue.drainTo(mutations); if (mutations.size() == 0) return null; if (mutations.size() == 1) { return mutations.get(0); } else { TabletServerMutations<QCMutation> tsm = mutations.get(0); for (int i = 1; i < mutations.size(); i++) { for (Entry<KeyExtent,List<QCMutation>> entry : mutations.get(i).getMutations().entrySet()) { tsm.getMutations().computeIfAbsent(entry.getKey(), k -> new ArrayList<>()) .addAll(entry.getValue()); } } return tsm; } }
Source:
<code>public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, final String fileName, SinkRecord record, final AvroData avroData) throws IOException { DatumWriter<Object> datumWriter = new GenericDatumWriter<>(); final DataFileWriter<Object> writer = new DataFileWriter<>(datumWriter); Path path = new Path(fileName); final Schema schema = record.valueSchema(); final FSDataOutputStream out = path.getFileSystem(conf).create(path); org.apache.avro.Schema avroSchema = avroData.fromCopycatSchema(schema); <START> int version = schema.version(); <END> avroSchema.addProp("version", String.valueOf(version)); writer.create(avroSchema, out); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException { Object value = avroData.fromCopycatData(schema, record.value()); writer.append(value); } @Override public void close() throws IOException { writer.close(); } }; }</code><technical_language>careful here, version required this result in a null pointer exception</technical_language>

Target:
public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, final String fileName, SinkRecord record, final AvroData avroData) throws IOException { DatumWriter<Object> datumWriter = new GenericDatumWriter<>(); final DataFileWriter<Object> writer = new DataFileWriter<>(datumWriter); Path path = new Path(fileName); final Schema schema = record.valueSchema(); final FSDataOutputStream out = path.getFileSystem(conf).create(path); org.apache.avro.Schema avroSchema = avroData.fromCopycatSchema(schema); writer.create(avroSchema, out); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException { Object value = avroData.fromCopycatData(schema, record.value()); writer.append(value); } @Override public void close() throws IOException { writer.close(); } }; }
Source:
<code>public static Object[] unwrapBinariesInArray(Object[] arr) { Class<?> compType = arr.getClass().getComponentType(); <START> Object[] res = (Object[])Array.newInstance(compType, arr.length); <END> for (int i = 0; i < arr.length; i++) res[i] = unwrapBinary(arr[i]); return res; }</code><technical_language>Great! strange, untyped array. Great catch</technical_language>

Target:
public static Object[] unwrapBinariesInArray(Object[] arr) { if (arr.getClass().getComponentType() != Object.class) return arr; Object[] res = new Object[arr.length]; for (int i = 0; i < arr.length; i++) res[i] = unwrapBinary(arr[i]); return res; }
Source:
<code>public long save(LibraryDilution dilution) throws IOException { long id; <START> if (dilution.getId() == AbstractLibrary.UNSAVED_ID) { <END> id = (long) currentSession().save(dilution); } else { currentSession().update(dilution); id = dilution.getId(); } return id; }</code><technical_language>same, comparing dilution's ID AbstractLibrary's</technical_language>

Target:
public long save(LibraryDilution dilution) throws IOException { long id; if (dilution.getId() == LibraryDilution.UNSAVED_ID) { id = (long) currentSession().save(dilution); } else { currentSession().update(dilution); id = dilution.getId(); } return id; }
Source:
<code>public boolean isAvailable(SourceMonitor callback) { <START> throw new UnsupportedOperationException( <END> "isAvailable callbacks are not supported for " + CachedSource.class.getSimpleName()); }</code><technical_language>I simply change behavior throw exception in classes implement Source interface is whitelisted. current behavior considered a bug write a ticket for it. If throw exception, client code break. If leave existing behavior, existing client code behaving has</technical_language>

Target:
public boolean isAvailable(SourceMonitor callback) { return isAvailable(); }
Source:
<code>public String getDosingType(DrugOrder drugOrder) { String dosingType = null; if (drugOrder.getDosingType() != null) { dosingType = drugOrder.getDosingType().getCanonicalName(); } <START> return dosingType; <END> }</code><technical_language>do in line</technical_language>

Target:
public String getDosingType(DrugOrder drugOrder) { return (drugOrder.getDosingType() != null) ? drugOrder.getDosingType().getCanonicalName() : null; }
Source:
<code><START> private <T, U> Map<T, U> getGuestTimeZone(){ <END> Map resultMap = map(); resultMap.put("zone","Israel"); resultMap.put("offset", "120"); return resultMap; }</code><technical_language>VDSM this is Map<String, Object>, please change</technical_language>

Target:
private Map<String, String> getGuestTimeZone(){ Map<String, String> resultMap = map(); resultMap.put("zone","Israel"); resultMap.put("offset", "120"); return resultMap; }
Source:
<code>public void returnContext(DirContext context) { final ClassLoader oldClassLoader = setClassLoaderTo(targetClassLoader); try{ if (context == null) { return; } <START> <END> if (context instanceof InitialDirContext) { try { context.close(); log.debugf("Context [%s] was closed. Connection closed or just returned to the pool.", context); } catch (NamingException ignored) { } } }finally{ setClassLoaderTo(oldClassLoader); } }</code><technical_language>context==null condition stay of classloader setting block. (better performance)</technical_language>

Target:
public void returnContext(DirContext context) { if (context == null) { return; } if (context instanceof InitialDirContext) { final ClassLoader oldClassLoader = setClassLoaderTo(targetClassLoader); try { context.close(); log.debugf("Context [%s] was closed. Connection closed or just returned to the pool.", context); } catch (NamingException ignored) { } finally { setClassLoaderTo(oldClassLoader); } } }