auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static void validateDataStreams(SortedMap<String, IndexAbstraction> indicesLookup, @Nullable DataStreamMetadata dsMetadata) { if (dsMetadata != null) { for (DataStream ds : dsMetadata.dataStreams().values()) { Map<String, IndexAbstraction> conflicts = indicesLookup.subMap(ds.getName() + "-", ds.getName() + ".") .entrySet().stream() .filter(entry -> { if (entry.getValue().getType() != IndexAbstraction.Type.CONCRETE_INDEX) { return true; } else { int indexNameCounter; try { indexNameCounter = IndexMetadata.parseIndexNameCounter(entry.getKey()); } catch (Exception e) { return false; } return indexNameCounter > ds.getGeneration(); } }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); if (conflicts.size() > 0) { throw new IllegalStateException("data stream [" + ds.getName() + "] could create backing indices that conflict with " + conflicts.size() + " existing index(s) or alias(s)" + " including '" + conflicts.keySet().iterator().next() + "'"); } } } }

Target:
static void validateDataStreams(SortedMap<String, IndexAbstraction> indicesLookup, @Nullable DataStreamMetadata dsMetadata) { if (dsMetadata != null) { for (DataStream ds : dsMetadata.dataStreams().values()) { Map<String, IndexAbstraction> conflicts = indicesLookup.subMap(ds.getName() + "-", ds.getName() + ".") .entrySet().stream() .filter(entry -> { if (entry.getValue().getType() != IndexAbstraction.Type.CONCRETE_INDEX) { return true; } else { int indexNameCounter; try { indexNameCounter = IndexMetadata.parseIndexNameCounter(entry.getKey()); } catch (IllegalArgumentException e) { return false; } return indexNameCounter > ds.getGeneration(); } }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); if (conflicts.size() > 0) { throw new IllegalStateException("data stream [" + ds.getName() + "] could create backing indices that conflict with " + conflicts.size() + " existing index(s) or alias(s)" + " including '" + conflicts.keySet().iterator().next() + "'"); } } } }
Source:
private Map<SubPair, List<String>> getSubPoolMap() throws SQLException, DatabaseException { Statement stmt = connection.createStatement(); Map<SubPair, List<String>> subPoolsMap = new HashMap<>(); ResultSet rs = stmt.executeQuery( "SELECT cp_pool.id, cp_pool.subscriptionid, " + "cp_pool.subscriptionsubkey, cp_pool.owner_id " + "FROM cp_pool, " + "(SELECT subscriptionid, subscriptionsubkey " + "FROM cp_pool " + "WHERE subscriptionid IS NOT NULL " + "AND subscriptionsubkey IS NOT NULL " + "GROUP BY subscriptionid, subscriptionsubkey " + "HAVING count(id) > 1) subs " + "WHERE subs.subscriptionid = cp_pool.subscriptionid " + "AND subs.subscriptionsubkey = cp_pool.subscriptionsubkey"); Map<SubPair, String> subOwners = new HashMap<>(); while (rs.next()) { SubPair current = new SubPair(rs.getString(2), rs.getString(3)); if (!subPoolsMap.containsKey(current)) { subPoolsMap.put(current, new LinkedList<>()); subOwners.put(current, rs.getString(4)); } else if (!subOwners.get(current).equals(rs.getString(4))) { logger.error("Owners '{}' and '{}' both have pools from subscription: {}", rs.getString(4), subOwners.get(current), current); throw new DatabaseException("Pools exist for subscription " + current + " within multiple " + "owners."); } subPoolsMap.get(current).add(rs.getString(1)); } rs.close(); return subPoolsMap; }

Target:
private Map<SubPair, List<String>> getSubPoolMap() throws SQLException, DatabaseException { Statement stmt = connection.createStatement(); Map<SubPair, List<String>> subPoolsMap = new HashMap<>(); ResultSet rs = stmt.executeQuery( "SELECT cp_pool.id, cp_pool.subscriptionid, " + "cp_pool.subscriptionsubkey, cp_pool.owner_id " + "FROM cp_pool, " + "(SELECT subscriptionid, subscriptionsubkey " + "FROM cp_pool " + "WHERE subscriptionid IS NOT NULL " + "AND subscriptionsubkey IS NOT NULL " + "GROUP BY subscriptionid, subscriptionsubkey " + "HAVING count(id) > 1) subs " + "WHERE subs.subscriptionid = cp_pool.subscriptionid " + "AND subs.subscriptionsubkey = cp_pool.subscriptionsubkey"); Map<SubPair, String> subOwners = new HashMap<>(); while (rs.next()) { SubPair current = new SubPair(rs.getString(2), rs.getString(3)); if (!subPoolsMap.containsKey(current)) { subPoolsMap.put(current, new LinkedList<>()); subOwners.put(current, rs.getString(4)); } else if (!subOwners.get(current).equals(rs.getString(4))) { logger.error(String.format("Owners '%s' and '%s' both have pools from subscription: %s", rs.getString(4), subOwners.get(current), current)); throw new DatabaseException("Pools exist for subscription " + current + " within multiple " + "owners."); } subPoolsMap.get(current).add(rs.getString(1)); } rs.close(); return subPoolsMap; }
Source:
@Test public void getPriorityWithMultipleRequests() { Action action1 = mockAction(URI_KEY_1, URI_1, NORMAL); Action action2 = mockAction(URI_KEY_1, URI_1, HIGH); BitmapHunter hunter = forRequest(mockPicasso(new NetworkRequestHandler(downloader, stats)), dispatcher, cache, stats, action1); hunter.attach(action2); assertThat(hunter.getAction()).isEqualTo(action1); assertThat(hunter.getActions()).hasSize(1); assertThat(hunter.getActions()).contains(action2); assertThat(hunter.getPriority()).isEqualTo(HIGH); }

Target:
@Test public void getPriorityWithMultipleRequests() { Action action1 = mockAction(URI_KEY_1, URI_1, NORMAL); Action action2 = mockAction(URI_KEY_1, URI_1, HIGH); BitmapHunter hunter = forRequest(mockPicasso(new NetworkRequestHandler(downloader, stats)), dispatcher, cache, stats, action1); hunter.attach(action2); assertThat(hunter.getAction()).isEqualTo(action1); assertThat(hunter.getActions()).containsExactly(action2); assertThat(hunter.getPriority()).isEqualTo(HIGH); }
Source:
protected @NonNull List<@NonNull TimeGraphEntryModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { Builder<@NonNull TimeGraphEntryModel> builder = new Builder<>(); long parentId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); builder.add(new TimeGraphEntryModel(parentId, -1, getTrace().getName(), ss.getStartTime(), ss.getCurrentEndTime())); addChildren(ss, builder, ITmfStateSystem.ROOT_ATTRIBUTE, parentId); return builder.build(); }

Target:
protected @NonNull List<@NonNull TimeGraphEntryModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { Builder<@NonNull TimeGraphEntryModel> builder = new Builder<>(); long parentId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); builder.add(new TimeGraphEntryModel(parentId, -1, String.valueOf(getTrace().getName()), ss.getStartTime(), ss.getCurrentEndTime())); addChildren(ss, builder, ITmfStateSystem.ROOT_ATTRIBUTE, parentId); return builder.build(); }
Source:
static <BO extends BrooklynObject> Class<? extends AbstractBrooklynObjectSpec<?,?>> lookupSpecTypeForTarget(Class<BO> targetSuperType) { if (targetSuperType==null) return null; BrooklynObjectType best = null; for (BrooklynObjectType t: BrooklynObjectType.values()) { if (t.getSpecType()==null) continue; if (!t.getInterfaceType().isAssignableFrom(targetSuperType)) continue; if (t.getInterfaceType().equals(targetSuperType)) return t.getSpecType(); if (best==null) { best = t; continue; } if (best.getSpecType().isAssignableFrom(t.getSpecType())) { best = t; continue; } } if (best==null) { log.warn("Unexpected target supertype ("+targetSuperType+"); unable to infer spec type"); return null; } return best.getSpecType(); }

Target:
static <BO extends BrooklynObject> Class<? extends AbstractBrooklynObjectSpec<?,?>> lookupSpecTypeForTarget(Class<BO> targetSuperType) { if (targetSuperType==null) return null; BrooklynObjectType best = null; for (BrooklynObjectType t: BrooklynObjectType.values()) { if (t.getInterfaceType()==null) continue; if (!t.getInterfaceType().isAssignableFrom(targetSuperType)) continue; if (t.getInterfaceType().equals(targetSuperType)) return t.getSpecType(); if (best==null) { best = t; continue; } if (best.getInterfaceType().isAssignableFrom(t.getInterfaceType())) { best = t; continue; } } if (best==null) { log.warn("Unexpected target supertype ("+targetSuperType+"); unable to infer spec type"); return null; } return best.getSpecType(); }
Source:
public GamesTableController(MapService mapService, JoinGameHelper joinGameHelper, I18n i18n, UiService uiService, PreferencesService preferencesService) { this.mapService = mapService; this.joinGameHelper = joinGameHelper; this.i18n = i18n; this.uiService = uiService; this.preferencesService = preferencesService; this.selectedGame = new SimpleObjectProperty<>(); modChangedListener = (observable, oldValue, newValue) -> modsColumn.setVisible(newValue); passwordChangeListener = (observable, oldValue, newValue) -> passwordProtectionColumn.setVisible(newValue); }

Target:
public GamesTableController(MapService mapService, JoinGameHelper joinGameHelper, I18n i18n, UiService uiService, PreferencesService preferencesService) { this.mapService = mapService; this.joinGameHelper = joinGameHelper; this.i18n = i18n; this.uiService = uiService; this.preferencesService = preferencesService; this.selectedGame = new SimpleObjectProperty<>(); showModdedGamesChangedListener = (observable, oldValue, newValue) -> modsColumn.setVisible(newValue); showPasswordProtectedGamesChangedListener = (observable, oldValue, newValue) -> passwordProtectionColumn.setVisible(newValue); }
Source:
private static void assertFullGetAllAttachableDisksByPoolId(List<Disk> disks) { assertEquals("There should be only three attachable disks", 4, disks.size()); Set<Guid> expectedFloatingDiskIds = new HashSet<Guid>(Arrays.asList(FixturesTool.FLOATING_DISK_ID, FixturesTool.FLOATING_LUN_ID, FixturesTool.FLOATING_CINDER_DISK_ID)); Set<Guid> actualFloatingDiskIds = new HashSet<Guid>(); for (Disk disk : disks) { actualFloatingDiskIds.add(disk.getId()); } assertEquals("Wrong attachable disks", expectedFloatingDiskIds, actualFloatingDiskIds); }

Target:
private static void assertFullGetAllAttachableDisksByPoolId(List<Disk> disks) { assertEquals("There should be only four attachable disks", 4, disks.size()); Set<Guid> expectedFloatingDiskIds = new HashSet<Guid>(Arrays.asList(FixturesTool.FLOATING_DISK_ID, FixturesTool.FLOATING_LUN_ID, FixturesTool.FLOATING_CINDER_DISK_ID)); Set<Guid> actualFloatingDiskIds = new HashSet<Guid>(); for (Disk disk : disks) { actualFloatingDiskIds.add(disk.getId()); } assertEquals("Wrong attachable disks", expectedFloatingDiskIds, actualFloatingDiskIds); }
Source:
public Response getGeoAlertsForGeoClusters(@PathParam("alertType") String alertType) { try { String authorizedUser = MultitenantUtils.getTenantAwareUsername( CarbonContext.getThreadLocalCarbonContext().getUsername() ); GeoLocationProviderService geoService = DeviceMgtAPIUtils.getGeoService(); if (GeoServices.ALERT_TYPE_WITHIN.equals(alertType)) { List<GeoFence> alerts = geoService.getWithinAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_EXIT.equals(alertType)) { List<GeoFence> alerts = geoService.getExitAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_SPEED.equals(alertType)) { String result = geoService.getSpeedAlerts(); return Response.ok().entity(result).build(); } else if (GeoServices.ALERT_TYPE_PROXIMITY.equals(alertType)) { String result = geoService.getProximityAlerts(); return Response.ok().entity(result).build(); } else if (GeoServices.ALERT_TYPE_STATIONARY.equals(alertType)) { List<GeoFence> alerts = geoService.getStationaryAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_TRAFFIC.equals(alertType)) { List<GeoFence> alerts = geoService.getTrafficAlerts(); return Response.ok().entity(alerts).build(); } return null; } catch (GeoLocationBasedServiceException e) { String error = "Error occurred while getting the geo alerts for " + alertType + " alert"; log.error(error, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build(); } }

Target:
public Response getGeoAlertsForGeoClusters(@PathParam("alertType") String alertType) { try { GeoLocationProviderService geoService = DeviceMgtAPIUtils.getGeoService(); List<GeoFence> alerts = null; String result = null; switch (alertType) { case GeoServices.ALERT_TYPE_WITHIN: alerts = geoService.getWithinAlerts(); break; case GeoServices.ALERT_TYPE_EXIT: alerts = geoService.getExitAlerts(); break; case GeoServices.ALERT_TYPE_STATIONARY: alerts = geoService.getStationaryAlerts(); break; case GeoServices.ALERT_TYPE_TRAFFIC: alerts = geoService.getTrafficAlerts(); break; case GeoServices.ALERT_TYPE_SPEED: result = geoService.getSpeedAlerts(); return Response.ok().entity(result).build(); case GeoServices.ALERT_TYPE_PROXIMITY: result = geoService.getProximityAlerts(); return Response.ok().entity(result).build(); default: throw new GeoLocationBasedServiceException("Invalid Alert Type"); } return Response.ok().entity(alerts).build(); } catch (GeoLocationBasedServiceException e) { String error = "Error occurred while getting the geo alerts for " + alertType + " alert"; log.error(error, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build(); } }
Source:
public void adsFandomMobileArticleAds(String article) throws IOException { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsBaseObject wikiPage = new AdsBaseObject(driver, testedPage); getJquery(); wikiPage.verifyFandomMobileArticleTopLeaderboard(); wikiPage.verifyFandomMobileArticleBottomLeaderboard(); }

Target:
public void adsFandomMobileArticleAds(String article) { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsFandomObject wikiPage = new AdsFandomObject(driver, testedPage); getJquery(); wikiPage.verifyFandomMobileTopBoxad(); wikiPage.verifyFandomMobileArticleBottomLeaderboard(); }
Source:
public static Integer getConceptIdForUnits(String units) { String appDataDir = OpenmrsUtil.getApplicationDataDirectory(); Properties props = new Properties(); String conceptId = null; File propFile; BufferedReader br; String propString; try { propFile = new File(appDataDir + System.getProperty("file.separator") + DatabaseUtil.ORDER_ENTRY_UPGRADE_SETTINGS_FILENAME); br = new BufferedReader(new FileReader(propFile)); propString = IOUtils.toString(br).replaceAll("[^\\S\\n]", "\\\\ "); props.load(new StringReader(propString)); for (Map.Entry prop : props.entrySet()) { if (prop.getKey().equals(units)) { conceptId = prop.getValue().toString(); if (conceptId != null) { return Integer.valueOf(conceptId); } else { return null; } } } } catch (NumberFormatException e) { throw new APIException("Your order entry upgrade settings file" + "contains invalid mapping from " + units + " to concept ID " + conceptId + ". ID must be an integer or null. Please refer to upgrade instructions for more details.", e); } catch (IOException e) { if (e instanceof FileNotFoundException) { throw new APIException("Unable to find file containing order entry upgrade settings in your " + "application data directory: " + appDataDir + "\nPlease refer to upgrade instructions for more details.", e); } else { throw new APIException(e); } } throw new APIException("Your order entry upgrade settings file" + " does not have mapping for " + units + ". Please refer to upgrade instructions for more details."); }

Target:
public static Integer getConceptIdForUnits(String units) { String appDataDir = OpenmrsUtil.getApplicationDataDirectory(); Properties props = new Properties(); String conceptId = null; try { props.load(new FileInputStream(appDataDir + System.getProperty("file.separator") + DatabaseUtil.ORDER_ENTRY_UPGRADE_SETTINGS_FILENAME)); for (Map.Entry prop : props.entrySet()) { if (prop.getKey().equals(units)) { conceptId = prop.getValue().toString(); if (conceptId != null) { return Integer.valueOf(conceptId); } else { return null; } } } } catch (NumberFormatException e) { throw new APIException("Your order entry upgrade settings file" + "contains invalid mapping from " + units + " to concept ID " + conceptId + ". ID must be an integer or null. Please refer to upgrade instructions for more details.", e); } catch (IOException e) { if (e instanceof FileNotFoundException) { throw new APIException("Unable to find file containing order entry upgrade settings in your " + "application data directory: " + appDataDir + "\nPlease refer to upgrade instructions for more details.", e); } else { throw new APIException(e); } } throw new APIException("Your order entry upgrade settings file" + " does not have mapping for " + units + ". Please refer to upgrade instructions for more details."); }
Source:
public static ReferenceSequenceFile getReferenceSequenceFile(final Path path, final boolean truncateNamesAtWhitespace, final boolean preferIndexed) { getFastaExtension(path); if (truncateNamesAtWhitespace && preferIndexed && canCreateIndexedFastaReader(path)) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { return (BlockCompressedInputStream.isValidFile(stream)) ? new BlockCompressedIndexedFastaSequenceFile(path) : new IndexedFastaSequenceFile(path); } catch (final FileNotFoundException e) { throw new IllegalStateException("Should never happen, because existence of files has been checked.", e); } catch (final IOException e) { throw new SAMException("Error opening FASTA: " + path, e); } } else { return new FastaSequenceFile(path, truncateNamesAtWhitespace); } }

Target:
public static ReferenceSequenceFile getReferenceSequenceFile(final Path path, final boolean truncateNamesAtWhitespace, final boolean preferIndexed) { getFastaExtension(path); if (truncateNamesAtWhitespace && preferIndexed && canCreateIndexedFastaReader(path)) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { return (BlockCompressedInputStream.isValidFile(stream)) ? new BlockCompressedIndexedFastaSequenceFile(path) : new IndexedFastaSequenceFile(path); } catch (final IOException e) { throw new SAMException("Error opening FASTA: " + path, e); } } else { return new FastaSequenceFile(path, truncateNamesAtWhitespace); } }
Source:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem || item instanceof RollershutterItem || item instanceof ContactItem || item instanceof DimmerItem)) { throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', only Switch-, Number- and StringItems are allowed - please check your *.items configuration"); } }

Target:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem || item instanceof RollershutterItem || item instanceof ContactItem || item instanceof DimmerItem)) { throw new BindingConfigParseException("Item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', only Switch-, Number-, Rollershutter-, Contact-, Dimmer- and StringItems are allowed - please check your *.items configuration"); } }
Source:
protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { connectToRunningTask(); return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); String newestRef = ResourceInstallUtils.getLatestProfileRef(); updateTask.execute(newestRef); uiController.downloadingUiState(); }

Target:
protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { connectToRunningTask(); return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); if(DeveloperPreferences.isUseDevFormsEnabled()) { ref = ResourceInstallUtils.getLatestProfileRef(); } updateTask.execute(ref); uiController.downloadingUiState(); }
Source:
private static Map<String, ModuleService> loadModules(Class cls) { Map<String, ModuleService> modules = new HashMap<>(); if(cls != null) { Map<String, ExtensionProxy> proxies = new HashMap<>(); ExtMap context = new ExtMap().mput(Base.GlobalContextKeys.EXTENSIONS_MAP, proxies); ServiceLoader<ModuleService> loader = ServiceLoader.load(cls); for (ModuleService module : loader) { modules.put(module.getName(), module); module.setContext(context); } } return modules; }

Target:
private static Map<String, ModuleService> loadModules(Class cls) { Map<String, ModuleService> modules = new HashMap<>(); if(cls != null) { Map<String, ExtensionProxy> proxies = new HashMap<>(); ExtMap context = new ExtMap().mput(ModuleService.EXTENSIONS_MAP, proxies); ServiceLoader<ModuleService> loader = ServiceLoader.load(cls); for (ModuleService module : loader) { modules.put(module.getName(), module); module.setContext(context); } } return modules; }
Source:
protected static InitialContext createJNDIContextFromServer0() throws NamingException { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080")); env.put(Context.SECURITY_PRINCIPAL, "guest"); env.put(Context.SECURITY_CREDENTIALS, "guest"); return new InitialContext(env); }

Target:
protected static InitialContext createJNDIContextFromServer0() throws NamingException { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, "http-remoting://" + TestSuiteEnvironment.getServerAddress() + ":8080"); env.put(Context.SECURITY_PRINCIPAL, "guest"); env.put(Context.SECURITY_CREDENTIALS, "guest"); return new InitialContext(env); }
Source:
public static StatusCode login() { final ImmutablePair<String, String> login = Settings.getGCVoteLogin(); if (login == null) { Log.e("Credentials can't be retreived"); return StatusCode.NO_LOGIN_INFO_STORED; } if (StringUtils.isEmpty(login.left) || StringUtils.isEmpty(login.right)) { Log.e("GCVote login information is not stored"); return StatusCode.NO_LOGIN_INFO_STORED; } final Parameters params = new Parameters("version", "cgeo"); params.put("userName", login.left, "password", login.right); final InputStream response = Network.getResponseStream(Network.getRequest("<LINK_0>", params)); boolean loggedIn = false; try { final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); final XmlPullParser xpp = factory.newPullParser(); xpp.setInput(response, Charsets.UTF_8.name()); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { final String tagName = xpp.getName(); if (StringUtils.equals(tagName, "votes")) { loggedIn = StringUtils.equals(xpp.getAttributeValue(null, "loggedIn"), "true"); break; } } eventType = xpp.next(); } } catch (final Exception e) { Log.e("Cannot parse GCVote result", e); return StatusCode.UNKNOWN_ERROR; } if (loggedIn) { Log.i("Successfully logged in gcvote.com as " + login.left); return StatusCode.NO_ERROR; } else { Log.e("Username or password is wrong"); return StatusCode.WRONG_LOGIN_DATA; } }

Target:
public static StatusCode login() { final ImmutablePair<String, String> login = Settings.getGCVoteLogin(); if (login == null) { Log.e("Credentials can't be retreived"); return StatusCode.NO_LOGIN_INFO_STORED; } final Parameters params = new Parameters("version", "cgeo", "userName", login.left, "password", login.right); final InputStream response = Network.getResponseStream(Network.getRequest("<LINK_0>", params)); try { final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); final XmlPullParser xpp = factory.newPullParser(); xpp.setInput(response, Charsets.UTF_8.name()); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { final String tagName = xpp.getName(); if (StringUtils.equals(tagName, "votes")) { if (StringUtils.equals(xpp.getAttributeValue(null, "loggedIn"), "true")) { Log.i("Successfully logged in gcvote.com as " + login.left); return StatusCode.NO_ERROR; } else { Log.e("Username or password is wrong"); return StatusCode.WRONG_LOGIN_DATA; } } } eventType = xpp.next(); } } catch (final Exception e) { Log.e("Cannot parse GCVote result", e); return StatusCode.UNKNOWN_ERROR; } return StatusCode.UNKNOWN_ERROR; }
Source:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return ""; } }

Target:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return constants.pooledDesktop(); } }
Source:
public void init(ScrollRequest scrollRequest, Map<String, String> map) { if (!(scrollRequest instanceof GenericScrollRequest)) { throw new IllegalArgumentException( "Requires a GenericScrollRequest got a " + scrollRequest.getClass().getCanonicalName()); } GenericScrollRequest request = (GenericScrollRequest) scrollRequest; File file = new File(request.getQuery()); size = request.getSize(); try { iterator = FileUtils.lineIterator(file, "UTF-8"); } catch (IOException e) { throw new IllegalArgumentException("Invalid file " + file, e); } log.info("Scroll init: {}, size: {]", file.getAbsolutePath(), size); }

Target:
public void init(ScrollRequest scrollRequest, Map<String, String> map) { if (!(scrollRequest instanceof GenericScrollRequest)) { throw new IllegalArgumentException( "Requires a GenericScrollRequest got a " + scrollRequest.getClass().getCanonicalName()); } GenericScrollRequest request = (GenericScrollRequest) scrollRequest; File file = new File(request.getQuery()); size = request.getSize(); try { iterator = FileUtils.lineIterator(file, "UTF-8"); } catch (IOException e) { throw new IllegalArgumentException("Invalid file " + file, e); } log.info("Scroll init: {}, size: {}", file.getAbsolutePath(), size); }
Source:
public synchronized void remove(int n) throws IOException { if (isEmpty()) throw new NoSuchElementException(); if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } if (n < 1) { throw new IllegalArgumentException( "Cannot remove a non-positive (" + n + ") number of elements."); } if (n == elementCount) { clear(); return; } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }

Target:
public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }
Source:
public void showAlertDialog(String title, String message) { AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); dialog.setTitle(title); dialog.setMessage(message).setCancelable(false).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }).create().show(); }

Target:
public void showAlertDialog(String title, String message) { new MaterialDialog.Builder().init(getActivity()) .setTitle(title) .setMessage(message) .setCancelable(false) .setPositiveButton(getStringMessage(R.string.dialog_action_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }) .createMaterialDialog() .show(); }
Source:
public void init() throws Exception { int portOffset = 1; int idleTime = 1; serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); serverPropertyMap.put("-Dtenant.idle.time", Integer.toString(idleTime)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); manager.startServers(server); UserPopulator userPopulator = new UserPopulator("AS", "appServerInstance0002"); userPopulator.populateUsers(); }

Target:
public void init() throws Exception { int portOffset = 1; int idleTime = 1; serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); serverPropertyMap.put("-Dtenant.idle.time", Integer.toString(idleTime)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); asServerManager.startServers(server); UserPopulator userPopulator = new UserPopulator(ASIntegrationConstants.AS_PRODUCT_GROUP, ASIntegrationConstants.AS_INSTANCE_0002); userPopulator.populateUsers(); }
Source:
public static void openInCompare(RevCommit commit1, RevCommit commit2, String commit1Path, String commit2Path, Repository repository, IWorkbenchPage workBenchPage) { final ITypedElement base = CompareUtils .getFileRevisionTypedElement(commit1Path, commit1, repository); final ITypedElement next = CompareUtils .getFileRevisionTypedElement(commit2Path, commit2, repository); CompareEditorInput in = new GitCompareFileRevisionEditorInput(base, next, repository, null); CompareUtils.openInCompareEditor(workBenchPage, in); }

Target:
public static void openInCompare(RevCommit commit1, RevCommit commit2, String commit1Path, String commit2Path, Repository repository, IWorkbenchPage workBenchPage) { final ITypedElement base = CompareUtils .getFileRevisionTypedElement(commit1Path, commit1, repository); final ITypedElement next = CompareUtils .getFileRevisionTypedElement(commit2Path, commit2, repository); CompareEditorInput in = new GitCompareFileRevisionEditorInput(base, next, null); CompareUtils.openInCompare(workBenchPage, repository, in); }
Source:
public UploadStatistics applyDeltaCodeSystemsRemove(String theSystem, CustomTerminologySet theValue) { validateDstu3OrNewer(); TermCodeSystem cs = myCodeSystemDao.findByCodeSystemUri(theSystem); if (cs == null) { throw new InvalidRequestException("Unknown code system: " + theSystem); } AtomicInteger removeCounter = new AtomicInteger(0); for (TermConcept nextSuppliedConcept : theValue.getRootConcepts()) { Optional<TermConcept> conceptOpt = myTerminologySvc.findCode(theSystem, nextSuppliedConcept.getCode()); if (conceptOpt.isPresent()) { TermConcept concept = conceptOpt.get(); deleteConceptChildrenAndConcept(concept, removeCounter); } } IIdType target = cs.getResource().getIdDt(); return new UploadStatistics(removeCounter.get(), target); }

Target:
public UploadStatistics applyDeltaCodeSystemsRemove(String theSystem, CustomTerminologySet theValue) { ValidateUtil.isNotBlankOrThrowInvalidRequest(theSystem, "No system provided"); validateDstu3OrNewer(); TermCodeSystem cs = myCodeSystemDao.findByCodeSystemUri(theSystem); if (cs == null) { throw new InvalidRequestException("Unknown code system: " + theSystem); } AtomicInteger removeCounter = new AtomicInteger(0); for (TermConcept nextSuppliedConcept : theValue.getRootConcepts()) { Optional<TermConcept> conceptOpt = myTerminologySvc.findCode(theSystem, nextSuppliedConcept.getCode()); if (conceptOpt.isPresent()) { TermConcept concept = conceptOpt.get(); deleteConceptChildrenAndConcept(concept, removeCounter); } } IIdType target = cs.getResource().getIdDt(); return new UploadStatistics(removeCounter.get(), target); }
Source:
public static <TSource, TInner, TKey, TResult> Enumerable<TResult> hashJoin( Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource, TKey> outerKeySelector, Function1<TInner, TKey> innerKeySelector, Function2<TSource, TInner, TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight) { return hashJoin_( outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, generateNullsOnLeft, generateNullsOnRight, null); }

Target:
public static <TSource, TInner, TKey, TResult> Enumerable<TResult> hashJoin( Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource, TKey> outerKeySelector, Function1<TInner, TKey> innerKeySelector, Function2<TSource, TInner, TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight) { return hashEquiJoin_( outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, generateNullsOnLeft, generateNullsOnRight); }
Source:
public void testCacheConfigUsage() { DefaultCacheEventListenerConfiguration cacheEventListenerConfiguration = new DefaultCacheEventListenerConfiguration(ListenerObject.class); cacheEventListenerConfiguration.setEventsToFireOn(ListenerObject.fireOn()); cacheEventListenerConfiguration.setEventOrderingMode(ListenerObject.eventOrdering()); cacheEventListenerConfiguration.setEventFiringMode(ListenerObject.eventFiring()); final CacheManager manager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder() .addServiceConfig(cacheEventListenerConfiguration) .buildConfig(Object.class, Object.class)).build(); final Collection<?> bar = manager.getCache("foo", Object.class, Object.class).getRuntimeConfiguration().getServiceConfigurations(); assertThat(bar.iterator().next().getClass().toString(), is(ListenerObject.object.toString())); }

Target:
public void testCacheConfigUsage() { Set<EventType> eventTypeSet = new HashSet<EventType>(); eventTypeSet.add(EventType.CREATED); eventTypeSet.add(EventType.UPDATED); DefaultCacheEventListenerBuilder listenerBuilder = DefaultCacheEventListenerBuilder.newCacheEventListenerBuilder(); listenerBuilder.withEventsToFireOn(EnumSet.copyOf(eventTypeSet)); listenerBuilder.withEventOrdering(EventOrdering.UNORDERED); listenerBuilder.withEventFiringMode(EventFiring.ASYNCHRONOUS); DefaultCacheEventListenerConfiguration cacheEventListenerConfiguration = listenerBuilder.build(ListenerObject.class); final CacheManager manager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder() .addServiceConfig(cacheEventListenerConfiguration) .buildConfig(Object.class, Object.class)).build(true); final Collection<?> bar = manager.getCache("foo", Object.class, Object.class).getRuntimeConfiguration().getServiceConfigurations(); assertThat(bar.iterator().next().getClass().toString(), is(ListenerObject.object.toString())); }
Source:
public void displayText() { String name = getIntent().getExtras().getString("name"); String[] firstName = name.split(" "); if (firstName.length > 1) { requestReceiver.setText("Hi " + firstName[1] + " I'd like you to help me buy this items"); } requestReceiver.setText("Hi " + name + " I'd like you to help me buy this items"); }

Target:
public void displayText() { requestReceiver.setVisibility(View.VISIBLE); String receiversName = getIntent().getExtras().getString("name"); String[] receiversFullName = receiversName.split(" "); if (receiversFullName.length > 1) { requestReceiver.setText("Hi " + receiversFullName[0] + " I'd like you to help me buy this item(s)"); } else { requestReceiver.setText("Hi " + receiversName + " I'd like you to help me buy this item(s)"); } }
Source:
public static String gensalt(int log_rounds, SecureRandom random) { StringBuffer rs = new StringBuffer(); byte rnd[] = new byte[BCRYPT_SALT_LEN]; random.nextBytes(rnd); rs.append("$2a$"); if (log_rounds < 10) { rs.append("0"); } if (log_rounds > 30) { throw new IllegalArgumentException( "log_rounds exceeds maximum (30)"); } rs.append(Integer.toString(log_rounds)).append("$") .append(encode_base64(rnd, rnd.length)); return rs.toString(); }

Target:
public static String gensalt(int log_rounds, SecureRandom random) { StringBuffer rs = new StringBuffer(); byte rnd[] = new byte[BCRYPT_SALT_LEN]; random.nextBytes(rnd); rs.append("$2a$"); if (log_rounds < 10) { rs.append("0"); } if (log_rounds > 30) { throw new IllegalArgumentException( "log_rounds exceeds maximum (30)"); } rs.append(log_rounds).append("$") .append(encode_base64(rnd, rnd.length)); return rs.toString(); }
Source:
public void savePluginXml() throws CoreException { try (InputStream stream = XmlDocumentHelper.saveDocument(document)) { if (pluginXml.exists()) { pluginXml.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); pluginXml.setContents(stream, false, true, new NullProgressMonitor()); } else { pluginXml.create(stream, false, new NullProgressMonitor()); } } catch (TransformerException e) { throw wrapException(e); } catch (IOException e) { wrapException(e); } }

Target:
public void savePluginXml() throws CoreException { try { InputStream stream = XmlDocumentHelper.saveDocument(document); if (pluginXml.exists()) { pluginXml.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); pluginXml.setContents(stream, false, true, new NullProgressMonitor()); } else { pluginXml.create(stream, false, new NullProgressMonitor()); } } catch (TransformerException e) { throw wrapException(e); } catch (IOException e) { wrapException(e); } }
Source:
static void cleanup(){ final String ver = org.sqlite.SQLiteJDBCLoader.getVersion(); String tempFolder = new java.io.File(System.getProperty("java.io.tmpdir")).getAbsolutePath(); java.io.File dir = new java.io.File(tempFolder); java.io.File files = dir.listFiles(new java.io.FilenameFilter() { @Override public boolean accept(java.io.File dir, String name) { return name.startsWith("sqlite-" + ver); } }); for (java.io.File tempFile : files) { if(tempFile.getName().indexOf(".lck") > 0) { continue; } java.io.File lckFile = new java.io.File(tempFile.getName() + ".lck"); if(!lckFile.exists()) { try{ tempFile.delete(); } catch(SecurityException ex){ } } } }

Target:
static void cleanup() { String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath(); File dir = new File(tempFolder); File[] files = dir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.startsWith(searchPattern); } }); if(files != null) { for (File tempFile : files) { if(tempFile.getName().indexOf(".lck") > 0) { continue; } File lckFile = new File(tempFile.getName() + ".lck"); if(!lckFile.exists()) { try { tempFile.delete(); } catch (SecurityException e) { System.err.println("Fail deleting old native lib" + e.getMessage()); } } } } }
Source:
public UpdateStack build() { UpdateStack result = new AutoValue_UpdateStack( this.template != null ? template : null, this.templateUrl != null ? templateUrl : null, parameters != null ? ImmutableMap.copyOf(this.parameters) : null); return result; }

Target:
public UpdateStack build() { UpdateStack result = new AutoValue_UpdateStack( this.template, this.templateUrl, parameters != null ? ImmutableMap.copyOf(this.parameters) : null); return result; }
Source:
public void initialize(IPath containerPath, IJavaProject project) throws CoreException { String[] jars = Util.getJavaClassLibs(); IClasspathEntry[] entries = new IClasspathEntry[jars.length]; IClasspathAttribute[] extraAttributes; if (jars.length == 1 && (jars[0].endsWith("jrt-fs.jar") || JavaModelManager.isJrtInstallation(jars[0]))) { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; entries[0] = JavaCore.newJrtEntry((new Path(jars[0])).removeLastSegments(2), null, null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false ); } else { for (int i = 0; i < jars.length; i++) { if (RT_JAR_ANNOTATION_PATH != null && jars[i].endsWith("rt.jar")) { extraAttributes = externalAnnotationExtraAttributes(RT_JAR_ANNOTATION_PATH); } else { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } entries[i] = JavaCore.newLibraryEntry(new Path(jars[i]), null, null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false ); } } JavaCore.setClasspathContainer( new Path(TEST_CONTAINER_NAME), new IJavaProject[]{ project }, new IClasspathContainer[] { new TestContainer(new Path(TEST_CONTAINER_NAME), entries) }, null); }

Target:
public void initialize(IPath containerPath, IJavaProject project) throws CoreException { String[] jars = Util.getJavaClassLibs(); IClasspathEntry[] entries = new IClasspathEntry[jars.length]; IClasspathAttribute[] extraAttributes; if (jars.length == 1 && (jars[0].endsWith("jrt-fs.jar") || JavaModelManager.isJrtInstallation(jars[0]))) { if (RT_JAR_ANNOTATION_PATH != null) { extraAttributes = externalAnnotationExtraAttributes(RT_JAR_ANNOTATION_PATH); } else { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } extraAttributes = externalAnnotationExtraAttributes(RT_JAR_ANNOTATION_PATH); entries[0] = JavaCore.newJrtEntry((new Path(jars[0])).removeLastSegments(2), null, null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false ); } else { for (int i = 0; i < jars.length; i++) { if (RT_JAR_ANNOTATION_PATH != null && jars[i].endsWith("rt.jar")) { extraAttributes = externalAnnotationExtraAttributes(RT_JAR_ANNOTATION_PATH); } else { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } entries[i] = JavaCore.newLibraryEntry(new Path(jars[i]), null, null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false ); } } JavaCore.setClasspathContainer( new Path(TEST_CONTAINER_NAME), new IJavaProject[]{ project }, new IClasspathContainer[] { new TestContainer(new Path(TEST_CONTAINER_NAME), entries) }, null); }
Source:
public String cadenceToString(int cadence) { numberFormat.setMaximumFractionDigits(0); return numberFormat.format(cadence) + " r|spm"; }

Target:
public String cadenceToString(int cadence) { numberFormat.setMaximumFractionDigits(0); return numberFormat.format(cadence) + " rpm / spm"; }
Source:
public void testAddLabelAndAlias() throws JsonProcessingException { ItemDocument currentDocument = ItemDocumentBuilder.forItemId(Q1).build(); MonolingualTextValue label = Datamodel.makeMonolingualTextValue("strudel aux pommes", "fr"); MonolingualTextValue alias = Datamodel.makeMonolingualTextValue("Apfelstrudel", "fr"); TermStatementUpdate su = makeUpdate(currentDocument, Collections.singletonList(label), Collections.<MonolingualTextValue> emptyList(), Collections.singletonList(alias), Collections.<MonolingualTextValue> emptyList()); assertEquals(Collections.singleton("fr"), su.getLabelUpdates().keySet()); assertEquals(label.getText(), su.getLabelUpdates().get("fr").getText()); assertEquals(Collections.singleton("fr"), su.getAliasUpdates().keySet()); assertEquals(alias.getText(), su.getAliasUpdates().get("fr").get(0).getText()); assertTrue(su.getDescriptionUpdates().isEmpty()); assertTrue(!su.isNull()); }

Target:
public void testAddLabelAndAlias() throws JsonProcessingException { ItemDocument currentDocument = ItemDocumentBuilder.forItemId(Q1).build(); MonolingualTextValue label = Datamodel.makeMonolingualTextValue("strudel aux pommes", "fr"); MonolingualTextValue alias = Datamodel.makeMonolingualTextValue("Apfelstrudel", "fr"); TermStatementUpdate su = makeUpdate(currentDocument, Collections.singletonList(label), Collections.<MonolingualTextValue> emptyList(), Collections.singletonList(alias), Collections.<MonolingualTextValue> emptyList()); assertEquals(Collections.singleton("fr"), su.getLabelUpdates().keySet()); assertEquals(label.getText(), su.getLabelUpdates().get("fr").getText()); assertEquals(Collections.singleton("fr"), su.getAliasUpdates().keySet()); assertEquals(alias.getText(), su.getAliasUpdates().get("fr").get(0).getText()); assertTrue(su.getDescriptionUpdates().isEmpty()); assertFalse(su.isEmptyEdit()); }
Source:
Set<SinkRecordField> missingFields(Collection<SinkRecordField> fields, Set<String> dbColumnNames) { final Set<SinkRecordField> missingFields = new HashSet<>(); for (SinkRecordField field : fields) { if (!dbColumnNames.contains(field.name())) { missingFields.add(field); } } Set<String> columnNamesLowerCase = new HashSet<>(); for (String columnName: dbColumnNames) { columnNamesLowerCase.add(columnName.toLowerCase()); } if (columnNamesLowerCase.size() != dbColumnNames.size()) { log.warn("Table has column names which differ only with case sensitivity. Original " + "columns={}", dbColumnNames); } final Set<SinkRecordField> missingFieldsIgnoreCase = new HashSet<>(); for (SinkRecordField missing: missingFields) { if (!columnNamesLowerCase.contains(missing.name().toLowerCase())) { missingFieldsIgnoreCase.add(missing); } } if (missingFieldsIgnoreCase.size() > 0) { log.info( "Unable to find fields among column names {}", missingFieldsIgnoreCase, dbColumnNames ); } return missingFieldsIgnoreCase; }

Target:
Set<SinkRecordField> missingFields(Collection<SinkRecordField> fields, Set<String> dbColumnNames) { final Set<SinkRecordField> missingFields = new HashSet<>(); for (SinkRecordField field : fields) { if (!dbColumnNames.contains(field.name())) { missingFields.add(field); } } if (missingFields.isEmpty()) { return missingFields; } Set<String> columnNamesLowerCase = new HashSet<>(); for (String columnName: dbColumnNames) { columnNamesLowerCase.add(columnName.toLowerCase()); } if (columnNamesLowerCase.size() != dbColumnNames.size()) { log.warn( "Table has column names that differ only by case. Original columns={}", dbColumnNames ); } final Set<SinkRecordField> missingFieldsIgnoreCase = new HashSet<>(); for (SinkRecordField missing: missingFields) { if (!columnNamesLowerCase.contains(missing.name().toLowerCase())) { missingFieldsIgnoreCase.add(missing); } } if (missingFieldsIgnoreCase.size() > 0) { log.info( "Unable to find fields among column names {}", missingFieldsIgnoreCase, dbColumnNames ); } return missingFieldsIgnoreCase; }