auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static double[] getVoxelScreenSize( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint, final int mipmapIndex ) { final double[] pixelSize = new double[ 3 ]; final AffineTransform3D sourceToScreen = new AffineTransform3D(); sourceToScreen.set( screenTransform ); final AffineTransform3D sourceTransform = new AffineTransform3D(); source.getSourceTransform( timepoint, mipmapIndex, sourceTransform ); sourceToScreen.concatenate( sourceTransform ); final double[] zero = new double[] { 0, 0, 0 }; final double[] tzero = new double[ 3 ]; final double[] one = new double[ 3 ]; final double[] tone = new double[ 3 ]; final double[] diff = new double[ 3 ]; sourceToScreen.apply( zero, tzero ); for ( int i = 0; i < 3; ++i ) { for ( int d = 0; d < 3; ++d ) one[ d ] = d == i ? 1 : 0; sourceToScreen.apply( one, tone ); LinAlgHelpers.subtract( tone, tzero, diff ); pixelSize[ i ] = LinAlgHelpers.length( diff ); } return pixelSize; }

Target:
public static double getVoxelScreenSize( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint, final int mipmapIndex ) { double pixelSize = 0; final AffineTransform3D sourceToScreen = new AffineTransform3D(); sourceToScreen.set( screenTransform ); final AffineTransform3D sourceTransform = new AffineTransform3D(); source.getSourceTransform( timepoint, mipmapIndex, sourceTransform ); sourceToScreen.concatenate( sourceTransform ); final double[] zero = new double[] { 0, 0, 0 }; final double[] tzero = new double[ 3 ]; final double[] one = new double[ 3 ]; final double[] tone = new double[ 3 ]; final double[] diff = new double[ 2 ]; sourceToScreen.apply( zero, tzero ); for ( int i = 0; i < 3; ++i ) { for ( int d = 0; d < 3; ++d ) one[ d ] = d == i ? 1 : 0; sourceToScreen.apply( one, tone ); LinAlgHelpers.subtract( tone, tzero, tone ); diff[0] = tone[0]; diff[1] = tone[1]; final double l = LinAlgHelpers.length( diff ); if ( l > pixelSize ) pixelSize = l; } return pixelSize; }
Source:
void testNewTargetGroupsForOneUnitAndOneEnemyUnit() { final GamePlayer germany = GameDataTestUtil.germany(twwGameData); final List<Unit> units = GameDataTestUtil.germanInfantry(twwGameData).create(1, germany); final GamePlayer britain = GameDataTestUtil.britain(twwGameData); final List<Unit> enemyUnits = GameDataTestUtil.britishInfantry(twwGameData).create(1, britain); final List<TargetGroup> result = TargetGroup.newTargetGroups(units, enemyUnits); assertEquals(1, result.size()); }

Target:
void testNewTargetGroupsForOneUnitAndOneEnemyUnit() { final GamePlayer germany = GameDataTestUtil.germany(twwGameData); final List<Unit> units = GameDataTestUtil.germanInfantry(twwGameData).create(1, germany); final GamePlayer britain = GameDataTestUtil.britain(twwGameData); final List<Unit> enemyUnits = GameDataTestUtil.britishInfantry(twwGameData).create(1, britain); final List<TargetGroup> result = TargetGroup.newTargetGroups(units, enemyUnits); assertThat(result, hasSize(1)); }
Source:
public synchronized MetricsPhoenixTTLSource getPhoenixTTLSource() { if (INSTANCE.phoenixTTLSource == null) { INSTANCE.phoenixTTLSource = new MetricsPhoenixTTLSourceImpl(); } return INSTANCE.phoenixTTLSource; }

Target:
public MetricsPhoenixTTLSource getPhoenixTTLSource() { if (INSTANCE.phoenixTTLSource == null) { synchronized (MetricsPhoenixTTLSource.class) { if (INSTANCE.phoenixTTLSource == null) { INSTANCE.phoenixTTLSource = new MetricsPhoenixTTLSourceImpl(); } } } return INSTANCE.phoenixTTLSource; }
Source:
protected void initButton(final Button button) { button.setToolTipText("Create Working Branch"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { disableAll = true; refreshEnablement(button); Result result = AtsBranchUtil.createWorkingBranch_Validate(getTeamArt()); boolean appropriate = selectTargetedVersionIfAppropriate(result, button); if (appropriate) { return; } if (result.isFalse()) { AWorkbench.popup(result); disableAll = false; refreshEnablement(button); return; } try { String workingBranchName = AtsClientService.get().getBranchService().getBranchName(getTeamArt()); String baselineBranchName = getTeamArt().getParentTeamWorkflow().getBranch().toString(); if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Create Working Branch", "Creating working branch,\n\n\"<" + workingBranchName + ">\"\n\nfrom parent branch, \n\n\"<" + baselineBranchName + ">\"\n\nIs that correct?\n\n" + "---\nNOTE: Working branches are necessary when OSEE Artifact changes " + "are made during implementation.")) { disableAll = false; refreshEnablement(button); return; } button.setText("Creating Branch..."); button.redraw(); button.getParent().layout(); AtsBranchUtil.createWorkingBranch_Create(getTeamArt(), false); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); disableAll = false; refreshEnablement(button); } } }); }

Target:
protected void initButton(final Button button) { button.setToolTipText("Create Working Branch"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { disableAll = true; refreshEnablement(button); Result result = AtsBranchUtil.createWorkingBranch_Validate(getTeamArt()); boolean appropriate = selectTargetedVersionIfAppropriate(result, button); if (appropriate) { return; } if (result.isFalse()) { AWorkbench.popup(result); disableAll = false; refreshEnablement(button); return; } try { String workingBranchName = AtsClientService.get().getBranchService().getBranchName(getTeamArt()); String baselineBranchName = getTeamArt().getParentTeamWorkflow().getBranch().toString(); if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Create Working Branch", "Creating working branch,\n\n\"" + workingBranchName + "\"\n\nfrom parent branch, \n\n\"" + baselineBranchName + "\"\n\nIs that correct?\n\n" + "---\nNOTE: Working branches are necessary when OSEE Artifact changes " + "are made during implementation.")) { disableAll = false; refreshEnablement(button); return; } button.setText("Creating Branch..."); button.redraw(); button.getParent().layout(); AtsBranchUtil.createWorkingBranch_Create(getTeamArt(), false); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); disableAll = false; refreshEnablement(button); } } }); }
Source:
protected void doStart() throws Exception { if (config == null) { List<SerializerFeature> serializerFeatureList = new ArrayList<SerializerFeature>(); config = new FastJsonConfig(); if (prettyPrint) { serializerFeatureList.add(SerializerFeature.PrettyFormat); } if (serializeNulls) { serializerFeatureList.add(SerializerFeature.WriteMapNullValue); serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse); serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty); serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero); serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty); } if (null != this.dateFormatPattern) { serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat); config.setDateFormat(this.dateFormatPattern); } } }

Target:
protected void doStart() throws Exception { if (config == null) { List<SerializerFeature> serializerFeatureList = new ArrayList<SerializerFeature>(); config = new FastJsonConfig(); if (prettyPrint) { serializerFeatureList.add(SerializerFeature.PrettyFormat); } if (serializeNulls) { serializerFeatureList.add(SerializerFeature.WriteMapNullValue); serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse); serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty); serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero); serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty); } if (this.dateFormatPattern != null) { serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat); config.setDateFormat(this.dateFormatPattern); } } }
Source:
public DeterministicKeyChain makeSpendingFriendKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, ImmutableList<ChildNumber> accountPath) throws UnreadableWalletException { DeterministicKeyChain chain; if (isMarried) throw new UnsupportedOperationException("Married Friend Keychains are not allowed"); else if(accountPath.get(0).equals(ChildNumber.NINE_HARDENED) && accountPath.get(2).equals(new ChildNumber(15, true))) chain = new FriendKeyChain(seed, crypter, accountPath); else return new DeterministicKeyChain(seed, crypter, Script.ScriptType.P2PKH, accountPath); return chain; }

Target:
public DeterministicKeyChain makeSpendingFriendKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, ImmutableList<ChildNumber> accountPath) throws UnreadableWalletException { DeterministicKeyChain chain; if (isMarried) throw new UnsupportedOperationException("Married Friend Keychains are not allowed"); else if(accountPath.get(0).equals(ChildNumber.NINE_HARDENED) && accountPath.get(2).equals(DerivationPathFactory.FEATURE_PURPOSE_DASHPAY)) chain = new FriendKeyChain(seed, crypter, accountPath); else return new DeterministicKeyChain(seed, crypter, Script.ScriptType.P2PKH, accountPath); return chain; }
Source:
public void handleEvent(MotechEvent event) { String configName = EventSubjects.getConfigName(event.getSubject()); DateTime startDate = (DateTime) event.getParameters().get(START_DATE); DateTime endDate = (DateTime) event.getParameters().get(END_DATE); Range<DateTime> dateRange = new Range<>(startDate, endDate); CommcareFormImporterImpl importer = new CommcareFormImporterImpl(eventRelay, formService); int formsToImport = importer.countForImport(dateRange, configName); LOGGER.info("{} commcare forms to be imported.", formsToImport); importer.startImport(dateRange, configName); }

Target:
public void handleEvent(MotechEvent event) { CommcareFormImporterImpl importer = importerFactory.getCommcareFormImporter(); String configName = EventSubjects.getConfigName(event.getSubject()); DateTime startDate = (DateTime) event.getParameters().get(START_DATE); DateTime endDate = (DateTime) event.getParameters().get(END_DATE); Range<DateTime> dateRange = new Range<>(startDate, endDate); int formsToImport = importer.countForImport(dateRange, configName); LOGGER.info("{} commcare forms to be imported.", formsToImport); importer.startImport(dateRange, configName); }
Source:
public void testInsertUrlSuccessful() { String goolgeString = "<LINK_0>"; URL googleUrl = null; try { googleUrl = URI.create(goolgeString).toURL(); } catch (MalformedURLException e) { e.printStackTrace(); } handle.createUpdate("INSERT INTO foo VALUES (:url)") .bind("url", googleUrl) .execute(); Assertions.assertThat(handle.createQuery("SELECT * FROM foo").mapTo(URL.class).findOnly()).isEqualTo(googleUrl); }

Target:
public void testInsertUrlSuccessful() throws MalformedURLException { String googleString = "<LINK_0>"; URL googleUrl = new URL(googleString); handle.createUpdate("INSERT INTO foo VALUES (:url)") .bind("url", googleUrl) .execute(); URL actualUrl = handle.createQuery("SELECT url FROM foo").mapTo(URL.class).findOnly(); Assertions.assertThat(actualUrl).hasToString(googleUrl.toString()); }
Source:
private ArrayList<PathAndTime> listTemporaryMacrosPathAndTime(File macroDirectory) { ArrayList<PathAndTime> pathAndTime = new ArrayList<>(); try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(macroDirectory.toURI()), new DirectoryStream.Filter<Path>() { @Override public boolean accept(Path entry) { String name = entry.getFileName().toString().toLowerCase(); return name.startsWith(TEMP_MACRO_PREFIX) && name.endsWith(JS_EXT); } })) { for (Path p : directoryStream) { pathAndTime.add(new PathAndTime(p, Files.getLastModifiedTime(p).to(TimeUnit.NANOSECONDS))); } } catch (IOException e1) { Activator.log(e1); } Collections.sort(pathAndTime, new Comparator<PathAndTime>() { @Override public int compare(PathAndTime o1, PathAndTime o2) { return Long.compare(o2.fLastModified, o1.fLastModified); } }); return pathAndTime; }

Target:
private List<PathAndTime> listTemporaryMacrosPathAndTime(File macroDirectory) { List<PathAndTime> pathAndTime = new ArrayList<>(); try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(macroDirectory.toURI()), new DirectoryStream.Filter<Path>() { @Override public boolean accept(Path entry) { String name = entry.getFileName().toString().toLowerCase(); return name.startsWith(TEMP_MACRO_PREFIX) && name.endsWith(JS_EXT); } })) { for (Path p : directoryStream) { pathAndTime.add(new PathAndTime(p, Files.getLastModifiedTime(p).to(TimeUnit.NANOSECONDS))); } } catch (IOException e1) { Activator.log(e1); } Collections.sort(pathAndTime, new Comparator<PathAndTime>() { @Override public int compare(PathAndTime o1, PathAndTime o2) { return Long.compare(o2.fLastModified, o1.fLastModified); } }); return pathAndTime; }
Source:
protected void initialiseAttributes(HttpServletRequest req) { request = req; requestUrl = HttpRequestHelper.getRequestedUrl(request); currentUrl = request.getHeader("referer"); logic = new Logic(); gateKeeper = new GateKeeper(); setTaskQueuer(new TaskQueuer()); setEmailSender(new EmailSender()); requestParameters = request.getParameterMap(); session = request.getSession(); sessionToken = CryptoHelper.computeSessionToken(session.getId()); parseAndInitializeRegkeyFromRequest(); isError = getRequestParamAsBoolean(Const.ParamsNames.ERROR); }

Target:
protected void initialiseAttributes(HttpServletRequest req) { request = req; requestUrl = HttpRequestHelper.getRequestedUrl(request); logic = new Logic(); gateKeeper = new GateKeeper(); setTaskQueuer(new TaskQueuer()); setEmailSender(new EmailSender()); requestParameters = request.getParameterMap(); session = request.getSession(); sessionToken = CryptoHelper.computeSessionToken(session.getId()); parseAndInitializeRegkeyFromRequest(); isError = getRequestParamAsBoolean(Const.ParamsNames.ERROR); }
Source:
public static float getSize(String cssSize) { if (cssSize == null || cssSize.length() < 1) { throw new IllegalArgumentException("The parameter can't be null"); } Stream<Unit> units = getUnits().filter(unit -> cssSize.endsWith(unit.toString())); String size; String unit = ""; try { unit = units.findFirst().get().toString(); } catch (NoSuchElementException e) { throw new IllegalArgumentException( "The parameter string '"+cssSize+"' does not contain valid unit"); } size = cssSize.substring(0,cssSize.length()-unit.length()); if (size.isEmpty()) { size = "0"; } return Float.valueOf(size); }

Target:
public static float getSize(String cssSize) { if (cssSize == null || cssSize.length() < 1) { throw new IllegalArgumentException("The parameter can't be null"); } Unit unit = getUnits() .filter(value -> cssSize.endsWith(value.toString())).findFirst() .orElseThrow(() -> new IllegalArgumentException(String.format( "The parameter string '%s' does not contain valid unit", cssSize))); String size = cssSize .substring(0, cssSize.length() - unit.toString().length()); if (size.isEmpty()) { size = "0"; } return Float.valueOf(size); }
Source:
public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutProvider sp = dh.getShortcutProvider(); String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Uninstall shortcut " + name); ShortcutPojo pojo = (ShortcutPojo) sp.findByName(name); if (pojo == null) { Log.d("onReceive", "Shortcut " + name + " not found"); return; } dh.getShortcutProvider().removeShortcut(pojo); dh.removeShortcut(context, pojo.name); }

Target:
public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutProvider sp = dh.getShortcutProvider(); if (sp == null) return; String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Uninstall shortcut " + name); ShortcutPojo pojo = (ShortcutPojo) sp.findByName(name); if (pojo == null) { Log.d("onReceive", "Shortcut " + name + " not found"); return; } dh.getShortcutProvider().removeShortcut(pojo); }
Source:
private static String urlEncode(String string) { if(string == null) { return ""; } try { return URLEncoder.encode(string, "UTF-8"); } catch(UnsupportedEncodingException notGonnaHappen) { } return string; }

Target:
private static String urlEncode(String string) { if(string == null) { return ""; } try { return URLEncoder.encode(string, ENCODING); } catch(UnsupportedEncodingException notGonnaHappen) { } return string; }
Source:
public void aggregate() { Object obj = selector.getObject(); if (obj == null) { return; } if (selector.getObject() instanceof Number) { synchronized (this) { histogram.add(((Number) selector.getObject()).doubleValue()); } } else if (selector.getObject() instanceof MergingDigest) { synchronized (this) { histogram.add((MergingDigest) selector.getObject()); } } else { TDigestSketchUtils.throwExceptionForWrongType(selector); } }

Target:
public void aggregate() { Object obj = selector.getObject(); if (obj == null) { return; } if (obj instanceof Number) { synchronized (this) { histogram.add(((Number) obj).doubleValue()); } } else if (obj instanceof MergingDigest) { synchronized (this) { histogram.add((MergingDigest) obj); } } else { throw new IAE( "Expected a number or an instance of MergingDigest, but received [%s] of type [%s]", obj, obj.getClass() ); } }
Source:
public void initialize(int capacity) { neighbors = idTypeOps.createArrayList(capacity); }

Target:
public void initialize(int capacity) { neighbors.clear(); neighbors.setCapacity(capacity); }
Source:
public int write(Iterable<StructuredRecord> structuredRecords, DataWriter dataWriter) throws Exception { int numRecordsWritten = 0; for (StructuredRecord structuredRecord : structuredRecords) { Schema schema = structuredRecord.getSchema(); Object data = structuredRecord.get(config.bodyField); if (data == null) { LOG.debug("Found null data. Skipping record."); continue; } Schema.Field dataSchemaField = schema.getField(config.bodyField); PutRecordRequest putRecordRequest = new PutRecordRequest(); putRecordRequest.setStreamName(config.name); putRecordRequest.setPartitionKey(config.partition); switch (dataSchemaField.getSchema().getType()) { case BYTES: numRecordsWritten += writeBytes(putRecordRequest, data); break; case STRING: numRecordsWritten += writeString(putRecordRequest, data); break; default: LOG.debug("Type is not supported for writing to stream", data.getClass().getName()); break; } } return numRecordsWritten; }

Target:
public int write(Iterable<StructuredRecord> structuredRecords, DataWriter dataWriter) throws Exception { int numRecordsWritten = 0; for (StructuredRecord structuredRecord : structuredRecords) { Schema schema = structuredRecord.getSchema(); Object data = structuredRecord.get(config.bodyField); if (data == null) { LOG.debug("Found null data. Skipping record."); continue; } Schema.Field dataSchemaField = schema.getField(config.bodyField); PutRecordRequest putRecordRequest = new PutRecordRequest(); putRecordRequest.setStreamName(config.name); putRecordRequest.setPartitionKey(config.partition); switch (dataSchemaField.getSchema().getType()) { case BYTES: numRecordsWritten += writeBytes(putRecordRequest, data); break; case STRING: numRecordsWritten += writeString(putRecordRequest, data); break; case LONG: case DOUBLE: case FLOAT: case BOOLEAN: case INT: numRecordsWritten += writeString(putRecordRequest, String.valueOf(data)); break; default: throw new UnsupportedTypeException(String.format("Type %s is not supported for writing to stream", data.getClass().getName())); } } return numRecordsWritten; }
Source:
private static String prompt() { StringBuilder input = new StringBuilder(); System.out.print(START_PROMPT); try { String lineSeparator = ""; while (true) { String line = reader.readLine(); if (line == null) { return null; } if (line.isEmpty()) { return input.toString(); } input.append(lineSeparator).append(line); StarlarkFile starlarkFile = StarlarkFile.parse(ParserInput.fromString(input.toString(), "<stdin>")); if (starlarkFile.ok()) { return input.toString(); } lineSeparator = "\n"; System.out.print(CONTINUATION_PROMPT); } } catch (IOException e) { System.err.format("Error reading line: %s\n", e); return null; } }

Target:
private static String prompt() { StringBuilder input = new StringBuilder(); System.out.print(START_PROMPT); try { String lineSeparator = ""; while (true) { String line = reader.readLine(); if (line == null) { return null; } if (line.isEmpty()) { return input.toString(); } input.append(lineSeparator).append(line); StarlarkFile starlarkFile = StarlarkFile.parse(ParserInput.fromString(input.toString(), "<stdin>")); if (starlarkFile.ok()) { if (starlarkFile.getStatements().isEmpty()) { return input.toString(); } Statement lastStatement = starlarkFile.getStatements().get(starlarkFile.getStatements().size() - 1); switch (lastStatement.kind()) { case IF: case DEF: case FOR: break; default: return input.toString(); } } lineSeparator = "\n"; System.out.print(CONTINUATION_PROMPT); } } catch (IOException e) { System.err.format("Error reading line: %s\n", e); return null; } }
Source:
public synchronized void init(QuipConfig config){ if(initialized){ throw new RuntimeException("QuipStore is already initialized"); } sourceFiles.put(QuipRequestTypes.COMPLIMENT, config.getComplimentsFile()); sourceFiles.put(QuipRequestTypes.WINSULT, config.getWinsultsFile()); sourceFiles.put(QuipRequestTypes.INSULT, config.getInsultsFile()); sourceFiles.put(QuipRequestTypes.BACKHANDED_COMPLIMENT, config.getBackhandedComplimentsFile()); refreshRate = config.getRefreshRate(); initialized = true; try{ updateQuips(QuipRequestTypes.COMPLIMENT); updateQuips(QuipRequestTypes.WINSULT); updateQuips(QuipRequestTypes.INSULT); updateQuips(QuipRequestTypes.BACKHANDED_COMPLIMENT); LOG.info("QuipStore initialized"); } catch(IOException e){ LOG.error("There was a problem loading quips",e); } }

Target:
public synchronized void init(QuipConfig config){ if(initialized){ throw new RuntimeException("QuipStore is already initialized"); } if(config==null){return;} sourceFiles.put(QuipType.COMPLIMENT, config.getComplimentsFile()); sourceFiles.put(QuipType.WINSULT, config.getWinsultsFile()); sourceFiles.put(QuipType.INSULT, config.getInsultsFile()); sourceFiles.put(QuipType.BACKHANDED_COMPLIMENT, config.getBackhandedComplimentsFile()); refreshRate = config.getRefreshRate(); initialized = true; try{ updateQuips(QuipType.COMPLIMENT); updateQuips(QuipType.WINSULT); updateQuips(QuipType.INSULT); updateQuips(QuipType.BACKHANDED_COMPLIMENT); LOG.info("QuipStore initialized"); } catch(IOException e){ LOG.error("There was a problem loading quips",e); } }
Source:
public InternationalFixedDate plus(final long amountToAdd, final TemporalUnit unit) { if (amountToAdd == 0) { return this; } if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case DAYS: return plusDays(amountToAdd); case MONTHS: return plusMonths(amountToAdd); case YEARS: return plusYears(amountToAdd); default: break; } } return (InternationalFixedDate) super.plus(amountToAdd, unit); }

Target:
public InternationalFixedDate plus(final long amountToAdd, final TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case WEEKS: return plusWeeks(amountToAdd); case MONTHS: return plusMonths(amountToAdd); default: break; } } return (InternationalFixedDate) super.plus(amountToAdd, unit); }
Source:
public ProjectList call() { final ProjectList result = new ProjectList(); result.setProjects(getProjects()); result.setCanCreateProject(user.getCapabilities().canCreateProject()); return result; }

Target:
public List<Project> call() { List<Project> result = new ArrayList<Project>(); for (Project.NameKey p : projectCache.all()) { try { ProjectControl c = projectControlFactory.controlFor(p); if (c.isVisible() || c.isOwner()) { result.add(c.getProject()); } } catch (NoSuchProjectException e) { continue; } } Collections.sort(result, new Comparator<Project>() { public int compare(final Project a, final Project b) { return a.getName().compareTo(b.getName()); } }); return result; }
Source:
public ListViewColumnDescriptor getDescriptor() { return (ListViewColumnDescriptor) Jenkins.getInstance().getDescriptorOrDie(getClass()); }

Target:
public DescriptorImpl getDescriptor() { return (DescriptorImpl) Jenkins.getInstance().getDescriptorOrDie(getClass()); }
Source:
private void createSickNotes(Person person) { LocalDate now = ZonedDateTime.now(UTC).toLocalDate(); SickNoteType sickNoteTypeStandard = null; SickNoteType sickNoteTypeChild = null; List<SickNoteType> sickNoteTypes = sickNoteTypeService.getSickNoteTypes(); for (SickNoteType sickNoteType : sickNoteTypes) { if (sickNoteType.isOfCategory(SickNoteCategory.SICK_NOTE)) { sickNoteTypeStandard = sickNoteType; } if (sickNoteType.isOfCategory(SickNoteCategory.SICK_NOTE_CHILD)) { sickNoteTypeChild = sickNoteType; } } sickNoteDataProvider.createSickNote(person, office, DayLength.NOON, now.minusDays(10), now.minusDays(10), sickNoteTypeStandard, false); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(2), now.minusDays(2), sickNoteTypeStandard, false); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(30), now.minusDays(25), sickNoteTypeStandard, true); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(40), now.minusDays(38), sickNoteTypeChild, false); }

Target:
private void createSickNotes(Person person) { LocalDate now = LocalDate.now(UTC); SickNoteType sickNoteTypeStandard = null; SickNoteType sickNoteTypeChild = null; List<SickNoteType> sickNoteTypes = sickNoteTypeService.getSickNoteTypes(); for (SickNoteType sickNoteType : sickNoteTypes) { if (sickNoteType.isOfCategory(SickNoteCategory.SICK_NOTE)) { sickNoteTypeStandard = sickNoteType; } if (sickNoteType.isOfCategory(SickNoteCategory.SICK_NOTE_CHILD)) { sickNoteTypeChild = sickNoteType; } } sickNoteDataProvider.createSickNote(person, office, DayLength.NOON, now.minusDays(10), now.minusDays(10), sickNoteTypeStandard, false); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(2), now.minusDays(2), sickNoteTypeStandard, false); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(30), now.minusDays(25), sickNoteTypeStandard, true); sickNoteDataProvider.createSickNote(person, office, DayLength.FULL, now.minusDays(40), now.minusDays(38), sickNoteTypeChild, false); }
Source:
private void waitForUpdates(long timeout, long numUpdates) throws InterruptedException { long startTime = System.currentTimeMillis(); long pre = 0L; synchronized (updateLock) { pre = updates.get(); } do { Thread.sleep(5); log.info("Waiting for updateLock"); synchronized (updateLock) { Assert.assertTrue("Failed waiting for update", System.currentTimeMillis() - startTime < timeout); } } while (updates.get() < pre + numUpdates); }

Target:
private void waitForUpdates(long timeout, long numUpdates) throws InterruptedException { long startTime = System.currentTimeMillis(); long pre = 0L; synchronized (updateLock) { pre = updates.get(); } long post = 0L; do { Thread.sleep(5); log.debug("Waiting for updateLock"); synchronized (updateLock) { Assert.assertTrue("Failed waiting for update", System.currentTimeMillis() - startTime < timeout); post = updates.get(); } } while (post < pre + numUpdates); }
Source:
public <V> Pair<K, V> update(final K id, final V deltaValue) { final int blockId = blockResolver.resolveBlock(id); final Optional<String> remoteEvalId = router.resolveEval(blockId); if (remoteEvalId.isPresent()) { final SingleKeyOperation<K, V> operation = remoteOpHandler.sendOpToRemoteStore(DataOpType.UPDATE, id, Optional.of(deltaValue), remoteEvalId.get()); return new Pair<>(id, operation.getOutputData().get()); } else { final Block<V> block = blocks.get(blockId); final V output = block.update(id, deltaValue); return output == null ? null : new Pair<>(id, output); } }

Target:
public <V> Pair<K, V> update(final K id, final V deltaValue) { final int blockId = blockResolver.resolveBlock(id); final Optional<String> remoteEvalId = router.resolveEval(blockId); if (remoteEvalId.isPresent()) { final SingleKeyOperation<K, V> operation = remoteOpHandler.sendOpToRemoteStore(DataOpType.UPDATE, id, Optional.of(deltaValue), remoteEvalId.get()); return new Pair<>(id, operation.getOutputData().get()); } else { final Block<V> block = blocks.get(blockId); final V output = block.update(id, deltaValue); return new Pair<>(id, output); } }
Source:
private static void addResponseHeaderWithOverride( HttpServletRequest request, HttpServletResponse response, String headerName, String overrideHeaderName, String value) { if (logger.isDebugEnabled()) { logger.debug("entry > addResponseHeaderWithOverride(). " + "headerName: {}, overideHeaderName: {}, value: {}", headerName, overrideHeaderName, value); } String override = request.getParameter(overrideHeaderName); override = (override != null) ? override : value; if (override != null) { response.addHeader(headerName, override); } if (logger.isDebugEnabled()) { logger.debug("exit < addResponseHeaderWithOverride()"); } }

Target:
private static void addResponseHeaderWithOverride( HttpServletRequest request, HttpServletResponse response, String headerName, String overrideHeaderName, String value) { logger.debug("entry > addResponseHeaderWithOverride(). " + "headerName: {}, overideHeaderName: {}, value: {}", headerName, overrideHeaderName, value); String override = request.getParameter(overrideHeaderName); override = (override != null) ? override : value; if (override != null) { response.addHeader(headerName, override); } logger.debug("exit < addResponseHeaderWithOverride()"); }
Source:
public final Response act(final Request req) throws IOException { boolean hasorigin = false; Response response; String domain = ""; for (final String head : req.head()) { if (head.startsWith(ORIGIN_PREFIX)) { hasorigin = true; domain = head.split(ORIGIN_PREFIX)[1].trim(); break; } } if (hasorigin && ( this.alloweddomains.size() == 0 || this.alloweddomains.contains(domain))) { response = this.origin.act(req); final Set<String> headers = new HashSet<String>(); headers.add("Access-Control-Allow-Credentials: true"); headers.add("Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE, HEAD"); headers.add( String.format("Access-Control-Allow-Origin: %s", domain) ); response = new RsWithHeaders(response, headers); } else if (hasorigin) { final Set<String> headers = new HashSet<String>(); headers.add("Access-Control-Allow-Credentials: false"); response = new RsWithStatus(HttpURLConnection.HTTP_FORBIDDEN); response = new RsWithHeaders(response, headers); } else { response = this.origin.act(req); } return response; }

Target:
public Response act(final Request req) throws IOException { String domain; final Response response; try { domain = new RqHeaders.Smart( new RqHeaders.Base(req) ).single("origin"); } catch (final IOException exp) { domain = ""; } if (this.allowed.contains(domain)) { response = new RsWithHeaders( this.origin.act(req), "Access-Control-Allow-Credentials: true", "Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE, HEAD", String.format( "Access-Control-Allow-Origin: %s", domain ) ); } else { response = new RsWithHeaders( new RsWithStatus( HttpURLConnection.HTTP_FORBIDDEN ), "Access-Control-Allow-Credentials: false" ); } return response; }
Source:
public Node visitColumnDefinition(SqlBaseParser.ColumnDefinitionContext context) { Optional<String> comment = Optional.empty(); List<Property> properties = ImmutableList.of(); boolean nullable = true; Optional<Literal> defaultValue = Optional.empty(); if (context.COMMENT() != null) { comment = Optional.of(((StringLiteral) visit(context.string())).getValue()); } else if (context.properties() != null) { properties = visit(context.properties().property(), Property.class); } else if (context.defaultValue != null) { defaultValue = Optional.of((Literal) visit(context.defaultValue)); } else if (context.NOT() != null) { nullable = false; } return new ColumnDefinition( getLocation(context), (Identifier) visit(context.identifier()), getType(context.type()), properties, comment, nullable, defaultValue); }

Target:
public Node visitColumnDefinition(SqlBaseParser.ColumnDefinitionContext context) { Identifier columnIdentifier = (Identifier) visit(context.identifier()); Optional<String> comment = Optional.empty(); if (context.COMMENT() != null) { comment = Optional.of(((StringLiteral) visit(context.string())).getValue()); } List<Property> properties = ImmutableList.of(); if (context.properties() != null) { properties = visit(context.properties().property(), Property.class); } Optional<Literal> defaultValue = Optional.empty(); if (context.defaultValue != null) { Node defaultValueNode = visit(context.defaultValue); if (!(defaultValueNode instanceof Literal)) { throw parseError(format("Default value (%s) for column %s is not a literal expression", context.defaultValue.getText(), columnIdentifier.getValue()), context); } defaultValue = Optional.of((Literal) defaultValueNode); } boolean nullable = true; if (context.NOT() != null) { nullable = false; } return new ColumnDefinition( getLocation(context), columnIdentifier, getType(context.type()), properties, comment, nullable, defaultValue); }
Source:
public void onApplicationEvent(WebServerInitializedEvent event) { String contextName = event.getApplicationContext().getServerNamespace(); if (StringUtils.isEmpty(contextName)) { int localPort = event.getWebServer().getPort(); if (this.port.get() == 0) { log.info("Updating port to " + localPort); this.port.compareAndSet(0, localPort); start(); } } }

Target:
public void onApplicationEvent(WebServerInitializedEvent event) { String contextName = event.getApplicationContext().getServerNamespace(); if (contextName == null || !contextName.equals("management")) { int localPort = event.getWebServer().getPort(); if (this.port.get() == 0) { log.info("Updating port to " + localPort); this.port.compareAndSet(0, localPort); start(); } } }
Source:
public String toString() { return new StringJoiner(", ", TestOutputTopic.class.getSimpleName() + "[", "]") .add("topic='" + topic + "'") .add("keyDeserializer=" + keyDeserializer) .add("valueDeserializer=" + valueDeserializer) .add("size=" + getQueueSize()) .toString(); }

Target:
public String toString() { return new StringJoiner(", ", TestOutputTopic.class.getSimpleName() + "[", "]") .add("topic='" + topic + "'") .add("keyDeserializer=" + keyDeserializer.getClass().getSimpleName()) .add("valueDeserializer=" + valueDeserializer.getClass().getSimpleName()) .add("size=" + getQueueSize()) .toString(); }
Source:
private static Cache<?, ?> checkValidConfiguration(final Cache<?, ?> cache, String indexName) { if (cache == null) { return null; } Configuration configuration = cache.getCacheConfiguration(); if (configuration.expiration().maxIdle() != -1) { throw log.luceneStorageHavingIdleTimeSet( indexName, cache.getName() ); } if (configuration.expiration().lifespan() != -1) { throw log.luceneStorageHavingLifespanSet( indexName, cache.getName() ); } if (configuration.storeAsBinary().enabled()) { throw log.luceneStorageAsBinaryEnabled(indexName, cache.getName()); } if (configuration.clustering().cacheMode().isClustered() && !StateConsumerImpl.isFetchStateEnabled(configuration)) { throw log.luceneStorageNoStateTransferEnabled(indexName, cache.getName()); } return cache; }

Target:
private static Cache<?, ?> checkValidConfiguration(final Cache<?, ?> cache, String indexName) { if (cache == null) { return null; } Configuration configuration = cache.getCacheConfiguration(); if (configuration.expiration().maxIdle() != -1) { throw log.luceneStorageHavingIdleTimeSet( indexName, cache.getName() ); } if (configuration.expiration().lifespan() != -1) { throw log.luceneStorageHavingLifespanSet( indexName, cache.getName() ); } if (configuration.storeAsBinary().enabled()) { throw log.luceneStorageAsBinaryEnabled(indexName, cache.getName()); } if (!Configurations.noDataLossOnJoiner(configuration)) { throw log.luceneStorageNoStateTransferEnabled(indexName, cache.getName()); } return cache; }
Source:
private String getTargetBranchName(final Composite parent, Repository localRepo) { Set<String> branches = null; try { branches = getShortLocalBranchNames(new Git(localRepo)); } catch (GitAPIException e1) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, "No branches found"); ErrorDialog.openError(parent.getShell(), "Error", "Operation could not be performed", status); return ""; } String shortName = fChangeInfo.get_number() + "/" + filesTab.getSelectedPatchSetNumber(); Iterator<String> iterator = branches.iterator(); String branchName = null; while (iterator.hasNext()) { String setElement = iterator.next(); if (setElement.contains(shortName)) { branchName = setElement; } } return branchName; }

Target:
private String getTargetBranchName(final Composite parent, Repository localRepo) { Set<String> branches = null; try { branches = getShortLocalBranchNames(new Git(localRepo)); } catch (GitAPIException e1) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, "No branches found"); ErrorDialog.openError(parent.getShell(), "Error", "Operation could not be performed", status); return ""; } String shortName = fChangeInfo.get_number() + "/" + filesTab.getSelectedPatchSetNumber(); Iterator<String> iterator = branches.iterator(); String branchName = null; while (iterator.hasNext()) { String setElement = iterator.next(); if (setElement.contains(shortName)) { branchName = setElement; break; } } return branchName; }
Source:
public void matchesWithAnyTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( "text/xml", FkContentTypeTest.createTakeWithEmptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "*/* " ) ).has(), Matchers.is(true) ); }

Target:
public void matchesWithAnyTypes() throws IOException { MatcherAssert.assertThat( new FkContentType("text/xml", new RsEmpty()).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "*/* " ) ).has(), Matchers.is(true) ); }
Source:
public void onlyTheLatestTransactionIsKeptAfterIncrementalBackup() throws Exception { db.withSetting( GraphDatabaseSettings.keep_logical_logs, "1 txs" ) .withSetting( GraphDatabaseSettings.logical_log_rotation_threshold, "1M" ); int port = 4446; startDb( "" + port ); createSomeData( db ); String backupName = "backupName" + recordFormat; File backupLocation = new File( backupDir, backupName ); String address = "localhost:" + port; assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", address, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=" + backupName ) ); long megabytes = 1024 * 1024; long numberOfBytesInTx = 100; long defaultLogRotationPolicyM = 250; LongStream.range( 0, defaultLogRotationPolicyM ).forEach( number -> createSomeData( db, megabytes / numberOfBytesInTx ) ); assertEquals( "Server should have 3 tx log files", 3, transactionFiles( db.getStoreDirFile() ).size() ); assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", address, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=" + backupName ) ); Collection<File> txLogFiles = transactionFiles( backupLocation ); File expectedTxLogFile1 = new File( backupLocation, "neostore.transaction.db.1" ); File expectedTxLogFile2 = new File( backupLocation, "neostore.transaction.db.2" ); assertEquals( "Backup client retains latest incomplete tx log and previous complete log: " + txLogFiles.toString(), 2, txLogFiles.size() ); assertEquals( new HashSet<>( Arrays.asList( expectedTxLogFile1, expectedTxLogFile2 ) ), new HashSet<>( txLogFiles ) ); }

Target:
public void onlyTheLatestTransactionIsKeptAfterIncrementalBackup() throws Exception { int port = 4446; startDb( "" + port ); createSomeData( db ); String backupName = "backupName" + recordFormat; File backupLocation = new File( backupDir, backupName ); String address = "localhost:" + port; assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", address, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=" + backupName ) ); long aMegabyte = ByteUnit.mebiBytes( 1 ); long numberOfBytesInTx = 100; LongStream.range( 0, 205 ).forEach( number -> createSomeData( db, aMegabyte / numberOfBytesInTx ) ); assertEquals( "Server should have 3 tx log files", 3, transactionFiles( db.getStoreDirFile() ).size() ); assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", address, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=" + backupName ) ); Collection<File> txLogFiles = transactionFiles( backupLocation ); File expectedTxLogFile1 = new File( backupLocation, "neostore.transaction.db.1" ); File expectedTxLogFile2 = new File( backupLocation, "neostore.transaction.db.2" ); assertEquals( new HashSet<>( Arrays.asList( expectedTxLogFile1, expectedTxLogFile2 ) ), new HashSet<>( txLogFiles ) ); }
Source:
boolean updateMoreAggInfo(HTable aggTable, AppAggregationKey appAggKey, JobDetails jobDetails) throws IOException { int attempts = 0; boolean status = false; while ((status != true) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateNumberRuns(appAggKey, aggTable, jobDetails); attempts++; } attempts = 0; status = false; while ((status != true) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateQueue(appAggKey, aggTable, jobDetails); attempts++; } attempts = 0; status = false; while ((status != Boolean.TRUE) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateCost(appAggKey, aggTable, jobDetails); attempts++; } byte[] rowKey = aggConv.toBytes(appAggKey); Put p = new Put(rowKey); p.add(Constants.INFO_FAM_BYTES, AggregationConstants.USER_BYTES, Bytes.toBytes(appAggKey.getUserName())); p.add(Constants.INFO_FAM_BYTES, AggregationConstants.APP_ID_COL_BYTES, Bytes.toBytes(appAggKey.getAppId())); aggTable.put(p); return true; }

Target:
boolean updateMoreAggInfo(HTable aggTable, AppAggregationKey appAggKey, JobDetails jobDetails) throws IOException { int attempts = 0; boolean status = false; while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateNumberRuns(appAggKey, aggTable, jobDetails); attempts++; } attempts = 0; status = false; while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateQueue(appAggKey, aggTable, jobDetails); attempts++; } attempts = 0; status = false; while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) { status = updateCost(appAggKey, aggTable, jobDetails); attempts++; } byte[] rowKey = aggConv.toBytes(appAggKey); Put p = new Put(rowKey); p.add(Constants.INFO_FAM_BYTES, AggregationConstants.USER_BYTES, Bytes.toBytes(appAggKey.getUserName())); p.add(Constants.INFO_FAM_BYTES, AggregationConstants.APP_ID_COL_BYTES, Bytes.toBytes(appAggKey.getAppId())); aggTable.put(p); return true; }
Source:
protected Runnable getCallback(final RefreshProfileDialog dialog) { return new Runnable() { public void run() { Map<Package, Collection<Profile>> profilesToReapply = dialog.getProfilesToReapply(); EditingDomain domain = EMFHelper.resolveEditingDomain(rootPackage); if(domain instanceof TransactionalEditingDomain) { Collection<Profile> allProfiles = new LinkedList<Profile>(); for(Collection<Profile> profiles : profilesToReapply.values()) { allProfiles.addAll(profiles); } if(ProfileValidationHelper.checkApplicableProfiles(Display.getCurrent().getActiveShell(), allProfiles)) { CompoundCommand command = new CompoundCommand(); for(Map.Entry<Package, Collection<Profile>> profiles : profilesToReapply.entrySet()) { command.append(new ApplyProfileCommand(profiles.getKey(), profiles.getValue(), (TransactionalEditingDomain)domain)); command.append(new ApplyProfileVersionCommand(profiles.getKey(), profiles.getValue(), (TransactionalEditingDomain)domain)); } domain.getCommandStack().execute(command); } } else { Activator.log.error(new IllegalArgumentException("Cannot reapply profiles on Package " + rootPackage.getQualifiedName() + ". The EditingDomain cannot be found")); } } }; }

Target:
protected Runnable getCallback(final RefreshProfileDialog dialog) { return new Runnable() { public void run() { Map<Package, Collection<Profile>> profilesToReapply = dialog.getProfilesToReapply(); EditingDomain domain = EMFHelper.resolveEditingDomain(rootPackage); if(domain instanceof TransactionalEditingDomain) { Collection<Profile> allProfiles = new LinkedList<Profile>(); for(Collection<Profile> profiles : profilesToReapply.values()) { allProfiles.addAll(profiles); } if(ProfileValidationHelper.checkApplicableProfiles(Display.getCurrent().getActiveShell(), allProfiles)) { CompoundCommand command = new CompoundCommand(); for(Map.Entry<Package, Collection<Profile>> profiles : profilesToReapply.entrySet()) { command.append(new ApplyProfileCommand(profiles.getKey(), profiles.getValue(), (TransactionalEditingDomain)domain)); } domain.getCommandStack().execute(command); } } else { Activator.log.error(new IllegalArgumentException("Cannot reapply profiles on Package " + rootPackage.getQualifiedName() + ". The EditingDomain cannot be found")); } } }; }
Source:
public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) throws ConfigurationException { logger.debug("activate is called."); this.bundleContext = bundleContext; context.setProviders(providers); String refreshIntervalString = (String) configuration.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } context.getConfig().parse(configuration); logger.info(context.getConfig().toString()); communicator.start(); setProperlyConfigured(true); }

Target:
public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) throws ConfigurationException { logger.debug("activate is called."); context.setProviders(providers); String refreshIntervalString = (String) configuration.get("poll.interval"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } context.getConfig().parse(configuration); logger.debug(context.getConfig().toString()); communicator.start(); setProperlyConfigured(true); }
Source:
public GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile) { if (geoJsonFile == null) { throw new IllegalArgumentException("GeoJSON file cannot be null"); } mBoundingBox = null; GeoJsonParser parser = new GeoJsonParser(geoJsonFile); mBoundingBox = parser.getBoundingBox(); HashMap<GeoJsonFeature, Object> geoJsonFeatures = new HashMap<>(); for (GeoJsonFeature feature : parser.getFeatures()) { geoJsonFeatures.put(feature, null); } mRenderer = new GeoJsonRenderer(map, geoJsonFeatures); storeRenderer(mRenderer); }

Target:
public GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile) { if (geoJsonFile == null) { throw new IllegalArgumentException("GeoJSON file cannot be null"); } mBoundingBox = null; GeoJsonParser parser = new GeoJsonParser(geoJsonFile); mBoundingBox = parser.getBoundingBox(); HashMap<GeoJsonFeature, Object> geoJsonFeatures = new HashMap<>(); for (GeoJsonFeature feature : parser.getFeatures()) { geoJsonFeatures.put(feature, null); } GeoJsonRenderer mRenderer = new GeoJsonRenderer(map, geoJsonFeatures); storeRenderer(mRenderer); }