auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public URL findResource(String name) { URL url = super.findResource(name); final Channel channel = channel(); if (url != null || channel == null || !channel.isRemoteClassLoadingAllowed()) { return url; } boolean interrupted = false; try { for (int tries = 0; tries < MAX_RETRIES; tries++) { try { if (resourceMap.containsKey(name)) { URLish f = resourceMap.get(name); if (f == null) { return null; } URL u = f.toURL(); if (u != null) { return u; } } invokeResourceLoadTestingHookIfNeeded(); long startTime = System.nanoTime(); ResourceFile r = proxy.getResource2(name); ResourceImageRef image = null; if (r != null) { image = r.image; } channel.resourceLoadingTime.addAndGet(System.nanoTime() - startTime); channel.resourceLoadingCount.incrementAndGet(); if (image == null) { resourceMap.put(name, null); return null; } URLish res = image.resolveURL(channel, name).get(); resourceMap.put(name, res); return res.toURL(); } catch (IOException | InterruptedException | ExecutionException e) { throw new Error("Unable to load resource " + name, e); } catch (RemotingSystemException x) { if (shouldRetry(x)) { interrupted = true; try { Thread.sleep(RETRY_SLEEP_DURATION_MILLISECONDS); } catch (InterruptedException e) { } LOGGER.finer("Handling interrupt while finding resource. Current retry count = " + tries + ", maximum = " + MAX_RETRIES); continue; } throw x; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } throw new RuntimeException("Could not load resource " + name + " after " + MAX_RETRIES + " tries."); }

Target:
public URL findResource(String name) { URL url = super.findResource(name); final Channel channel = channel(); if (url != null || channel == null || !channel.isRemoteClassLoadingAllowed()) { return url; } int tries = 0; while (true) { try { if (resourceMap.containsKey(name)) { URLish f = resourceMap.get(name); if (f == null) { return null; } URL u = f.toURL(); if (u != null) { return u; } } invokeResourceLoadTestingHookIfNeeded(); long startTime = System.nanoTime(); ResourceFile r = proxy.getResource2(name); ResourceImageRef image = null; if (r != null) { image = r.image; } channel.resourceLoadingTime.addAndGet(System.nanoTime() - startTime); channel.resourceLoadingCount.incrementAndGet(); if (image == null) { resourceMap.put(name, null); return null; } URLish res = image.resolveURL(channel, name).get(); resourceMap.put(name, res); return res.toURL(); } catch (IOException | ExecutionException e) { throw new Error("Unable to load resource " + name, e); } catch (InterruptedException | RemotingSystemException x) { tries++; if (shouldRetry(x, tries)) { sleepForRetry(); LOGGER.finer("Handling interrupt while finding resource. Current retry count = " + tries + ", maximum = " + MAX_RETRIES); continue; } throw determineRemotingSystemException(x); } } }
Source:
private boolean matchSourceType(Type sourceType, Type candidateSourceType, Map<TypeVariable, TypeMirror> genericTypesMap) { if ( !isJavaLangObject( candidateSourceType.getTypeMirror() ) ) { TypeMatcher parameterMatcher = new TypeMatcher( Assignability.VISITED_ASSIGNABLE_FROM, genericTypesMap ); if ( !parameterMatcher.visit( candidateSourceType.getTypeMirror(), sourceType.getTypeMirror() ) ) { if ( sourceType.isPrimitive() ) { TypeMirror boxedType = typeUtils.boxedClass( (PrimitiveType) sourceType.getTypeMirror() ).asType(); return parameterMatcher.visit( candidateSourceType.getTypeMirror(), boxedType ); } else { return false; } } } return true; }

Target:
private boolean matchSourceType(Type sourceType, Type candidateSourceType, Map<TypeVariable, TypeMirror> genericTypesMap) { if ( !isJavaLangObject( candidateSourceType.getTypeMirror() ) ) { TypeMatcher parameterMatcher = new TypeMatcher( Assignability.VISITED_ASSIGNABLE_FROM, genericTypesMap ); if ( !parameterMatcher.visit( candidateSourceType.getTypeMirror(), sourceType.getTypeMirror() ) ) { if ( sourceType.isPrimitive() ) { TypeMirror boxedType = typeUtils.boxedClass( (PrimitiveType) sourceType.getTypeMirror() ).asType(); if ( !parameterMatcher.visit( candidateSourceType.getTypeMirror(), boxedType ) ) { return false; } } else { return false; } } } return true; }
Source:
protected void updateAndPublishWhitelist( final MavenRepository mavenRepository, final boolean notify ) throws IOException { getLogger().debug( "Updating WL of {}.", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); try { final PrefixSource prefixSource; if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenGroupRepository.class ) ) { prefixSource = updateGroupWhitelist( mavenRepository.adaptToFacet( MavenGroupRepository.class ) ); } else if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenProxyRepository.class ) ) { prefixSource = updateProxyWhitelist( mavenRepository.adaptToFacet( MavenProxyRepository.class ), null ); } else if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenHostedRepository.class ) ) { prefixSource = updateHostedWhitelist( mavenRepository.adaptToFacet( MavenHostedRepository.class ) ); } else { getLogger().info( "Repository not supported by white-list feature, not updating it.", RepositoryStringUtils.getFullHumanizedNameString( mavenRepository ) ); return; } if ( prefixSource != null ) { if ( notify ) { getLogger().info( "Updated and published white-list of {}.", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } publish( mavenRepository, prefixSource ); } else { if ( notify ) { getLogger().info( "Unpublished white-list of (and is marked for noscrape).", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } unpublish( mavenRepository ); } } catch ( IllegalStateException e ) { getLogger().info( e.getMessage() ); return; } }

Target:
protected void updateAndPublishWhitelist( final MavenRepository mavenRepository, final boolean notify ) throws IOException { getLogger().debug( "Updating white-list of {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); try { final PrefixSource prefixSource; if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenGroupRepository.class ) ) { prefixSource = updateGroupWhitelist( mavenRepository.adaptToFacet( MavenGroupRepository.class ) ); } else if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenProxyRepository.class ) ) { prefixSource = updateProxyWhitelist( mavenRepository.adaptToFacet( MavenProxyRepository.class ), null ); } else if ( mavenRepository.getRepositoryKind().isFacetAvailable( MavenHostedRepository.class ) ) { prefixSource = updateHostedWhitelist( mavenRepository.adaptToFacet( MavenHostedRepository.class ) ); } else { getLogger().info( "Repository unsupported by white-list feature", RepositoryStringUtils.getFullHumanizedNameString( mavenRepository ) ); return; } if ( prefixSource != null ) { if ( notify ) { getLogger().info( "Updated and published white-list of {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } publish( mavenRepository, prefixSource ); } else { if ( notify ) { getLogger().info( "Unpublished white-list of (and is marked for noscrape)", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } unpublish( mavenRepository ); } } catch ( IllegalStateException e ) { getLogger().info( e.getMessage() ); return; } }
Source:
public void checkTimeoutNotExhausted() { if (((System.nanoTime() - startTimeInNanos) / 1_000_000) >= timeoutInMilliseconds) { throw new PrestoException(OPTIMIZER_TIMEOUT, format("The optimizer exhausted the time limit of %d ms", timeoutInMilliseconds)); } }

Target:
public void checkTimeoutNotExhausted() { if ((NANOSECONDS.toMillis(System.nanoTime() - startTimeInNanos)) >= timeoutInMilliseconds) { throw new PrestoException(OPTIMIZER_TIMEOUT, format("The optimizer exhausted the time limit of %d ms", timeoutInMilliseconds)); } }
Source:
public Observable<ByteBuf> call(Observable<ByteBuf> upstream) { return upstream .collect( new Func0<CountingCollector>() { @Override public CountingCollector call() { return new CountingCollector(); } }, new Action2<CountingCollector, ByteBuf>() { @Override public void call(CountingCollector collector, ByteBuf buf) { collector.count += buf.readableBytes(); if (collector.count <= maxBytes) { int i = buf.readableBytes(); collector.byteBuf.addComponent(buf); collector.byteBuf.writerIndex(collector.byteBuf.writerIndex() + i); } else { collector.byteBuf.release(); buf.release(); throw new TooMuchDataException(); } } } ) .map(new Func1<CountingCollector, ByteBuf>() { @Override public ByteBuf call(CountingCollector collector) { return collector.byteBuf; } }); }

Target:
public Observable<ByteBuf> call(Observable<ByteBuf> upstream) { return upstream .collect( new Func0<CompositeByteBuf>() { @Override public CompositeByteBuf call() { return Unpooled.compositeBuffer(); } }, new Action2<CompositeByteBuf, ByteBuf>() { @Override public void call(CompositeByteBuf collector, ByteBuf buf) { long newLength = collector.readableBytes() + buf.readableBytes(); if (newLength <= maxBytes) { collector.addComponent(true, buf); } else { collector.release(); buf.release(); throw new TooMuchDataException("More than " + maxBytes + "B received"); } } } ) .cast(ByteBuf.class); }
Source:
public SchemaBuilder addSingleValueDimension(String dimensionName, DataType dataType, int maxLength, Object defaultNullValue) { _schema.addField(new DimensionFieldSpec(dimensionName, dataType, true, maxLength, defaultNullValue)); return this; }

Target:
public SchemaBuilder addSingleValueDimension(String dimensionName, DataType dataType, int maxLength, Object defaultNullValue) { Preconditions.checkArgument(dataType == STRING, "The maxLength field only applies to STRING field right now"); _schema.addField(new DimensionFieldSpec(dimensionName, dataType, true, maxLength, defaultNullValue)); return this; }
Source:
public Call<MwQueryResponse<QueryResult>> request(@NonNull WikiSite wiki, @NonNull PageTitle title, @NonNull Callback cb) { List<PageTitle> titles = new ArrayList<>(); titles.add(title); return request(wiki, cachedService.service(wiki), titles, cb); }

Target:
public Call<MwQueryResponse<QueryResult>> request(@NonNull WikiSite wiki, @NonNull PageTitle title, @NonNull Callback cb) { return request(wiki, cachedService.service(wiki), title, cb); }
Source:
public static String get() { RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(1000).build(); HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig) .build(); HttpGet request = new HttpGet(URL); try { HttpResponse response = client.execute(request); JsonNode object = MAPPER.readTree(response.getEntity().getContent()); return object.get(INSTANCE_ID).asText() + "_" + object.get(REGION).asText() + "_" + object.get(ACCOUNT_ID).asText(); } catch (Exception e) { log.trace("Exception trying to execute {}, Exception: ", request, e); } return null; }

Target:
public static String get() { return get(1000); }
Source:
public RemoteFormDefinition(String formName, String formId, String versionString, String downloadUrl, String manifestUrl) { this.formName = formName == null ? null : formName.replaceAll(BasicConsts.INVALID_CHARS, BasicConsts.EMPTY_STRING); this.formId = formId; this.versionString = versionString; this.downloadUrl = downloadUrl; this.manifestUrl = manifestUrl; }

Target:
public RemoteFormDefinition(String formName, String formId, String versionString, String downloadUrl, String manifestUrl) { this.formName = formName; this.formId = formId; this.versionString = versionString; this.downloadUrl = downloadUrl; this.manifestUrl = manifestUrl; }
Source:
public void testRestAccessLog() throws Exception { client.newRequest(String.format("http://localhost:%d/rest/default/key", restServer.getPort())) .content(new StringContentProvider("value")) .header("Content-type", "text/plain; charset=utf-8") .method(HttpMethod.PUT) .send(); String logline = logAppender.getLog(0).toString(); assertTrue(logline, logline.matches("^127\\.0\\.0\\.1 - \\[\\d+/\\w+/\\d+:\\d+:\\d+:\\d+ [+-]\\d+\\] \"PUT /rest/default/key HTTP/1\\.1\" 404 5 65 \\d+ ms$")); logAppender.uninstall(); }

Target:
public void testRestAccessLog() throws Exception { client.newRequest(String.format("http://localhost:%d/rest/default/key", restServer.getPort())) .content(new StringContentProvider("value")) .header("Content-type", "text/plain; charset=utf-8") .method(HttpMethod.PUT) .send(); restServer.stop(); String logline = logAppender.getLog(0).toString(); assertTrue(logline, logline.matches("^127\\.0\\.0\\.1 - \\[\\d+/\\w+/\\d+:\\d+:\\d+:\\d+ [+-]?\\w+\\] \"PUT /rest/default/key HTTP/1\\.1\" 404 \\d+ \\d+ \\d+$")); }
Source:
public void testCreate() { PluginDescriptor pluginDescriptor = mock(DefaultPluginDescriptor.class); when(pluginDescriptor.getPluginClass()).thenReturn(TestPlugin.class.getName()); PluginWrapper pluginWrapper = mock(PluginWrapper.class); when(pluginWrapper.getDescriptor()).thenReturn(pluginDescriptor); when(pluginWrapper.getPluginClassLoader()).thenReturn(getClass().getClassLoader()); DefaultPluginFactory instance = new DefaultPluginFactory(); Plugin result = instance.create(pluginWrapper); assertNotNull(result); assertThat(result, instanceOf(TestPlugin.class)); }

Target:
public void testCreate() { PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class); when(pluginDescriptor.getPluginClass()).thenReturn(TestPlugin.class.getName()); PluginWrapper pluginWrapper = mock(PluginWrapper.class); when(pluginWrapper.getDescriptor()).thenReturn(pluginDescriptor); when(pluginWrapper.getPluginClassLoader()).thenReturn(getClass().getClassLoader()); DefaultPluginFactory instance = new DefaultPluginFactory(); Plugin result = instance.create(pluginWrapper); assertNotNull(result); assertThat(result, instanceOf(TestPlugin.class)); }
Source:
public boolean isStrict() { return value == STRICT.value ? true : false; }

Target:
public boolean isStrict() { return value == STRICT.value; }
Source:
public void loadWebPage(String url, Context context) throws Exception { url = "<LINK_0>"; WebView webview = new WebView(context); webview.setBackgroundColor(0x99FFFFFF); final Dialog d = new Dialog(context) { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) this.dismiss(); return true; } }; webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { if (url.contains("return")) { d.dismiss(); mixView.repaint(); } else { super.onPageFinished(view, url); } } }); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.getWindow().setGravity(Gravity.BOTTOM); d.addContentView(webview, new FrameLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM)); if(!processUrl(url, mixView)){ d.show(); webview.loadUrl(url); } }

Target:
public void loadWebPage(String url, Context context) throws Exception { WebView webview = new WebView(context); webview.setBackgroundColor(0x99FFFFFF); final Dialog d = new Dialog(context) { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) this.dismiss(); return true; } }; webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { if (url.endsWith("return")) { d.dismiss(); mixView.repaint(); } else { super.onPageFinished(view, url); } } }); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.getWindow().setGravity(Gravity.BOTTOM); d.addContentView(webview, new FrameLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM)); if(!processUrl(url, mixView)){ d.show(); webview.loadUrl(url); } }
Source:
public DataDrivenRuntimeFsm getRuntimeForFsm(DataDrivenFsm fsm) { return fFsmRuntime.computeIfAbsent(fsm, k -> new DataDrivenRuntimeFsm()); }

Target:
public DataDrivenRuntimeFsm getRuntimeForFsm(DataDrivenFsm fsm) { return fFsmRuntime.computeIfAbsent(fsm, dataDrivenRuntimeFsm -> new DataDrivenRuntimeFsm()); }
Source:
public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); if (key.equals(getString(R.string.preference_key_upload_switch))) { boolean isUploadEnabled = (boolean) newValue; if (isUploadEnabled) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { boolean b = checkReadPermissions(); Log.d("UploadPer","value = " + b); return b; } } toggleUploadSettings(isUploadEnabled); preference.setTitle(getAutoUploadTitle(isUploadEnabled)); } else if (key.equals(getString(R.string.preference_key_upload_hda))) { String session = String.valueOf(newValue); setUpServer(session); if(!session.equals(getHdaPreference().getValue())){ getSharePreference().setSummary(null); getSharePreference().setValue(null); getHdaPreference().setSummary(getHdaPreference().getEntries()[getHdaPreference().findIndexOfValue(session)]); } } else if (key.equals(getString(R.string.preference_key_upload_share))) { getSharePreference().setSummary(String.valueOf(newValue)); getPathPreference().setEnabled(true); getAllowOnDataPreference().setEnabled(true); }else if (key.equals(getString(R.string.preference_key_upload_path))){ String path = String.valueOf(newValue); if(path.isEmpty()){ getPathPreference().setSummary("Select Path"); }else { setUploadPathSummary(String.valueOf(newValue)); } } return true; }

Target:
public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); if (key.equals(getString(R.string.preference_key_upload_switch))) { boolean isUploadEnabled = (boolean) newValue; if (isUploadEnabled) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return checkReadPermissions() && areSettingsValid(); } } preference.setTitle(getAutoUploadTitle(isUploadEnabled)); } else if (key.equals(getString(R.string.preference_key_upload_server))) { String session = String.valueOf(newValue); setUpServer(getServer(session)); if (!session.equals(getHdaPreference().getValue())) { getSharePreference().setSummary(getString(R.string.preference_summary_share)); getAutoUploadSwitchPreference().setChecked(false); getAutoUploadSwitchPreference().setTitle(getAutoUploadTitle(isUploadEnabled())); getSharePreference().setValue(null); getHdaPreference().setSummary(getHdaPreference().getEntries()[getHdaPreference().findIndexOfValue(session)]); getSharePreference().setEnabled(false); } } else if (key.equals(getString(R.string.preference_key_upload_share))) { getSharePreference().setSummary(String.valueOf(newValue)); } else if (key.equals(getString(R.string.preference_key_upload_location))) { String location = String.valueOf(newValue); if (location.isEmpty()) { getLocationPreference().setSummary(getString(R.string.preference_summary_location)); } else { setUploadLocationSummary(String.valueOf(newValue)); } } return true; }
Source:
public void connectionChanged(IConnection connection, String property, Object oldValue, Object newValue) { if (!(connection instanceof IOpenShiftConnection)) { return; } if (ConnectionProperties.PROPERTY_PROJECTS.equals(property) && (oldValue instanceof List) && (newValue instanceof List)) { IOpenShiftConnection openshiftConnection = (IOpenShiftConnection) connection; Set<IProjectAdapter> adapters = getCacheFor(openshiftConnection); if(adapters == null) { adapters = createEntry(openshiftConnection); } addAndRemoveAdaptersFor((List<IProject>) newValue, (List<IProject>) oldValue, openshiftConnection, adapters); } }

Target:
public void connectionChanged(IConnection connection, String property, Object oldValue, Object newValue) { if (!(connection instanceof IOpenShiftConnection)) { return; } if (ConnectionProperties.PROPERTY_PROJECTS.equals(property) && (oldValue instanceof List) && (newValue instanceof List)) { IOpenShiftConnection openshiftConnection = (IOpenShiftConnection) connection; Set<IProjectAdapter> adapters; synchronized (cache) { adapters = getCacheFor(openshiftConnection); if(adapters == null) { adapters = createEntry(openshiftConnection); } } addAndRemoveAdaptersFor((List<IProject>) newValue, (List<IProject>) oldValue, openshiftConnection, adapters); } }
Source:
public CallLogWrapper readCallLog() { return new Gson().fromJson((String)execute("readCallLog").getValue(), CallLogWrapper.class); }

Target:
public List<CallLogEntry> readCallLog() { return new Gson().fromJson((String)execute("readCallLog").getValue(), new TypeToken<List<CallLogEntry>>(){}.getType()); }
Source:
public JWK rsa(Key key, KeyUse keyUse) { JWK k = rsa(key); String keyUseString = DEFAULT_PUBLIC_KEY_USE; if (KeyUse.ENC == keyUse) keyUseString = "enc"; k.setPublicKeyUse(keyUseString); return k; }

Target:
public JWK rsa(Key key, KeyUse keyUse) { JWK k = rsa(key); String keyUseString = keyUse == null ? DEFAULT_PUBLIC_KEY_USE : keyUse.getSpecName(); if (KeyUse.ENC == keyUse) keyUseString = "enc"; k.setPublicKeyUse(keyUseString); return k; }
Source:
protected Map<String, ClientDMNType> getDMNTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> toReturn = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, false, null, type); } toReturn.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> indexed = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); toReturn.put(jsitItemDefinition.getName(), getDMNType(indexed, jsitItemDefinition, nameSpace, toReturn)); } toReturn.values().forEach((v) -> { if (indexed.containsKey(v.getName())) { populateItemFields(indexed, Js.uncheckedCast(indexed.get(v.getName())), nameSpace, toReturn); } }); return toReturn; }

Target:
protected Map<String, ClientDMNType> getDMNTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> toReturn = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, false, null, type); } toReturn.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> indexed = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); toReturn.put(jsitItemDefinition.getName(), getDMNType(indexed, jsitItemDefinition, nameSpace, toReturn)); } final Collection<ClientDMNType> values = new ArrayList<>(toReturn.values()); values.forEach((v) -> { if (indexed.containsKey(v.getName())) { populateItemFields(indexed, Js.uncheckedCast(indexed.get(v.getName())), nameSpace, toReturn); } }); return toReturn; }
Source:
void setUp() { fixture = new AggregateTestFixture<>(AggregateA.class).registerSubtype(AggregateB.class) .registerSubtype(AggregateC.class); }

Target:
void setUp() { fixture = new AggregateTestFixture<>(AggregateA.class).withSubtypes(AggregateB.class, AggregateC.class); }
Source:
public AuditLogType getAuditLogTypeValue() { if (getSucceeded()) { return AuditLogType.SYNC_STORAGE_DEVICES_IN_HOST; } else { return AuditLogType.SYNC_STORAGE_DEVICES_IN_HOST_FAILED; } }

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.SYNC_STORAGE_DEVICES_IN_HOST : AuditLogType.SYNC_STORAGE_DEVICES_IN_HOST_FAILED; }
Source:
public List<AuthzDecisionStatement> createAuthorizationDecisionStatements(final CallbackProperties properties, final Subject subject) { final List<AuthzDecisionStatement> authDecisionStatements = new ArrayList<>(); final Boolean hasAuthzStmt = properties.getAuthorizationStatementExists(); if (hasAuthzStmt) { final String resource = properties.getAuthnicationResource(); String decision = properties.getAuthorizationDecision(); if (decision == null) { decision = AUTHZ_DECISION_PERMIT; } if (!isValidAuthenicationDescision(decision)) { decision = AUTHZ_DECISION_PERMIT; } final Evidence evidence = createEvidence(properties, subject); authDecisionStatements.add(OpenSAML2ComponentBuilder.getInstance().createAuthzDecisionStatement(resource, decision, AUTHZ_DECISION_ACTION_EXECUTE, evidence)); } return authDecisionStatements; }

Target:
public List<AuthzDecisionStatement> createAuthorizationDecisionStatements(final CallbackProperties properties, final Subject subject) { final List<AuthzDecisionStatement> authDecisionStatements = new ArrayList<>(); final Boolean hasAuthzStmt = properties.getAuthorizationStatementExists(); if (hasAuthzStmt) { final String resource = properties.getAuthorizationResource(); String decision = properties.getAuthorizationDecision(); if (decision == null) { decision = AUTHZ_DECISION_PERMIT; } if (!isValidAuthorizationDecision(decision)) { decision = AUTHZ_DECISION_PERMIT; } final Evidence evidence = createEvidence(properties, subject); authDecisionStatements.add(OpenSAML2ComponentBuilder.getInstance().createAuthzDecisionStatement(resource, decision, AUTHZ_DECISION_ACTION_EXECUTE, evidence)); } return authDecisionStatements; }
Source:
public T parse(String value) { if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) return null; if (!Strings.isQuoted(value)) throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); String json = Strings.unquote(value); try { return (T) objectMapper.readValue(json, toJacksonJavaType()); } catch (IOException e) { throw new IllegalArgumentException(e.getMessage(), e); } }

Target:
public T parse(String value) { if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) { return null; } if (!Strings.isQuoted(value)) { throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); } String json = Strings.unquote(value); try { return (T) objectMapper.readValue(json, toJacksonJavaType()); } catch (IOException e) { throw new IllegalArgumentException(e.getMessage(), e); } }
Source:
@Override public void setMasterKeyName(String masterKeyName) { if (!started()) { masterKey = new T2<>(masterKeyName, null); return; } loadMasterKey(masterKeyName); }

Target:
@Override public void setMasterKeyName(String masterKeyName) { this.masterKeyName = masterKeyName; if (started()) loadMasterKey(masterKeyName); }
Source:
private Menu createSortMenu() { Menu submenu = new Menu(shell, SWT.DROP_DOWN); MenuItem subitem; for(int i = 0; i < columnNames.length; i++) { subitem = new MenuItem (submenu, SWT.NONE); subitem.setText(columnNames [i]); final int column = i; subitem.addSelectionListener(widgetSelectedAdapter( e -> { sort(column); })); } return submenu; }

Target:
private Menu createSortMenu() { Menu submenu = new Menu(shell, SWT.DROP_DOWN); MenuItem subitem; for(int i = 0; i < columnNames.length; i++) { subitem = new MenuItem (submenu, SWT.NONE); subitem.setText(columnNames [i]); final int column = i; subitem.addSelectionListener(widgetSelectedAdapter( e -> sort(column))); } return submenu; }
Source:
public void tearDown() { fLogger.removeAllAppenders(); fBot.closeAllEditors(); }

Target:
public void tearDown() { fBot.closeAllEditors(); }
Source:
protected void firstListenerAdded() { if (!isDisposed()) { if (listener == null) { listener = property .adaptListener(new ISimplePropertyListener<MapDiff<K, V>>() { @Override public void handleEvent( final SimplePropertyEvent<MapDiff<K, V>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedMap = new HashMap<>(getMap()); stale = false; if (listener != null) listener.addTo(source); } }); } }

Target:
protected void firstListenerAdded() { if (!isDisposed() && listener == null) { listener = property.adaptListener(new ISimplePropertyListener<MapDiff<K, V>>() { @Override public void handleEvent(final SimplePropertyEvent<MapDiff<K, V>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedMap = new HashMap<>(getMap()); stale = false; if (listener != null) listener.addTo(source); } }); }
Source:
private boolean moveChunkInside(Chunk chunkToMove, long boundary) { return chunkToMove.block >= boundary && fileStore.predictAllocation(chunkToMove.len) + chunkToMove.len < chunkToMove.block && moveChunk(chunkToMove, 0, 0); }

Target:
private boolean moveChunkInside(Chunk chunkToMove, long boundary) { boolean res = chunkToMove.block >= boundary && fileStore.predictAllocation(chunkToMove.len, boundary, -1) < boundary && moveChunk(chunkToMove, boundary, -1); assert !res || chunkToMove.block + chunkToMove.len <= boundary; return res; }
Source:
private static Class<?> loadClassWithNodeClassloader(final TypeNode n, final String clazzName) { if (n.getType() != null) { try { ClassLoader classLoader = n.getType().getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } return classLoader.loadClass(clazzName); } catch (final ClassNotFoundException ignored) { } catch (final LinkageError expected) { } } return null; }

Target:
private static Class<?> loadClassWithNodeClassloader(final TypeNode n, final String clazzName) { if (n.getType() != null) { try { ClassLoader classLoader = n.getType().getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } return ClassUtils.getClass(classLoader, clazzName); } catch (final ClassNotFoundException ignored) { } catch (final LinkageError expected) { } } return null; }
Source:
public BigDecimal getExchangeRateForSell(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency) || !getCryptoCurrencies().contains(cryptoCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); setTicker(cryptoCurrency, fiatCurrency); return rateInfo.getLowestAsk(); } catch (Exception e) { log.error("", e); } return null; }

Target:
public BigDecimal getExchangeRateForSell(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency) || !getCryptoCurrencies().contains(cryptoCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); setTicker(cryptoCurrency, fiatCurrency); return bitKubRateInfo.getLowestAsk(); } catch (Exception e) { log.error("", e); } return null; }
Source:
private Set<String> validateTopics(final Set<String> topicsToValidate, final Map<String, InternalTopicConfig> topicsMap) { if (!topicsMap.keySet().containsAll(topicsToValidate)) { throw new IllegalStateException("The topics map " + topicsMap + " does not contain all the topics " + topicsToValidate + " trying to validate."); } final Map<String, Integer> existedTopicPartition = getNumPartitions(topicsToValidate); final Set<String> topicsToCreate = new HashSet<>(); for (final String topicName : topicsToValidate) { final Optional<Integer> numberOfPartitions = topicsMap.get(topicName).numberOfPartitions(); if (existedTopicPartition.containsKey(topicName) && numberOfPartitions.isPresent()) { if (!existedTopicPartition.get(topicName).equals(numberOfPartitions.get())) { final String errorMsg = String.format("Existing internal topic %s has invalid partitions: " + "expected: %d; actual: %d. " + "Use 'kafka.tools.StreamsResetter' tool to clean up invalid topics before processing.", topicName, numberOfPartitions.get(), existedTopicPartition.get(topicName)); log.error(errorMsg); throw new StreamsException(errorMsg); } } else { topicsToCreate.add(topicName); } } return topicsToCreate; }

Target:
private Set<String> validateTopics(final Set<String> topicsToValidate, final Map<String, InternalTopicConfig> topicsMap) { if (!topicsMap.keySet().containsAll(topicsToValidate)) { throw new IllegalStateException("The topics map " + topicsMap.keySet() + " does not contain all the topics " + topicsToValidate + " trying to validate."); } final Map<String, Integer> existedTopicPartition = getNumPartitions(topicsToValidate); final Set<String> topicsToCreate = new HashSet<>(); for (final String topicName : topicsToValidate) { final Optional<Integer> numberOfPartitions = topicsMap.get(topicName).numberOfPartitions(); if (existedTopicPartition.containsKey(topicName) && numberOfPartitions.isPresent()) { if (!existedTopicPartition.get(topicName).equals(numberOfPartitions.get())) { final String errorMsg = String.format("Existing internal topic %s has invalid partitions: " + "expected: %d; actual: %d. " + "Use 'kafka.tools.StreamsResetter' tool to clean up invalid topics before processing.", topicName, numberOfPartitions.get(), existedTopicPartition.get(topicName)); log.error(errorMsg); throw new StreamsException(errorMsg); } } else { topicsToCreate.add(topicName); } } return topicsToCreate; }
Source:
public RdfRepository(UrisScheme uris, RdfClient rdfClient, long maxPostSize, UpdateMode updateMode) { this.uris = uris; this.rdfClient = rdfClient; updateLeftOffTimeBody = loadBody("updateLeftOffTime"); getValues = loadBody("GetValues"); getRefs = loadBody("GetRefs"); getRevisions = loadBody("GetRevisions"); verifyExtra = loadBody("verifyExtra"); verifyMissing = loadBody("verifyMissing"); getLexemes = loadBody("GetLexemes"); maxStatementsPerBatch = maxPostSize / 400; maxPostDataSize = (maxPostSize - 1024 * 1024) / 2; this.updateMode = updateMode; }

Target:
public RdfRepository(UrisScheme uris, RdfClient rdfClient, long maxPostSize, UpdateMode updateMode) { this.uris = uris; this.rdfClient = rdfClient; updateLeftOffTimeBody = loadBody("updateLeftOffTime"); getValues = loadBody("GetValues"); getRefs = loadBody("GetRefs"); getRevisions = loadBody("GetRevisions"); verifyExtra = loadBody("verifyExtra"); verifyMissing = loadBody("verifyMissing"); getLexemes = loadBody("GetLexemes"); maxStatementsPerBatch = maxPostSize / 400; maxPostDataSize = (maxPostSize - 1024 * 1024) / 2; this.updateMode = updateMode; updateQueryFactory = new UpdateQueryFactory(uris); }
Source:
public void loadUserWhenUserRequestIsNullThenThrowIllegalArgumentException() { DelegatingOAuth2UserService<OAuth2UserRequest, OAuth2User> delegatingUserService = new DelegatingOAuth2UserService<>( Arrays.asList(mock(DefaultOAuth2UserService.class), mock(DefaultOAuth2UserService.class))); delegatingUserService.loadUser(null); }

Target:
public void loadUserWhenUserRequestIsNullThenThrowIllegalArgumentException() { DelegatingOAuth2UserService<OAuth2UserRequest, OAuth2User> delegatingUserService = new DelegatingOAuth2UserService(Arrays.asList(mock(OAuth2UserService.class), mock(OAuth2UserService.class))); delegatingUserService.loadUser(null); }
Source:
public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { try { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); } catch (HazelcastSerializationException e) { send = send(target, new ErrorResponse(e, operation.getCallId(), operation.isUrgent())); } } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }

Target:
public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }
Source:
public ElasticsearchClient(Map<SchemaTableName, ElasticsearchTableDescription> descriptions, Duration requestTimeout) throws IOException { tableDescriptions = requireNonNull(descriptions, "Elasticsearch Table Description is null"); timeout = requireNonNull(requestTimeout, "Elasticsearch request timeout is null"); for (Map.Entry<SchemaTableName, ElasticsearchTableDescription> entry : tableDescriptions.entrySet()) { ElasticsearchTableDescription tableDescription = entry.getValue(); if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(tableDescription.getHostAddress()), tableDescription.getPort())); clients.put(tableDescription.getClusterName(), client); } } }

Target:
public ElasticsearchClient(Map<SchemaTableName, ElasticsearchTableDescription> descriptions, Duration requestTimeout) throws IOException { tableDescriptions = requireNonNull(descriptions, "description is null"); timeout = requireNonNull(requestTimeout, "requestTimeout is null"); for (Entry<SchemaTableName, ElasticsearchTableDescription> entry : tableDescriptions.entrySet()) { ElasticsearchTableDescription tableDescription = entry.getValue(); if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportAddress address = new TransportAddress(InetAddress.getByName(tableDescription.getHostAddress()), tableDescription.getPort()); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(address); clients.put(tableDescription.getClusterName(), client); } } }
Source:
public Group removeAccount(String hrefOrEmailOrUsername) { Assert.hasText(hrefOrEmailOrUsername, "hrefOrEmailOrUsername cannot be null or empty"); GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getAccountMemberships()) { if (aGroupMembership.getAccount().getHref().equalsIgnoreCase(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getEmail().equalsIgnoreCase(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getUsername().equalsIgnoreCase(hrefOrEmailOrUsername)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }

Target:
public Group removeAccount(String hrefOrEmailOrUsername) { Assert.hasText(hrefOrEmailOrUsername, "hrefOrEmailOrUsername cannot be null or empty"); GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getAccountMemberships()) { if (aGroupMembership.getAccount().getHref().equals(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getEmail().equals(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getUsername().equals(hrefOrEmailOrUsername)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }
Source:
protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, CreateDataDiskTemplateContext<TemplateApiResult> context) { if (s_logger.isDebugEnabled()) { s_logger.debug("MDOVA createDatadiskTemplateCallback Performing create datadisk template cross callback after completion"); } DataObject dataDiskTemplate = context.dataDiskTemplate; AsyncCallFuture<TemplateApiResult> future = context.getFuture(); CreateCmdResult result = callback.getResult(); TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate); try { if (result.isSuccess()) { dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer()); } else { dataDiskTemplate.processEvent(Event.OperationFailed); dataDiskTemplateResult.setResult(result.getResult()); } } catch (Exception e) { s_logger.debug("Failed to process create template callback", e); dataDiskTemplateResult.setResult(e.toString()); } future.complete(dataDiskTemplateResult); return null; }

Target:
protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, CreateDataDiskTemplateContext<TemplateApiResult> context) { DataObject dataDiskTemplate = context.dataDiskTemplate; AsyncCallFuture<TemplateApiResult> future = context.getFuture(); CreateCmdResult result = callback.getResult(); TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate); try { if (result.isSuccess()) { dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer()); } else { dataDiskTemplate.processEvent(Event.OperationFailed); dataDiskTemplateResult.setResult(result.getResult()); } } catch (CloudRuntimeException e) { s_logger.debug("Failed to process create template callback", e); dataDiskTemplateResult.setResult(e.toString()); } future.complete(dataDiskTemplateResult); return null; }
Source:
private void evalState() { String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("archive.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(false); return; } if (!(location.startsWith("content://") || (new File(location)).exists())) { txtInteractiveMessages.setText(Localization.get("archive.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallArchive.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("archive.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(true); } }

Target:
private void evalState() { String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("archive.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(false); return; } if (!location.startsWith("content://") && !(new File(location)).exists()) { txtInteractiveMessages.setText(Localization.get("archive.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallArchive.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("archive.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(true); } }
Source:
public boolean isEnabledFor(ISelection selection) { selectionChanged(null, selection); ICElement[] project = getSelectedCElements(); return project.length > 0; }

Target:
public boolean isEnabledFor(ISelection selection) { selectionChanged(null, selection); ICElement[] elements = getSelectedCElements(); return elements.length > 0; }
Source:
public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(CONFIG_FILE_NAME); checkState( configFileName != null, "Security configuration must contain the '%s' property", CONFIG_FILE_NAME); try { Path path = Paths.get(configFileName); if (!path.isAbsolute()) { path = path.toAbsolutePath(); } path.toFile().canRead(); FileBasedSystemAccessControlRules rules = jsonCodec(FileBasedSystemAccessControlRules.class) .fromJson(Files.readAllBytes(path)); ImmutableList.Builder<CatalogAccessControlRule> catalogRulesBuilder = ImmutableList.builder(); catalogRulesBuilder.addAll(rules.getCatalogRules()); ImmutableList.Builder<PrincipalUserMatchRule> principleUserMatchRulesBuilder = ImmutableList.builder(); principleUserMatchRulesBuilder.addAll(rules.getPrincipalUserMatchRules()); catalogRulesBuilder.add(new CatalogAccessControlRule( true, Optional.of(Pattern.compile(".*")), Optional.of(Pattern.compile("system")))); return new FileBasedSystemAccessControl(catalogRulesBuilder.build(), principleUserMatchRulesBuilder.build()); } catch (SecurityException | IOException | InvalidPathException e) { throw new RuntimeException(e); } }

Target:
public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(CONFIG_FILE_NAME); checkState( configFileName != null, "Security configuration must contain the '%s' property", CONFIG_FILE_NAME); try { Path path = Paths.get(configFileName); if (!path.isAbsolute()) { path = path.toAbsolutePath(); } path.toFile().canRead(); FileBasedSystemAccessControlRules rules = jsonCodec(FileBasedSystemAccessControlRules.class) .fromJson(Files.readAllBytes(path)); ImmutableList.Builder<CatalogAccessControlRule> catalogRulesBuilder = ImmutableList.builder(); catalogRulesBuilder.addAll(rules.getCatalogRules()); catalogRulesBuilder.add(new CatalogAccessControlRule( true, Optional.of(Pattern.compile(".*")), Optional.of(Pattern.compile("system")))); return new FileBasedSystemAccessControl(catalogRulesBuilder.build(), rules.getPrincipalUserMatchRules()); } catch (SecurityException | IOException | InvalidPathException e) { throw new RuntimeException(e); } }
Source:
private void calculateMinimumScaleToFit() { if (mMinimumScaleMode != MinimumScaleMode.NONE) { float minimumScaleX = getWidth() / (float) mBaseWidth; float minimumScaleY = getHeight() / (float) mBaseHeight; float recalculatedMinScale = mMinimumScaleMode == MinimumScaleMode.FILL ? Math.max( minimumScaleX, minimumScaleY ) : Math.min( minimumScaleX, minimumScaleY ); if( recalculatedMinScale != mEffectiveMinScale ) { mEffectiveMinScale = recalculatedMinScale; if( mScale < mEffectiveMinScale ){ setScale( mEffectiveMinScale ); } } } }

Target:
private void calculateMinimumScaleToFit() { float minimumScaleX = getWidth() / (float) mBaseWidth; float minimumScaleY = getHeight() / (float) mBaseHeight; float recalculatedMinScale = calculatedMinScale(minimumScaleX, minimumScaleY); if( recalculatedMinScale != mEffectiveMinScale ) { mEffectiveMinScale = recalculatedMinScale; if( mScale < mEffectiveMinScale ){ setScale( mEffectiveMinScale ); } } }