auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void toString_test() { String str = dObjTyped.toString(); <START> assertTrue(str.startsWith("AllJavaTypes = dyn[")); <END> assertTrue(str.endsWith("}]")); }</code><technical_language>reason save chars here. I strongly prefer dynamic</technical_language>

Target:
public void toString_test() { String str = dObjTyped.toString(); assertTrue(str.startsWith("AllJavaTypes = dynamic[")); assertTrue(str.endsWith("}]")); }
Source:
<code>public void visitSwitchStatement(SwitchStatementTree tree) { if (isWithinSwitch) { <START> context().newIssue(this, tree, MESSAGE); <END> } boolean previousIsWithinSwitch = isWithinSwitch; isWithinSwitch = true; super.visitSwitchStatement(tree); isWithinSwitch = previousIsWithinSwitch; }</code><technical_language>I raise issue switch keyword. more understandable a secondary location nesting switch keyword</technical_language>

Target:
public void visitSwitchStatement(SwitchStatementTree tree) { if (parentSwitchStatement != null) { context().newIssue(this, tree.switchToken(), MESSAGE) .secondary(parentSwitchStatement.switchToken(), MESSAGE_SECONDARY); } SwitchStatementTree previousParentSwitchStatement = parentSwitchStatement; parentSwitchStatement = tree; super.visitSwitchStatement(tree); parentSwitchStatement = previousParentSwitchStatement; }
Source:
<code>public void testOriginalContentTypeIsRetrievedForLegacyContentHeaderType() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MessageHandler messageHandler = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { assertThat(message.getPayload()).isInstanceOf(byte[].class); <START> assertThat(new String(((byte[])message.getPayload()), StandardCharsets.UTF_8)).isEqualTo("{\"message\":\"Hi\"}"); <END> assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()).isEqualTo("application/json"); latch.countDown(); } }; testSink.input().subscribe(messageHandler); testSink.input().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}".getBytes()) .setHeader(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE, "application/json") .build()); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); testSink.input().unsubscribe(messageHandler); }</code><technical_language>Hmmm - I need this charset noise in tests</technical_language>

Target:
public void testOriginalContentTypeIsRetrievedForLegacyContentHeaderType() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MessageHandler messageHandler = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { assertThat(message.getPayload()).isInstanceOf(byte[].class); assertThat(((byte[])message.getPayload())).isEqualTo("{\"message\":\"Hi\"}".getBytes(StandardCharsets.UTF_8)); assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()).isEqualTo("application/json"); latch.countDown(); } }; testSink.input().subscribe(messageHandler); testSink.input().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}".getBytes()) .setHeader(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE, "application/json") .build()); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); testSink.input().unsubscribe(messageHandler); }
Source:
<code>public void testDeserialization() throws Exception { ConfigurationObjectFactory factory = Config.createFactory(new Properties()); DruidProcessingConfig config = factory.build(DruidProcessingConfig.class); Assert.assertEquals(1024 * 1024 * 1024, config.intermediateComputeSizeBytes()); Assert.assertEquals(Integer.MAX_VALUE, config.poolCacheMaxCount()); if (Runtime.getRuntime().availableProcessors() > 1) { Assert.assertTrue(config.getNumThreads() < Runtime.getRuntime().availableProcessors()); <START> } <END> Assert.assertEquals(0, config.columnCacheSizeBytes()); Assert.assertFalse(config.isFifo()); Properties props = new Properties(); props.setProperty("druid.processing.buffer.sizeBytes", "1"); props.setProperty("druid.processing.buffer.poolCacheMaxCount", "1"); props.setProperty("druid.processing.numThreads", "5"); props.setProperty("druid.processing.columnCache.sizeBytes", "1"); props.setProperty("druid.processing.fifo", "true"); factory = Config.createFactory(props); config = factory.buildWithReplacements(DruidProcessingConfig.class, ImmutableMap.of("base_path", "druid.processing")); Assert.assertEquals(1, config.intermediateComputeSizeBytes()); Assert.assertEquals(1, config.poolCacheMaxCount()); Assert.assertEquals(5, config.getNumThreads()); Assert.assertEquals(1, config.columnCacheSizeBytes()); Assert.assertTrue(config.isFifo()); }</code><technical_language>nice assert numThreads is 1 processors is 1</technical_language>

Target:
public void testDeserialization() throws Exception { ConfigurationObjectFactory factory = Config.createFactory(new Properties()); DruidProcessingConfig config = factory.build(DruidProcessingConfig.class); Assert.assertEquals(1024 * 1024 * 1024, config.intermediateComputeSizeBytes()); Assert.assertEquals(Integer.MAX_VALUE, config.poolCacheMaxCount()); if (Runtime.getRuntime().availableProcessors() == 1) { Assert.assertTrue(config.getNumThreads() == 1); } else { Assert.assertTrue(config.getNumThreads() < Runtime.getRuntime().availableProcessors()); } Assert.assertEquals(0, config.columnCacheSizeBytes()); Assert.assertFalse(config.isFifo()); Properties props = new Properties(); props.setProperty("druid.processing.buffer.sizeBytes", "1"); props.setProperty("druid.processing.buffer.poolCacheMaxCount", "1"); props.setProperty("druid.processing.numThreads", "5"); props.setProperty("druid.processing.columnCache.sizeBytes", "1"); props.setProperty("druid.processing.fifo", "true"); factory = Config.createFactory(props); config = factory.buildWithReplacements(DruidProcessingConfig.class, ImmutableMap.of("base_path", "druid.processing")); Assert.assertEquals(1, config.intermediateComputeSizeBytes()); Assert.assertEquals(1, config.poolCacheMaxCount()); Assert.assertEquals(5, config.getNumThreads()); Assert.assertEquals(1, config.columnCacheSizeBytes()); Assert.assertTrue(config.isFifo()); }
Source:
<code>byte[] load(String id) throws IOException { File file = new File(folder, filename(id)); if (file.exists() && file.canRead()) { <START> BufferedSource source = Okio.buffer(Okio.source(file)); <END> return source.readByteArray(); } return null; }</code><technical_language>close() source</technical_language>

Target:
byte[] load(String id) throws IOException { final File file = toFile(id); if (file.exists() && file.canRead()) { BufferedSource source = Okio.buffer(Okio.source(file)); try { return source.readByteArray(); } finally { closeQuitely(source); } } return null; }
Source:
<code>private V put0(Entry<V> entry) { <START> if (size >= (int)(entries.length * SCALE_LOAD_FACTOR)) <END> resize(true); Entry<V> savedEntry = entry; int startKey = savedEntry.key; for (int i = 0; i < entries.length; i++) { int idx = (index(startKey) + i) & (entries.length - 1); Entry<V> curEntry = entries[idx]; if (curEntry == null) { entries[idx] = savedEntry; size++; return null; } else if (curEntry.key == savedEntry.key) { entries[idx] = savedEntry; return curEntry.val; } int curDist = distance(idx, curEntry.key); int savedDist = distance(idx, savedEntry.key); if (curDist < savedDist) { entries[idx] = savedEntry; savedEntry = curEntry; } } throw new IllegalStateException("Unreachable state exception. Insertion position not found. " + "Entry: " + entry + " map state: " + toString()); }</code><technical_language>store precalculated</technical_language>

Target:
private V put0(Entry<V> entry) { if (size >= scaleThreshold) resize(true); Entry<V> savedEntry = entry; int startKey = savedEntry.key; for (int i = 0; i < entries.length; i++) { int idx = (index(startKey) + i) & (entries.length - 1); Entry<V> curEntry = entries[idx]; if (curEntry == null) { entries[idx] = savedEntry; size++; return null; } else if (curEntry.key == savedEntry.key) { entries[idx] = savedEntry; return curEntry.val; } int curDist = distance(idx, curEntry.key); int savedDist = distance(idx, savedEntry.key); if (curDist < savedDist) { entries[idx] = savedEntry; savedEntry = curEntry; } } throw new IllegalStateException("Unreachable state exception. Insertion position not found. " + "Entry: " + entry + " map state: " + toString()); }
Source:
<code>private void addDnsConfiguration(ReportedConfigurations result) { boolean dnsResolverConfigurationSupported = FeatureSupported.supportedInConfig(ConfigValues.DnsResolverConfigurationSupported, this.cluster.getCompatibilityVersion()); if (!dnsResolverConfigurationSupported) { return; } <START> List<NameServer> nameServersOfNetworkAttachment = getNameServers(networkAttachment.getDnsResolverConfiguration()); List<NameServer> nameServersOfNetwork = getNameServers(network.getDnsResolverConfiguration()); List<NameServer> nameServersOfHost = getNameServers(reportedDnsResolverConfiguration); boolean engineDefineDnsConfiguration = nameServersOfNetworkAttachment != null || nameServersOfNetwork != null; List<NameServer> expectedNameServers = nameServersOfNetworkAttachment != null ? nameServersOfNetworkAttachment : nameServersOfNetwork; result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), engineDefineDnsConfiguration && isDefaultRouteNetwork ? addressesAsString(expectedNameServers): "", !(engineDefineDnsConfiguration && isDefaultRouteNetwork && !Objects.equals(nameServersOfHost, expectedNameServers))); <END> boolean inSync = !isDefaultRouteNetwork || iface.isIpv4DefaultRoute(); result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork ? true : "", inSync); }</code><technical_language>block surrounded 'if (engineDefineDnsConfiguration)'</technical_language>

Target:
private void addDnsConfiguration(ReportedConfigurations result) { List<NameServer> nameServersOfHost = getNameServers(reportedDnsResolverConfiguration); if (isDefaultRouteNetwork) { List<NameServer> expectedNameServers = getExpectedNameServers(); boolean engineDefineDnsConfiguration = expectedNameServers != null; if (engineDefineDnsConfiguration) { result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), addressesAsString(expectedNameServers), Objects.equals(nameServersOfHost, expectedNameServers)); } else { result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), "", true); } } else { result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), "", true); } }
Source:
<code>public JobResultImpl() { allResults = new HashMap<>(); preciousResults = new HashMap<>(); <START> resultMap = new ConcurrentHashMap<>(); <END> }</code><technical_language>need for concurrent</technical_language>

Target:
public JobResultImpl() { allResults = new HashMap<>(); preciousResults = new HashMap<>(); resultMap = new HashMap<>(); }
Source:
<code>public static String resolveNetworkLocation(DNSToSwitchMapping dnsResolver, BookieSocketAddress addr) { List<String> names = new ArrayList<String>(1); InetSocketAddress inetSocketAddress = addr.getSocketAddress(); if (dnsResolver.useHostName()) { names.add(addr.getHostName()); } else { InetAddress inetAddress = inetSocketAddress.getAddress(); if (null == inetAddress) { <START> addr.getHostName(); <END> } else { names.add(inetAddress.getHostAddress()); } } List<String> rNames = dnsResolver.resolve(names); checkNotNull(rNames, "DNS Resolver should not return null response."); checkState(rNames.size() == 1, "Expected exactly one element"); return rNames.get(0); }</code><technical_language>add names</technical_language>

Target:
public static String resolveNetworkLocation(DNSToSwitchMapping dnsResolver, BookieSocketAddress addr) { List<String> names = new ArrayList<String>(1); InetSocketAddress inetSocketAddress = addr.getSocketAddress(); if (dnsResolver.useHostName()) { names.add(addr.getHostName()); } else { InetAddress inetAddress = inetSocketAddress.getAddress(); if (null == inetAddress) { names.add(addr.getHostName()); } else { names.add(inetAddress.getHostAddress()); } } List<String> rNames = dnsResolver.resolve(names); checkNotNull(rNames, "DNS Resolver should not return null response."); checkState(rNames.size() == 1, "Expected exactly one element"); return rNames.get(0); }
Source:
<code>private RoundedImageView createAvatar(final String email) { int sizeInDip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 65, getResources().getDisplayMetrics()); RoundedImageView image = new RoundedImageView(getActivity()); image.setTag(email); image.setCornerRadius(100); image.setBorderWidth(0); image.setPadding(20, 0, 0, 0); image.setLayoutParams(new LinearLayout.LayoutParams(sizeInDip, sizeInDip)); image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MainApplication.emailBeingTracked = email; Intent intentLocation = new Intent("LOCATION-UPDATE"); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentLocation); <START> Intent intentMapTab = new Intent("GO_TO_MAP"); <END> LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentMapTab); } }); return image; }</code><technical_language>Variable name is :]</technical_language>

Target:
private RoundedImageView createAvatar(final String email) { int sizeInDip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 65, getResources().getDisplayMetrics()); RoundedImageView image = new RoundedImageView(getActivity()); image.setTag(email); image.setCornerRadius(100); image.setBorderWidth(0); image.setPadding(20, 0, 0, 0); image.setLayoutParams(new LinearLayout.LayoutParams(sizeInDip, sizeInDip)); image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MainApplication.emailBeingTracked = email; LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(new Intent("LOCATION-UPDATE")); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(new Intent("GO-TO-MAP")); } }); return image; }
Source:
<code>public void close() { closingChannel = true; if (LOG.isDebugEnabled()) { LOG.debug("close called for sessionid:0x{}", Long.toHexString(sessionId)); } factory.unregisterConnection(this); if (!factory.cnxns.remove(this)) { if (LOG.isDebugEnabled()) { LOG.debug("cnxns size:{}", factory.cnxns.size()); } return; } if (LOG.isDebugEnabled()) { LOG.debug("close in progress for sessionid:0x{}", Long.toHexString(sessionId)); } factory.removeCnxnFromIpMap( this, ((InetSocketAddress)channel.remoteAddress()).getAddress()); <START> <END> if (channel.isOpen()) { channel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { future.channel().close().addListener(f -> releaseQueuedBuffer()); } }); } else { channel.eventLoop().execute(this::releaseQueuedBuffer); } }</code><technical_language>master branch calls zkServer.removeCnxn(this); here, NIOServerCnxn.close() 3.5 branch. I need add code here: if (zkServer != null) { zkServer.removeCnxn(this); }</technical_language>

Target:
public void close() { closingChannel = true; if (LOG.isDebugEnabled()) { LOG.debug("close called for sessionid:0x{}", Long.toHexString(sessionId)); } factory.unregisterConnection(this); if (!factory.cnxns.remove(this)) { if (LOG.isDebugEnabled()) { LOG.debug("cnxns size:{}", factory.cnxns.size()); } return; } if (LOG.isDebugEnabled()) { LOG.debug("close in progress for sessionid:0x{}", Long.toHexString(sessionId)); } factory.removeCnxnFromIpMap( this, ((InetSocketAddress)channel.remoteAddress()).getAddress()); if (zkServer != null) { zkServer.removeCnxn(this); } if (channel.isOpen()) { channel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { future.channel().close().addListener(f -> releaseQueuedBuffer()); } }); } else { channel.eventLoop().execute(this::releaseQueuedBuffer); } }
Source:
<code>Map<String, Statistics> getStatistics() { synchronized (statLock) { <START> Map<String, Statistics> out = new HashMap<>(statistics.size() + statLog.size()); <END> out.putAll(statistics); out.putAll(statLog); return out; } }</code><technical_language>This discards sort order. Recommend a TreeMap (in case statistics a HashMap)</technical_language>

Target:
Map<String, Statistics> getStatistics() { synchronized (statLock) { Map<String, Statistics> out = new TreeMap<>(); out.putAll(statistics); out.putAll(statLog); return out; } }
Source:
<code><START> private boolean isExcluded(VariableTree variable) { <END> return isStaticOrFinal(variable) || variable.symbol().metadata().isAnnotatedWith("javax.inject.Inject"); }</code><technical_language>![MAJOR](<LINK_0> "isExcluded" a "static" method. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static boolean isExcluded(VariableTree variable) { return isStaticOrFinal(variable) || variable.symbol().metadata().isAnnotatedWith("javax.inject.Inject"); }
Source:
<code>BiGaussian(MultiKeyMap<Integer, Triplet> horizontalSlice,double mz,int leftBound,int rightBound){ <START> this.horizontalSlice = horizontalSlice; <END> List<SliceSparseMatrix.Triplet> listOfTripletsInSlice = new ArrayList<SliceSparseMatrix.Triplet>(horizontalSlice.values()); listOfIntensities = new ArrayList<Double>(); for(int i=0;i<listOfTripletsInSlice.size();i++){ double intensity = listOfTripletsInSlice.get(i)!=null?listOfTripletsInSlice.get(i).intensity:0; listOfIntensities.add(intensity); } Collections.sort(listOfIntensities); double maxHeight = listOfIntensities.get(listOfIntensities.size()-1); int mu = getScanNumber(maxHeight); int roundedmz = (int) Math.round(mz * 10000); double halfHeight = (double) maxHeight/2; BiGaussianParams.maxHeight = maxHeight; BiGaussianParams.mu = mu; double interpolationLeftSideX = InterpolationX(mu,halfHeight,leftBound,rightBound,roundedmz,Direction.LEFT); BiGaussianParams.sigmaLeft = (mu - interpolationLeftSideX)/Math.sqrt(2*Math.log(2)); double interpolationRightSideX = InterpolationX(mu,halfHeight,leftBound,rightBound,roundedmz,Direction.RIGHT); BiGaussianParams.sigmaRight = ((interpolationRightSideX - mu))/Math.sqrt(2*Math.log(2)); }</code><technical_language>Is horizontalSlice required for state of this object? set BiGaussianParams end of constructor, longer need it. If true, I suggest removing it-less code/state means easier maintain bugs</technical_language>

Target:
BiGaussian(MultiKeyMap<Integer, Triplet> horizontalSlice, double mz, int leftBound, int rightBound) { maxHeight = horizontalSlice.values().stream().map(x -> x != null ? x.intensity : 0.0) .max(Double::compareTo).orElse(0.0); mu = getScanNumber(horizontalSlice, maxHeight); int roundedmz = (int) Math.round(mz * 10000); double halfHeight = (double) maxHeight / 2; double interpolationLeftSideX = InterpolationX(horizontalSlice, mu, halfHeight, leftBound, rightBound, roundedmz, Direction.LEFT); sigmaLeft = (mu - interpolationLeftSideX) / Math.sqrt(2 * Math.log(2)); double interpolationRightSideX = InterpolationX(horizontalSlice, mu, halfHeight, leftBound, rightBound, roundedmz, Direction.RIGHT); sigmaRight = ((interpolationRightSideX - mu)) / Math.sqrt(2 * Math.log(2)); }
Source:
<code>private static void sendGristMessage(MinecraftServer server, PlayerIdentifier player, ITextComponent message) { <START> if (MinestuckConfig.showGristChanges.get()) <END> { if (player != null) { ServerPlayerEntity client = player.getPlayer(server); if (client != null) { client.sendStatusMessage(message, true); } } } }</code><technical_language>Do this config check in functions instead of config options added</technical_language>

Target:
private static void sendGristMessage(MinecraftServer server, PlayerIdentifier player, ITextComponent message) { if(player != null) { ServerPlayerEntity client = player.getPlayer(server); if(client != null) { client.sendStatusMessage(message, true); } } }
Source:
<code>private VdcReturnValueBase runActionImpl(VdcActionType actionType, VdcActionParametersBase parameters, boolean runAsInternal, CommandContext context) { VdcReturnValueBase returnValue = null; returnValue = ExecutionHandler.evaluateCorrelationId(parameters); if (returnValue != null) { log.warnFormat("CanDoAction of action {0} failed. Reasons: {1}", actionType, StringUtils.join(returnValue.getCanDoActionMessages(), ',')); return returnValue; } CommandBase<?> command = CommandsFactory.CreateCommand(actionType, parameters); command.setInternalExecution(runAsInternal); command.setContext(context); ExecutionHandler.prepareCommandForMonitoring(command, actionType, runAsInternal); <START> command.checkCanDoAction(); <END> command.insertAsyncTaskPlaceHolders(); returnValue = command.executeAction(); returnValue.setCorrelationId(parameters.getCorrelationId()); returnValue.setJobId(command.getJobId()); return returnValue; }</code><technical_language>Ravi, call insertAsyncTaskPlaceHolders call canDoAction executeAction? This list of disks populated calling insertAsyncTaskPlaceHolders work</technical_language>

Target:
private VdcReturnValueBase runActionImpl(VdcActionType actionType, VdcActionParametersBase parameters, boolean runAsInternal, CommandContext context) { CommandBase<?> command = CommandsFactory.CreateCommand(actionType, parameters); return runAction(command, runAsInternal, context); }
Source:
<code>public int saveResource(String resourcePath, boolean replace) { if (resourcePath == null || resourcePath.equals("")) { throw new IllegalArgumentException("ResourcePath cannot be null or empty"); } resourcePath = resourcePath.replace('\\', '/'); InputStream in = getResource(resourcePath); if (in == null) { throw new IllegalArgumentException("The embedded resource '" + resourcePath + "' cannot be found in " + file); } File outFile = new File(dataFolder, resourcePath); int lastIndex = resourcePath.lastIndexOf('/'); File outDir = new File(dataFolder, resourcePath.substring(0, lastIndex >= 0 ? lastIndex : 0)); if (!outDir.exists()) { outDir.mkdirs(); } try { if (!outFile.exists() || replace) { OutputStream out = new FileOutputStream(outFile); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.close(); in.close(); return 0; } else { logger.log(Level.WARNING, "Could not save " + outFile.getName() + " to " + outFile + " because " + outFile.getName() + " already exists."); return 1; } } catch (IOException ex) { logger.log(Level.SEVERE, "Could not save " + outFile.getName() + " to " + outFile, ex); return 2; <START> <END> } }</code><technical_language>Random newline here, full of spaces</technical_language>

Target:
public resourceSaveStatus saveResource(String resourcePath, boolean replace) { if (resourcePath == null || resourcePath.equals("")) { throw new IllegalArgumentException("ResourcePath cannot be null or empty"); } resourcePath = resourcePath.replace('\\', '/'); InputStream in = getResource(resourcePath); if (in == null) { throw new IllegalArgumentException("The embedded resource '" + resourcePath + "' cannot be found in " + file); } File outFile = new File(dataFolder, resourcePath); int lastIndex = resourcePath.lastIndexOf('/'); File outDir = new File(dataFolder, resourcePath.substring(0, lastIndex >= 0 ? lastIndex : 0)); if (!outDir.exists()) { outDir.mkdirs(); } try { if (!outFile.exists() || replace) { OutputStream out = new FileOutputStream(outFile); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.close(); in.close(); return resourceSaveStatus.SUCESS; } else { logger.log(Level.WARNING, "Could not save " + outFile.getName() + " to " + outFile + " because " + outFile.getName() + " already exists."); return resourceSaveStatus.EXISTS; } } catch (IOException ex) { logger.log(Level.SEVERE, "Could not save " + outFile.getName() + " to " + outFile, ex); return resourceSaveStatus.FAIL; } }
Source:
<code>ServerNodeKey( Properties connProperties ) { m_connProperties = new Properties( ); for ( String propertyName : connProperties.stringPropertyNames( ) ) { System.out.println( "propertyName :: " + propertyName ); System.out.println( "connProperties.getProperty( propertyName ) :: " + connProperties.getProperty( propertyName ) ); m_connProperties.setProperty( propertyName, connProperties.getProperty( propertyName ) ); <START> if(propertyName.equals( "mongoURI" ) ) <END> { MongoClientURI mongoUri = getMongoURI( connProperties ); if(mongoUri.getUsername()!=null) m_connProperties.setProperty(USERNAME_PROP,mongoUri.getUsername()); } } }</code><technical_language>a constant represent a key</technical_language>

Target:
ServerNodeKey( Properties connProperties ) { m_connProperties = new Properties( ); for ( String propertyName : connProperties.stringPropertyNames( ) ) { System.out.println( "propertyName :: " + propertyName ); System.out.println( "connProperties.getProperty( propertyName ) :: " + connProperties.getProperty( propertyName ) ); m_connProperties.setProperty( propertyName, connProperties.getProperty( propertyName ) ); if ( propertyName.equals( MONGO_URI_PROP ) ) { MongoClientURI mongoUri = getMongoURI( connProperties ); if ( mongoUri.getUsername( ) != null ) { m_connProperties.setProperty( USERNAME_PROP, mongoUri.getUsername( ) ); } } } }
Source:
<code>public Mono<Void> deadLetter(ServiceBusReceivedMessage message, DeadLetterOptions deadLetterOptions) { <START> if (deadLetterOptions != null) { <END> return updateDisposition(message, DispositionStatus.SUSPENDED, deadLetterOptions.getDeadLetterReason(), deadLetterOptions.getDeadLetterErrorDescription(), deadLetterOptions.getPropertiesToModify()); } else { return updateDisposition(message, DispositionStatus.SUSPENDED, null, null, null); } }</code><technical_language>* easier create a static default_dead_letter_options pass arguments in, do this extra logic if is null</technical_language>

Target:
public Mono<Void> deadLetter(ServiceBusReceivedMessage message, DeadLetterOptions deadLetterOptions) { Objects.requireNonNull(deadLetterOptions, "'deadLetterOptions' cannot be null."); return updateDisposition(message, DispositionStatus.SUSPENDED, deadLetterOptions.getDeadLetterReason(), deadLetterOptions.getDeadLetterErrorDescription(), deadLetterOptions.getPropertiesToModify()); }
Source:
<code>public ExpandableRecyclerAdapterHelper(List<Object> itemList) { sCurrentId = INITIAL_STABLE_ID; <START> generateHelperItemList(itemList); <END> }</code><technical_language>@dgreenhalgh setting list return of generateHelperItemList is ok set of method done here</technical_language>

Target:
public ExpandableRecyclerAdapterHelper(List<Object> itemList) { generateHelperItemList(itemList); }
Source:
<code>protected Object execute(Object blobInput, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) throws ClientException { if (contextParams == null) { contextParams = new HashMap<>(); } if (operationParams == null) { operationParams = new HashMap<>(); } OperationContext ctx = new OperationContext(session); AutomationServer server = Framework.getService(AutomationServer.class); RestBinding binding = server.getOperationBinding(chainOrOperationId); if (binding != null && binding.isAdministrator()) { Principal principal = ctx.getPrincipal(); if (!(principal instanceof NuxeoPrincipal && ((NuxeoPrincipal) principal).isAdministrator())) { <START> String message = "Not allowed. You must be administrator to use this operation"; <END> log.error(message); throw new WebSecurityException(message); } } ctx.setInput(blobInput); ctx.putAll(contextParams); try { Object result = null; AutomationService as = Framework.getLocalService(AutomationService.class); result = as.run(ctx, chainOrOperationId, operationParams); return result; } catch (Exception e) { log.error("Error while executing automation batch ", e); throw ClientException.wrap(e); } }</code><technical_language>want log operation / chain id? "this operation" useful in server.log</technical_language>

Target:
protected Object execute(Object blobInput, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) throws ClientException { if (contextParams == null) { contextParams = new HashMap<>(); } if (operationParams == null) { operationParams = new HashMap<>(); } OperationContext ctx = new OperationContext(session); AutomationServer server = Framework.getService(AutomationServer.class); RestBinding binding = server.getOperationBinding(chainOrOperationId); if (binding != null && binding.isAdministrator()) { Principal principal = ctx.getPrincipal(); if (!(principal instanceof NuxeoPrincipal && ((NuxeoPrincipal) principal).isAdministrator())) { String message = "Not allowed. You must be administrator to use this operation"; log.error(message + ": " + chainOrOperationId); throw new WebSecurityException(message); } } ctx.setInput(blobInput); ctx.putAll(contextParams); try { Object result = null; AutomationService as = Framework.getLocalService(AutomationService.class); result = as.run(ctx, chainOrOperationId, operationParams); return result; } catch (Exception e) { log.error("Error while executing automation batch ", e); throw ClientException.wrap(e); } }
Source:
<code>public SAMFileWriter makeWriter(final SAMFileHeader header, final boolean presorted, final File outputFile, final File referenceFasta) { final String filename = outputFile.getName(); if (filename.endsWith(SamReader.Type.CRAM_TYPE.fileExtension())) { if (referenceFasta == null && Defaults.REFERENCE_FASTA == null) { if (Defaults.USE_CRAM_REF_DOWNLOAD) { log.warn("Reference file is not provided, remote sequence service may be used when writing CRAM file: " + outputFile.getAbsolutePath()); } else { log.warn("Neither reference file nor sequence service are provided when writing CRAM file: " + outputFile.getAbsolutePath()); <START> } <END> } return makeCRAMWriter(header, presorted, outputFile, referenceFasta); } if (filename.endsWith(SamReader.Type.SAM_TYPE.fileExtension())) { return makeSAMWriter(header, presorted, outputFile); } if (!filename.endsWith(SamReader.Type.BAM_TYPE.fileExtension())) { log.warn("Unknown file extension, assuming BAM format when writing file: " + outputFile.getAbsolutePath()); } return makeBAMWriter(header, presorted, outputFile); }</code><technical_language>this in makeCRAMWriter method? out of place here</technical_language>

Target:
public SAMFileWriter makeWriter(final SAMFileHeader header, final boolean presorted, final File outputFile, final File referenceFasta) { return makeWriter(header, presorted, IOUtil.toPath( outputFile ), IOUtil.toPath(referenceFasta)); }
Source:
<code>public void setup() { <START> System.setProperty("jenkins.model.Jenkins.SHOW_STACK_TRACE", "false"); <END> System.setProperty("org.kohsuke.stapler.HttpResponses.SHOW_STACK_TRACE", "false"); }</code><technical_language>cleared in a tear @After (possibly static) - incase test run sets true reuse surefire for other tests (which is default I changed in pom - running multiple tests IDE). suggestion System.clearProperty("jenkins.model.Jenkins.SHOW_STACK_TRACE");</technical_language>

Target:
public void setup() { clearProperties(); }
Source:
<code>public static boolean isUserNameValid(final String username, ConstraintValidatorContext context) { String validCharacters = "[a-zA-ZÀ-ÿ0-9\\_\\-\\."; validCharacters += "\\u00C0-\\u017F"; validCharacters += "\\x{4e00}-\\x{9fa5}"; <START> validCharacters += "]*"; <END> Pattern p = Pattern.compile(validCharacters); Matcher m = p.matcher(username); return m.matches(); }</code><technical_language>Change * + end of line 44. If not, empty string is valid current: validCharacters += "]*"; updated: validCharacters += "]+";</technical_language>

Target:
public static boolean isUserNameValid(final String username, ConstraintValidatorContext context) { if (username == null) { return false; } String validCharacters = "[a-zA-Z0-9\\_\\-\\."; validCharacters += "]"; validCharacters += "{2,60}"; Pattern p = Pattern.compile(validCharacters); Matcher m = p.matcher(username); return m.matches(); }
Source:
<code>public Optional<IndexingExpectations<BigDecimal>> getIndexingExpectations() { return Optional.of( new IndexingExpectations<>( BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN, nextUp( BigDecimal.ONE ) , nextDown( BigDecimal.ONE ), BigDecimal.valueOf( 42.42 ), BigDecimal.valueOf( 1584514514.000000184 ), BigDecimal.valueOf( Double.MAX_VALUE ), BigDecimal.valueOf( Double.MAX_VALUE ), scale( Long.MAX_VALUE ), <START> scale( Long.MIN_VALUE ) <END> ) ); }</code><technical_language>test some small values 0 1</technical_language>

Target:
public Optional<IndexingExpectations<BigDecimal>> getIndexingExpectations() { return Optional.of( new IndexingExpectations<>( BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN, nextUp( BigDecimal.ONE ) , nextDown( BigDecimal.ONE ), BigDecimal.valueOf( 42.42 ), BigDecimal.valueOf( 1584514514.000000184 ), scaled( Long.MAX_VALUE ), scaled( Long.MIN_VALUE ), new BigDecimal( "-0.00000000012" ), BigDecimal.valueOf( 0.0000000001 ) ) ); }
Source:
<code>public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); File passFile = null; try { passFile = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : " --admin-pass-file " + passFile.getAbsolutePath()) + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, <START> "Verify Connection to Db, Check if DB service is running", <END> enumValue.name()); } } catch (Throwable e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, "Verify Connection to Db, Check if DB service is running", new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(passFile); } }</code><technical_language>I rephrase - "Please verify following:\n1. database credentials valid.\n2. database machine is accessible.\n3. database service is running"</technical_language>

Target:
public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); File passFile = null; try { passFile = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : " --admin-pass-file " + passFile.getAbsolutePath()) + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, enumValue.name()); } } catch (Throwable e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(passFile); } }
Source:
<code>private String getRandomString() { String randomAppId; byte[] array = new byte[7]; new Random().nextBytes(array); <START> randomAppId = new String(array, Charset.forName("UTF-8")); <END> return randomAppId; }</code><technical_language>I surprised if this call succeeded in cases. sequence of bytes is valid UTF-8. - Besides, arbitrary characters in URLs is a good idea, if parts of Unicode accepted (like Chinese Han characters, for example). solve issues, I prefer a hexadecimal representation</technical_language>

Target:
private String getRandomString() { return UUID.randomUUID().toString(); }
Source:
<code>public void configure(ResourceInfo resourceInfo, FeatureContext context) { Config config = ConfigProvider.getConfig(); Optional<String> skipPattern = config.getOptionalValue("mp.opentracing.server.skip-pattern", String.class); Optional<String> operationNameProvider = config.getOptionalValue("mp.opentracing.server.operation-name-provider", String.class); Tracer tracer; Object tracerObject = servletContext.getAttribute(TracerInitializer.SMALLRYE_OPENTRACING_TRACER); if (tracerObject instanceof Tracer) { tracer = (Tracer) tracerObject; } else { TracingLogger.ROOT_LOGGER.noTracerAvailable(); return; } ServerTracingDynamicFeature.Builder builder = new ServerTracingDynamicFeature.Builder(tracer) .withOperationNameProvider(ClassNameOperationName.newBuilder()) .withTraceSerialization(false); if (skipPattern.isPresent()) { builder.withSkipPattern(skipPattern.get()); } if (operationNameProvider.isPresent()) { if ("http-path".equalsIgnoreCase(operationNameProvider.get())) { builder.withOperationNameProvider(OperationNameProvider.WildcardOperationName.newBuilder()); } else if (!"class-method".equalsIgnoreCase(operationNameProvider.get())) { <START> TracingLogger.ROOT_LOGGER.warn("Provided operation name does not match http-path or class-method. Using default class-method."); <END> } } ServerTracingDynamicFeature delegate = builder.build(); delegate.configure(resourceInfo, context); }</code><technical_language>This needs i18n</technical_language>

Target:
public void configure(ResourceInfo resourceInfo, FeatureContext context) { Config config = ConfigProvider.getConfig(); Optional<String> skipPattern = config.getOptionalValue("mp.opentracing.server.skip-pattern", String.class); Optional<String> operationNameProvider = config.getOptionalValue("mp.opentracing.server.operation-name-provider", String.class); Tracer tracer; Object tracerObject = servletContext.getAttribute(TracerInitializer.SMALLRYE_OPENTRACING_TRACER); if (tracerObject instanceof Tracer) { tracer = (Tracer) tracerObject; } else { TracingLogger.ROOT_LOGGER.noTracerAvailable(); return; } ServerTracingDynamicFeature.Builder builder = new ServerTracingDynamicFeature.Builder(tracer) .withOperationNameProvider(ClassNameOperationName.newBuilder()) .withTraceSerialization(false); if (skipPattern.isPresent()) { builder.withSkipPattern(skipPattern.get()); } if (operationNameProvider.isPresent()) { if ("http-path".equalsIgnoreCase(operationNameProvider.get())) { builder.withOperationNameProvider(OperationNameProvider.WildcardOperationName.newBuilder()); } else if (!"class-method".equalsIgnoreCase(operationNameProvider.get())) { TracingLogger.ROOT_LOGGER.wrongOperationNameProvider(); } } ServerTracingDynamicFeature delegate = builder.build(); delegate.configure(resourceInfo, context); }
Source:
<code>public Response call() { long time = 0; while (time < waitTime) { String queryState = (String) query(format("SELECT state from system.runtime.queries" + " WHERE query = '%s' ORDER BY created DESC LIMIT 1", sqlStatement)).row(0).get(0); if (!queryState.equalsIgnoreCase("running")) { try { <START> Thread.sleep(step); <END> } catch (InterruptedException e) { e.printStackTrace(); return null; } time = time + step; } else { String queryId = (String) query(format("SELECT query_id from system.runtime.queries" + " WHERE query = '%s' ORDER BY created DESC LIMIT 1", sqlStatement)).row(0).get(0); return (new CancelQuery(queryId, serverAddress)).cancel(); } } return null; }</code><technical_language>write logger instead (like in dropTestTables())</technical_language>

Target:
public Response call() { long endTime = System.currentTimeMillis() + WAIT_TIME; while (System.currentTimeMillis() < endTime && !Thread.currentThread().isInterrupted()) { QueryResult queryResult = query(format("SELECT state, query_id from system.runtime.queries" + " WHERE query = '%s' ORDER BY created DESC LIMIT 1", sqlStatement)); if (queryResult.getRowsCount() == 0) { sleepUninterruptibly(STEP, TimeUnit.MILLISECONDS); continue; } String queryState = (String) queryResult.row(0).get(0); String queryId = (String) queryResult.row(0).get(1); if (!queryState.equalsIgnoreCase("running")) { sleepUninterruptibly(STEP, TimeUnit.MILLISECONDS); } else { return queryCanceller.cancel(queryId); } } return null; }
Source:
<code>public CellEditor createPropertyEditor(Composite parent) { CellEditor cellEditor = null; if (object instanceof EObject && getPermissionAuthority().canEditInstance((EObject) object)) { cellEditor = <START> super.createPropertyEditor(parent); <END> } return cellEditor; }</code><technical_language>call super.createPropertyEditor(parent); if object is a EObject? I this is a bug</technical_language>

Target:
public CellEditor createPropertyEditor(Composite parent) { CellEditor cellEditor = null; if (!(object instanceof EObject) || getPermissionAuthority() != null && getPermissionAuthority().canEditInstance((EObject) object)) { cellEditor = super.createPropertyEditor(parent); } return cellEditor; }
Source:
<code>public GpsNetInitiatedHandler(Context context, INetInitiatedListener netInitiatedListener, boolean isSuplEsEnabled) { mContext = context; if (netInitiatedListener == null) { throw new IllegalArgumentException("netInitiatedListener is null"); } else { mNetInitiatedListener = netInitiatedListener; } mIsSuplEsEnabled = isSuplEsEnabled; mLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); mTelephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); mPhoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { if (DEBUG) Log.d(TAG, "onCallStateChanged(): <START> "+"state <END> is "+ state); if (state == TelephonyManager.CALL_STATE_IDLE) { mIsInEmergency = false; } } }; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL); mContext.registerReceiver(mBroadcastReciever, intentFilter, null, mHandler); }</code><technical_language>this is needed</technical_language>

Target:
public GpsNetInitiatedHandler(Context context, INetInitiatedListener netInitiatedListener, boolean isSuplEsEnabled) { mContext = context; if (netInitiatedListener == null) { throw new IllegalArgumentException("netInitiatedListener is null"); } else { mNetInitiatedListener = netInitiatedListener; } mIsSuplEsEnabled = isSuplEsEnabled; mLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); mTelephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); mPhoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { if (DEBUG) Log.d(TAG, "onCallStateChanged(): state is "+ state); if (state == TelephonyManager.CALL_STATE_IDLE) { mIsInEmergency = false; } } }; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL); mContext.registerReceiver(mBroadcastReciever, intentFilter, null, mHandler); }
Source:
<code>public ColumnVector() { <START> this.isNull = new boolean[DEFAULT_VECTOR_LENGTH]; <END> }</code><technical_language>DEFAULT if change</technical_language>

Target:
public ColumnVector() { this.isNull = new boolean[MAX_VECTOR_LENGTH]; }
Source:
<code>public void setGroundAndAirSpeeds(double groundSpeed, double airSpeed, double climb) { this.groundSpeed = new org.droidplanner.core.helpers.units.Speed(groundSpeed); this.airSpeed = new org.droidplanner.core.helpers.units.Speed(airSpeed); this.verticalSpeed = new org.droidplanner.core.helpers.units.Speed(climb); double altitude = myDrone.getAltitude().getAltitude(); <START> if(altitude + climb* COLLISION_SECONDS_BEFORE_COLLISION < 0 && climb < COLLISION_DANGEROUS_SPEED && altitude > COLLISION_SAFE_ALTITUDE){ <END> myDrone.getState().setCollisionImminent(true); }else{ myDrone.getState().setCollisionImminent(false); } }</code><technical_language>@TShapinsky computation determine collision in method, updated affecting rest of code if needed</technical_language>

Target:
public void setGroundAndAirSpeeds(double groundSpeed, double airSpeed, double climb) { this.groundSpeed = new org.droidplanner.core.helpers.units.Speed(groundSpeed); this.airSpeed = new org.droidplanner.core.helpers.units.Speed(airSpeed); this.verticalSpeed = new org.droidplanner.core.helpers.units.Speed(climb); checkCollisionIsImminent(); }
Source:
<code>private void processFallbackWindow( List<RowMetaAndData> list ) { if ( isProcessing.compareAndSet( false, true ) ) { if ( this.subject != null ) { this.subject.dispose(); this.subject = this.buffer.subscribe( bufferList -> processBufferWindow( bufferList ) ); } <START> hasWindow.compareAndSet( false, true ); <END> unSubscribeStarter(); setCacheWindow( list ); isProcessing.compareAndSet( true, false ); } }</code><technical_language>set compare</technical_language>

Target:
private void processFallbackWindow( List<RowMetaAndData> list ) { if ( isProcessing.compareAndSet( false, true ) ) { if ( this.subject != null ) { this.subject.dispose(); this.subject = this.buffer.subscribe( bufferList -> processBufferWindow( bufferList ) ); } hasWindow.set( true ); unSubscribeStarter(); setCacheWindow( list ); isProcessing.set( false ); } }
Source:
<code>BitMappedTrie<T> drop(int n) { if (n <= 0) { return this; } else if (n >= length()) { return empty(); } else { final int index = offset + n; final Object[] root = arePointingToSameLeaf(0, n) ? array : modifyLeaf(array, depthShift, index, Arrays::copyDrop, Identity); <START> return new BitMappedTrie<T>(root, index, length() - n, depthShift).collapseHeight(); <END> } }</code><technical_language>collapseHeight() is called constructing BMT - is a smell :) save BMT instance (in worst case) changing collapseHeight() a static factory method: java /* drop root node while a single element */ private static BitMappedTrie<T> collapseHeight(Object[] array, int offset, int length, int shift) { for (; shift > 0; shift -= BRANCHING_BASE) { final int skippedElements = array.length - 1; if (skippedElements != digit(offset, shift)) { break; } array = getAt(array, skippedElements); offset -= treeSize(skippedElements, shift); } return new BitMappedTrie<>(array, offset, length, shift); } replace java return new BitMappedTrie<T>(root, index, length() - n, depthShift).collapseHeight(); java return collapseHeight(root, index, length() - n, depthShift); rename collapseHeight(...) of(...)? necessarily</technical_language>

Target:
BitMappedTrie<T> drop(int n) { if (n <= 0) { return this; } else if (n >= length()) { return empty(); } else { final int index = offset + n; final Object[] root = arePointingToSameLeaf(0, n) ? array : modifyLeaf(array, depthShift, index, Arrays::copyDrop, IDENTITY); return collapsed(root, index, length() - n, depthShift); } }
Source:
<code>public WebSocketSession getSession(String sessionId) { if (isRunning()) { if (!isConnected()) { stop(); start(); } try { this.connectionLatch.await(this.connectionTimeout, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.error("'clientSession' has not been established during 'openConnection'"); } } try { if (this.openConnectionException != null) { throw new IllegalStateException(this.openConnectionException); } Assert.state(this.clientSession != null, "'clientSession' has not been established. Consider to 'start' this container."); } <START> catch (IllegalStateException e){ <END> stop(); throw e; } return this.clientSession; }</code><technical_language>space {</technical_language>

Target:
public WebSocketSession getSession(String sessionId) { if (isRunning()) { if (!isConnected() && !this.connecting) { stop(); start(); } try { this.connectionLatch.await(this.connectionTimeout, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.error("'clientSession' has not been established during 'openConnection'"); } this.connecting = false; } try { if (this.openConnectionException != null) { throw new IllegalStateException(this.openConnectionException); } Assert.state(this.clientSession != null, "'clientSession' has not been established. Consider to 'start' this container."); } catch (IllegalStateException e) { stop(); throw e; } return this.clientSession; }
Source:
<code>private void updatePointer(final ILogData data) { <START> if ((data.getType() == DataType.DATA || data.getType() == DataType.HOLE) <END> && !data.hasCheckpointMetadata()) { getCurrentContext().setGlobalPointer(data.getGlobalAddress()); } }</code><technical_language>this a bit cleaner calling data.isData() data.isHole()</technical_language>

Target:
private void updatePointer(final ILogData data) { if ((data.isData() || data.isHole()) && !data.hasCheckpointMetadata()) { getCurrentContext().setGlobalPointer(data.getGlobalAddress()); } }