auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testfindbyRegionAndOtherBeaconFilters() { Region startRange = new Region("9", new Long(10099), new Long(10099)); Region endRange = new Region("9", new Long(10099), new Long(10099)); List<VariantRepositoryFilter> filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, Arrays.asList("PRJEB5829")); List<VariantMongo> variantMongoList = service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters); assertEquals(true, variantMongoList.size() > 0); assertEquals("9", variantMongoList.get(0).getChromosome()); assertEquals("A", variantMongoList.get(0).getReference()); assertEquals("T", variantMongoList.get(0).getAlternate()); assertEquals(VariantType.SNV, variantMongoList.get(0).getType()); filters= new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); filters= new FilterBuilder().getBeaconFilters("A", "T", null, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); filters= new FilterBuilder().getBeaconFilters("A", null, VariantType.SNV, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); endRange = new Region("9", new Long(10098), new Long(10098)); assertEquals(false, service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size() > 0); }

Target:
public void testfindbyRegionAndOtherBeaconFilters() { Region startRange = new Region("9", 10099L, 10099L); Region endRange = new Region("9", 10099L, 10099L); Pageable pageable = new PageRequest(0, 1000); List<VariantRepositoryFilter> filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, Collections.singletonList("PRJEB5829")); List<VariantMongo> variantMongoList = service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable); assertTrue(variantMongoList.size() > 0); assertEquals("9", variantMongoList.get(0).getChromosome()); assertEquals("A", variantMongoList.get(0).getReference()); assertEquals("T", variantMongoList.get(0).getAlternate()); assertEquals(VariantType.SNV, variantMongoList.get(0).getType()); filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); filters = new FilterBuilder().getBeaconFilters("A", "T", null, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); filters = new FilterBuilder().getBeaconFilters("A", null, VariantType.SNV, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); endRange = new Region("9", 10098L, 10098L); assertFalse(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); }
Source:
public void testGenerateReportToPdfFile_WithDataSource() throws Exception { String reportFileName = infoForDataSourceReport.getReportFileName(); String reportDirectoty = infoForDataSourceReport.getReportsDirectory(); String reportTemplateClassPath = infoForDataSourceReport.getReportTemplateClassPath(); String reportTemplateName = infoForDataSourceReport.getReportTemplateName(); ResourceBundle resourceBundle = infoForDataSourceReport.getResourceBundle(); String subReportTemplateClassPath = infoForDataSourceReport.getSubReportTemplateClassPath(); Map<String, String> subReports = infoForDataSourceReport.getSubReports(); Map<String, Object> reportData = new HashMap<String, Object>(); reportData.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, subReportTemplateClassPath); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME, subReports); try { String template = reportTemplateClassPath + reportTemplateName; String fullReportFileName = reportDirectoty + reportFileName; Collection<Account> accountDataSource = this.getAccounts(); reportGenerationService.generateReportToPdfFile(reportData, accountDataSource, template, fullReportFileName); } catch (Exception e) { e.printStackTrace(); fail("fail to generate PDF file." + e); } }

Target:
public void testGenerateReportToPdfFile_WithDataSource() throws Exception { String reportFileName = infoForDataSourceReport.getReportFileName(); String reportDirectoty = infoForDataSourceReport.getReportsDirectory(); String reportTemplateClassPath = infoForDataSourceReport.getReportTemplateClassPath(); String reportTemplateName = infoForDataSourceReport.getReportTemplateName(); ResourceBundle resourceBundle = infoForDataSourceReport.getResourceBundle(); String subReportTemplateClassPath = infoForDataSourceReport.getSubReportTemplateClassPath(); Map<String, String> subReports = infoForDataSourceReport.getSubReports(); Map<String, Object> reportData = new HashMap<String, Object>(); reportData.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, subReportTemplateClassPath); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME, subReports); try { String template = reportTemplateClassPath + reportTemplateName; String fullReportFileName = reportDirectoty + reportFileName; Collection<Account> accountDataSource = this.getAccounts(); reportGenerationService.generateReportToPdfFile(reportData, accountDataSource, template, fullReportFileName); } catch (Exception e) { LOG.error("fail to generate PDF file", e); fail("fail to generate PDF file." + e); } }
Source:
public void onMessage(String data) { try { @SuppressWarnings("unchecked") Map<String, Object> dataMap = objectMapper.readValue(data, Map.class); String event = (String) dataMap.get("event"); if ((event != null) && (event.equals("KEEP_ALIVE"))) { return; } event = (String) dataMap.get("type"); if (event != null) { if (event.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(event, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } else { log.debug("ignoring message. {}", dataMap); } } catch (IOException ex) { log.error("failed to process messages", ex); } }

Target:
public void onMessage(String data) { try { @SuppressWarnings("unchecked") Map<String, Object> dataMap = objectMapper.readValue(data, Map.class); String event = (String) dataMap.get("event"); if ("KEEP_ALIVE".equals(event)) { return; } String type = (String) dataMap.get("type"); if (type == null) { log.debug("type missing so ignoring message. {}", dataMap); return; } if (type.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(type, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } catch (IOException ex) { log.error("failed to process messages", ex); } }
Source:
public AnviltopData.RowMutation.Builder adapt(Delete operation) { AnviltopData.RowMutation.Builder result = AnviltopData.RowMutation.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); if (operation.getFamilyCellMap().isEmpty()) { throwIfUnsupportedDeleteRow(operation); AnviltopData.RowMutation.Mod.Builder modBuilder = result.addModsBuilder(); modBuilder.setDeleteRow(true); } else { for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()) { ByteString familyByteString = ByteString.copyFrom(entry.getKey()); for (Cell cell : entry.getValue()) { if (isColumnDelete(cell)) { if (isPointDelete(cell)) { throwIfUnsupportedPointDelete(cell); } addDeleteCellRange(result, familyByteString, cell); } else if (isDeleteFamily(cell)) { throwIfUnsupportedDeleteFamily(cell); addDeleteFamilyMods(result, familyByteString); } else if (isDeleteFamilyVersion(cell)) { throwOnUnsupportedDeleteFamilyVersion(cell); } else { throwOnUnsupportedCellType(cell); } } } } return result; }

Target:
public AnviltopData.RowMutation.Builder adapt(Delete operation) { AnviltopData.RowMutation.Builder result = AnviltopData.RowMutation.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); if (operation.getFamilyCellMap().isEmpty()) { throwIfUnsupportedDeleteRow(operation); AnviltopData.RowMutation.Mod.Builder modBuilder = result.addModsBuilder(); modBuilder.setDeleteRow(true); } else { for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()) { ByteString familyByteString = ByteString.copyFrom(entry.getKey()); for (Cell cell : entry.getValue()) { if (isColumnDelete(cell) || isPointDelete(cell)) { if (isPointDelete(cell)) { throwIfUnsupportedPointDelete(cell); } addDeleteCellRange(result, familyByteString, cell); } else if (isFamilyDelete(cell)) { throwIfUnsupportedDeleteFamily(cell); addDeleteFamilyMods(result, familyByteString); } else if (isFamilyVersionDelete(cell)) { throwOnUnsupportedDeleteFamilyVersion(cell); } else { throwOnUnsupportedCellType(cell); } } } } return result; }
Source:
public void returnsNonZeroreturnsCode() throws Exception { final Shell shell = Mockito.mock(Shell.class); Mockito.doReturn(1).when(shell).exec( Mockito.anyString(), Mockito.any(InputStream.class), Mockito.any(TeeOutputStream.class), Mockito.any(TeeOutputStream.class) ); final Terminal terminal = new Terminal(shell); try { terminal.exec("", ""); Assert.fail("should throw IOException"); } catch (IOException ex) { Assert.assertTrue(true); } }

Target:
public void returnsNonZeroreturnsCode() throws Exception { final Shell shell = Mockito.mock(Shell.class); Mockito.doReturn(1).when(shell).exec( Mockito.anyString(), Mockito.any(InputStream.class), Mockito.any(OutputStream.class), Mockito.any(OutputStream.class) ); final Terminal terminal = new Terminal(shell); terminal.exec("", ""); }
Source:
public void switchOnOff(State state, ObjectInstance space) { boolean isOn = SpaceFactory.getOnOff(space); SpaceFactory.setOnOff(space, !isOn); if (!isOn) { for (String name : SpaceFactory.getContents(space)) { ObjectInstance container = state.getObject(name); if (!ContainerFactory.isEmptyContainer(container)) { if (SpaceFactory.isBaking(space) && ContainerFactory.isBakingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { IngredientFactory.bakeIngredient(state.getObject(ing)); } } else if (SpaceFactory.isHeating(space) && ContainerFactory.isHeatingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(ing))) { IngredientFactory.meltIngredient(state.getObject(ing)); } } } } } } }

Target:
private void switchOnOff(State state, ObjectInstance space) { boolean isOn = SpaceFactory.getOnOff(space); SpaceFactory.setOnOff(space, !isOn); if (!isOn) { for (String name : SpaceFactory.getContents(space)) { ObjectInstance container = state.getObject(name); if (!ContainerFactory.isEmptyContainer(container)) { if (SpaceFactory.isBaking(space) && ContainerFactory.isBakingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { IngredientFactory.bakeIngredient(state.getObject(ing)); } } else if (SpaceFactory.isHeating(space) && ContainerFactory.isHeatingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(ing))) { IngredientFactory.meltIngredient(state.getObject(ing)); } } } } } } }
Source:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getPath(presentationProvider, stateItem, ITimeEventStyleStrings.fillStyle()); String heightKey = getPath(presentationProvider, stateItem, ITimeEventStyleStrings.heightFactor()); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if (defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(rgbKey); if (store.getDefaultInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeightFactor = isLink(stateItem) ? TimeGraphControl.DEFAULT_LINK_WIDTH : TimeGraphControl.DEFAULT_STATE_WIDTH; defaultHeightFactor = (float) styleMap.getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeightFactor); store.setDefault(heightKey, defaultHeightFactor); } float width = store.getFloat(heightKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); } }

Target:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String fillColorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.fillColor()); String heightFactorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.heightFactor()); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(fillColorKey); if (defaultString.isEmpty()) { store.setDefault(fillColorKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(fillColorKey); if (store.getDefaultInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeightFactor = isLink(stateItem) ? TimeGraphControl.DEFAULT_LINK_WIDTH : TimeGraphControl.DEFAULT_STATE_WIDTH; defaultHeightFactor = (float) styleMap.getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeightFactor); store.setDefault(heightFactorKey, defaultHeightFactor); } float heightFactor = store.getFloat(heightFactorKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), heightFactor); } }
Source:
public DatacenterBrokerHeuristicExample() { Log.setLevel(Level.WARN); System.out.println("Starting " + getClass().getSimpleName()); boolean useBestFitBroker = true; seed = 0; random0 = new UniformDistr(0, 1, seed); simulation0 = new CloudSim(); final Datacenter datacenter0 = createDatacenter(simulation0); broker0 = createBroker(); vmList0 = createVms(random0); cloudletList0 = createCloudlets(random0); broker0.submitVmList(vmList0); broker0.submitCloudletList(cloudletList0); simulation0.start(); random1 = new UniformDistr(0, 1, seed); simulation1 = new CloudSim(); final Datacenter datacenter1 = createDatacenter(simulation1); if (useBestFitBroker) { broker1 = new DatacenterBrokerBestFit(simulation1); } else { broker1 = new DatacenterBrokerSimple(simulation1); broker1.setVmMapper(this::bestFitCloudletToVmMapper); } vmList1 = createVms(random1); cloudletList1 = createCloudlets(random1); broker1.submitVmList(vmList1); broker1.submitCloudletList(cloudletList1); simulation1.start(); final List<Cloudlet> finishedCloudlets0 = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets0).build(); final List<Cloudlet> finishedCloudlets1 = broker1.getCloudletFinishedList(); finishedCloudlets1.sort(Comparator.comparingLong(Cloudlet::getId)); new CloudletsTableBuilder(finishedCloudlets1).build(); print(broker0); }

Target:
public DatacenterBrokerHeuristicExample() { Log.setLevel(Level.WARN); System.out.println("Starting " + getClass().getSimpleName()); this.vmList = new ArrayList<>(); this.cloudletList = new ArrayList<>(); simulation = new CloudSim(); final Datacenter datacenter0 = createDatacenter(); DatacenterBrokerHeuristic broker0 = createBroker(); createAndSubmitVms(broker0); createAndSubmitCloudlets(broker0); simulation.start(); final List<Cloudlet> finishedCloudlets = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets).build(); print(broker0); }
Source:
static Object getAvroRecord (StreamlineEvent streamlineEvent, Schema schema) { if (streamlineEvent.keySet().size() == 1 && streamlineEvent.containsKey(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD)) { return streamlineEvent.get(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD); } GenericRecord result; result = new GenericData.Record(schema); for (Map.Entry<String, Object> entry: streamlineEvent.entrySet()) { result.put(entry.getKey(), getAvroValue(entry.getValue(), schema.getField(entry.getKey()).schema())); } return result; }

Target:
static Object getAvroRecord (StreamlineEvent streamlineEvent, Schema schema) { if (streamlineEvent.containsKey(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD)) { if (streamlineEvent.keySet().size() > 1) { throw new RuntimeException("Invalid schema, primitive schema can contain only one field."); } return streamlineEvent.get(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD); } GenericRecord result; result = new GenericData.Record(schema); for (Map.Entry<String, Object> entry: streamlineEvent.entrySet()) { result.put(entry.getKey(), getAvroValue(entry.getValue(), schema.getField(entry.getKey()).schema())); } return result; }
Source:
protected boolean createFolderNode(HierarchialElement el, ResourceResolver r) throws RepositoryException, PersistenceException { if (el == null || !el.isFolder()) { return false; } if (dryRunMode) { return true; } String folderPath = el.getNodePath(); String name = el.getName(); Session s = r.adaptTo(Session.class); if (s.nodeExists(folderPath)) { Node folderNode = s.getNode(folderPath); Node folderContentNode = folderNode.hasNode(JcrConstants.JCR_CONTENT) ? folderNode.getNode(JcrConstants.JCR_CONTENT) : null; if (folderPath.equals(jcrBasePath) || (null != folderContentNode && folderContentNode.hasProperty(JcrConstants.JCR_TITLE) && folderContentNode.getProperty(JcrConstants.JCR_TITLE).getString().equals(name))) { return false; } else { folderContentNode = folderNode.addNode(JcrConstants.JCR_CONTENT,JcrConstants.NT_UNSTRUCTURED); folderContentNode.setProperty(JcrConstants.JCR_TITLE, name); r.commit(); r.refresh(); return true; } } HierarchialElement parent = el.getParent(); String parentPath; if (parent == null) { parentPath = jcrBasePath; } else { parentPath = parent.getNodePath(); } if (!jcrBasePath.equals(parentPath)) { createFolderNode(parent, r); } Node child = s.getNode(parentPath).addNode(el.getNodeName(), DEFAULT_FOLDER_TYPE); trackDetailedActivity(el.getNodePath(), "Create Folder", "Create folder", 0L); incrementCount(createdFolders, 1L); if (!folderPath.equals(jcrBasePath)) { if(child.hasNode(JcrConstants.JCR_CONTENT)){ child.getNode(JcrConstants.JCR_CONTENT).setProperty(JcrConstants.JCR_TITLE, name); }else{ child.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_UNSTRUCTURED).setProperty(JcrConstants.JCR_TITLE, name); } } r.commit(); r.refresh(); return true; }

Target:
protected boolean createFolderNode(HierarchialElement el, ResourceResolver r) throws RepositoryException, PersistenceException { if (el == null || !el.isFolder()) { return false; } if (dryRunMode) { return true; } String folderPath = el.getNodePath(); String name = el.getName(); Session s = r.adaptTo(Session.class); if (s.nodeExists(folderPath)) { Node folderNode = s.getNode(folderPath); Node folderContentNode = folderNode.hasNode(JcrConstants.JCR_CONTENT) ? folderNode.getNode(JcrConstants.JCR_CONTENT) : null; if (folderNode.getPath().equals(jcrBasePath) || (null != folderContentNode && folderContentNode.hasProperty(JcrConstants.JCR_TITLE) && folderContentNode.getProperty(JcrConstants.JCR_TITLE).getString().equals(name))) { return false; } else { folderContentNode = folderNode.addNode(JcrConstants.JCR_CONTENT,JcrConstants.NT_UNSTRUCTURED); folderContentNode.setProperty(JcrConstants.JCR_TITLE, name); r.commit(); r.refresh(); return true; } } HierarchialElement parent = el.getParent(); String parentPath; if (parent == null) { parentPath = jcrBasePath; } else { parentPath = parent.getNodePath(); } if (!jcrBasePath.equals(parentPath)) { createFolderNode(parent, r); } Node child = s.getNode(parentPath).addNode(el.getNodeName(), DEFAULT_FOLDER_TYPE); trackDetailedActivity(el.getNodePath(), "Create Folder", "Create folder", 0L); setFolderTitle(child,folderPath,name); incrementCount(createdFolders, 1L); r.commit(); r.refresh(); return true; }
Source:
public void initialize() throws ParserConfigurationException, SAXException { saxParser = SAXParserFactory.newInstance().newSAXParser(); handler = new DatabaseProjectXmlHandler(projectsReceiver = new ProjectsReceiver()); }

Target:
public void initialize() throws ParserConfigurationException, SAXException { saxParser = SAXParserFactory.newInstance().newSAXParser(); projectsReceiver = new ProjectsReceiver(); handler = new DatabaseProjectXmlHandler(projectsReceiver); }
Source:
private static void makeWritable(@Nonnull Path path) throws IOException { if (!Functions.isWindows()) { try { PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class); Set<PosixFilePermission> newPermissions = ((PosixFileAttributes)attrs).permissions(); newPermissions.add(PosixFilePermission.OWNER_WRITE); Files.setPosixFilePermissions(path, newPermissions); } catch (NoSuchFileException e) { return; } catch (UnsupportedOperationException e) { } } path.toFile().setWritable(true); }

Target:
private static void makeWritable(@Nonnull Path path) throws IOException { if (!Functions.isWindows()) { try { PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class); Set<PosixFilePermission> newPermissions = ((PosixFileAttributes)attrs).permissions(); newPermissions.add(PosixFilePermission.OWNER_WRITE); Files.setPosixFilePermissions(path, newPermissions); return; } catch (NoSuchFileException e) { return; } catch (UnsupportedOperationException e) { } } path.toFile().setWritable(true); }
Source:
private Vector3i computeAABB(TreeGenerator treeGen, long seed) { Vector3i pos = new Vector3i(ChunkConstants.SIZE_X / 2, 0, ChunkConstants.SIZE_Z / 2); Vector3i min = new Vector3i(pos); Vector3i max = new Vector3i(pos); Rect2i chunks = Rect2i.createFromMinAndMax(-1, -1, 1, 1); for (Vector2i chunkPos : chunks) { Chunk chunk = new ChunkImpl(chunkPos.getX(), 0, chunkPos.getY()) { @Override public Block setBlock(int x, int y, int z, Block block) { Vector3i world = chunkToWorldPosition(x, y, z); minimize(min, world); maximize(max, world); return null; } }; Random random = new MersenneRandom(seed); BlockManager blockManager = CoreRegistry.get(BlockManager.class); Vector3i relPos = chunk.chunkToWorldPosition(0, 0, 0).sub(pos).invert(); treeGen.generate(blockManager, chunk, random, relPos.x, relPos.y, relPos.z); } Vector3i ext = new Vector3i(max).sub(min); return ext; }

Target:
private Vector3i computeAABB(TreeGenerator treeGen, long seed) { Vector3i pos = new Vector3i(ChunkConstants.SIZE_X / 2, 0, ChunkConstants.SIZE_Z / 2); final Vector3i min = new Vector3i(pos); final Vector3i max = new Vector3i(pos); Rect2i chunks = Rect2i.createFromMinAndMax(-1, -1, 1, 1); for (Vector2i chunkPos : chunks) { Chunk chunk = new ChunkImpl(chunkPos.getX(), 0, chunkPos.getY()) { @Override public Block setBlock(int x, int y, int z, Block block) { Vector3i world = chunkToWorldPosition(x, y, z); minimize(min, world); maximize(max, world); return null; } }; Random random = new MersenneRandom(seed); BlockManager blockManager = CoreRegistry.get(BlockManager.class); Vector3i relPos = chunk.chunkToWorldPosition(0, 0, 0).sub(pos).invert(); treeGen.generate(blockManager, chunk, random, relPos.x, relPos.y, relPos.z); } Vector3i ext = new Vector3i(max).sub(min); return ext; }
Source:
private static int getFirstGeneratedLineNumber(final String sourceFileName, final String smap) { try { final BufferedReader br = new BufferedReader( new StringReader(smap)); expectLine(br, "SMAP"); expectLine(br, sourceFileName); expectLine(br, "Kotlin"); expectLine(br, "*S Kotlin"); expectLine(br, "*F"); final BitSet sourceFileIds = new BitSet(); String line; while (!"*L".equals(line = br.readLine())) { br.readLine(); final Matcher m = FILE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final String fileName = m.group(2); if (fileName.equals(sourceFileName)) { sourceFileIds.set(Integer.parseInt(m.group(1))); } } if (sourceFileIds.isEmpty()) { throw new IllegalStateException("Unexpected SMAP"); } int min = Integer.MAX_VALUE; while (!"*E".equals(line = br.readLine())) { final Matcher m = LINE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final int inputStartLine = Integer.parseInt(m.group(1)); final int lineFileID = Integer .parseInt(m.group(2).substring(1)); final int outputStartLine = Integer.parseInt(m.group(4)); if (sourceFileIds.get(lineFileID) && inputStartLine == outputStartLine) { continue; } min = Math.min(outputStartLine, min); } return min; } catch (final IOException e) { throw new AssertionError(e); } }

Target:
private static int getFirstGeneratedLineNumber(final String sourceFileName, final String smap) { try { final BufferedReader br = new BufferedReader( new StringReader(smap)); expectLine(br, "SMAP"); expectLine(br, sourceFileName); expectLine(br, "Kotlin"); expectLine(br, "*S Kotlin"); expectLine(br, "*F"); final BitSet sourceFileIds = new BitSet(); String line; while (!"*L".equals(line = br.readLine())) { br.readLine(); final Matcher m = FILE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final String fileName = m.group(2); if (fileName.equals(sourceFileName)) { sourceFileIds.set(Integer.parseInt(m.group(1))); } } if (sourceFileIds.isEmpty()) { throw new IllegalStateException("Unexpected SMAP FileSection"); } int min = Integer.MAX_VALUE; while (!"*E".equals(line = br.readLine())) { final Matcher m = LINE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final int inputStartLine = Integer.parseInt(m.group(1)); final int lineFileID = Integer .parseInt(m.group(2).substring(1)); final int outputStartLine = Integer.parseInt(m.group(4)); if (sourceFileIds.get(lineFileID) && inputStartLine == outputStartLine) { continue; } min = Math.min(outputStartLine, min); } return min; } catch (final IOException e) { throw new AssertionError(e); } }
Source:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { String uri = message.getRequestHeader().getURI().toString(); String contentType = message.getResponseHeader() .getHeader(HttpHeader.CONTENT_TYPE) .toLowerCase(Locale.ROOT); String responseBodyStart = StringUtils.left(message.getResponseBody().toString(), 250) .toLowerCase(Locale.ROOT); if (uri.endsWith(".graphql") || uri.endsWith(".graphqls") || contentType.startsWith("application/graphql")) { schema = message.getResponseBody().toString(); LOG.debug("Found GraphQL schema at: " + uri); } if (responseBodyStart.contains("__schema") || responseBodyStart.contains("graphql")) { LOG.debug("Found GraphQl endpoint at: " + uri); return true; } return false; } catch (Exception e) { LOG.debug("Could not parse " + message.getRequestHeader().getURI()); return false; } }

Target:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { String uri = message.getRequestHeader().getURI().toString(); switch (MessageValidator.validate(message)) { case VALID_ENDPOINT: LOG.debug("Found GraphQl endpoint at: " + uri); return true; case VALID_SCHEMA: LOG.debug("Found GraphQL schema at: " + uri); break; } return false; }
Source:
public void testIsMapFunctionExtension1() throws InterruptedException { log.info("RemoveFunctionExtension TestCase with test attributeExpressionExecutors length"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "\ndefine stream inputStream (symbol string, price long, volume long);"; String query = ("@info(name = 'query1') from inputStream " + "select symbol,price,map:create() as tmpMap" + " insert into tmpStream;" + "@info(name = 'query2') from tmpStream select symbol,price,tmpMap, map:put(tmpMap,symbol,price) as map1" + " insert into outputStream;" + "@info(name = 'query3') from outputStream " + "select map:isMap(map1) as isMap1,map:isMap(symbol,price) as isMap2" + " insert into outputStream2;" ); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }

Target:
public void testIsMapFunctionExtension1() throws InterruptedException { log.info("RemoveFunctionExtension TestCase with test attributeExpressionExecutors length"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "\ndefine stream inputStream (symbol string, price long, volume long);"; String query = ("@info(name = 'query1') from inputStream " + "select symbol,price,map:create() as tmpMap" + " insert into tmpStream;" + "@info(name = 'query2') from tmpStream select symbol,price,tmpMap, map:put(tmpMap,symbol,price) "+ "as map1 insert into outputStream;" + "@info(name = 'query3') from outputStream " + "select map:isMap(map1) as isMap1,map:isMap(symbol,price) as isMap2" + " insert into outputStream2;" ); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }
Source:
public static Collection<ITmfTrace> getTraceSet(@Nullable ITmfTrace trace) { if (trace == null) { return ImmutableSet.of(); } List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class); if (traces.size() > 0) { Iterable<ITmfTrace> iterable = checkNotNull(Iterables.concat(Iterables.transform(traces, t -> getTraceSet(t)))); return ImmutableSet.copyOf(iterable); } return ImmutableSet.of(trace); }

Target:
public static Collection<ITmfTrace> getTraceSet(@Nullable ITmfTrace trace) { if (trace == null) { return ImmutableSet.of(); } List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class); if (!traces.isEmpty()) { Iterable<ITmfTrace> iterable = checkNotNull(Iterables.concat(Iterables.transform(traces, t -> getTraceSet(t)))); return ImmutableSet.copyOf(iterable); } return ImmutableSet.of(trace); }
Source:
private Input retrieveInput(String key) { validate(); Set<Entry<String, LinkedList<Input>>> set = items.entrySet(); for (Entry<String, LinkedList<Input>> entry: set) { String entryKey = entry.getKey(); LinkedList<Input> entryValue = entry.getValue(); InputKind kind = entryValue.get(0).getKind(); if (InputCollection.matchesInputName(kind, key, entryKey)) { if (entryValue.size() > 1) { throw new SplunkException(SplunkException.AMBIGUOUS, "Key has multiple values, specify a namespace"); } else { return entryValue.get(0); } } } return null; }

Target:
private Input retrieveInput(String key) { validate(); Set<Entry<String, LinkedList<Input>>> set = items.entrySet(); for (Entry<String, LinkedList<Input>> entry: set) { String entryKey = entry.getKey(); LinkedList<Input> entryValue = entry.getValue(); InputKind kind = entryValue.get(0).getKind(); if (InputCollection.matchesInputName(kind, key, entryKey)) { if (entryValue.size() > 1) { throw new SplunkException(SplunkException.AMBIGUOUS, "Multiple inputs matched " + key + "; specify a namespace to disambiguate."); } else { return entryValue.get(0); } } } return null; }
Source:
public ShowDiffPreferencesCommand( ListenableAccountDiffPreference prefs) { super(0, 's', PatchUtil.C.showSettings()); this.prefs = prefs; }

Target:
ShowDiffPreferencesCommand( ListenableAccountDiffPreference prefs) { super(0, 's', PatchUtil.C.showSettings()); this.prefs = prefs; }
Source:
public <T extends RegisteredService> T findServiceBy(final long id, final Class<T> clazz) { val result = this.serviceRegistry.findServiceById(id, clazz); if (result != null) { services.get(result.getId(), k -> result); } return result; }

Target:
public <T extends RegisteredService> T findServiceBy(final long id, final Class<T> clazz) { var service = getService(null, id); if (service != null && service.getClass().equals(clazz)) { return (T) service; } else { LOGGER.trace("The service with id and type is not found in the cache; trying to find it from [{}]", id, clazz, serviceRegistry.getName()); service = services.get(id, k -> this.serviceRegistry.findServiceById(id, clazz)); } return (T) validateRegisteredService(service); }
Source:
public static SQLQuery parse(String sql) { Preconditions.checkNotNull(sql); SQLQuery query = new SQLQuery(); Scanner scanner = new Scanner(sql.trim()); String op = scanner.next("\\w+"); if ("SELECT".equalsIgnoreCase(op)) { query.setOperation(Operation.READ); while (! scanner.hasNext("(?i)FROM")) { scanner.next(); } scanner.next(); String table = scanner.useDelimiter(",").next(); query.setTableName(table.trim()); } else if ("INSERT".equalsIgnoreCase(op)){ query.setOperation(Operation.WRITE); while (! scanner.hasNext("(?i)INTO")) { scanner.next(); } scanner.next(); String table = scanner.useDelimiter("[,\\(]").next(); query.setTableName(table.trim()); } else if ("UPDATE".equalsIgnoreCase(op)) { query.setOperation(Operation.WRITE); query.setTableName(scanner.next()); } else if( "DELETE".equalsIgnoreCase(op)) { query.setOperation(Operation.WRITE); scanner.next(); String table = scanner.next(); query.setTableName(table.trim()); } else { LOGGER.error("Error during parsing query:\n{}",sql); } scanner.close(); return query; }

Target:
public static SQLQuery parse(String sql) { Preconditions.checkNotNull(sql); SQLQuery query = new SQLQuery(); Scanner scanner = new Scanner(sql.trim()); String op = scanner.next("\\w+"); if ("SELECT".equalsIgnoreCase(op)) { query.setOperation(Operation.READ); while (! scanner.hasNext("(?i)FROM")) { scanner.next(); } scanner.next(); String table = keepSingleValue(scanner.next()); query.setTableName(table.trim()); } else if ("INSERT".equalsIgnoreCase(op)){ query.setOperation(Operation.WRITE); while (! scanner.hasNext("(?i)INTO")) { scanner.next(); } scanner.next(); String table = scanner.useDelimiter("[,\\(\\s]").next(); query.setTableName(table.trim()); } else if ("UPDATE".equalsIgnoreCase(op)) { query.setOperation(Operation.WRITE); query.setTableName(scanner.next()); } else if( "DELETE".equalsIgnoreCase(op)) { query.setOperation(Operation.WRITE); scanner.next(); String table = scanner.next(); query.setTableName(table.trim()); } else { LOGGER.error("Error during parsing query:\n{}",sql); } scanner.close(); return query; }
Source:
public void apply(OfflineCommandContext ctx) throws CommandFailedException, IOException { Map<String, Object> groovyAttributes = new HashMap<String, Object>(); groovyAttributes.put("atrConnectionName", connectionName); groovyAttributes.put("atrHandlesReferralsFor", handlesReferralsFor); groovyAttributes.put("atrInitialContextFactory", initialContextFactory); groovyAttributes.put("atrReferrals", referrals); groovyAttributes.put("atrSearchCredential", searchCredential); groovyAttributes.put("atrSearchDn", searchDn); groovyAttributes.put("atrSecurityRealm", securityRealm); groovyAttributes.put("atrUrl", url); groovyAttributes.put("atrReplaceExisting", replaceExisting); groovyAttributes.put("atrProperties", properties); ctx.client.apply(GroovyXmlTransform.of(AddLdapConnection.class) .parameters(groovyAttributes) .subtree("management", Subtree.management()) .build()); }

Target:
public void apply(OfflineCommandContext ctx) throws Exception { ctx.client.apply(GroovyXmlTransform.of(AddLdapConnection.class) .subtree("management", Subtree.management()) .parameter("atrConnectionName", connectionName) .parameter("atrHandlesReferralsFor", handlesReferralsFor) .parameter("atrInitialContextFactory", initialContextFactory) .parameter("atrReferrals", referrals) .parameter("atrSearchCredential", searchCredential) .parameter("atrSearchDn", searchDn) .parameter("atrSecurityRealm", securityRealm) .parameter("atrUrl", url) .parameter("atrReplaceExisting", replaceExisting) .parameter("atrProperties", properties) .build()); }
Source:
private static void addNoticeForMultipleValues(final RdapObject rdapObject, final AttributeType type, final List<RpslAttribute> values, final String key) { if(values.isEmpty() || values.size() == 1) { return; } final String commaSeperatedValues = values.stream().map( x -> x.getCleanValue()).collect(Collectors.joining(",")); final String title = String.format("Multiple %s attributes found", type.getName()); final String desc = String.format("There are multiple %s attributes %s in %s, but only the first %s %s was returned.", type.getName(), commaSeperatedValues, key, type.getName(), values.get(0).getCleanValue()); final Notice notice = new Notice(); notice.setTitle(title); notice.getDescription().add(desc); rdapObject.getNotices().add(notice); }

Target:
private static void addNoticeForMultipleValues(final RdapObject rdapObject, final AttributeType type, final List<RpslAttribute> values, final String key) { if(values.isEmpty() || values.size() == 1) { return; } final String commaSeperatedValues = values.stream().map( value -> value.getCleanValue()).collect(Collectors.joining(", ")); final String title = String.format("Multiple %s attributes found", type.getName()); final String desc = String.format("There are multiple %s attributes %s in %s, but only the first %s %s was returned.", type.getName(), commaSeperatedValues, key, type.getName(), values.get(0).getCleanValue()); final Notice notice = new Notice(); notice.setTitle(title); notice.getDescription().add(desc); rdapObject.getNotices().add(notice); }
Source:
public void filter(DocumentIndexingPackage dip) throws IndexingException { log.debug("Performing Datastream filter for object {}", dip.getPid()); ContentObject contentObj = dip.getContentObject(); FileObject fileObj = getFileObject(contentObj); if (fileObj != null) { boolean ownedByOtherObject = contentObj instanceof WorkObject; List<Datastream> datastreams = getDatastreams(fileObj, ownedByOtherObject); List<Datastream> derivatives = getDerivatives(fileObj.getPid(), ownedByOtherObject); datastreams.addAll(derivatives); IndexDocumentBean doc = dip.getDocument(); doc.setDatastream(getDatastreamStrings(datastreams)); doc.setFilesizeTotal(getFilesizeTotal(datastreams)); doc.setFilesizeSort(getFilesize(datastreams)); } else if (contentObj instanceof CollectionObject) { List<Datastream> derivatives = getDerivatives(contentObj.getPid(), false); List<Datastream> datastreams = new ArrayList<>(derivatives); IndexDocumentBean doc = dip.getDocument(); doc.setDatastream(getDatastreamStrings(datastreams)); } }

Target:
public void filter(DocumentIndexingPackage dip) throws IndexingException { log.debug("Performing Datastream filter for object {}", dip.getPid()); ContentObject contentObj = dip.getContentObject(); FileObject fileObj = getFileObject(contentObj); if (fileObj != null) { boolean ownedByOtherObject = contentObj instanceof WorkObject; List<Datastream> datastreams = getDatastreams(fileObj, ownedByOtherObject); List<Datastream> derivatives = getDerivatives(fileObj.getPid(), ownedByOtherObject); datastreams.addAll(derivatives); IndexDocumentBean doc = dip.getDocument(); doc.setDatastream(getDatastreamStrings(datastreams)); doc.setFilesizeTotal(getFilesizeTotal(datastreams)); doc.setFilesizeSort(getFilesize(datastreams)); } else { List<Datastream> derivatives = getDerivatives(contentObj.getPid(), false); IndexDocumentBean doc = dip.getDocument(); doc.setDatastream(getDatastreamStrings(derivatives)); } }
Source:
public LedgerEntry getEntry(long entryId) { long firstId = entries.get(0).getEntryId(); long lastId = entries.get(entries.size() - 1).getEntryId(); if (entryId < firstId || entryId > lastId) { return null; } return entries.get((int)(entryId - firstId)); }

Target:
public LedgerEntry getEntry(long entryId) { checkNotNull(entries, "entries has been recycled"); long firstId = entries.get(0).getEntryId(); long lastId = entries.get(entries.size() - 1).getEntryId(); if (entryId < firstId || entryId > lastId) { throw new IndexOutOfBoundsException("required index: " + entryId + " is out of bounds: [ " + firstId + ", " + lastId + " ]."); } return entries.get((int) (entryId - firstId)); }
Source:
public boolean isAccessible(Map context, Object target, Member member, String propertyName) { LOG.debug("Checking access for [target: {}, member: {}, property: {}]", target, member, propertyName); Class targetClass = target != null ? target.getClass() : member.getDeclaringClass(); Class memberClass = member.getDeclaringClass(); if (checkEnumAccess(target, member)) { LOG.trace("Allowing access to enum: target class of target [{}], member [{}]", targetClass, target, member); return true; } if (Modifier.isStatic(member.getModifiers()) && allowStaticMethodAccess) { LOG.debug("Support for accessing static methods [target: {}, targetClass: {}, member: {}, property: {}] is deprecated!", target, targetClass, member, propertyName); if (!isClassExcluded(member.getDeclaringClass())) { targetClass = member.getDeclaringClass(); } } if (isPackageExcluded(targetClass.getPackage(), memberClass.getPackage())) { LOG.warn("Package of target class of target or package of member are excluded!", targetClass.getPackage(), targetClass, target, memberClass.getPackage(), member); return false; } if (isClassExcluded(targetClass)) { LOG.warn("Target class of target is excluded!", targetClass, target); return false; } if (isClassExcluded(memberClass)) { LOG.warn("Declaring class of member type is excluded!", member); return false; } if (disallowProxyMemberAccess && ProxyUtil.isProxyMember(member, target)) { LOG.warn("Access to proxy is blocked! Target class of target [{}], member [{}]", targetClass, target, member); return false; } boolean allow = true; if (!checkStaticMethodAccess(member)) { LOG.warn("Access to static is blocked!", member); allow = false; } if (!allow) { return false; } return Modifier.isPublic(member.getModifiers()) && isAcceptableProperty(propertyName); }

Target:
public boolean isAccessible(Map context, Object target, Member member, String propertyName) { LOG.debug("Checking access for [target: {}, member: {}, property: {}]", target, member, propertyName); if (checkEnumAccess(target, member)) { LOG.trace("Allowing access to enum: target [{}], member [{}]", target, member); return true; } if (!checkStaticMethodAccess(member)) { LOG.warn("Access to static is blocked!", member); return false; } final Class memberClass = member.getDeclaringClass(); if (isClassExcluded(memberClass)) { LOG.warn("Declaring class of member type is excluded!", member); return false; } Class targetClass = Modifier.isStatic(member.getModifiers()) ? memberClass : target.getClass(); if (isPackageExcluded(targetClass.getPackage(), memberClass.getPackage())) { LOG.warn("Package of target class of target or package of member are excluded!", targetClass.getPackage(), targetClass, target, memberClass.getPackage(), member); return false; } if (isClassExcluded(targetClass)) { LOG.warn("Target class of target is excluded!", targetClass, target); return false; } if (disallowProxyMemberAccess && ProxyUtil.isProxyMember(member, target)) { LOG.warn("Access to proxy is blocked! Target class of target [{}], member [{}]", targetClass, target, member); return false; } return Modifier.isPublic(member.getModifiers()) && isAcceptableProperty(propertyName); }
Source:
protected Integer[] doInBackground(Void... voids) { System.out.println("doInBackground"); Integer[] result = {0,0,0}; try { SmartCardController smartCardController = ((MuzimaApplication)context).getSmartCardController(); List<SmartCardRecord> smartCardRecords = smartCardController.getSmartCardRecordWithNonUploadedData(); for(SmartCardRecord smartCardRecord : smartCardRecords){ if (smartCardController.syncSmartCardRecord(smartCardRecord)) { smartCardRecord.setEncryptedPayload(null); try { smartCardController.updateSmartCardRecord(smartCardRecord); } catch (SmartCardController.SmartCardRecordSaveException e) { Log.e(TAG, "Exception thrown while updating smartcard record.", e); } result[1]++; } else { result[0] = UPLOAD_ERROR; result[2]++; } } if(result[0] != UPLOAD_ERROR){ result[0] = SUCCESS; } return result; } catch (SmartCardController.SmartCardRecordFetchException e) { Log.e(TAG, "Exception thrown while uploading smartcard record.", e); result[0] = UPLOAD_ERROR; } return result; }

Target:
protected Integer[] doInBackground(Void... voids) { Integer[] result = {0,0,0}; try { SmartCardController smartCardController = ((MuzimaApplication)context).getSmartCardController(); List<SmartCardRecord> smartCardRecords = smartCardController.getSmartCardRecordWithNonUploadedData(); for(SmartCardRecord smartCardRecord : smartCardRecords){ if (smartCardController.syncSmartCardRecord(smartCardRecord)) { smartCardRecord.setEncryptedPayload(null); try { smartCardController.updateSmartCardRecord(smartCardRecord); } catch (SmartCardController.SmartCardRecordSaveException e) { Log.e(TAG, "Exception thrown while updating smartcard record.", e); } result[1]++; } else { result[0] = UPLOAD_ERROR; result[2]++; } } if(result[0] != UPLOAD_ERROR){ result[0] = SUCCESS; } return result; } catch (SmartCardController.SmartCardRecordFetchException e) { Log.e(TAG, "Exception thrown while uploading smartcard record.", e); result[0] = UPLOAD_ERROR; } return result; }
Source:
protected abstract void flush(byte[] payload) throws TTransportException; protected void handleResponse(byte[] frame) throws TException { Map<String, String> headers; headers = HeaderUtils.decodeFromFrame(frame); long opId; try { opId = Long.parseLong(headers.get(FContext.OPID_HEADER)); } catch (NumberFormatException e) { throw new TException("invalid protocol frame: op id not a uint64", e); } BlockingQueue<byte[]> queue; synchronized (this) { queue = queueMap.get(opId); } if (queue == null) { return; } try { queue.put(frame); } catch (InterruptedException e) { throw new TException(e); } }

Target:
protected abstract void flush(byte[] payload) throws TTransportException; protected void handleResponse(byte[] frame) throws TException { Map<String, String> headers; headers = HeaderUtils.decodeFromFrame(frame); long opId; try { opId = Long.parseLong(headers.get(FContext.OPID_HEADER)); } catch (NumberFormatException e) { throw new TProtocolException("invalid protocol frame: op id not a uint64", e); } BlockingQueue<byte[]> queue; synchronized (this) { queue = queueMap.get(opId); } if (queue == null) { return; } try { queue.put(frame); } catch (InterruptedException e) { throw new TException(e); } }
Source:
public void startSpan() { final Tracer tracer1 = mock(Tracer.class); List<Tracer> tracers = new ArrayList<>(Arrays.asList(tracer1)); final TracerProvider tracerProvider = new TracerProvider(tracers); Context updatedContext = tracerProvider.startSpan(Context.NONE, ProcessKind.SEND); verify(tracer1, times(1)).start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND)); }

Target:
public void startSpan() { tracerProvider.startSpan(Context.NONE, ProcessKind.SEND); for (Tracer t : tracers) { verify(t, times(1)) .start(eq(METHOD_NAME), any(), eq(ProcessKind.SEND)); } }
Source:
public void start() { if (namingContext != null) { return; } this.messageSender = new MessageSender(configuration); install(); }

Target:
public void start() throws NamingException, JMSException { if (namingContext != null) { return; } namingContext = new InitialContext(); TopicConnectionFactory tcf = (TopicConnectionFactory) namingContext.lookup( configuration.getConnectionFactoryJndiName()); ConnectionContextFactory ccf = new ConnectionContextFactory(tcf); this.messageSender = new MessageSender(ccf, configuration.getInventoryChangesTopicName()); install(); }
Source:
static boolean equalsVariableTime(CharSequence s1, CharSequence s2) { if (s1 instanceof AsciiString && s2 instanceof AsciiString) { return s1.equals(s2); } return String.valueOf(s1).equals(String.valueOf(s2)); }

Target:
static boolean equalsVariableTime(CharSequence s1, CharSequence s2) { return AsciiString.contentEquals(s1, s2); }