auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, InterruptedException { Job project = getProject(); if (project == null) { return; } project.checkPermission(Item.BUILD); if (isRebuildAvailable()) { if (!req.getMethod().equals("POST")) { req.getView(this, "index.jelly").forward(req, rsp); return; } build = req.findAncestorObject(Run.class); ParametersDefinitionProperty paramDefProp = build.getParent().getProperty( ParametersDefinitionProperty.class); List<ParameterValue> values = new ArrayList<ParameterValue>(); ParametersAction paramAction = build.getAction(ParametersAction.class); JSONObject formData = req.getSubmittedForm(); if (!formData.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { if (o instanceof JSONNull) { continue; } JSONObject jo = (JSONObject)o; String name = jo.getString("name"); ParameterValue parameterValue = getParameterValue(paramDefProp, name, paramAction, req, jo); if (parameterValue != null) { values.add(parameterValue); } } } for (ParameterValue source : paramAction.getParameters()) { <START> if (!values.contains(source)) { <END> values.add(source); } } List<Action> actions = constructRebuildActions(build, new ParametersAction(values)); Jenkins.getInstance().getQueue().schedule((Queue.Task) build.getParent(), 0, actions); rsp.sendRedirect("../../"); } }</code><technical_language>work properly for ParameterValue implementations</technical_language>

Target:
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, InterruptedException { Job project = getProject(); if (project == null) { return; } project.checkPermission(Item.BUILD); if (isRebuildAvailable()) { if (!req.getMethod().equals("POST")) { req.getView(this, "index.jelly").forward(req, rsp); return; } build = req.findAncestorObject(Run.class); ParametersDefinitionProperty paramDefProp = build.getParent().getProperty(ParametersDefinitionProperty.class); List<ParameterValue> values = new ArrayList<ParameterValue>(); ParametersAction paramAction = build.getAction(ParametersAction.class); JSONObject formData = req.getSubmittedForm(); if (!formData.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { if (o instanceof JSONNull) { continue; } JSONObject jo = (JSONObject)o; String name = jo.getString("name"); ParameterValue parameterValue = getParameterValue(paramDefProp, name, paramAction, req, jo); if (parameterValue != null) { values.add(parameterValue); } } } for (ParameterValue source : paramAction.getParameters()) { boolean alreadyAdded = false; for (ParameterValue dest : values) { if (source.getName().equals(dest.getName())) { alreadyAdded = true; break; } } if (!alreadyAdded) { values.add(source); } } List<Action> actions = constructRebuildActions(build, new ParametersAction(values)); Jenkins.getInstance().getQueue().schedule((Queue.Task) build.getParent(), 0, actions); rsp.sendRedirect("../../"); } }
Source:
<code>public void deleteEnvironment(String id) throws DotDataException { if(!UtilMethods.isSet(id)) return; List<PublishingEndPoint> endPoints = APILocator.getPublisherEndPointAPI().findSendingEndPointsByEnvironment(id); IntegrityUtil integrityUtil = new IntegrityUtil(); for (PublishingEndPoint ep : endPoints) { <START> integrityUtil.completeDiscardConflicts(ep.getId()); <END> APILocator.getPublisherEndPointAPI().deleteEndPointById(ep.getId()); } Environment e = findEnvironmentById(id); APILocator.getPermissionAPI().removePermissions(e); FactoryLocator.getBundleFactory().deleteBundleEnvironmentByEnvironment(id); FactoryLocator.getPushedAssetsFactory().deletePushedAssetsByEnvironment(id); environmentFactory.deleteEnvironmentById(id); }</code><technical_language>I suggest moving this call APILocator.getPublisherEndPointAPI().deleteEndPointById. need repeated in REST Resource guarantees a direct call APILocator.getPublisherEndPointAPI().deleteEndPointById takes care of this</technical_language>

Target:
public void deleteEnvironment(String id) throws DotDataException { if(!UtilMethods.isSet(id)) return; List<PublishingEndPoint> endPoints = APILocator.getPublisherEndPointAPI().findSendingEndPointsByEnvironment(id); for (PublishingEndPoint ep : endPoints) { APILocator.getPublisherEndPointAPI().deleteEndPointById(ep.getId()); } Environment e = findEnvironmentById(id); APILocator.getPermissionAPI().removePermissions(e); FactoryLocator.getBundleFactory().deleteBundleEnvironmentByEnvironment(id); FactoryLocator.getPushedAssetsFactory().deletePushedAssetsByEnvironment(id); environmentFactory.deleteEnvironmentById(id); }
Source:
<code>public void serviceResolved(ServiceEvent se) { <START> throw new UnsupportedOperationException("Not supported yet."); END> }</code><technical_language>do change behaviour? I strict write some warning log instead of throwing this error</technical_language>

Target:
public void serviceResolved(ServiceEvent se) { }
Source:
<code>public Map<String, Map<String, List<String>>> getRoutingTableForTable(String tableName) throws Exception { final Map<String, Map<String, List<String>>> routingTableMap = new HashMap<>(); final String url = String.format(ROUTING_TABLE_API_TEMPLATE, getBrokerHost(tableName), tableName); String responseBody = sendHttpGet(url); <START> log.debug("Trying to get routingTable for %s. url: %s", tableName, url); <END> JSONObject resp = JSONObject.parseObject(responseBody); JSONArray routingTableSnapshots = resp.getJSONArray("routingTableSnapshot"); for (int i = 0; i < routingTableSnapshots.size(); i++) { JSONObject snapshot = routingTableSnapshots.getJSONObject(i); String tableNameWithType = snapshot.getString("tableName"); if (!tableName.equals(extractRawTableName(tableNameWithType))) { log.debug("Ignoring routingTable for %s", tableNameWithType); continue; } JSONArray routingTableEntriesArray = snapshot.getJSONArray("routingTableEntries"); if (routingTableEntriesArray.size() == 0) { throw new PrestoException( PINOT_FAILURE_GETTING_TABLE, "RoutingTable is empty for " + tableName); } String routingTableEntries = routingTableEntriesArray.getJSONObject(new Random().nextInt(routingTableEntriesArray.size())).toJSONString(); Map<String, List<String>> routingTable = objectMapper.readValue(routingTableEntries, Map.class); routingTableMap.put(tableNameWithType, routingTable); } return routingTableMap; }</code><technical_language>remove</technical_language>

Target:
public Map<String, Map<String, List<String>>> getRoutingTableForTable(String tableName) throws Exception { ImmutableMap.Builder<String, Map<String, List<String>>> routingTableMapBuilder = ImmutableMap.builder(); String url = String.format(ROUTING_TABLE_API_TEMPLATE, getBrokerHost(tableName), tableName); String responseBody = sendHttpGet(url); JSONObject resp = JSONObject.parseObject(responseBody); JSONArray routingTableSnapshots = resp.getJSONArray("routingTableSnapshot"); for (int i = 0; i < routingTableSnapshots.size(); i++) { JSONObject snapshot = routingTableSnapshots.getJSONObject(i); String tableNameWithType = snapshot.getString("tableName"); if (!tableName.equals(extractRawTableName(tableNameWithType))) { log.debug("Ignoring routingTable for %s", tableNameWithType); continue; } JSONArray routingTableEntriesArray = snapshot.getJSONArray("routingTableEntries"); if (routingTableEntriesArray.size() == 0) { throw new PrestoException( PINOT_FAILURE_GETTING_TABLE, "RoutingTable is empty for " + tableName); } String routingTableEntries = routingTableEntriesArray.getJSONObject(new Random().nextInt(routingTableEntriesArray.size())).toJSONString(); Map<String, List<String>> routingTable = objectMapper.readValue(routingTableEntries, Map.class); routingTableMapBuilder.put(tableNameWithType, routingTable); } return routingTableMapBuilder.build(); }
Source:
<code>private static void accept(ByteArrayOutputStream byteOutputStream, ByteBuffer byteBuffer) { try { byteOutputStream.write(byteBufferToArray(byteBuffer)); } catch (IOException e) { throw new RuntimeException("Error occurs when write ByteBuffer to ByteArrayOutputStream. " <START> + "Error details: " + e.getMessage(), e); <END> } }</code><technical_language>print error details. duplicated in throwable. below,</technical_language>

Target:
private static void accept(ByteArrayOutputStream byteOutputStream, ByteBuffer byteBuffer) { try { byteOutputStream.write(byteBufferToArray(byteBuffer)); } catch (IOException e) { throw new RuntimeException("Error occurred writing ByteBuffer to ByteArrayOutputStream.", e); } }
Source:
<code><START> public void setUp() { <END> this.transformer = new CsvMetacardTransformer(); this.arguments = new HashMap<>(); attributeDescriptorsSet = new HashSet<>(); attributeDescriptorsList = new ArrayList<>(); metacardDataMap = new HashMap<>(); ATTRIBUTE_DESCRIPTOR_LIST = new ArrayList<>(); String[] hiddenFieldsArray = {"attribute3", "attribute5"}; arguments.put("hiddenFields", buildSet(hiddenFieldsArray)); String[] columnOrderArray = {"attribute3", "attribute4", "attribute2"}; arguments.put("columnOrder", buildList(columnOrderArray)); String[][] aliases = {{"attribute1", "column1"}, {"attribute2", "column2"}}; arguments.put("aliases", buildMap(aliases)); attributeDescriptorsSet.add(buildAttributeDescriptor("attribute1", BasicTypes.STRING_TYPE)); attributeDescriptorsSet.add(buildAttributeDescriptor("attribute2", BasicTypes.STRING_TYPE)); attributeDescriptorsSet.add(buildAttributeDescriptor("attribute3", BasicTypes.STRING_TYPE)); attributeDescriptorsSet.add(buildAttributeDescriptor("1", BasicTypes.INTEGER_TYPE)); buildMetacardDataMap(); normalMC = buildMetacard(); }</code><technical_language>of this functionality moved out of setup. unit tests, masters of this domain. need layers of abstraction this. String[] -> List<String> -> Set<String> declare beginning a Set<String> for example. tests simpler if remove layers of abstraction</technical_language>

Target:
public void setUp() { this.transformer = new CsvMetacardTransformer(); this.arguments = new HashMap<>(); arguments.put("columnOrder", ImmutableList.of("stringAtt", "intAtt", "doubleAtt")); normalMC = buildMetacard(); }
Source:
<code>public int hashCode() { <START> int result = (isSsl ? 1 : 0); <END> result = 31 * result + hostAndPort.hashCode(); return result; }</code><technical_language>return Objects.hashCode(isSsl, hostAndPort);</technical_language>

Target:
public int hashCode() { return Objects.hashCode(isSsl, hostAndPort); }
Source:
<code>public void process(final SocketEndpoint webSocket, JobIdentifier jobIdentifier, long start) throws Exception { if (start < 0L) start = 0L; socketHealthService.register(webSocket); boolean isRunningBuild = !detectCompleted(jobIdentifier); try { waitForLogToExist(webSocket, jobIdentifier); } catch (Retryable.TooManyRetriesException e) { socketHealthService.deregister(webSocket); webSocket.close(LOG_DOES_NOT_EXIST, e.getMessage()); return; } try (ConsoleConsumer streamer = consoleService.getStreamer(start, jobIdentifier)) { do { start += sendLogs(webSocket, streamer, jobIdentifier); if (isRunningBuild) { Thread.sleep(FILL_INTERVAL); } } while (webSocket.isOpen() && !detectCompleted(jobIdentifier)); if (isRunningBuild) sendLogs(webSocket, streamer, jobIdentifier); if (detectCompleted(jobIdentifier)) { <START> sendLogs(webSocket, consoleService.getStreamer(start, jobIdentifier), jobIdentifier); <END> } LOGGER.debug("Sent log lines for {}", streamer.totalLinesConsumed(), jobIdentifier); } finally { socketHealthService.deregister(webSocket); webSocket.close(); } }</code><technical_language>close streamer prevent file handle leaks</technical_language>

Target:
public void process(final SocketEndpoint webSocket, JobIdentifier jobIdentifier, long start) throws Exception { if (start < 0L) start = 0L; socketHealthService.register(webSocket); boolean isRunningBuild = !detectCompleted(jobIdentifier); try { waitForLogToExist(webSocket, jobIdentifier); } catch (Retryable.TooManyRetriesException e) { socketHealthService.deregister(webSocket); webSocket.close(LOG_DOES_NOT_EXIST, e.getMessage()); return; } try (ConsoleConsumer streamer = consoleService.getStreamer(start, jobIdentifier)) { do { start += sendLogs(webSocket, streamer, jobIdentifier); if (isRunningBuild) { Thread.sleep(FILL_INTERVAL); } } while (webSocket.isOpen() && !detectCompleted(jobIdentifier)); LOGGER.debug("Sent log lines for from {}", streamer.totalLinesConsumed(), jobIdentifier, consoleService.consoleLogFile(jobIdentifier).toPath()); if (isRunningBuild) sendLogs(webSocket, streamer, jobIdentifier); if (detectCompleted(jobIdentifier)) { try(ConsoleConsumer consoleFileStreamer = consoleService.getStreamer(start, jobIdentifier)) { start += sendLogs(webSocket, consoleFileStreamer, jobIdentifier); LOGGER.debug("Sent log lines for from {}", streamer.totalLinesConsumed(), jobIdentifier, consoleService.consoleLogFile(jobIdentifier).toPath()); } } LOGGER.debug("Sent log lines for from all sources", start, jobIdentifier); } finally { socketHealthService.deregister(webSocket); webSocket.close(); } }
Source:
<code>public <T> T loadClass(ILanguageComponent component, String className, Class<T> expectedType) throws MetaborgException { final ClassLoader classLoader = classLoader(component); Class<?> theClass; try { logger.trace("Loading outliner class"); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MetaborgException("Given class was not found: " + className, e); } T instance; try { logger.trace("Instantiating outliner class"); instance = (T) theClass.newInstance(); injector.injectMembers(instance); <START> } catch (InstantiationException e) { <END> throw new MetaborgException("Given class was not instantiable", e); } catch (IllegalAccessException e) { throw new MetaborgException("Given class was not accessible", e); } catch (ClassCastException e) { throw new MetaborgException("Given class does not implement required interface", e); } return instance; }</code><technical_language>a big fan of wrapping exceptions in a generic MetaborgException</technical_language>

Target:
public <T> T loadClass(ILanguageComponent component, String className, Class<T> expectedType) { final ClassLoader classLoader = classLoader(component); Class<?> theClass; try { logger.trace("Loading outliner class"); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MetaborgRuntimeException("Given class was not found: " + className, e); } T instance; try { logger.trace("Instantiating class " + className); instance = (T) theClass.newInstance(); injector.injectMembers(instance); } catch (InstantiationException e) { throw new MetaborgRuntimeException("Given class was not instantiable: " + className, e); } catch (IllegalAccessException e) { throw new MetaborgRuntimeException("Given class was not accessible: " + className, e); } catch (ClassCastException e) { throw new MetaborgRuntimeException("Given class does not implement required interface: " + className, e); } logger.trace("Successfully loaded and instantiated class " + className); return instance; }
Source:
<code>public CommandResult command( DBObject cmd , int options, ReadPreference readPrefs ) throws MongoException { if (LOG.isDebugEnabled()) { LOG.debug("Fongo got command " + cmd); } if (cmd.containsField("getlasterror")) { return okResult(); } else if (cmd.containsField("drop")) { this.collMap.remove(cmd.get("drop").toString()); return okResult(); } else if(cmd.containsField("create")) { String collectionName = (String) cmd.get("create"); doGetCollection(collectionName); return okResult(); } else if (cmd.containsField("count")) { String collectionName = (String) cmd.get("count"); Number limit = (Number) cmd.get("limit"); Number skip = (Number) cmd.get("skip"); long result = doGetCollection(collectionName).getCount( (DBObject) cmd.get("query"), null, limit == null ? 0L : limit.longValue(), skip == null ? 0L : skip.longValue()); CommandResult okResult = okResult(); okResult.append("n", result); return okResult; } else if(cmd.containsField("deleteIndexes")) { String collectionName = (String) cmd.get("deleteIndexes"); String indexName = (String) cmd.get("index"); if("*".equals(indexName)) { doGetCollection(collectionName)._dropIndexes(); } else { doGetCollection(collectionName)._dropIndexes(indexName); } CommandResult okResult = okResult(); return okResult; } <START> return koErrorResult("undefined command: " + cmd); <END> }</code><technical_language>changes errorResult? Is error result for "ok" true</technical_language>

Target:
public CommandResult command(DBObject cmd, int options, ReadPreference readPrefs) throws MongoException { if (LOG.isDebugEnabled()) { LOG.debug("Fongo got command " + cmd); } if (cmd.containsField("getlasterror")) { return okResult(); } else if (cmd.containsField("drop")) { this.collMap.remove(cmd.get("drop").toString()); return okResult(); } else if (cmd.containsField("create")) { String collectionName = (String) cmd.get("create"); doGetCollection(collectionName); return okResult(); } else if (cmd.containsField("count")) { String collectionName = (String) cmd.get("count"); Number limit = (Number) cmd.get("limit"); Number skip = (Number) cmd.get("skip"); long result = doGetCollection(collectionName).getCount( (DBObject) cmd.get("query"), null, limit == null ? 0L : limit.longValue(), skip == null ? 0L : skip.longValue()); CommandResult okResult = okResult(); okResult.append("n", result); return okResult; } else if (cmd.containsField("deleteIndexes")) { String collectionName = (String) cmd.get("deleteIndexes"); String indexName = (String) cmd.get("index"); if ("*".equals(indexName)) { doGetCollection(collectionName)._dropIndexes(); } else { doGetCollection(collectionName)._dropIndexes(indexName); } CommandResult okResult = okResult(); return okResult; } else if (cmd.containsField("aggregate")) { List<DBObject> result = doAggregateCollection((String) cmd.get("aggregate"), (List<DBObject>) cmd.get("pipeline")); if (result == null) { return koErrorResult("can't aggregate"); } CommandResult okResult = okResult(); BasicDBList list = new BasicDBList(); list.addAll(result); okResult.put("result", list); return okResult; } return koErrorResult("undefined command: " + cmd); }
Source:
<code>private FedoraResource locateResource(final Path path, final Session session) { final Predicate<Path> exists = UncheckedPredicate.uncheck(x -> session.nodeExists(x.toString())); if (exists.test(path) || path.isRoot()) { LOGGER.debug("findRolesForPath: {}", path.getString()); return nodeService.find(session, path.toString()); <START> } else { <END> LOGGER.trace("Path: does not exist, checking parent", path.getString()); return locateResource(path.getParent(), session); } }</code><technical_language>else necessary due return line:111</technical_language>

Target:
private FedoraResource locateResource(final Path path, final Session session) { final Predicate<Path> exists = UncheckedPredicate.uncheck(x -> session.nodeExists(x.toString())); if (exists.test(path) || path.isRoot()) { LOGGER.debug("findRolesForPath: {}", path.getString()); return nodeService.find(session, path.toString()); } LOGGER.trace("Path: does not exist, checking parent", path.getString()); return locateResource(path.getParent(), session); }
Source:
<code>public void when_searching_for_several_tags_combine_them_with_OR() throws IOException { OrganizationDto organization = dbTester.organizations().insert(); <START> RuleDefinitionDto both_tags_rule = createJavaRule(); <END> insertMetadata(organization, both_tags_rule, setTags("tag1", "tag2")); RuleDefinitionDto one_tag_rule = createJavaRule(); insertMetadata(organization, one_tag_rule, setTags("tag1")); RuleDefinitionDto other_tag_rule = createJavaRule(); insertMetadata(organization, other_tag_rule, setTags("tag2")); RuleDefinitionDto no_tag_rule = createJavaRule(); insertMetadata(organization, no_tag_rule, setTags()); indexRules(); Consumer<TestRequest> request = r -> r .setParam("f", "repo,name") .setParam("tags", "tag1,tag2") .setParam("organization", organization.getKey()); verify(request, both_tags_rule, one_tag_rule, other_tag_rule); }</code><technical_language>Please camel case for variables</technical_language>

Target:
public void when_searching_for_several_tags_combine_them_with_OR() throws IOException { OrganizationDto organization = dbTester.organizations().insert(); RuleDefinitionDto bothTagsRule = createJavaRule(); insertMetadata(organization, bothTagsRule, setTags("tag1", "tag2")); RuleDefinitionDto oneTagRule = createJavaRule(); insertMetadata(organization, oneTagRule, setTags("tag1")); RuleDefinitionDto otherTagRule = createJavaRule(); insertMetadata(organization, otherTagRule, setTags("tag2")); RuleDefinitionDto noTagRule = createJavaRule(); insertMetadata(organization, noTagRule, setTags()); indexRules(); Consumer<TestRequest> request = r -> r .setParam("f", "repo,name") .setParam("tags", "tag1,tag2") .setParam("organization", organization.getKey()); verify(request, bothTagsRule, oneTagRule, otherTagRule); }
Source:
<code>private void addOrUpdateSnapshotsConfig(Guid clusterId, GlusterSnapshotConfigInfo configInfo) { try (EngineLock lock = acquireEntityLock(clusterId)) { <START> for (String key : configInfo.getClusterConfigOptions().keySet()) { <END> String value = configInfo.getClusterConfigOptions().get(key); if (value != null) { addOrUpdateClusterConfig(clusterId, key, value); } } } Map<String, Map<String, String>> volumeConfigs = configInfo.getVolumeConfigOptions(); for (String key : volumeConfigs.keySet()) { GlusterVolumeEntity volume = getGlusterVolumeDao().getByName(clusterId, key); try (EngineLock lock = acquireEntityLock(volume.getId())) { Map<String, String> volumeConfig = volumeConfigs.get(key); if (volumeConfig != null) { for (String configKey : volumeConfig.keySet()) { String value = volumeConfig.get(configKey); if (value != null) { addOrUpdateVolumeConfig(clusterId, volume.getId(), configKey, value); } } } } } }</code><technical_language>Map.Entry</technical_language>

Target:
private void addOrUpdateSnapshotsConfig(Guid clusterId, GlusterSnapshotConfigInfo configInfo) { try (EngineLock lock = acquireEntityLock(clusterId)) { for (Map.Entry<String, String> entry : configInfo.getClusterConfigOptions().entrySet()) { if (entry.getValue() != null) { addOrUpdateClusterConfig(clusterId, entry.getKey(), entry.getValue()); } } } Map<String, Map<String, String>> volumeConfigs = configInfo.getVolumeConfigOptions(); for (Map.Entry<String, Map<String, String>> entry : volumeConfigs.entrySet()) { GlusterVolumeEntity volume = getGlusterVolumeDao().getByName(clusterId, entry.getKey()); if (volume == null) { continue; } try (EngineLock lock = acquireEntityLock(volume.getId())) { Map<String, String> volumeConfig = entry.getValue(); if (volumeConfig != null) { for (Map.Entry<String, String> entry1 : volumeConfig.entrySet()) { if (entry.getValue() != null) { addOrUpdateVolumeConfig(clusterId, volume.getId(), entry1.getKey(), entry1.getValue()); } } } } } }
Source:
<code>public void stop() { this.binlogEventListener.stop(); try { <START> this.replicator.stop(5, TimeUnit.SECONDS); <END> } catch ( Exception e ) { System.err.println("Got exception while shutting down replicator: " + e); } if ( this.replicator.isRunning() ) { System.err.println("Maxwell' replicator thread wouldn't die, but we're exiting anyway."); } this.shouldStop = true; for ( int i = 0; i < 50 && this.isRunning; i++ ) { try { Thread.sleep(100); } catch ( InterruptedException e) } if ( this.isRunning ) { System.err.println("Maxwell's main thread didn't die, but we had to go anyway."); } System.err.flush(); }</code><technical_language>this is a bit weird. Considering is a chance L129 (<LINK_0> ) simply restart in main thread. I suggest setting shouldStop flag here, letting main thread do this cleanup</technical_language>

Target:
public void stop() throws TimeoutException { stop(5000); }
Source:
<code>protected void checkRenderedRendition(DocumentModel doc, String renditionName, boolean store, boolean stale, String expectedFilename, String expectedDigest) { Rendition rendition = rs.getRendition(doc, renditionName, store); assertNotNull(rendition); assertTrue(rendition.isStored() == store); Blob blob = rendition.getBlob(); String mimeType = blob.getMimeType(); assertFalse(blob.getMimeType().contains(LazyRendition.EMPTY_MARKER)); assertTrue( <START> stale ? mimeType.contains(LazyRendition.STALE_MARKER) : !mimeType.contains(LazyRendition.STALE_MARKER)); <END> assertEquals(expectedFilename, blob.getFilename()); assertTrue(blob.getLength() > 0); String digest = blob.getDigest(); log.debug(String.format("Comparing expected digest %s and %s rendition blob digest %s", expectedDigest, stale ? "stale" : "up-to-date", digest)); assertEquals(expectedDigest, digest); }</code><technical_language>assertTrue(stale == mimeType.contains(LazyRendition.STALE_MARKER))</technical_language>

Target:
protected void checkRenderedRendition(DocumentModel doc, String renditionName, boolean store, boolean stale, String expectedFilename, String expectedDigest) { Rendition rendition = rs.getRendition(doc, renditionName, store); assertNotNull(rendition); assertTrue(rendition.isStored() == store); Blob blob = rendition.getBlob(); String mimeType = blob.getMimeType(); assertFalse(blob.getMimeType().contains(LazyRendition.EMPTY_MARKER)); assertTrue(stale == mimeType.contains(LazyRendition.STALE_MARKER)); assertEquals(expectedFilename, blob.getFilename()); assertTrue(blob.getLength() > 0); String digest = blob.getDigest(); log.debug(String.format("Comparing expected digest %s and %s rendition blob digest %s", expectedDigest, stale ? "stale" : "up-to-date", digest)); assertEquals(expectedDigest, digest); }
Source:
<code>public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } <START> List<String> expectedEvents = ImmutableList.of( <END> UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN ); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }</code><technical_language>ImmutableSet (contains() is faster)</technical_language>

Target:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } Set<String> expectedEvents = ImmutableSet.of( UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN ); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }
Source:
<code>private SelectionListener onStartPortForwarding() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { <START> if(!wizardModel.checkPortForwardingAllowed()) { <END> MessageDialog.openWarning(getShell(), "Warning", "Some ports are in use now."); return; } try { WizardUtils.runInWizard(new Job("Starting port forwarding...") { @Override protected IStatus run(IProgressMonitor monitor) { wizardModel.startPortForwarding(); refreshViewerInput(wizardModel.getForwardablePorts()); return Status.OK_STATUS; } }, getContainer(), getDataBindingContext()); } catch (OpenShiftException | InvocationTargetException | InterruptedException e1) { LOG.logError(e1); MessageDialog.openError(getShell(), "Error starting port forwarding", e1.getMessage()); } } }; }</code><technical_language>needs java viewer.refresh(true); some point</technical_language>

Target:
private SelectionListener onStartPortForwarding() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if(!wizardModel.checkPortForwardingAllowed()) { viewer.refresh(true); MessageDialog.openWarning(getShell(), "Warning", "Some ports are in use now."); return; } try { WizardUtils.runInWizard(new Job("Starting port forwarding...") { @Override protected IStatus run(IProgressMonitor monitor) { wizardModel.startPortForwarding(); refreshViewerInput(wizardModel.getForwardablePorts()); return Status.OK_STATUS; } }, getContainer(), getDataBindingContext()); } catch (OpenShiftException | InvocationTargetException | InterruptedException e1) { LOG.logError(e1); MessageDialog.openError(getShell(), "Error starting port forwarding", e1.getMessage()); } } }; }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext()); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); imgPathString = cursor.getString(columnIndex); Timber.i(imgPathString); preferences.edit().putString("deck_background_path", imgPathString); preferences.edit().apply(); Timber.i(imgPathString); cursor.close(); } else { Toast.makeText(this, "You haven't picked Image", Toast.LENGTH_LONG).show(); } } catch (Exception e) { <START> Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show(); <END> } }</code><technical_language>extract resource</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Cursor cursor = null; Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; try { cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String imgPathString = cursor.getString(columnIndex); File sourceFile = new File(imgPathString); String currentAnkiDroidDirectory = CollectionHelper.getCurrentAnkiDroidDirectory(this); String imageName = "DeckPickerBackground.png"; File destFile = new File(currentAnkiDroidDirectory, imageName); try (FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel(); FileChannel destChannel = new FileOutputStream(destFile).getChannel()) { destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); UIUtils.showThemedToast(this, getString(R.string.background_image_applied), false); } } finally { if (cursor != null) { cursor.close(); } } } else { UIUtils.showThemedToast(this, getString(R.string.no_image_selected), false); } } catch (OutOfMemoryError | Exception e) { UIUtils.showThemedToast(this, getString(R.string.error_selecting_image, e.getLocalizedMessage()), false); } }
Source:
<code>private CompiledQuery sqlDatabaseBackup(SqlExecutionContext executionContext) throws SqlException { setupBackupRenamePath(); <START> NativeLPSZ nativeLPSZ = new NativeLPSZ(); <END> ff.iterateDir(path.of(configuration.getRoot()).$(), (file, type) -> { nativeLPSZ.of(file); if (type == Files.DT_DIR && nativeLPSZ.charAt(0) != '.') { backupTable(nativeLPSZ, executionContext); } }); return compiledQuery.ofBackupTable(); }</code><technical_language>indeed, lets cache</technical_language>

Target:
private CompiledQuery sqlDatabaseBackup(SqlExecutionContext executionContext) throws SqlException { currentExecutionContext = executionContext; try { setupBackupRenamePath(); ff.iterateDir(path.of(configuration.getRoot()).$(), sqlDatabaseBackupOnFind); return compiledQuery.ofBackupTable(); } finally { currentExecutionContext = null; } }
Source:
<code>private static void checkCipher_Update_invalidMode_Failure(int opmode) throws Exception { String msg = "update() should throw IllegalStateException [mode=" + opmode + "]"; int bs = createAesCipher(opmode).getBlockSize(); assertEquals(16, bs); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[0])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[2 * bs])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update( new byte[2 * bs], bs, 0)); try { <START> createAesCipher(opmode).update( new byte[2*bs], 0, <END> 2 * bs, new byte[2 * bs], 0); fail(msg); } catch (IllegalStateException expected) { } catch (Exception e) { fail(e.getMessage()); } }</code><technical_language>Re: splitting lines, remembering Google style guidelines (and super enforced while I in Compare) func( param1, param2, param3) allowed func( param1, param2, param3) was, func(param1, param2, param3). I Android more lenient times (because of external/legacy code?) If find a example of this (not coming external/legacy code) happy it</technical_language>

Target:
private static void checkCipher_Update_invalidMode_Failure(int opmode) throws Exception { String msg = "update() should throw IllegalStateException [mode=" + opmode + "]"; int bs = createAesCipher(opmode).getBlockSize(); assertEquals(16, bs); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[0])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update(new byte[2 * bs])); assertIllegalStateException(msg, () -> createAesCipher(opmode).update( new byte[2 * bs] , bs , 0 )); try { createAesCipher(opmode).update(new byte[2*bs] , 0 , 2 * bs , new byte[2 * bs] , 0 ); fail(msg); } catch (IllegalStateException expected) { } }
Source:
<code>public String getID() { <START> return block.getLocalizedName(); <END> }</code><technical_language>Uhh, "Localized"</technical_language>

Target:
public String getID() { return block.getUnlocalizedName(); }
Source:
<code>public void testArraySection() { BytesBuilder bb = Bytes.newBuilder(); bb.append(new byte[] {'c', (byte) 0, (byte) 127, (byte) 128, (byte) 255}, 0, 3); <START> Bytes bytes = bb.toBytes(); <END> Assert.assertEquals(Bytes.of(new byte[] {'c', (byte) 0, (byte) 127, (byte) 128, (byte) 255}), 0, 3); }</code><technical_language>This test broken. assertEquals verify data in bytes</technical_language>

Target:
public void testArraySection() { BytesBuilder bb = Bytes.newBuilder(); byte[] testing = new byte[] {'a', 'b', 'c', 'd', 'e'}; bb.append(testing, 0, 3); bb.append(testing, 1, 3); bb.append(testing, 2, 2); Bytes bytes = bb.toBytes(); Assert.assertEquals(Bytes.of("abcbcdcd"), bytes); }
Source:
<code><START> protected boolean doStatusCheck(T pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { <END> List<ApiCommand> failedCommands = new ArrayList<>(); for (BigDecimal commandId : pollerObject.getIdList()) { ApiCommand apiCommand = commandsResourceApi.readCommand(commandId); if (apiCommand.getActive()) { LOGGER.debug("Command [" + getCommandName() + "] with id [" + commandId + "] is active, so it hasn't finished yet"); return false; } else if (!apiCommand.getSuccess()) { failedCommands.add(apiCommand); } } if (!failedCommands.isEmpty()) { String message = failedCommands.stream().map(cmd -> { String resultMessage = cmd.getResultMessage(); List<String> detailedMessages = parseResultMessageFromChildren(cmd.getChildren()); ApiHostRef hostRef = cmd.getHostRef(); String hostRefStr = hostRef == null ? "Unknown" : hostRef.getHostname(); return "Command [" + cmd.getName() + ":" + cmd.getId() + "] failed on host [" + hostRefStr + "]: " + resultMessage + ". Detailed messages: " + String.join("\n", detailedMessages); }).collect(Collectors.joining(",")); LOGGER.info(message); throw new ClouderaManagerOperationFailedException(message); } return true; }</code><technical_language>refactor? for a separate method if</technical_language>

Target:
protected boolean doStatusCheck(T pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<ApiCommand> apiCommands = collectApiCommands(pollerObject, commandsResourceApi); boolean allCommandsFinished = apiCommands.stream().noneMatch(ApiCommand::getActive); if (allCommandsFinished) { validateApiCommandResults(apiCommands); return true; } else { return false; } }
Source:
<code>public Schema getSchema() { <START> return null; <END> }</code><technical_language>return schemainstance</technical_language>

Target:
public Schema getSchema() { return schema; }
Source:
<code>public void handleCommand(ChannelUID channelUID, Command command) { BridgeHandler dssBridgeHandler = getDssBridgeHandler(); if (dssBridgeHandler == null) { <START> logger.warn("BridgeHandler not found. Cannot handle command without bridge."); <END> return; } if (temperatureSensorTransmitter == null && zoneID != null) { logger.warn( "Device not known on TemperationControlManager or temperatureSensorTransreciver is not registerd. Cannot handle command."); return; } if (channelUID.getId().equals(currentChannelID)) { if (command instanceof PercentType || command instanceof DecimalType) { sendCommandAndUpdateChannel(((DecimalType) command).floatValue()); } else if (command instanceof OnOffType) { if (OnOffType.ON.equals(command)) { if (isTemperature()) { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_TEMP); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_CONTROLL_VALUE); } } else { if (isTemperature()) { sendCommandAndUpdateChannel(0f); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MIN_CONTROLL_VALUE); } } } else if (command instanceof IncreaseDecreaseType) { if (IncreaseDecreaseType.INCREASE.equals(command)) { sendCommandAndUpdateChannel(currentValue + step); } else { sendCommandAndUpdateChannel(currentValue - step); } } } else { logger.warn("Command sent to an unknown channel id: {}", channelUID); } }</code><technical_language>This level debug, warning in users log file user do it</technical_language>

Target:
public void handleCommand(ChannelUID channelUID, Command command) { BridgeHandler dssBridgeHandler = getDssBridgeHandler(); if (dssBridgeHandler == null) { logger.debug("BridgeHandler not found. Cannot handle command without bridge."); return; } if (temperatureSensorTransmitter == null && zoneID != null) { logger.debug( "Device not known on TemperationControlManager or temperatureSensorTransreciver is not registerd. Cannot handle command."); return; } if (channelUID.getId().equals(currentChannelID)) { if (command instanceof PercentType || command instanceof DecimalType) { sendCommandAndUpdateChannel(((DecimalType) command).floatValue()); } else if (command instanceof OnOffType) { if (OnOffType.ON.equals(command)) { if (isTemperature()) { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_TEMP); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MAX_CONTROLL_VALUE); } } else { if (isTemperature()) { sendCommandAndUpdateChannel(0f); } else { sendCommandAndUpdateChannel(TemperatureControlSensorTransmitter.MIN_CONTROLL_VALUE); } } } else if (command instanceof IncreaseDecreaseType) { if (IncreaseDecreaseType.INCREASE.equals(command)) { sendCommandAndUpdateChannel(currentValue + step); } else { sendCommandAndUpdateChannel(currentValue - step); } } } else { logger.debug("Command sent to an unknown channel id: {}", channelUID); } }
Source:
<code>public static void assertDateIsNow(Date date) { assertDateWithinRange(date, new Date(new Date().getTime() - (1000 * 60)), <START> new Date(new Date().getTime() + (1000 * 60))); <END> }</code><technical_language>if is a utility method (in a helper class) for dates/times offset</technical_language>

Target:
public static void assertDateIsNow(Date date) { assertDateWithinRange(date, TimeHelper.getMsOffsetToCurrentTime(-1000 * 60), TimeHelper.getMsOffsetToCurrentTime(1000 * 60)); }
Source:
<code><START> public void projectClosed() { <END> SonarQubeNotifications.get().remove(eventListener); }</code><technical_language>I move this next projectOpened, I easier read symmetric operations close other</technical_language>

Target:
public void projectClosed() { unregister(); }
Source:
<code>public void afterPropertiesSet() throws Exception { try { this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class); } catch (NoUniqueBeanDefinitionException ex) { throw new BeanCreationNotAllowedException(this.name, "Only one 'PublisherAnnotationBeanPostProcessor' bean can be defined in the application context." + <START> " Consider do not use '@EnablePublisher' (or '<int:enable-publisher>') if you declare" + <END> " 'PublisherAnnotationBeanPostProcessor' bean definition manually. " + "Bean names found: " + ex.getBeanNamesFound()); } }</code><technical_language>Do '@EnablePublisher' (or '<int:enable-publisher>') if declare a</technical_language>

Target:
public void afterPropertiesSet() throws Exception { try { this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class); } catch (NoUniqueBeanDefinitionException ex) { throw new BeanCreationNotAllowedException(this.name, "Only one 'PublisherAnnotationBeanPostProcessor' bean can be defined in the application context." + " Do not use '@EnablePublisher' (or '<int:enable-publisher>') if you declare a" + " 'PublisherAnnotationBeanPostProcessor' bean definition manually. " + "Bean names found: " + ex.getBeanNamesFound()); } }
Source:
<code><START> private void ensureLoaded() { <END> if (!loaded) { for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, AtsUtilCore.getAtsBranch())) { User user = (User) art; AtsUser atsUser = new AtsUser(user); userIdToAtsUser.put(user.getUserId(), atsUser); nameToAtsUser.put(user.getName(), atsUser); } loaded = true; } }</code><technical_language>this method synchronized</technical_language>

Target:
protected synchronized void ensureLoaded() { if (!loaded) { for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, AtsUtilCore.getAtsBranch())) { User user = (User) art; AtsUser atsUser = new AtsUser(user); userIdToAtsUser.put(user.getUserId(), atsUser); nameToAtsUser.put(user.getName(), atsUser); } loaded = true; } }
Source:
<code>public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutput output) { PluginTask task = taskSource.loadTask(PluginTask.class); final boolean stopOnInvalidRecord = task.getStopOnInvalidRecord(); final Column column = schema.getColumn(0); try (PageBuilder pageBuilder = newPageBuilder(schema, output); <START> FileInputInputStream in = new FileInputInputStream(input)) { <END> while (in.nextFile()) { try (JsonParser.Stream stream = newJsonStream(in, task)) { Value value; while ((value = stream.next()) != null) { try { if (!value.isMapValue()) { throw new JsonRecordValidateException( String.format("A Json record must not represent map value but it's %s", value.getValueType().name())); } pageBuilder.setJson(column, value); pageBuilder.addRecord(); } catch (JsonRecordValidateException e) { if (stopOnInvalidRecord) { throw new DataException(String.format("Invalid record: %s", value.toJson()), e); } log.warn(String.format("Skipped record (%s): %s", e.getMessage(), value.toJson())); } } } catch (IOException | JsonParseException e) { throw new DataException(e); } } pageBuilder.finish(); } }</code><technical_language>get this -- changes unrelated this topic</technical_language>

Target:
public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutput output) { PluginTask task = taskSource.loadTask(PluginTask.class); final boolean stopOnInvalidRecord = task.getStopOnInvalidRecord(); final Column column = schema.getColumn(0); try (PageBuilder pageBuilder = newPageBuilder(schema, output); FileInputInputStream in = new FileInputInputStream(input)) { while (in.nextFile()) { boolean evenOneJsonParsed = false; try (JsonParser.Stream stream = newJsonStream(in, task)) { Value value; while ((value = stream.next()) != null) { try { if (!value.isMapValue()) { throw new JsonRecordValidateException( String.format("A Json record must not represent map value but it's %s", value.getValueType().name())); } pageBuilder.setJson(column, value); pageBuilder.addRecord(); evenOneJsonParsed = true; } catch (JsonRecordValidateException e) { if (stopOnInvalidRecord) { throw new DataException(String.format("Invalid record: %s", value.toJson()), e); } log.warn(String.format("Skipped record (%s): %s", e.getMessage(), value.toJson())); } } } catch (IOException | JsonParseException e) { if (Exec.isPreview() && evenOneJsonParsed) { break; } throw new DataException(e); } } pageBuilder.finish(); } }
Source:
<code>public JdbcPrestoAction( SqlExceptionClassifier exceptionClassifier, BenchmarkQuery benchmarkQuery, PrestoClusterConfig prestoClusterConfig, Map<String, String> sessionProperties, RetryConfig networkRetryConfig) { this.exceptionClassifier = requireNonNull(exceptionClassifier, "exceptionClassifier is null"); this.benchmarkQuery = requireNonNull(benchmarkQuery, "benchmarkQuery is null"); this.jdbcUrl = requireNonNull(prestoClusterConfig.getJdbcUrl(), "jdbcUrl is null"); this.queryTimeout = requireNonNull(prestoClusterConfig.getQueryTimeout(), "queryTimeout is null"); this.sessionProperties = ImmutableMap.copyOf(sessionProperties); this.networkRetry = new RetryDriver( networkRetryConfig, <START> exception -> (exception instanceof QueryException) ? (((QueryException) exception).getType() == CLUSTER_CONNECTION) : FALSE); <END> }</code><technical_language>Java exception instanceof QueryException && ((QueryException) exception).getType == CLUSTER_CONNECTION;</technical_language>

Target:
public JdbcPrestoAction( SqlExceptionClassifier exceptionClassifier, BenchmarkQuery benchmarkQuery, PrestoClusterConfig prestoClusterConfig, Map<String, String> sessionProperties, RetryConfig networkRetryConfig) { this.exceptionClassifier = requireNonNull(exceptionClassifier, "exceptionClassifier is null"); this.benchmarkQuery = requireNonNull(benchmarkQuery, "benchmarkQuery is null"); this.jdbcUrl = requireNonNull(prestoClusterConfig.getJdbcUrl(), "jdbcUrl is null"); this.queryTimeout = requireNonNull(prestoClusterConfig.getQueryTimeout(), "queryTimeout is null"); this.sessionProperties = ImmutableMap.copyOf(sessionProperties); this.networkRetry = new RetryDriver( networkRetryConfig, (exception) -> exception instanceof QueryException && (((QueryException) exception).getType() == CLUSTER_CONNECTION)); }