auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private HiveDruidSplit[] getInputSplits(Configuration conf) throws IOException { String address = conf.get(Constants.DRUID_ADDRESS); if (StringUtils.isEmpty(address)) { address = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_DRUID_DEFAULT_ADDRESS); if (StringUtils.isEmpty(address)) { throw new IOException("Druid address not specified; use " + Constants.DRUID_ADDRESS + " in table properties or specify a default address" + " in your configuration files"); } } String druidQuery = StringEscapeUtils.unescapeJava(conf.get(Constants.DRUID_QUERY_JSON)); String druidQueryType; if (StringUtils.isEmpty(druidQuery)) { if (LOG.isWarnEnabled()) { LOG.warn("Druid query is empty; creating Select query"); } String dataSource = conf.get(Constants.DRUID_DATA_SOURCE); if (dataSource == null) { throw new IOException("Druid data source cannot be empty"); } druidQuery = createSelectStarQuery(address, dataSource); druidQueryType = Query.SELECT; } else { druidQueryType = conf.get(Constants.DRUID_QUERY_TYPE); if (druidQueryType == null) { throw new IOException("Druid query type not recognized"); } } Job job = new Job(conf); JobContext jobContext = ShimLoader.getHadoopShims().newJobContext(job); <START> Path paths = FileInputFormat.getInputPaths(jobContext); <END> switch (druidQueryType) { case Query.TIMESERIES: case Query.TOPN: case Query.GROUP_BY: return new HiveDruidSplit[] { new HiveDruidSplit(address, druidQuery, paths[0]) }; case Query.SELECT: return splitSelectQuery(conf, address, druidQuery, paths[0]); default: throw new IOException("Druid query type not recognized"); } }</code><technical_language>This connect FS, a slow operation. this a dummy path</technical_language>

Target:
private HiveDruidSplit[] getInputSplits(Configuration conf) throws IOException { String address = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_DRUID_BROKER_DEFAULT_ADDRESS); if (StringUtils.isEmpty(address)) { throw new IOException("Druid broker address not specified in configuration"); } String druidQuery = StringEscapeUtils.unescapeJava(conf.get(Constants.DRUID_QUERY_JSON)); String druidQueryType; if (StringUtils.isEmpty(druidQuery)) { if (LOG.isWarnEnabled()) { LOG.warn("Druid query is empty; creating Select query"); } String dataSource = conf.get(Constants.DRUID_DATA_SOURCE); if (dataSource == null) { throw new IOException("Druid data source cannot be empty"); } druidQuery = createSelectStarQuery(address, dataSource); druidQueryType = Query.SELECT; } else { druidQueryType = conf.get(Constants.DRUID_QUERY_TYPE); if (druidQueryType == null) { throw new IOException("Druid query type not recognized"); } } Job job = new Job(conf); JobContext jobContext = ShimLoader.getHadoopShims().newJobContext(job); Path paths = FileInputFormat.getInputPaths(jobContext); switch (druidQueryType) { case Query.TIMESERIES: case Query.TOPN: case Query.GROUP_BY: return new HiveDruidSplit[] { new HiveDruidSplit(address, druidQuery, paths[0]) }; case Query.SELECT: return splitSelectQuery(conf, address, druidQuery, paths[0]); default: throw new IOException("Druid query type not recognized"); } }
Source:
<code>public Map<String, String> getLanguages(@QueryParam("token") String authToken, @Context ServletContext servletContext) throws GuacamoleException { Set<String> resourcePaths = servletContext.getResourcePaths(TRANSLATION_PATHS); if (resourcePaths == null) return Collections.EMPTY_MAP; Map<String, String> languageMap = new HashMap<String, String>(); <START> for(String resourcePath : resourcePaths) { <END> InputStream languageFileStream = servletContext.getResourceAsStream(resourcePath); if (languageFileStream == null) { logger.warn("Unable to read language resource \"{}\"", resourcePath); continue; } try { String languageKey; Matcher languageKeyMatcher = LANGUAGE_KEY_PATTERN.matcher(resourcePath); if (!languageKeyMatcher.matches() || (languageKey = languageKeyMatcher.group(1)) == null) { logger.warn("Invalid language file name: \"{}\"", resourcePath); continue; } JsonNode tree = mapper.readTree(languageFileStream); JsonNode nameNode = tree.get(LANGUAGE_DISPLAY_NAME_KEY); String languageName; if (nameNode == null || (languageName = nameNode.getTextValue()) == null) { logger.warn("Root-level \"" + LANGUAGE_DISPLAY_NAME_KEY + "\" string missing or invalid in language file \"{}\"", resourcePath); languageName = languageKey; } languageMap.put(languageKey, languageName); } catch (IOException e) { logger.warn("Unable to read language resource \"{}\": {}", resourcePath, e.getMessage()); logger.debug("Error while reading language resource.", e); } } return languageMap; }</code><technical_language>Space for please</technical_language>

Target:
public Map<String, String> getLanguages(@QueryParam("token") String authToken, @Context ServletContext servletContext) throws GuacamoleException { Set<String> resourcePaths = servletContext.getResourcePaths(TRANSLATION_PATH); if (resourcePaths == null) return Collections.EMPTY_MAP; Map<String, String> languageMap = new HashMap<String, String>(); for (String resourcePath : resourcePaths) { InputStream languageFileStream = servletContext.getResourceAsStream(resourcePath); if (languageFileStream == null) { logger.warn("Unable to read language resource \"{}\"", resourcePath); continue; } try { String languageKey; Matcher languageKeyMatcher = LANGUAGE_KEY_PATTERN.matcher(resourcePath); if (!languageKeyMatcher.matches() || (languageKey = languageKeyMatcher.group(1)) == null) { logger.warn("Invalid language file name: \"{}\"", resourcePath); continue; } JsonNode tree = mapper.readTree(languageFileStream); JsonNode nameNode = tree.get(LANGUAGE_DISPLAY_NAME_KEY); String languageName; if (nameNode == null || (languageName = nameNode.getTextValue()) == null) { logger.warn("Root-level \"" + LANGUAGE_DISPLAY_NAME_KEY + "\" string missing or invalid in language file \"{}\"", resourcePath); languageName = languageKey; } languageMap.put(languageKey, languageName); } catch (IOException e) { logger.warn("Unable to read language resource \"{}\": {}", resourcePath, e.getMessage()); logger.debug("Error while reading language resource.", e); } } return languageMap; }
Source:
<code>public List<String> getExecuteBeforeIDs() { <START> Rules ann = this.getClass().getAnnotation(Rules.class); <END> if(ann != null) return Arrays.asList(ann.beforeIDs()); else return Collections.emptyList(); }</code><technical_language>Rename "ann" "rules", "rulesAnnotation" more descriptive</technical_language>

Target:
public List<String> getExecuteBeforeIDs() { Rules rulesAnnotation = this.getClass().getAnnotation(Rules.class); if(rulesAnnotation != null) return Arrays.asList(rulesAnnotation.beforeIDs()); else return Collections.emptyList(); }
Source:
<code><START> public JobExecutionListener loggingListener() { <END> return new LoggingListener(); }</code><technical_language>concrete classes return types. need downcast for picked in collection injections concrete classes lets recognized easier for conditionals</technical_language>

Target:
public LoggingListener loggingListener() { return new LoggingListener(); }
Source:
<code>public final XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(IQ_ELEMENT); addCommonAttributes(buf); <START> addCustomAttributes(buf); <END> if (type == null) { buf.attribute("type", "get"); } else { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); buf.append(getChildElementXML()); buf.closeElement(IQ_ELEMENT); return buf; }</code><technical_language>I merge addCommonattributes addCustomAttributes, add code in addCustomAttributes existing method rename addAttributes</technical_language>

Target:
public final XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(IQ_ELEMENT); addAttributes(buf); if (type == null) { buf.attribute("type", "get"); } else { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); buf.append(getChildElementXML()); buf.closeElement(IQ_ELEMENT); return buf; }
Source:
<code>void performSubmit(Action action, boolean dismissFailed) { if (pausedTags.contains(action.getTag())) { pausedActions.put(action.getTarget(), action); if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_PAUSED, action.request.logId(), "because tag '" + action.getTag() + "' is paused"); } return; } BitmapHunter hunter = hunterMap.get(action.request.key); if (hunter != null) { hunter.attach(action); return; } if (service.isShutdown()) { if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_IGNORED, action.request.logId(), "because shut down"); } return; } <START> hunter = BitmapHunter.Companion.forRequest(action.picasso, this, cache, action); <END> hunter.setFuture(service.submit(hunter)); hunterMap.put(action.request.key, hunter); if (dismissFailed) { failedActions.remove(action.getTarget()); } if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_ENQUEUED, action.request.logId()); } }</code><technical_language>nit: import revert this line</technical_language>

Target:
void performSubmit(Action action, boolean dismissFailed) { if (pausedTags.contains(action.getTag())) { pausedActions.put(action.getTarget(), action); if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_PAUSED, action.request.logId(), "because tag '" + action.getTag() + "' is paused"); } return; } BitmapHunter hunter = hunterMap.get(action.request.key); if (hunter != null) { hunter.attach(action); return; } if (service.isShutdown()) { if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_IGNORED, action.request.logId(), "because shut down"); } return; } hunter = forRequest(action.picasso, this, cache, action); hunter.future = service.submit(hunter); hunterMap.put(action.request.key, hunter); if (dismissFailed) { failedActions.remove(action.getTarget()); } if (action.picasso.loggingEnabled) { log(OWNER_DISPATCHER, VERB_ENQUEUED, action.request.logId()); } }
Source:
<code>private static BlockInStream createGrpcBlockInStream(FileSystemContext context, WorkerNetAddress address, BlockInStreamSource blockSource, ReadRequest readRequestPartial, long blockSize, InStreamOptions options) { ReadRequest.Builder readRequestBuilder = readRequestPartial.toBuilder(); long chunkSize = context.getClusterConf().getBytes( PropertyKey.USER_STREAMING_READER_CHUNK_SIZE_BYTES); readRequestBuilder.setChunkSize(chunkSize); DataReader.Factory factory; if (context.getClusterConf().getBoolean(PropertyKey.FUSE_SHARED_CACHING_READER_ENABLED) <START> && (blockSize > (chunkSize * 4))) { <END> factory = new SharedGrpcDataReader .Factory(context, address, readRequestBuilder.build(), blockSize); } else { factory = new GrpcDataReader.Factory(context, address, readRequestBuilder.build()); } return new BlockInStream(context, factory, address, blockSource, readRequestPartial.getBlockId(), blockSize); }</code><technical_language>Is this ((blockSize > (chunkSize * 4)) some heuristic? is thinking this</technical_language>

Target:
private static BlockInStream createGrpcBlockInStream(FileSystemContext context, WorkerNetAddress address, BlockInStreamSource blockSource, ReadRequest readRequestPartial, long blockSize, InStreamOptions options) { ReadRequest.Builder readRequestBuilder = readRequestPartial.toBuilder(); long chunkSize = context.getClusterConf().getBytes( PropertyKey.USER_STREAMING_READER_CHUNK_SIZE_BYTES); readRequestBuilder.setChunkSize(chunkSize); DataReader.Factory factory; if (context.getClusterConf().getBoolean(PropertyKey.FUSE_SHARED_CACHING_READER_ENABLED) && blockSize > chunkSize * 4) { factory = new SharedGrpcDataReader .Factory(context, address, readRequestBuilder.build(), blockSize); } else { factory = new GrpcDataReader.Factory(context, address, readRequestBuilder.build()); } return new BlockInStream(factory, address, blockSource, readRequestPartial.getBlockId(), blockSize); }
Source:
<code>public void should_fail_if_peer_does_not_support_v3() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage( "reports Cassandra version 2.0.9, but the driver only supports 2.1.0 and above"); try (BoundCluster simulacron = mixedVersions("3.0.0", "2.0.9", "3.11"); BoundNode contactPoint = simulacron.node(0); Cluster ignored = Cluster.builder() .addContactPoint(contactPoint.inetSocketAddress()) .withConfigLoader(new TestConfigLoader()) .build()) { <START> fail("Cluster init should have failed"); <END> } }</code><technical_language>Nice! simulacron cluster builders kinda ugly work with, nice simplify this a method</technical_language>

Target:
public void should_fail_if_peer_does_not_support_v3() { thrown.expect(UnsupportedProtocolVersionException.class); thrown.expectMessage( "reports Cassandra version 2.0.9, but the driver only supports 2.1.0 and above"); try (BoundCluster simulacron = mixedVersions("3.0.0", "2.0.9", "3.11"); BoundNode contactPoint = simulacron.node(0); Cluster ignored = Cluster.builder() .addContactPoint(contactPoint.inetSocketAddress()) .withConfigLoader(new TestConfigLoader()) .build()) { fail("Cluster init should have failed"); } }
Source:
<code>private void createTable(int style) { fTable = new Table(this, style | SWT.NO_SCROLL); fTable.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { handleTableSelection(event); } }); <START> <END> fTable.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent event) { handleTableKeyEvent(event); } @Override public void keyReleased(KeyEvent event) { } }); fTable.addListener( SWT.MouseDoubleClick, new Listener() { @Override public void handleEvent(Event event) { if (doubleClickListener != null) { TableItem item = fTable.getItem (new Point (event.x, event.y)); if (item != null) { for(int i=0;i<fTable.getColumnCount();i++){ Rectangle bounds = item.getBounds(i); if (bounds.contains(event.x,event.y)){ doubleClickListener.handleDoubleClick(TmfVirtualTable.this, item, i); break; } } } } } } ); fTable.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { if (fTable.getTopIndex() != 0 || fResetTopIndex) { fTable.setTopIndex(0); } fResetTopIndex = false; } }); }</code><technical_language>Add fTable.addMouseListener(new MouseListener() { @Override public void mouseUp(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseDown(MouseEvent e) { fLastMouseEvent = e; } @Override public void mouseDoubleClick(MouseEvent e) { // TODO Auto-generated method stub } });</technical_language>

Target:
private void createTable(int style) { fTable = new Table(this, style | SWT.NO_SCROLL); fTable.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { handleTableMouseEvent(e); } }); fTable.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { handleTableKeyEvent(event); } }); fTable.addListener( SWT.MouseDoubleClick, new Listener() { @Override public void handleEvent(Event event) { if (doubleClickListener != null) { TableItem item = fTable.getItem (new Point (event.x, event.y)); if (item != null) { for(int i=0;i<fTable.getColumnCount();i++){ Rectangle bounds = item.getBounds(i); if (bounds.contains(event.x,event.y)){ doubleClickListener.handleDoubleClick(TmfVirtualTable.this, item, i); break; } } } } } } ); fTable.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { if (fTable.getTopIndex() != 0 || fResetTopIndex) { fTable.setTopIndex(0); } fResetTopIndex = false; } }); }
Source:
<code>public void multipleAssembliesUniqueNames() { AssemblyConfiguration assemblyConfigurationOne = new AssemblyConfiguration.Builder().name("foo").build(); AssemblyConfiguration assemblyConfigurationTwo = new AssemblyConfiguration.Builder().name("foo").build(); BuildImageConfiguration config = new BuildImageConfiguration.Builder(). assemblies(Arrays.asList(assemblyConfigurationOne, assemblyConfigurationTwo)).build(); try { config.initAndValidate(logger); } catch (IllegalArgumentException expected) { return; } <START> fail("Should have failed."); <END> }</code><technical_language>expected attribute of @Test annotation declare IllegalArgumentException thrown in annotated test method this: @Test(expected = IllegalArgumentException.class)</technical_language>

Target:
public void multipleAssembliesUniqueNames() { AssemblyConfiguration assemblyConfigurationOne = new AssemblyConfiguration.Builder().name("foo").build(); AssemblyConfiguration assemblyConfigurationTwo = new AssemblyConfiguration.Builder().name("foo").build(); BuildImageConfiguration config = new BuildImageConfiguration.Builder(). assemblies(Arrays.asList(assemblyConfigurationOne, assemblyConfigurationTwo)).build(); config.initAndValidate(logger); }
Source:
<code>public AdColonyBannerRenderer(MediationBannerAdConfiguration adConfiguration) { requestedZone = adConfiguration.getServerParameters().getString(AdColonyAdapterUtils.KEY_ZONE_ID); <START> this.adSize = AdColonyAdapterUtils.adColonyAdSizeFromAdMobAdSize( <END> adConfiguration.getContext(), adConfiguration.getAdSize()); }</code><technical_language>RTB support, adaptive banner. Requested size match rendered adSize. So, this is required here. Instead publisher requested AdSize</technical_language>

Target:
public AdColonyBannerRenderer(MediationBannerAdConfiguration adConfiguration) { requestedZone = adConfiguration.getServerParameters().getString(AdColonyAdapterUtils.KEY_ZONE_ID); this.adSize = new AdColonyAdSize(convertPixelsToDp( adConfiguration.getAdSize().getWidthInPixels(adConfiguration.getContext())), convertPixelsToDp( adConfiguration.getAdSize().getHeightInPixels(adConfiguration.getContext()))); }
Source:
<code><START> public static void checkPreJoinableClausesForDuplicatesAndShadowing( <END> final List<PreJoinableClause> preJoinableClauses ) { List<String> prefixes = new ArrayList<>(); for (PreJoinableClause clause : preJoinableClauses) { prefixes.add(clause.getPrefix()); } checkPrefixesForDuplicatesAndShadowing(prefixes); }</code><technical_language>suggestion private static void checkPreJoinableClausesForDuplicatesAndShadowing(</technical_language>

Target:
private static void checkPreJoinableClausesForDuplicatesAndShadowing( final List<PreJoinableClause> preJoinableClauses ) { List<String> prefixes = new ArrayList<>(); for (PreJoinableClause clause : preJoinableClauses) { prefixes.add(clause.getPrefix()); } checkPrefixesForDuplicatesAndShadowing(prefixes); }
Source:
<code><START> public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception { <END> Boolean found = false; AssertionError ex = null; command = "set -o pipefail && alias grep='grep --color=never' && " + command; for (int i = 0; (i <= timeout); i += wait) { if (found) { break; } commonspec.getLogger().debug("Checking output value"); commonspec.getRemoteSSHConnection().runCommand(command); commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult()); try { if (exitStatus != null) { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus); } assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search); found = true; timeout = i; } catch (AssertionError e) { commonspec.getLogger().info("Command output don't found yet after " + i + " seconds"); Thread.sleep(wait * 1000); ex = e; } } if (!found) { throw (ex); } commonspec.getLogger().info("Command output found after " + timeout + " seconds"); }</code><technical_language>String foo do</technical_language>

Target:
public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception { Boolean found = false; AssertionError ex = null; command = "set -o pipefail && alias grep='grep --color=never' && " + command; for (int i = 0; (i <= timeout); i += wait) { if (found) { break; } commonspec.getLogger().debug("Checking output value"); commonspec.getRemoteSSHConnection().runCommand(command); commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult()); try { if (exitStatus != null) { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus); } else { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(0); } assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search); found = true; timeout = i; } catch (AssertionError e) { commonspec.getLogger().info("Command output don't found yet after " + i + " seconds"); Thread.sleep(wait * 1000); ex = e; } } if (!found) { throw (ex); } commonspec.getLogger().info("Command output found after " + timeout + " seconds"); }
Source:
<code>private static NotificationChannel createChannelAutoDownload(Context c) { NotificationChannel mChannel = new NotificationChannel( CHANNEL_ID_AUTO_DOWNLOAD, c.getString(R.string.notification_channel_auto_download), NotificationManager.IMPORTANCE_DEFAULT); <START> mChannel.setDescription(c.getString(R.string.notification_channel_downloading_description)); <END> return mChannel; }</code><technical_language>I description string is wrong. new for auto download please formatting rest of file, more even</technical_language>

Target:
private static NotificationChannel createChannelAutoDownload(Context c) { NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_AUTO_DOWNLOAD, c.getString(R.string.notification_channel_auto_download), NotificationManager.IMPORTANCE_DEFAULT); mChannel.setDescription(c.getString(R.string.notification_channel_episode_auto_download)); return mChannel; }
Source:
<code>public void initialize() throws IllegalStateException { initChildEntries(rootFile); serializer.store(rootFile.getName(), rootFile); <START> if (LOGGER.isDebugEnabled()) { <END> timer = new Timer(); timer.scheduleAtFixedRate(new LogProcessing(), LOGGING_TIME_DELAY, LOGGING_TIME_INTERVAL); } }</code><technical_language>realize startup timer thread if, init time, debug is enabled</technical_language>

Target:
public void initialize() throws IllegalStateException { initChildEntries(rootFile); serializer.store(rootFile.getName(), rootFile); }
Source:
<code><START> public ComparableComparator getInstance(){ <END> return INSTANCE; }</code><technical_language>a [<LINK_0>](here). This class deprecated longer updated, all</technical_language>

Target:
public static ComparableComparator getInstance(){ return INSTANCE; }
Source:
<code>private String mapInternalRestUri(final String httpUri) { if (httpUri.startsWith("info:/rest")) { String realpath = httpUri.substring(10); <START> if (realpath.startsWith("/")) { <END> realpath = realpath.substring(1); } final String fullUri = uriBuilder.build(realpath).toString(); return getPath(fullUri); } return null; }</code><technical_language>Is multiple / characters? If so, "while (realpath.startsWith("/"))"</technical_language>

Target:
private String mapInternalRestUri(final String httpUri) { final String internalRestString = internalIdPrefix() + "/rest"; if (httpUri.startsWith(internalRestString)) { String realpath = httpUri.substring(internalRestString.length()); if (realpath.startsWith("/")) { realpath = realpath.substring(1); } final String fullUri = uriBuilder.build(realpath).toString(); return getPath(fullUri); } return null; }
Source:
<code><START> public DataNodeRemoteReplicaInfos(String datacenter, RemoteReplicaInfo remoteReplicaInfo) { <END> this.datacenter = datacenter; this.dataNodeToReplicaLists = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); this.dataNodeToReplicaLists.put(remoteReplicaInfo.getReplicaId().getDataNodeId(), Arrays.asList(remoteReplicaInfo)); }</code><technical_language>This constructor is a weird right? a addRemoteReplica() - do need send remoteReplicaInfo here</technical_language>

Target:
public DataNodeRemoteReplicaInfos(String datacenter, RemoteReplicaInfo remoteReplicaInfo) { this.datacenter = datacenter; this.dataNodeToReplicaLists = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); this.dataNodeToReplicaLists.put(remoteReplicaInfo.getReplicaId().getDataNodeId(), new ArrayList<RemoteReplicaInfo>(Arrays.asList(remoteReplicaInfo))); }
Source:
<code>private Callable<Void> processRecoveredBufferTask(RecoveredInputChannel inputChannel, int totalStates, int[] states, boolean verifyRelease) { return () -> { int numProcessedStates = 0; while (numProcessedStates < totalStates) { if (verifyRelease && inputChannel.isReleased()) { break; } if (inputChannel.getNumberOfQueuedBuffers() == 0) { Thread.sleep(1); continue; } try { Optional<BufferAndAvailability> bufferAndAvailability = inputChannel.getNextBuffer(); if (bufferAndAvailability.isPresent()) { Buffer buffer = bufferAndAvailability.get().buffer(); BufferBuilderAndConsumerTest.assertContent(buffer, null, states); buffer.recycleBuffer(); numProcessedStates++; } } catch (Throwable t) { <START> assertTrue("The expected exception should only happen in the case of released channel.", verifyRelease && inputChannel.isReleased()); <END> } } return null; }; }</code><technical_language>hide original exception in case of failure (to speed understanding test is failing). throw original exception, embed failure message (as cause) etc</technical_language>

Target:
private Callable<Void> processRecoveredBufferTask(RecoveredInputChannel inputChannel, int totalStates, int[] states, boolean verifyRelease) { return () -> { int numProcessedStates = 0; while (numProcessedStates < totalStates) { if (verifyRelease && inputChannel.isReleased()) { break; } if (inputChannel.getNumberOfQueuedBuffers() == 0) { Thread.sleep(1); continue; } try { Optional<BufferAndAvailability> bufferAndAvailability = inputChannel.getNextBuffer(); if (bufferAndAvailability.isPresent()) { Buffer buffer = bufferAndAvailability.get().buffer(); BufferBuilderAndConsumerTest.assertContent(buffer, null, states); buffer.recycleBuffer(); numProcessedStates++; } } catch (Throwable t) { if (!(verifyRelease && inputChannel.isReleased())) { throw new AssertionError("Exceptions are expected here only if the input channel was released", t); } } } return null; }; }
Source:
<code>boolean matchesTableAlias(String tableAlias) { <START> return m_tableAlias == null || m_tableAlias.equals(tableAlias); <END> }</code><technical_language>This a significant change in behavior for a TVE anonymized. This problems</technical_language>

Target:
boolean matchesTableAlias(String tableAlias) { if (m_tableAlias == null) { return m_tableName.equals(tableAlias); } else { return m_tableAlias.equals(tableAlias); } }
Source:
<code>public boolean affectsSpawning() { <START> return this.affectsSpawning; <END> }</code><technical_language>This needs check player's capabilities include of spectator mode (tile entities tick I recall)</technical_language>

Target:
public boolean affectsSpawning() { return this.affectsSpawning && !this.isSpectator(); }
Source:
<code>private void image(@NonNull FeaturedImage image) { if (containerView.getWidth() == 0) { <START> containerView.getViewTreeObserver().addOnGlobalLayoutListener(() -> loadImage(image)); <END> } else { loadImage(image); } }</code><technical_language>do a post() here, track of imageHasLoaded</technical_language>

Target:
private void image(@NonNull FeaturedImage image) { containerView.post(() -> loadImage(image)); }
Source:
<code>private void findContentRenames(ContentSource.Pair reader, ProgressMonitor pm) throws IOException { int cnt = Math.max(added.size(), deleted.size()); if (getRenameLimit() == 0 || cnt <= getRenameLimit()) { SimilarityRenameDetector d; d = new SimilarityRenameDetector(reader, deleted, added); d.setRenameScore(getRenameScore()); <START> d.compute(pm); <END> overRenameLimit |= d.isTableOverflow(); deleted = d.getLeftOverSources(); added = d.getLeftOverDestinations(); entries.addAll(d.getMatches()); } else { overRenameLimit = true; } }</code><technical_language>This throws _other_ CancelledException</technical_language>

Target:
private void findContentRenames(ContentSource.Pair reader, ProgressMonitor pm) throws IOException, CanceledException { int cnt = Math.max(added.size(), deleted.size()); if (getRenameLimit() == 0 || cnt <= getRenameLimit()) { SimilarityRenameDetector d; d = new SimilarityRenameDetector(reader, deleted, added); d.setRenameScore(getRenameScore()); d.compute(pm); overRenameLimit |= d.isTableOverflow(); deleted = d.getLeftOverSources(); added = d.getLeftOverDestinations(); entries.addAll(d.getMatches()); } else { overRenameLimit = true; } }
Source:
<code>public static PaymentForSearchResult valueOf( ChargeFromResponse paymentResult, URI selfLink, URI paymentEventsLink, URI paymentCancelLink, URI paymentRefundsLink) { return new PaymentForSearchResult( paymentResult.getChargeId(), paymentResult.getAmount(), paymentResult.getState(), paymentResult.getReturnUrl(), paymentResult.getDescription(), paymentResult.getReference(), paymentResult.getEmail(), paymentResult.getPaymentProvider(), <START> paymentResult.getCardLabel(), <END> paymentResult.getCreated_date(), paymentResult.getRefundSummary(), selfLink, paymentEventsLink, paymentCancelLink, paymentRefundsLink); }</code><technical_language>label brand for thing? good call consistently</technical_language>

Target:
public static PaymentForSearchResult valueOf( ChargeFromResponse paymentResult, URI selfLink, URI paymentEventsLink, URI paymentCancelLink, URI paymentRefundsLink) { return new PaymentForSearchResult( paymentResult.getChargeId(), paymentResult.getAmount(), paymentResult.getState(), paymentResult.getReturnUrl(), paymentResult.getDescription(), paymentResult.getReference(), paymentResult.getEmail(), paymentResult.getPaymentProvider(), paymentResult.getCardBrand(), paymentResult.getCreated_date(), paymentResult.getRefundSummary(), selfLink, paymentEventsLink, paymentCancelLink, paymentRefundsLink); }
Source:
<code>public void testClickContactOpensMap() throws JSONException, InterruptedException { getMockDispatcher().setPlacesResponse(new MockResponse().setBody(MockJsonUtils.getPlacesJson())); <START> String[] contactEmails = (new String[]{"family.member@example.com"}); <END> JSONObject location = new JSONObject(); location.put("lat", "37.483477313364574") .put("lon", "-122.14838393032551") .put("rad", "100"); JSONObject[] locations = (new JSONObject[]{location}); getMockDispatcher().setDashboardResponse(new MockResponse().setBody(MockJsonUtils .getDashboardJsonContactsUserLocation(contactEmails, locations, location))); enterPlacesScreen(); onView(withContentDescription("family.member@example.com")).perform(click()); onView(withId(R.id.map)).check(matches(isDisplayed())); }</code><technical_language>I need braces</technical_language>

Target:
public void testClickContactOpensMap() throws JSONException, InterruptedException { getMockDispatcher().setPlacesResponse(new MockResponse().setBody(MockJsonUtils.getPlacesJson())); String[] contactEmails = new String[]{"family.member@example.com"}; JSONObject location = new JSONObject(); location.put("lat", "37.483477313364574") .put("lon", "-122.14838393032551") .put("rad", "100"); JSONObject[] locations = new JSONObject[]{location}; getMockDispatcher().setDashboardResponse(new MockResponse().setBody(MockJsonUtils .getDashboardJsonContactsUserLocation(contactEmails, locations, location))); enterPlacesScreen(); onView(withContentDescription("family.member@example.com")).perform(click()); onView(withId(R.id.map)).check(matches(isDisplayed())); }
Source:
<code>public void set6ByteLong( long index, int offset, long value ) { long pageId = pageId( index ); offset += offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ); ) { cursor.next(); cursor.putInt( offset, (int) value ); <START> cursor.putShort( offset + Integer.BYTES, (short) (value >>> 32) ); <END> checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }</code><technical_language>Integer.SIZE</technical_language>

Target:
public void set6ByteLong( long index, int offset, long value ) { long pageId = pageId( index ); offset += offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ) ) { cursor.next(); cursor.putInt( offset, (int) value ); cursor.putShort( offset + Integer.BYTES, (short) (value >>> Integer.SIZE) ); checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
Source:
<code>protected void line(PrintStream out, double x, double y, double resolution) throws IOException { x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); String append = ""; if (nextPower != currentPower) { <START> append += String.format(FORMAT_LOCALE, " S%d", (int) nextPower); <END> currentPower = nextPower; } if (nextSpeed != currentSpeed) { append += String.format(FORMAT_LOCALE, " F%d", (int) (max_speed*nextSpeed/100.0)); currentSpeed = nextSpeed; } sendLine("G1 X%.3f Y%.3f"+append, x, y); }</code><technical_language>I this needs reverted, changed %.2f, some laser cutters 0.0-1.0 for laser power, others 0-255, etc. max spindle power setting is configurable in Grbl Visicut, laser cutter 0.0 1.0 for power. this setting I a 3d laser engrave out S0 for line 100% black. Changing %.2f solves reasonable accuracy leading massive file sizes. vary formatter based user's max spindle power setting (float for < 100, int otherwise), if is worth code though</technical_language>

Target:
protected void line(PrintStream out, double x, double y, double resolution) throws IOException { x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); String line = "G1"; if (x != currentX) { if (resolution >= 254) { line += String.format(FORMAT_LOCALE, "X%.3f", x); } else { line += String.format(FORMAT_LOCALE, "X%.2f", x); } currentX = x; } if (y != currentY) { if (resolution >= 254) { line += String.format(FORMAT_LOCALE, "Y%.3f", y); } else { line += String.format(FORMAT_LOCALE, "Y%.2f", y); } currentY = y; } if (nextPower != currentPower) { line += String.format(FORMAT_LOCALE, "S%.2f", nextPower); currentPower = nextPower; } if (nextSpeed != currentSpeed) { line += String.format(FORMAT_LOCALE, "F%d", (int) (max_speed*nextSpeed/100.0)); currentSpeed = nextSpeed; } sendLine(line); }
Source:
<code>protected boolean validateMacAddress(VmNetworkInterface iface) { <START> if (!Regex.IsMatch(iface.getMacAddress(), VmNetworkInterface.VALID_MAC_ADDRESS_FORMAT)) { <END> AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MacAddress", iface.getMacAddress()); logable.AddCustomValue("IfaceName", iface.getName()); AuditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_IMPORT_INTERFACES_WITH_INVALID_MAC_ADDRESS); addCanDoActionMessage(VdcBllMessages.VM_IMPORT_INTERFACES_WITH_INVALID_MAC_ADDRESS); return false; } return true; }</code><technical_language>please notice format is fit for empty null string, want check StringUtils.isEmpty() before</technical_language>

Target:
protected boolean validateMacAddress(VmNetworkInterface iface) { if (!StringUtils.isEmpty(iface.getMacAddress()) && !validMacAddress.matcher(iface.getMacAddress()).matches()) { addCanDoActionMessage("$IfaceName " + iface.getName()); addCanDoActionMessage("$MacAddress " + iface.getMacAddress()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_INTERFACE_INVALID); return false; } return true; }
Source:
<code>protected InputChannel( SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, int initialBackoff, int maxBackoff, Counter numBytesIn, Counter numBuffersIn) { int initial = initialBackoff; int max = maxBackoff; <START> checkArgument(initial >= 0 && initial <= max); <END> this.inputGate = checkNotNull(inputGate); this.channelInfo = new InputChannelInfo(inputGate.getGateIndex(), channelIndex); this.partitionId = checkNotNull(partitionId); this.initialBackoff = initial; this.maxBackoff = max; this.currentBackoff = initial == 0 ? -1 : 0; this.numBytesIn = numBytesIn; this.numBuffersIn = numBuffersIn; }</code><technical_language>this check is valid retain</technical_language>

Target:
protected InputChannel( SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, int initialBackoff, int maxBackoff, Counter numBytesIn, Counter numBuffersIn) { checkArgument(channelIndex >= 0); int initial = initialBackoff; int max = maxBackoff; checkArgument(initial >= 0 && initial <= max); this.inputGate = checkNotNull(inputGate); this.channelInfo = new InputChannelInfo(inputGate.getGateIndex(), channelIndex); this.partitionId = checkNotNull(partitionId); this.initialBackoff = initial; this.maxBackoff = max; this.currentBackoff = initial == 0 ? -1 : 0; this.numBytesIn = numBytesIn; this.numBuffersIn = numBuffersIn; }
Source:
<code>private byte[] buildPart(String name, TypedOutput body, boolean first) { ByteArrayOutputStream out = null; try { out = new ByteArrayOutputStream(); out.write(buildBoundary(boundary, first, false)); out.write(buildHeader(name, body)); body.writeTo(out); return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { if (out != null) { try { out.close(); } catch (IOException ignored) { } <START> } <END> } }</code><technical_language>block indented extra</technical_language>

Target:
private byte[] buildPart(String name, TypedOutput body, boolean first) { ByteArrayOutputStream out = null; try { out = new ByteArrayOutputStream(); out.write(buildBoundary(boundary, first, false)); out.write(buildHeader(name, body)); body.writeTo(out); return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException("Unable to write multipart request.", ex); } finally { if (out != null) { try { out.close(); } catch (IOException ignored) { } } } }
Source:
<code>private LogRecordWithInputStream nextLogRecord() throws IOException { try { return nextLogRecord(reader); } catch (EndOfStreamException e) { <START> eos = true; <END> return null; } }</code><technical_language>helpful a log here</technical_language>

Target:
private LogRecordWithInputStream nextLogRecord() throws IOException { try { return nextLogRecord(reader); } catch (EndOfStreamException e) { eos = true; LOG.info(()->"end of stream is reached"); return null; } }
Source:
<code>public static InitializedInputVariable createCustomInput(String parentId, VariableDeclaration varDecl, String expression) { <START> String isExpressionPattern = "^#\\{(.+)}$"; <END> String decodedExpression = decode(expression); if (decodedExpression.matches(isExpressionPattern)) { return new InputExpression(parentId, varDecl, decodedExpression); } else { return new InputConstant(parentId, varDecl, decodedExpression); } }</code><technical_language>I is create Pattern object static field in this class, This call Pattern#match(s) passing test string, pattern is pre-compiled once</technical_language>

Target:
public static InitializedInputVariable createCustomInput(String parentId, VariableDeclaration varDecl, String expression) { String decodedExpression = decode(expression); if (EXPRESSION.matcher(decodedExpression).matches()) { return new InputExpression(parentId, varDecl, decodedExpression); } else { return new InputConstant(parentId, varDecl, decodedExpression); } }
Source:
<code>public String render(final GetBucketResult result) throws JsonProcessingException { <START> ObjectMapper mapper = new ObjectMapper(); <END> return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(result); }</code><technical_language>final</technical_language>

Target:
public String render(final GetBucketResult result) throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper(); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(result); }
Source:
<code>private SourceSystemId parseSource(LahdejarjestelmaIdReturnVal lahdejarjestelmaIdReturnVal) { String id = lahdejarjestelmaIdReturnVal.getId(); if (StringUtils.isNotBlank(id) && id.contains(":")) { KoskiStudyProgrammeHandler handler = KoskiStudyProgrammeHandler.valueOf(id.substring(0, id.indexOf(':'))); <START> Long studentId = Long.valueOf(id.substring(id.indexOf(':') + 1)); <END> return new SourceSystemId(handler, studentId); } return null; }</code><technical_language>biggie StringUtils.substringBefore StringUtils.substringAfter</technical_language>

Target:
private SourceSystemId parseSource(LahdejarjestelmaIdReturnVal lahdejarjestelmaIdReturnVal) { String id = lahdejarjestelmaIdReturnVal.getId(); if (StringUtils.isNotBlank(id) && id.contains(":")) { KoskiStudyProgrammeHandler handler = KoskiStudyProgrammeHandler.valueOf(StringUtils.substringBefore(id, ":")); Long studentId = Long.valueOf(StringUtils.substringAfter(id, ":")); return new SourceSystemId(handler, studentId); } return null; }
Source:
<code>private void init() { <START> FirebaseApp.initializeApp(this); <END> RxJavaPlugins.setErrorHandler(new DefaultRxErrorHandler(analytics)); final Scheduler asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> asyncMainThreadScheduler); flex.initialize(); userPreferenceManager.initialize(); purchaseManager.initialize(this); orderingPreferencesManager.initialize(); dateFormatter.initialize(); onLaunchDataPreFetcher.loadUserData(); identityManager.initialize(); pushManager.initialize(); cognitoManager.initialize(); ocrManager.initialize(); crashReporter.initialize(userPreferenceManager.get(UserPreference.Privacy.EnableCrashTracking)); receiptsOrderer.initialize(); picassoInitializer.initialize(); markedForDeletionCleaner.safelyDeleteAllOutstandingItems(); memoryLeakMonitor.initialize(); extraInitializer.init(); PDFBoxResourceLoader.init(getApplicationContext()); Completable.fromAction(() -> new SmartReceiptsTemporaryFileCache(this).resetCache()) .subscribeOn(Schedulers.io()) .subscribe(); appVersionManager.onLaunch(); appRatingPreferencesStorage.incrementLaunchCount(); }</code><technical_language>I need pull this out nonFloss applications, for floss builds</technical_language>

Target:
private void init() { RxJavaPlugins.setErrorHandler(new DefaultRxErrorHandler(analytics)); final Scheduler asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> asyncMainThreadScheduler); flex.initialize(); userPreferenceManager.initialize(); purchaseManager.initialize(this); orderingPreferencesManager.initialize(); dateFormatter.initialize(); onLaunchDataPreFetcher.loadUserData(); identityManager.initialize(); pushManager.initialize(); cognitoManager.initialize(); ocrManager.initialize(); crashReporter.initialize(userPreferenceManager.get(UserPreference.Privacy.EnableCrashTracking)); receiptsOrderer.initialize(); picassoInitializer.initialize(); markedForDeletionCleaner.safelyDeleteAllOutstandingItems(); memoryLeakMonitor.initialize(); extraInitializer.init(); PDFBoxResourceLoader.init(getApplicationContext()); Completable.fromAction(() -> new SmartReceiptsTemporaryFileCache(this).resetCache()) .subscribeOn(Schedulers.io()) .subscribe(); appVersionManager.onLaunch(); appRatingPreferencesStorage.incrementLaunchCount(); }
Source:
<code>public void visitForStatement(ForStatementTree tree) { List<UnaryExpressionTree> unaryOperations = tree.update().stream() <START> .filter(expression -> expression.is(Kind.PREFIX_INCREMENT, Kind.PREFIX_DECREMENT, Kind.POSTFIX_INCREMENT, Kind.POSTFIX_DECREMENT)) <END> .map(UnaryExpressionTree.class::cast) .collect(Collectors.toList()); if (!unaryOperations.isEmpty() && !tree.condition().isEmpty()) { checkCondition(tree.condition().get(tree.condition().size() - 1), unaryOperations); } super.visitForStatement(tree); }</code><technical_language>[cert](<LINK_0> rule, I cover forms for ($i = 0; $i < $n; $i += 1) { ... }</technical_language>

Target:
public void visitForStatement(ForStatementTree tree) { List<ExpressionTree> updates = tree.update().stream() .filter(expression -> updateKind(expression) != UpdateKind.UNKNOWN) .collect(Collectors.toList()); ExpressionTree forCondition = CheckUtils.getForCondition(tree); if (forCondition != null && !updates.isEmpty()) { checkCondition(forCondition, updates); } super.visitForStatement(tree); }
Source:
<code>private void processSingleResultMCDC(String resultPath, Matcher m) { DispoItemData item = datIdToItem.get(generateDatId(m.group(1), m.group(2))); Integer lineNumber = Integer.valueOf(m.group(3)); Integer bitsTrue = Integer.valueOf(m.group(4)); Integer bitsUsed = Integer.valueOf(m.group(5)); Map<String, Boolean> bitsTrueMap = getBitToBoolean(Integer.toString(bitsTrue, 2), Integer.toString(bitsUsed, 2)); for (String abbrevCond : bitsTrueMap.keySet()) { String TorF = bitsTrueMap.get(abbrevCond) ? "T" : "F"; String location = String.format("%s.%s.%s", lineNumber, abbrevCond, TorF); Discrepancy matchingDiscrepancy = matchDiscrepancy(location, item.getDiscrepanciesList()); if (matchingDiscrepancy != null) { String text = matchingDiscrepancy.getText(); Map<String, Discrepancy> discrepancies = item.getDiscrepanciesList(); discrepancies.remove(matchingDiscrepancy.getId()); item.setDiscrepanciesList(discrepancies); addAnnotationForForCoveredLine(item, location, Test_Unit_Resolution, resultPath, text); } else { <START> System.out.println(""); <END> } } }</code><technical_language>log instead</technical_language>

Target:
private void processSingleResultMCDC(String resultPath, Matcher m) { DispoItemData item = datIdToItem.get(generateDatId(m.group(1), m.group(2))); if(item != null) { Integer lineNumber = Integer.valueOf(m.group(3)); Integer bitsTrue = Integer.valueOf(m.group(4)); Integer bitsUsed = Integer.valueOf(m.group(5)); Map<String, Boolean> bitsTrueMap = getBitToBoolean(Integer.toString(bitsTrue, 2), Integer.toString(bitsUsed, 2)); for (String abbrevCond : bitsTrueMap.keySet()) { String TorF = bitsTrueMap.get(abbrevCond) ? "T" : "F"; String location = String.format("%s.%s.%s", lineNumber, abbrevCond, TorF); Discrepancy matchingDiscrepancy = matchDiscrepancy(location, item.getDiscrepanciesList()); if (matchingDiscrepancy != null) { String text = matchingDiscrepancy.getText(); Map<String, Discrepancy> discrepancies = item.getDiscrepanciesList(); discrepancies.remove(matchingDiscrepancy.getId()); item.setDiscrepanciesList(discrepancies); addAnnotationForForCoveredLine(item, location, Test_Unit_Resolution, resultPath, text); } } } }
Source:
<code>private String formatLogStmt(String statement) { if (statement == null) { return "sqlHash=null, statement=null"; } synchronized(this) { if (statement.equals(lastLogStmt)) { return lastLogStmtFormat; } String hash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(statement.getBytes("UTF-8")); hash = new BigInteger(1, md.digest()).toString(16); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { stmtLogger.error("Cannot encode statement " + statement, e); } String subStatement = statement; if (maxStatementLogLen >= 0 && maxStatementLogLen < statement.length()) { subStatement = statement.substring(0, maxStatementLogLen) + " ... "; } <START> subStatement = StringUtils.maskMessage(subStatement, StringUtils.maskPasswordPattern,StringUtils.maskString); <END> if (maxStatementLogLen >= 0 && maxStatementLogLen < subStatement.length()) { subStatement = subStatement.substring(0, maxStatementLogLen) + " ... "; } String result = String.format("sqlHash=%s, statement=[ %s ]", hash, subStatement); lastLogStmt = statement; lastLogStmtFormat = result; return result; } }</code><technical_language>a bit worried cost of this function, parsing full statement, specially long statements. run some benchmarks this is affecting performance for OLTP workloads</technical_language>

Target:
private String formatLogStmt(String statement) { if (statement == null) { return "sqlHash=null, statement=null"; } synchronized(this) { if (statement.equals(lastLogStmt)) { return lastLogStmtFormat; } String hash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(statement.getBytes("UTF-8")); hash = new BigInteger(1, md.digest()).toString(16); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { stmtLogger.error("Cannot encode statement " + statement, e); } String subStatement = statement; if (maxStatementLogLen >= 0 && maxStatementLogLen < statement.length()) { subStatement = statement.substring(0, maxStatementLogLen) + " ... "; } String result = String.format("sqlHash=%s, statement=[ %s ]", hash, subStatement); lastLogStmt = statement; lastLogStmtFormat = result; return result; } }