auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeUnregisteredTemplatesTitle()); window.setHelpTag(HelpTag.remove_unregistered_template); window.setHashName("remove_unregistered_templates"); List<String> items = getSelectedItems().stream() .map(item -> (VmTemplate) item) .filter(vmTemplate -> vmTemplate.getId().isNullOrEmpty(Guid.Empty)) .map(VmTemplate::getName) .collect(Collectors.toList()); window.setItems(items); UICommand onRemoveUiCommand = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(onRemoveUiCommand); UICommand cancelUiCommand = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(cancelUiCommand); }

Target:
protected void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeUnregisteredTemplatesTitle()); window.setHelpTag(HelpTag.remove_unregistered_template); window.setHashName("remove_unregistered_templates"); List<String> items = getSelectedItems().stream() .map(item -> (VmTemplate) item) .filter(vmTemplate -> !Guid.isNullOrEmpty(vmTemplate.getId())) .map(VmTemplate::getName) .collect(Collectors.toList()); window.setItems(items); UICommand onRemoveUiCommand = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(onRemoveUiCommand); UICommand cancelUiCommand = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(cancelUiCommand); }
Source:
public LogicalPlan apply(Filter filter, Captures captures) { var projectSet = captures.get(projectSetCapture); var queryParts = AndOperator.split(filter.query()); LinkedList<Symbol> toPushDown = new LinkedList<>(); LinkedList<Symbol> toKeep = new LinkedList<>(); for (var part : queryParts) { if (!SymbolVisitors.any(MoveFilterBeneathProjectSet::isTableFunction, part) && projectSet.standaloneOutputs().containsAll(extractColumns(part))) { toPushDown.add(part); } else { toKeep.add(part); } } if (toPushDown.isEmpty()) { return null; } else if (toKeep.isEmpty()) { return transpose(filter, projectSet); } else { var newProjectSet = projectSet.replaceSources( List.of(new Filter(projectSet.source(), AndOperator.join(toPushDown)))); return new Filter(newProjectSet, AndOperator.join(toKeep)); } }

Target:
public LogicalPlan apply(Filter filter, Captures captures) { var projectSet = captures.get(projectSetCapture); var queryParts = AndOperator.split(filter.query()); ArrayList<Symbol> toPushDown = new ArrayList<>(); ArrayList<Symbol> toKeep = new ArrayList<>(); for (var part : queryParts) { if (!SymbolVisitors.any(MoveFilterBeneathProjectSet::isTableFunction, part) && projectSet.standaloneOutputs().containsAll(extractColumns(part))) { toPushDown.add(part); } else { toKeep.add(part); } } if (toPushDown.isEmpty()) { return null; } else if (toKeep.isEmpty()) { return transpose(filter, projectSet); } else { var newProjectSet = projectSet.replaceSources( List.of(new Filter(projectSet.source(), AndOperator.join(toPushDown)))); return new Filter(newProjectSet, AndOperator.join(toKeep)); } }
Source:
public void writeTo(Resource file) throws JDOMException, IOException { OutputStream out = path.out(); try { IOUtils.write(body, out); } finally { out.close(); } }

Target:
public void writeTo(Resource file) throws JDOMException, IOException { try (OutputStream out = path.out()) { IOUtils.write(body, out); } }
Source:
protected void saveData(JsonObject json, BiomeTextureMap data) { Queue<Integer> queue = new PriorityQueue<>(data.textureMap.keySet()); while (!queue.isEmpty()) { int biomeID = queue.poll(); if (biomeID >= 0 && biomeID < 256) { String key = Biome.REGISTRY.getObjectById(biomeID).getRegistryName().toString(); json.addProperty(key, data.textureMap.get(biomeID).name); } } }

Target:
protected void saveData(JsonObject json, BiomeTextureMap data) { Queue<Biome> queue = new PriorityQueue<>(data.textureMap.keySet()); while (!queue.isEmpty()) { Biome biome = queue.poll(); int biomeID = Biome.getIdForBiome(biome); if (biomeID >= 0 && biomeID < 256) { String key = CustomFormatter.getRegistryString(biome); json.addProperty(key, data.textureMap.get(biome).name); } } }
Source:
public ArrayList<SimpleEvent> getEventsInWeek(int year, int week) { ArrayList<SimpleEvent> events = new ArrayList<>(); Cursor cursor = db.query(TABLE_EVENTS, new String[]{Events.KEY, Events.NAME, Events.TYPE, Events.DISTRICT, Events.START, Events.END, Events.LOCATION, Events.VENUE, Events.OFFICIAL, Events.DISTRICT_STRING}, Events.KEY + " LIKE ? AND " + Events.WEEK + " = ?", new String[]{Integer.toString(year) + "%", Integer.toString(week)}, null, null, null, null ); if (cursor != null && cursor.moveToFirst()) { do { SimpleEvent event = new SimpleEvent(); event.setEventKey(cursor.getString(0)); event.setEventName(cursor.getString(1)); event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]); event.setDistrictEnum(cursor.getInt(3)); event.setStartDate(cursor.getString(4)); event.setEndDate(cursor.getString(5)); event.setLocation(cursor.getString(6)); event.setOfficial(cursor.getInt(7) == 1); event.setDistrictTitle(cursor.getString(8)); events.add(event); } while (cursor.moveToNext()); cursor.close(); return events; } else { Log.w(Constants.LOG_TAG, "Failed to find events in " + year + " week " + week); return null; } }

Target:
public ArrayList<SimpleEvent> getEventsInWeek(int year, int week) { ArrayList<SimpleEvent> events = new ArrayList<>(); Cursor cursor = db.query(TABLE_EVENTS, new String[]{Events.KEY, Events.NAME, Events.TYPE, Events.DISTRICT, Events.START, Events.END, Events.LOCATION, Events.VENUE, Events.OFFICIAL, Events.DISTRICT_STRING}, Events.KEY + " LIKE ? AND " + Events.WEEK + " = ?", new String[]{Integer.toString(year) + "%", Integer.toString(week)}, null, null, null, null ); if (cursor != null && cursor.moveToFirst()) { do { SimpleEvent event = new SimpleEvent(); event.setEventKey(cursor.getString(0)); event.setEventName(cursor.getString(1)); event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]); event.setDistrictEnum(cursor.getInt(3)); event.setStartDate(cursor.getString(4)); event.setEndDate(cursor.getString(5)); event.setLocation(cursor.getString(6)); event.setVenue(cursor.getString(7)); event.setOfficial(cursor.getInt(8) == 1); event.setDistrictTitle(cursor.getString(9)); events.add(event); } while (cursor.moveToNext()); cursor.close(); return events; } else { Log.w(Constants.LOG_TAG, "Failed to find events in " + year + " week " + week); return null; } }
Source:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { data.moveToFirst(); route.buildFromCursor(data, DBAdapter.getInstance()); data.close(); adapter.clear(); adapter.addAll(route.getStops()); adapter.notifyDataSetChanged(); updateMapItems((ArrayList) route.getVehicles(), true); if (swipeRefreshLayout.isRefreshing()) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(false); } }); } refreshMapInfoWindow(); }

Target:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { data.moveToFirst(); route.buildFromCursor(data, DBAdapter.getInstance()); adapter.clear(); adapter.addAll(route.getStops()); adapter.notifyDataSetChanged(); updateMapItems((ArrayList) route.getVehicles(), true); if (swipeRefreshLayout.isRefreshing()) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(false); } }); } refreshMapInfoWindow(); }
Source:
protected String getEventSubscriptionScope(ActivityExecution execution, EventSubscriptionEntity subscription) { String subscriptionScope = null; if (subscription.getConfiguration() != null) { Pattern pattern = Pattern.compile("\"scope\"\\s*:\\s*\"([^\"]+)\",?"); Matcher matcher = pattern.matcher(subscription.getConfiguration()); if (matcher.find()) { subscriptionScope = matcher.group(1); } } return subscription.getEventName() + ":" + getSignalExecutionScope(execution, subscriptionScope); }

Target:
protected String getEventSubscriptionScope(ActivityExecution execution, EventSubscriptionEntity subscription) { String subscriptionScope = null; if (subscription.getConfiguration() != null) { Matcher matcher = scopeRegexPattern.matcher(subscription.getConfiguration()); if (matcher.find()) { subscriptionScope = matcher.group(1); } } return getSignalExecutionScope(execution, subscription.getEventName(), subscriptionScope); }
Source:
public Object[][] loadTestMeasureBaselineDivergenceInput() { final String[] params = new String[]{"bestline", "someMatchBestPossible", "noMatchBestPossible"}; return TestInputLoader .loadTestInputs("TestResourceUsageCalculator.MeasureBaselineDivergence.json", params); }

Target:
public Object[][] loadTestMeasureBaselineDivergenceInput() { final String[] params = new String[]{"baseline", "someMatchBestPossible", "noMatchBestPossible"}; return TestInputLoader .loadTestInputs("TestResourceUsageCalculator.MeasureBaselineDivergence.json", params); }
Source:
public void should_throw_illegal_state_exception_if_null_answer() throws Throwable { Invocation invocation = createMethodInvocation(); try { new ThrowsException(null) .answer(invocation); } catch (IllegalStateException expected) { } }

Target:
public void should_throw_illegal_state_exception_if_null_answer() throws Throwable { Invocation invocation = createMethodInvocation(); try { new ThrowsException(null).answer(invocation); fail(); } catch (IllegalStateException expected) { } }
Source:
public void setup(Method method) throws Exception { Util.print("test name: " + method.getName()); bundles[0] = new Bundle(); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].setInputFeedDataPath(feedInputPath); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }

Target:
public void setup(Method method) throws Exception { Util.print("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].setInputFeedDataPath(feedInputPath); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }
Source:
private synchronized IConnectionRegistryProvider[] getProviders() { if( registryProviders == null ) { loadProviders(); } List<ProviderPair> l = new ArrayList<ProviderPair>(Arrays.asList(registryProviders)); Comparator<ProviderPair> c = (e1, e2) -> e2.getWeight() - e1.getWeight(); List<IConnectionRegistryProvider> ret = l.stream().sorted(c).map(ProviderPair::getProvider).collect(Collectors.toList()); return (IConnectionRegistryProvider[]) ret.toArray(new IConnectionRegistryProvider[ret.size()]); }

Target:
private synchronized IConnectionRegistryProvider[] getProviders() { if( registryProviders == null ) { loadProviders(); } List<ProviderPair> l = new ArrayList<ProviderPair>(Arrays.asList(registryProviders)); Comparator<ProviderPair> c = (e1, e2) -> e2.getWeight() - e1.getWeight(); List<IConnectionRegistryProvider> ret = l.stream().sorted(c).map(ProviderPair::getProvider).collect(Collectors.toList()); return ret.toArray(new IConnectionRegistryProvider[ret.size()]); }
Source:
public void addPassMsgs(Set<String> msgs) { _passMsgs.addAll(msgs); }

Target:
public void addPassMsgs(Set<String> msgs) { if (msgs != null) { _passMsgs.addAll(msgs); } }
Source:
public ResourceReference parse(String rawReference) { StringBuilder content = new StringBuilder(rawReference); ResourceReference parsedURILinks = parseURILinks(rawReference); ResourceReference parsedInterWikiLinks = parseInterWikiLinks(content); ResourceReference resourceReference; if (parsedURILinks != null) { resourceReference = parsedURILinks; } else if (parsedInterWikiLinks != null) { resourceReference = parsedInterWikiLinks; } else if (!isInWikiMode()) { resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); } else { return parseDocumentLink(content); } return resourceReference; }

Target:
public ResourceReference parse(String rawReference) { ResourceReference resourceReference = parseURILinks(rawReference); StringBuilder content = new StringBuilder(rawReference); if (resourceReference == null) { resourceReference = parseInterWikiLinks(content); if (resourceReference == null) { if (!isInWikiMode()) { resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); } } } if (resourceReference != null) { return resourceReference; else { return parseDocumentLink(content); } } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { return (mDrawerToggle.onOptionsItemSelected(item)) || super.onOptionsItemSelected(item); }
Source:
public void populateDAG(DAG dag, Configuration conf) { JsonGenerator generator = dag.addOperator("JsonGenerator", JsonGenerator.class); JsonParser parser = dag.addOperator("JsonParser", JsonParser.class); ConsoleOutputOperator pojo = dag.addOperator("Pojo", ConsoleOutputOperator.class); ConsoleOutputOperator jsonObject = dag.addOperator("JsonObject", ConsoleOutputOperator.class); ConsoleOutputOperator error = dag.addOperator("Error", ConsoleOutputOperator.class); dag.addStream("json", generator.out, parser.in); dag.addStream("pojo", parser.out, pojo.input); dag.addStream("jsonObject", parser.parsedOutput, jsonObject.input); dag.addStream("error", parser.err, error.input); dag.getMeta(parser).getMeta(parser.out).getAttributes().put(Context.PortContext.TUPLE_CLASS, Campaign.class); }

Target:
public void populateDAG(DAG dag, Configuration conf) { JsonGenerator generator = dag.addOperator("JsonGenerator", JsonGenerator.class); JsonParser parser = dag.addOperator("JsonParser", JsonParser.class); JsonFormatter formatter = dag.addOperator("JsonFormatter", JsonFormatter.class); ConsoleOutputOperator jsonString = dag.addOperator("JsonString", ConsoleOutputOperator.class); ConsoleOutputOperator jsonObject = dag.addOperator("JsonObject", ConsoleOutputOperator.class); ConsoleOutputOperator error = dag.addOperator("Error", ConsoleOutputOperator.class); dag.addStream("json", generator.out, parser.in); dag.addStream("pojo", parser.out, formatter.in); dag.addStream("jsonString", formatter.out, jsonString.input); dag.addStream("jsonObject", parser.parsedOutput, jsonObject.input); dag.addStream("error", parser.err, error.input); }
Source:
private Set<String> getTranslationKeys(File file) { Set<String> keys = new HashSet<>(); try (InputStream inStream = Files.newInputStream(file.toPath())) { final Properties translations = new Properties(); translations.load(inStream); keys = translations.stringPropertyNames(); } catch (final IOException | IllegalArgumentException ex) { logException(ex, file); } return keys; }

Target:
private Set<String> getTranslationKeys(File file) { Set<String> keys = new HashSet<>(); try (InputStream inStream = Files.newInputStream(file.toPath())) { final Properties translations = new Properties(); translations.load(inStream); keys = translations.stringPropertyNames(); } catch (final Exception ex) { logException(ex, file); } return keys; }
Source:
public LockRpcClient getLockService(@Safe @PathParam("namespace") String namespace) { return getOrCreateServices(namespace).getLockService(); }

Target:
public LockResource getLockService(@Safe @PathParam("namespace") String namespace) { return getOrCreateServices(namespace).getLockService(); }
Source:
public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx ctx, Object... nodeOutputs) throws SemanticException { TableScanOperator scanOp = (TableScanOperator) nd; ColumnPrunerProcCtx cppCtx = (ColumnPrunerProcCtx) ctx; List<String> cols = cppCtx .genColLists((Operator<? extends OperatorDesc>) nd); if (cols == null && !scanOp.getConf().isGatherStats() ) { scanOp.setNeededColumnIDs(null); return null; } cols = cols == null ? new ArrayList<String>() : cols; cppCtx.getPrunedColLists().put((Operator<? extends OperatorDesc>) nd, cols); cppCtx.getPrunedNestedColLists().put((Operator<? extends OperatorDesc>) nd, cppCtx.genNestedColPaths((Operator<? extends OperatorDesc>) nd)); RowSchema inputRS = scanOp.getSchema(); setupNeededColumns(scanOp, inputRS, cols); scanOp.setNeededNestedColumnPaths( cppCtx.genNestedColPaths((Operator<? extends OperatorDesc>) nd)); return null; }

Target:
public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx ctx, Object... nodeOutputs) throws SemanticException { TableScanOperator scanOp = (TableScanOperator) nd; ColumnPrunerProcCtx cppCtx = (ColumnPrunerProcCtx) ctx; List<String> cols = cppCtx .genColLists((Operator<? extends OperatorDesc>) nd); if (cols == null && !scanOp.getConf().isGatherStats() ) { scanOp.setNeededColumnIDs(null); return null; } cols = cols == null ? new ArrayList<String>() : cols; List nestedCols = cppCtx.genNestedColPaths((Operator<? extends OperatorDesc>) nd); cppCtx.getPrunedColLists().put((Operator<? extends OperatorDesc>) nd, cols); cppCtx.getPrunedNestedColLists().put((Operator<? extends OperatorDesc>) nd, nestedCols); RowSchema inputRS = scanOp.getSchema(); setupNeededColumns(scanOp, inputRS, cols); scanOp.setNeededNestedColumnPaths(nestedCols); return null; }
Source:
public double logTransitionProbability(final CopyNumberTriState currentState, final Target fromTarget, final CopyNumberTriState nextState, final Target nextPosition) { Utils.nonNull(currentState); Utils.nonNull(nextState); Utils.nonNull(fromTarget); Utils.nonNull(nextPosition); final double distance = calculateDistance(fromTarget, nextPosition); double logProb = Double.NEGATIVE_INFINITY; try { logProb = logTransitionProbabilityCache.logProbability((int) distance, nextState, currentState); } catch (NullPointerException ex) { System.out.println(distance + " " + currentState.name() + " " + fromTarget.getName() + " " + nextState.name() + " " + nextPosition.getName()); } return logProb; }

Target:
public double logTransitionProbability(final CopyNumberTriState currentState, final Target fromTarget, final CopyNumberTriState nextState, final Target nextPosition) { Utils.nonNull(currentState); Utils.nonNull(nextState); Utils.nonNull(fromTarget); Utils.nonNull(nextPosition); final double distance = calculateDistance(fromTarget, nextPosition); return logTransitionProbabilityCache.logProbability((int) distance, nextState, currentState); }
Source:
private void getFileAsHttpResponse(File file) throws IOException { long size = file.length(); if (size > Integer.MAX_VALUE) { statusCode = HttpStatus.SC_BAD_REQUEST; return; } int len = (int) size; if (fileProtocol.getMaxContentLength() >= 0 && len > fileProtocol.getMaxContentLength()) len = fileProtocol.getMaxContentLength(); content = new byte[len]; InputStream is = new FileInputStream(file); int offset = 0; int n = 0; while (offset < len && (n = is.read(content, offset, len - offset)) >= 0) { offset += n; } if (offset < len) { LOG.warn("not enough bytes read from file: {}", file.getPath()); } is.close(); metadata.setValue(HttpHeaders.CONTENT_LENGTH, new Long(size).toString()); metadata.setValue(HttpHeaders.LAST_MODIFIED, formatDate(file.lastModified())); statusCode = HttpStatus.SC_OK; }

Target:
private void getFileAsHttpResponse(File file) throws IOException { long size = file.length(); if (size > Integer.MAX_VALUE) { statusCode = HttpStatus.SC_BAD_REQUEST; return; } try { content = IOUtils.toByteArray(new FileInputStream(file), size); } catch (IOException | IllegalArgumentException e) { LOG.error("Exception while fetching file response ", file.getPath(), e); statusCode = HttpStatus.SC_METHOD_FAILURE; return; } metadata.setValue(HttpHeaders.CONTENT_LENGTH, new Long(size).toString()); metadata.setValue(HttpHeaders.LAST_MODIFIED, formatDate(file.lastModified())); statusCode = HttpStatus.SC_OK; }
Source:
public void run() { if (Bukkit.isPrimaryThread()) throw new IllegalStateException("Cannot run profile fetcher on main thread."); List<ProfileRequest> requests; synchronized (sync) { if (queue.isEmpty()) return; requests = new ArrayList<ProfileRequest>(queue); queue.clear(); } profileFetcher.fetch(requests); }

Target:
public void run() { List<ProfileRequest> requests; synchronized (sync) { if (queue.isEmpty()) return; requests = new ArrayList<ProfileRequest>(queue); queue.clear(); } profileFetcher.fetchRequests(requests); }
Source:
public void shouldReceiveServerInfoAfterInit() throws Throwable { SocketClient socket = mock( SocketClient.class ); SocketConnection conn = new SocketConnection( socket, SERVER_INFO, DEV_NULL_LOGGER ); when( socket.address() ).thenReturn( new BoltServerAddress( URI.create( "<LINK_0>" ) ) ); ArrayList<Message> serverResponses = new ArrayList<>(); serverResponses.add( new SuccessMessage( Values.parameters( "server", "super-awesome" ).asMap( Values.ofValue() ) ) ); final Iterator<Message> iterator = serverResponses.iterator(); doAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { Object[] arguments = invocation.getArguments(); SocketResponseHandler responseHandler = ( SocketResponseHandler ) arguments[0]; iterator.next().dispatch( responseHandler ); return null; } } ).when( socket ).receiveOne( any( SocketResponseHandler.class ) ); doCallRealMethod().when( socket ).receiveAll( any(SocketResponseHandler.class) ); conn.init( "java-driver-1.1", parameters( "scheme", "none" ).asMap( Values.ofValue() ) ); ServerInfo server = conn.server(); assertThat( server.address(), equalTo( "neo4j.com:9000" ) ); assertThat( server.version(), equalTo( "super-awesome" ) ); }

Target:
public void shouldReceiveServerInfoAfterInit() throws Throwable { SocketClient socket = mock( SocketClient.class ); SocketConnection conn = new SocketConnection( socket, SERVER_INFO, DEV_NULL_LOGGER ); when( socket.address() ).thenReturn( new BoltServerAddress( "neo4j.com:9000" ) ); ArrayList<Message> serverResponses = new ArrayList<>(); serverResponses.add( new SuccessMessage( Values.parameters( "server", "super-awesome" ).asMap( Values.ofValue() ) ) ); final Iterator<Message> iterator = serverResponses.iterator(); doAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { Object[] arguments = invocation.getArguments(); SocketResponseHandler responseHandler = ( SocketResponseHandler ) arguments[0]; iterator.next().dispatch( responseHandler ); return null; } } ).when( socket ).receiveOne( any( SocketResponseHandler.class ) ); doCallRealMethod().when( socket ).receiveAll( any(SocketResponseHandler.class) ); conn.init( "java-driver-1.1", parameters( "scheme", "none" ).asMap( Values.ofValue() ) ); ServerInfo server = conn.server(); assertThat( server.address(), equalTo( "neo4j.com:9000" ) ); assertThat( server.version(), equalTo( "super-awesome" ) ); }
Source:
private UpdateFirmwareResponseDto executeFirmwareUpdate(final DlmsConnectionHolder conn, final DlmsDevice device, final String firmwareIdentification) throws ProtocolAdapterException { if (this.firmwareRepository.isAvailable(firmwareIdentification)) { return this.updateFirmwareCommandExecutor.execute(conn, device, firmwareIdentification); } else { throw new ProtocolAdapterException("Firmware Unavailable"); } }

Target:
private UpdateFirmwareResponseDto executeFirmwareUpdate(final DlmsConnectionHolder conn, final DlmsDevice device, final String firmwareIdentification) throws ProtocolAdapterException { if (this.firmwareRepository.isAvailable(firmwareIdentification)) { return this.updateFirmwareCommandExecutor.execute(conn, device, firmwareIdentification); } else { throw new ProtocolAdapterException(EXCEPTION_MSG_FIRMWARE_FILE_NOT_AVAILABLE); } }
Source:
public void email(final String self, final Friend friend, final String text) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(friend.alias(), friend.email())) .with( new StSubject( String.format( "#%d: %s", this.bout.number(), this.bout.title() ) ) ) .with( new StReplyTo( String.format( "%s%s", EmCatch.encrypt( String.format( "%s|%d", self, this.bout.number() ) ), "@reply.netbout.com" ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Default().html(text), "<p>--<br/>to reply click here: ", String.format( "<LINK_0>", this.bout.number() ), "</p><p style=\"color:#C8C8C8;font-size:2px;\">", String.format( "%d</p>", System.nanoTime() ), new GmailViewAction(this.bout.number()).xml() ) ) ) ); }

Target:
public void email(final String self, final Friend friend, final String text) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(friend.alias(), friend.email())) .with( new StSubject( String.format( "#%d: %s", this.bout.number(), this.bout.title() ) ) ) .with( new StReplyTo( String.format( "%s@reply.netbout.com", EmCatch.encrypt( String.format( "%s|%d", self, this.bout.number() ) ) ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Default().html(text), "<p>--<br/>to reply click here: ", String.format( "<LINK_0>", this.bout.number() ), "</p><p style=\"color:#C8C8C8;font-size:2px;\">", String.format( "%d</p>", System.nanoTime() ), new GmailViewAction(this.bout.number()).xml() ) ) ) ); }
Source:
private static boolean isWebServiceDeployed(String webServiceName, String endpoint) { log.info("waiting " + 90000 + " millis for web service deployment " + webServiceName); HttpResponse response; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < 90000) { try { response = HttpRequestUtil.sendGetRequest(endpoint, null); if (!response.getData().isEmpty()) { return true; } } catch (IOException ignored) { } try { Thread.sleep(500); } catch (InterruptedException ignored) { } } return false; }

Target:
private boolean isWebServiceDeployed(String webServiceName, String endpoint) { log.info("waiting " + 90000 + " millis for web service deployment " + webServiceName); HttpResponse response; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < 90000) { try { response = HttpRequestUtil.sendGetRequest(endpoint, null); if (!response.getData().isEmpty()) { return true; } } catch (IOException ignored) { } try { Thread.sleep(500); } catch (InterruptedException ignored) { } } return false; }
Source:
public MobileOptions(Capabilities source) { this(); merge(source); }

Target:
public MobileOptions(Capabilities source) { merge(source); }
Source:
public void testLocalTimeMax() throws SQLException { PreparedStatement pstmt = con.prepareStatement("INSERT INTO timetable (tt) VALUES (?)"); pstmt.setObject(1, LocalTime.MAX); pstmt.executeUpdate(); pstmt.setObject(1, LocalTime.MIN); pstmt.executeUpdate(); ResultSet rs = con.createStatement().executeQuery("select tt from timetable order by id asc"); Assert.assertTrue(rs.next()); LocalTime localTime = (LocalTime)rs.getObject(1,LocalTime.class); Assert.assertTrue( localTime == LocalTime.MAX); Assert.assertTrue(rs.next()); localTime = (LocalTime)rs.getObject(1, LocalTime.class); Assert.assertTrue( localTime == LocalTime.MIN); }

Target:
public void testLocalTimeMax() throws SQLException { PreparedStatement pstmt = con.prepareStatement("INSERT INTO timetable (tt) VALUES (?)"); pstmt.setObject(1, LocalTime.MAX); pstmt.executeUpdate(); pstmt.setObject(1, LocalTime.MIN); pstmt.executeUpdate(); ResultSet rs = con.createStatement().executeQuery("select tt from timetable order by id asc"); Assert.assertTrue(rs.next()); LocalTime localTime = (LocalTime)rs.getObject(1,LocalTime.class); Assert.assertEquals( LocalTime.MAX, localTime); Assert.assertTrue(rs.next()); localTime = (LocalTime)rs.getObject(1, LocalTime.class); Assert.assertEquals( LocalTime.MIN, localTime); }
Source:
public void testElementWithGenericNode() { FaxResponse.Builder builder = new FaxResponse.Builder(); GenericNode.Builder genericBuilder = new GenericNode.Builder("genericTag"); GenericNode node = genericBuilder.build(); FaxResponse elem = builder.addChild(node).build(); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<Response>" + "<genericTag/>"+ "</Response>", elem.toXml() ); }

Target:
public void testElementWithGenericNode() { GenericNode.Builder genericBuilder = new GenericNode.Builder("genericTag").addText("Some text"); GenericNode node = genericBuilder.build(); FaxResponse.Builder builder = new FaxResponse.Builder(); FaxResponse elem = builder.addChild(node).build(); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<Response>" + "<genericTag>" + "Some text" + "</genericTag>" + "</Response>", elem.toXml() ); }
Source:
public PayloadImpl(String data, String metadata) { this(data, Charset.defaultCharset(), metadata, Charset.defaultCharset()); }

Target:
public PayloadImpl(String data, String metadata) { this(data, StandardCharsets.UTF_8, metadata, StandardCharsets.UTF_8); }
Source:
ChannelsProvider(List<String> channels) { Preconditions.checkArgument(channels != null, "channels can be empty but not null"); this.channels = channels; log.info("Slack toggles channels: " + this.channels); }

Target:
ChannelsProvider(List<String> channels) { Preconditions.checkArgument(channels != null, "channels can be empty but not null"); this.channels = new LinkedList<>(channels); log.info("Slack toggles channels: " + channels); }
Source:
private static boolean isNumericOrGeometricPredicate( IndexQuery predicate ) { if ( predicate.type() == IndexQuery.IndexQueryType.exact ) { IndexQuery.ExactPredicate exactPredicate = (IndexQuery.ExactPredicate) predicate; return isNumberGeometryOrArray(exactPredicate.value()); } else return predicate.type() == IndexQuery.IndexQueryType.range && (predicate.valueGroup() == ValueGroup.NUMBER || predicate.valueGroup() == ValueGroup.GEOMETRY); }

Target:
private static boolean isNumericOrGeometricPredicate( IndexQuery predicate ) { if ( predicate.type() == IndexQuery.IndexQueryType.exact ) { IndexQuery.ExactPredicate exactPredicate = (IndexQuery.ExactPredicate) predicate; if ( isNumberGeometryOrArray( exactPredicate.value() ) ) { return true; } } else if ( predicate.type() == IndexQuery.IndexQueryType.range && ( predicate.valueGroup() == ValueGroup.NUMBER || predicate.valueGroup() == ValueGroup.GEOMETRY ) ) { return true; } return false; }
Source:
public void testColumnMethods() { final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); Assert.assertEquals(ParseTreeTableModel.class, parseTree.getColumnClass(0)); Assert.assertEquals(String.class, parseTree.getColumnClass(1)); Assert.assertEquals(Integer.class, parseTree.getColumnClass(2)); Assert.assertEquals(Integer.class, parseTree.getColumnClass(3)); Assert.assertEquals(String.class, parseTree.getColumnClass(4)); try { parseTree.getColumnClass(67); Assert.fail("IllegalStateException expected"); } catch (IllegalStateException ex) { Assert.assertEquals("Unknown column", ex.getMessage()); } Assert.assertTrue(parseTree.isCellEditable(0)); Assert.assertFalse(parseTree.isCellEditable(1)); Assert.assertEquals(5, parseTree.getColumnCount()); Assert.assertEquals("Tree", parseTree.getColumnName(0)); Assert.assertEquals("Type", parseTree.getColumnName(1)); Assert.assertEquals("Line", parseTree.getColumnName(2)); Assert.assertEquals("Column", parseTree.getColumnName(3)); Assert.assertEquals("Text", parseTree.getColumnName(4)); }

Target:
public void testColumnMethods() { final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); Assert.assertEquals(ParseTreeTableModel.class, parseTree.getColumnClass(0)); Assert.assertEquals(String.class, parseTree.getColumnClass(1)); Assert.assertEquals(Integer.class, parseTree.getColumnClass(2)); Assert.assertEquals(Integer.class, parseTree.getColumnClass(3)); Assert.assertEquals(String.class, parseTree.getColumnClass(4)); try { parseTree.getColumnClass(parseTree.getColumnCount()); Assert.fail("IllegalStateException expected"); } catch (IllegalStateException ex) { Assert.assertEquals("Unknown column", ex.getMessage()); } Assert.assertFalse(parseTree.isCellEditable(1)); Assert.assertEquals(5, parseTree.getColumnCount()); Assert.assertEquals("Tree", parseTree.getColumnName(0)); Assert.assertEquals("Type", parseTree.getColumnName(1)); Assert.assertEquals("Line", parseTree.getColumnName(2)); Assert.assertEquals("Column", parseTree.getColumnName(3)); Assert.assertEquals("Text", parseTree.getColumnName(4)); }
Source:
protected void resetWorkingCopies(final ICompilationUnit unit) { for (ICompilationUnit u : JavaCore.getWorkingCopies(fOwner)) { if (!u.equals(unit)) { try { u.discardWorkingCopy(); }catch (Exception exception) { } } else { try { u.getBuffer().setContents(unit.getPrimary().getBuffer().getContents()); JavaModelUtil.reconcile(u); }catch (JavaModelException exception) { JavaPlugin.log(exception); } } } }

Target:
protected void resetWorkingCopies(final ICompilationUnit unit) { for (ICompilationUnit cu : JavaCore.getWorkingCopies(fOwner)) { if (!cu.equals(unit)) { try { cu.discardWorkingCopy(); } catch (Exception exception) { } } else { try { cu.getBuffer().setContents(unit.getPrimary().getBuffer().getContents()); JavaModelUtil.reconcile(cu); }catch (JavaModelException exception) { JavaPlugin.log(exception); } } } }
Source:
public void decodes() { compare(BigDecimal.class, new BigDecimal("12345678901234567890")); assertEquals(new BigDecimal(42L), converter.decode(BigDecimal.class, new BigDecimal(42L))); assertEquals(new BigDecimal("12345678901234567890"), converter.decode(BigDecimal.class, new BigInteger("12345678901234567890"))); assertEquals(new BigDecimal(42L), converter.decode(BigDecimal.class, 42L)); assertEquals(new BigDecimal(Long.valueOf(42)), converter.decode(BigDecimal.class, 42L)); assertEquals(new BigDecimal(42D), converter.decode(BigDecimal.class, 42D)); assertEquals(new BigDecimal(Double.valueOf(42)), converter.decode(BigDecimal.class, 42D)); assertEquals(new BigDecimal("12345678901234567890"), converter.decode(BigDecimal.class, "12345678901234567890")); assertEquals(new BigDecimal("1.2345678901234567890"), converter.decode(BigDecimal.class, "1.2345678901234567890")); assertEquals(new BigDecimal(Double.MAX_VALUE), converter.decode(BigDecimal.class, Double.MAX_VALUE)); assertEquals(new BigDecimal(Double.MIN_VALUE), converter.decode(BigDecimal.class, Double.MIN_VALUE)); assertEquals(new BigDecimal(Long.MAX_VALUE), converter.decode(BigDecimal.class, Long.MAX_VALUE)); assertEquals(new BigDecimal(Long.MIN_VALUE), converter.decode(BigDecimal.class, Long.MIN_VALUE)); assertEquals(new BigDecimal(0), converter.decode(BigDecimal.class, 0)); assertEquals(new BigDecimal(-0), converter.decode(BigDecimal.class, -0)); }

Target:
public void decodes() { compare(BigDecimal.class, new BigDecimal("12345678901234567890")); assertEquals(new BigDecimal(42L), converter.decode(BigDecimal.class, new BigDecimal(42L))); assertEquals(new BigDecimal("12345678901234567890"), converter.decode(BigDecimal.class, new BigInteger("12345678901234567890"))); assertEquals(new BigDecimal(42L), converter.decode(BigDecimal.class, 42L)); assertEquals(new BigDecimal(Long.valueOf(42)), converter.decode(BigDecimal.class, 42L)); assertEquals(new BigDecimal(42D), converter.decode(BigDecimal.class, 42D)); assertEquals(new BigDecimal(Double.valueOf(42)), converter.decode(BigDecimal.class, 42D)); assertEquals(new BigDecimal("12345678901234567890"), converter.decode(BigDecimal.class, "12345678901234567890")); assertEquals(new BigDecimal("1.2345678901234567890"), converter.decode(BigDecimal.class, "1.2345678901234567890")); assertEquals(new BigDecimal(Double.MAX_VALUE), converter.decode(BigDecimal.class, Double.MAX_VALUE)); assertEquals(new BigDecimal(Double.MIN_VALUE), converter.decode(BigDecimal.class, Double.MIN_VALUE)); assertEquals(new BigDecimal(Long.MAX_VALUE), converter.decode(BigDecimal.class, Long.MAX_VALUE)); assertEquals(new BigDecimal(Long.MIN_VALUE), converter.decode(BigDecimal.class, Long.MIN_VALUE)); assertEquals(new BigDecimal(0), converter.decode(BigDecimal.class, 0)); }
Source:
long connectionCheckInterval() { return 0; }

Target:
public long connectionCheckInterval() { return 0; }
Source:
private void runExec() { this.destroyProcess(); if (logger.isInfoEnabled()) { logger.info("Starting tail process"); } try { Process process = Runtime.getRuntime().exec(getCommand()); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); this.process = process; this.startProcessMonitor(); this.startStatusReader(); this.reader = reader; this.getTaskExecutor().execute(this); } catch (IOException e) { throw new MessagingException("Failed to exec tail command: '" + getCommand() + "'", e); } }

Target:
private void runExec() { this.destroyProcess(); if (logger.isInfoEnabled()) { logger.info("Starting tail process"); } try { Process process = Runtime.getRuntime().exec(this.command); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); this.process = process; this.startProcessMonitor(); this.startStatusReader(); this.reader = reader; this.getTaskExecutor().execute(this); } catch (IOException e) { throw new MessagingException("Failed to exec tail command: '" + this.command + "'", e); } }
Source:
public void close() throws IOException { flush(); log.info("Closing emitter org.apache.druid.emitter.influxdb.InfluxdbEmitter"); started.set(false); exec.shutdown(); }

Target:
public void close() throws IOException { flush(); log.info("Closing [%s]", this.getClass().getName()); started.set(false); exec.shutdownNow(); }
Source:
public StatementExecution buildPreparedStatement() throws SQLException { return new StatementExecution(environment.createStatementWithBoundFixtureSymbols(testHost, statementText), false, environment.supportsSavepoints()); }

Target:
public StatementExecution buildPreparedStatement() throws SQLException { return new StatementExecution(environment.createStatementWithBoundFixtureSymbols(testHost, statementText), false); }
Source:
private String createExpectation(Map<Integer, Integer> transform, Collection<Integer> allValuesInRaster, String initial) { String expectation = initial; for (Integer sourceInt : allValuesInRaster) { String sourceValue = sourceInt.toString(); Integer targetInt = transform.containsKey(sourceInt) ? transform.get(sourceInt) : null; String targetValue = targetInt != null ? Double.toString(targetInt) : "-9999"; expectation = expectation.replace(sourceValue, targetValue); } expectation = expectation.replace("\n ", "\n"); expectation = expectation.replace("\n", System.lineSeparator()); expectation = expectation.toUpperCase(); expectation = expectation.replaceAll(" +", " "); expectation = expectation.replace("CELLSIZE 0.041666666667", "CELLSIZE 0.04166666666700003"); return expectation; }

Target:
private String createExpectation(Map<Integer, Integer> transform, Collection<Integer> allValuesInRaster, String initial) { String expectation = initial; for (Integer sourceInt : allValuesInRaster) { String sourceValue = sourceInt.toString(); Integer targetInt = transform.containsKey(sourceInt) ? transform.get(sourceInt) : null; String targetValue = (targetInt != null) ? Double.toString(targetInt) : "-9999"; expectation = expectation.replace(sourceValue, targetValue); } expectation = expectation.replace("\n ", "\n"); expectation = expectation.replace("\n", System.lineSeparator()); expectation = expectation.toUpperCase(); expectation = expectation.replaceAll(" +", " "); expectation = expectation.replace("CELLSIZE 0.041666666667", "CELLSIZE 0.04166666666700003"); return expectation; }
Source:
public static PantsOptions getPantsOptions(@NotNull final String pantsExecutable) { File pantsExecutableFile = new File(pantsExecutable); return optionsCache.computeIfAbsent(pantsExecutableFile, file -> execPantsOptions(pantsExecutable, file)); }

Target:
public static PantsOptions getPantsOptions(@NotNull final String pantsExecutable) { File pantsExecutableFile = new File(pantsExecutable); return optionsCache.computeIfAbsent(pantsExecutableFile, file -> execPantsOptions(pantsExecutable)); }
Source:
public ColumnChunk readNext() { ColumnChunk columnChunk = null; try { seek(); if (field.isRequired()) { columnChunk = readWithoutNull(); } else { columnChunk = readWithNull(); } } catch (IOException ex) { throw new PrestoException(PARQUET_IO_READ_ERROR, "Error reading Parquet column " + columnDescriptor, ex); } readOffset = 0; nextBatchSize = 0; return columnChunk; }

Target:
public ColumnChunk readNext() { ColumnChunk columnChunk = null; try { seek(); if (field.isRequired()) { columnChunk = readWithoutNull(); } else { columnChunk = readWithNull(); } } catch (IOException exception) { throw new PrestoException(PARQUET_IO_READ_ERROR, "Error reading Parquet column " + columnDescriptor, exception); } readOffset = 0; nextBatchSize = 0; return columnChunk; }
Source:
public void close() { super.close(); logger .trace("Closing NettyMultipartRequest with raw content chunks unread", getUri(), requestContents.size()); while (rawRequestContents.peek() != null) { ReferenceCountUtil.release(rawRequestContents.poll()); } }

Target:
public void close() { super.close(); logger.trace("Closing NettyMultipartRequest with raw content chunks unread", rawRequestContents.size()); HttpContent content = rawRequestContents.poll(); while (content != null) { ReferenceCountUtil.release(content); content = rawRequestContents.poll(); } }
Source:
public ApplicationListWidget(ViewLibrary parent) { this.parent = parent; this.rootItem = new TreeItem<>(); this.setRoot(rootItem); this.setShowRoot(false); try { installedApplications = new FilterPromise<>(this.parent.getEventHandler().getInstalledApplications(), this.filter); } catch (PlayOnLinuxException e) { e.printStackTrace(); } installedApplications.addObserver(this); }

Target:
public ApplicationListWidget(ViewLibrary parent) { this.parent = parent; this.rootItem = new TreeItem<>(); this.setRoot(rootItem); this.setShowRoot(false); try { installedApplications = new FilterPromise<>(this.parent.getEventHandler().getInstalledApplications(), this.filter); } catch (PlayOnLinuxException e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(translate("Error while trying to fetch installed applications.")); alert.setContentText(String.format("The error was: %s", e)); alert.show(); logger.error(e); } installedApplications.addObserver(this); }
Source:
public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { try { rsp.setContentType("text/plain"); send(read(req), req, rsp); } catch (FileNotFoundException noFile) { rsp.sendError(SC_NOT_FOUND); } }

Target:
public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { try { rsp.setContentType(HttpSupport.TEXT_PLAIN); send(read(req), req, rsp); } catch (FileNotFoundException noFile) { rsp.sendError(SC_NOT_FOUND); } }
Source:
public void testWbTypeRefFromDMNWhenQNameIsNotUndefined() { final org.kie.dmn.model.api.ItemDefinition dmn = mock(org.kie.dmn.model.api.ItemDefinition.class); final javax.xml.namespace.QName dmnQName = mock(javax.xml.namespace.QName.class); final QName expectedQName = BuiltInType.STRING.asQName(); when(dmn.getTypeRef()).thenReturn(dmnQName); when(dmnQName.getLocalPart()).thenReturn("string"); when(dmnQName.getPrefix()).thenReturn("string"); final QName actualQName = wbTypeRefFromDMN(dmn); assertEquals(actualQName, expectedQName); }

Target:
public void testWbTypeRefFromDMNWhenQNameIsNotUndefined() { final String qNameLocalPart = "string"; final String qNamePrefix = "qName prefix"; final org.kie.dmn.model.api.ItemDefinition dmn = mock(org.kie.dmn.model.api.ItemDefinition.class); final javax.xml.namespace.QName dmnQName = mock(javax.xml.namespace.QName.class); final QName expectedQName = BuiltInType.STRING.asQName(); when(dmn.getTypeRef()).thenReturn(dmnQName); when(dmnQName.getLocalPart()).thenReturn(qNameLocalPart); when(dmnQName.getPrefix()).thenReturn(qNamePrefix); final QName actualQName = wbTypeRefFromDMN(dmn); assertEquals(actualQName, expectedQName); }
Source:
synchronized public void restartAllRunningTasls() { final Iterator<Entry<TaskId, TaskDescriptor>> iterator = runningTasks.entrySet().iterator(); while (iterator.hasNext()) { final Entry<TaskId, TaskDescriptor> entry = iterator.next(); logger.info("JDI: " + entry.getKey() + " -> " + entry.getValue()); eligibleTasks.put(entry.getKey(), (EligibleTaskDescriptor) entry.getValue()); } runningTasks.clear(); }

Target:
synchronized public void restartAllRunningTasls() { final Iterator<Entry<TaskId, TaskDescriptor>> iterator = runningTasks.entrySet().iterator(); while (iterator.hasNext()) { final Entry<TaskId, TaskDescriptor> entry = iterator.next(); logger.info("Move " + entry.getKey() + " from running to eligible tasls"); eligibleTasks.put(entry.getKey(), (EligibleTaskDescriptor) entry.getValue()); } runningTasks.clear(); logger.info("Restarted all running tasks"); }
Source:
private void initMatrixLocationListForRecyclerView() { matrixLocationList = new ArrayList<>(); for (int x = 0; x < featureCollection.features().size(); x++) { SingleRecyclerViewMatrixLocation singleRecyclerViewLocation = new SingleRecyclerViewMatrixLocation(); singleRecyclerViewLocation.setName(featureCollection.features().get(x) .getStringProperty("Station_Name")); singleRecyclerViewLocation.setLocationLatLng(new LatLng(pointList.get(x).latitude(), pointList.get(x).longitude())); matrixLocationList.add(singleRecyclerViewLocation); } }

Target:
private void initMatrixLocationListForRecyclerView() { matrixLocationList = new ArrayList<>(); for (Feature feature : featureCollection.features()) { SingleRecyclerViewMatrixLocation singleRecyclerViewLocation = new SingleRecyclerViewMatrixLocation(); singleRecyclerViewLocation.setName(feature.getStringProperty("Station_Name")); singleRecyclerViewLocation.setLocationLatLng(new LatLng(((Point) feature.geometry()).latitude(), ((Point) feature.geometry()).longitude())); matrixLocationList.add(singleRecyclerViewLocation); } }
Source:
ConditionMatcherFactory(ValueType keyType, IndexedTable.Index index) { this.keyType = keyType; this.index = index; this.dimensionCaches = Caffeine.newBuilder() .maximumSize(MAX_NUM_CACHE) .build( selector -> Caffeine.newBuilder() .maximumSize(CACHE_MAX_SIZE) .build(dimensionId -> getRowNumbers(selector, dimensionId)) ); }

Target:
ConditionMatcherFactory(ValueType keyType, IndexedTable.Index index) { this.keyType = keyType; this.index = index; this.dimensionCaches = new LruLoadingHashMap<>( MAX_NUM_CACHE, selector -> { int cardinality = selector.getValueCardinality(); IntFunction<IntList> loader = dimensionId -> getRowNumbers(selector, dimensionId); return cardinality <= CACHE_MAX_SIZE ? new Int2IntListLookupTable(cardinality, loader) : new Int2IntListLruCache(CACHE_MAX_SIZE, loader); } ); }
Source:
public void should_have_javascript_as_category_for_properties() throws Exception { List<PropertyDefinition> properties = properties(); assertThat(properties).isNotEmpty(); for (PropertyDefinition propertyDefinition : properties) { if (propertyDefinition.key().equals("sonar.eslint.reportPaths") || propertyDefinition.key().equals("sonar.tslint.reportPaths")) { assertThat(propertyDefinition.category()).isEqualTo("External Analyzers"); } else { assertThat(propertyDefinition.category()).isIn("JavaScript", "TypeScript"); } } }

Target:
public void should_have_javascript_as_category_for_properties() throws Exception { List<PropertyDefinition> properties = properties(); assertThat(properties).isNotEmpty(); for (PropertyDefinition propertyDefinition : properties) { if (propertyDefinition.key().endsWith("lint.reportPaths")) { assertThat(propertyDefinition.category()).isEqualTo("External Analyzers"); } else { assertThat(propertyDefinition.category()).isIn("JavaScript", "TypeScript"); } } }