auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean onFarmlandTrample(World world, BlockPos pos, IBlockState state, float fallDistance, Entity entity) { boolean trampleResult = entity.canTrample(world, state.getBlock(), pos, fallDistance); BlockEvent.FarmlandTrampleEvent event = new BlockEvent.FarmlandTrampleEvent(world, pos, state, fallDistance, trampleResult, entity); MinecraftForge.EVENT_BUS.post(event); return event.getResult() == Event.Result.ALLOW || (event.getResult() == Event.Result.DEFAULT && trampleResult); }

Target:
public static boolean onFarmlandTrample(World world, BlockPos pos, IBlockState state, float fallDistance, Entity entity) { if (entity.canTrample(world, state.getBlock(), pos, fallDistance)) { BlockEvent.FarmlandTrampleEvent event = new BlockEvent.FarmlandTrampleEvent(world, pos, state, fallDistance, entity); MinecraftForge.EVENT_BUS.post(event); return !event.isCanceled(); } return false; }
Source:
public void testSwitchStatement() { enableTypeInfoValidation = false; String switchStatement = lines( "function foo(x) {", " switch(x) {", " case 1: ", " var y = 5;", " default:", " var y = 5;", " case 2: ", " var y = 5;", " }", "}"); valid(switchStatement); Node switchNode = parseValidScript(switchStatement); Node defaultBlock = IR.block(); Node nodeToAppendChildTo = stream(NodeUtil.preOrderIterable(switchNode)) .filter(node -> node.isCase()) .findFirst() .get(); nodeToAppendChildTo.addChildToFront(defaultBlock); expectInvalid(switchNode, Check.SCRIPT); }

Target:
public void testSwitchStatement() { enableTypeInfoValidation = false; String switchStatement = lines( "function foo(x) {", " switch(x) {", " case 1: ", " var y = 5;", " case 2: ", " var y = 5;", " }", "}"); valid(switchStatement); Node rootScriptNode = parseValidScript(switchStatement); Node blockNode = IR.block(); Node nodeToAppendChildTo = stream(NodeUtil.preOrderIterable(rootScriptNode)) .filter(node -> node.isCase()) .findFirst() .get(); nodeToAppendChildTo.addChildToFront(blockNode); expectInvalid(rootScriptNode, Check.SCRIPT); }
Source:
private void initCreateButton() { createButton = new Button(Util.C.buttonCreateProject()); createButton.setEnabled(false); createButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { enableForm(false); doCreateProject(); } }); }

Target:
private void initCreateButton() { createButton = new Button(Util.C.buttonCreateProject()); createButton.setEnabled(false); createButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { doCreateProject(); } }); }
Source:
private static void waitForSymbolNames(String... symbolNames) { final SWTBotView viewBot = fBot.viewById(CallStackView.ID); List<String> symbolNameList = Lists.newArrayList(symbolNames); WaitUtils.waitUntil(vBot -> symbolNameList.equals(getVisibleStackFrames(vBot)), viewBot, "Wrong symbol names, expected:" + symbolNameList + ", got: " + getVisibleStackFrames(viewBot)); }

Target:
private static void waitForSymbolNames(String... symbolNames) { final SWTBotView viewBot = sfBot.viewById(CallStackView.ID); List<String> symbolNameList = Lists.newArrayList(symbolNames); WaitUtils.waitUntil(vBot -> symbolNameList.equals(getVisibleStackFrames(vBot)), viewBot, "Wrong symbol names, expected:" + symbolNameList + ", got: " + getVisibleStackFrames(viewBot)); }
Source:
public static List<TheoreticalSensitivityMetrics> calculateSensitivities(final int simulationSize, final Histogram<Integer> depthHistogram, final Histogram<Integer> baseQHistogram, final List<Double> alleleFractions) { final List<TheoreticalSensitivityMetrics> metricsOverVariousAlleleFractions = new ArrayList<>(); final double logOddsThreshold = 6.2; final Histogram<Double> sensitivityHistogram = new Histogram<>(); sensitivityHistogram.setBinLabel("allele_fraction"); sensitivityHistogram.setValueLabel("theoretical_sensitivity"); for (Double alleleFraction : alleleFractions) { final TheoreticalSensitivityMetrics theoreticalSensitivityMetrics = new TheoreticalSensitivityMetrics(); log.info("Calculating theoretical sensitivity for AF = " + alleleFraction + "."); theoreticalSensitivityMetrics.ALLELE_FRACTION = alleleFraction; theoreticalSensitivityMetrics.THEORETICAL_SENSITIVITY = TheoreticalSensitivity.theoreticalSensitivity(depthHistogram, baseQHistogram, simulationSize, logOddsThreshold, alleleFraction); theoreticalSensitivityMetrics.SIMULATION_SIZE = simulationSize; theoreticalSensitivityMetrics.LOG_ODDS_THRESHOLD = logOddsThreshold; theoreticalSensitivityMetrics.LARGE_NUMBER_OF_DRAWS = LARGE_NUMBER_OF_DRAWS; theoreticalSensitivityMetrics.DEPTH_BIN_WIDTH = DEPTH_BIN_WIDTH; theoreticalSensitivityMetrics.RANDOM_SEED = RANDOM_SEED; metricsOverVariousAlleleFractions.add(theoreticalSensitivityMetrics); } return metricsOverVariousAlleleFractions; }

Target:
public static List<TheoreticalSensitivityMetrics> calculateSensitivities(final int simulationSize, final Histogram<Integer> depthHistogram, final Histogram<Integer> baseQHistogram, final List<Double> alleleFractions) { final List<TheoreticalSensitivityMetrics> metricsOverVariousAlleleFractions = new ArrayList<>(); final double logOddsThreshold = 6.2; for (final double alleleFraction : alleleFractions) { final TheoreticalSensitivityMetrics theoreticalSensitivityMetrics = new TheoreticalSensitivityMetrics(); theoreticalSensitivityMetrics.ALLELE_FRACTION = alleleFraction; theoreticalSensitivityMetrics.THEORETICAL_SENSITIVITY = TheoreticalSensitivity.theoreticalSensitivity(depthHistogram, baseQHistogram, simulationSize, logOddsThreshold, alleleFraction); theoreticalSensitivityMetrics.THEORETICAL_SENSITIVITY_Q = QualityUtil.getPhredScoreFromErrorProbability((1 - theoreticalSensitivityMetrics.THEORETICAL_SENSITIVITY)); theoreticalSensitivityMetrics.SAMPLE_SIZE = simulationSize; theoreticalSensitivityMetrics.LOG_ODDS_THRESHOLD = logOddsThreshold; metricsOverVariousAlleleFractions.add(theoreticalSensitivityMetrics); } return metricsOverVariousAlleleFractions; }
Source:
static Set<String> getDisabledTests(Path testMappingsRootPath, String testGroup) { Set<String> disabledTests = new HashSet<>(); if (!testGroup.equals(PRESUBMIT)) { return disabledTests; } File disabledPresubmitTestsFile = new File(testMappingsRootPath.toString(), DISABLED_PRESUBMIT_TESTS); try { disabledTests.addAll( Arrays.asList( FileUtil.readStringFromFile(disabledPresubmitTestsFile) .split("\\r?\\n"))); } catch (IOException e) { RuntimeException runtimeException = new RuntimeException( String.format( "IO error (%s) when reading disabled tests from file (%s)", e.getMessage(), disabledPresubmitTestsFile.getAbsolutePath()), e); throw runtimeException; } return disabledTests; }

Target:
static Set<String> getDisabledTests(Path testMappingsRootPath, String testGroup) { Set<String> disabledTests = new HashSet<>(); File disabledPresubmitTestsFile = new File(testMappingsRootPath.toString(), DISABLED_PRESUBMIT_TESTS_FILE); if (!(testGroup.equals(PRESUBMIT) && disabledPresubmitTestsFile.exists())) { return disabledTests; } try { disabledTests.addAll( Arrays.asList( FileUtil.readStringFromFile(disabledPresubmitTestsFile) .split("\\r?\\n"))); } catch (IOException e) { throw new RuntimeException( String.format( "IO exception (%s) when reading disabled tests from file (%s)", e.getMessage(), disabledPresubmitTestsFile.getAbsolutePath()), e); } return disabledTests; }
Source:
private IRequirement getRequirement(SiteIU iu) { String id = iu.getID(); String range = iu.getRange(); String type = iu.getQueryType(); String expression = iu.getQueryExpression(); String[] params = iu.getQueryParams(); if (id != null) { VersionRange vRange = new VersionRange(range); return MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, vRange, null, false, false); } else if ("match".equals(type)) { String[] allArgs = new String[(params == null ? 0 : params.length) + 1]; allArgs[0] = id; if (params != null) System.arraycopy(params, 0, allArgs, 1, params.length); IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory() .<IInstallableUnit> matchExpression(ExpressionUtil.parse(expression), params); return MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true); } else if ("context".equals(type)) { throw new IllegalStateException( "Context iu queries are not supported in Tycho. Faulty expression is " + expression); } return null; }

Target:
private IRequirement getRequirement(SiteIU iu) { String id = iu.getID(); String range = iu.getRange(); String type = iu.getQueryType(); String expression = iu.getQueryExpression(); String[] params = iu.getQueryParams(); if (id != null) { VersionRange vRange = new VersionRange(range); return MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, vRange, null, false, false); } else if ("match".equals(type)) { IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory() .<IInstallableUnit> matchExpression(ExpressionUtil.parse(expression), params); return MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true); } else if ("context".equals(type)) { throw new IllegalStateException( "Context iu queries are not supported in Tycho. Faulty expression is " + expression); } return null; }
Source:
public static String[] getDefaultErrorParserIds() { if (fDefaultErrorParserIds==null) { return fAvailableErrorParsers.keySet().toArray(new String[0]); } return fDefaultErrorParserIds.toArray(new String[0]); }

Target:
public static String[] getDefaultErrorParserIds() { if (fDefaultErrorParserIds == null) { return fAvailableErrorParsers.keySet().toArray(new String[fAvailableErrorParsers.size()]); } return fDefaultErrorParserIds.toArray(new String[fDefaultErrorParserIds.size()]); }
Source:
public static String parse(String inField) throws IllegalArgumentException { Objects.requireNonNull(inField); String toFormat = UNDERSCORE_MATCHER.matcher(inField).replaceAll(REPLACEMENT_CHAR); try { var parsingResult = LaTeX2Unicode.parse(toFormat); if (parsingResult instanceof Parsed.Success) { String text = parsingResult.get().value(); toFormat = Normalizer.normalize(text, Normalizer.Form.NFC); return UNDERSCORE_PLACEHOLDER_MATCHER.matcher(toFormat).replaceAll("_"); } else { throw new IllegalArgumentException("Parsing of latex failed."); } } catch (Throwable throwable) { throw new IllegalArgumentException("An error occurred while attempting to parse latex."); } }

Target:
public static Optional<String> parse(String inField) { Objects.requireNonNull(inField); String toFormat = UNDERSCORE_MATCHER.matcher(inField).replaceAll(REPLACEMENT_CHAR); var parsingResult = LaTeX2Unicode.parse(toFormat); if (parsingResult instanceof Parsed.Success) { String text = parsingResult.get().value(); toFormat = Normalizer.normalize(text, Normalizer.Form.NFC); return Optional.of(UNDERSCORE_PLACEHOLDER_MATCHER.matcher(toFormat).replaceAll("_")); } return Optional.empty(); }
Source:
public Map<Symbol, Object> getMessageAnnotationsMap(boolean createIfAbsent) { Map<Symbol, Object> map = null; if (messageAnnotations != null) { map = messageAnnotations.getValue(); } if (map == null) { if (createIfAbsent) { map = new HashMap<>(); this.messageAnnotations = new MessageAnnotations(map); } else { map = Collections.EMPTY_MAP; } } return map; }

Target:
protected Map<Symbol, Object> getMessageAnnotationsMap(boolean createIfAbsent) { Map<Symbol, Object> map = null; if (messageAnnotations != null) { map = messageAnnotations.getValue(); } if (map == null) { if (createIfAbsent) { map = new HashMap<>(); this.messageAnnotations = new MessageAnnotations(map); } else { map = Collections.EMPTY_MAP; } } return map; }
Source:
public UniqueRandomFunction(int minValue, int maxValue) { this.dataset = this.initIntegerDataset(minValue, maxValue); this.shuffleDataset(); this.nextValueIndex = 0; }

Target:
public UniqueRandomFunction(int minValue, int maxValue) { if(minValue >= maxValue) { throw new IllegalArgumentException("maxValue cannot be greater than minValue."); } this.dataset = this.initIntegerDataset(minValue, maxValue); this.shuffleDataset(); }
Source:
public Object decodeBytes(byte[] b, Object object) throws SerializationException { if (!(object instanceof Schema)) { throw logger.logExceptionAsError( new SerializationException("Attempted to decode with non-Avro schema object in AvroByteDecoder")); } Schema schema = (Schema) object; if (schema.getType().equals(Schema.Type.BYTES)) { return b; } DatumReader<?> reader = getDatumReader(schema); try { Object result = reader.read(null, decoderFactory.binaryDecoder(b, null)); if (schema.getType().equals(Schema.Type.STRING)) { return result.toString(); } return result; } catch (IOException | RuntimeException e) { throw logger.logExceptionAsError(new SerializationException("Error deserializing Avro message.", e)); } }

Target:
public Object decodeBytes(byte[] b, Object object) { Objects.requireNonNull(object, "Schema must not be null."); if (!(object instanceof Schema)) { throw logger.logExceptionAsError( new SerializationException("Object must be an Avro schema.")); } Schema schema = (Schema) object; if (schema.getType().equals(Schema.Type.BYTES)) { return b; } DatumReader<?> reader = getDatumReader(schema); try { Object result = reader.read(null, DECODER_FACTORY.binaryDecoder(b, null)); if (schema.getType().equals(Schema.Type.STRING)) { return result.toString(); } return result; } catch (IOException | RuntimeException e) { throw logger.logExceptionAsError(new SerializationException("Error deserializing Avro message.", e)); } }
Source:
private void updateDestinationVds(final Guid dstVdsId, final VM vm) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance() .getVdsDynamicDao() .updatePartialVdsDynamicCalc(dstVdsId, 1, vm.getNumOfCpus(), vm.getMinAllocatedMem(), 0, 0); return null; } }); log.debugFormat( "IncreasePendingVms::MigrateVm Increasing vds {0} pending vcpu count, in {1}, and pending vmem size, in {2}. Vm: {3}", dstVdsId, vm.getNumOfCpus(), vm.getMinAllocatedMem(), vm.getName()); }

Target:
private void updateDestinationVds(final Guid dstVdsId, final VM vm) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { DbFacade.getInstance() .getVdsDynamicDao() .updatePartialVdsDynamicCalc(dstVdsId, 1, vm.getNumOfCpus(), vm.getMinAllocatedMem(), 0, 0); log.debugFormat( "IncreasePendingVms::MigrateVm Increasing vds {0} pending vcpu count, in {1}, and pending vmem size, in {2}. Vm: {3}", dstVdsId, vm.getNumOfCpus(), vm.getMinAllocatedMem(), vm.getName()); } }); }
Source:
public boolean has(final String name) { if (parsed == null) { throw new IllegalStateException("parse() wasn't called"); } return parsed.containsKey(name); }

Target:
public boolean has(final String name) { if (!options.containsKey(name)) { throw new IllegalArgumentException("Unknown option " + name); } else if (parsed == null) { throw new IllegalStateException("parse() wasn't called"); } return parsed.containsKey(name); }
Source:
private Stream<String> attributeIdsFromResponseAsStream(Response response) { return response .getAssertions() .stream() .flatMap(assertion -> assertion.getAttributeStatements().stream()) .flatMap(statement -> statement.getAttributes().stream()) .flatMap(attribute -> attribute.getAttributeValues().stream()) .filter(attributeValue -> attributeValue instanceof XSString) .map(attributeValue -> (XSString) attributeValue) .map(XSString::getValue) .filter(StringUtils::isNotBlank); }

Target:
private Stream<String> attributeIdsFromResponseAsStream(Response response) { return response .getAssertions() .stream() .flatMap(assertion -> assertion.getAttributeStatements().stream()) .flatMap(statement -> statement.getAttributes().stream()) .flatMap(attribute -> attribute.getAttributeValues().stream()) .filter(XSString.class::isInstance) .map(XSString.class::cast) .map(XSString::getValue) .filter(StringUtils::isNotBlank); }
Source:
static public String filenameNoCompression(String filename) { for ( String ext : extensions ) { if ( filename.endsWith(ext) ) return filename.substring(0, filename.length()-ext.length()); } return filename; }

Target:
static public String filenameNoCompression(String filename) { if ( FilenameUtils.isExtension(filename, extensions) ) { return FilenameUtils.removeExtension(filename); } return filename; }
Source:
public void elideSecurityEnabled() { Elide elide = new Elide(new ElideSettingsBuilder(dataStore) .withEntityDictionary(new EntityDictionary(TestCheckMappings.MAPPINGS)) .withAuditLogger(new TestAuditLogger()) .build()); com.yahoo.elide.security.User user = new com.yahoo.elide.security.User(new Principal() { @Override public String getName() { return "-1"; } }); ElideResponse response = elide.get("parent/1/children", new MultivaluedHashMap<>(), user); assertEquals(response.getResponseCode(), HttpStatus.SC_OK); assertEquals(response.getBody(), "{\"data\":[]}"); }

Target:
public void elideSecurityEnabled() { Elide elide = new Elide(new ElideSettingsBuilder(dataStore) .withEntityDictionary(new EntityDictionary(TestCheckMappings.MAPPINGS)) .withAuditLogger(new TestAuditLogger()) .build()); com.yahoo.elide.security.User user = new com.yahoo.elide.security.User(() -> "-1"); ElideResponse response = elide.get("parent/1/children", new MultivaluedHashMap<>(), user); assertEquals(response.getResponseCode(), HttpStatus.SC_OK); assertEquals(response.getBody(), "{\"data\":[]}"); }
Source:
public CloudSecurityGroups securityGroups(CloudCredential cloudCredential, Region region, Map<String, String> filters) throws IOException { Compute compute = GcpStackUtil.buildCompute(cloudCredential); String projectId = GcpStackUtil.getProjectId(cloudCredential); Map<String, Set<CloudSecurityGroup>> result = new HashMap<>(); FirewallList firewallList = compute.firewalls().list(projectId).execute(); for (Firewall firewall : firewallList.getItems()) { Map<String, Object> properties = new HashMap<>(); properties.put("network", getNetworkName(firewall)); CloudSecurityGroup cloudSecurityGroup = new CloudSecurityGroup(firewall.getName(), firewall.getName(), properties); result.computeIfAbsent(region.value(), k -> new HashSet<>()).add(cloudSecurityGroup); } if (filters != null) { String sharedProjectId = filters.get(SHARED_PROJECT_ID); if (!Strings.isNullOrEmpty(sharedProjectId)) { try { FirewallList sharedProjectFirewalls = compute.firewalls().list(sharedProjectId).execute(); for (Firewall firewall : sharedProjectFirewalls.getItems()) { Map<String, Object> properties = new HashMap<>(); properties.put("network", getNetworkName(firewall)); CloudSecurityGroup cloudSecurityGroup = new CloudSecurityGroup(firewall.getName(), firewall.getName(), properties); result.computeIfAbsent(region.value(), k -> new HashSet<>()).add(cloudSecurityGroup); } } catch (Exception ex) { LOGGER.warn(String.format("We can not read the host project which id %s", sharedProjectId)); } } } return new CloudSecurityGroups(result); }

Target:
public CloudSecurityGroups securityGroups(CloudCredential cloudCredential, Region region, Map<String, String> filters) throws IOException { Compute compute = GcpStackUtil.buildCompute(cloudCredential); String projectId = GcpStackUtil.getProjectId(cloudCredential); Map<String, Set<CloudSecurityGroup>> result = new HashMap<>(); FirewallList firewallList = compute.firewalls().list(projectId).execute(); for (Firewall firewall : firewallList.getItems()) { Map<String, Object> properties = new HashMap<>(); properties.put("network", getNetworkName(firewall)); CloudSecurityGroup cloudSecurityGroup = new CloudSecurityGroup(firewall.getName(), firewall.getName(), properties); result.computeIfAbsent(region.value(), k -> new HashSet<>()).add(cloudSecurityGroup); } if (filters != null) { String sharedProjectId = filters.get(SHARED_PROJECT_ID); if (!Strings.isNullOrEmpty(sharedProjectId)) { try { FirewallList sharedProjectFirewalls = compute.firewalls().list(sharedProjectId).execute(); for (Firewall firewall : sharedProjectFirewalls.getItems()) { Map<String, Object> properties = new HashMap<>(); properties.put("network", getNetworkName(firewall)); CloudSecurityGroup cloudSecurityGroup = new CloudSecurityGroup(firewall.getName(), firewall.getName(), properties); result.computeIfAbsent(region.value(), k -> new HashSet<>()).add(cloudSecurityGroup); } } catch (Exception ex) { LOGGER.warn(String.format("We can not read the host project with id %s", sharedProjectId)); } } } return new CloudSecurityGroups(result); }
Source:
public void start() { isPessimisticCache = cacheConfiguration.transaction().lockingMode() == LockingMode.PESSIMISTIC; useClusteredWriteSkewCheck = Configurations.isVersioningEnabled(cacheConfiguration); rollbackRpcOptions = createRpcOptionsFor2ndPhase(cacheConfiguration.transaction().syncRollbackPhase() ); commitRpcOptions = createRpcOptionsFor2ndPhase(cacheConfiguration.transaction().syncCommitPhase() ); }

Target:
public void start() { isPessimisticCache = cacheConfiguration.transaction().lockingMode() == LockingMode.PESSIMISTIC; useClusteredWriteSkewCheck = Configurations.isVersioningEnabled(cacheConfiguration); }
Source:
protected Builder() { super(); id("azurecompute-arm") .name("Azure Resource Management ") .apiMetadata(new AzureManagementApiMetadata()) .endpoint("<LINK_0>") .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .linkedServices("azureblob", "azurequeue", "azuretable") .defaultProperties(AzureComputeProviderMetadata.defaultProperties()); }

Target:
protected Builder() { super(); id("azurecompute-arm") .name("Azure Resource Management ") .apiMetadata(new AzureManagementApiMetadata()) .endpoint("<LINK_0>") .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .linkedServices("azureblob") .defaultProperties(AzureComputeProviderMetadata.defaultProperties()); }
Source:
public Object evaluate(Object feature) { Object arg0; Object arg1; MatchAction matchAction = null; try { arg0 = (Object) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #0 - expected type Object"); } try { arg1 = (Object) getExpression(1).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #1 - expected type Object"); } if (getParameters().size() > 2) { try { matchAction = MatchAction.valueOf((String) getExpression(2).evaluate(feature)); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #2 - expected one of ANY, ONE or ALL"); } } return Boolean.valueOf(StaticGeometry.equalTo(arg0, arg1, matchAction)); }

Target:
public Object evaluate(Object feature) { Expression arg0 = getExpression(0); Expression arg1 = getExpression(1); MatchAction matchAction = null; if (getParameters().size() > 2) { try { matchAction = (MatchAction) getExpression(2).evaluate(feature, MatchAction.class); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #2 - expected one of ANY, ONE or ALL"); } } Filter equalTo = matchAction == null ? getFilterFactory2().equal(arg0, arg1, false) : getFilterFactory2().equal(arg0, arg1, false, matchAction); return equalTo.evaluate(feature); }
Source:
public void act(float delta) { super.act(delta); getCurrentFrame().act(delta); if (getCurrentFrame().isDone()) { getCurrentFrame().reset(); currentFrame = function.getNextFrameIndex(currentFrame, frames.size()); } }

Target:
public void act(float delta) { super.act(delta); while (delta > 0) { getCurrentFrame().act(delta); delta = getCurrentFrame().surplusTime(); if (delta >= 0) { getCurrentFrame().reset(); setCurrentFrame(function.getNextFrameIndex(currentFrame, frames.size())); } } }
Source:
private <T extends AbstractEntity> boolean isAuditable(final T entity) { if(entity.getClass().isAnnotationPresent(Auditable.class)) { return true; } return false; }

Target:
private <T extends AbstractEntity> boolean isAuditable(final T entity) { Assert.requireNonNull(entity , "entity"); if(entity.getClass().isAnnotationPresent(Auditable.class)) { return true; } return false; }
Source:
public void testGetForValidId() throws JsonProcessingException { final UUID uuid = UUID.randomUUID(); Assert.assertFalse(alertRepo.get(uuid).isPresent()); final Transaction transaction = Ebean.beginTransaction(); try { final models.ebean.Alert ebeanAlert = new models.ebean.Alert(); ebeanAlert.setNagiosExtension(TEST_NAGIOS_EXTENSIONS); ebeanAlert.setName(TEST_NAME); ebeanAlert.setOperator(TEST_OPERATOR); ebeanAlert.setPeriod(TEST_PERIOD_IN_SECONDS); ebeanAlert.setStatistic(TEST_STATISTIC); ebeanAlert.setQuantityValue(TEST_QUANTITY_VALUE); ebeanAlert.setQuantityUnit(TEST_QUANTITY_UNIT); ebeanAlert.setCluster(TEST_CLUSTER); ebeanAlert.setUuid(uuid); ebeanAlert.setMetric(TEST_METRIC); ebeanAlert.setContext(TEST_CONTEXT); ebeanAlert.setService(TEST_SERVICE); Ebean.save(ebeanAlert); transaction.commit(); } finally { transaction.end(); } final Optional<Alert> expected = alertRepo.get(uuid); Assert.assertTrue(expected.isPresent()); Assert.assertEquals(uuid, expected.get().getId()); Assert.assertEquals(TEST_CLUSTER, expected.get().getCluster()); Assert.assertEquals(TEST_METRIC, expected.get().getMetric()); Assert.assertEquals(TEST_EXTENSIONS, expected.get().getExtensions()); Assert.assertEquals(TEST_SERVICE, expected.get().getService()); Assert.assertEquals(TEST_NAME, expected.get().getName()); Assert.assertEquals(TEST_OPERATOR, expected.get().getOperator()); Assert.assertEquals(Period.seconds(TEST_PERIOD_IN_SECONDS), expected.get().getPeriod()); Assert.assertEquals(TEST_STATISTIC, expected.get().getStatistic()); Assert.assertEquals(TEST_QUANTITY, expected.get().getValue()); Assert.assertEquals(TEST_CONTEXT, expected.get().getContext()); }

Target:
public void testGetForValidId() throws IOException { final UUID uuid = UUID.randomUUID(); Assert.assertFalse(alertRepo.get(uuid).isPresent()); final models.ebean.Alert ebeanAlert = TestBeanFactory.createEbeanAlert(); ebeanAlert.setUuid(uuid); try (Transaction transaction = Ebean.beginTransaction()) { Ebean.save(ebeanAlert); transaction.commit(); } final Optional<Alert> expected = alertRepo.get(uuid); Assert.assertTrue(expected.isPresent()); Assert.assertTrue(isAlertEbeanEquivalent(expected.get(), ebeanAlert)); }
Source:
private static void initializeAppsLocation(File serverXML, File configDir, File bootstrapFile, Map<String, String> bootstrapProp, File serverEnvFile) { try { serverFile = serverXML; configDirectory = configDir; locations = new HashSet<String>(); props = new Properties(); Document doc = parseDocument(new FileInputStream(serverFile)); if (serverEnvFile.exists()) { Properties propServerEnv = new Properties(); propServerEnv.load(new FileInputStream(serverEnvFile)); props.putAll(propServerEnv); } if (bootstrapProp != null && !bootstrapProp.isEmpty()) { props.putAll(bootstrapProp); } else if (bootstrapFile.exists()) { Properties propBootStrap = new Properties(); propBootStrap.load(new FileInputStream(bootstrapFile)); props.putAll(propBootStrap); } parseIncludeVariables(doc); parseConfigDropinsDirVariables("defaults"); parseVariables(doc); parseConfigDropinsDirVariables("overrides"); parseApplication(doc, "/server/application"); parseApplication(doc, "/server/webApplication"); parseApplication(doc, "/server/enterpriseApplication"); parseInclude(doc); parseConfigDropinsDir(); } catch (Exception e) { e.printStackTrace(); } }

Target:
private static void initializeAppsLocation(File serverXML, File configDir, File bootstrapFile, Map<String, String> bootstrapProp, File serverEnvFile) { try { serverFile = serverXML; configDirectory = configDir; locations = new HashSet<String>(); props = new Properties(); Document doc = parseDocument(new FileInputStream(serverFile)); Properties fProps; File cfgDirFile = getFileFromConfigDirectory("server.env"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (serverEnvFile.exists()) { fProps = parseProperties(new FileInputStream(serverEnvFile)); props.putAll(fProps); } cfgDirFile = getFileFromConfigDirectory("bootstrap.properties"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (bootstrapProp != null && !bootstrapProp.isEmpty()) { props.putAll(bootstrapProp); } else if (bootstrapFile.exists()) { fProps = parseProperties(new FileInputStream(bootstrapFile)); props.putAll(fProps); } parseIncludeVariables(doc); parseConfigDropinsDirVariables("defaults"); parseVariables(doc); parseConfigDropinsDirVariables("overrides"); parseApplication(doc, "/server/application"); parseApplication(doc, "/server/webApplication"); parseApplication(doc, "/server/enterpriseApplication"); parseInclude(doc); parseConfigDropinsDir(); } catch (Exception e) { e.printStackTrace(); } }
Source:
private CredentialsProvider getCredentialsProvider() { CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( System.getProperty("solr.username"), System.getProperty("solr.credentials")); provider.setCredentials(AuthScope.ANY, credentials); return provider; }

Target:
private CredentialsProvider getCredentialsProvider() { String username = getUsername(); String password = getPassword(); CredentialsProvider provider = new BasicCredentialsProvider(); org.apache.http.auth.UsernamePasswordCredentials credentials = new org.apache.http.auth.UsernamePasswordCredentials(username, password); provider.setCredentials(AuthScope.ANY, credentials); return provider; }
Source:
public void removeWorkspace(String workspaceId) throws ConflictException, ServerException { TracingTags.WORKSPACE_ID.set(workspaceId); TracingTags.USER_ID.set(() -> EnvironmentContext.getCurrent().getSubject().getUserId()); try { TracingTags.STACK_ID.set( workspaceDao.get(workspaceId).getAttributes().getOrDefault("stackId", "no stack")); } catch (NotFoundException e) { LOG.warn("Unable to provide stack id for tracing"); } requireNonNull(workspaceId, "Required non-null workspace id"); if (runtimes.hasRuntime(workspaceId)) { throw new ConflictException( format("The workspace '%s' is currently running and cannot be removed.", workspaceId)); } workspaceDao.remove(workspaceId); LOG.info("Workspace '{}' removed by user '{}'", workspaceId, sessionUserNameOrUndefined()); }

Target:
public void removeWorkspace(String workspaceId) throws ConflictException, ServerException { TracingTags.WORKSPACE_ID.set(workspaceId); requireNonNull(workspaceId, "Required non-null workspace id"); if (runtimes.hasRuntime(workspaceId)) { throw new ConflictException( format("The workspace '%s' is currently running and cannot be removed.", workspaceId)); } Optional<WorkspaceImpl> workspaceOpt = workspaceDao.remove(workspaceId); workspaceOpt.ifPresent( workspace -> TracingTags.STACK_ID.set( workspace.getAttributes().getOrDefault("stackId", "no stack"))); LOG.info("Workspace '{}' removed by user '{}'", workspaceId, sessionUserNameOrUndefined()); }
Source:
public void doVisitRandomArticle() { final Bus bus = app.getBus(); Handler randomHandler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app.getPrimarySite(), app) { @Override public void onBeforeExecute() { setState(true); } @Override public void onFinish(PageTitle title) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article title pulled: " + title); if (title != null) { randomListener.onRandomPageReceived(title); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }

Target:
public void doVisitRandomArticle() { Handler randomHandler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app.getPrimarySite(), app) { @Override public void onBeforeExecute() { setState(true); } @Override public void onFinish(PageTitle title) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article title pulled: " + title); if (title != null) { randomListener.onRandomPageReceived(title); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }
Source:
public QueryableGridDialect<?> initiateService(Map configurationValues, ServiceRegistryImplementor registry) { return asQueryableGridDialectOrNull( registry.getService( GridDialect.class ) ); }

Target:
public QueryableGridDialect<?> initiateService(Map configurationValues, ServiceRegistryImplementor registry) { return GridDialects.getDialectFacetOrNull( registry.getService( GridDialect.class ), QueryableGridDialect.class ); }
Source:
private void updateAllocation() { long totalAllocations = 0; double scale; for (Long allocation : writerList.values()) { totalAllocations += allocation; } if (totalAllocations <= totalMemoryPool) { scale = 1.0; } else { scale = (double) totalMemoryPool / totalAllocations; LOG.warn(String.format( "Total allocation exceeds %.2f%% (%,d bytes) of heap memory\n" + "Scaling row group sizes to %.2f%% for %d writers", 100*memoryPoolRatio, totalMemoryPool, 100*scale, writerList.size())); } int maxColCount = 0; for (InternalParquetRecordWriter w : writerList.keySet()) { maxColCount = Math.max(w.getSchema().getColumns().size(), maxColCount); } for (Map.Entry<InternalParquetRecordWriter, Long> entry : writerList.entrySet()) { long newSize = (long) Math.floor(entry.getValue() * scale); if(scale < 1.0 && minMemoryAllocation > 0 && newSize < minMemoryAllocation) { throw new ParquetRuntimeException(String.format("New Memory allocation %d" + " is smaller than the minimum allocation size of %d", newSize, minMemoryAllocation)){}; } entry.getKey().setRowGroupSizeThreshold(newSize); LOG.debug(String.format("Adjust block size from %,d to %,d for writer: %s", entry.getValue(), newSize, entry.getKey())); } }

Target:
private void updateAllocation() { long totalAllocations = 0; double scale; for (Long allocation : writerList.values()) { totalAllocations += allocation; } if (totalAllocations <= totalMemoryPool) { scale = 1.0; } else { scale = (double) totalMemoryPool / totalAllocations; LOG.warn(String.format( "Total allocation exceeds %.2f%% (%,d bytes) of heap memory\n" + "Scaling row group sizes to %.2f%% for %d writers", 100*memoryPoolRatio, totalMemoryPool, 100*scale, writerList.size())); } int maxColCount = 0; for (InternalParquetRecordWriter w : writerList.keySet()) { maxColCount = Math.max(w.getSchema().getColumns().size(), maxColCount); } for (Map.Entry<InternalParquetRecordWriter, Long> entry : writerList.entrySet()) { long newSize = (long) Math.floor(entry.getValue() * scale); if(scale < 1.0 && minMemoryAllocation > 0 && newSize < minMemoryAllocation) { throw new ParquetRuntimeException(String.format("New Memory allocation %d bytes" + " is smaller than the minimum allocation size of %d bytes.", newSize, minMemoryAllocation)){}; } entry.getKey().setRowGroupSizeThreshold(newSize); LOG.debug(String.format("Adjust block size from %,d to %,d for writer: %s", entry.getValue(), newSize, entry.getKey())); } }
Source:
public Object getMember(String memberName) { if (memberName == MEMBER_ARTIFACT_KEY) return key; if (memberName == MEMBER_PROPERTIES) { if (properties == null) { properties = new OrderedProperties(); } return properties; } if (memberName == MEMBER_PROCESSING_STEPS) return processingSteps; if (memberName == MEMBER_REPOSITORY) return repository; throw new IllegalArgumentException("No such member: " + memberName); }

Target:
public Object getMember(String memberName) { if (memberName == MEMBER_ARTIFACT_KEY) return key; if (memberName == MEMBER_PROPERTIES) { synchronized (this) { if (properties == null) { properties = new OrderedProperties(); } } return properties; } if (memberName == MEMBER_PROCESSING_STEPS) return processingSteps; if (memberName == MEMBER_REPOSITORY) return repository; throw new IllegalArgumentException("No such member: " + memberName); }
Source:
public ProjectToOrganizationConverter(ResultApprover resultApprover, byte[] relationColumnFamilyBytes) { super(resultApprover); this.relationColumnFamilyBytes = OafHelper.copyArrayWhenNotNull(relationColumnFamilyBytes); }

Target:
public ProjectToOrganizationConverter(ResultApprover resultApprover, byte[] relationColumnFamilyBytes) { super(resultApprover); Preconditions.checkNotNull(resultApprover); Preconditions.checkNotNull(relationColumnFamilyBytes); this.relationColumnFamilyBytes = OafHelper.copyArrayWhenNotNull(relationColumnFamilyBytes); }
Source:
public void trimDocument() { int len = 0; len = getDocument().getLength(); if (len > maxChars) { int n = len - maxChars; System.out.println("trimDocument: remove " + n + " chars"); try { getDocument().remove(0, n); } catch (BadLocationException ble) { } } }

Target:
public void trimDocument() { int len = 0; len = getDocument().getLength(); if (len > trimMaxChars) { int n = len - trimMaxChars; try { getDocument().remove(0, n); } catch (BadLocationException ble) { } } }
Source:
protected String[] getBodyArray( HttpResponse response ) throws IOException { StringWriter sw = new StringWriter(); IOUtils.copy( response.getEntity().getContent(), sw ); IOUtils.closeQuietly( response.getEntity().getContent() ); return sw.toString().split( System.lineSeparator() ); }

Target:
protected String[] getBodyArray( HttpResponse response ) throws IOException { try { StringWriter sw = new StringWriter(); IOUtils.copy( response.getEntity().getContent(), sw ); return sw.toString().split( System.lineSeparator() ); } finally { IOUtils.closeQuietly( response.getEntity().getContent() ); } }
Source:
public void should_know_the_url_of_the_last_build() { view = JobView.of( a(job().whereTheLast(build().numberIs(22))), config, locatedAt("job/project-name") ); assertThat(view.lastBuildUrl(), is("job/project-name/22/")); }

Target:
public void should_know_the_url_of_the_last_build() { view = a(jobView().of( a(job().whereTheLast(build().hasNumber(22)))) .with(locatedAt("job/project-name"))); assertThat(view.lastBuildUrl(), is("job/project-name/22/")); }
Source:
public boolean supports(MediaType delimiter) { if (this.mediaTypes == null) { return true; } else { for (MediaType mediaType : this.mediaTypes) { if (mediaType.isCompatibleWith(delimiter)) { return true; } } return false; } }

Target:
public boolean supports(MediaType delimiter) { if (this.mediaTypes.isEmpty()) { return true; } else { for (MediaType mediaType : this.mediaTypes) { if (mediaType.isCompatibleWith(delimiter)) { return true; } } return false; } }
Source:
public static void freeDirectBuffer(ByteBuffer buffer) { if (!ALLOW_CUSTOM_CLEANER || customerCleaner == null) { PlatformDependent.freeDirectBuffer(buffer); } else { customerCleaner.freeDirectMemory(buffer); } }

Target:
public static void freeDirectBuffer(ByteBuffer buffer) { CustomCleaner localCustomCleaner; if (!ALLOW_CUSTOM_CLEANER || (localCustomCleaner = DirectCleaner.customCleaner) == null) { PlatformDependent.freeDirectBuffer(buffer); } else { localCustomCleaner.freeDirectMemory(buffer); } }
Source:
public void addComponent(JComponent component, String orientation){ workspaceBar.add(component, orientation); }

Target:
protected void addComponent(JComponent component, String orientation){ workspaceBar.add(component, orientation); }
Source:
private boolean rewrite() { match(subject); if (success) { List<ExtendedSubstitution> normalizedExtSubsts = getCNFExtendedSubstitutions( fExtSubst, fMultiExtSubsts); Profiler.startTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); ExtendedSubstitution solution = null; for (ExtendedSubstitution extSubst : normalizedExtSubsts) { Map<Variable, Term> updatedSubst = evaluateConditions(extSubst.substitution()); if (updatedSubst != null) { extSubst.setSubst(updatedSubst); solution = extSubst; break; } } Profiler.stopTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); if (solution != null) { Profiler.startTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); Transformer substAndEvalTransformer = new CopyOnShareSubstAndEvalTransformer( solution.substitution(), rule.reusableLhsVariables().elementSet(), context); for (Cell cell : solution.writeCells()) { String cellLabel = cell.getLabel(); Term rightHandSide = getWriteCellRHS(cellLabel); if (rule.cellsToCopy().contains(cellLabel)) { rightHandSide = DeepCloner.clone(rightHandSide); } cell.unsafeSetContent((Term) rightHandSide.accept(substAndEvalTransformer)); } Profiler.stopTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); } else { success = false; } } return success; }

Target:
private boolean rewrite() { match(subject); if (success) { List<ExtendedSubstitution> normalizedExtSubsts = getCNFExtendedSubstitutions( fExtSubst, fMultiExtSubsts); Profiler.startTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); ExtendedSubstitution solution = null; for (ExtendedSubstitution extSubst : normalizedExtSubsts) { Map<Variable, Term> updatedSubst = evaluateConditions(extSubst.substitution()); if (updatedSubst != null) { extSubst.setSubst(updatedSubst); solution = extSubst; break; } } Profiler.stopTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); if (solution != null) { Profiler.startTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); Transformer substAndEvalTransformer = new CopyOnShareSubstAndEvalTransformer( solution.substitution(), rule.reusableVariables().elementSet(), context); for (Cell cell : solution.writeCells()) { String cellLabel = cell.getLabel(); Term rightHandSide = getWriteCellRHS(cellLabel); if (rule.cellsToCopy().contains(cellLabel)) { rightHandSide = DeepCloner.clone(rightHandSide); } cell.unsafeSetContent((Term) rightHandSide.accept(substAndEvalTransformer)); } Profiler.stopTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); } else { success = false; } } return success; }
Source:
public static Expr[] toConjunctiveNormalFormArray(Expr expr) { List<Expr> list = new ArrayList<Expr>(); toConjunctiveNormalFormArrayRecursive(expr, list); return list.toArray(new Expr[list.size()]); }

Target:
public static Expr[] toConjunctiveNormalFormArray(Expr expr) { List<Expr> list = TUtil.newList(); toConjunctiveNormalFormArrayRecursive(expr, list); return list.toArray(new Expr[list.size()]); }
Source:
public static Map<String, Partitioner> getPartitioners() { return partitionersByTopic; }

Target:
public static Set<Partitioner> getPartitioners() { return new HashSet<Partitioner>(partitionersByTopic.values()); }
Source:
public String getElementAxisName(final IAxis axis) { String returnedValue = null; if (axis instanceof FeatureIdAxis) { String elementId = ((FeatureIdAxis) axis).getElement(); final Object resolvedElement = resolvedPath(elementId); if (resolvedElement instanceof NamedElement) { returnedValue = UMLLabelInternationalization.getInstance().getLabel((NamedElement) resolvedElement); } else { elementId = elementId.replace("property_of_stereotype:/", ""); final String[] splitedElementId = elementId.split("::"); returnedValue = splitedElementId[splitedElementId.length - 1]; } } return null != returnedValue ? returnedValue : super.getElementAxisName(axis); }

Target:
public String getElementAxisName(final IAxis axis) { String returnedValue = null; if (axis instanceof FeatureIdAxis) { String elementId = ((FeatureIdAxis) axis).getElement(); final Object resolvedElement = resolvedPath(elementId); if (resolvedElement instanceof NamedElement) { returnedValue = UMLLabelInternationalization.getInstance().getLabel((NamedElement) resolvedElement); } else { elementId = elementId.replace(Constants.PROPERTY_OF_STEREOTYPE_PREFIX, ""); final String[] splitedElementId = elementId.split("::"); returnedValue = splitedElementId[splitedElementId.length - 1]; } } return null != returnedValue ? returnedValue : super.getElementAxisName(axis); }
Source:
private @NonNull InneractiveAdSpot.RequestListener createFyberBannerAdListener() { return new InneractiveAdSpot.RequestListener() { @Override public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot inneractiveAdSpot) { if (!(mBannerSpot.getSelectedUnitController() instanceof InneractiveAdViewUnitController)) { mMediationBannerListener.onAdFailedToLoad(FyberMediationAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } InneractiveAdViewUnitController controller = (InneractiveAdViewUnitController) mBannerSpot.getSelectedUnitController(); InneractiveAdViewEventsListener listener = createFyberAdViewListener(); controller.setEventsListener(listener); mMediationBannerListener.onAdLoaded(FyberMediationAdapter.this); } @Override public void onInneractiveFailedAdRequest(InneractiveAdSpot inneractiveAdSpot, InneractiveErrorCode inneractiveErrorCode) { int adMobErrorCode = AdRequest.ERROR_CODE_INTERNAL_ERROR; if (inneractiveErrorCode == InneractiveErrorCode.CONNECTION_ERROR || inneractiveErrorCode == InneractiveErrorCode.CONNECTION_TIMEOUT) { adMobErrorCode = AdRequest.ERROR_CODE_NETWORK_ERROR; } else if (inneractiveErrorCode == InneractiveErrorCode.NO_FILL) { adMobErrorCode = AdRequest.ERROR_CODE_NO_FILL; } mMediationBannerListener.onAdFailedToLoad(FyberMediationAdapter.this, adMobErrorCode); } }; }

Target:
private @NonNull InneractiveAdSpot.RequestListener createFyberBannerAdListener() { return new InneractiveAdSpot.RequestListener() { @Override public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot inneractiveAdSpot) { if (!(mBannerSpot.getSelectedUnitController() instanceof InneractiveAdViewUnitController)) { mMediationBannerListener.onAdFailedToLoad(FyberMediationAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); mBannerSpot.destroy(); } InneractiveAdViewUnitController controller = (InneractiveAdViewUnitController) mBannerSpot.getSelectedUnitController(); InneractiveAdViewEventsListener listener = createFyberAdViewListener(); controller.setEventsListener(listener); mMediationBannerListener.onAdLoaded(FyberMediationAdapter.this); } @Override public void onInneractiveFailedAdRequest(InneractiveAdSpot inneractiveAdSpot, InneractiveErrorCode inneractiveErrorCode) { int adMobErrorCode = AdRequest.ERROR_CODE_INTERNAL_ERROR; if (inneractiveErrorCode == InneractiveErrorCode.CONNECTION_ERROR || inneractiveErrorCode == InneractiveErrorCode.CONNECTION_TIMEOUT) { adMobErrorCode = AdRequest.ERROR_CODE_NETWORK_ERROR; } else if (inneractiveErrorCode == InneractiveErrorCode.NO_FILL) { adMobErrorCode = AdRequest.ERROR_CODE_NO_FILL; } mMediationBannerListener.onAdFailedToLoad(FyberMediationAdapter.this, adMobErrorCode); } }; }
Source:
protected Session getSession(URI sessionModelURI) { Session sessionFromURI = null; try { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI); if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); uiSession.open(); } } catch (IllegalStateException e) { } return sessionFromURI; }

Target:
protected Session getSession(URI sessionModelURI) { Session sessionFromURI; try { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI); if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); uiSession.open(); } } catch (IllegalStateException e) { sessionFromURI = null; } return sessionFromURI; }