auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ValueMatcher makeMatcher( BitmapIndexSelector selector, ValueMatcherFactory valueMatcherFactory, RowOffsetMatcherFactory rowOffsetMatcherFactory ) { final List<ValueMatcher> offsetMatchers = new ArrayList<>(); final List<ValueMatcher> valueMatchers = new ArrayList<>(); for (Filter filter : filters) { ValueMatcher matcher = filter.makeMatcher(selector, valueMatcherFactory, rowOffsetMatcherFactory); if (filter.supportsBitmapIndex(selector)) { <START> offsetMatchers.add(matcher); <END> } else { valueMatchers.add(matcher); } } return new ValueMatcher() { @Override public boolean matches() { for (ValueMatcher offsetMatcher : offsetMatchers) { if (!offsetMatcher.matches()) { return false; } } for (ValueMatcher valueMatcher : valueMatchers) { if (!valueMatcher.matches()) { return false; } } return true; } }; }</code><technical_language>wondering if do a bitmap intersection of multiple bitmap offsetMatchers well</technical_language>

Target:
public ValueMatcher makeMatcher( BitmapIndexSelector selector, ValueMatcherFactory valueMatcherFactory, RowOffsetMatcherFactory rowOffsetMatcherFactory ) { final List<ValueMatcher> matchers = new ArrayList<>(); final List<ImmutableBitmap> bitmaps = new ArrayList<>(); for (Filter filter : filters) { if (filter.supportsBitmapIndex(selector)) { bitmaps.add(filter.getBitmapIndex(selector)); } else { ValueMatcher matcher = filter.makeMatcher(valueMatcherFactory); matchers.add(matcher); } } if (bitmaps.size() > 0) { ImmutableBitmap combinedBitmap = selector.getBitmapFactory().intersection(bitmaps); ValueMatcher offsetMatcher = rowOffsetMatcherFactory.makeRowOffsetMatcher(combinedBitmap); matchers.add(0, offsetMatcher); } return new ValueMatcher() { @Override public boolean matches() { for (ValueMatcher valueMatcher : matchers) { if (!valueMatcher.matches()) { return false; } } return true; } }; }
Source:
<code>private void addStyling(@NonNull List<Point> pointList) { if (mapboxMap.getStyle() != null) { Style loadedStyle = mapboxMap.getStyle(); List<LineString> innerList = new ArrayList<>(); innerList.add(LineString.fromLngLats(pointList)); List<List<Point>> megaInnerList = new ArrayList<>(); megaInnerList.add(pointList); <START> loadedStyle.addSource(new GeoJsonSource(FILL_SOURCE_ID, <END> Polygon.fromOuterInner(LineString.fromLngLats(OUTER_POLYGON_COORDINATES), innerList))); loadedStyle.addSource(new GeoJsonSource(LINE_SOURCE_ID, Polygon.fromLngLats(megaInnerList))); loadedStyle.addLayerBelow(new FillLayer(FILL_LAYER_ID, FILL_SOURCE_ID).withProperties( fillColor(GREY_COLOR), fillOpacity(FILL_OPACITY)), "road-street"); loadedStyle.addLayer(new LineLayer(LINE_LAYER_ID, LINE_SOURCE_ID).withProperties( lineColor(RED_COLOR), lineWidth(LINE_WIDTH), lineCap(Property.LINE_CAP_ROUND), lineJoin(Property.LINE_JOIN_ROUND) )); mapboxMap.animateCamera( CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .zoom(11) .build()), 3000); } }</code><technical_language>loadedStyle object for if-check, preferably OnStyleLoaded listener</technical_language>

Target:
private void addStyling(@NonNull List<Point> pointList) { mapboxMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style loadedStyle) { List<LineString> innerList = new ArrayList<>(); LineString innerLineString = LineString.fromLngLats(pointList); innerList.add(innerLineString); loadedStyle.addSource(new GeoJsonSource(FILL_SOURCE_ID, Polygon.fromOuterInner(LineString.fromLngLats(OUTER_POLYGON_COORDINATES), innerList))); loadedStyle.addSource(new GeoJsonSource(LINE_SOURCE_ID, innerLineString)); loadedStyle.addLayerBelow(new FillLayer(FILL_LAYER_ID, FILL_SOURCE_ID).withProperties( fillColor(GREY_COLOR), fillOpacity(FILL_OPACITY)), "road-street"); loadedStyle.addLayer(new LineLayer(LINE_LAYER_ID, LINE_SOURCE_ID).withProperties( lineColor(RED_COLOR), lineWidth(LINE_WIDTH), lineCap(Property.LINE_CAP_ROUND), lineJoin(Property.LINE_JOIN_ROUND) )); } }); }
Source:
<code>public void nullWriteTest() throws Exception { String fname="~benchmark::all_types::200kb"; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); file.setProjectList(""); List<HPCCRecord> records = readFile(file); assertEquals( "Record count mismatch for dataset:" + fname + ". got: " + records.size() + " expected:" + 5600,5600,records.size()); HPCCRecord first = records.get(0); for (int f = 0; f < first.getNumFields(); f++) { first.setField(f, null); } String copyFileName = fname + "_copy"; writeFile(records, copyFileName, file.getProjectedRecordDefinition()); file = new HPCCFile(copyFileName, connString, hpccUser, hpccPass); records = readFile(file); assertEquals( "Record count mismatch for dataset:" + copyFileName + ". got: " + records.size() + " expected:" + 5600,5600,records.size()); HPCCRecord rec0 = records.get(0); <START> for (int i = 0; i < rec0.getNumFields(); i++) { <END> Object field = rec0.getField(0); if (field instanceof Long) { assertEquals((Long) field, new Long(0)); } else if (field instanceof Double) { assertEquals((Double) field, new Double(0.0)); } else if (field instanceof Boolean) { assertEquals((Boolean) field, new Boolean(false)); } else if (field instanceof String) { assertEquals((String) field, ""); } else if (field instanceof BigDecimal) { assertEquals(((BigDecimal) field).intValue(),0); } else if (field instanceof List) { assertEquals(((List) field).size(),0); } } }</code><technical_language>format</technical_language>

Target:
public void nullWriteTest() throws Exception { String fname = datasets[1]; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); file.setProjectList(""); List<HPCCRecord> records = readFile(file); assertEquals( "Record count mismatch for dataset:" + fname + ". got: " + records.size() + " expected:" + expectedCounts[1],expectedCounts[1],records.size()); HPCCRecord first = records.get(0); for (int f = 0; f < first.getNumFields(); f++) { first.setField(f, null); } String copyFileName = fname + "_copy"; writeFile(records, copyFileName, file.getProjectedRecordDefinition()); file = new HPCCFile(copyFileName, connString, hpccUser, hpccPass); records = readFile(file); assertEquals( "Record count mismatch for dataset:" + copyFileName + ". got: " + records.size() + " expected:" + 5600,5600,records.size()); HPCCRecord rec0 = records.get(0); for (int i = 0; i < rec0.getNumFields(); i++) { Object field = rec0.getField(0); if (field instanceof Long) { assertEquals((Long) field, new Long(0)); } else if (field instanceof Double) { assertEquals((Double) field, new Double(0.0)); } else if (field instanceof Boolean) { assertEquals((Boolean) field, new Boolean(false)); } else if (field instanceof String) { assertEquals((String) field, ""); } else if (field instanceof BigDecimal) { assertEquals(((BigDecimal) field).intValue(),0); } else if (field instanceof List) { assertEquals(((List) field).size(),0); } } }
Source:
<code>public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId) { rmId = (rmId == null) ? "" : ("." + rmId); InetSocketAddress address; if (sslEnabled) { address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT); } else { address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_PORT); } LOG.info("rm webapp address setting {}", address); LOG.debug("rm setting sources {}", conf.getPropertySources(YarnConfiguration.RM_WEBAPP_ADDRESS)); address = NetUtils.getConnectAddress(address); InetAddress resolved = address.getAddress(); if (resolved == null || resolved.isAnyLocalAddress() || resolved.isLoopbackAddress()) { try { <START> address = new InetSocketAddress(InetAddress.getLocalHost(), address.getPort()); <END> } catch (UnknownHostException e) { } } return address; }</code><technical_language>For local address need canonical hostname</technical_language>

Target:
public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId) { rmId = (rmId == null) ? "" : ("." + rmId); InetSocketAddress address; if (sslEnabled) { address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT); } else { address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_PORT); } LOG.info("rm webapp address setting {}", address); LOG.debug("rm setting sources {}", conf.getPropertySources(YarnConfiguration.RM_WEBAPP_ADDRESS)); InetSocketAddress resolvedSocketAddress = NetUtils.getConnectAddress(address); InetAddress resolved = resolvedSocketAddress.getAddress(); if (resolved == null || resolved.isAnyLocalAddress() || resolved.isLoopbackAddress()) { try { resolvedSocketAddress = InetSocketAddress.createUnresolved(InetAddress.getLocalHost().getCanonicalHostName(), address.getPort()); } catch (UnknownHostException e) { } } return resolvedSocketAddress; }
Source:
<code>public Config getConfig() { try { InputStream in = new FileInputStream(path); Properties props = new Properties(); props.load(in); in.close(); LOG.debug("got config from config {}", props, path); return new MapConfig(props); } catch (IOException e) { <START> throw new SamzaException("Failed to read from"); <END> } }</code><technical_language>this full exception message intended? meant include path in there</technical_language>

Target:
public Config getConfig() { try { InputStream in = new FileInputStream(path); Properties props = new Properties(); props.load(in); in.close(); LOG.debug("got config from path {}", props, path); Map<String, String> config = new HashMap<>(props.size()); props.forEach((key, value) -> config.put(key.toString(), value.toString())); return new MapConfig(config); } catch (IOException e) { throw new SamzaException("Failed to read from " + path); } }
Source:
<code>protected AxonServerConnectionManager(Builder builder) { builder.validate(); this.axonServerConfiguration = builder.axonServerConfiguration; this.tagsConfiguration = builder.tagsConfiguration; this.scheduler = builder.scheduler; <START> onOutboundInstruction(NODE_NOTIFICATION, <END> instruction -> logger.debug("Received: {}", instruction.getNodeNotification())); handlers.register(RESULT, (instruction, stream) -> logger .trace("Received instruction result {}.", instruction.getResult())); }</code><technical_language>calling a deprecated operation here. Change handers.register</technical_language>

Target:
protected AxonServerConnectionManager(Builder builder) { builder.validate(); this.axonServerConfiguration = builder.axonServerConfiguration; this.tagsConfiguration = builder.tagsConfiguration; this.scheduler = builder.scheduler; this.requestStreamFactory = builder.requestStreamFactory; this.instructionAckSource = builder.instructionAckSource; onOutboundInstruction(NODE_NOTIFICATION, (instruction, stream) -> logger.debug("Received: {}", instruction.getNodeNotification())); handlers.register(ACK, (instruction, stream) -> { if (isUnsupportedInstructionErrorAck(instruction.getAck())) { logger.warn("Unsupported instruction sent to the server. {}", instruction.getAck()); } else { logger.trace("Received instruction ack {}.", instruction.getAck()); } }); }
Source:
<code>public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.writeEndObject(); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == FIELD_NAME) { jg.copyCurrentStructure(parser); } if (parser.currentToken() != END_OBJECT) { log.error("Enricher: failed on current token: {}, output to write: {}", name, <START> parser.currentToken(), MAPPER.readTree(tb.asParser())); <END> } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("Enricher failed", name, e); } } }</code><technical_language>try/catch readTree call</technical_language>

Target:
public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.writeEndObject(); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == FIELD_NAME) { jg.copyCurrentStructure(parser); } if (parser.currentToken() != END_OBJECT) { log.error("Enricher: failed on current token: {}, output to write: {}", name::toString, parser::currentToken, () -> safeReadBuffer(tb)); } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("Enricher: failed", name, e); } } }
Source:
<code>public void initializeHardDeleteMetric(final HardDeleter hardDeleter, final Log log) { currentHardDeleteProgress = new Gauge<Long>() { @Override public Long getValue() { return hardDeleter.getProgress(); } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "CurrentHardDeleteProgress"), currentHardDeleteProgress); percentageHardDeleteCompleted = new Gauge<Double>() { @Override public Double getValue() { return ((double) hardDeleter.getProgress() / log.getLogEndOffset()) * 100; } }; registry.register(MetricRegistry.name(Log.class, name + "PercentageHardDeleteCompleted"), percentageHardDeleteCompleted); hardDeleteThreadRunning = new Gauge<Long>() { @Override public Long getValue() { <START> return hardDeleter.hardDeleteThreadRunning() ? 1L : 0L; <END> } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "HardDeleteThreadRunning"), hardDeleteThreadRunning); hardDeleteCaughtUp = new Gauge<Long>() { @Override public Long getValue() { return hardDeleter.isCaughtUp() ? 1L : 0L; } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "HardDeleteCaughtUp"), hardDeleteCaughtUp); }</code><technical_language>this method called isRunning() now</technical_language>

Target:
public void initializeHardDeleteMetric(final HardDeleter hardDeleter, final Log log) { currentHardDeleteProgress = new Gauge<Long>() { @Override public Long getValue() { return hardDeleter.getProgress(); } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "CurrentHardDeleteProgress"), currentHardDeleteProgress); percentageHardDeleteCompleted = new Gauge<Double>() { @Override public Double getValue() { return ((double) hardDeleter.getProgress() / log.getLogEndOffset()) * 100; } }; registry.register(MetricRegistry.name(Log.class, name + "PercentageHardDeleteCompleted"), percentageHardDeleteCompleted); hardDeleteThreadRunning = new Gauge<Long>() { @Override public Long getValue() { return hardDeleter.isRunning() ? 1L : 0L; } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "HardDeleteThreadRunning"), hardDeleteThreadRunning); hardDeleteCaughtUp = new Gauge<Long>() { @Override public Long getValue() { return hardDeleter.isCaughtUp() ? 1L : 0L; } }; registry.register(MetricRegistry.name(PersistentIndex.class, name + "HardDeleteCaughtUp"), hardDeleteCaughtUp); }
Source:
<code>public Iterable<EntryKey> list() { <START> ImmutableSet.Builder<EntryKey> result = ImmutableSet.builder(); <END> for (String section : sec.getSections()) { for (String subsection : sec.getSubsections(section)) { for (String name : sec.getNames(section, subsection)) { result.add(new EntryKey(section, subsection, name)); } } for (String name : sec.getNames(section)) { result.add(new EntryKey(section, null, name)); } } return result.build(); }</code><technical_language>Do need ImmutableSet do need a Set here? of set EntryKey implement equals/hashCode ... need is iterate entries a List<EntryKey> enough</technical_language>

Target:
public Iterable<EntryKey> list() { List<EntryKey> result = new ArrayList<>(); for (String section : sec.getSections()) { for (String subsection : sec.getSubsections(section)) { for (String name : sec.getNames(section, subsection)) { result.add(new EntryKey(section, subsection, name)); } } for (String name : sec.getNames(section)) { result.add(new EntryKey(section, null, name)); } } return result; }
Source:
<code>private void validateNumSegments(Map<ServerInstance, List<String>> offlineRoutingTable, Map<ServerInstance, List<String>> realtimeRoutingTable, int querySegmentLimit) { <START> int numOffline = offlineRoutingTable == null ? 0 : offlineRoutingTable.values().stream().mapToInt(List::size).sum(); <END> int numRealtime = realtimeRoutingTable == null ? 0 : realtimeRoutingTable.values().stream().mapToInt(List::size).sum(); int numSegments = numOffline + numRealtime; if (numSegments > querySegmentLimit) { throw new IllegalStateException(String.format("Query exceeds segment limit of %d", querySegmentLimit)); } }</code><technical_language>Avoid stream api for performance concern</technical_language>

Target:
private void validateNumSegments(Map<ServerInstance, List<String>> offlineRoutingTable, Map<ServerInstance, List<String>> realtimeRoutingTable, int querySegmentLimit) { if (_querySegmentLimit > 0) { int numOffline = offlineRoutingTable == null ? 0 : offlineRoutingTable.values().stream().mapToInt(List::size).sum(); int numRealtime = realtimeRoutingTable == null ? 0 : realtimeRoutingTable.values().stream().mapToInt(List::size).sum(); int numSegments = numOffline + numRealtime; if (numSegments > querySegmentLimit) { throw new IllegalStateException(String.format("Query exceeds segment limit of %d", querySegmentLimit)); } } }
Source:
<code>public void accept(String json, Context context) throws RuntimeException { JsonObject body = gsonParser.fromJson(json, JsonObject.class); JsonObject fields = body.getAsJsonObject("value").getAsJsonObject("fields"); if (!fields.has("original")) { return; } String currentValue = fields.getAsJsonObject("original").get("stringValue").getAsString(); String newValue = currentValue.toUpperCase(); Map<String, String> newFields = new HashMap<>(); newFields.put("original", newValue); String affectedDoc = context.resource().split("/documents/")[1].replace("\"", ""); LOGGER.info(String.format("Replacing value: %s --> %s", currentValue, newValue)); try { firestore.document(affectedDoc).set(newFields, SetOptions.merge()).get(); <START> } catch (Exception e) { throw new RuntimeException(e); } <END> }</code><technical_language>do bother this? bother catching try if do useful it. automatically propagate parent</technical_language>

Target:
public void accept(String json, Context context) throws RuntimeException { JsonObject body = gsonParser.fromJson(json, JsonObject.class); JsonObject tempJson = body.getAsJsonObject("value"); String currentValue = null; if (tempJson != null) { tempJson = tempJson.getAsJsonObject("fields"); } if (tempJson != null) { tempJson = tempJson.getAsJsonObject("original"); } if (tempJson != null && tempJson.has("stringValue")) { currentValue = tempJson.get("stringValue").getAsString(); } if (currentValue == null) { throw new IllegalArgumentException("Malformed JSON"); } String newValue = currentValue.toUpperCase(); Map<String, String> newFields = new HashMap<>(); newFields.put("original", newValue); String affectedDoc = context.resource().split("/documents/")[1].replace("\"", ""); LOGGER.info(String.format("Replacing value: %s --> %s", currentValue, newValue)); try { firestore.document(affectedDoc).set(newFields, SetOptions.merge()).get(); } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); } }
Source:
<code><START> private void unit1() { <END> when(unit1.getType()).thenReturn(mockUnit1Type); when(mockUnit1Type.getAttachment(anyString())).thenReturn(mockUnit1Attachment); }</code><technical_language>Explicit input/output of test setup methods for more explicit unit tests. This method for example possibly changed to: private Unit givenUnitWithAttachment(UnitAttachment unitAttachment) { Unit unit = mock(Unit.class); UnitType unitType = mock(UnitType.class); when(unit.getType).thenReturn(unitType); when(unitType.getAttachment(anyString()).thenReturn(unitAttachment); return unit; } a test, for this, a bit more self-contained, eg: players(); attackerRetreat(); Unit unit1 = givenUnitWithAttachment(mockUnit1Attachment); unit2(); final List<String> steps = getStepBuilder() .attackingUnits(List.of(unit1)) .defendingUnits(List.of(unit2)) .isBattleSiteWater(false) .build() .get(); In above, pretty clear usage of 'unitAttachment' is a side-effect somewhere. pattern eventually unitAttachment a parameter a return of some setup method, is configured (which test a bit more self-explanatory self-contained). WDYT of this approach</technical_language>

Target:
private void unit1() { when(unit1.getType()).thenReturn(unit1Type); when(unit1Type.getAttachment(anyString())).thenReturn(unit1Attachment); }
Source:
<code>private boolean parseUrl( HttpChunkedResponseSocket socket, HttpRequestHeader request, TextQueryProcessorState state ) throws PeerDisconnectedException, PeerIsSlowToReadException { final DirectByteCharSequence query = request.getUrlParam("query"); if (query == null || query.length() == 0) { info(state).$("Empty query request received. Sending empty reply.").$(); sendException(socket, 0, "No query text", 400, state.query); return false; } long skip = 0; long stop = Long.MAX_VALUE; CharSequence limit = request.getUrlParam("limit"); if (limit != null) { int sepPos = Chars.indexOf(limit, ','); try { if (sepPos > 0) { skip = Numbers.parseLong(limit, 0, sepPos); if (sepPos + 1 < limit.length()) { stop = Numbers.parseLong(limit, sepPos + 1, limit.length()); } } else { stop = Numbers.parseLong(limit); } } catch (NumericException ex) { } } if (stop < 0) { stop = 0; } if (skip < 0) { skip = 0; } <START> if (configuration.getMaxQueryResponseRowLimit() != Long.MAX_VALUE && (stop - skip) > configuration.getMaxQueryResponseRowLimit()) { <END> stop = skip + configuration.getMaxQueryResponseRowLimit(); } state.query.clear(); try { TextUtil.utf8Decode(query.getLo(), query.getHi(), state.query); } catch (Utf8Exception e) { info(state).$("Bad UTF8 encoding").$(); sendException(socket, 0, "Bad UTF8 encoding in query text", 400, state.query); return false; } state.skip = skip; state.count = 0L; state.stop = stop; state.noMeta = Chars.equalsNc("true", request.getUrlParam("nm")); state.countRows = Chars.equalsNc("true", request.getUrlParam("count")); return true; }</code><technical_language>comparison MAX_VALUE redundant</technical_language>

Target:
private boolean parseUrl( HttpChunkedResponseSocket socket, HttpRequestHeader request, TextQueryProcessorState state ) throws PeerDisconnectedException, PeerIsSlowToReadException { final DirectByteCharSequence query = request.getUrlParam("query"); if (query == null || query.length() == 0) { info(state).$("Empty query request received. Sending empty reply.").$(); sendException(socket, 0, "No query text", 400, state.query); return false; } long skip = 0; long stop = Long.MAX_VALUE; CharSequence limit = request.getUrlParam("limit"); if (limit != null) { int sepPos = Chars.indexOf(limit, ','); try { if (sepPos > 0) { skip = Numbers.parseLong(limit, 0, sepPos); if (sepPos + 1 < limit.length()) { stop = Numbers.parseLong(limit, sepPos + 1, limit.length()); } } else { stop = Numbers.parseLong(limit); } } catch (NumericException ex) { } } if (stop < 0) { stop = 0; } if (skip < 0) { skip = 0; } if ((stop - skip) > configuration.getMaxQueryResponseRowLimit()) { stop = skip + configuration.getMaxQueryResponseRowLimit(); } state.query.clear(); try { TextUtil.utf8Decode(query.getLo(), query.getHi(), state.query); } catch (Utf8Exception e) { info(state).$("Bad UTF8 encoding").$(); sendException(socket, 0, "Bad UTF8 encoding in query text", 400, state.query); return false; } state.skip = skip; state.count = 0L; state.stop = stop; state.noMeta = Chars.equalsNc("true", request.getUrlParam("nm")); state.countRows = Chars.equalsNc("true", request.getUrlParam("count")); return true; }
Source:
<code>public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> authorities) { Set<MisoAuthority> roles = EnumSet.noneOf(MisoAuthority.class); for (GrantedAuthority a : authorities) { <START> if ((rolePrefix + "ROLE_ADMIN").equals(a.getAuthority())) { <END> roles.add(MisoAuthority.ROLE_ADMIN); } else if ((rolePrefix + "ROLE_INTERNAL").equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_INTERNAL); } else if ((rolePrefix + "ROLE_EXTERNAL").equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_EXTERNAL); } } return roles; }</code><technical_language>MisoAuthority values instead of String role names</technical_language>

Target:
public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> authorities) { Set<MisoAuthority> roles = EnumSet.noneOf(MisoAuthority.class); for (GrantedAuthority a : authorities) { if ((rolePrefix + MisoAuthority.ROLE_ADMIN).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_ADMIN); } else if ((rolePrefix + MisoAuthority.ROLE_INTERNAL).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_INTERNAL); } else if ((rolePrefix + MisoAuthority.ROLE_EXTERNAL).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_EXTERNAL); } } return roles; }
Source:
<code><START> void addLayer(Layer layer,String style) { <END> this.layers.add(layer); this.styles.add(style); if (srsName == null) { for(String srs : layer.getBoundingBoxes().keySet()) { try { CRS.decode(srs); srsName = srs; break; } catch(Exception e) { } } if(srsName == null) { if (layer.getSrs().contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = layer.getSrs().iterator().next(); } } validSRS = layer.getSrs(); } else { Set<String> intersection = new HashSet<String>(validSRS); intersection.retainAll(layer.getSrs()); if (!intersection.contains(srsName)) { if (intersection.size() == 0) { throw new IllegalArgumentException("The layer being appended does " + "not have any SRS in common with the ones already " + "included in the WMS request, cannot be merged"); } else if (intersection.contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = intersection.iterator().next(); } this.validSRS = intersection; } } CoordinateReferenceSystem crs = null; try { crs = CRS.decode(srsName); } catch (Exception e) { LOGGER.log(Level.FINE, "Bounds unavailable for layer" + layer); } this.crs = crs; updateBounds(); }</code><technical_language>White line methods</technical_language>

Target:
void addLayer(Layer layer, String style) { this.layers.add(new LayerStyle(layer, style)); if (srsName == null) { for (String srs : layer.getBoundingBoxes().keySet()) { try { CRS.decode(srs); srsName = srs; break; } catch (Exception e) { } } if (srsName == null) { if (layer.getSrs().contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = layer.getSrs().iterator().next(); } } validSRS = layer.getSrs(); } else { Set<String> intersection = new HashSet<String>(validSRS); intersection.retainAll(layer.getSrs()); if (!intersection.contains(srsName)) { if (intersection.size() == 0) { throw new IllegalArgumentException("The layer being appended does " + "not have any SRS in common with the ones already " + "included in the WMS request, cannot be merged"); } else if (intersection.contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = intersection.iterator().next(); } this.validSRS = intersection; } } CoordinateReferenceSystem crs = null; try { crs = CRS.decode(srsName); } catch (Exception e) { LOGGER.log(Level.FINE, "Bounds unavailable for layer" + layer); } this.crs = crs; updateBounds(); }
Source:
<code>public static Collection<String> names(Collection<ConfigInfo> infos) { <START> if (infos.isEmpty()) { <END> return Collections.emptyList(); } return Lists.newArrayList(Iterables.transform(infos, new Function<ConfigInfo, String>() { @Override public String apply(ConfigInfo info) { return info.name(); } })); }</code><technical_language>I agree check for emptiness ideally need null checks, I do remove null checks guarantee infos is made. I suggest if (infos == null || infos.isEmpty()) || is cutting if infos is null check infos.isEmpty() performed. Please do similar for other places removed null check</technical_language>

Target:
public static Collection<String> names(Collection<ConfigInfo> infos) { if (infos == null || infos.isEmpty()) { return Collections.emptyList(); } return Lists.newArrayList(Iterables.transform(infos, new Function<ConfigInfo, String>() { @Override public String apply(ConfigInfo info) { return info.name(); } })); }
Source:
<code>public void onBindViewHolder(ThumbnailViewHolder holder, int position) { PhotoChooserItem item = getItemAtPosition(position); <START> int selectedIndex = mIsMultiSelectEnabled ? mSelectedUris.indexOfUri(item.uri) : -1; <END> if (selectedIndex > -1) { holder.txtSelectionCount.setVisibility(View.VISIBLE); holder.txtSelectionCount.setText(Integer.toString(selectedIndex + 1)); } else { holder.txtSelectionCount.setVisibility(View.GONE); } float scale = selectedIndex > -1 ? SCALE_SELECTED : SCALE_NORMAL; if (holder.imgThumbnail.getScaleX() != scale) { holder.imgThumbnail.setScaleX(scale); holder.imgThumbnail.setScaleY(scale); } holder.videoOverlay.setVisibility(item.isVideo ? View.VISIBLE : View.GONE); mThumbnailLoader.loadThumbnail(holder.imgThumbnail, item._id, item.isVideo); }</code><technical_language>check item is null accessing (and a call AppLog if is)</technical_language>

Target:
public void onBindViewHolder(ThumbnailViewHolder holder, int position) { PhotoChooserItem item = getItemAtPosition(position); if (item == null) { return; } int selectedIndex = mIsMultiSelectEnabled ? mSelectedUris.indexOfUri(item.uri) : -1; if (selectedIndex > -1) { holder.txtSelectionCount.setVisibility(View.VISIBLE); holder.txtSelectionCount.setText(Integer.toString(selectedIndex + 1)); } else { holder.txtSelectionCount.setVisibility(View.GONE); } float scale = selectedIndex > -1 ? SCALE_SELECTED : SCALE_NORMAL; if (holder.imgThumbnail.getScaleX() != scale) { holder.imgThumbnail.setScaleX(scale); holder.imgThumbnail.setScaleY(scale); } holder.videoOverlay.setVisibility(item.isVideo ? View.VISIBLE : View.GONE); mThumbnailLoader.loadThumbnail(holder.imgThumbnail, item._id, item.isVideo); }
Source:
<code>public AboutDialogE4(final Shell parentShell) { super(parentShell); <START> product = new ProductInformation(Platform.getProduct()); <END> }</code><technical_language>need Optional.ofNullable(Plaform.getProduct())</technical_language>

Target:
public AboutDialogE4(final Shell parentShell) { super(parentShell); product = new ProductInformation(Optional.ofNullable(Platform.getProduct())); }
Source:
<code>public NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, NotificationFilter filter) throws TException { NotificationEventRequest rqst = new NotificationEventRequest(lastEventId); rqst.setMaxEvents(maxEvents); NotificationEventResponse rsp = client.get_next_notification(rqst); LOG.debug("Got back " + rsp.getEventsSize() + " events"); NotificationEventResponse filtered = new NotificationEventResponse(); if (rsp != null && rsp.getEvents() != null) { long nextEventId = lastEventId + 1; for (NotificationEvent e : rsp.getEvents()) { if (e.getEventId() != nextEventId) { LOG.warn("Requested events are found missing in NOTIFICATION_LOG table. " + "Probably, cleaner would've cleaned it up. " + "Try setting higher value for hive.metastore.event.db.listener.timetolive. " + "Also, bootstrap the system again to get back the consistent replicated state."); throw new IllegalStateException("Notification events are missing."); } if ((filter != null) && filter.accept(e)) { filtered.addToEvents(e); <START> } <END> nextEventId++; } } return (filter != null) ? filtered : rsp; }</code><technical_language>need do this change in HiveMetaStoreClientPreCatalog class</technical_language>

Target:
public NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, NotificationFilter filter) throws TException { NotificationEventRequest rqst = new NotificationEventRequest(lastEventId); rqst.setMaxEvents(maxEvents); NotificationEventResponse rsp = client.get_next_notification(rqst); LOG.debug("Got back " + rsp.getEventsSize() + " events"); NotificationEventResponse filtered = new NotificationEventResponse(); if (rsp != null && rsp.getEvents() != null) { long nextEventId = lastEventId + 1; for (NotificationEvent e : rsp.getEvents()) { if (e.getEventId() != nextEventId) { LOG.error("Requested events are found missing in NOTIFICATION_LOG table. Expected: {}, Actual: {}. " + "Probably, cleaner would've cleaned it up. " + "Try setting higher value for hive.metastore.event.db.listener.timetolive. " + "Also, bootstrap the system again to get back the consistent replicated state.", nextEventId, e.getEventId()); throw new IllegalStateException("Notification events are missing."); } if ((filter != null) && filter.accept(e)) { filtered.addToEvents(e); } nextEventId++; } } return (filter != null) ? filtered : rsp; }
Source:
<code>public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode); final IConnector connector = ConnectorFactory.getConnector(geoCode); if (!(connector instanceof OCApiConnector)) { return null; } final OCApiConnector ocapiConn = (OCApiConnector) connector; params.add("fields", getFullFields(ocapiConn)); params.add("attribution_append", "none"); <START> final JSONObject data = request(ocapiConn, OkapiService.SERVICE_CACHE, params).data; <END> if (data == null) { return null; } return parseCache(data); }</code><technical_language>cases request return null. end a NullPointerException</technical_language>

Target:
public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode); final IConnector connector = ConnectorFactory.getConnector(geoCode); if (!(connector instanceof OCApiConnector)) { return null; } final OCApiConnector ocapiConn = (OCApiConnector) connector; params.add("fields", getFullFields(ocapiConn)); params.add("attribution_append", "none"); final JSONResult result = request(ocapiConn, OkapiService.SERVICE_CACHE, params); return result.isSuccess ? parseCache(result.data) : null; }
Source:
<code>protected int act(List<AbstractBuild<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); <START> final HashSet<Integer> hs_builds = new HashSet<Integer>(); <END> for (AbstractBuild build : builds) { if (!hs_builds.contains(build.number)) { build.delete(); hs_builds.add(build.number); } } stdout.println("Deleted "+hs_builds.size()+" builds"); return 0; }</code><technical_language>NIT: java (local) variables underscore is uncommon. Btw, IIUC, I remove prefix, buildSet instead</technical_language>

Target:
protected int act(List<AbstractBuild<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); final HashSet<Integer> hsBuilds = new HashSet<Integer>(); for (AbstractBuild build : builds) { if (!hsBuilds.contains(build.number)) { build.delete(); hsBuilds.add(build.number); } } stdout.println("Deleted "+hsBuilds.size()+" builds"); return 0; }
Source:
<code>public SettingsPanel(SettingsPanelForm form, BriefcasePreferences appPreferences, Analytics analytics, FormCache formCache) { this.form = form; appPreferences.getBriefcaseDir().ifPresent(path -> form.setStorageLocation(path.getParent())); appPreferences.getPullInParallel().ifPresent(form::setPullInParallel); appPreferences.getRememberPasswords().ifPresent(form::setRememberPasswords); appPreferences.getSendUsageData().ifPresent(form::setSendUsageData); appPreferences.getHttpProxy().ifPresent(httpProxy -> { form.enableUseHttpProxy(); form.setHttpProxy(httpProxy); form.updateHttpProxyFields(); }); form.onStorageLocation(path -> { Path briefcaseDir = BriefcasePreferences.buildBriefcaseDir(path); UncheckedFiles.createBriefcaseDir(briefcaseDir); formCache.setLocation(briefcaseDir); formCache.update(); appPreferences.setStorageDir(path); }, () -> { formCache.unsetLocation(); formCache.update(); appPreferences.unsetStorageDir(); }); form.onPullInParallelChange(appPreferences::setPullInParallel); form.onRememberPasswordsChange(appPreferences::setRememberPasswords); form.onSendUsageDataChange(enabled -> { appPreferences.setSendUsage(enabled); analytics.enableTracking(enabled, false); }); form.onHttpProxy(appPreferences::setHttpProxy, appPreferences::unsetHttpProxy); form.onReloadCache(() -> { formCache.update(); <START> JOptionPane.showMessageDialog(getContainer(), "Forms successfully reloaded from storage location.", "", JOptionPane.PLAIN_MESSAGE); <END> }); }</code><technical_language>consider APP_NAME argument instead of ""</technical_language>

Target:
public SettingsPanel(SettingsPanelForm form, BriefcasePreferences appPreferences, Analytics analytics, FormCache formCache) { this.form = form; appPreferences.getBriefcaseDir().ifPresent(path -> form.setStorageLocation(path.getParent())); appPreferences.getPullInParallel().ifPresent(form::setPullInParallel); appPreferences.getRememberPasswords().ifPresent(form::setRememberPasswords); appPreferences.getSendUsageData().ifPresent(form::setSendUsageData); appPreferences.getHttpProxy().ifPresent(httpProxy -> { form.enableUseHttpProxy(); form.setHttpProxy(httpProxy); form.updateHttpProxyFields(); }); form.onStorageLocation(path -> { Path briefcaseDir = BriefcasePreferences.buildBriefcaseDir(path); UncheckedFiles.createBriefcaseDir(briefcaseDir); formCache.setLocation(briefcaseDir); formCache.update(); appPreferences.setStorageDir(path); }, () -> { formCache.unsetLocation(); formCache.update(); appPreferences.unsetStorageDir(); }); form.onPullInParallelChange(appPreferences::setPullInParallel); form.onRememberPasswordsChange(appPreferences::setRememberPasswords); form.onSendUsageDataChange(enabled -> { appPreferences.setSendUsage(enabled); analytics.enableTracking(enabled, false); }); form.onHttpProxy(appPreferences::setHttpProxy, appPreferences::unsetHttpProxy); form.onReloadCache(() -> { formCache.update(); JOptionPane.showMessageDialog(getContainer(), "Forms successfully reloaded from storage location.", APP_NAME, JOptionPane.PLAIN_MESSAGE); }); }
Source:
<code>public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { Optional<GenerateAuditLog> generateAuditLog = Optional.of(handler).filter(h -> h instanceof HandlerMethod) .map(HandlerMethod.class::cast).map(HandlerMethod::getMethod).map(m -> m.getAnnotation(GenerateAuditLog.class)); if (generateAuditLog.isPresent() && generateAuditLog.get().scope().in(ALL, ERROR)) { int responseCode = response.getStatus(); if (ex != null & ex instanceof AccessDeniedException) { responseCode = HttpStatus.FORBIDDEN.value(); } if (ex != null & ex instanceof AuthenticationException) { responseCode = HttpStatus.UNAUTHORIZED.value(); } String requestBodyString = Optional.ofNullable(request).map(this::extractContent).orElse(null); Object requestBody = Optional.of(handler).map(HandlerMethod.class::cast).map(HandlerMethod::getMethod) .map(this::extractRequestType).map(t -> this.parse(requestBodyString, t)).orElse(null); String responseBodyString = Optional.ofNullable(response).map(this::extractContent).orElse(null); <START> if (!HttpStatus.valueOf(responseCode).is2xxSuccessful() && !HttpStatus.valueOf(responseCode).is3xxRedirection()) { <END> this.auditLogSender.sendAuditLog(request, requestBody, responseCode, responseBodyString, generateAuditLog.get()); } } else { super.afterCompletion(request, response, handler, ex); } }</code><technical_language>simpler write HttpStatus.valueOf(responseCode).isError()</technical_language>

Target:
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { Optional<GenerateAuditLog> generateAuditLog = Optional.of(handler).filter(h -> h instanceof HandlerMethod) .map(HandlerMethod.class::cast).map(HandlerMethod::getMethod).map(m -> m.getAnnotation(GenerateAuditLog.class)); if (generateAuditLog.isPresent() && generateAuditLog.get().scope().in(ALL, ERROR)) { int responseCode = response.getStatus(); if (ex != null & ex instanceof AccessDeniedException) { responseCode = HttpStatus.FORBIDDEN.value(); } if (ex != null & ex instanceof AuthenticationException) { responseCode = HttpStatus.UNAUTHORIZED.value(); } String requestBodyString = Optional.ofNullable(request).map(this::extractContent).orElse(null); Object requestBody = Optional.of(handler).map(HandlerMethod.class::cast).map(HandlerMethod::getMethod) .map(this::extractRequestType).map(t -> this.parse(requestBodyString, t)).orElse(null); String responseBodyString = Optional.ofNullable(response).map(this::extractContent).orElse(null); if (HttpStatus.valueOf(responseCode).isError()) { this.auditLogSender.sendAuditLog(request, requestBody, responseCode, responseBodyString, generateAuditLog.get()); } } else { super.afterCompletion(request, response, handler, ex); } }
Source:
<code><START> private StorageType updateLUNConnectionsInfo(LUNs lun) { <END> lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); return lun.getLunConnections().isEmpty() ? StorageType.FCP : lun.getLunConnections().get(0).getstorage_type(); }</code><technical_language>I name, updateConnectionsInfo is loading connections..i related return storage type. way,for type (which is usecase of this method) i add a check if connection list is loaded, if is - return type , need load db if loaded do action in some command for example</technical_language>

Target:
private StorageType updateLUNConnectionsInfo(LUNs lun) { if (lun.getLunConnections() == null) { lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); } return lun.getLunConnections().isEmpty() ? StorageType.FCP : lun.getLunConnections().get(0).getstorage_type(); }
Source:
<code>private ImageDescriptor createImageDescriptorForId(String providerId, String imageId) { if (imageId == null || providerId == null) return null; String registryKey = makeKey(providerId, imageId); ImageRegistry imageRegistry = GraphitiUIPlugin.getDefault().getImageRegistry(); ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(registryKey); if (imageDescriptor != null) { return imageDescriptor; } Collection<IImageProvider> imageProviders = ExtensionManager.getSingleton() .getImageProvidersForDiagramTypeProviderId(providerId); for (IImageProvider imageProvider : imageProviders) { String imageFilePath = imageProvider.getImageFilePath(imageId); if (imageFilePath != null) { if (imageFilePath.startsWith("bundleentry://")) { try { URL imageFileUrl = new URL(imageFilePath); imageDescriptor = ImageDescriptor.createFromURL(imageFileUrl); <START> } catch (MalformedURLException e) { <END> } } else { String pluginId = imageProvider.getPluginId(); if (pluginId != null) { imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath); } } break; } } if (imageDescriptor == null) { imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); } imageDescriptor = fixImageDescriptor(imageDescriptor); imageRegistry.put(registryKey, imageDescriptor); return imageDescriptor; }</code><technical_language>1 exception handled logged</technical_language>

Target:
private ImageDescriptor createImageDescriptorForId(String providerId, String imageId) { if (imageId == null || providerId == null) return null; String registryKey = makeKey(providerId, imageId); ImageRegistry imageRegistry = GraphitiUIPlugin.getDefault().getImageRegistry(); ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(registryKey); if (imageDescriptor != null) { return imageDescriptor; } Collection<IImageProvider> imageProviders = ExtensionManager.getSingleton() .getImageProvidersForDiagramTypeProviderId(providerId); for (IImageProvider imageProvider : imageProviders) { String imageFilePath = imageProvider.getImageFilePath(imageId); if (imageFilePath != null) { if (imageFilePath.startsWith("bundleentry://")) { try { URL imageFileUrl = new URL(imageFilePath); imageDescriptor = ImageDescriptor.createFromURL(imageFileUrl); } catch (MalformedURLException e) { T.racer().error("Bundle entry url for image could not be parsed, url was: " + imageFilePath, e); } } else { String pluginId = imageProvider.getPluginId(); if (pluginId != null) { imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath); } } break; } } if (imageDescriptor == null) { imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); } imageDescriptor = fixImageDescriptor(imageDescriptor); imageRegistry.put(registryKey, imageDescriptor); return imageDescriptor; }
Source:
<code>public void retriesIfFailsWithRetriableException() throws Exception { <START> when(task.run()).thenThrow(new TransactionFailedRetriableException("")).thenReturn("success"); <END> assertThat(run()).isEqualTo("success"); }</code><technical_language>is easy of checking retried (or depending define retries)</technical_language>

Target:
public void retriesIfFailsWithRetriableException() throws Exception { when(task.run()).thenThrow(new TransactionFailedRetriableException("")).thenReturn("success"); assertThat(runExponential()).isEqualTo("success"); assertThat(blockStrategy.numRetries).isEqualTo(1); }
Source:
<code>public LogReplicationSinkManager(String localCorfuEndpoint, LogReplicationConfig config, LogReplicationMetadataManager metadataManager, ServerContext context, long topologyConfigId) { this.logReplicationMetadataManager = metadataManager; this.applySnapshotExecutor = Executors.newSingleThreadExecutor(new <START> ThreadFactoryBuilder().setNameFormat("log-replication-sink-manager-apply-snapshot").build()); <END> this.runtime = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters.builder() .trustStore((String) context.getServerConfig().get("--truststore")) .tsPasswordFile((String) context.getServerConfig().get("--truststore-password-file")) .keyStore((String) context.getServerConfig().get("--keystore")) .ksPasswordFile((String) context.getServerConfig().get("--keystore-password-file")) .tlsEnabled((Boolean) context.getServerConfig().get("--enable-tls")) .build()) .parseConfigurationString(localCorfuEndpoint).connect(); this.rxState = RxState.LOG_ENTRY_SYNC; this.config = config; this.topologyConfigId = topologyConfigId; init(); }</code><technical_language>long name, name of variable a nice one, apply-snapshot-executor</technical_language>

Target:
public LogReplicationSinkManager(String localCorfuEndpoint, LogReplicationConfig config, LogReplicationMetadataManager metadataManager, ServerContext context, long topologyConfigId) { this.logReplicationMetadataManager = metadataManager; this.applySnapshotExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("apply-snapshot-executor").build()); this.runtime = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters.builder() .trustStore((String) context.getServerConfig().get("--truststore")) .tsPasswordFile((String) context.getServerConfig().get("--truststore-password-file")) .keyStore((String) context.getServerConfig().get("--keystore")) .ksPasswordFile((String) context.getServerConfig().get("--keystore-password-file")) .tlsEnabled((Boolean) context.getServerConfig().get("--enable-tls")) .build()) .parseConfigurationString(localCorfuEndpoint).connect(); this.rxState = RxState.LOG_ENTRY_SYNC; this.config = config; this.topologyConfigId = topologyConfigId; init(); }