auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void loadFromLocalStorage(VmConsoles consoles) { String vmId = guidToStringNullSafe(consoles.getVm().getId()); String poolId = guidToStringNullSafe(consoles.getVm().getVmPoolId()); ConsoleContext context = consoles.getConsoleContext(); KeyMaker poolKeyMaker = new KeyMaker(poolId, true, context); loadConsolesWithKeymaker(consoles, poolKeyMaker); if (consoles instanceof VmConsolesImpl) { KeyMaker vmKeyMaker = new KeyMaker(vmId, false, context); loadConsolesWithKeymaker(consoles, vmKeyMaker); } }

Target:
public void loadFromLocalStorage(VmConsoles consoles) { String vmId = guidToStringNullSafe(consoles.getVm().getId()); String poolId = guidToStringNullSafe(consoles.getVm().getVmPoolId()); ConsoleContext context = consoles.getConsoleContext(); if (poolId != null) { KeyMaker poolKeyMaker = new KeyMaker(poolId, true, context); loadConsolesWithKeymaker(consoles, poolKeyMaker); } if (consoles instanceof VmConsolesImpl) { KeyMaker vmKeyMaker = new KeyMaker(vmId, false, context); loadConsolesWithKeymaker(consoles, vmKeyMaker); } }
Source:
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/").setCachePeriod(3600*24*7); registry.addResourceHandler("/robots.txt").addResourceLocations("/WEB-INF/").setCachePeriod(0); registry.addResourceHandler("/files/judgments/**").addResourceLocations(ResourceUtils.FILE_URL_PREFIX + judgmentsContentPath).setCachePeriod(3600*24); }

Target:
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/").setCachePeriod(3600*24*7); registry.addResourceHandler("/robots.txt").addResourceLocations("/WEB-INF/").setCachePeriod(0); registry.addResourceHandler("/files/judgments/**").addResourceLocations(ResourceUtils.FILE_URL_PREFIX + judgmentsContentPath).setCachePeriod(600); }
Source:
JwkDefinition getDefinitionLoadIfNecessary(String keyId) { JwkDefinition result = this.getDefinition(keyId); if (result != null) { return result; } this.jwkDefinitions.clear(); for(URL jwkSetUrl : jwkSetUrls) { this.jwkDefinitions.putAll(loadJwkDefinitions(jwkSetUrl)); } return this.getDefinition(keyId); }

Target:
JwkDefinitionHolder getDefinitionLoadIfNecessary(String keyId) { JwkDefinitionHolder result = this.getDefinition(keyId); if (result != null) { return result; } synchronized (this.jwkDefinitions) { this.jwkDefinitions.clear(); for (URL jwkSetUrl : jwkSetUrls) { this.jwkDefinitions.putAll(loadJwkDefinitions(jwkSetUrl)); } return this.getDefinition(keyId); } }
Source:
public ParseHttpResponse intercept(Chain chain) throws IOException { ParseHttpRequest request = chain.getRequest(); ParseHttpResponse response = chain.proceed(request); if (GZIP_ENCODING.equalsIgnoreCase(response.getHeader(CONTENT_ENCODING_HEADER))) { Map<String, String > newHeaders = new HashMap<>(response.getAllHeaders()); newHeaders.remove(CONTENT_ENCODING_HEADER); response = new ParseHttpResponse.Builder() .setTotalSize(response.getTotalSize()) .setContentType(response.getContentType()) .setHeaders(newHeaders) .setReasonPhase(response.getReasonPhrase()) .setStatusCode(response.getStatusCode()) .setContent(new GZIPInputStream(response.getContent())) .build(); } return response; }

Target:
public ParseHttpResponse intercept(Chain chain) throws IOException { ParseHttpRequest request = chain.getRequest(); ParseHttpResponse response = chain.proceed(request); if (GZIP_ENCODING.equalsIgnoreCase(response.getHeader(CONTENT_ENCODING_HEADER))) { Map<String, String > newHeaders = new HashMap<>(response.getAllHeaders()); newHeaders.remove(CONTENT_ENCODING_HEADER); newHeaders.put(CONTENT_LENGTH_HEADER, "-1"); response = new ParseHttpResponse.Builder() .setTotalSize(-1) .setContentType(response.getContentType()) .setHeaders(newHeaders) .setReasonPhase(response.getReasonPhrase()) .setStatusCode(response.getStatusCode()) .setContent(new GZIPInputStream(response.getContent())) .build(); } return response; }
Source:
public void should_increase_development_cards_when_user_buys_a_new_one() { playPreparationStage() .THROW_DICE(1) .nextRandomDevelopmentCards(asList(KNIGHT, KNIGHT, ROAD_BUILDING, KNIGHT, YEAR_OF_PLENTY, YEAR_OF_PLENTY)) .startTrackDevCardsQuantity() .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(1, 0, 0, 0, 0) .getGameDetails(2).gameUser(2).devCardsQuantityChanged(0, 0, 0, 0, 0) .getGameDetails(3).gameUser(3).devCardsQuantityChanged(0, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(1, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(0, 0, 1, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(1, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(0, 0, 0, 0, 1) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChanged(0, 0, 0, 0, 1); }

Target:
public void should_increase_development_cards_when_user_buys_a_new_one() { playPreparationStage() .THROW_DICE(1) .nextRandomDevelopmentCards(asList(KNIGHT, KNIGHT, ROAD_BUILDING, KNIGHT, YEAR_OF_PLENTY, YEAR_OF_PLENTY)) .startTrackDevCardsQuantity() .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(1, 0, 0, 0, 0) .getGameDetails(2).gameUser(2).devCardsQuantityChangedBy(0, 0, 0, 0, 0) .getGameDetails(3).gameUser(3).devCardsQuantityChangedBy(0, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(1, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(0, 0, 1, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(1, 0, 0, 0, 0) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(0, 0, 0, 0, 1) .BUY_CARD(1) .getGameDetails(1).gameUser(1).devCardsQuantityChangedBy(0, 0, 0, 0, 1); }
Source:
public void testCreateProjectWithProperties() throws IOException { final String newProjectName = "newProject"; ProjectInput in = new ProjectInput(); in.description = "Test description"; in.submit_type = SubmitType.CHERRY_PICK; in.use_contributor_agreements = InheritableBoolean.TRUE; in.use_signed_off_by = InheritableBoolean.TRUE; in.use_content_merge = InheritableBoolean.TRUE; in.require_change_id = InheritableBoolean.TRUE; RestResponse r = session.put("/projects/" + newProjectName, in); @SuppressWarnings("serial") ProjectInfo p = (new Gson()).fromJson(r.getReader(), new TypeToken<ProjectInfo>() {}.getType()); assertEquals(newProjectName, p.name); Project project = projectCache.get(new Project.NameKey(newProjectName)).getProject(); assertEquals(in.description, project.getDescription()); assertEquals(in.submit_type, project.getSubmitType()); assertEquals(in.use_contributor_agreements, project.getUseContributorAgreements()); assertEquals(in.use_signed_off_by, project.getUseSignedOffBy()); assertEquals(in.use_content_merge, project.getUseContentMerge()); assertEquals(in.require_change_id, project.getRequireChangeID()); }

Target:
public void testCreateProjectWithProperties() throws IOException { final String newProjectName = "newProject"; ProjectInput in = new ProjectInput(); in.description = "Test description"; in.submit_type = SubmitType.CHERRY_PICK; in.use_contributor_agreements = InheritableBoolean.TRUE; in.use_signed_off_by = InheritableBoolean.TRUE; in.use_content_merge = InheritableBoolean.TRUE; in.require_change_id = InheritableBoolean.TRUE; RestResponse r = session.put("/projects/" + newProjectName, in); @SuppressWarnings("serial") ProjectInfo p = (new Gson()).fromJson(r.getReader(), new TypeToken<ProjectInfo>() {}.getType()); assertEquals(newProjectName, p.name); Project project = projectCache.get(new Project.NameKey(newProjectName)).getProject(); assertProjectInfo(project, p); assertEquals(in.description, project.getDescription()); assertEquals(in.submit_type, project.getSubmitType()); assertEquals(in.use_contributor_agreements, project.getUseContributorAgreements()); assertEquals(in.use_signed_off_by, project.getUseSignedOffBy()); assertEquals(in.use_content_merge, project.getUseContentMerge()); assertEquals(in.require_change_id, project.getRequireChangeID()); }
Source:
public void testDeepCopy() throws Exception { ZestRequest req = new ZestRequest (); req.setUrl(new URL("<LINK_0>{{token1}}")); req.setHeaders("Set-Cookie: test={{token2}}"); req.setData("test={{token3}}&user=12{{token3}}34"); req.addCookie(new ZestCookie("{{token}}.{{token3}}", "12{{token3}}34", "56{{token2}}78", "/{{token1}}A/{{token2}}B", new Date(), true)); ZestRequest req2 = req.deepCopy(); assertTrue(req.getHeaders().equals(req2.getHeaders())); assertTrue(req.getData().equals(req2.getData())); ZestCookie cookie = req.getZestCookies().get(0); ZestCookie cookie2 = req2.getZestCookies().get(0); assertTrue("cookies should not be reference equals", !cookie.equals(cookie2)); assertTrue(cookie.getDomain().equals(cookie2.getDomain())); assertTrue(cookie.getName().equals(cookie2.getName())); assertTrue(cookie.getValue().equals(cookie2.getValue())); assertTrue(cookie.getPath().equals(cookie2.getPath())); assertTrue(cookie.getExpiryDate().equals(cookie2.getExpiryDate())); assertTrue(cookie.isSecure() == cookie2.isSecure()); }

Target:
public void testDeepCopy() throws Exception { ZestRequest req = new ZestRequest (); req.setUrl(new URL("<LINK_0>{{token1}}")); req.setHeaders("Set-Cookie: test={{token2}}"); req.setData("test={{token3}}&user=12{{token3}}34"); req.addCookie(new ZestCookie("{{token}}.{{token3}}", "12{{token3}}34", "56{{token2}}78", "/{{token1}}A/{{token2}}B", new Date(), true)); ZestRequest req2 = req.deepCopy(); assertTrue(req.getHeaders().equals(req2.getHeaders())); assertTrue(req.getData().equals(req2.getData())); ZestCookie cookie = req.getZestCookies().get(0); ZestCookie cookie2 = req2.getZestCookies().get(0); assertTrue("cookies should not be reference equals", cookie != cookie2); assertTrue(cookie.getDomain().equals(cookie2.getDomain())); assertTrue(cookie.getName().equals(cookie2.getName())); assertTrue(cookie.getValue().equals(cookie2.getValue())); assertTrue(cookie.getPath().equals(cookie2.getPath())); assertTrue(cookie.getExpiryDate().equals(cookie2.getExpiryDate())); assertTrue(cookie.isSecure() == cookie2.isSecure()); }
Source:
protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) { GoogleComputeEngineApi api = super.create(props, modules); URI imageUri = api.getImageApiForProject("google") .list(new ListOptions.Builder().filter("name eq gcel.*")) .concat() .filter(new Predicate<Image>() { @Override public boolean apply(Image input) { if (input.getDeprecated().isPresent()) { if (input.getDeprecated().get().getState().isPresent()) { if (!input.getDeprecated().get().getState().get().equals("DEPRECATED")) { return false; } } } return true; } }) .first() .get() .getSelfLink(); instance = InstanceTemplate.builder() .forMachineType(getDefaultMachineTypeUrl(userProject.get())) .addNetworkInterface(getNetworkUrl(userProject.get(), INSTANCE_NETWORK_NAME), Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT) .addMetadata("mykey", "myvalue") .description("a description") .addDisk(InstanceTemplate.PersistentDisk.Mode.READ_WRITE, getDiskUrl(userProject.get(), DISK_NAME)) .image(imageUri); return api; }

Target:
protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) { GoogleComputeEngineApi api = super.create(props, modules); URI imageUri = api.getImageApiForProject("google") .list(new ListOptions.Builder().filter("name eq gcel.*")) .concat() .filter(new Predicate<Image>() { @Override public boolean apply(Image input) { if (input.getDeprecated().isPresent() && input.getDeprecated().get().getState().isPresent()) { return input.getDeprecated().get().getState().get().equals("DEPRECATED"); } return true; } }) .first() .get() .getSelfLink(); instance = InstanceTemplate.builder() .forMachineType(getDefaultMachineTypeUrl(userProject.get())) .addNetworkInterface(getNetworkUrl(userProject.get(), INSTANCE_NETWORK_NAME), Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT) .addMetadata("mykey", "myvalue") .description("a description") .addDisk(InstanceTemplate.PersistentDisk.Mode.READ_WRITE, getDiskUrl(userProject.get(), DISK_NAME)) .image(imageUri); return api; }
Source:
public AppiumDriver(URL remoteAddress, String sessionId) { this.setSessionId(sessionId); AppiumCommandExecutor executor = new AppiumCommandExecutor(MobileCommand.commandRepository, remoteAddress); executor.setCommandCodec(new AppiumW3CHttpCommandCodec()); executor.setResponseCodec(Dialect.W3C.getResponseCodec()); executor.configureW3CMode(); this.setCommandExecutor(executor); init(executor); }

Target:
public AppiumDriver(URL remoteAddress, String sessionId) { this.setSessionId(sessionId); AppiumCommandExecutor executor = new AppiumCommandExecutor(MobileCommand.commandRepository, remoteAddress); executor.configureW3CMode(); executor.setResponseCodec(Dialect.W3C.getResponseCodec()); this.setCommandExecutor(executor); init(executor); }
Source:
private AbstractPlanNode handleDistinctWithGroupby(AbstractPlanNode root) { if (! m_parsedSelect.hasDistinctWithGroupBy()) { return root; } assert(m_parsedSelect.hasBeenRewritten() || m_parsedSelect.isGrouped()); if (m_parsedSelect.displayColumnsContainAllGroupByColumns()) { return root; } assert(m_parsedSelect.hasComplexAgg()); AggregatePlanNode distinctAggNode = new HashAggregatePlanNode(); distinctAggNode.setOutputSchema(m_parsedSelect.getDistinctProjectionSchema()); for (ParsedColInfo col : m_parsedSelect.distinctGroupByColumns()) { distinctAggNode.addGroupByExpression(col.expression); } distinctAggNode.addAndLinkChild(root); root = distinctAggNode; return root; }

Target:
private AbstractPlanNode handleDistinctWithGroupby(AbstractPlanNode root) { if (! m_parsedSelect.hasDistinctWithGroupBy()) { return root; } assert(m_parsedSelect.isGrouped()); if (m_parsedSelect.displayColumnsContainAllGroupByColumns()) { return root; } assert(m_parsedSelect.hasComplexAgg()); AggregatePlanNode distinctAggNode = new HashAggregatePlanNode(); distinctAggNode.setOutputSchema(m_parsedSelect.getDistinctProjectionSchema()); for (ParsedColInfo col : m_parsedSelect.distinctGroupByColumns()) { distinctAggNode.addGroupByExpression(col.m_expression); } distinctAggNode.addAndLinkChild(root); root = distinctAggNode; return root; }
Source:
public void process( EventData<?> eventData ) { }

Target:
public void process( EventData<?> eventData ) { if ( metricsConfig != null && metricsManager != null ) { String name = getName( metricsConfig.getNodePrefix(), TRANSFER_HONEYCOMB_EVENT, getDefaultName( IndyEventPostProcessor.class, "process" ), METER ); Meter meter = metricsManager.getMeter( name ); meter.mark(); } }
Source:
public boolean isTestingData() { boolean isTestingAccount = false; if(email.endsWith(".tmt")){ isTestingAccount = true; } return isTestingAccount; }

Target:
public boolean isTestingData() { return email.endsWith(".tmt"); }
Source:
public static void addShortcut(@Nullable final Context context, @NonNull final ChannelInfoItem data) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1 || context == null) { return; } final ShortcutManager manager = (ShortcutManager) context.getSystemService(Context.SHORTCUT_SERVICE); if (manager == null) { return; } Single.fromCallable(() -> getIcon(context, data.getThumbnailUrl(), manager.getIconMaxWidth(), manager.getIconMaxHeight(), R.drawable.ic_newpipe_triangle_white)) .subscribeOn(Schedulers.computation()) .map(icon -> new ShortcutInfo.Builder(context, getShortcutId(data)) .setShortLabel(data.getName()) .setLongLabel(data.getName()) .setIcon(icon.toIcon()) .setIntent(createIntent(context, data))) .observeOn(AndroidSchedulers.mainThread()) .subscribe(builder -> { final String id = getShortcutId(data); final List<ShortcutInfo> shortcuts = manager.getDynamicShortcuts(); final int limit = manager.getMaxShortcutCountPerActivity(); for (int i = 0; i < shortcuts.size(); i++) { final ShortcutInfo shortcut = shortcuts.get(i); if (id.equals(shortcut.getId())) { builder.setRank(shortcut.getRank() + 1); manager.updateShortcuts(Collections.singletonList(builder.build())); return; } } builder.setRank(1); if (!shortcuts.isEmpty() && shortcuts.size() >= limit) { manager.removeDynamicShortcuts(Collections.singletonList(shortcuts.get(shortcuts.size() - 1).getId())); } manager.addDynamicShortcuts(Collections.singletonList(builder.build())); }, e -> { if (BuildConfig.DEBUG) { e.printStackTrace(); } }); }

Target:
public static Disposable addShortcut(@Nullable final Context context, @NonNull final ChannelInfoItem data) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1 || context == null) { return null; } final ShortcutManager manager = (ShortcutManager) context.getSystemService(Context.SHORTCUT_SERVICE); if (manager == null) { return null; } return Single.fromCallable(() -> getIcon(context, data.getThumbnailUrl(), manager.getIconMaxWidth(), manager.getIconMaxHeight(), R.drawable.ic_newpipe_triangle_white)) .subscribeOn(Schedulers.io()) .map(icon -> new ShortcutInfo.Builder(context, getShortcutId(data.getUrl())) .setShortLabel(data.getName()) .setLongLabel(data.getName()) .setIcon(icon.toIcon()) .setIntent(createIntent(context, data))) .observeOn(AndroidSchedulers.mainThread()) .subscribe(builder -> { final String id = getShortcutId(data.getUrl()); final List<ShortcutInfo> shortcuts = manager.getDynamicShortcuts(); final int limit = manager.getMaxShortcutCountPerActivity(); for (int i = 0; i < shortcuts.size(); i++) { final ShortcutInfo shortcut = shortcuts.get(i); if (id.equals(shortcut.getId())) { builder.setRank(shortcut.getRank() + 1); manager.updateShortcuts(Collections.singletonList(builder.build())); return; } } builder.setRank(1); if (!shortcuts.isEmpty() && shortcuts.size() >= limit) { manager.removeDynamicShortcuts(Collections.singletonList(shortcuts.get(shortcuts.size() - 1).getId())); } manager.addDynamicShortcuts(Collections.singletonList(builder.build())); }, e -> { if (BuildConfig.DEBUG) { e.printStackTrace(); } }); }
Source:
String getFileName(final Diagram diagram) { Metadata metadata = diagram.getMetadata(); final Optional<Path> path = Optional.ofNullable(metadata.getPath()); return path.map(Path::getFileName).orElse(translationService.format(DMNDocumentationFactory_NoFileName)); }

Target:
String getFileName(final Diagram diagram) { final Metadata metadata = diagram.getMetadata(); final Optional<Path> path = Optional.ofNullable(metadata.getPath()); return path.map(Path::getFileName).orElse(translationService.format(DMNDocumentationFactory_NoFileName)); }
Source:
public XmlConfiguration(URL url, final ClassLoader classLoader, final Map<String, ClassLoader> cacheClassLoaders) throws ClassNotFoundException, SAXException, InstantiationException, IllegalAccessException, IOException { if(url == null) { throw new NullPointerException("The resource specified by the URL does not exist"); } this.xml = url; this.classLoader = classLoader; this.cacheClassLoaders = new HashMap<String, ClassLoader>(cacheClassLoaders); parseConfiguration(); }

Target:
public XmlConfiguration(URL url, final ClassLoader classLoader, final Map<String, ClassLoader> cacheClassLoaders) throws ClassNotFoundException, SAXException, InstantiationException, IllegalAccessException, IOException { if(url == null) { throw new NullPointerException("The url can not be null"); } if(classLoader == null) { throw new NullPointerException("The classLoader can not be null"); } if(cacheClassLoaders == null) { throw new NullPointerException("The cacheClassLoaders map can not be null"); } this.xml = url; this.classLoader = classLoader; this.cacheClassLoaders = new HashMap<String, ClassLoader>(cacheClassLoaders); parseConfiguration(); }
Source:
public static int compareSoftwareVersions(String firstVersion, String secondVersion) throws IOException { int GREATER_THAN = 1; int EQUAL = 0; int LESS_THAN = -1; if (firstVersion == null) { return LESS_THAN; } if (secondVersion == null) { return GREATER_THAN; } String[] firstParts = firstVersion.split("\\."); String[] secondParts = secondVersion.split("\\."); int firstMajor = firstParts.length >= 1 ? Integer.parseInt(firstParts[0]) : 0; int firstMinor = firstParts.length >= 2 ? Integer.parseInt(firstParts[1]) : 0; int secondMajor = secondParts.length >= 1 ? Integer.parseInt(secondParts[0]) : 0; int secondMinor = secondParts.length >= 2 ? Integer.parseInt(secondParts[1]) : 0; if (firstMajor == secondMajor && firstMinor == secondMinor) { return EQUAL; } else if (firstMajor > secondMajor) { return GREATER_THAN; } else if (firstMajor < secondMajor) { return LESS_THAN; } else if (firstMinor > secondMinor) { return GREATER_THAN; } else if (firstMinor < secondMinor) { return LESS_THAN; } return EQUAL; }

Target:
public static int compareSoftwareVersions(String firstVersion, String secondVersion) throws IOException { int GREATER_THAN = 1; int EQUAL = 0; int LESS_THAN = -1; if (firstVersion == null) { return LESS_THAN; } if (secondVersion == null) { return GREATER_THAN; } String[] firstParts = firstVersion.split("\\."); String[] secondParts = secondVersion.split("\\."); int firstMajor = firstParts.length >= 1 ? Integer.parseInt(firstParts[0]) : 0; int firstMinor = firstParts.length >= 2 ? Integer.parseInt(firstParts[1]) : 0; int secondMajor = secondParts.length >= 1 ? Integer.parseInt(secondParts[0]) : 0; int secondMinor = secondParts.length >= 2 ? Integer.parseInt(secondParts[1]) : 0; if (firstMajor == secondMajor && firstMinor == secondMinor) { return EQUAL; } else if (firstMajor > secondMajor) { return GREATER_THAN; } else if (firstMajor < secondMajor) { return LESS_THAN; } else if (firstMinor > secondMinor) { return GREATER_THAN; } else { return LESS_THAN; } }
Source:
public PerReplicaThrottleStage(boolean enableEmitThrottledMsg) { isEmitThrottledMsg = enableEmitThrottledMsg; }

Target:
protected PerReplicaThrottleStage(boolean enableEmitThrottledMsg) { isEmitThrottledMsg = enableEmitThrottledMsg; }
Source:
String serialize(final String uniqueUserId) throws AuthenticationException { final String methodName = ":serialize"; if (StringExtensions.isNullOrBlank(uniqueUserId)) { throw new IllegalArgumentException("uniqueUserId"); } if (mBrokerProxy.canSwitchToBroker(mAuthority) != BrokerProxy.SwitchToBroker.CANNOT_SWITCH_TO_BROKER) { throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "Failed to export the family refresh token cache item because broker is enabled."); } final TokenCacheAccessor tokenCacheAccessor = new TokenCacheAccessor(mTokenCacheStore, this.getAuthority(), Telemetry.registerNewRequest()); final TokenCacheItem tokenItem; try { tokenItem = tokenCacheAccessor.getFRTItem(AuthenticationConstants.MS_FAMILY_ID, uniqueUserId); } catch (final MalformedURLException e) { throw new AuthenticationException(ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL, e.getMessage(), e); } if (tokenItem == null) { Logger.i(TAG + methodName, "Cannot find the family token cache item for this userID", ""); throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "Failed to export the FID because no family token cache item is found."); } if (!StringExtensions.isNullOrBlank(tokenItem.getFamilyClientId())) { return SSOStateSerializer.serialize(tokenItem); } else { throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "tokenItem does not contain family refresh token"); } }

Target:
String serialize(final String uniqueUserId) throws AuthenticationException { final String methodName = ":serialize"; if (StringExtensions.isNullOrBlank(uniqueUserId)) { throw new IllegalArgumentException("uniqueUserId"); } if (mBrokerProxy.canSwitchToBroker(mAuthority) != BrokerProxy.SwitchToBroker.CANNOT_SWITCH_TO_BROKER) { throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "Failed to export the family refresh token cache item because broker is enabled."); } final TokenCacheAccessor tokenCacheAccessor = new TokenCacheAccessor(mTokenCacheStore, this.getAuthority(), Telemetry.registerNewRequest()); final TokenCacheItem tokenItem; try { tokenItem = tokenCacheAccessor.getFRTItem(AuthenticationConstants.MS_FAMILY_ID, uniqueUserId); } catch (final MalformedURLException e) { throw new AuthenticationException(ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL, e.getMessage(), e); } if (tokenItem == null) { Logger.i(TAG + methodName, "Cannot find the family token cache item for this userID", ""); throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "Failed to export the FID because no family token cache item is found."); } if (StringExtensions.isNullOrBlank(tokenItem.getFamilyClientId())) { throw new UsageAuthenticationException(ADALError.FAIL_TO_EXPORT, "tokenItem does not contain family refresh token"); } return SSOStateSerializer.serialize(tokenItem); }
Source:
public List<ItemFormMetadata> findAllByCrfVersion(int crf_version_id) { String query = "select distinct * from item_form_metadata ifm where ifm.crf_version_id = " + crf_version_id; org.hibernate.Query q = getCurrentSession().createSQLQuery(query).addEntity(ItemFormMetadata.class); return (List<ItemFormMetadata>) q.list(); }

Target:
public List<ItemFormMetadata> findAllByCrfVersion(int crf_version_id) { org.hibernate.Query q = getCurrentSession().createSQLQuery(findAllByCrfVersionQuery).addEntity(ItemFormMetadata.class); q.setInteger("crfversionid", crf_version_id); return (List<ItemFormMetadata>) q.list(); }
Source:
public double getInterestRate(Double time) { double discountFactor = getDiscountFactor(time); return -Math.log(discountFactor) / time; }

Target:
public double getInterestRate(Double time) { final double rate = _baseCurve.getYValue(time) + _sign * _fixedCurve.getYValue(time); return _compoundingPeriodsPerYear * Math.log(1.0d + rate / _compoundingPeriodsPerYear); }
Source:
private II getPatientIdFromRequest(PRPAIN201305UV02 request) { II livingSubjectId = null; if (request != null && request.getControlActProcess() != null && request.getControlActProcess().getQueryByParameter() != null && request.getControlActProcess().getQueryByParameter().getValue() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() .getLivingSubjectId() != null) { List<PRPAMT201306UV02LivingSubjectId> ids = request.getControlActProcess().getQueryByParameter().getValue() .getParameterList().getLivingSubjectId(); if (ids.size() == 1) { livingSubjectId = getLivingSubjectId(ids.get(0)); } else if (ids.size() > 1) { String root = request.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice() .getValue().getId().get(0).getRoot(); for (PRPAMT201306UV02LivingSubjectId id : ids) { II oII = getLivingSubjectId(id); if (oII != null && oII.getRoot() != null && oII.getRoot().equals(root)) { livingSubjectId = oII; break; } } } } else { LOG.error("PatientId doesn't exist in the received PRPAIN201305UV02 message"); } return livingSubjectId; }

Target:
private II getPatientIdFromRequest(PRPAIN201305UV02 request) { II livingSubjectId = null; if (request != null && request.getControlActProcess() != null && request.getControlActProcess().getQueryByParameter() != null && request.getControlActProcess().getQueryByParameter().getValue() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() .getLivingSubjectId() != null) { List<PRPAMT201306UV02LivingSubjectId> ids = request.getControlActProcess().getQueryByParameter().getValue() .getParameterList().getLivingSubjectId(); if (ids.size() == 1) { livingSubjectId = getLivingSubjectId(ids.get(0)); } else if (ids.size() > 1) { livingSubjectId = getLivingSubjectIdFromAuthorOrPerformerValue(request, ids); } } else { LOG.error("PatientId doesn't exist in the received PRPAIN201305UV02 message"); } return livingSubjectId; }
Source:
protected JSONObject search(@NonNull Query query) throws AlgoliaException { String cacheKey = null; String jsonStr = null; if (isCacheEnabled) { cacheKey = String.format("%s", query.getQueryString()); jsonStr = searchCache.get(cacheKey); } try { if (jsonStr == null) { jsonStr = new String(searchRaw(query), "UTF-8"); if (isCacheEnabled) { searchCache.put(cacheKey, jsonStr); } } return BaseAPIClient._getJSONObject(jsonStr); } catch (UnsupportedEncodingException | JSONException e) { throw new AlgoliaException(e.getMessage()); } }

Target:
protected JSONObject search(@NonNull Query query) throws AlgoliaException { String cacheKey = null; byte[] rawResponse = null; if (isCacheEnabled) { cacheKey = String.format("%s", query.getQueryString()); rawResponse = searchCache.get(cacheKey); } try { if (rawResponse == null) { rawResponse = searchRaw(query); if (isCacheEnabled) { searchCache.put(cacheKey, rawResponse); } } return BaseAPIClient._getJSONObject(rawResponse); } catch (UnsupportedEncodingException | JSONException e) { throw new AlgoliaException(e.getMessage()); } }
Source:
public boolean isFileValid() { String fileExstenstion = fileUpload.getFilename().substring(fileUpload.getFilename().lastIndexOf(".") + 1); if (isValidation && !allowedFiles.contains(fileExstenstion)) { return false; } return true; }

Target:
public boolean isFileValid() { String fileExtension = fileUpload.getFilename().substring(fileUpload.getFilename().lastIndexOf(".") + 1); if (isValidation && !allowedFiles.contains(fileExtension)) { return false; } return true; }
Source:
public List<Buffer> requestInflightBuffers(long checkpointId) throws IOException { synchronized (receivedBuffers) { checkState(checkpointId > lastRequestedCheckpointId, "Need to request the next checkpointId"); final List<Buffer> inflightBuffers = new ArrayList<>(receivedBuffers.size()); for (Buffer buffer : receivedBuffers) { if (!buffer.isBuffer() && parseCheckpointBarrierOrNull(buffer) != null) { break; } inflightBuffers.add(buffer.retainBuffer()); } lastRequestedCheckpointId = checkpointId; return inflightBuffers; } }

Target:
public List<Buffer> requestInflightBuffers(long checkpointId) throws IOException { synchronized (receivedBuffers) { checkState(checkpointId > lastRequestedCheckpointId, "Need to request the next checkpointId"); final List<Buffer> inflightBuffers = new ArrayList<>(receivedBuffers.size()); for (Buffer buffer : receivedBuffers) { CheckpointBarrier checkpointBarrier = parseCheckpointBarrierOrNull(buffer); if (checkpointBarrier != null && checkpointBarrier.getId() >= checkpointId) { break; } if (buffer.isBuffer()) { inflightBuffers.add(buffer.retainBuffer()); } } lastRequestedCheckpointId = checkpointId; return inflightBuffers; } }
Source:
public String getAsText() { Focus val = (Focus) getValue(); if (val == null) return null; return val.getStringValue(); }

Target:
public String getAsText() { return ImOption.apply((Focus) getValue()).map(f -> f.getStringValue()).getOrNull(); }
Source:
public void connectsToAnotherGithubServer() throws Exception { final RtGithub github = new RtGithub(URI.create("http://localhost:12345")); MatcherAssert.assertThat( github.entry().uri().toString(), Matchers.equalTo( "http://localhost:12345/" ) ); }

Target:
public void connectsToAnotherGithubServer() throws Exception { MatcherAssert.assertThat( new RtGithub(URI.create("http://localhost:12345")) .entry().uri().toString(), Matchers.equalTo( "http://localhost:12345/" ) ); }
Source:
public void testDeleteRecordV2() throws IOException, MessageFormatException { ByteBuffer deleteRecord = ByteBuffer.allocate(MessageFormatRecord.Delete_Format_V2.getDeleteRecordSize()); short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); int deletionTimeSecs = TestUtils.RANDOM.nextInt(); MessageFormatRecord.Delete_Format_V2.serializeDeleteRecord(deleteRecord, accountId, containerId, deletionTimeSecs); deleteRecord.flip(); DeleteRecord deserializeDeleteRecord = MessageFormatRecord.deserializeDeleteRecord(new ByteBufferInputStream(deleteRecord)); Assert.assertEquals("Delete record version mismatch ", deserializeDeleteRecord.getVersion(), MessageFormatRecord.Delete_Version_V2); Assert.assertEquals("AccountId mismatch ", accountId, deserializeDeleteRecord.getAccountId()); Assert.assertEquals("ContainerId mismatch ", containerId, deserializeDeleteRecord.getContainerId()); Assert.assertEquals("DeletionTime mismatch ", deletionTimeSecs, deserializeDeleteRecord.getDeletionTimeInSecs()); deleteRecord.flip(); deleteRecord.put(10, (byte) 4); try { MessageFormatRecord.deserializeDeleteRecord(new ByteBufferInputStream(deleteRecord)); Assert.assertEquals(true, false); } catch (MessageFormatException e) { Assert.assertEquals(e.getErrorCode(), MessageFormatErrorCodes.Data_Corrupt); } }

Target:
public void testDeleteRecordV2() throws IOException, MessageFormatException { ByteBuffer deleteRecord = ByteBuffer.allocate(MessageFormatRecord.Delete_Format_V2.getDeleteRecordSize()); short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); long deletionTimeMs = SystemTime.getInstance().milliseconds() + TestUtils.RANDOM.nextInt(); MessageFormatRecord.Delete_Format_V2.serializeDeleteRecord(deleteRecord, new DeleteRecord(accountId, containerId, deletionTimeMs)); deleteRecord.flip(); DeleteRecord deserializeDeleteRecord = MessageFormatRecord.deserializeDeleteRecord(new ByteBufferInputStream(deleteRecord)); Assert.assertEquals("AccountId mismatch ", accountId, deserializeDeleteRecord.getAccountId()); Assert.assertEquals("ContainerId mismatch ", containerId, deserializeDeleteRecord.getContainerId()); Assert.assertEquals("DeletionTime mismatch ", deletionTimeMs, deserializeDeleteRecord.getDeletionTimeInMs()); deleteRecord.flip(); byte toCorrupt = deleteRecord.get(10); deleteRecord.put(10, (byte) (toCorrupt + 1)); try { MessageFormatRecord.deserializeDeleteRecord(new ByteBufferInputStream(deleteRecord)); fail("Deserialization of a corrupt delete record V2 should have failed "); } catch (MessageFormatException e) { Assert.assertEquals(e.getErrorCode(), MessageFormatErrorCodes.Data_Corrupt); } }
Source:
protected String getAccessTokenIdFromRequest(final HttpServletRequest request) { var accessToken = request.getParameter(OAuth20Constants.ACCESS_TOKEN); if (StringUtils.isBlank(accessToken)) { val authHeader = request.getHeader(HttpConstants.AUTHORIZATION_HEADER); if (StringUtils.isNotBlank(authHeader) && authHeader.toLowerCase() .startsWith(OAuth20Constants.TOKEN_TYPE_BEARER.toLowerCase() + ' ')) { accessToken = authHeader.substring(OAuth20Constants.TOKEN_TYPE_BEARER.length() + 1); } } LOGGER.debug("[{}]: [{}]", OAuth20Constants.ACCESS_TOKEN, accessToken); return OAuth20Utils.getAccessTokenId(accessToken, getOAuthConfigurationContext().getOAuthAccessTokenIdExtractor()); }

Target:
protected String getAccessTokenIdFromRequest(final HttpServletRequest request) { var accessToken = request.getParameter(OAuth20Constants.ACCESS_TOKEN); if (StringUtils.isBlank(accessToken)) { val authHeader = request.getHeader(HttpConstants.AUTHORIZATION_HEADER); if (StringUtils.isNotBlank(authHeader) && authHeader.toLowerCase() .startsWith(OAuth20Constants.TOKEN_TYPE_BEARER.toLowerCase() + ' ')) { accessToken = authHeader.substring(OAuth20Constants.TOKEN_TYPE_BEARER.length() + 1); } } LOGGER.debug("[{}]: [{}]", OAuth20Constants.ACCESS_TOKEN, accessToken); return getOAuthConfigurationContext().getAccessTokenIdExtractor().extractId(accessToken); }
Source:
private RelationshipMetadataValue constructMetadataValue(Context context, String key) { try { String[] splittedKey = key.split("\\."); RelationshipMetadataValue metadataValue = new RelationshipMetadataValue(); String metadataSchema = splittedKey.length > 0 ? splittedKey[0] : null; String metadataElement = splittedKey.length > 1 ? splittedKey[1] : null; String metadataQualifier = splittedKey.length > 2 ? splittedKey[2] : null; MetadataField metadataField = metadataFieldService .findByElement(context, metadataSchema, metadataElement, metadataQualifier); if (metadataField == null) { log.error( "A MetadataValue was attempted to construct with MetadataField for paremeters: metadataschema: " + metadataSchema + ", metadataelement:" + metadataElement + ", metadataqualifier: " + metadataQualifier); return null; } metadataValue.setMetadataField(metadataField); metadataValue.setLanguage(Item.ANY); return metadataValue; } catch (SQLException e) { log.error(e.getMessage(), e); } return null; }

Target:
private RelationshipMetadataValue constructMetadataValue(Context context, String key) { String[] splittedKey = key.split("\\."); RelationshipMetadataValue metadataValue = new RelationshipMetadataValue(); String metadataSchema = splittedKey.length > 0 ? splittedKey[0] : null; String metadataElement = splittedKey.length > 1 ? splittedKey[1] : null; String metadataQualifier = splittedKey.length > 2 ? splittedKey[2] : null; MetadataField metadataField = null; try { metadataField = metadataFieldService .findByElement(context, metadataSchema, metadataElement, metadataQualifier); } catch (SQLException e) { log.error("Could not find element with MetadataSchema: " + metadataSchema + ", MetadataElement: " + metadataElement + " and MetadataQualifier: " + metadataQualifier, e); return null; } if (metadataField == null) { log.error("A MetadataValue was attempted to construct with MetadataField for parameters: " + "metadataschema: {}, metadataelement: {}, metadataqualifier: {}", metadataSchema, metadataElement, metadataQualifier); return null; } metadataValue.setMetadataField(metadataField); metadataValue.setLanguage(Item.ANY); return metadataValue; }
Source:
private void setVolumeOptions(GlusterVolumeEntity volume) { List<String> errors = new ArrayList<String>(); for (GlusterVolumeOptionEntity option : volume.getOptions()) { option.setVolumeId(volume.getId()); VdcReturnValueBase setOptionReturnValue = runBllAction( VdcActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), createCommandContext(volume, option)); if (!getSucceeded()) { errors.addAll(setOptionReturnValue.getCanDoActionMessages()); errors.addAll(setOptionReturnValue.getExecuteFailedMessages()); } } if (!errors.isEmpty()) { handleVdsErrors(AuditLogType.GLUSTER_VOLUME_OPTION_SET_FAILED, errors); } }

Target:
private void setVolumeOptions(GlusterVolumeEntity volume) { List<String> errors = new ArrayList<String>(); for (GlusterVolumeOptionEntity option : volume.getOptions()) { option.setVolumeId(volume.getId()); VdcReturnValueBase setOptionReturnValue = getBackend().runInternalAction( VdcActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), createCommandContext(volume, option)); if (!setOptionReturnValue.getSucceeded()) { setSucceeded(false); errors.addAll(setOptionReturnValue.getCanDoActionMessages()); errors.addAll(setOptionReturnValue.getExecuteFailedMessages()); } } if (!errors.isEmpty()) { handleVdsErrors(AuditLogType.GLUSTER_VOLUME_OPTION_SET_FAILED, errors); } }
Source:
static URL getLookupsUpdateURL(HostAndPort druidNode) throws MalformedURLException { return new URL( "http", druidNode.getHostText(), druidNode.getPortOrDefault(-1), ListenerResource.BASE_PATH + "/" + LOOKUP_LISTEN_ANNOUNCE_KEY + "/" + "updates" ); }

Target:
static URL getLookupsUpdateURL(HostAndPort druidNode) throws MalformedURLException { return new URL( "http", druidNode.getHostText(), druidNode.getPortOrDefault(-1), LOOKUP_UPDATE_REQUEST_PATH ); }
Source:
void process() { sendCommandsToDelegate(); getDelegate().prepare(); }

Target:
void process() { sendCommandsToDelegate(); getDelegate().process(); }
Source:
private static InstallableComponent[] createComponents(@NotNull FirstRunWizardMode reason, boolean createAvd) { AndroidSdk androidSdk = new AndroidSdk(); ArrayList<InstallableComponent> components = new ArrayList<InstallableComponent>(); components.add(androidSdk); if (Haxm.canRun() && reason == FirstRunWizardMode.NEW_INSTALL) { components.add(new Haxm(KEY_CUSTOM_INSTALL)); } if (createAvd) { components.add(new AndroidVirtualDevice()); } return components.toArray(new InstallableComponent[components.size()]); }

Target:
private static InstallableComponent[] createComponents(@NotNull FirstRunWizardMode reason, boolean createAvd) { AndroidSdk androidSdk = new AndroidSdk(); List<InstallableComponent> components = Lists.newArrayList(); components.add(androidSdk); if (Haxm.canRun() && reason == FirstRunWizardMode.NEW_INSTALL) { components.add(new Haxm(KEY_CUSTOM_INSTALL)); } if (createAvd) { components.add(new AndroidVirtualDevice()); } return components.toArray(new InstallableComponent[components.size()]); }
Source:
private Map<String, Integer> getLoadStatus() { Map<String, Integer> status = null; try { StatusResponseHolder response = makeRequest(HttpMethod.GET, getCoordinatorURL() + "loadstatus"); status = jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, Integer>>() { } ); } catch (Exception e) { Throwables.propagate(e); } return status; }

Target:
private Map<String, Integer> getLoadStatus() { Map<String, Integer> status = null; try { StatusResponseHolder response = makeRequest(HttpMethod.GET, getLoadStatusURL()); status = jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, Integer>>() { } ); } catch (Exception e) { Throwables.propagate(e); } return status; }
Source:
public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } }

Target:
public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } }
Source:
public Collection<Specification<Boolean>> collectSpecifications(URL[] classpath, List<TestResult> testClasses, Collection<TestCase> failures) { int nbFailingTestExecution = 0; int nbPassedTestExecution = 0; SpecificationTestCasesListener<Boolean> listener = new SpecificationTestCasesListener<>(runtimeValues); AngelicExecution.enable(); CompoundResult firstResult = TestSuiteExecution.runTestCases(failures, classLoader, listener, config); nbFailingTestExecution += listener.numberOfFailedTests(); nbPassedTestExecution += listener.numberOfTests() - listener.numberOfFailedTests(); AngelicExecution.flip(); CompoundResult secondResult = TestSuiteExecution.runTestCases(failures, classLoader, listener, config); nbFailingTestExecution += listener.numberOfFailedTests(); nbPassedTestExecution += listener.numberOfTests() - listener.numberOfFailedTests(); AngelicExecution.disable(); if (determineViability(firstResult, secondResult)) { TestSuiteExecution.runTestResult(testClasses, classLoader, listener, config); } return listener.specifications(); }

Target:
public Collection<Specification<Boolean>> collectSpecifications(URL[] classpath, List<TestResult> testClasses, Collection<TestCase> failures) { SpecificationTestCasesListener<Boolean> listener = new SpecificationTestCasesListener<>(runtimeValues); AngelicExecution.enable(); CompoundResult firstResult = TestSuiteExecution.runTestCases(failures, classLoader, listener, config); AngelicExecution.flip(); CompoundResult secondResult = TestSuiteExecution.runTestCases(failures, classLoader, listener, config); AngelicExecution.disable(); if (determineViability(firstResult, secondResult)) { TestSuiteExecution.runTestResult(testClasses, classLoader, listener, config); } return listener.specifications(); }
Source:
public void checkAccess(final Path path, AccessMode... modes) { checkNotNull("path", path); checkNotNull("modes", modes); checkFileNotExistThenThrow(path, false); if (path.toFile() != null) { for (final AccessMode mode : modes) { checkNotNull("mode", mode); switch (mode) { case READ: if (!path.toFile().canRead()) { throw new AccessDeniedException(path.toString()); } break; case EXECUTE: if (!path.toFile().canExecute()) { throw new AccessDeniedException(path.toString()); } break; case WRITE: if (!path.toFile().canWrite()) { throw new AccessDeniedException(path.toString()); } break; } } } }

Target:
public void checkAccess(final Path path, AccessMode... modes) throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException { checkNotNull("path", path); checkNotNull("modes", modes); checkFileNotExistThenThrow(path, false); if (path.toFile() != null) { for (final AccessMode mode : modes) { checkNotNull("mode", mode); switch (mode) { case READ: if (!path.toFile().canRead()) { throw new AccessDeniedException(path.toString()); } break; case EXECUTE: if (!path.toFile().canExecute()) { throw new AccessDeniedException(path.toString()); } break; case WRITE: if (!path.toFile().canWrite()) { throw new AccessDeniedException(path.toString()); } break; } } } }
Source:
public Object[][] isWithinHammingDistanceException() { return new Object[][] { {"ATAC", "GCT", 3, true}, {"ATAC", "AT", 2, false}, {"ATAC", "T", 1, false}, {"", "GCAT", 0, false} }; }

Target:
public Object[][] isWithinHammingDistanceException() { return new Object[][] { {"ATAC", "GCT" , 3}, {"ATAC", "AT" , 2}, {"ATAC", "T" , 1}, {"" , "GCAT", 0} }; }
Source:
private void validateAndClose() throws Exception { try { info("Validating static and Helix cluster maps"); verifyEquivalencyWithStaticClusterMap(staticClusterMap.hardwareLayout, staticClusterMap.partitionLayout); if (validatingHelixClusterManager != null) { ensureOrThrow(validatingHelixClusterManager.getErrorCount() == 0, "Helix cluster manager should not have encountered any errors"); } } finally { if (validatingHelixClusterManager != null) { validatingHelixClusterManager.close(); } for (HelixAdmin admin : adminForDc.values()) { admin.close(); } } }

Target:
private void validateAndClose() { try { info("Validating static and Helix cluster maps"); verifyEquivalencyWithStaticClusterMap(staticClusterMap.hardwareLayout, staticClusterMap.partitionLayout); if (validatingHelixClusterManager != null) { ensureOrThrow(validatingHelixClusterManager.getErrorCount() == 0, "Helix cluster manager should not have encountered any errors"); } } finally { if (validatingHelixClusterManager != null) { validatingHelixClusterManager.close(); } for (HelixAdmin admin : adminForDc.values()) { admin.close(); } } }
Source:
public OutputWriter createOutputWriter() { List<String> headers = new ArrayList<String>() ; for (int i = 0; i < columns.length; i++) { String columnName = columns[i].getName(); headers.add(columnName); if(columnToBeSortedOn != null) { if(columnName.equals(columnToBeSortedOn.getName())){ indexOfColumnToBeSortedOn = i ; } } } if(columnToBeSortedOn != null) { if(indexOfColumnToBeSortedOn == -1) { this.isColumnToBeSortedOnPresentInInput = false ; indexOfColumnToBeSortedOn = columns.length ; headers.add(columnToBeSortedOn.getName()) ; InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1] ; for(int i = 0; i < columns.length; i++){ newColumns[i] = columns[i] ; } newColumns[columns.length] = columnToBeSortedOn ; columns = newColumns ; } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, quoteChar, escapeChar, includeHeader, columns); }

Target:
public OutputWriter createOutputWriter() { InputColumn<?>[] inputColumns = columns ; List<String> headers = new ArrayList<String>() ; for (int i = 0; i < columns.length; i++) { String columnName = columns[i].getName(); headers.add(columnName); if(columnToBeSortedOn != null) { if(columnName.equals(columnToBeSortedOn.getName())){ indexOfColumnToBeSortedOn = i ; } } } if(columnToBeSortedOn != null) { if(indexOfColumnToBeSortedOn == -1) { this.isColumnToBeSortedOnPresentInInput = false ; indexOfColumnToBeSortedOn = columns.length ; headers.add(columnToBeSortedOn.getName()) ; InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1] ; for(int i = 0; i < columns.length; i++){ newColumns[i] = columns[i] ; } newColumns[columns.length] = columnToBeSortedOn ; inputColumns = newColumns ; } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, quoteChar, escapeChar, includeHeader, inputColumns); }
Source:
public String getDescription() { return "A function to add a layer based on a table name\n" + "The second argument is optional. It permits to set a style to the layer."; }

Target:
public String getDescription() { return I18N.tr("A function to add a layer based on a table name\n" + "The second argument is optional. It permits to set a style to the layer."); }