auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static PlanFragment createFragment(PlanNode planNode) { ImmutableMap.Builder<Symbol, Type> types = ImmutableMap.builder(); for (Symbol symbol : planNode.getOutputSymbols()) { types.put(symbol, VARCHAR); } return new PlanFragment( new PlanFragmentId(planNode.getId() + "_fragment_id"), planNode, types.build(), SOURCE_DISTRIBUTION, ImmutableList.of(planNode.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), planNode.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), emptyMap(), emptyMap()); }

Target:
private static PlanFragment createFragment(PlanNode planNode) { ImmutableMap.Builder<Symbol, Type> types = ImmutableMap.builder(); for (Symbol symbol : planNode.getOutputSymbols()) { types.put(symbol, VARCHAR); } return new PlanFragment( new PlanFragmentId(planNode.getId() + "_fragment_id"), planNode, types.build(), SOURCE_DISTRIBUTION, ImmutableList.of(planNode.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), planNode.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), StatsAndCosts.empty()); }
Source:
public Set<ResourceType<?>> getResourceTypes() { Set<ResourceType<?>> resourceType = new HashSet<>(); resourceType.add(ClusteredResourceType.Types.DEDICATED); resourceType.add(ClusteredResourceType.Types.SHARED); resourceType.add(ClusteredResourceType.Types.UNKNOWN); return resourceType; }

Target:
public Set<ResourceType<?>> getResourceTypes() { Set<ResourceType<?>> resourceType = new HashSet<>(3); resourceType.add(ClusteredResourceType.Types.DEDICATED); resourceType.add(ClusteredResourceType.Types.SHARED); resourceType.add(ClusteredResourceType.Types.UNKNOWN); return Collections.unmodifiableSet(resourceType); }
Source:
public void subscribeToDataStore() { Log.v(TAG, "subscribeToDataStore"); compositeSubscription.add( Observable.switchOnNext( Observable.switchOnNext(searchString) .filter((string) -> string.length() > 2) .throttleLast(500, TimeUnit.MILLISECONDS) .map(dataLayer::getGitHubRepositorySearch) ) .flatMap((repositorySearch) -> { final List<Observable<GitHubRepository>> observables = new ArrayList<>(); for (int repositoryId : repositorySearch.getItems()) { Log.d(TAG, "Process repositoryId: " + repositoryId); final Observable<GitHubRepository> observable = dataLayer.getGitHubRepository(repositoryId); observables.add(observable); } return Observable.combineLatest( observables, (args) -> { Log.v(TAG, "Combine items into a list"); final List<GitHubRepository> list = new ArrayList<>(); for (Object repository : args) { list.add((GitHubRepository) repository); } return list; } ); }) .subscribe((repositories) -> { Log.d(TAG, "Publishing " + repositories.size() + " repositories from the ViewModel"); RepositoriesViewModel.this.repositories.onNext(repositories); })); }

Target:
public void subscribeToDataStore() { Log.v(TAG, "subscribeToDataStore"); if (compositeSubscription == null) { compositeSubscription = new CompositeSubscription(); } compositeSubscription.add( Observable.switchOnNext( Observable.switchOnNext(searchString) .filter((string) -> string.length() > 2) .throttleLast(500, TimeUnit.MILLISECONDS) .map(dataLayer::getGitHubRepositorySearch) ) .flatMap((repositorySearch) -> { Log.d(TAG, "Found " + repositorySearch.getItems().size() + " repositories with search " + repositorySearch.getSearch()); final List<Observable<GitHubRepository>> observables = new ArrayList<>(); for (int repositoryId : repositorySearch.getItems()) { Log.v(TAG, "Process repositoryId: " + repositoryId); final Observable<GitHubRepository> observable = dataLayer.getGitHubRepository(repositoryId) .doOnNext((repository) -> Log.v(TAG, "Received repository " + repository.getId())); observables.add(observable); if (observables.size() >= MAX_REPOSITORIES_DISPLAYED) { break; } } return Observable.combineLatest( observables, (args) -> { Log.v(TAG, "Combine items into a list"); final List<GitHubRepository> list = new ArrayList<>(); for (Object repository : args) { list.add((GitHubRepository) repository); } return list; } ); }) .subscribe((repositories) -> { Log.d(TAG, "Publishing " + repositories.size() + " repositories from the ViewModel"); RepositoriesViewModel.this.repositories.onNext(repositories); })); }
Source:
public StructField getStructField(String columnName) { StructField childStructField = null; if (typeId.isArray()) { assert typeDescriptor!=null:"Catalog Type"; assert typeDescriptor.getChildren() != null:"Catalog Type"; TypeDescriptorImpl childTypeDescriptor = (TypeDescriptorImpl) typeDescriptor.getChildren()[0]; TypeId childTypeId = TypeId.getBuiltInTypeId(childTypeDescriptor.getTypeId().getJDBCTypeId()); childStructField = childTypeId.getStructField("co", childTypeDescriptor.getPrecision(), childTypeDescriptor.getScale(), null); } return typeId.getStructField(columnName, getPrecision(), getScale(), childStructField); }

Target:
public StructField getStructField(String columnName) { StructField childStructField = null; if (typeId.isArray()) { assert typeDescriptor.getChildren() != null:"ArrayType should have the child type specified"; TypeDescriptorImpl childTypeDescriptor = (TypeDescriptorImpl) typeDescriptor.getChildren()[0]; TypeId childTypeId = TypeId.getBuiltInTypeId(childTypeDescriptor.getTypeId().getJDBCTypeId()); childStructField = childTypeId.getStructField("co", childTypeDescriptor.getPrecision(), childTypeDescriptor.getScale(), null); } return typeId.getStructField(columnName, getPrecision(), getScale(), childStructField); }
Source:
public void isSameInstanceType(String columnClassName, String value, boolean expectedResult) { FactIdentifier factIdentifierMock = mock(FactIdentifier.class); when(factIdentifierMock.getClassNameWithoutPackage()).thenReturn(columnClassName); when(factMappingMock.getFactIdentifier()).thenReturn(factIdentifierMock); when(simulationDescriptorMock.getFactMappingByIndex(COLUMN_INDEX)).thenReturn(factMappingMock); boolean result = scenarioGridModel.isSameInstanceType(COLUMN_INDEX, value); verify(simulationMock, times(1)).getSimulationDescriptor(); verify(simulationDescriptorMock, times(1)).getFactMappingByIndex(eq(COLUMN_INDEX)); assertEquals(result, expectedResult); }

Target:
private void isSameInstanceType(String columnClassName, String value, boolean expectedResult) { FactIdentifier factIdentifierMock = mock(FactIdentifier.class); when(factIdentifierMock.getClassNameWithoutPackage()).thenReturn(columnClassName); when(factMappingMock.getFactIdentifier()).thenReturn(factIdentifierMock); when(simulationDescriptorMock.getFactMappingByIndex(COLUMN_INDEX)).thenReturn(factMappingMock); boolean result = scenarioGridModel.isSameInstanceType(COLUMN_INDEX, value); verify(simulationMock, times(1)).getSimulationDescriptor(); verify(simulationDescriptorMock, times(1)).getFactMappingByIndex(eq(COLUMN_INDEX)); assertEquals(result, expectedResult); }
Source:
protected void doInit() { Assert.state(this.queryExpression != null || this.collectionCallback != null, "no query specified"); Assert.state(this.collectionNameExpression != null, "no collection name specified"); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); TypeLocator typeLocator = this.evaluationContext.getTypeLocator(); if (typeLocator instanceof StandardTypeLocator) { ((StandardTypeLocator) typeLocator).registerImport(Query.class.getPackage().getName()); } } if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } }

Target:
protected void doInit() { Assert.state(this.queryExpression != null || this.collectionCallback != null, "no query or collectionCallback is specified"); Assert.state(this.collectionNameExpression != null, "no collection name specified"); if (this.queryExpression != null && this.collectionCallback != null) { throw new IllegalStateException("query and collectionCallback are mutually exclusive"); } if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); TypeLocator typeLocator = this.evaluationContext.getTypeLocator(); if (typeLocator instanceof StandardTypeLocator) { ((StandardTypeLocator) typeLocator).registerImport(Query.class.getPackage().getName()); } } if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } }
Source:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); System.out.println("Modules: " + StringUtils.join(modules, ", ")); System.exit(0); } if(others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } moduleService.parseArguments(others); if(moduleService.isHelp()) { System.out.println(module + " help"); return; } loadExtensions(moduleService, argMap); moduleService.run(); } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); System.err.println(message); logger.error(message); logger.debug(message, t); System.exit(1); } }

Target:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { printModules(moduleServices.keySet()); } else { if (others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists.", module) ); } moduleService.parseArguments(others); if (moduleService.doHelp()) { System.out.println(module + " help"); return; } loadExtensions(moduleService, argMap); moduleService.run(); } } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); logger.error(message); logger.debug(message, t); System.exit(1); } }
Source:
private void connect(){ findViewById(R.id.sign_in_button).setVisibility(View.INVISIBLE); findViewById(R.id.textViewGoogleConnecting).setVisibility(View.VISIBLE); findViewById(R.id.buttonCancelGoogleConnection).setVisibility(View.VISIBLE); findViewById(R.id.progressBarGoogleConnection).setVisibility(View.VISIBLE); mGoogleApiClient.connect(); }

Target:
private void connect(){ mGoogleSingInButton.setVisibility(View.INVISIBLE); mTextViewGoogleConnecting.setVisibility(View.VISIBLE); mButtonCancelGoogleConnection.setVisibility(View.VISIBLE); mProgressBarGoogleConnection.setVisibility(View.VISIBLE); mGoogleApiClient.connect(); }
Source:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getOvfUpdateStep() == OvfUpdateStep.OVF_STORES_CREATION) { setOvfUpdateStep(OvfUpdateStep.OVF_UPLOAD); if (!updateOvfStoreContent()) { setSucceeded(false); log.error("Failed to update OVF_STORE content"); throw new EngineException(EngineError.UPLOAD_FAILURE); } return true; } return false; }

Target:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getOvfUpdateStep() == OvfUpdateStep.OVF_STORES_CREATION) { setOvfUpdateStep(OvfUpdateStep.OVF_UPLOAD); if (!updateOvfStoreContent()) { setSucceeded(false); log.error("Failed to update OVF_STORE content"); throw new RuntimeException(); } return true; } return false; }
Source:
public void evictStaleEntries(final StalenessTracker stalenessTracker) { for (Map.Entry<JmxCollector.Rule, Map<String, MatchedRule>> entry : cachedRules.entrySet()) { JmxCollector.Rule rule = entry.getKey(); Map<String, MatchedRule> cachedRulesForRule = entry.getValue(); for (String cacheKey : cachedRulesForRule.keySet()) { if (!stalenessTracker.contains(rule, cacheKey)) { cachedRulesForRule.remove(cacheKey); } } if (cachedRulesForRule.size() == 0) { cachedRules.remove(rule); } } }

Target:
public void evictStaleEntries(final StalenessTracker stalenessTracker) { for (Map.Entry<JmxCollector.Rule, Map<String, MatchedRule>> entry : cachedRules.entrySet()) { JmxCollector.Rule rule = entry.getKey(); Map<String, MatchedRule> cachedRulesForRule = entry.getValue(); for (String cacheKey : cachedRulesForRule.keySet()) { if (!stalenessTracker.contains(rule, cacheKey)) { cachedRulesForRule.remove(cacheKey); } } } }
Source:
private void addRepository(File repositoryDir) { util.addConfiguredRepository(repositoryDir); if (doAutoShare()) { autoShareProjects(repositoryDir); } }

Target:
private void addRepository(File repositoryDir) { util.addConfiguredRepository(repositoryDir); if (doAutoShare()) autoShareProjects(repositoryDir); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); skyMaterial.setFloat("viewingDistance", renderingConfig.getViewDistance().getChunkDistance().x * 8.0f, true); skyMaterial.setFloat("daylight", backdropProvider.getDaylight(), true); skyMaterial.setFloat("tick", worldRenderer.getMillisecondsSinceRenderingStart(), true); skyMaterial.setFloat("sunlightValueAtPlayerPos", worldRenderer.getTimeSmoothedMainLightIntensity(), true); activeCamera = worldRenderer.getActiveCamera(); cameraDir = activeCamera.getViewingDirection(); cameraPosition = activeCamera.getPosition(); skyMaterial.setFloat("swimming", activeCamera.isUnderWater() ? 1.0f : 0.0f, true); skyMaterial.setFloat3("cameraPosition", cameraPosition.x, cameraPosition.y, cameraPosition.z, true); skyMaterial.setFloat3("cameraDirection", cameraDir.x, cameraDir.y, cameraDir.z, true); skyMaterial.setFloat3("cameraParameters", activeCamera.getzNear(), activeCamera.getzFar(), 0.0f, true); sunDirection = backdropProvider.getSunDirection(false); skyMaterial.setFloat3("sunVec", sunDirection.x, sunDirection.y, sunDirection.z, true); skyMaterial.setFloat("time", worldProvider.getTime().getDays(), true); skyMaterial.setFloat("colorExp", backdropProvider.getColorExp(), true); zenithColor = getAllWeatherZenith(sunDirection.y, backdropProvider.getTurbidity()); skyMaterial.setFloat("sunAngle", backdropProvider.getSunPositionAngle(), true); skyMaterial.setFloat("turbidity", backdropProvider.getTurbidity(), true); skyMaterial.setFloat3("zenith", (float) zenithColor.x, (float) zenithColor.y, (float) zenithColor.z, true); skyMaterial.setFloat4("skySettings", sunExponent, moonExponent, skyDaylightBrightness, skyNightBrightness, true); glCallList(skySphere); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); sunDirection = backdropProvider.getSunDirection(false); turbidity = backdropProvider.getTurbidity(); skyMaterial.setFloat("daylight", backdropProvider.getDaylight(), true); skyMaterial.setFloat3("sunVec", sunDirection, true); skyMaterial.setFloat3("zenith", getAllWeatherZenith(backdropProvider.getSunDirection(false).y, turbidity), true); skyMaterial.setFloat("turbidity", turbidity, true); skyMaterial.setFloat("colorExp", backdropProvider.getColorExp(), true); skyMaterial.setFloat4("skySettings", sunExponent, moonExponent, skyDaylightBrightness, skyNightBrightness, true); glCallList(skySphere); PerformanceMonitor.endActivity(); }
Source:
public Node visitClazz(ClazzContext ctx) { String superclass; String clazzName = ctx.classname.getText(); if (ctx.superclass != null) { superclass = ctx.superclass.getText().replace('\\', '/'); } else { superclass = "org/twnc/runtime/BObject"; } DeclsNode decls; if (ctx.decls() != null) { decls = (DeclsNode) visit(ctx.decls()); } else { decls = new DeclsNode(new ArrayList<VarDeclNode>()); } List<MethodNode> methods = new ArrayList<>(); for (MthdContext m : ctx.mthd()) { methods.add((MethodNode) visit(m)); } return new ClazzNode(clazzName, superclass, decls, methods); }

Target:
public Node visitClazz(ClazzContext ctx) { String superclass; String clazzName = ctx.classname.getText(); if (ctx.superclass != null) { superclass = ctx.superclass.getText().replace('\\', '/'); } else { superclass = "org/twnc/runtime/BObject"; } DeclsNode decls; if (ctx.decls() != null) { decls = (DeclsNode) visit(ctx.decls()); } else { decls = new DeclsNode(); } List<MethodNode> methods = new ArrayList<>(); for (MthdContext m : ctx.mthd()) { methods.add((MethodNode) visit(m)); } return new ClazzNode(clazzName, superclass, decls, methods); }
Source:
public boolean isConfirmationEmailBoxTicked() { WebElement sendEmailChecbox = browser.driver.findElement(By.name(Const.ParamsNames.SEND_SUBMISSION_EMAIL)); return sendEmailChecbox.isSelected(); }

Target:
public boolean isConfirmationEmailBoxTicked() { WebElement sendEmailCheckbox = browser.driver.findElement(By.name(Const.ParamsNames.SEND_SUBMISSION_EMAIL)); return sendEmailCheckbox.isSelected(); }
Source:
public void testFormReceiptFailure() throws Exception{ MockEventListener mockEventListener = new MockEventListener(MOCK_ID_2); registry.registerListener(mockEventListener,EventSubjects.FORM_FAIL); String badConfigName = "bad_config_name"; HttpPost request = new HttpPost(String.format("http://localhost:%d/odk/forms/%s/%s", TestContext.getJettyPort(), badConfigName, TITLE)); StringEntity entity = new StringEntity(getJson()); request.setEntity(entity); HttpResponse response = getHttpClient().execute(request); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); int count = 0; while (mockEventListener.getEvents().size() < EXPECTED_EVENTS_FAIL && count < WAIT_COUNT) { count++; getLogger().debug("Number of events: " + mockEventListener.getEvents().size()); if (count == WAIT_COUNT) { getLogger().error("Timeout"); fail(); } Thread.sleep(2000); } MotechEvent event = mockEventListener.getEvents().get(0); assertNotNull(event); assertEquals(event.getSubject(), EventSubjects.FORM_FAIL); assertEquals(event.getParameters().get(EventParameters.FORM_TITLE), TITLE); assertEquals(event.getParameters().get(EventParameters.CONFIGURATION_NAME), badConfigName); }

Target:
public void testFormReceiptFailure() throws Exception { MockEventListener mockEventListener = new MockEventListener(MOCK_ID_2); registry.registerListener(mockEventListener, EventSubjects.FORM_FAIL); String badConfigName = "bad_config_name"; HttpPost request = new HttpPost(String.format("http://localhost:%d/odk/forms/%s/%s", TestContext.getJettyPort(), badConfigName, TITLE)); StringEntity entity = new StringEntity(getJson()); request.setEntity(entity); HttpResponse response = getHttpClient().execute(request); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); int count = 0; while (mockEventListener.getEvents().size() < EXPECTED_EVENTS_FAIL && count < WAIT_COUNT) { count++; getLogger().debug("Number of events: " + mockEventListener.getEvents().size()); if (count == WAIT_COUNT) { fail(TIMEOUT); } Thread.sleep(2000); } MotechEvent event = mockEventListener.getEvents().get(0); assertNotNull(event); assertEquals(event.getSubject(), EventSubjects.FORM_FAIL); assertEquals(event.getParameters().get(EventParameters.FORM_TITLE), TITLE); assertEquals(event.getParameters().get(EventParameters.CONFIGURATION_NAME), badConfigName); }
Source:
public int hashCode() { int result = Objects.hashCode(fullName); result += Objects.hashCode(name); return result * 31; }

Target:
public int hashCode() { return Objects.hash(name, fullName); }
Source:
private ListenableFuture<Void> stopTasksInGroup(TaskGroup taskGroup) { if (taskGroup == null) { return Futures.immediateFuture(null); } final List<ListenableFuture<Void>> futures = Lists.newArrayList(); for (Map.Entry<String, TaskData> entry : taskGroup.tasks.entrySet()) { if (!entry.getValue().status.isComplete()) { futures.add(stopTask(entry.getKey(), false)); } } return Futures.transform( Futures.successfulAsList(futures), new Function<List<Void>, Void>() { @Nullable @Override public Void apply(@Nullable List<Void> input) { return null; } } ); }

Target:
private ListenableFuture<?> stopTasksInGroup(TaskGroup taskGroup) { if (taskGroup == null) { return Futures.immediateFuture(null); } final List<ListenableFuture<Void>> futures = Lists.newArrayList(); for (Map.Entry<String, TaskData> entry : taskGroup.tasks.entrySet()) { if (!entry.getValue().status.isComplete()) { futures.add(stopTask(entry.getKey(), false)); } } return Futures.successfulAsList(futures); }
Source:
boolean addOverride(long changeId, String packageName, boolean enabled, IOverrideValidator validator) { boolean alreadyKnown = true; try { if (!validator.allowOverride(changeId, packageName)) { return alreadyKnown; } } catch (RemoteException e) { throw new RuntimeException("Unable to call override validator!", e); } synchronized (mChanges) { CompatChange c = mChanges.get(changeId); if (c == null) { alreadyKnown = false; c = new CompatChange(changeId); addChange(c); } c.addPackageOverride(packageName, enabled); } return alreadyKnown; }

Target:
boolean addOverride(long changeId, String packageName, boolean enabled, IOverrideValidator validator) throws RemoteException, SecurityException { boolean alreadyKnown = true; enforceOverridePolicy(changeId, packageName, validator); synchronized (mChanges) { CompatChange c = mChanges.get(changeId); if (c == null) { alreadyKnown = false; c = new CompatChange(changeId); addChange(c); } c.addPackageOverride(packageName, enabled); } return alreadyKnown; }
Source:
public int getUnsortedEncodedKeyComponentHashCode(@Nullable Double key) { return Objects.hashCode(key); }

Target:
public int getUnsortedEncodedKeyComponentHashCode(@Nullable Double key) { return DimensionHandlerUtils.nullToZero(key).hashCode(); }
Source:
Map getNetworksMap(Host host) { Map resultMap = map(); Map ovirtmgmtMap = map(); resultMap.put(AppConfig.getInstance().getNetworkBridgeName(), ovirtmgmtMap); ovirtmgmtMap.put("iface", AppConfig.getInstance().getNetworkBridgeName()); ovirtmgmtMap.put("addr", host.getIpAddress()); Map cfgMap = map(); cfgMap.put("DEVICE", AppConfig.getInstance().getNetworkBridgeName()); cfgMap.put("DELAY", "0"); cfgMap.put("BOOTPROTO", "dhcp"); cfgMap.put("TYPE", "Ethernet"); cfgMap.put("ONBOOT", "yes"); ovirtmgmtMap.put("cfg", cfgMap); ovirtmgmtMap.put("mtu", "1500"); ovirtmgmtMap.put("netmask", "255.255.252.0"); ovirtmgmtMap.put("stp", "off"); ovirtmgmtMap.put("bridged", Boolean.TRUE); ovirtmgmtMap.put("gateway", "10.34.63.254"); ovirtmgmtMap.put("switch", "legacy"); List portsList = lst(); portsList.add("em1"); ovirtmgmtMap.put("ports", portsList); return resultMap; }

Target:
Map getNetworksMap(Host host) { Map resultMap = map(); Map ovirtmgmtMap = map(); resultMap.put(AppConfig.getInstance().getNetworkBridgeName(), ovirtmgmtMap); ovirtmgmtMap.put("iface", AppConfig.getInstance().getNetworkBridgeName()); ovirtmgmtMap.put("addr", host.getIpAddress()); Map cfgMap = map(); cfgMap.put("DEVICE", AppConfig.getInstance().getNetworkBridgeName()); cfgMap.put("DELAY", "0"); cfgMap.put("BOOTPROTO", "dhcp"); cfgMap.put("TYPE", "Ethernet"); cfgMap.put("ONBOOT", "yes"); ovirtmgmtMap.put("cfg", cfgMap); ovirtmgmtMap.put("mtu", "1500"); ovirtmgmtMap.put("netmask", "255.255.252.0"); ovirtmgmtMap.put("stp", "off"); ovirtmgmtMap.put("bridged", Boolean.TRUE); ovirtmgmtMap.put("gateway", "10.34.63.254"); List portsList = lst(); portsList.add("em1"); ovirtmgmtMap.put("ports", portsList); return resultMap; }
Source:
public Saveable[] getSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); return saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getSaveables() : new Saveable[] { new DefaultSaveable(saveablePart) }; } return super.getSaveables(); }

Target:
public Saveable[] getSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); return saveablePart != null ? saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getSaveables() : new Saveable[] { new DefaultSaveable(saveablePart) } : new Saveable[] {}; } return super.getSaveables(); }
Source:
public ListCertificatesResponseMessageType listChainOfTrust(ListChainOfTrustRequestMessageType request) { LOG.debug("listChainOfTrust--begin"); String alias = request.getAlias(); if(StringUtils.isBlank(alias)){ return buildListCertificatesResponseMessageType(false, "Certificate Alias is required for chain-of-trust"); } try { ListCertificatesResponseMessageType response = new ListCertificatesResponseMessageType(); response.getCertList().addAll(buildChain(alias, getTrustStore())); return response; } catch (KeyStoreException | CertificateEncodingException ex) { LOG.error("unable to build chain-of-trust: {}", ex.getMessage(), ex); return buildListCertificatesResponseMessageType(false, "ERROR: Unable to build the chain-of-trust."); } finally { LOG.debug("listChainOfTrust--end"); } }

Target:
public ListCertificatesResponseMessageType listChainOfTrust(ListChainOfTrustRequestMessageType request) { LOG.debug("listChainOfTrust: begin"); String alias = request.getAlias(); if(StringUtils.isBlank(alias)){ return buildListCertificatesResponseMessageType(false, "Certificate Alias is required for chain of trust"); } try { ListCertificatesResponseMessageType response = new ListCertificatesResponseMessageType(); response.getCertList().addAll(buildChain(alias, getTrustStore())); return response; } catch (KeyStoreException | CertificateEncodingException ex) { LOG.error("unable to build chain-of-trust: {}", ex.getMessage(), ex); return buildListCertificatesResponseMessageType(false, "Unable to build the chain of trust."); } finally { LOG.debug("listChainOfTrust: end"); } }
Source:
public void shouldThrowStreamsExceptionForOldTopicPartitions() throws IOException { final HashMap<TopicPartition, Long> expectedOffsets = new HashMap<>(); expectedOffsets.put(t1, 1L); expectedOffsets.put(t2, 1L); expectedOffsets.put(t3, 1L); expectedOffsets.put(t4, 1L); final HashMap<TopicPartition, Long> startOffsets = new HashMap<>(expectedOffsets); final TopicPartition tOld = new TopicPartition("oldTopic", 1); startOffsets.put(tOld, 1L); final OffsetCheckpoint checkpoint = new OffsetCheckpoint(checkpointFile); checkpoint.write(startOffsets); stateManager.initialize(); }

Target:
public void shouldThrowStreamsExceptionForOldTopicPartitions() throws IOException { final HashMap<TopicPartition, Long> expectedOffsets = new HashMap<>(); expectedOffsets.put(t1, 1L); expectedOffsets.put(t2, 1L); expectedOffsets.put(t3, 1L); expectedOffsets.put(t4, 1L); final HashMap<TopicPartition, Long> startOffsets = new HashMap<>(expectedOffsets); final TopicPartition tOld = new TopicPartition("oldTopic", 1); startOffsets.put(tOld, 1L); final OffsetCheckpoint checkpoint = new OffsetCheckpoint(checkpointFile); checkpoint.write(startOffsets); final StreamsException e = assertThrows(StreamsException.class, () -> stateManager.initialize()); assertThat(e.getMessage(), equalTo("Encountered a topic-partition not associated with any global state store")); }
Source:
public void dumpRingStructure(IgniteLogger log) { ClusterNode[] serverNodes = getRemoteNodes().stream() .filter(node -> !node.isClient()) .sorted((o1, o2) -> (int)(o1.order() - o2.order())) .toArray(ClusterNode[]::new); U.quietAndInfo(log, Arrays.toString(serverNodes)); }

Target:
@Override public void dumpRingStructure(IgniteLogger log) { ClusterNode[] serverNodes = getRemoteNodes().stream() .filter(node -> !node.isClient()) .sorted(Comparator.comparingLong(ClusterNode::order)) .toArray(ClusterNode[]::new); U.quietAndInfo(log, Arrays.toString(serverNodes)); }
Source:
protected boolean filter(String name) { if (filters == null || filters.isEmpty()) { String filters = Framework.getProperty(FILTER_PROPERTY, DEFAULT_METRICS); return matchesFilter(name, Arrays.stream(filters.split(","))); } else { return matchesFilter(name, filters.stream()); } }

Target:
public boolean filter(String name) { return allowedMetrics.stream().anyMatch(f -> ALL_METRICS.equals(f) || name.startsWith(f)) || deniedMetrics.stream().noneMatch(f -> ALL_METRICS.equals(f) || name.startsWith(f)); }
Source:
protected Object cast(Object value) { switch (type) { case STRING : return valueFactories.getStringFactory().create(value); case LONG : return valueFactories.getLongFactory().create(value); case NAME : return valueFactories.getNameFactory().create(value); case PATH : return valueFactories.getPathFactory().create(value); case DATE : return valueFactories.getDateFactory().create(value); case BOOLEAN : return valueFactories.getBooleanFactory().create(value); case URI : return valueFactories.getUriFactory().create(value); case REFERENCE : return valueFactories.getReferenceFactory().create(value); case SIMPLEREFERENCE : return valueFactories.getSimpleReferenceFactory().create(value); case WEAKREFERENCE : return valueFactories.getWeakReferenceFactory().create(value); } return value; }

Target:
protected Object cast(Object value) { switch (type) { case STRING : return valueFactories.getStringFactory().create(value); case LONG : return valueFactories.getLongFactory().create(value); case NAME : return valueFactories.getNameFactory().create(value); case PATH : return valueFactories.getPathFactory().create(value); case DATE : return valueFactories.getDateFactory().create(value); case BOOLEAN : return valueFactories.getBooleanFactory().create(value); case URI : return valueFactories.getUriFactory().create(value); case REFERENCE : return valueFactories.getReferenceFactory().create(value); case SIMPLEREFERENCE : return valueFactories.getSimpleReferenceFactory().create(value); case WEAKREFERENCE : return valueFactories.getWeakReferenceFactory().create(value); default : return value; } }
Source:
protected IJavaType getPrimitiveType(String name) throws CoreException { IJavaReferenceType type = null; if (null != name) switch (name) { case "boolean": type = (IJavaReferenceType) getType("java.lang.Boolean"); break; case "byte": type = (IJavaReferenceType) getType("java.lang.Byte"); break; case "char": type = (IJavaReferenceType) getType("java.lang.Character"); break; case "double": type = (IJavaReferenceType) getType("java.lang.Double"); break; case "float": type = (IJavaReferenceType) getType("java.lang.Float"); break; case "int": type = (IJavaReferenceType) getType("java.lang.Integer"); break; case "long": type = (IJavaReferenceType) getType("java.lang.Long"); break; case "short": type = (IJavaReferenceType) getType("java.lang.Short"); break; case "void": type = (IJavaReferenceType) getType("java.lang.Void"); break; default: break; } if (type != null) { IJavaFieldVariable field = type.getField("TYPE"); IJavaClassObject clazz = (IJavaClassObject) field.getValue(); return clazz.getInstanceType(); } throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, NLS.bind( InstructionsEvaluationMessages.Instruction_No_type, new String[] { name }), null)); }

Target:
protected IJavaType getPrimitiveType(String name) throws CoreException { IJavaReferenceType type = null; if (name != null) { switch (name) { case "boolean": type = (IJavaReferenceType) getType("java.lang.Boolean"); break; case "byte": type = (IJavaReferenceType) getType("java.lang.Byte"); break; case "char": type = (IJavaReferenceType) getType("java.lang.Character"); break; case "double": type = (IJavaReferenceType) getType("java.lang.Double"); break; case "float": type = (IJavaReferenceType) getType("java.lang.Float"); break; case "int": type = (IJavaReferenceType) getType("java.lang.Integer"); break; case "long": type = (IJavaReferenceType) getType("java.lang.Long"); break; case "short": type = (IJavaReferenceType) getType("java.lang.Short"); break; case "void": type = (IJavaReferenceType) getType("java.lang.Void"); break; default: break; } } if (type != null) { IJavaFieldVariable field = type.getField("TYPE"); IJavaClassObject clazz = (IJavaClassObject) field.getValue(); return clazz.getInstanceType(); } throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, NLS.bind( InstructionsEvaluationMessages.Instruction_No_type, new String[] { name }), null)); }
Source:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (isStoreAsBinary()) { for (Object key : command.getKeys()) { if (getMightGoRemote(ctx, key, command)) checkMarshallable(key); } } return super.visitGetAllCommand(ctx, command); }

Target:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { for (Object key : command.getKeys()) { if (isStoreAsBinary() || getMightGoRemote(ctx, key, command)) checkMarshallable(key); } return super.visitGetAllCommand(ctx, command); }
Source:
public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext ) { validate( queryParameters ); EmbeddedCacheManager embeddedCacheManager = getCacheManager().getCacheManager(); Cache<String, String> cache = embeddedCacheManager.getCache( "___stored_procedures", true ); String className = cache.getOrDefault( storedProcedureName, storedProcedureName ); Callable<?> callable = instantiate( storedProcedureName, className ); setParams( storedProcedureName, queryParameters, callable ); Object res = execute( storedProcedureName, embeddedCacheManager, callable ); return CollectionHelper.newClosableIterator( extractTuples( storedProcedureName, res ) ); }

Target:
public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext ) { EmbeddedCacheManager embeddedCacheManager = getCacheManager().getCacheManager(); return storedProceduresDelegate.callStoredProcedure( embeddedCacheManager, storedProcedureName, queryParameters, classLoaderService ); }
Source:
protected void after() throws Throwable { }

Target:
protected void after() { }
Source:
private void flushToFile() throws IOException { if (!closed) { if (outStream == null) { createStream(); } if (pos > 0) { outStream.write(writeBuffer, 0, pos); pos = 0; } } else { throw new IOException("closed"); } }

Target:
public void flushToFile() throws IOException { if (!closed) { if (outStream == null) { createStream(); } if (pos > 0) { outStream.write(writeBuffer, 0, pos); pos = 0; } } else { throw new IOException("closed"); } }
Source:
private void readDataInFetch() { if (this.closed.get()) { return; } while (remainingDataInCurrentRequest > 0) { if (CompileTimeConstants.PROFILE_CODE) { boolean acquired = this.bufferWriteMutex.tryAcquire(); if (acquired == false) { long aquireTime = System.nanoTime(); this.bufferWriteMutex.acquireUninterruptibly(); aquireTime = System.nanoTime() - aquireTime; mutexWaitTimeNS += aquireTime; } } else { this.bufferWriteMutex.acquireUninterruptibly(); } int totalBufferCapacity = this.readBufferCapacity.get(); int currentBufferLen = this.readBufferDataLen.get(); int remainingBufferCapacity = totalBufferCapacity - currentBufferLen; remainingBufferCapacity = totalBufferCapacity - currentBufferLen; int bytesToRead = 0; try { bytesToRead = Math.max(512,this.dis.available()); bytesToRead = Math.min(remainingBufferCapacity, Math.min(bytesToRead,remainingDataInCurrentRequest)); dis.readFully(this.readBuffer, currentBufferLen, bytesToRead); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } this.readBufferDataLen.addAndGet(bytesToRead); remainingDataInCurrentRequest -= bytesToRead; bufferWriteMutex.release(); if (this.readBufferDataLen.get() > (this.bufferPrefetchThresholdKB * 1024)) { return; } } }

Target:
private void readDataInFetch() { if (this.closed.get()) { return; } while (remainingDataInCurrentRequest > 0) { if (CompileTimeConstants.PROFILE_CODE) { boolean acquired = this.bufferWriteMutex.tryAcquire(); if (acquired == false) { long aquireTime = System.nanoTime(); this.bufferWriteMutex.acquireUninterruptibly(); aquireTime = System.nanoTime() - aquireTime; mutexWaitTimeNS += aquireTime; } } else { this.bufferWriteMutex.acquireUninterruptibly(); } int totalBufferCapacity = this.readBufferCapacity.get(); int currentBufferLen = this.readBufferDataLen.get(); int remainingBufferCapacity = totalBufferCapacity - currentBufferLen; remainingBufferCapacity = totalBufferCapacity - currentBufferLen; int bytesToRead = 0; try { bytesToRead = Math.max(MIN_SOCKET_READ_SIZE,this.dis.available()); bytesToRead = Math.min(remainingBufferCapacity, Math.min(bytesToRead,remainingDataInCurrentRequest)); dis.readFully(this.readBuffer, currentBufferLen, bytesToRead); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } this.readBufferDataLen.addAndGet(bytesToRead); remainingDataInCurrentRequest -= bytesToRead; bufferWriteMutex.release(); if (this.readBufferDataLen.get() > (this.bufferPrefetchThresholdKB * 1024)) { return; } } }
Source:
public Void visitAnnotation(AnnotationTree node, Void p) { AnnotationMirror annot = TreeUtils.annotationFromAnnotationTree(node); if (AnnotationUtils.areSame(annot, getTypeFactory().THIS_ANNOTATION)) { TreePath parentPath = getCurrentPath().getParentPath(); Tree parent = parentPath.getLeaf(); Tree grandparent = parentPath.getParentPath().getLeaf(); boolean isReturnAnnot = grandparent instanceof MethodTree && (parent.equals(((MethodTree) grandparent).getReturnType()) || parent instanceof ModifiersTree); boolean isCastAnnot = grandparent instanceof TypeCastTree && parent.equals(((TypeCastTree) grandparent).getType()); if (!(isReturnAnnot || isCastAnnot)) { checker.report( node, new DiagMessage(Diagnostic.Kind.ERROR, "invalid.this.location")); } } return super.visitAnnotation(node, p); }

Target:
public Void visitAnnotation(AnnotationTree node, Void p) { AnnotationMirror annot = TreeUtils.annotationFromAnnotationTree(node); if (AnnotationUtils.areSame(annot, getTypeFactory().THIS_ANNOTATION)) { TreePath parentPath = getCurrentPath().getParentPath(); Tree parent = parentPath.getLeaf(); Tree grandparent = parentPath.getParentPath().getLeaf(); Tree greatGrandparent = parentPath.getParentPath().getParentPath().getLeaf(); boolean isReturnAnnot = grandparent instanceof MethodTree && (parent.equals(((MethodTree) grandparent).getReturnType()) || parent instanceof ModifiersTree); boolean isReceiverAnnot = greatGrandparent instanceof MethodTree && grandparent.equals( ((MethodTree) greatGrandparent).getReceiverParameter()) && parent.equals(((VariableTree) grandparent).getModifiers()); boolean isCastAnnot = grandparent instanceof TypeCastTree && parent.equals(((TypeCastTree) grandparent).getType()); if (!(isReturnAnnot || isReceiverAnnot || isCastAnnot)) { checker.reportError(node, "type.invalid.this.location"); } if (isReturnAnnot && ElementUtils.isStatic( TreeUtils.elementFromDeclaration((MethodTree) grandparent))) { checker.reportError(node, "type.invalid.this.location"); } } return super.visitAnnotation(node, p); }
Source:
public A value() { return supplier != null ? supplier.f() : null; }

Target:
public final A value() { return supplier.f(); }
Source:
private static boolean isValidClaimValue(Object value) { if (value == null) { return true; } Class<?> clazz = value.getClass(); if (clazz.isArray() && SUPPORTED_ARRAY_TYPES.contains(clazz)) { return true; } return SUPPORTED_TYPES.contains(clazz); }

Target:
private static boolean isValidClaimValue(Object value) { if (value == null) { return true; } Class<?> clazz = value.getClass(); if (clazz.isArray() && SUPPORTED_ARRAY_TYPES.contains(clazz)) { return true; } if(SUPPORTED_TYPES.contains(clazz)) return true; throw new IllegalArgumentException("For the claim, of value {" + value + "}, it's type {" + clazz + "} is not supported"); }
Source:
public Object getValueAt(int row, int col) { boolean compact = butCompact.isSelected(); Entity entity = getEntityAt(row); boolean blindDrop = !entity.getOwner().equals(clientgui.getClient().getLocalPlayer()) && clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.BASE_BLIND_DROP); String value = ""; if (col == COL_BV) { value += entity.calculateBattleValue(); } else if (col == COL_PLAYER) { if (compact) { value += entity.getOwner().getName(); } else { value += entity.getOwner().getName() + "<br>Team " + clientgui.getClient().getGame().getPlayer(entity.getOwnerId()).getTeam(); } } else if (col == COL_PILOT) { boolean rpgSkills = clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.RPG_RPG_GUNNERY); if (compact) { return formatPilotCompact(entity.getCrew(), blindDrop, rpgSkills); } return formatPilotHTML(entity.getCrew(), blindDrop, rpgSkills); } else { if (compact) { return formatUnitCompact(entity, blindDrop); } return formatUnitHTML(entity, blindDrop); } return value; }

Target:
public Object getValueAt(int row, int col) { boolean compact = butCompact.isSelected(); Entity entity = getEntityAt(row); boolean blindDrop = !entity.getOwner().equals(clientgui.getClient().getLocalPlayer()) && clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.BASE_BLIND_DROP); String value = ""; if (col == COL_BV) { value += entity.calculateBattleValue(); } else if (col == COL_PLAYER) { if (compact) { value += entity.getOwner().getName(); } else { value += entity.getOwner().getName() + "<br>Team " + clientgui.getClient().getGame().getPlayer(entity.getOwnerId()).getTeam(); } } else if (col == COL_PILOT) { final boolean rpgSkills = clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.RPG_RPG_GUNNERY); if (compact) { return formatPilotCompact(entity.getCrew(), blindDrop, rpgSkills); } return formatPilotHTML(entity.getCrew(), blindDrop, rpgSkills); } else { if (compact) { return formatUnitCompact(entity, blindDrop); } return formatUnitHTML(entity, blindDrop); } return value; }
Source:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()){ case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } }
Source:
public void mouseUp(MouseEvent event) { if (fDragState == DRAG_RANGE && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (event.x != fStartPosition) { int pointDelta = event.x - fStartPosition; long deltaNs = (long) (pointDelta * fScaledData.fBucketDuration); long startTime = fRangeStartTime - deltaNs; fRangeStartTime = Math.min(fFullRangeEndTime - fRangeDuration, startTime); ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); setOffset(0); } return; } else if (fDragState == DRAG_ZOOM && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (fRangeDuration < 0) { fRangeStartTime = fRangeStartTime + fRangeDuration; fRangeDuration = -fRangeDuration; } if (fRangeDuration > 0) { ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); } else { fRangeStartTime = fZoom.getStartTime(); fRangeDuration = fZoom.getDuration(); fCanvas.redraw(); } return; } super.mouseUp(event); }

Target:
public void mouseUp(MouseEvent event) { if (fDragState == DRAG_RANGE && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (event.x != fStartPosition) { int pointDelta = event.x - fStartPosition; long deltaNs = (long) (pointDelta * fScaledData.fBucketDuration); long startTime = fRangeStartTime - deltaNs; fRangeStartTime = Math.max(fFullRangeStartTime, Math.min(fFullRangeEndTime - fRangeDuration, startTime)); ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); setOffset(0); } return; } else if (fDragState == DRAG_ZOOM && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (fRangeDuration < 0) { fRangeStartTime = fRangeStartTime + fRangeDuration; fRangeDuration = -fRangeDuration; } if (fRangeDuration > 0) { ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); } else { fRangeStartTime = fZoom.getStartTime(); fRangeDuration = fZoom.getDuration(); fCanvas.redraw(); } return; } super.mouseUp(event); }
Source:
public void testThreadLeakWhenClientCanNotConstructDueToIncorrectSerializationServiceFactoryClassName() { try { ClientConfig config = new ClientConfig(); SerializationConfig serializationConfig = new SerializationConfig(); serializationConfig.addDataSerializableFactoryClass(5, "invalid.factory"); config.setSerializationConfig(serializationConfig); HazelcastClient.newHazelcastClient(config); Assert.fail(); } catch (HazelcastSerializationException e) { } }

Target:
public void testThreadLeakWhenClientCanNotConstructDueToIncorrectSerializationServiceFactoryClassName() { ClientConfig config = new ClientConfig(); SerializationConfig serializationConfig = new SerializationConfig(); serializationConfig.addDataSerializableFactoryClass(5, "invalid.factory"); config.setSerializationConfig(serializationConfig); Set<Thread> testStartThreads = getThreads(); try { HazelcastClient.newHazelcastClient(config); } finally { assertHazelcastThreadShutdown(testStartThreads); } }
Source:
public void testWhereColumnEqualsValues() throws Exception { DataSet ds = dc.query().from(testTableName).select("id").and("title").where("id") .isEquals(firstRowId).execute(); assertEquals(FilteredDataSet.class, ds.getClass()); try { assertTrue(ds.next()); assertEquals("Row[values=["+firstRowId+", "+firstRowTitle+"]]", ds.getRow().toString()); assertFalse(ds.next()); } finally { ds.close(); } }

Target:
public void testWhereColumnEqualsValues() throws Exception { if (!isConfigured()) { System.err.println(getInvalidConfigurationMessage()); return; } DataSet ds = dc.query().from(testTableName).select("id").and("title").where("id") .isEquals(firstRowId).execute(); assertEquals(FilteredDataSet.class, ds.getClass()); try { assertTrue(ds.next()); assertEquals("Row[values=["+firstRowId+", "+firstRowTitle+"]]", ds.getRow().toString()); assertFalse(ds.next()); } finally { ds.close(); } }