auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
AccessController.doPrivileged((PrivilegedAction<ServiceLoaderSupplier<Provider>>) () -> new ServiceLoaderSupplier<>(Provider.class, ElytronXmlParser.class.getClassLoader())) : new ServiceLoaderSupplier<>(Provider.class, ElytronXmlParser.class.getClassLoader()); private static final Supplier<Provider[]> DEFAULT_PROVIDER_SUPPLIER = ProviderUtil.aggregate(ELYTRON_PROVIDER_SUPPLIER, Security::getProviders); static final Map<String, Version> KNOWN_NAMESPACES; private static final class Version { final int major; final int minor; Version(int major, int minor) { this.major = major; this.minor = minor; } boolean isAtLeast(int major, int minor) { return this.major > major || this.major == major && this.minor >= minor; } boolean isAtMost(int major, int minor) { return this.major < major || this.major == major && this.minor <= minor; } } static { Map<String, Version> knownNamespaces = new HashMap<>(); knownNamespaces.put("urn:elytron:1.0", new Version(1, 0)); knownNamespaces.put("urn:elytron:client:1.1", new Version(1, 1)); KNOWN_NAMESPACES = Collections.unmodifiableMap(knownNamespaces); } private ElytronXmlParser() { }

Target:
AccessController.doPrivileged((PrivilegedAction<ServiceLoaderSupplier<Provider>>) () -> new ServiceLoaderSupplier<>(Provider.class, ElytronXmlParser.class.getClassLoader())) : new ServiceLoaderSupplier<>(Provider.class, ElytronXmlParser.class.getClassLoader()); private static final Supplier<Provider[]> DEFAULT_PROVIDER_SUPPLIER = ProviderUtil.aggregate(ELYTRON_PROVIDER_SUPPLIER, Security::getProviders); static final Map<String, Version> KNOWN_NAMESPACES; private enum Version { VERSION_1_0("urn:elytron:1.0", 1, 0), VERSION_1_1("urn:elytron:client:1.1", 1, 1); final String namespace; final int major; final int minor; Version(String namespace, int major, int minor) { this.namespace = namespace; this.major = major; this.minor = minor; } boolean isAtLeast(int major, int minor) { return this.major > major || this.major == major && this.minor >= minor; } boolean isAtLeastMinor(int major, int minor) { return this.major == major && this.minor >= minor; } } static { Map<String, Version> knownNamespaces = new HashMap<>(); for (Version version : Version.values()) { knownNamespaces.put(version.namespace, version); } KNOWN_NAMESPACES = Collections.unmodifiableMap(knownNamespaces); } private ElytronXmlParser() { }
Source:
public void notifySubscriptions(Topic topic, Instant beforeMigrationInstant) { waitUntilOffsetsAvailableOnAllKafkaTopics(topic, CHECK_OFFSETS_AVAILABLE_TIMEOUT); logger.info("Offsets available on all partitions of topic {}", topic.getQualifiedName()); subscriptionRepository.listSubscriptions(topic.getName()) .stream() .filter(sub -> Subscription.State.SUSPENDED != sub.getState()) .map(Subscription::getName) .forEach(sub -> notifySingleSubscription(topic, beforeMigrationInstant, sub) ); }

Target:
void notifySubscriptions(Topic topic, Instant beforeMigrationInstant) { waitUntilOffsetsAvailableOnAllKafkaTopics(topic, CHECK_OFFSETS_AVAILABLE_TIMEOUT); logger.info("Offsets available on all partitions of topic {}", topic.getQualifiedName()); notSuspendedSubscriptionsForTopic(topic) .map(Subscription::getName) .forEach(sub -> notifySingleSubscription(topic, beforeMigrationInstant, sub)); }
Source:
public NodeChildrenContainer getNamedChildren() { return NodeChildrenContainer.newNodeChildrenContainer() .child(CHILD_VALUE, value) .build(); }

Target:
public NodeChildrenContainer getNamedChildren() { return newNodeChildrenContainer() .child(CHILD_VALUE, value) .build(); }
Source:
public void testDisablingTopStateReplicaByDisablingInstance() throws Exception { int participantCount = 5; setupEnvironment(participantCount); setThrottleConfigForLoadBalance(); PropertyKey key = _accessor.keyBuilder().instanceConfig(_participants[0].getInstanceName()); InstanceConfig instanceConfig = _accessor.getProperty(key); instanceConfig.setInstanceEnabled(false); _accessor.setProperty(key, instanceConfig); ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0"); controller.syncStart(); Thread.sleep(10000L); PropertyKey liveInstanceKey = _accessor.keyBuilder().liveInstance(_participants[0].getInstanceName()); LiveInstance liveInstance = _accessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); List<CurrentState> currentStates = _accessor.getChildValues( _accessor.keyBuilder().currentStates(_participants[0].getInstanceName(), sessionId), true); for (CurrentState currentState : currentStates) { for (Map.Entry<String, String> partitionState : currentState.getPartitionStateMap() .entrySet()) { Assert.assertFalse(partitionState.getValue().equals("MASTER")); } } } controller.syncStop(); for (int i = 0; i < participantCount; i++) { _participants[i].syncStop(); } deleteCluster(_clusterName); }

Target:
public void testDisablingTopStateReplicaByDisablingInstance() throws Exception { int participantCount = 5; setupEnvironment(participantCount); setThrottleConfigForLoadBalance(); PropertyKey key = _accessor.keyBuilder().instanceConfig(_participants[0].getInstanceName()); InstanceConfig instanceConfig = _accessor.getProperty(key); instanceConfig.setInstanceEnabled(false); _accessor.setProperty(key, instanceConfig); ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0"); controller.syncStart(); Thread.sleep(500L); PropertyKey liveInstanceKey = _accessor.keyBuilder().liveInstance(_participants[0].getInstanceName()); LiveInstance liveInstance = _accessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); List<CurrentState> currentStates = _accessor.getChildValues( _accessor.keyBuilder().currentStates(_participants[0].getInstanceName(), sessionId), true); for (CurrentState currentState : currentStates) { for (Map.Entry<String, String> partitionState : currentState.getPartitionStateMap() .entrySet()) { Assert.assertFalse(partitionState.getValue().equals("MASTER")); } } } controller.syncStop(); for (int i = 0; i < participantCount; i++) { _participants[i].syncStop(); } deleteCluster(_clusterName); }
Source:
private static List<Integer> getIds(JSONObject params) throws ApiException { List<Integer> listIds = new ArrayList<>(); for (String id : params.getString(PARAM_IDS).split(",")) { String trimmedId = id.trim(); if (!trimmedId.isEmpty()) { try { listIds.add(Integer.parseInt(trimmedId)); } catch (NumberFormatException e) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, PARAM_IDS, e); } } } if (listIds.isEmpty()) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, PARAM_IDS); } return listIds; }

Target:
private static List<Integer> getIds(JSONObject params) throws ApiException { List<Integer> listIds = new ArrayList<>(); for (String id : params.getString(PARAM_IDS).split(",")) { try { listIds.add(Integer.valueOf(id.trim())); } catch (NumberFormatException e) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, PARAM_IDS, e); } } if (listIds.isEmpty()) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, PARAM_IDS); } return listIds; }
Source:
public static void processTimespan(Timespan agent, eu.europeana.corelib.edm.model.schemaorg.ContextualEntity timespanObject) { timespanObject.setId(agent.getAbout()); addMultilingualProperties(timespanObject, agent.getPrefLabel(), SchemaOrgConstants.PROPERTY_NAME); addMultilingualProperties(timespanObject, agent.getAltLabel(), SchemaOrgConstants.PROPERTY_ALTERNATE_NAME); addMultilingualProperties(timespanObject, agent.getNote(), SchemaOrgConstants.PROPERTY_DESCRIPTION); addTextProperties(timespanObject, toList(agent.getOwlSameAs()), SchemaOrgConstants.PROPERTY_SAME_AS); addTextProperties(timespanObject, toList(agent.getIsPartOfArray()), SchemaOrgConstants.PROPERTY_IS_PART_OF); addTextProperties(timespanObject, toList(agent.getIsNextInSequence()), SchemaOrgConstants.PROPERTY_NEXT_IN_SEQUENCE); addTextProperties(timespanObject, Arrays.asList(agent.getBeginString()), SchemaOrgConstants.PROPERTY_BEGIN_DATE); addTextProperties(timespanObject, Arrays.asList(agent.getEndString()), SchemaOrgConstants.PROPERTY_END_DATE); }

Target:
public static void processTimespan(Timespan agent, eu.europeana.corelib.edm.model.schemaorg.ContextualEntity timespanObject) { timespanObject.setId(agent.getAbout()); addMultilingualProperties(timespanObject, agent.getPrefLabel(), SchemaOrgConstants.PROPERTY_NAME); addMultilingualProperties(timespanObject, agent.getAltLabel(), SchemaOrgConstants.PROPERTY_ALTERNATE_NAME); addMultilingualProperties(timespanObject, agent.getNote(), SchemaOrgConstants.PROPERTY_DESCRIPTION); addTextProperties(timespanObject, toList(agent.getOwlSameAs()), SchemaOrgConstants.PROPERTY_SAME_AS); }
Source:
public ResultSet getTableTypes() throws SQLException { String types[] = new String[tableTypeClauses.size()]; int i = 0; for (String s : tableTypeClauses.keySet()) { types[i++] = s; } sortStringArray(types); Field f[] = new Field[1]; List<byte[][]> v = new ArrayList<byte[][]>(); f[0] = new Field("TABLE_TYPE", Oid.VARCHAR); for (String type : types) { byte[][] tuple = new byte[1][]; tuple[0] = connection.encodeString(type); v.add(tuple); } return ((BaseStatement) createMetaDataStatement()).createDriverResultSet(f, v); }

Target:
public ResultSet getTableTypes() throws SQLException { String types[] = tableTypeClauses.keySet().toArray(new String[0]); sortStringArray(types); Field f[] = new Field[1]; List<byte[][]> v = new ArrayList<byte[][]>(); f[0] = new Field("TABLE_TYPE", Oid.VARCHAR); for (String type : types) { byte[][] tuple = new byte[1][]; tuple[0] = connection.encodeString(type); v.add(tuple); } return ((BaseStatement) createMetaDataStatement()).createDriverResultSet(f, v); }
Source:
public void clearErrorStat() { hasException = true; this.updateCounts.remove((long) Statement.EXECUTE_FAILED); }

Target:
public void clearErrorStat() { hasException = false; this.updateCounts.remove((long) Statement.EXECUTE_FAILED); }
Source:
public double next() throws IOException { input.readFully(buffer, 0, (int) SIZE_OF_DOUBLE); return slice.getDouble(0); }

Target:
public double next() throws IOException { input.readFully(buffer, 0, SIZE_OF_DOUBLE); return slice.getDouble(0); }
Source:
public void shutdown() { executor.shutdown(); try { if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { LOGGER.debug("One minute passed, saving still not completed. Trying forced shutdown."); executor.shutdownNow(); if (executor.awaitTermination(60, TimeUnit.SECONDS)) { LOGGER.debug("One minute passed again - forced shutdown worked."); } else { LOGGER.error("DelayedTaskThrottler did not terminate"); } } } catch (InterruptedException ie) { executor.shutdownNow(); Thread.currentThread().interrupt(); } }

Target:
public void shutdown() { JabRefExecutorService.gracefullyShutdown(executor); }
Source:
private void updateServer(IServerWorkingCopy server) throws OpenShiftException { String connectionUrl = getConnectionUrl(getConnection()); String baseServerName = OpenShiftServerUtils.getServerName(getService(), getConnection()); String serverName = ServerUtils.getServerName(baseServerName); String routeURL = isSelectDefaultRoute() && getRoute() != null ? getRoute().getURL() : null; OpenShiftServerUtils.updateServer( serverName, connectionUrl, getService(), sourcePath, podPath, deployProject, routeURL, server); String profile = getProfileId(); ServerProfileModel.setProfile(server, profile); OpenShiftServerUtils.updateServerProject( connectionUrl, getService(), sourcePath, podPath, routeURL, deployProject); IModule[] matchingModules = ServerUtil.getModules(deployProject); try { server.modifyModules(matchingModules, new IModule[]{}, new NullProgressMonitor()); } catch(CoreException ce) { throw new OpenShiftException(ce, "Could not get add modules to server ", server.getName()); } }

Target:
private void updateServer(IServerWorkingCopy server) throws OpenShiftException { String connectionUrl = getConnectionUrl(getConnection()); String baseServerName = OpenShiftServerUtils.getServerName(getService(), getConnection()); String serverName = ServerUtils.getServerName(baseServerName); String routeURL = isSelectDefaultRoute() && getRoute() != null ? getRoute().getURL() : null; OpenShiftServerUtils.updateServer( serverName, connectionUrl, getService(), sourcePath, podPath, deployProject, routeURL, server); String profile = getProfileId(); ServerProfileModel.setProfile(server, profile); OpenShiftServerUtils.updateServerProject( connectionUrl, getService(), sourcePath, podPath, routeURL, deployProject); IModule[] matchingModules = ServerUtil.getModules(deployProject); if( matchingModules != null && matchingModules.length > 0) { try { server.modifyModules(matchingModules, new IModule[]{}, new NullProgressMonitor()); } catch(CoreException ce) { throw new OpenShiftException(ce, "Could not get add modules to server ", server.getName()); } } }
Source:
public CapInfoDTO(List<String> resources, List<String> areas) { this.resources = ImmutableList.copyOf(resources); this.areas = ImmutableList.copyOf(areas); }

Target:
CapInfoDTO(List<String> resources, List<String> areas) { this.resources = ImmutableList.copyOf(resources); this.areas = ImmutableList.copyOf(areas); }
Source:
private int deleteTokensOlderThanSpecifiedDate() { ZonedDateTime cut_off_date = ZonedDateTime.now(ZoneId.of("UTC")).plusDays(DAYS_TILL_EXPIRY); return tokenDao.deleteTokensOlderThanSpecifiedDate(cut_off_date); }

Target:
private int deleteTokensOlderThanSpecifiedDate() { ZonedDateTime cutOffDate = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(TOKEN_EXPIRY_DAYS); return tokenDao.deleteTokensOlderThanSpecifiedDate(cutOffDate); }
Source:
public List<Diagnosis> getUniqueDiagnoses(Patient patient, Date fromDate) { List<Diagnosis> diagnoses = getDiagnoses(patient, fromDate); Set<Diagnosis> uniqueDiagnoses = new HashSet<Diagnosis>(); uniqueDiagnoses.addAll(diagnoses); return new ArrayList<>(uniqueDiagnoses); }

Target:
public List<Diagnosis> getUniqueDiagnoses(Patient patient, Date fromDate) { List<Diagnosis> diagnoses = getDiagnoses(patient, fromDate); Set<CodedOrFreeText> answers = new HashSet<CodedOrFreeText>(); Iterator<Diagnosis> iterator = diagnoses.iterator(); while(iterator.hasNext()) { Diagnosis diagnosis = iterator.next(); if (!answers.add(diagnosis.getDiagnosis())) { iterator.remove(); } } return diagnoses; }
Source:
public Iterable<TestingSchedulingExecutionVertex> getVertices() { return regionVertices.values(); }

Target:
public Iterable<TestingSchedulingExecutionVertex> getVertices() { return Collections.unmodifiableCollection(regionVertices.values()); }
Source:
public Response undeployApplication(int applicationId) { Response response = delete(uri, APPLICATIONS + "/" + applicationId); validateStatusSuccess(response); return response; }

Target:
public String undeployApplication(int applicationId) { Response response = delete(uri, APPLICATIONS + "/" + applicationId); validateStatusSuccess(response); return response.readEntity(String.class); }
Source:
private static String sanitizeNoProxy(String noProxyString) { return sanitizeNonProxyHosts(noProxyString.split(",")); }

Target:
private static String sanitizeNoProxy(String noProxyString) { String[] nonProxyHosts = noProxyString.split(","); for (int i = 0; i < nonProxyHosts.length; i++) { String prefixWildcard = ""; String suffixWildcard = ""; String body = nonProxyHosts[i]; if (body.startsWith(".*")) { prefixWildcard = ".*"; body = body.substring(2); } else if (body.startsWith("*") || body.startsWith(".")) { prefixWildcard = ".*"; body = body.substring(1); } if (body.endsWith(".*")) { suffixWildcard = ".*"; body = body.substring(0, body.length() - 2); } else if (body.endsWith("*") || body.endsWith(".")) { suffixWildcard = ".*"; body = body.substring(0, body.length() - 1); } nonProxyHosts[i] = prefixWildcard + Pattern.quote(body) + suffixWildcard; } return String.join("|", nonProxyHosts); }
Source:
private static void serializeIdentity(final PreSharedKeyIdentity principal, final DatagramWriter writer) { writer.writeByte(ClientAuthenticationType.PSK.code); if (principal.isScopedIdentity()) { writer.writeByte((byte) 1); byte[] virtualHost = principal.getVirtualHost() == null ? EMPTY_BYTE_ARRAY : principal.getVirtualHost().getBytes(StandardCharsets.UTF_8); writeBytesWithLength(PSK_LENGTH_BITS, virtualHost, writer); writeBytesWithLength(PSK_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); } else { writer.writeByte((byte) 0); writeBytesWithLength(PSK_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); } }

Target:
private static void serializeIdentity(final PreSharedKeyIdentity principal, final DatagramWriter writer) { writer.writeByte(ClientAuthenticationType.PSK.code); if (principal.isScopedIdentity()) { writer.writeByte((byte) 1); byte[] virtualHost = principal.getVirtualHost() == null ? EMPTY_BYTE_ARRAY : principal.getVirtualHost().getBytes(StandardCharsets.UTF_8); writeBytesWithLength(PSK_HOSTNAME_LENGTH_BITS, virtualHost, writer); writeBytesWithLength(PSK_IDENTITY_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); } else { writer.writeByte((byte) 0); writeBytesWithLength(PSK_IDENTITY_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); } }
Source:
public static int getContainerFromTaskTid(ITmfStateSystemBuilder ssb, int taskTid) { int rootQuark = getRootContainerQuark(ssb); int parentContainerQuark = fCONTAINER_QUARK_NOT_FOUND; try { List<Integer> VTIDsSection = ssb.getSubAttributes(rootQuark, true, ContainerAttributes.CONTAINER_TASKS); if (VTIDsSection.size() >= 1) { for (Integer quarkVTIDsSection : VTIDsSection) { List<Integer> VTIDs = ssb.getSubAttributes(quarkVTIDsSection, false); for (Integer quarkVTid : VTIDs) { int real_tid_quark = ssb.getQuarkRelative(quarkVTid, ContainerAttributes.REAL_TID); int tid_in_container = ssb.queryOngoingState(real_tid_quark).unboxInt(); if (taskTid == tid_in_container) { parentContainerQuark = ssb.getParentAttributeQuark(quarkVTid); parentContainerQuark = ssb.getParentAttributeQuark(parentContainerQuark); break; } } } } } catch (AttributeNotFoundException e) { e.printStackTrace(); } return parentContainerQuark; }

Target:
public static int getContainerFromTaskTid(ITmfStateSystemBuilder ssb, int taskTid) { int rootQuark = getRootContainerQuark(ssb); int parentContainerQuark = CONTAINER_QUARK_NOT_FOUND; try { List<Integer> vtidSection = ssb.getSubAttributes(rootQuark, true, ContainerAttributes.CONTAINER_TASKS); if (!vtidSection.isEmpty()) { for (Integer quarkVTIDSection : vtidSection) { List<Integer> VTIDs = ssb.getSubAttributes(quarkVTIDSection, false); for (Integer quarkVTid : VTIDs) { int real_tid_quark = ssb.getQuarkRelative(quarkVTid, ContainerAttributes.REAL_TID); int tid_in_container = ssb.queryOngoingState(real_tid_quark).unboxInt(); if (taskTid == tid_in_container) { parentContainerQuark = ssb.getParentAttributeQuark(quarkVTid); parentContainerQuark = ssb.getParentAttributeQuark(parentContainerQuark); return parentContainerQuark; } } } } } catch (AttributeNotFoundException e) { throw new IllegalStateException(); } return parentContainerQuark; }
Source:
public void onPartitionBecomeOfflineFromInactive(String partitionName) { PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); if (replicationManagerListener != null) { try { replicationManagerListener.onPartitionBecomeOfflineFromInactive(partitionName); replicaSyncUpManager.waitDisconnectionCompleted(partitionName); } catch (InterruptedException e) { logger.error("Disconnection was interrupted on partition {}", partitionName); participantMetrics.inactiveCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw new StateTransitionException("Disconnection failed or was interrupted", DisconnectionFailure); } catch (StateTransitionException e) { logger.error("Disconnection didn't complete ", e); participantMetrics.inactiveCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw e; } } PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { try { storageManagerListener.onPartitionBecomeOfflineFromInactive(partitionName); } catch (Exception e) { participantMetrics.inactiveCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw e; } } participantMetrics.inactiveCount.addAndGet(-1); participantMetrics.offlineCount.addAndGet(1); }

Target:
public void onPartitionBecomeOfflineFromInactive(String partitionName) { PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); try { if (replicationManagerListener != null) { replicationManagerListener.onPartitionBecomeOfflineFromInactive(partitionName); replicaSyncUpManager.waitDisconnectionCompleted(partitionName); } PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { storageManagerListener.onPartitionBecomeOfflineFromInactive(partitionName); } } catch (InterruptedException e) { logger.error("Disconnection was interrupted on partition {}", partitionName); participantMetrics.errorStateCount.addAndGet(1); throw new StateTransitionException("Disconnection failed or was interrupted", DisconnectionFailure); } catch (StateTransitionException e) { logger.error("Exception occurred during Inactive-To-Offline transition ", e); participantMetrics.errorStateCount.addAndGet(1); throw e; } finally { participantMetrics.inactiveCount.addAndGet(-1); } participantMetrics.offlineCount.addAndGet(1); }
Source:
private void findAllOccurrences(TreeItem item, Object element, ArrayList<TreeItem> list) { if (element.equals(item.getData())) { list.add(item); } for (TreeItem item2 : item.getItems()) { findAllOccurrences(item2, element, list); } }

Target:
private void findAllOccurrences(TreeItem item, Object element, ArrayList<TreeItem> list) { if (element.equals(item.getData())) { list.add(item); } for (TreeItem childItem : item.getItems()) { findAllOccurrences(childItem, element, list); } }
Source:
public void setFile(AbstractFile file) { try { if (file == null) { resetComponent(); return; } if (file.equals(lastFile)) { return; } lastFile = file; if (mediaPlayerPanelInited && mediaPlayerPanel.isSupported(file)) { mediaPlayerPanel.loadFile(file); this.showVideoPanel(); } else if (imagePanelInited && imagePanel.isSupported(file)) { imagePanel.showImageFx(file); this.showImagePanel(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception while setting node", e); } }

Target:
public void setFile(AbstractFile file) { try { if (file == null) { resetComponent(); return; } if (file.equals(lastFile)) { return; } lastFile = file; if (mediaPlayerPanel != null && mediaPlayerPanel.isSupported(file)) { mediaPlayerPanel.loadFile(file); this.showVideoPanel(); } else if (imagePanelInited && imagePanel.isSupported(file)) { imagePanel.showImageFx(file); this.showImagePanel(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception while setting node", e); } }
Source:
public void should_instanciate_a_process_with_given_inputs_for_a_specific_user() throws Exception { final Map<String, Serializable> expectedComplexInput = aComplexInput(); when(processAPI.startProcessWithInputs(1L, PROCESS_DEFINITION_ID, expectedComplexInput)).thenReturn(new ProcessInstanceImpl("complexProcessInstance")); when(processAPI.getProcessContract(PROCESS_DEFINITION_ID)).thenReturn(contractDefinition); final Response response = request(URL_API_PROCESS_INSTANTIATION_TEST_WITH_USER).post(VALID_COMPLEX_POST_BODY); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response.getEntityAsText()) .isEqualTo( "{\"processInstanceId\":0}"); verify(processAPI).startProcessWithInputs(1L, PROCESS_DEFINITION_ID, expectedComplexInput); verify(processAPI, times(0)).startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput); }

Target:
public void should_instanciate_a_process_with_given_inputs_for_a_specific_user() throws Exception { final Map<String, Serializable> expectedComplexInput = aComplexInput(); when(processAPI.startProcessWithInputs(1L, PROCESS_DEFINITION_ID, expectedComplexInput)).thenReturn(new ProcessInstanceImpl("complexProcessInstance")); when(processAPI.getProcessContract(PROCESS_DEFINITION_ID)).thenReturn(contractDefinition); final Response response = request(URL_API_PROCESS_INSTANTIATION_TEST_WITH_USER).post(VALID_COMPLEX_POST_BODY); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response.getEntityAsText()) .isEqualTo( "{\"caseId\":0}"); verify(processAPI).startProcessWithInputs(1L, PROCESS_DEFINITION_ID, expectedComplexInput); verify(processAPI, times(0)).startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput); }
Source:
private static boolean isSelectedCategory(CustomXmlTraceDefinition[] customXmlTraceDefinitions, Set<String> selectedTraceTypes) { for (CustomXmlTraceDefinition def : customXmlTraceDefinitions) { String traceTypeId = CustomXmlTrace.class.getCanonicalName() + ":" + def.definitionName; if (selectedTraceTypes.contains(traceTypeId)) { return true; } } return false; }

Target:
private static boolean isSelectedCategory(CustomXmlTraceDefinition[] customXmlTraceDefinitions, Set<String> selectedTraceTypes) { for (CustomXmlTraceDefinition def : customXmlTraceDefinitions) { String traceTypeId = CustomXmlTrace.class.getCanonicalName() + ':' + def.definitionName; if (selectedTraceTypes.contains(traceTypeId)) { return true; } } return false; }
Source:
public void startup() { this.tileRendererManager = new TileRendererManager(this.graph); this.defaultRoutingRequest = routerConfig.routingRequestDefaults(); if (routerConfig.requestLogFile() != null) { this.requestLogger = createLogger(routerConfig.requestLogFile()); LOG.info("Logging incoming requests at '{}'", routerConfig.requestLogFile()); } else { LOG.info("Incoming requests will not be logged."); } LOG.info("Creating transit layer for Raptor routing."); if (graph.hasTransit && graph.index != null) { graph.setTransitLayer(TransitLayerMapper.map(routerConfig.transitTuningParameters(), graph)); graph.setRealtimeTransitLayer(new TransitLayer(graph.getTransitLayer())); graph.transitLayerUpdater = new TransitLayerUpdater( graph, graph.index.getServiceCodesRunningForDate() ); } else { LOG.warn("Cannot create Raptor data, that requires the graph to have transit data and be indexed."); } GraphUpdaterConfigurator.setupGraph( this.graph, routerConfig.updaterConfig(), routerConfig.getBikeShareUpdaterEndpoint() ); try { WorldEnvelope env = graph.getEnvelope(); double lat = (env.getLowerLeftLatitude() + env.getUpperRightLatitude()) / 2; double lon = (env.getLowerLeftLongitude() + env.getUpperRightLongitude()) / 2; graph.ellipsoidToGeoidDifference = ElevationUtils.computeEllipsoidToGeoidDifference(lat, lon); LOG.info("Computed ellipsoid/geoid offset at (" + lat + ", " + lon + ") as " + graph.ellipsoidToGeoidDifference); } catch (Exception e) { LOG.error("Error computing ellipsoid/geoid difference"); } }

Target:
public void startup() { this.tileRendererManager = new TileRendererManager(this.graph); this.defaultRoutingRequest = routerConfig.routingRequestDefaults(); if (routerConfig.requestLogFile() != null) { this.requestLogger = createLogger(routerConfig.requestLogFile()); LOG.info("Logging incoming requests at '{}'", routerConfig.requestLogFile()); } else { LOG.info("Incoming requests will not be logged."); } LOG.info("Creating transit layer for Raptor routing."); if (graph.hasTransit && graph.index != null) { graph.setTransitLayer(TransitLayerMapper.map(routerConfig.transitTuningParameters(), graph)); graph.setRealtimeTransitLayer(new TransitLayer(graph.getTransitLayer())); graph.transitLayerUpdater = new TransitLayerUpdater( graph, graph.index.getServiceCodesRunningForDate() ); } else { LOG.warn("Cannot create Raptor data, that requires the graph to have transit data and be indexed."); } GraphUpdaterConfigurator.setupGraph( this.graph, routerConfig.updaterConfig(), routerConfig.getBikeRentalServiceDirectoryUrl() ); try { WorldEnvelope env = graph.getEnvelope(); double lat = (env.getLowerLeftLatitude() + env.getUpperRightLatitude()) / 2; double lon = (env.getLowerLeftLongitude() + env.getUpperRightLongitude()) / 2; graph.ellipsoidToGeoidDifference = ElevationUtils.computeEllipsoidToGeoidDifference(lat, lon); LOG.info("Computed ellipsoid/geoid offset at (" + lat + ", " + lon + ") as " + graph.ellipsoidToGeoidDifference); } catch (Exception e) { LOG.error("Error computing ellipsoid/geoid difference"); } }
Source:
private Set<Feature> determineEnabledFeatures(TableViewerSWTCustomization<V> customization) { final Set<Feature> enabled = new LinkedHashSet<Feature>(); enabled.addAll(customization.getTableConfiguration().getEnabledFeatures()); for (final ColumnConfiguration columnConfig : customization.getConfiguredColumns()) { enabled.addAll(columnConfig.getEnabledFeatures()); } return enabled; }

Target:
private Set<Feature> determineEnabledFeatures(TableViewerSWTCustomization<V> customization) { final Set<Feature> enabled = new LinkedHashSet<Feature>(); enabled.addAll(customization.getTableConfiguration().getEnabledFeatures()); for (final ColumnConfiguration columnConfig : customization.getColumnConfigurations()) { enabled.addAll(columnConfig.getEnabledFeatures()); } return enabled; }
Source:
public static IStatus validateRefName(String refNameInput, final Repository repo, final String refPrefix, final boolean errorOnEmptyName) { if (refNameInput.isEmpty()) { if (errorOnEmptyName) return new Status(ERROR, Activator.getPluginId(), CoreText.ValidationUtils_PleaseEnterNameMessage); else return OK_STATUS; } String testFor = refPrefix + refNameInput; if (!Repository.isValidRefName(testFor)) return new Status(ERROR, Activator.getPluginId(), NLS.bind( CoreText.ValidationUtils_InvalidRefNameMessage, testFor)); try { if (repo.resolve(testFor) != null) return new Status(ERROR, Activator.getPluginId(), NLS.bind( CoreText.ValidationUtils_RefAlreadyExistsMessage, testFor)); RefDatabase refDatabase = repo.getRefDatabase(); Collection<String> conflictingNames = refDatabase .getConflictingNames(testFor); if (!conflictingNames.isEmpty()) { String joined = conflictingNames.stream().sorted() .collect(joining(", ")); return new Status(ERROR, Activator.getPluginId(), NLS.bind( CoreText.ValidationUtils_RefNameConflictsWithExistingMessage, joined)); } } catch (IOException e) { return Activator.error(e.getMessage(), e); } catch (RevisionSyntaxException e) { String m = MessageFormat .format(CoreText.ValidationUtils_InvalidRevision, testFor); return Activator.error(m, e); } return OK_STATUS; }

Target:
public static IStatus validateRefName(String refNameInput, final Repository repo, final String refPrefix, final boolean errorOnEmptyName) { if (refNameInput.isEmpty()) { if (errorOnEmptyName) { return Activator.error( CoreText.ValidationUtils_PleaseEnterNameMessage, null); } else { return OK_STATUS; } } String testFor = refPrefix + refNameInput; if (!Repository.isValidRefName(testFor)) return Activator.error(MessageFormat.format( CoreText.ValidationUtils_InvalidRefNameMessage, testFor), null); try { if (repo.resolve(testFor) != null) return Activator.error(MessageFormat.format( CoreText.ValidationUtils_RefAlreadyExistsMessage, testFor), null); RefDatabase refDatabase = repo.getRefDatabase(); Collection<String> conflictingNames = refDatabase .getConflictingNames(testFor); if (!conflictingNames.isEmpty()) { String joined = conflictingNames.stream().sorted() .collect(joining(", ")); return Activator.error(MessageFormat.format( CoreText.ValidationUtils_RefNameConflictsWithExistingMessage, joined), null); } } catch (IOException e) { return Activator.error(e.getMessage(), e); } catch (RevisionSyntaxException e) { String m = MessageFormat .format(CoreText.ValidationUtils_InvalidRevision, testFor); return Activator.error(m, e); } return OK_STATUS; }
Source:
public int getFlags() { for (LazyFlag flag : LazyFlag.values()) { if (initializedFlags.contains(flag)) { continue; } FlagGetter flagGetter = lazyFlagsGetters.get(flag); if (flagGetter == null) { throw new RuntimeException("No flag " + flag + " getter specified"); } try { if (flagGetter.canCallOnNotPaired || getReadPairedFlag()) { this.getClass().getMethod(flagGetter.getterName).invoke(this); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } return super.getFlags(); }

Target:
public int getFlags() { for (LazyFlag flag : LazyFlag.values()) { if (initializedFlags.contains(flag)) { continue; } if (flag.canCallOnNotPaired() || getReadPairedFlag()) { flag.getFlag(this); } } return super.getFlags(); }
Source:
private OpenTok(int apiKey, String apiSecret, HttpClient httpClient) { this.apiKey = apiKey; this.apiSecret = apiSecret; this.client=httpClient; }

Target:
private OpenTok(int apiKey, String apiSecret, HttpClient httpClient) { this.apiKey = apiKey; this.apiSecret = apiSecret.trim(); this.client = httpClient; }
Source:
private TypeConfigurator(Class<? extends EnvironmentType> type) { this.se = instance(); if (CustomEnvironmentType.class.isAssignableFrom(type)) { @SuppressWarnings("unchecked") Class<? extends CustomEnvironmentType> customType = (Class<? extends CustomEnvironmentType>) type; Environment.instance() .register(customType); } this.type = checkNotNull(type); }

Target:
private TypeConfigurator(Class<? extends EnvironmentType> type) { this.se = instance(); if (CustomEnvironmentType.class.isAssignableFrom(type)) { registerCustomType(type); } this.type = checkNotNull(type); }
Source:
public MentionsFormatter get(String type) { String hint = type; if (type == null) { hint = "user"; } MentionsFormatter ret; try { ret = this.componentManager.getInstance(MentionsFormatter.class, hint); } catch (ComponentLookupException e) { this.logger .debug("Unable to find a formatter with type [{}]. Fallback to the default formatter. Cause: [{}]", type, getRootCauseMessage(e)); ret = this.defaultFormatter; } return ret; }

Target:
public MentionsFormatter get(String type) { String hint = type; if (StringUtils.isEmpty(type)) { hint = USER_MENTION_TYPE; } MentionsFormatter ret; try { ret = this.componentManager.getInstance(MentionsFormatter.class, hint); } catch (ComponentLookupException e) { this.logger .debug("Unable to find a formatter with type [{}]. Fallback to the default formatter. Cause: [{}]", type, getRootCauseMessage(e)); ret = this.defaultFormatter; } return ret; }
Source:
public void registerPill(@Scope(OAuthScope.ADMINISTRATION_WRITE) final AccessToken accessToken, @Valid final PillRegistration pillRegistration) { try { final Long trackerId = deviceDAO.registerTracker(accessToken.accountId, pillRegistration.pillId); LOGGER.info("Account registered pill with internal id = {}", accessToken.accountId, pillRegistration.pillId, trackerId); final List<DeviceAccountPair> sensePairedWithAccount = this.deviceDAO.getSensesForAccountId(accessToken.accountId); if(sensePairedWithAccount.size() == 0){ LOGGER.error("No sense paired with account {}", accessToken.accountId); throw new WebApplicationException(Response.Status.BAD_REQUEST); }else { final String senseId = sensePairedWithAccount.get(0).externalDeviceId; this.mergedUserInfoDynamoDB.setNextPillColor(senseId, accessToken.accountId, pillRegistration.pillId); } return; } catch (UnableToExecuteStatementException exception) { final Matcher matcher = MatcherPatternsDB.PG_UNIQ_PATTERN.matcher(exception.getMessage()); if(matcher.find()) { LOGGER.error("Failed to register pill for account id = and pill id = : {}", accessToken.accountId, pillRegistration.pillId, exception.getMessage()); throw new WebApplicationException(Response.status(Response.Status.CONFLICT) .entity(new JsonError(409, "Pill already exists for this account.")).build()); } } catch (AmazonServiceException awsEx){ LOGGER.error("Set pill color failed for pill {}, error: {}", pillRegistration.pillId, awsEx.getMessage()); } throw new WebApplicationException(Response.Status.BAD_REQUEST); }

Target:
public void registerPill(@Scope(OAuthScope.ADMINISTRATION_WRITE) final AccessToken accessToken, @Valid final PillRegistration pillRegistration) { try { final Long trackerId = deviceDAO.registerTracker(accessToken.accountId, pillRegistration.pillId); LOGGER.info("Account registered pill with internal id = {}", accessToken.accountId, pillRegistration.pillId, trackerId); final List<DeviceAccountPair> sensePairedWithAccount = this.deviceDAO.getSensesForAccountId(accessToken.accountId); if(sensePairedWithAccount.size() == 0){ LOGGER.error("No sense paired with account {}", accessToken.accountId); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final String senseId = sensePairedWithAccount.get(0).externalDeviceId; this.mergedUserInfoDynamoDB.setNextPillColor(senseId, accessToken.accountId, pillRegistration.pillId); return; } catch (UnableToExecuteStatementException exception) { final Matcher matcher = MatcherPatternsDB.PG_UNIQ_PATTERN.matcher(exception.getMessage()); if(matcher.find()) { LOGGER.error("Failed to register pill for account id = and pill id = : {}", accessToken.accountId, pillRegistration.pillId, exception.getMessage()); throw new WebApplicationException(Response.status(Response.Status.CONFLICT) .entity(new JsonError(409, "Pill already exists for this account.")).build()); } } catch (AmazonServiceException awsEx){ LOGGER.error("Set pill color failed for pill {}, error: {}", pillRegistration.pillId, awsEx.getMessage()); } throw new WebApplicationException(Response.Status.BAD_REQUEST); }
Source:
private void validateCloudLocationScheme(String cloudPlatform, String location, ValidationResult.ValidationResultBuilder resultBuilder) { try { URI uri = new URI(location); if (AWS.equalsIgnoreCase(cloudPlatform)) { if (uri.getScheme() != null) { Matcher matcher = Pattern.compile(AWS_PATTERN, Pattern.CASE_INSENSITIVE).matcher(uri.getScheme()); if (!matcher.find()) { resultBuilder.error("Incorrect URL scheme for AWS cloud platform: " + location); } } } else if (AZURE.equalsIgnoreCase(cloudPlatform)) { if (uri.getScheme() != null) { Matcher matcher = Pattern.compile(AZURE_PATTERN, Pattern.CASE_INSENSITIVE).matcher(uri.getScheme()); if (!matcher.find()) { resultBuilder.error("Incorrect URL scheme for Azure cloud platform: " + location); } } } else { resultBuilder.error("Cloud platform " + cloudPlatform + " not supported for backup/restore"); } } catch (URISyntaxException e) { resultBuilder.error("Unable to parse URI for location: " + location); } }

Target:
private void validateCloudLocationScheme(String cloudPlatform, String location, ValidationResult.ValidationResultBuilder resultBuilder) { try { URI uri = new URI(location); if (AWS.equalsIgnoreCase(cloudPlatform)) { if (uri.getScheme() != null) { Matcher matcher = AWS_PATTERN.matcher(uri.getScheme()); if (!matcher.find()) { resultBuilder.error("Incorrect URL scheme for AWS cloud platform: " + location); } } } else if (AZURE.equalsIgnoreCase(cloudPlatform)) { if (uri.getScheme() != null) { Matcher matcher = AZURE_PATTERN.matcher(uri.getScheme()); if (!matcher.find()) { resultBuilder.error("Incorrect URL scheme for Azure cloud platform: " + location); } } } else { resultBuilder.error("Cloud platform " + cloudPlatform + " not supported for backup/restore"); } } catch (URISyntaxException e) { resultBuilder.error("Unable to parse URI for location: " + location); } }
Source:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { svm.clearInvalidations(); if (ctx.isOriginLocal() && !isLocalModeForced(command)) { if (!isSynchronous(command)) { rpcManager.sendToAll(command, DeliverOrder.PER_SENDER); return invokeNextThenAccept(ctx, command, clearHandler); } RpcOptions rpcOptions = rpcManager.getSyncRpcOptions(); MapResponseCollector collector = MapResponseCollector.ignoreLeavers(); return makeStage(asyncInvokeNext(ctx, command, rpcManager.invokeCommandOnAll(command, collector, rpcOptions))) .thenAccept(ctx, command, clearHandler); } else { return invokeNextThenAccept(ctx, command, clearHandler); } }

Target:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { svm.clearInvalidations(); if (ctx.isOriginLocal() && !isLocalModeForced(command)) { if (isSynchronous(command)) { RpcOptions rpcOptions = rpcManager.getSyncRpcOptions(); MapResponseCollector collector = MapResponseCollector.ignoreLeavers(); return makeStage( asyncInvokeNext(ctx, command, rpcManager.invokeCommandOnAll(command, collector, rpcOptions))) .thenAccept(ctx, command, clearHandler); } else { rpcManager.sendToAll(command, DeliverOrder.PER_SENDER); return invokeNextThenAccept(ctx, command, clearHandler); } } else { return invokeNextThenAccept(ctx, command, clearHandler); } }
Source:
public static Object withBundle(Bundle aBundle, RunnableWithException aCode, List<URL> additionalURLs) throws RuntimeException { if (Thread.currentThread().isInterrupted() || CCWPlugin.canLoadCodeInBundle()) { return null; } initialize(); DynamicClassLoader loader = getDynamicClassLoader(aBundle, additionalURLs); IPersistentMap bindings = RT.map(Compiler.LOADER, loader); bindings = bindings.assoc(RT.USE_CONTEXT_CLASSLOADER, true); boolean pushed = true; ClassLoader saved = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(loader); try { Var.pushThreadBindings(bindings); } catch (RuntimeException aEx) { pushed = false; throw aEx; } return aCode.run(); } catch (Exception e) { String msg = "Exception while executing code from bundle " + aBundle.getSymbolicName(); CCWPlugin.getTracer().trace(TraceOptions.CLOJURE_OSGI, e, msg); throw new RuntimeException(msg, e); } finally { if (pushed) { Var.popThreadBindings(); } Thread.currentThread().setContextClassLoader(saved); } }

Target:
public static Object withBundle(Bundle aBundle, RunnableWithException aCode, List<URL> additionalURLs) throws RuntimeException { if (Thread.currentThread().isInterrupted() || !CCWPlugin.canLoadCodeInBundle()) { return null; } initialize(); DynamicClassLoader loader = getDynamicClassLoader(aBundle, additionalURLs); IPersistentMap bindings = RT.map(Compiler.LOADER, loader); bindings = bindings.assoc(RT.USE_CONTEXT_CLASSLOADER, true); boolean pushed = true; ClassLoader saved = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(loader); try { Var.pushThreadBindings(bindings); } catch (RuntimeException aEx) { pushed = false; throw aEx; } return aCode.run(); } catch (Exception e) { String msg = "Exception while executing code from bundle " + aBundle.getSymbolicName(); CCWPlugin.getTracer().trace(TraceOptions.CLOJURE_OSGI, e, msg); throw new RuntimeException(msg, e); } finally { if (pushed) { Var.popThreadBindings(); } Thread.currentThread().setContextClassLoader(saved); } }
Source:
private static ExprEval evalAsString(ExprEval eval) { String stringValue = eval.asString(); if (stringValue == null) { return eval; } try { long longValue = Long.parseLong(stringValue); return evalLong(longValue); } catch (NumberFormatException ignored) { } return ExprEval.of(IPv4AddressExprUtils.extractIPv4Address(stringValue)); }

Target:
private static ExprEval evalAsString(ExprEval eval) { if (IPv4AddressExprUtils.isValidAddress(eval.asString())) { return eval; } return ExprEval.of(null); }
Source:
public KnoxShellTable lessThanOrEqualTo(Comparable<? extends Object> comparable) throws KnoxShellTableFilterException { return filter(s -> s.compareTo(comparable) < 0 || s.compareTo(comparable) == 0); }

Target:
public KnoxShellTable lessThanOrEqualTo(Comparable<? extends Object> comparable) throws KnoxShellTableFilterException { return filter(s -> s.compareTo(comparable) < 0 || s.equals(comparable)); }
Source:
public Mono<Response<IndexDocumentsResult>> uploadDocumentsWithResponse(Iterable<?> documents) { return withContext(context -> uploadDocumentsWithResponse(documents, context)); }

Target:
public Mono<Response<IndexDocumentsResult>> uploadDocumentsWithResponse(Iterable<?> documents) { try { return withContext(context -> uploadDocumentsWithResponse(documents, context)); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public List<Double> getAverageOrderingOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { return getAverage("SELECT AVG(t.ordering) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = " + projectId + " GROUP BY t.title ORDER BY t.ordering"); }

Target:
public List<Double> getAverageOrderingOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { Map<String, Object> parameters = new HashMap<>(); parameters.put("projectId", projectId); return getAverage("SELECT AVG(t.ordering) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = :projectId GROUP BY t.title ORDER BY t.ordering", parameters); }
Source:
public VCFIterator open(final File file) throws IOException { IOUtil.assertFileIsReadable(file); return open(new FileInputStream(file)); }

Target:
public VCFIterator open(final File file) throws IOException { return this.open(file.toPath()); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_profile); ButterKnife.bind(this); firstNameInput = (TextInputEditText) firstNameWrapper.getEditText(); lastNameInput = (TextInputEditText) lastNameWrapper.getEditText(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); editProfileActivityViewModel = ViewModelProviders.of(this).get(EditProfileActivityViewModel.class); editProfileActivityViewModel.getUser().observe(this, user -> { this.user = user; showUserData(user); }); avatar.setOnClickListener(v -> showFileChooser()); save.setOnClickListener(v -> { Views.hideKeyboard(this, this.getCurrentFocus()); saveChanges(); }); ActivityCompat.requestPermissions(EditProfileActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},1); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_profile); ButterKnife.bind(this); firstNameInput = (TextInputEditText) firstNameWrapper.getEditText(); lastNameInput = (TextInputEditText) lastNameWrapper.getEditText(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); editProfileActivityViewModel = ViewModelProviders.of(this).get(EditProfileActivityViewModel.class); editProfileActivityViewModel.getUser().observe(this, user -> { this.user = user; showUserData(user); }); permissionGranted = checkReadExternalPermission(); avatar.setOnClickListener(v -> { if (permissionGranted) { showFileChooser(); } else { ActivityCompat.requestPermissions(EditProfileActivity.this, READ_STORAGE, REQUEST_CODE); } }); save.setOnClickListener(v -> { Views.hideKeyboard(this, this.getCurrentFocus()); saveChanges(); }); }
Source:
public void hashcodeTest() { VariantDeclaration a = new VariantDeclaration(); VariantDeclaration b = new VariantDeclaration(); b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); VariantDeclaration c = new VariantDeclaration(); c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); assertEquals(fixture.hashCode(), a.hashCode()); assertEquals(b.hashCode(), c.hashCode()); }

Target:
public void hashcodeTest() { VariantDeclaration a = new VariantDeclaration(); assertEquals(fixture.hashCode(), a.hashCode()); VariantDeclaration b = new VariantDeclaration(); b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); VariantDeclaration c = new VariantDeclaration(); c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); assertEquals(b.hashCode(), c.hashCode()); }