auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void serializeBytes(Baos bytes) { Baos b = new Baos(); b.putFlags(new boolean[]{true, nick.length() > 0, false, happiness != 0, false, true}); b.putBaos(gen); b.putBaos(uID); b.write(level); b.putFlags(new boolean[]{shiny, isHackmon}); if (nick.length() > 0) { b.putString(nick); } if (gen.num > 1) { b.putShort(item); if (gen.num > 2) { b.putShort(ability); b.write(nature); } b.write(gender); if (gen.num > 2 && happiness != 0) { b.write(happiness); } if (gen.num > 6 && hiddenPowerType() != 16) { b.write(hiddenPowerType); } } for (int i = 0; i < 4; i++) { b.putShort(moves[i].num); } for (int i = 0; i < 6; i++) b.write(EVs[i]); for (int i = 0; i < 6; i++) b.write(DVs[i]); bytes.putVersionControl(0, b); }

Target:
public void serializeBytes(Baos bytes) { Baos b = new Baos(); b.putFlags(new boolean[]{true, nick.length() > 0, false, happiness != 0,false, true, hiddenPowerType != (byte)TypeInfo.Type.Dark.ordinal()}); b.putBaos(gen); b.putBaos(uID); b.write(level); b.putFlags(new boolean[]{shiny, isHackmon}); if (nick.length() > 0) { b.putString(nick); } if (gen.num > 1) { b.putShort(item); if (gen.num > 2) { b.putShort(ability); b.write(nature); } b.write(gender); if (gen.num > 2 && happiness != 0) { b.write(happiness); } if (gen.num > 6 && hiddenPowerType() != (byte)TypeInfo.Type.Dark.ordinal()) { b.write(hiddenPowerType); } } for (int i = 0; i < 4; i++) { b.putShort(moves[i].num); } for (int i = 0; i < 6; i++) b.write(EVs[i]); for (int i = 0; i < 6; i++) b.write(DVs[i]); bytes.putVersionControl(0, b); }
Source:
private void showVolumeProfiling() { if(getSelectedItem() == null) { return; } VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(((GlusterVolumeEntity)getSelectedItem()).getClusterId(), ((GlusterVolumeEntity)getSelectedItem()).getId(), ((GlusterVolumeEntity)getSelectedItem()).getName(), this); VolumeProfileStatisticsModel.setCurrentTab(VolumeProfileStatisticsModel.ProfileTabSelected.BRICKS); setProfileWindow(profileStatsModel); profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(); }

Target:
private void showVolumeProfiling() { if(getSelectedItem() == null) { return; } GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName(), this); setProfileWindow(profileStatsModel); profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(true); }
Source:
public RateCalculationSwapLeg toLeg( LocalDate startDate, LocalDate endDate, PayReceive payReceive, Period lag, BusinessDayAdjustment businessDayAdjustment, DaysAdjustment paymentDateOffset, double notional) { return toLeg(startDate, endDate, payReceive, lag, businessDayAdjustment, paymentDateOffset, notional, false); }

Target:
public RateCalculationSwapLeg toLeg( LocalDate startDate, LocalDate endDate, PayReceive payReceive, Period lag, BusinessDayAdjustment businessDayAdjustment, DaysAdjustment paymentDateOffset, double notional) { return RateCalculationSwapLeg .builder() .payReceive(payReceive) .accrualSchedule(PeriodicSchedule.builder() .startDate(startDate) .endDate(endDate) .frequency(Frequency.TERM) .businessDayAdjustment(businessDayAdjustment) .build()) .paymentSchedule(PaymentSchedule.builder() .paymentFrequency(Frequency.TERM) .paymentDateOffset(paymentDateOffset) .build()) .calculation(InflationRateCalculation.builder() .index(index) .interpolated(interpolated) .lag(lag) .build()) .notionalSchedule(NotionalSchedule.of(getCurrency(), notional)) .build(); }
Source:
public String toString() { StringBuilder result = new StringBuilder("[Test: \"" + m_name + "\"") .append(" verbose:" + m_verbose); result.append("[parameters:"); for (String k : m_parameters.keySet()) { String v = m_parameters.get(k); result.append(k + "=>" + v); } result.append("]"); result.append("[metagroups:"); for (String g : m_metaGroups.keySet()) { List<String> mg = m_metaGroups.get(g); result.append(g).append("="); for (String n : mg) { result.append(n).append(","); } } result.append("] "); result.append("[included: "); for (String g : m_includedGroups) { result.append(g).append(" "); } result.append("]"); result.append("[excluded: "); for (String g : m_excludedGroups) { result.append(g).append(""); } result.append("] "); result.append(" classes:"); for (XmlClass cl : m_xmlClasses) { result.append(cl).append(" "); } result.append(" packages:"); for (XmlPackage p : m_xmlPackages) { result.append(p).append(" "); } result.append("] "); return result.toString(); }

Target:
public String toString() { StringBuffer result = new StringBuffer("[Test: \"" + m_name + "\"") .append(" verbose:" + m_verbose); result.append("[parameters:"); for (String k : m_parameters.keySet()) { String v = m_parameters.get(k); result.append(k + "=>" + v); } result.append("]"); result.append("[metagroups:"); for (String g : m_metaGroups.keySet()) { List<String> mg = m_metaGroups.get(g); result.append(g).append("="); for (String n : mg) { result.append(n).append(","); } } result.append("] "); result.append("[included: "); for (String g : m_includedGroups) { result.append(g).append(" "); } result.append("]"); result.append("[excluded: "); for (String g : m_excludedGroups) { result.append(g).append(""); } result.append("] "); result.append(" classes:"); for (XmlClass cl : m_xmlClasses) { result.append(cl).append(" "); } result.append(" packages:"); for (XmlPackage p : m_xmlPackages) { result.append(p).append(" "); } result.append("] "); return result.toString(); }
Source:
public Map<String, ActiveTopicsInfo> getConnectorActiveTopics(final @PathParam("connector") String connector) throws Throwable { return herder.connectorActiveTopics(connector); }

Target:
public Response getConnectorActiveTopics(final @PathParam("connector") String connector) throws Throwable { if (!config.getBoolean(TOPIC_TRACKING_ENABLE_CONFIG)) { return Response.status(Response.Status.FORBIDDEN) .entity("Topic tracking is disabled.") .build(); } ActiveTopicsInfo info = herder.connectorActiveTopics(connector); return Response.ok(Collections.singletonMap(info.connector(), info)).build(); }
Source:
public void shouldSynchronizeWorkspaceNameWithDevfileNameWhenDevfileIsUpdated() throws Exception { final AccountImpl account = new AccountImpl("accountId", "namespace", "test"); final WorkspaceImpl workspace1 = createWorkspaceFromDevfile("id", account, "name1"); final WorkspaceImpl workspace2 = createWorkspaceFromDevfile("id2", account, "name2"); manager.getTransaction().begin(); manager.persist(account); manager.persist(workspace1); manager.persist(workspace2); manager.getTransaction().commit(); workspace2.getDevfile().setName(workspace1.getDevfile().getName()); workspace2.getDevfile().setName(workspace1.getDevfile().getName()); manager.getTransaction().begin(); manager.merge(workspace2); manager.getTransaction().commit(); }

Target:
public void shouldSynchronizeWorkspaceNameWithDevfileNameWhenDevfileIsUpdated() throws Exception { final AccountImpl account = new AccountImpl("accountId", "namespace", "test"); final WorkspaceImpl workspace1 = createWorkspaceFromDevfile("id", account, "name1"); final WorkspaceImpl workspace2 = createWorkspaceFromDevfile("id2", account, "name2"); manager.getTransaction().begin(); manager.persist(account); manager.persist(workspace1); manager.persist(workspace2); manager.getTransaction().commit(); workspace2.getDevfile().setName(workspace1.getDevfile().getName()); manager.getTransaction().begin(); manager.merge(workspace2); manager.getTransaction().commit(); }
Source:
public void migrateIfNecessary_1_0_to_1_1() { try { String toMigrate = getFileContent("scesim-1-0.scesim"); String migrated = instance.migrateIfNecessary(toMigrate); assertTrue(toMigrate.contains("<ScenarioSimulationModel version=\"1.0\">")); assertFalse(migrated.contains("<ScenarioSimulationModel version=\"1.0\">")); assertTrue(migrated.contains("EXPECT")); assertFalse(migrated.contains("EXPECTED")); } catch (Exception e) { fail(e.getMessage()); e.printStackTrace(); } }

Target:
public void migrateIfNecessary_1_0_to_1_1() throws Exception { String toMigrate = getFileContent("scesim-1-0.scesim"); Document document = DOMParserUtil.getDocument(toMigrate); migrationInstance.from1_0to1_1().accept(document); Map<Node, List<Node>> retrieved = DOMParserUtil.getChildrenNodesMap(document, "expressionIdentifier", "type"); assertNotNull(retrieved); assertEquals(1, retrieved.size()); retrieved.forEach((node, typeNodes) -> { assertEquals(1, typeNodes.size()); assertEquals("EXPECT", typeNodes.get(0).getTextContent()); }); commonCheck(toMigrate, document, "1.1"); }
Source:
public SuccessOrFailure isReady(DockerComposeRule rule) { return SuccessOrFailure.onResultOf(() -> { CassandraKeyValueServiceImpl cassandraKeyValueService = CassandraKeyValueServiceImpl.create( CassandraKeyValueServiceConfigManager.createSimpleManager(KVS_CONFIG), LEADER_CONFIG, false); return cassandraKeyValueService.isInitialized(); }); }

Target:
public SuccessOrFailure isReady(DockerComposeRule rule) { return SuccessOrFailure.onResultOf(() -> CassandraKeyValueServiceImpl.create( CassandraKeyValueServiceConfigManager.createSimpleManager(KVS_CONFIG), LEADER_CONFIG) .isInitialized()); }
Source:
private void copyLiveInfo(ISessionInfo sessionInfo) { if (sessionInfo.getLivePort() != null) { fSessionInfo.setLivePort(sessionInfo.getLivePort()); } if (sessionInfo.getLiveUrl() != null) { fSessionInfo.setLiveUrl(sessionInfo.getLiveUrl()); } fSessionInfo.setLive(sessionInfo.isLive()); }

Target:
private void copyLiveInfo(ISessionInfo sessionInfo) { if (sessionInfo.getLivePort() != null) { fSessionInfo.setLivePort(sessionInfo.getLivePort()); } if (sessionInfo.getLiveUrl() != null) { fSessionInfo.setLiveUrl(sessionInfo.getLiveUrl()); } if (!getTargetNode().isVersionSupported("2.5.0")) { fSessionInfo.setLive(sessionInfo.isLive()); } }
Source:
private void onSelectFileClicked() { FileChooser chooser = new FileChooser(); chooser.setTitle("Select Files"); chooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("Java JARs", "*.jar"), new FileChooser.ExtensionFilter("Java WARs", "*.war"), new FileChooser.ExtensionFilter("Java EARs", "*.ear"), new FileChooser.ExtensionFilter("Java class files", "*.class") ); List<File> file = chooser.showOpenMultipleDialog(designerRoot.getMainStage()); for (File f : file) { fileListView.getItems().add(f); } }

Target:
private void onSelectFileClicked() { FileChooser chooser = new FileChooser(); chooser.setTitle("Select Files"); chooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("Java JARs", "*.jar"), new FileChooser.ExtensionFilter("Java WARs", "*.war"), new FileChooser.ExtensionFilter("Java EARs", "*.ear"), new FileChooser.ExtensionFilter("Java class files", "*.class") ); List<File> files = chooser.showOpenMultipleDialog(designerRoot.getMainStage()); fileListView.getItems().addAll(files); }
Source:
public @ResponseBody List<ColumnDataDto> importSpreadsheet(@RequestParam("file") MultipartFile file) throws IOException { String extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); SpreadsheetWrapper sheet = null; if (extension.equals("xlsx")) { sheet = new ExcelSpreadsheetWrapper(file.getInputStream()); } else if (extension.equals("ods")) { sheet = new OpenDocumentSpreadsheetWrapper(file.getInputStream()); } else if (extension.equals("csv")) { sheet = new DelimitedSpreadsheetWrapper(file.getInputStream()); } else { throw new RestException("Unknown file extension: " + extension + ". Only xlsx, ods, and csv files are accepted", Status.BAD_REQUEST); } int rows = sheet.getRowCount(); if (rows < 2) { throw new RestException("Spreadsheet contains no data to import", Status.BAD_REQUEST); } List<ColumnDataDto> columns = new ArrayList<>(); for (int i = 0; i < sheet.getColumnCount(); i++) { try { columns.add(new ColumnDataDto(sheet.getCellValue(0, i))); } catch (IllegalArgumentException e) { throw new RestException(String.format("Failed to parse heading cell at row 0, column %d", i), Status.BAD_REQUEST); } } for (int rowNum = 1; rowNum < sheet.getRowCount(); rowNum++) { for (int colNum = 0; colNum < sheet.getColumnCount(); colNum++) { try { columns.get(colNum).getData().add(sheet.getCellValue(rowNum, colNum)); } catch (IllegalArgumentException e) { throw new RestException(String.format("Failed to parse value of cell at row %d, column %d", rowNum, colNum), Status.BAD_REQUEST); } } } return columns; }

Target:
public @ResponseBody List<ColumnDataDto> importSpreadsheet(@RequestParam("file") MultipartFile file) throws IOException { String extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1).toLowerCase(); SpreadsheetWrapper sheet = null; switch (extension) { case "xlsx": sheet = new ExcelSpreadsheetWrapper(file.getInputStream()); break; case "ods": sheet = new OpenDocumentSpreadsheetWrapper(file.getInputStream()); break; case "csv": sheet = new DelimitedSpreadsheetWrapper(file.getInputStream()); break; default: throw new RestException("Unknown file extension: " + extension + ". Only xlsx, ods, and csv files are accepted", Status.BAD_REQUEST); } int rows = sheet.getRowCount(); if (rows < 2) { throw new RestException("Spreadsheet contains no data to import", Status.BAD_REQUEST); } List<ColumnDataDto> columns = new ArrayList<>(); for (int i = 0; i < sheet.getColumnCount(); i++) { try { columns.add(new ColumnDataDto(sheet.getCellValue(0, i))); } catch (IllegalArgumentException e) { throw new RestException(String.format("Failed to parse heading cell at row 0, column %d", i), Status.BAD_REQUEST); } } for (int rowNum = 1; rowNum < sheet.getRowCount(); rowNum++) { for (int colNum = 0; colNum < sheet.getColumnCount(); colNum++) { try { columns.get(colNum).getData().add(sheet.getCellValue(rowNum, colNum)); } catch (IllegalArgumentException e) { throw new RestException(String.format("Failed to parse value of cell at row %d, column %d", rowNum, colNum), Status.BAD_REQUEST); } } } return columns; }
Source:
private void doPublish() { String topic = (String) this.properties.get(PUBLISH_TOPIC_PROP_NAME); Integer qos = (Integer) this.properties.get(PUBLISH_QOS_PROP_NAME); Boolean retain = (Boolean) this.properties.get(PUBLISH_RETAIN_PROP_NAME); String mode = (String) this.properties.get(MODE_PROP_NAME); float setPoint = 0; float tempIncr = (Float) this.properties.get(TEMP_INCREMENT_PROP_NAME); if (MODE_PROP_PROGRAM.equals(mode)) { setPoint = (Float) this.properties.get(PROGRAM_SETPOINT_NAME); } else if (MODE_PROP_MANUAL.equals(mode)) { setPoint = (Float) this.properties.get(MANUAL_SETPOINT_NAME); } else if (MODE_PROP_VACATION.equals(mode)) { setPoint = 6.0F; } if (this.temperature + tempIncr < setPoint) { this.temperature += tempIncr; } else { this.temperature -= 4 * tempIncr; } KuraPayload payload = new KuraPayload(); payload.setTimestamp(new Date()); payload.addMetric("temperatureInternal", this.temperature); payload.addMetric("temperatureExternal", 5.0F); payload.addMetric("temperatureExhaust", 30.0F); int code = this.random.nextInt(); if (this.random.nextInt() % 5 == 0) { payload.addMetric("errorCode", code); } else { payload.addMetric("errorCode", 0); } try { this.cloudClient.publish(topic, payload, qos, retain); logger.info("Published to message: {}", topic, payload); } catch (Exception e) { logger.error("Cannot publish topic: {}" + topic, e); } }

Target:
private void doPublish() { String topic = (String) this.properties.get(PUBLISH_TOPIC_PROP_NAME); Integer qos = (Integer) this.properties.get(PUBLISH_QOS_PROP_NAME); Boolean retain = (Boolean) this.properties.get(PUBLISH_RETAIN_PROP_NAME); String mode = (String) this.properties.get(MODE_PROP_NAME); float setPoint = 0; float tempIncr = (Float) this.properties.get(TEMP_INCREMENT_PROP_NAME); if (MODE_PROP_PROGRAM.equals(mode)) { setPoint = (Float) this.properties.get(PROGRAM_SETPOINT_NAME); } else if (MODE_PROP_MANUAL.equals(mode)) { setPoint = (Float) this.properties.get(MANUAL_SETPOINT_NAME); } else if (MODE_PROP_VACATION.equals(mode)) { setPoint = 6.0F; } if (this.temperature + tempIncr < setPoint) { this.temperature += tempIncr; } else { this.temperature -= 4 * tempIncr; } KuraPayload payload = new KuraPayload(); payload.setTimestamp(new Date()); payload.addMetric("temperatureInternal", this.temperature); payload.addMetric("temperatureExternal", 5.0F); payload.addMetric("temperatureExhaust", 30.0F); int code = this.random.nextInt(); if (this.random.nextInt() % 5 == 0) { payload.addMetric("errorCode", code); } else { payload.addMetric("errorCode", 0); } try { this.cloudClient.publish(topic, payload, qos, retain); logger.info("Published to message: {}", topic, payload); } catch (Exception e) { logger.error("Cannot publish topic: {}", topic, e); } }
Source:
private void configureNavigationButtons() { next.setOnClickListener(v -> { if (!NetworkUtils.isInternetConnectionEstablished(this)) { ViewUtil.showShortSnackbar(rootLayout, R.string.no_internet); return; } setTitleAndDescriptions(); if (s_count > 3) { savePrevTitleDesc("prev_image_"); } presenter.handleNext(descriptionsAdapter.getTitle(), descriptionsAdapter.getDescriptions()); }); previous.setOnClickListener(v -> presenter.handlePrevious()); categoryNext.setOnClickListener(v -> presenter.handleCategoryNext(categoriesModel, false)); categoryPrevious.setOnClickListener(v -> presenter.handlePrevious()); licensePrevious.setOnClickListener(v -> presenter.handlePrevious()); submit.setOnClickListener(v -> { flag++; directKvStore.putInt("flag", flag); savePrevTitleDesc("prev_upload_"); Toast.makeText(this, R.string.uploading_started, Toast.LENGTH_LONG).show(); presenter.handleSubmit(categoriesModel); finish(); }); }

Target:
private void configureNavigationButtons() { next.setOnClickListener(v -> { if (!NetworkUtils.isInternetConnectionEstablished(this)) { ViewUtil.showShortSnackbar(rootLayout, R.string.no_internet); return; } setTitleAndDescriptions(); if (multipleUpload) { savePrevTitleDesc("prev_image_"); } presenter.handleNext(descriptionsAdapter.getTitle(), descriptionsAdapter.getDescriptions()); }); previous.setOnClickListener(v -> presenter.handlePrevious()); categoryNext.setOnClickListener(v -> presenter.handleCategoryNext(categoriesModel, false)); categoryPrevious.setOnClickListener(v -> presenter.handlePrevious()); licensePrevious.setOnClickListener(v -> presenter.handlePrevious()); submit.setOnClickListener(v -> { flagForSubmit = true; directKvStore.putBoolean("flagForSubmit", flagForSubmit); savePrevTitleDesc("prev_upload_"); Toast.makeText(this, R.string.uploading_started, Toast.LENGTH_LONG).show(); presenter.handleSubmit(categoriesModel); finish(); }); }
Source:
private void persist(HtmlParameterStats param) { try { if (param.getId() < 0) { RecordParam rp = Model.getSingleton().getDb().getTableParam().insert( param.getSite(), param.getType().name(), param.getName(), param.getTimesUsed(), setToString(param.getFlags()), setToString(param.getValues())); param.setId(rp.getParamId()); } else { Model.getSingleton().getDb().getTableParam().update( param.getId(), param.getTimesUsed(), setToString(param.getFlags()), setToString(param.getValues())); } } catch (DatabaseException e) { if (e.getCause() instanceof SQLDataException) { logger.info("Could not add or update param: " + param.getName()); logger.info("It is likely that the length of one of the data elements exceeded the column size."); if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } else { logger.error(e.getMessage(), e); } } }

Target:
private void persist(HtmlParameterStats param) { try { if (param.getId() < 0) { RecordParam rp = Model.getSingleton().getDb().getTableParam().insert( param.getSite(), param.getType().name(), param.getName(), param.getTimesUsed(), setToString(param.getFlags()), setToString(param.getValues())); param.setId(rp.getParamId()); } else { Model.getSingleton().getDb().getTableParam().update( param.getId(), param.getTimesUsed(), setToString(param.getFlags()), setToString(param.getValues())); } } catch (DatabaseException e) { if (e.getCause().getMessage().contains("truncation")) { logger.warn("Could not add or update param: " + param.getName()); logger.warn("It is likely that the length of one of the data elements exceeded the column size."); logger.warn(e.getMessage()); if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } else { logger.error(e.getMessage(), e); } } }
Source:
OperatorImpl createAndRegisterOperatorImpl(OperatorSpec prevOperatorSpec, OperatorSpec operatorSpec, SystemStream inputStream, Config config, TaskContext context) { if (!operatorImpls.containsKey(operatorSpec.getOpId()) || operatorSpec instanceof JoinOperatorSpec) { OperatorImpl operatorImpl = createOperatorImpl(prevOperatorSpec, operatorSpec, config, context); operatorImpl.init(config, context); operatorImpl.registerInputStream(inputStream); if (operatorSpec.getTimerFn() != null) { final TimerRegistry timerRegistry = operatorImpl.getTimerRegistry(); operatorSpec.getTimerFn().registerTimer(timerRegistry); } operatorImpls.put(operatorImpl.getOpImplId(), operatorImpl); Collection<OperatorSpec> registeredSpecs = operatorSpec.getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl nextImpl = createAndRegisterOperatorImpl(operatorSpec, registeredSpec, inputStream, config, context); operatorImpl.registerNextOperator(nextImpl); }); return operatorImpl; } else { OperatorImpl operatorImpl = operatorImpls.get(operatorSpec.getOpId()); operatorImpl.registerInputStream(inputStream); Collection<OperatorSpec> registeredSpecs = operatorSpec.getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { createAndRegisterOperatorImpl(operatorSpec, registeredSpec, inputStream, config, context); }); return operatorImpl; } }

Target:
OperatorImpl createAndRegisterOperatorImpl(OperatorSpec prevOperatorSpec, OperatorSpec operatorSpec, SystemStream inputStream, Config config, TaskContext context) { if (!operatorImpls.containsKey(operatorSpec.getOpId()) || operatorSpec instanceof JoinOperatorSpec) { OperatorImpl operatorImpl = createOperatorImpl(prevOperatorSpec, operatorSpec, config, context); operatorImpl.init(config, context); operatorImpl.registerInputStream(inputStream); if (operatorSpec.getTimerFn() != null) { final TimerRegistry timerRegistry = operatorImpl.createOperatorTimerRegistry(); operatorSpec.getTimerFn().registerTimer(timerRegistry); } operatorImpls.put(operatorImpl.getOpImplId(), operatorImpl); Collection<OperatorSpec> registeredSpecs = operatorSpec.getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl nextImpl = createAndRegisterOperatorImpl(operatorSpec, registeredSpec, inputStream, config, context); operatorImpl.registerNextOperator(nextImpl); }); return operatorImpl; } else { OperatorImpl operatorImpl = operatorImpls.get(operatorSpec.getOpId()); operatorImpl.registerInputStream(inputStream); Collection<OperatorSpec> registeredSpecs = operatorSpec.getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { createAndRegisterOperatorImpl(operatorSpec, registeredSpec, inputStream, config, context); }); return operatorImpl; } }
Source:
private boolean testVerticesEqual(final List<Vertex> vertecies, final List<Vertex> loadedVertecies) { for(int i=0; i<vertecies.size(); i++) { final Vertex vertex = vertecies.get(i); final Vertex loadedVertex = loadedVertecies.get(i); Assert.assertEquals(vertex.getSchema(), loadedVertex.getSchema()); Assert.assertEquals(vertex.getVertexType(), loadedVertex.getVertexType()); if (vertex.getAttributes() instanceof SourceInfo) { final SourceInfo sourceInfo = (SourceInfo) vertex.getAttributes(); final SourceInfo loadedSourceInfo = (SourceInfo) loadedVertex.getAttributes(); Assert.assertEquals(sourceInfo.getSchema(), loadedSourceInfo.getSchema()); Assert.assertEquals(sourceInfo.getSourceType(), loadedSourceInfo.getSourceType()); Assert.assertEquals(sourceInfo.getSourceConfiguration().toString(), loadedSourceInfo.getSourceConfiguration().toString()); Assert.assertEquals(sourceInfo.getWatermarkType(), loadedSourceInfo.getWatermarkType()); Assert.assertTrue(valuesEquals((Map) sourceInfo.getWatermarkConfiguration(), (Map) loadedSourceInfo.getWatermarkConfiguration())); } else { Assert.assertEquals(vertex.getAttributes().toString(), loadedVertex.getAttributes().toString()); } } return true; }

Target:
private void testVerticesEqual(final List<Vertex> vertecies, final List<Vertex> loadedVertecies) { for(int i=0; i<vertecies.size(); i++) { final Vertex vertex = vertecies.get(i); final Vertex loadedVertex = loadedVertecies.get(i); Assert.assertEquals(vertex.getSchema(), loadedVertex.getSchema()); Assert.assertEquals(vertex.getVertexType(), loadedVertex.getVertexType()); if (vertex.getAttributes() instanceof SourceInfo) { final SourceInfo sourceInfo = (SourceInfo) vertex.getAttributes(); final SourceInfo loadedSourceInfo = (SourceInfo) loadedVertex.getAttributes(); final Map<String, Object> stringConf = new HashMap<>(); for (final Map.Entry<CharSequence, Object> entry : loadedSourceInfo.getWatermarkConfiguration().entrySet()) { stringConf.put(entry.getKey().toString(), entry.getValue()); } Assert.assertEquals(sourceInfo.getSchema(), loadedSourceInfo.getSchema()); Assert.assertEquals(sourceInfo.getSourceType(), loadedSourceInfo.getSourceType()); Assert.assertEquals(sourceInfo.getSourceConfiguration().toString(), loadedSourceInfo.getSourceConfiguration().toString()); Assert.assertEquals(sourceInfo.getWatermarkType(), loadedSourceInfo.getWatermarkType()); Assert.assertEquals(sourceInfo.getWatermarkConfiguration(), stringConf); } else { Assert.assertEquals(vertex.getAttributes().toString(), loadedVertex.getAttributes().toString()); } } }
Source:
public synchronized void start() { if (mIsStarted || !isSupportedOnThisDevice()) { return; } mIsStarted = true; if (mTelephonyManager == null) { if (Build.VERSION.SDK_INT >= 18 ) { mGetAllInfoCellScanner = new GetAllCellInfoScannerMr2(); } else { mGetAllInfoCellScanner = new GetAllCellInfoScannerDummy(); } mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); if (mTelephonyManager == null) { return; } mPhoneType = mTelephonyManager.getPhoneType(); if (mPhoneType == TelephonyManager.PHONE_TYPE_NONE) { return; } if (mPhoneType != TelephonyManager.PHONE_TYPE_GSM && mPhoneType != TelephonyManager.PHONE_TYPE_CDMA) { throw new UnsupportedOperationException("Unexpected Phone Type: " + mPhoneType); } } mPhoneStateListener = new PhoneStateListener() { @Override public void onSignalStrengthsChanged(SignalStrength ss) { if (ss.isGsm()) { mSignalStrength = ss.getGsmSignalStrength(); } else { mCdmaDbm = ss.getCdmaDbm(); } } }; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); }

Target:
public synchronized void start() { if (mIsStarted || !isSupportedOnThisDevice()) { return; } mIsStarted = true; if (mTelephonyManager == null) { if (Build.VERSION.SDK_INT >= 18 ) { mGetAllInfoCellScanner = new GetAllCellInfoScannerMr2(); } else { mGetAllInfoCellScanner = new GetAllCellInfoScannerDummy(); } mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); if (mTelephonyManager == null) { return; } mPhoneType = mTelephonyManager.getPhoneType(); if (mPhoneType == TelephonyManager.PHONE_TYPE_NONE || mPhoneType == TelephonyManager.PHONE_TYPE_SIP) { return; } } mPhoneStateListener = new PhoneStateListener() { @Override public void onSignalStrengthsChanged(SignalStrength ss) { if (ss.isGsm()) { mSignalStrength = ss.getGsmSignalStrength(); } else { mCdmaDbm = ss.getCdmaDbm(); } } }; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); }
Source:
private void rescheduleNextRowTask() { if (nextRowFuture != null) { nextRowFuture.cancel(false); } lastRowEmittedAtMillis = System.currentTimeMillis(); nextRowFuture = NEXT_ROW_MONITOR_EXECUTOR_SERVICE.scheduleAtFixedRate( () -> { long cellCount = (rowInProgress != null) ? rowInProgress.cellCount : 0; long secondsSinceLastRowEmitted = (System.currentTimeMillis() - lastRowEmittedAtMillis) / 1000; if (!recievedFirstRow) { LOG.warn( "No rows emitted for " + secondsSinceLastRowEmitted + " seconds for a NEW Read request (Time to First Byte). " + "Current Rowmerger state: " + state.name() + ", Cells in current row: " + cellCount); } else { LOG.warn( "No rows emitted for " + secondsSinceLastRowEmitted + " seconds. Current Rowmerger state: " + state.name() + ", Cells in current row: " + cellCount); } }, NEXT_ROW_THRESHOLD_SECONDS, NEXT_ROW_THRESHOLD_SECONDS, TimeUnit.SECONDS); }

Target:
private void rescheduleNextRowTask() { try { nextRowMonitorReschedulingcounter++; if (nextRowMonitorReschedulingcounter % 20 == 0) { LOG.warn("RowMerger processed %d rows", nextRowMonitorReschedulingcounter - 1); } if (nextRowFuture != null) { nextRowFuture.cancel(false); } lastRowEmittedAtMillis = System.currentTimeMillis(); } catch (Exception e) { LOG.warn("Exception while scheduling NextRowFutureRunnable ", e); } finally { nextRowFuture = NEXT_ROW_MONITOR_EXECUTOR_SERVICE.scheduleAtFixedRate( new Runnable() { @Override public void run() { try { long cellCount = (rowInProgress != null) ? rowInProgress.cellCount : 0; long secondsSinceLastRowEmitted = (System.currentTimeMillis() - lastRowEmittedAtMillis) / 1000; if (!receivedFirstRow) { LOG.warn( "No rows emitted for " + secondsSinceLastRowEmitted + " seconds for a NEW Read request (Time to First Byte). " + "Current Rowmerger state: " + state.name() + ", Cells in current row: " + cellCount); } else { LOG.warn( "No rows emitted for " + secondsSinceLastRowEmitted + " seconds. Current Rowmerger state: " + state.name() + ", Cells in current row: " + cellCount); } } catch (Exception e) { LOG.warn("Exception in NextRowFutureRunnable ", e); } } }, NEXT_ROW_THRESHOLD_SECONDS, NEXT_ROW_THRESHOLD_SECONDS, TimeUnit.SECONDS); } }
Source:
private void createDirectoryWithNFiles(String directory, int n) throws ExecutionException, InterruptedException { final List<Future<Void>> tasks = new ArrayList<>(); ExecutorService es = Executors.newFixedThreadPool(10); for (int i = 0; i < n; i++) { final Path fileName = new Path("/" + directory + "/test" + i); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { touch(fileName); return null; } }; tasks.add(es.submit(callable)); } for (Future<Void> task : tasks) { task.get(); } es.shutdownNow(); }

Target:
private void createDirectoryWithNFiles(String directory, int n) throws ExecutionException, InterruptedException { final List<Future<Void>> tasks = new ArrayList<>(); ExecutorService es = Executors.newFixedThreadPool(10); for (int i = 0; i < n; i++) { final Path fileName = new Path("/" + directory + "/test" + i); tasks.add(es.submit(() -> { touch(fileName); return null; })); } for (Future<Void> task : tasks) { task.get(); } es.shutdownNow(); }
Source:
public static Object invokeMethod(final Object object, final boolean forceAccess, final String methodName, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { parameterTypes = ArrayUtils.nullToEmpty(parameterTypes); args = ArrayUtils.nullToEmpty(args); final String messagePrefix; final Method method; if (forceAccess) { messagePrefix = "No such method: "; method = getMatchingMethod(object.getClass(), methodName, parameterTypes); if (method != null) { method.setAccessible(true); } } else { messagePrefix = "No such accessible method: "; method = getMatchingAccessibleMethod(object.getClass(), methodName, parameterTypes); } if (method == null) { throw new NoSuchMethodException(messagePrefix + methodName + "() on object: " + object.getClass().getName()); } return method.invoke(object, args); }

Target:
public static Object invokeMethod(final Object object, final boolean forceAccess, final String methodName, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { parameterTypes = ArrayUtils.nullToEmpty(parameterTypes); args = ArrayUtils.nullToEmpty(args); final String messagePrefix; Method method = null; boolean isOriginallyAccessible = false; Object result = null; try { if (forceAccess) { messagePrefix = "No such method: "; method = getMatchingMethod(object.getClass(), methodName, parameterTypes); if (method != null) { isOriginallyAccessible = method.isAccessible(); if (!isOriginallyAccessible) { method.setAccessible(true); } } } else { messagePrefix = "No such accessible method: "; method = getMatchingAccessibleMethod(object.getClass(), methodName, parameterTypes); } if (method == null) { throw new NoSuchMethodException(messagePrefix + methodName + "() on object: " + object.getClass().getName()); } args = toVarArgs(method, args); result = method.invoke(object, args); } finally { if (method != null && forceAccess && method.isAccessible() != isOriginallyAccessible) { method.setAccessible(isOriginallyAccessible); } } return result; }
Source:
public void updatePassword(@ApiParam(value = "New password", required = true) @FormParam("password") String password) throws NotFoundException, ServerException, ConflictException { if (password == null || password.isEmpty()) { throw new ConflictException("Password required"); } if (password.length() < 8) { throw new ConflictException("Password should contain at least 8 characters"); } int numOfLetters = 0, numOfDigits = 0; for (byte passwordByte : password.getBytes()) { char passwordChar = (char)passwordByte; if (Character.isDigit(passwordChar)) { numOfDigits++; } if (Character.isLetter(passwordChar)) { numOfLetters++; } } if (numOfDigits == 0 || numOfLetters == 0) { throw new ConflictException("Password should contain letters and at least one digit"); } final User user = userDao.getById(currentUser().getId()); user.setPassword(password); userDao.update(user); }

Target:
public void updatePassword(@ApiParam(value = "New password", required = true) @FormParam("password") String password) throws NotFoundException, ServerException, ConflictException { if (password == null) { throw new ConflictException("Password required"); } if (password.length() < 8) { throw new ConflictException("Password should contain at least 8 characters"); } int numOfLetters = 0; int numOfDigits = 0; for (char passwordChar : password.toCharArray()) { if (Character.isDigit(passwordChar)) { numOfDigits++; } if (Character.isLetter(passwordChar)) { numOfLetters++; } } if (numOfDigits == 0 || numOfLetters == 0) { throw new ConflictException("Password should contain letters and digits"); } final User user = userDao.getById(currentUser().getId()); user.setPassword(password); userDao.update(user); }
Source:
public static AggregateCursor of(LocalDate date) { OffsetDateTime lastUpdate = date.atStartOfDay().atOffset(ZoneOffset.UTC); String cursorXml = String.format("<cursor xmlns=\"<LINK_0>\">" + "<attributeName>_LAST_UPDATE_DATE</attributeName>" + "<attributeValue>%s</attributeValue>" + "<uriLastReturnedValue/>" + "<isForwardCursor>true</isForwardCursor>" + "</cursor>", lastUpdate.format(ISO_OFFSET_DATE_TIME) ); return new AggregateCursor(cursorXml, Optional.of(lastUpdate), Optional.empty()); }

Target:
public static AggregateCursor of(LocalDate date) { OffsetDateTime lastUpdate = date.atStartOfDay().atOffset(ZoneOffset.UTC); Optional<String> lastUri = Optional.empty(); return new AggregateCursor(buildCursorXml(lastUpdate, lastUri), Optional.of(lastUpdate), lastUri); }
Source:
private List<Token> checkOnZenodoToken(User user) { List<Token> tokens = tokenDAO.findZenodoByUserId(user.getId()); if (!tokens.isEmpty()) { Token zenodoToken = tokens.get(0); DateTime updateTime = new DateTime(zenodoToken.getDbUpdateDate()); if (updateTime.plusHours(1).isBeforeNow()) { LOG.info("Refreshing the Zenodo Token"); String refreshUrl = zenodoUrl + "/oauth/token"; String payload = "client_id=" + zenodoClientID + "&client_secret=" + zenodoClientSecret + "&grant_type=refresh_token&refresh_token=" + zenodoToken.getRefreshToken(); refreshToken(refreshUrl, zenodoToken, client, tokenDAO, null, null, payload); } } return tokenDAO.findByUserId(user.getId()); }

Target:
private List<Token> checkOnZenodoToken(User user) { List<Token> tokens = tokenDAO.findZenodoByUserId(user.getId()); if (!tokens.isEmpty()) { Token zenodoToken = tokens.get(0); LocalDateTime now = LocalDateTime.now(); LocalDateTime updateTime = zenodoToken.getDbUpdateDate().toLocalDateTime(); if (now.isAfter(updateTime.plusHours(1).minusMinutes(1))) { LOG.info("Refreshing the Zenodo Token"); String refreshUrl = zenodoUrl + "/oauth/token"; String payload = "client_id=" + zenodoClientID + "&client_secret=" + zenodoClientSecret + "&grant_type=refresh_token&refresh_token=" + zenodoToken.getRefreshToken(); refreshToken(refreshUrl, zenodoToken, client, tokenDAO, null, null, payload); } } return tokenDAO.findByUserId(user.getId()); }
Source:
public void findByCandidateFieldRequestShouldFindCandidateCOnlyByPositionFilter() { String name = ""; String email = ""; String phone = ""; String position = "f"; List<CandidateEntity> expectedCandidates = Arrays.asList(candidateC); List<CandidateEntity> actualCandidates = candidateRepository .findByCandidateFilterRequest(name, email, phone, position, DEFAULT_PAGEREQUEST) .getContent(); assertCandidateList(expectedCandidates, actualCandidates); }

Target:
public void findByCandidateFieldRequestShouldFindCandidateCOnlyByPositionFilter() { final String name = StringUtils.EMPTY; final String email = StringUtils.EMPTY; final String phone = StringUtils.EMPTY; final String position = CANDIDATE_C_POSITION_FRAGMENT; final List<CandidateEntity> expectedCandidates = Arrays.asList(candidateC); final List<CandidateEntity> actualCandidates = candidateRepository .findByCandidateFilterRequest(name, email, phone, position, DEFAULT_PAGEREQUEST) .getContent(); assertCandidateList(expectedCandidates, actualCandidates); }
Source:
private void updatePatientIdentifiers(Config config, Patient patient, List<Identifier> fetchedIdentifierList) { String fetchedIdentifierDisplay; String newIdentifierName; for (Identifier fetchedIdentifier : fetchedIdentifierList) { for (Identifier newIdentifier : patient.getIdentifiers()) { fetchedIdentifierDisplay = fetchedIdentifier.getIdentifierType().getDisplay(); newIdentifierName = newIdentifier.getIdentifierType().getName(); if (newIdentifierName.equals(fetchedIdentifierDisplay)) { fetchedIdentifier.setIdentifier(newIdentifier.getIdentifier()); patientResource.updatePatientIdentifier(config, patient.getUuid(), fetchedIdentifier); } } } }

Target:
private void updatePatientIdentifiers(Config config, Patient patient, List<Identifier> fetchedIdentifierList) { String fetchedIdentifierName; String newIdentifierName; for (Identifier newIdentifier : patient.getIdentifiers()) { boolean isUpdated = false; for (Identifier fetchedIdentifier : fetchedIdentifierList) { fetchedIdentifierName = fetchedIdentifier.getIdentifierType().getName(); newIdentifierName = newIdentifier.getIdentifierType().getName(); if (newIdentifierName.equals(fetchedIdentifierName)) { fetchedIdentifier.setIdentifier(newIdentifier.getIdentifier()); patientResource.updatePatientIdentifier(config, patient.getUuid(), fetchedIdentifier); isUpdated = true; } } if (!isUpdated) { addNewPatientIdentifier(config, patient, newIdentifier); } } }
Source:
public String getTitle() { return "Export Wizard"; }

Target:
public String getTitle() { return i18n.exportWizardTitle(); }
Source:
private Optional<Producer<K, V>> maybeGetKafkaProducer(DatastreamTask task) { Producer<K, V> producer = _kafkaProducer; if (!_tasks.contains(task)) { _log.warn("Task has been unassigned for producer, abort the send", task); return Optional.empty(); } if (producer == null) { try { producer = initializeProducer(task); } catch (InterruptedException e) { _log.warn("Got interrupted while trying to initialize the producer for task {}", task); } } return Optional.ofNullable(producer); }

Target:
private Optional<Producer<K, V>> maybeGetKafkaProducer(DatastreamTask task) { if (!_tasks.contains(task)) { _log.warn("Task has been unassigned for producer, abort the send", task); return Optional.empty(); } Producer<K, V> producer = _kafkaProducer; if (producer == null) { try { producer = initializeProducer(task); } catch (InterruptedException e) { _log.warn("Got interrupted while trying to initialize the producer for task {}", task); } } return Optional.ofNullable(producer); }
Source:
public final void execute() throws MojoExecutionException, MojoFailureException { this.loadResources(); if (this.sourceIncludes == null || this.sourceIncludes.size() == 0) { this.sourceIncludes = ScansDirectory.DEFAULT_INCLUDES; } this.getLog().info("Running with the following value for parameter sourceIncludes: "+this.sourceIncludes); this.sources = new ScriptSearch(this.jsSrcDir,this.sourceIncludes,this.sourceExcludes); this.specs = new ScriptSearch(this.jsTestSrcDir,this.specIncludes,this.specExcludes); try { this.run(); } catch(MojoFailureException e) { throw e; } catch(Exception e) { throw new MojoExecutionException("The jasmine-maven-plugin encountered an exception: \n"+this.stringifiesStackTraces.stringify(e),e); } }

Target:
public void execute() throws MojoExecutionException, MojoFailureException { this.loadResources(); this.initIncludesExcludes(); this.sources = new ScriptSearch(this.jsSrcDir,this.sourceIncludes,this.sourceExcludes); this.specs = new ScriptSearch(this.jsTestSrcDir,this.specIncludes,this.specExcludes); try { this.run(); } catch(MojoFailureException e) { throw e; } catch(Exception e) { throw new MojoExecutionException("The jasmine-maven-plugin encountered an exception: \n"+this.stringifiesStackTraces.stringify(e),e); } }
Source:
protected Supplier<BsonValue> getReader(final T t) { final Class<?> documentClass = t.getClass(); final Optional<Method> maybeIdGetter = getIdGetter(documentClass); if (maybeIdGetter.isPresent()) { Method getter = maybeIdGetter.get(); getter.setAccessible(true); return () -> { try { return constructValue(getter.invoke(t)); } catch (Exception e) { e.printStackTrace(); return BsonNull.VALUE; } }; } else { final Optional<Field> maybeField = getIdField(documentClass); if (maybeField.isPresent()) { Field field = maybeField.get(); field.setAccessible(true); return () -> { try { return constructValue(field.get(t)); } catch (Exception e) { e.printStackTrace(); return BsonNull.VALUE; } }; } else { return () -> BsonNull.VALUE; } } }

Target:
private Supplier<BsonValue> getReader(final T t) { final Class<?> documentClass = t.getClass(); final Optional<Method> maybeIdGetter = getIdGetter(documentClass); if (maybeIdGetter.isPresent()) { Method getter = maybeIdGetter.get(); getter.setAccessible(true); return () -> { try { return constructValue(getter.invoke(t)); } catch (Exception e) { e.printStackTrace(); return BsonNull.VALUE; } }; } else { final Optional<Field> maybeField = getIdField(documentClass); if (maybeField.isPresent()) { Field field = maybeField.get(); field.setAccessible(true); return () -> { try { return constructValue(field.get(t)); } catch (Exception e) { e.printStackTrace(); return BsonNull.VALUE; } }; } else { return () -> BsonNull.VALUE; } } }
Source:
protected Merger(final Repository local) { if (local == null) { throw new IllegalArgumentException(JGitText.get().repositoryIsRequired); } db = local; inserter = local.newObjectInserter(); reader = inserter.newReader(); walk = new RevWalk(reader); }

Target:
protected Merger(final Repository local) { if (local == null) { throw new NullPointerException(JGitText.get().repositoryIsRequired); } db = local; inserter = local.newObjectInserter(); reader = inserter.newReader(); walk = new RevWalk(reader); }
Source:
public boolean intersectRectangle(Vector3f from, Vector3f direction) { Vector3f dirfrac = new Vector3f( 1.0f / direction.x, 1.0f / direction.y, 1.0f / direction.z ); float t1 = (min.x - from.x) * dirfrac.x; float t2 = (max.x - from.x) * dirfrac.x; float t3 = (min.y - from.y) * dirfrac.y; float t4 = (max.y - from.y) * dirfrac.y; float t5 = (min.z - from.z) * dirfrac.z; float t6 = (max.z - from.z) * dirfrac.z; float tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6)); float tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); if (tmax < 0) { return false; } if (tmin > tmax) { return false; } return true; }

Target:
public boolean intersectRectangle(Vector3f from, Vector3f direction) { Vector3f dirFrac = new Vector3f( 1.0f / direction.x, 1.0f / direction.y, 1.0f / direction.z ); float t1 = (min.x - from.x) * dirFrac.x; float t2 = (max.x - from.x) * dirFrac.x; float t3 = (min.y - from.y) * dirFrac.y; float t4 = (max.y - from.y) * dirFrac.y; float t5 = (min.z - from.z) * dirFrac.z; float t6 = (max.z - from.z) * dirFrac.z; float tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6)); float tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); if (tmax < 0) { return false; } if (tmin > tmax) { return false; } return true; }
Source:
protected boolean onError(Throwable exception) { if (super.onError(exception)) return true; int errorId = exception instanceof YoutubeStreamExtractor.DecryptException ? R.string.youtube_signature_decryption_error : exception instanceof ParsingException ? R.string.parsing_error : R.string.general_error; onUnrecoverableError(exception, UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(serviceId), url, errorId); return true; }

Target:
protected boolean onError(Throwable exception) { if (super.onError(exception)) return true; int errorId = exception instanceof YoutubeStreamExtractor.DecryptException ? R.string.youtube_signature_decryption_error : exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error; onUnrecoverableError(exception, UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(serviceId), url, errorId); return true; }
Source:
public StackIcon(String mediaType, byte[] data) throws IOException, ConflictException { if (data.length > 1024 * 1024) { throw new ConflictException("Maximum upload size exceeded."); } this.data = data; if (isSupportedMediaType(mediaType)) { this.mediaType = mediaType; } else { throw new IOException("Image media type '" + mediaType + "' is unsupported."); } }

Target:
public StackIcon(String mediaType, byte[] data) throws IOException, ConflictException { if (data == null || data.length == 0) { throw new IllegalStateException("Image content must not be empty"); } if (data.length > LIMIT_SIZE) { throw new ConflictException("Maximum upload size exceeded 1 Mb limit"); } this.data = data; if (!validMediaTypes.contains(mediaType)) { throw new IOException("Image media type '" + mediaType + "' is unsupported."); } this.mediaType = mediaType; }
Source:
private <T> List<T> createObjectsCollectionFromObject(T object) { List<T> objectCollection; if (object.getClass().isArray()) { T[] objectsAsArray = (T[]) object; objectCollection = Arrays.asList(objectsAsArray); } else if (Iterable.class.isAssignableFrom(object.getClass())) { objectCollection = (List<T>) object; } else { objectCollection = Collections.singletonList(object); } return objectCollection; }

Target:
private <T> List<T> createObjectsCollectionFromObject(T object) { List<T> objectCollection; if (object.getClass().isArray()) { T[] objectsAsArray = (T[]) object; objectCollection = Arrays.asList(objectsAsArray); } else if (Iterable.class.isAssignableFrom(object.getClass())) { objectCollection = new ArrayList<>(); ((Iterable<T>)object).forEach(objectCollection::add); } else { objectCollection = Collections.singletonList(object); } return objectCollection; }