auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull() || json.getAsString().isEmpty()) { return null; } String dateAsString = json.getAsJsonPrimitive().getAsString().replaceAll("Z$", "+0000"); ParseException e = null; for (SimpleDateFormat format : dateFormatters) { try { return format.parse(dateAsString); } catch (ParseException e1) { e = e1; } } Pattern isJustNumber = Pattern.compile("^\\d+$"); Matcher foundMatch = isJustNumber.matcher(dateAsString); if (foundMatch.find()) { Long time_t = Long.parseLong(dateAsString); Long msCheck = 1000000000000L; if (time_t > msCheck) { time_t = time_t / 1000; } return new Date(time_t); } LOG.log(Level.SEVERE, "Error parsing: " + dateAsString, e); return null; }

Target:
public synchronized Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull() || json.getAsString().isEmpty()) { return null; } String dateAsString = json.getAsJsonPrimitive().getAsString().replaceAll("Z$", "+0000"); ParseException e = null; for (SimpleDateFormat format : dateFormatters) { try { return format.parse(dateAsString); } catch (ParseException e1) { e = e1; } } Pattern isJustNumber = Pattern.compile("^\\d+$"); Matcher foundMatch = isJustNumber.matcher(dateAsString); if (foundMatch.find()) { Long timeAsLong = Long.parseLong(dateAsString); Long msCheck = 1000000000000L; if (timeAsLong > msCheck) { timeAsLong = timeAsLong / 1000; } return new Date(timeAsLong); } LOG.log(Level.SEVERE, "Error parsing: " + dateAsString, e); return null; }
Source:
public AsyncProcessor() { this.subscribers = new AtomicReference<AsyncSubscription<T>[]>(EMPTY); }

Target:
AsyncProcessor() { this.subscribers = new AtomicReference<AsyncSubscription<T>[]>(EMPTY); }
Source:
public Set<String> map(final String principalName, final Set<String> roles) { if (this.roleMappings == null || this.roleMappings.isEmpty()) return roles; Set<String> resolvedRoles = new HashSet<>(); for (String role : roles) { if (this.roleMappings.containsKey(role)) { String value = this.roleMappings.getProperty(role); if (!value.isEmpty()) { String[] mappedRoles = value.split(","); for (String mappedRole : mappedRoles) { String trimmedRole = mappedRole.trim(); if (!trimmedRole.isEmpty()) { resolvedRoles.add(trimmedRole); } } } } else { resolvedRoles.add(role); } } if (this.roleMappings.containsKey(principalName)) { String value = this.roleMappings.getProperty(principalName); if (value != null && !value.isEmpty()) { String[] principalRoles = value.split(","); Collections.addAll(resolvedRoles, principalRoles); } } return resolvedRoles; }

Target:
public Set<String> map(final String principalName, final Set<String> roles) { if (this.roleMappings == null || this.roleMappings.isEmpty()) return roles; Set<String> resolvedRoles = new HashSet<>(); for (String role : roles) { if (this.roleMappings.containsKey(role)) { this.extractRolesIntoSet(role, resolvedRoles); } else { resolvedRoles.add(role); } } if (this.roleMappings.containsKey(principalName)) { this.extractRolesIntoSet(principalName, resolvedRoles); } return resolvedRoles; }
Source:
public void rename(String oldTableName, String newTableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, TableExistsException { checkArgument(oldTableName.length() <= MAX_TABLE_NAME_LEN, "Table names longer than 1024 characters" + "are no longer supported and may result in unexpected behavior"); checkArgument(newTableName.length() <= MAX_TABLE_NAME_LEN, "Table name is longer than 1024 characters"); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes(UTF_8)), ByteBuffer.wrap(newTableName.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); doTableFateOperation(oldTableName, TableNotFoundException.class, FateOperation.TABLE_RENAME, args, opts); }

Target:
public void rename(String oldTableName, String newTableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, TableExistsException { checkArgument(newTableName.length() <= MAX_TABLE_NAME_LEN, "Table name is longer than " + MAX_TABLE_NAME_LEN + " characters"); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes(UTF_8)), ByteBuffer.wrap(newTableName.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); doTableFateOperation(oldTableName, TableNotFoundException.class, FateOperation.TABLE_RENAME, args, opts); }
Source:
public PageFunctionCompiler(Metadata metadata, int expressionCacheSize) { this.metadata = requireNonNull(metadata, "metadata is null"); this.determinismEvaluator = new RowExpressionDeterminismEvaluator(metadata.getFunctionManager()); if (expressionCacheSize > 0) { projectionCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(cacheKey -> compileProjectionInternal(cacheKey.sqlFunctionProperties, cacheKey.rowExpression, Optional.empty(), false))); projectionCacheStats = new CacheStatsMBean(projectionCache); } else { projectionCache = null; projectionCacheStats = null; } if (expressionCacheSize > 0) { filterCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(cacheKey -> compileFilterInternal(cacheKey.sqlFunctionProperties, cacheKey.rowExpression, Optional.empty(), cacheKey.isDisallowLargeBytecodeGeneration))); filterCacheStats = new CacheStatsMBean(filterCache); } else { filterCache = null; filterCacheStats = null; } }

Target:
public PageFunctionCompiler(Metadata metadata, int expressionCacheSize) { this.metadata = requireNonNull(metadata, "metadata is null"); this.determinismEvaluator = new RowExpressionDeterminismEvaluator(metadata.getFunctionManager()); if (expressionCacheSize > 0) { projectionCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(cacheKey -> compileProjectionInternal(cacheKey.sqlFunctionProperties, cacheKey.rowExpression, Optional.empty(), false))); projectionCacheStats = new CacheStatsMBean(projectionCache); } else { projectionCache = null; projectionCacheStats = null; } if (expressionCacheSize > 0) { filterCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(cacheKey -> compileFilterInternal(cacheKey.sqlFunctionProperties, cacheKey.rowExpression, Optional.empty(), cacheKey.isErrorOnLargeBytecodeGeneration))); filterCacheStats = new CacheStatsMBean(filterCache); } else { filterCache = null; filterCacheStats = null; } }
Source:
public void bind(Object service, Map properties) { LOGGER.info("Registering providers"); dataProviderDataService = (DataProviderDataService) service; synchronized (additionLock) { for (TaskDataProvider provider : providersToAdd) { LOGGER.info("Registering the provider with name: {}", provider.getName()); addProviderImpl(provider); } providersToAdd.clear(); } }

Target:
public void bind(Object service, Map properties) { LOGGER.info("Data Service for task data providers registered, starting to register queued providers"); dataProviderDataService = (DataProviderDataService) service; LOGGER.debug("Adding the following task data providers: {}", providersToAdd); synchronized (additionLock) { for (TaskDataProvider provider : providersToAdd) { LOGGER.info("Registering a task data provider with name: {}", provider.getName()); addProviderImpl(provider); } providersToAdd.clear(); } }
Source:
private AbstractMongoDBServer getServer() { AbstractMongoDBServer server = entity.getConfig(MongoDBClient.SERVER); if (server == null) { MongoDBShardedDeployment deployment = entity.getConfig(MongoDBClient.SHARDED_DEPLOYMENT); Task<MongoDBRouter> task = DependentConfiguration.attributeWhenReady(deployment.getRouterCluster(), MongoDBRouterCluster.ANY_ROUTER); try { server = DependentConfiguration.waitForTask(task, entity, "any available router"); } catch (InterruptedException e) { throw Exceptions.propagate(e); } DependentConfiguration.waitInTaskForAttributeReady(server, MongoDBRouter.SHARD_COUNT, new Predicate<Integer>() { public boolean apply(Integer input) { return input > 0; }; }); } else { DependentConfiguration.waitInTaskForAttributeReady(server, Startable.SERVICE_UP, Predicates.equalTo(true)); } return server; }

Target:
private AbstractMongoDBServer getServer() { AbstractMongoDBServer server = entity.getConfig(MongoDBClient.SERVER); if (server == null) { MongoDBShardedDeployment deployment = entity.getConfig(MongoDBClient.SHARDED_DEPLOYMENT); Preconditions.checkNotNull(deployment, "Either server or shardedDeployment must be specified"); Task<MongoDBRouter> task = DependentConfiguration.attributeWhenReady(deployment.getRouterCluster(), MongoDBRouterCluster.ANY_ROUTER); try { server = DependentConfiguration.waitForTask(task, entity, "any available router"); } catch (InterruptedException e) { throw Exceptions.propagate(e); } DependentConfiguration.waitInTaskForAttributeReady(server, MongoDBRouter.SHARD_COUNT, new Predicate<Integer>() { public boolean apply(Integer input) { return input > 0; }; }); } else { Task<Boolean> task = DependentConfiguration.attributeWhenReady(server, Startable.SERVICE_UP); try { DependentConfiguration.waitForTask(task, server); } catch (InterruptedException e) { throw Exceptions.propagate(e); } DependentConfiguration.waitInTaskForAttributeReady(server, Startable.SERVICE_UP, Predicates.equalTo(true)); } return server; }
Source:
public static t_type lookUp(final String s) { return Arrays.stream(t_type.values()) .filter((t)->t.identifier.equalsIgnoreCase(s)) .findAny() .orElseThrow(()->new IllegalArgumentException(String.format("Unknown mbtiles type '%s'",s))); }

Target:
public static t_type lookUp(final String s) throws IllegalArgumentException { return Arrays.stream(t_type.values()) .filter((t)->t.identifier.equalsIgnoreCase(s)) .findAny() .orElseThrow(()->new IllegalArgumentException(String.format("Unknown mbtiles type '%s'",s))); }
Source:
public void update(final Spec spec, final Spec drain) { try { new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .set( String.format( "spec=%s&drain=%s", URLEncoder.encode(spec.asText(), CharEncoding.UTF_8), URLEncoder.encode(drain.asText(), CharEncoding.UTF_8) ) ) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public void update(final Spec spec, final Spec drain) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .formParam("spec", spec.asText()) .formParam("drain", drain.asText()) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public final void read(InputStream inputStream) throws IOException { byte[] tmp = new byte[VERSIONED_IDENTIFIER.length]; int totalRead = 0; while (totalRead != tmp.length) { int read = inputStream.read(tmp, totalRead, tmp.length - totalRead); if (read == -1) { break; } totalRead += read; } if (Arrays.equals(tmp, VERSIONED_IDENTIFIER)) { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); super.read(inputView); read(inputView, true); } else { PushbackInputStream resetStream = new PushbackInputStream(inputStream, totalRead); resetStream.unread(tmp, 0, totalRead); read(new DataInputViewStreamWrapper(resetStream), false); } }

Target:
public final void read(InputStream inputStream) throws IOException { byte[] tmp = new byte[VERSIONED_IDENTIFIER.length]; int totalRead = IOUtils.readFully(inputStream, tmp); if (Arrays.equals(tmp, VERSIONED_IDENTIFIER)) { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); super.read(inputView); read(inputView, true); } else { InputStream streamToRead = inputStream; if (totalRead > 0) { PushbackInputStream resetStream = new PushbackInputStream(inputStream, totalRead); resetStream.unread(tmp, 0, totalRead); streamToRead = resetStream; } read(new DataInputViewStreamWrapper(streamToRead), false); } }
Source:
private void setExportConfiguration() { ConfigurationDialog dialog = ConfigurationDialog.from(exportConfiguration, true, BriefcasePreferences.getStorePasswordsConsentProperty()); dialog.onOK(config -> { exportConfiguration = Optional.ofNullable(config); }); dialog.open(); if (exportConfiguration.isPresent()) { changeDefaultConfigurationButton.setText("Change export configuration"); } }

Target:
private void setExportConfiguration() { ConfigurationDialog dialog = ConfigurationDialog.defaultPanel(exportConfiguration, BriefcasePreferences.getStorePasswordsConsentProperty()); dialog.onOK(config -> exportConfiguration = Optional.ofNullable(config)); dialog.open(); }
Source:
public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<O, O>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); if (minSize == 0) { if (!ringbuffer.shouldWait(sequence)) { sequence = ringbuffer.readMany(sequence, resultSet); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (sequence > ringbuffer.tailSequence() + 1 || (sequence < ringbuffer.headSequence() && !ringbuffer.getStore().isEnabled())) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } sequence = ringbuffer.readMany(sequence, resultSet); return !resultSet.isMinSizeReached(); }

Target:
public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<O, O>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); if (minSize == 0) { if (!ringbuffer.shouldWait(sequence)) { sequence = ringbuffer.readMany(sequence, resultSet); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (ringbuffer.isTooLargeSequence(sequence) || ringbuffer.isStaleSequence(sequence)) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } sequence = ringbuffer.readMany(sequence, resultSet); return !resultSet.isMinSizeReached(); }
Source:
public int getGlyphIndex( char c ) { int[] glyphIndexs = (int[]) getCMap( ).get( (int) c ); if( glyphIndexs == null && c == NBSP ) { glyphIndexs = getCMap( ).get( SPACE ); } return glyphIndexs[0]; }

Target:
public int getGlyphIndex( char c ) { int[] glyphIndexs = (int[]) getCMap( ).get( (int) c ); if( glyphIndexs == null ) { glyphIndexs = getCMap( ).get( SPACE ); } return glyphIndexs[0]; }
Source:
public void validate() { cluster = loadCluster(); FailoverPriority failoverPriority = cluster.getFailoverPriority(); if (failoverPriority != null && failoverPriority.getType().equals(CONSISTENCY)) { int voterCount = failoverPriority.getVoters(); for (Stripe stripe : cluster.getStripes()) { int nodeCount = stripe.getNodes().size(); int sum = voterCount + nodeCount; if (sum % 2 == 0) { logger.warn(lineSeparator() + "=========================================================================================================" + lineSeparator() + "IMPORTANT: The sum (" + sum + ") of voter count (" + voterCount + ") and number of nodes " + "(" + nodeCount + ") in stripe " + stripe.getName() + lineSeparator() + "is an even number. An even-numbered configuration is more likely to experience split-brain situations." + lineSeparator() + "=========================================================================================================" + lineSeparator()); } } } runtimePeers = cluster.getEndpoints(node); new ClusterValidator(cluster).validate(); if (node != null) { if (areAllNodesActivated(runtimePeers)) { throw new IllegalStateException("Cluster is already activated"); } else { if (isActivated(node)) { throw new IllegalStateException("Node is already activated"); } runtimePeers = Collections.singletonList(getEndpoint(node)); } } }

Target:
public void validate() { cluster = loadCluster(); FailoverPriority failoverPriority = cluster.getFailoverPriority(); if (failoverPriority.getType() == CONSISTENCY) { int voterCount = failoverPriority.getVoters(); for (Stripe stripe : cluster.getStripes()) { int nodeCount = stripe.getNodes().size(); int sum = voterCount + nodeCount; if (sum % 2 == 0) { logger.warn(lineSeparator() + "=========================================================================================================" + lineSeparator() + "IMPORTANT: The sum (" + sum + ") of voter count (" + voterCount + ") and number of nodes " + "(" + nodeCount + ") in stripe " + stripe.getName() + lineSeparator() + "is an even number. An even-numbered configuration is more likely to experience split-brain situations." + lineSeparator() + "=========================================================================================================" + lineSeparator()); } } } runtimePeers = cluster.getEndpoints(node); new ClusterValidator(cluster).validate(); if (node != null) { if (areAllNodesActivated(runtimePeers)) { throw new IllegalStateException("Cluster is already activated"); } else { if (isActivated(node)) { throw new IllegalStateException("Node is already activated"); } runtimePeers = Collections.singletonList(getEndpoint(node)); } } }
Source:
private void handleOpenPageIntent(Intent intent) { String pagePosition = intent.getStringExtra(ARG_OPEN_PAGE); if (!TextUtils.isEmpty(pagePosition)) { switch (pagePosition) { case ARG_NOTIFICATIONS: mBottomNav.setCurrentPosition(PAGE_NOTIFS); break; case ARG_READER: mBottomNav.setCurrentPosition(PAGE_READER); break; case ARG_ME: mBottomNav.setCurrentPosition(PAGE_ME); if (intent.getBooleanExtra(WPMainActivity.ARG_SHOW_ZENDESK_HINT_SNACKBAR, false)) { Snackbar.make(findViewById(R.id.coordinator), R.string.support_push_notification_message_hint_snackbar, Snackbar.LENGTH_LONG).show(); } break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }

Target:
private void handleOpenPageIntent(Intent intent) { String pagePosition = intent.getStringExtra(ARG_OPEN_PAGE); if (!TextUtils.isEmpty(pagePosition)) { switch (pagePosition) { case ARG_NOTIFICATIONS: mBottomNav.setCurrentPosition(PAGE_NOTIFS); break; case ARG_READER: mBottomNav.setCurrentPosition(PAGE_READER); break; case ARG_ME: mBottomNav.setCurrentPosition(PAGE_ME); if (intent.getBooleanExtra(WPMainActivity.ARG_SHOW_ZENDESK_HINT_SNACKBAR, false)) { Snackbar.make(findViewById(R.id.coordinator), R.string.support_push_notification_message_hint_snackbar, 5000).show(); } break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }
Source:
public HRavenStatsWriteService() { runningJobs = new HashSet<String>(); completedJobs = new HashSet<String>(); failedJobs = new HashSet<String>(); username = System.getProperty("user.name"); hRavenPool = Executors.newFixedThreadPool(1); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { shutdown(); } }); }

Target:
public HRavenStatsWriteService() { this.runningJobs = Sets.newHashSet(); this.completedJobs = Sets.newHashSet(); this.failedJobs = Sets.newHashSet(); this.username = System.getProperty("user.name"); this.hRavenPool = Executors.newFixedThreadPool(1); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { shutdown(); } }); }
Source:
private Path getNextListResult(BlobItem blobItem) { Path withoutRoot = this.path; if (withoutRoot.isAbsolute()) { withoutRoot = this.path.getRoot().relativize(this.path); } String blobName = blobItem.getName(); Path relativeResult = withoutRoot.relativize( this.path.getFileSystem().getPath(blobName)); return this.path.resolve(relativeResult); }

Target:
private Path getNextListResult(BlobItem blobItem) { String blobName = blobItem.getName(); Path relativeResult = this.withoutRoot.relativize( this.path.getFileSystem().getPath(blobName)); return this.path.resolve(relativeResult); }
Source:
public JmsSessionProvider(Session session, Destination destination) { m_session = assertNotNull(session); m_destination = destination; m_stats = new JmsSubscriptionStats(); }

Target:
public JmsSessionProvider(Session session, Destination destination) { m_session = assertNotNull(session); m_destination = destination; m_stats = createJmsSubscriptionStats(); }
Source:
public ActualMeterReadsResponse convert(final ActualMeterReads source, final Type<? extends ActualMeterReadsResponse> destinationType) { final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse destination = new ObjectFactory() .createActualMeterReadsResponse(); final GregorianCalendar c = new GregorianCalendar(); c.setTime(source.getLogTime()); XMLGregorianCalendar convertedDate; try { convertedDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (final DatatypeConfigurationException e) { LOGGER.error("JAXB mapping: An error occured while converting calendar types.", e); convertedDate = null; } destination.setLogTime(convertedDate); destination.setActiveEnergyImport(this.eFromDouble(source.getActiveEnergyImport())); if (!destination.getActiveEnergyImport().getUnit().name().equals(source.getOsgpUnit().name())) { throw new IllegalStateException(String.format("unit %s in destionation differs from unit %s in source", destination.getActiveEnergyImport().getUnit(), source.getOsgpUnit())); } destination.setActiveEnergyExport(this.eFromDouble(source.getActiveEnergyExport())); destination.setActiveEnergyExportTariffOne(this.eFromDouble(source.getActiveEnergyExportTariffOne())); destination.setActiveEnergyExportTariffTwo(this.eFromDouble(source.getActiveEnergyExportTariffTwo())); destination.setActiveEnergyImportTariffOne(this.eFromDouble(source.getActiveEnergyImportTariffOne())); destination.setActiveEnergyImportTariffTwo(this.eFromDouble(source.getActiveEnergyImportTariffTwo())); return destination; }

Target:
public ActualMeterReadsResponse convert(final ActualMeterReads source, final Type<? extends ActualMeterReadsResponse> destinationType) { final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse destination = new ObjectFactory() .createActualMeterReadsResponse(); final GregorianCalendar c = new GregorianCalendar(); c.setTime(source.getLogTime()); XMLGregorianCalendar convertedDate; try { convertedDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (final DatatypeConfigurationException e) { LOGGER.error("JAXB mapping: An error occured while converting calendar types.", e); convertedDate = null; } destination.setLogTime(convertedDate); destination.setActiveEnergyImport(this.eFromDouble(source.getActiveEnergyImport())); if (!destination.getActiveEnergyImport().getUnit().name().equals(source.getOsgpUnit().name())) { throw new IllegalStateException(String.format("unit %s in destination differs from unit %s in source", destination.getActiveEnergyImport().getUnit(), source.getOsgpUnit())); } destination.setActiveEnergyExport(this.eFromDouble(source.getActiveEnergyExport())); destination.setActiveEnergyExportTariffOne(this.eFromDouble(source.getActiveEnergyExportTariffOne())); destination.setActiveEnergyExportTariffTwo(this.eFromDouble(source.getActiveEnergyExportTariffTwo())); destination.setActiveEnergyImportTariffOne(this.eFromDouble(source.getActiveEnergyImportTariffOne())); destination.setActiveEnergyImportTariffTwo(this.eFromDouble(source.getActiveEnergyImportTariffTwo())); return destination; }
Source:
@Nullable public static <T> T getCallback(@NonNull Fragment fragment, @NonNull Class<T> callback) { if (callback.isInstance(fragment.getTargetFragment())) { return (T) fragment.getTargetFragment(); } if (callback.isInstance(fragment.getParentFragment())) { return (T) fragment.getParentFragment(); } if (fragment.getParentFragment() != null && callback.isInstance(fragment.getParentFragment().getParentFragment())) { return (T) fragment.getParentFragment().getParentFragment(); } if (callback.isInstance(fragment.getActivity())) { return (T) fragment.getActivity(); } return null; }

Target:
@Nullable public static <T> T getCallback(@NonNull Fragment fragment, @NonNull Class<T> callback) { if (callback.isInstance(fragment.getTargetFragment())) { return (T) fragment.getTargetFragment(); } if (callback.isInstance(fragment.getParentFragment())) { return (T) fragment.getParentFragment(); } if (callback.isInstance(fragment.getActivity())) { return (T) fragment.getActivity(); } return null; }
Source:
public void testGivePhysicalAddress() throws Exception { if (!HdmiCecUtils.isHdmiCecFeatureSupported(getDevice())) { CLog.v("No HDMI CEC feature running, should skip test."); return; } HdmiCecUtils hdmiCecUtils = new HdmiCecUtils(CecDevice.PLAYBACK_1, "1.0.0.0"); try { hdmiCecUtils.init(); hdmiCecUtils.sendCecMessage(CecMessage.GIVE_PHYSICAL_ADDRESS); String message = hdmiCecUtils.checkExpectedOutput(CecMessage.REPORT_PHYSICAL_ADDRESS); int expectedParams = (HdmiCecConstants.PHYSICAL_ADDRESS << 8) + HdmiCecConstants.PLAYBACK_DEVICE_TYPE; assertEquals(expectedParams, hdmiCecUtils.getParamsFromMessage(message)); } finally { hdmiCecUtils.killCecProcess(); } }

Target:
public void testGivePhysicalAddress() throws Exception { final int PHYSICAL_ADDRESS = 0x1000; final int PLAYBACK_DEVICE_TYPE = 0x4; if (!HdmiCecUtils.isHdmiCecFeatureSupported(getDevice())) { CLog.v("No HDMI CEC feature running, should skip test."); return; } HdmiCecUtils hdmiCecUtils = new HdmiCecUtils(CecDevice.PLAYBACK_1, "1.0.0.0"); try { hdmiCecUtils.init(); hdmiCecUtils.sendCecMessage(CecMessage.GIVE_PHYSICAL_ADDRESS); String message = hdmiCecUtils.checkExpectedOutput(CecMessage.REPORT_PHYSICAL_ADDRESS); int receivedParams = hdmiCecUtils.getParamsFromMessage(message); assertEquals(PHYSICAL_ADDRESS, receivedParams >> 8); assertEquals(PLAYBACK_DEVICE_TYPE, receivedParams & 0xFF); } finally { hdmiCecUtils.killCecProcess(); } }
Source:
private RuntimeException hardFailOwingToFailureOnLeader(RetryableException ex) { log.error("This connection has failed on a leader when its semantics instruct it not to retry" + " except on a non-leader.", ex); return ex == null ? new IllegalStateException("continueOrPropagate called on null") : ex; }

Target:
private static RuntimeException hardFailOwingToFailureOnLeader(RetryableException ex) { log.error("This connection has failed on a leader when its semantics instruct it not to retry" + " except on a non-leader.", ex); return ex == null ? new IllegalStateException("continueOrPropagate called on null") : ex; }
Source:
public void testOperationTimeRange() throws Exception { assertNotNull(fExperiment); assertNotNull(fTraces); SelectTracesOperation selectTracesOperation = new SelectTracesOperation(fExperiment, fTraces, new HashMap<String, TmfTraceElement>(), fStartTimeRange, fEndTimeRange); PlatformUI.getWorkbench().getProgressService().run(true, true, selectTracesOperation); validateTracesExperiment(true); }

Target:
public void testOperationTimeRange() throws Exception { assertNotNull(fExperiment); assertNotNull(fTraces); SelectTracesOperation selectTracesOperation = new SelectTracesOperation(NonNullUtils.checkNotNull(fExperiment), fTraces, new HashMap<String, TmfTraceElement>(), fStartTimeRange, fEndTimeRange); PlatformUI.getWorkbench().getProgressService().run(true, true, selectTracesOperation); validateTracesExperiment(true); }
Source:
public PathVariablesGroup(boolean multiSelect, int variableType) { this.multiSelect = multiSelect; this.variableType = variableType; pathVariableManager = ResourcesPlugin.getWorkspace() .getPathVariableManager(); removedVariableNames = new HashSet(); Collator ignoreCaseComparator = Collator.getInstance(); ignoreCaseComparator.setStrength(Collator.TERTIARY); tempPathVariables = new TreeMap(ignoreCaseComparator); initTemporaryState(); }

Target:
public PathVariablesGroup(boolean multiSelect, int variableType) { this.multiSelect = multiSelect; this.variableType = variableType; pathVariableManager = ResourcesPlugin.getWorkspace() .getPathVariableManager(); removedVariableNames = new HashSet(); Collator ignoreCaseComparator = Collator.getInstance(); tempPathVariables = new TreeMap(ignoreCaseComparator); initTemporaryState(); }
Source:
private void scanMethodAnnotations( Set<TypeElement> typeHierarchy, ExecutableElement getMethod, Map<Class<? extends Annotation>, Annotation> annotations) { Class<? extends Annotation> exclusiveAnnotation = getExclusiveAnnotation(annotations); for (Class<? extends Annotation> annotationClass : PROPERTY_ANNOTATIONS) { Optional<? extends ResolvedAnnotation<? extends Annotation>> annotation = getMethodAnnotation(annotationClass, getMethod, typeHierarchy); if (annotation.isPresent()) { if (EXCLUSIVE_PROPERTY_ANNOTATIONS.contains(annotationClass)) { if (exclusiveAnnotation == null) { exclusiveAnnotation = annotationClass; } else { reportMultipleAnnotationError( annotation.get().getElement(), exclusiveAnnotation, annotationClass); } } if (!annotations.containsKey(annotationClass)) { annotations.put(annotationClass, annotation.get().getAnnotation()); } } } }

Target:
private void scanMethodAnnotations( Set<TypeElement> typeHierarchy, ExecutableElement getMethod, Map<Class<? extends Annotation>, Annotation> annotations) { Class<? extends Annotation> exclusiveAnnotation = getExclusiveAnnotation(annotations); for (Class<? extends Annotation> annotationClass : PROPERTY_ANNOTATIONS) { Optional<? extends ResolvedAnnotation<? extends Annotation>> annotation = AnnotationScanner.getMethodAnnotation(annotationClass, getMethod, typeHierarchy); if (annotation.isPresent()) { if (EXCLUSIVE_PROPERTY_ANNOTATIONS.contains(annotationClass)) { if (exclusiveAnnotation == null) { exclusiveAnnotation = annotationClass; } else { reportMultipleAnnotationError( annotation.get().getElement(), exclusiveAnnotation, annotationClass); } } if (!annotations.containsKey(annotationClass)) { annotations.put(annotationClass, annotation.get().getAnnotation()); } } } }
Source:
public Map<String, String> parse(Document document) { Map<String, String> map = new HashMap<String, String>(); NodeList servicesNodes = document.getElementsByTagName("service"); for (int i = 0; i < servicesNodes.getLength(); i++) { Element node = (Element) servicesNodes.item(i); if (node.hasAttribute("class") && node.hasAttribute("id") && node.getAttribute("id").startsWith("doctrine.orm") && node.getAttribute("id").endsWith("_entity_manager")) { NodeList calls = document.getElementsByTagName("call"); for (int x = 0; x < calls.getLength(); x++) { Element call = (Element) calls.item(x); if (call.hasAttribute("method") && call.getAttribute("method").equals("setEntityNamespaces")) { NodeList arguments = call.getElementsByTagName("argument"); for (int y = 0; y < arguments.getLength(); y++) { Element arg = (Element) arguments.item(y); if (arg.hasAttribute("key")) { map.put(arg.getAttribute("key"), "\\" + arg.getTextContent()); } } } } } } return map; }

Target:
public Map<String, String> parse(Document document) { Map<String, String> map = new HashMap<String, String>(); Object result = null; try { XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression xPathExpr = xpath.compile("/container/services/service[@id[starts-with(.,'doctrine.orm.')]] result = xPathExpr.evaluate(document, XPathConstants.NODESET); } catch (XPathExpressionException e) { return map; } NodeList nodes = (NodeList) result; for (int i = 0; i < nodes.getLength(); i++) { Element node = (Element) nodes.item(i); map.put(node.getAttribute("key"), "\\" + node.getTextContent()); } return map; }
Source:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { if (proxyInfo == null) { mVPNProxy = null; return; } if (!TextUtils.isEmpty(proxyInfo.getHost()) && proxyInfo.getPort() != 0) { mVPNProxy = proxyInfo; } } }

Target:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { mVPNProxy = proxyInfo; } }
Source:
public BsmAdminPageEditWindow openNewDialog(String businessServiceName) throws InterruptedException { findElementById("createButton").click(); wait.until(pageContainsText("Business Service Edit")); return new BsmAdminPageEditWindow(businessServiceName).name(businessServiceName); }

Target:
public BsmAdminPageEditWindow openNewDialog(String businessServiceName) throws InterruptedException { findElementById("createButton").click(); wait.until(pageContainsText("Business Service Edit")); return new BsmAdminPageEditWindow().name(businessServiceName); }
Source:
public void done() { if(fMissMatched > 0) { Activator.logWarning("Incoherent callstack found on " + fMissMatched + " occations "); } super.done(); }

Target:
public void done() { if (fMissMatched > 0) { Activator.getInstance().logWarning(NLS.bind(Messages.CallStackStateProvider_IncoherentCallstack, fMissMatched)); } super.done(); }
Source:
private boolean sample(Span wavefrontSpan) { if (sampler != null && sampler.sample(wavefrontSpan.getName(), UUID.fromString(wavefrontSpan.getTraceId()).getLeastSignificantBits(), wavefrontSpan.getDuration())) { return true; } discardedSpansBySampler.inc(); return false; }

Target:
private boolean sample(Span wavefrontSpan) { if (sampler.sample(wavefrontSpan.getName(), UUID.fromString(wavefrontSpan.getTraceId()).getLeastSignificantBits(), wavefrontSpan.getDuration())) { return true; } discardedSpansBySampler.inc(); return false; }
Source:
public void onOrganizerResponse(boolean isOrganizer) { if (isOrganizer) { TaggedEventSeries eventSeries = intent.getParcelableExtra(Const.EXTRA_TAGGED_EVENT); NotificationHandler notificationHandler = new NotificationHandler(this, eventSeries); Notification notification = notificationHandler.createNotification(); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); nm.notify(NOTIFICATION_ID, notification); PrefUtils.setTaggedEventSeriesNotificationSet(this, eventSeries); } stop(); }

Target:
public void onOrganizerResponse(boolean isOrganizer) { if (isOrganizer || intent.getBooleanExtra(Const.EXTRA_ALARM_FOR_ALL, true)) { TaggedEventSeries eventSeries = intent.getParcelableExtra(Const.EXTRA_TAGGED_EVENT); NotificationHandler notificationHandler = new NotificationHandler(this, eventSeries); Notification notification = notificationHandler.createNotification(); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); nm.notify(NOTIFICATION_ID, notification); } stop(); }
Source:
private static @NonNull Intent helper_basicOSHMSOpenIntentWithActionId(final @NonNull String actionId) throws JSONException { return helper_baseHMSOpenIntent() .putExtra( "custom", new JSONObject() {{ put("i", UUID.randomUUID().toString()); put(BUNDLE_KEY_ACTION_ID, actionId); }}.toString() ); }

Target:
private static @NonNull Intent helper_basicOSHMSOpenIntentWithActionId(final @NonNull String actionId) throws JSONException { return helper_baseHMSOpenIntent() .putExtra( PAYLOAD_OS_ROOT_CUSTOM, new JSONObject() {{ put(PAYLOAD_OS_NOTIFICATION_ID, UUID.randomUUID().toString()); put(BUNDLE_KEY_ACTION_ID, actionId); }}.toString() ); }
Source:
public String getVersion() { return bundle != null ? bundle.getVersion().toString() : ""; }

Target:
public String getVersion() { return bundle.getVersion().toString(); }
Source:
protected void refreshUiReal() { updateConversationList(); if (conversationList.size() > 0) { if (!this.mConversationFragment.isAdded()) { Log.d(Config.LOGTAG,"fragment NOT added to activity. detached="+Boolean.toString(mConversationFragment.isDetached())); } if (getSelectedConversation() == null) { reInitLatestConversation(); } else { ConversationActivity.this.mConversationFragment.updateMessages(); updateActionBarTitle(); invalidateOptionsMenu(); } } else { if (!isStopping() && mRedirected.compareAndSet(false, true)) { redirectToStartConversationActivity(); } Log.d(Config.LOGTAG,"not updating conversations fragment because conversations list size was 0"); } mConversationFragment.checkRttButtonStatus(); if (!xmppConnectionService.useRealTimeText()) { mConversationFragment.rttStatusButton.setVisibility(View.GONE); } else { mConversationFragment.rttStatusButton.setVisibility(View.VISIBLE); } }

Target:
protected void refreshUiReal() { updateConversationList(); if (conversationList.size() > 0) { if (!this.mConversationFragment.isAdded()) { Log.d(Config.LOGTAG,"fragment NOT added to activity. detached="+Boolean.toString(mConversationFragment.isDetached())); } if (getSelectedConversation() == null) { reInitLatestConversation(); } else { ConversationActivity.this.mConversationFragment.updateMessages(); updateActionBarTitle(); invalidateOptionsMenu(); } } else { if (!isStopping() && mRedirected.compareAndSet(false, true)) { redirectToStartConversationActivity(); } Log.d(Config.LOGTAG,"not updating conversations fragment because conversations list size was 0"); } mConversationFragment.checkRttButtonStatus(); }
Source:
public byte getValueIfPresent(PointerType key, PointerByReference value) { return INSTANCE.CFDictionaryGetValueIfPresent(this, key, value); }

Target:
public boolean getValueIfPresent(PointerType key, PointerByReference value) { return INSTANCE.CFDictionaryGetValueIfPresent(this, key, value) > 0; }
Source:
public void setUp() throws Exception { folderWithoutWritePermission = tempDir.newFolder("folder-without-write-permission"); folderWithoutWritePermission.setWritable(false); folderWithWritePermission = tempDir.newFolder("folder-with-write-permission"); loggerContext = new LoggerContext(); factory = new LoggingFactory(loggerContext); }

Target:
public void setUp() throws Exception { output = new ByteArrayOutputStream(); factory = new LoggingFactory(new LoggerContext(), new PrintStream(output)); }
Source:
public Object moveToNextValue(Object currentValue) { BigInteger oneBigInteger = new BigInteger("1"); if (currentValue == null) { return oneBigInteger; } else { return ((BigInteger) currentValue).add(oneBigInteger); } }

Target:
public Object moveToNextValue(Object currentValue) { BigInteger oneBigInteger = BigInteger.ONE; if (currentValue == null) { return oneBigInteger; } else { return ((BigInteger) currentValue).add(oneBigInteger); } }
Source:
public void testRewrite() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.lateral( ImmutableList.of(p.symbol("nationkey"), p.symbol("nationkey")), p.tableScan(ImmutableList.of(p.symbol("nationkey")), ImmutableMap.of(p.symbol("nationkey"), new TpchColumnHandle("tpch:nationkey", BIGINT))), p.project( Assignments.of(p.symbol("nationkey"), expression("nationkey")), p.values( ImmutableList.of(), ImmutableList.of( ImmutableList.of()))))) .matches(project( ImmutableMap.of(), any())); }

Target:
public void testRewrite() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.lateral( ImmutableList.of(p.symbol("l_nationkey")), p.tableScan(new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "nation", TINY_SCALE_FACTOR)), ImmutableList.of(p.symbol("l_nationkey")), ImmutableMap.of(p.symbol("l_nationkey"), new TpchColumnHandle("nationkey", BIGINT))), p.project( Assignments.of(p.symbol("l_expr2"), expression("l_nationkey + 1")), p.values( ImmutableList.of(), ImmutableList.of( ImmutableList.of()))))) .matches(project( ImmutableMap.of( ("l_expr2"), PlanMatchPattern.expression("l_nationkey + 1"), "l_nationkey", PlanMatchPattern.expression("l_nationkey")), tableScan("nation", ImmutableMap.of("l_nationkey", "nationkey")))); }
Source:
public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (subMonitor.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) continue; String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1)); else if (delete) p.delete(false, true, subMonitor.newChild(1)); else closeMissingProject(p, projectFile, monitor); subMonitor.worked(1); } }

Target:
public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (subMonitor.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) continue; String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1)); else if (delete) p.delete(false, true, subMonitor.newChild(1)); else closeMissingProject(p, projectFile, subMonitor.newChild(1)); } }
Source:
public void onListItemClick(ListView l, View v, int position, long id) { Map.Entry<String, PulseEntry> pulse = mAdapter.getItem(position); if (mTarget.equals(GLOBAL)) { mListener.openPulse(pulse.getKey()); } else { if (v.isEnabled()) { Intent chapterIntent = new Intent(getActivity(), MainActivity.class); chapterIntent.putExtra(Const.EXTRA_CHAPTER_ID, pulse.getValue().getId()); startActivity(chapterIntent); } else { View rootView = getListView().getRootView(); Snackbar.make(rootView, R.string.no_pulse, Snackbar.LENGTH_SHORT) .show(); } } }

Target:
public void onListItemClick(ListView l, View v, int position, long id) { Map.Entry<String, PulseEntry> pulse = mAdapter.getItem(position); if (isGlobalSelected()) { mListener.openPulse(pulse.getKey()); } else { if (v.isEnabled()) { Intent chapterIntent = new Intent(getActivity(), MainActivity.class); chapterIntent.putExtra(Const.EXTRA_CHAPTER_ID, pulse.getValue().getId()); startActivity(chapterIntent); } } }
Source:
public Slice serialize() { SliceOutput sliceBuilder = new DynamicSliceOutput(toIntExact(estimatedSerializedSizeInBytes())); sliceBuilder.writeByte(0); sliceBuilder.writeByte(0); sliceBuilder.writeDouble(min); sliceBuilder.writeDouble(max); sliceBuilder.writeDouble(publicCompression); sliceBuilder.writeDouble(totalWeight); sliceBuilder.writeInt(activeCentroids); sliceBuilder.writeBytes(wrappedDoubleArray(weight), 0, activeCentroids * SIZE_OF_DOUBLE); sliceBuilder.writeBytes(wrappedDoubleArray(mean), 0, activeCentroids * SIZE_OF_DOUBLE); return sliceBuilder.slice(); }

Target:
public Slice serialize() { SliceOutput sliceOutput = new DynamicSliceOutput(toIntExact(estimatedSerializedSizeInBytes())); sliceOutput.writeByte(0); sliceOutput.writeByte(0); sliceOutput.writeDouble(min); sliceOutput.writeDouble(max); sliceOutput.writeDouble(publicCompression); sliceOutput.writeDouble(totalWeight); sliceOutput.writeInt(activeCentroids); sliceOutput.writeBytes(wrappedDoubleArray(weight), 0, activeCentroids * SIZE_OF_DOUBLE); sliceOutput.writeBytes(wrappedDoubleArray(mean), 0, activeCentroids * SIZE_OF_DOUBLE); return sliceOutput.slice(); }
Source:
public Property getSourceEndAssociation(Association association, DDiagramElement view) { final DEdge edge = (DEdge)view; final String sourceObject = edge.getSourceNode().toString(); final List<Property> members = association.getMemberEnds(); for (final Property member : members) { final String typeName = member.getType().getName(); if (sourceObject.contains(typeName)) { return member; } } return null; }

Target:
public Property getSourceEndAssociation(Association association, DDiagramElement view) { final DEdge edge = (DEdge)view; final List<Property> members = association.getMemberEnds(); final DNodeListSpec source = (DNodeListSpec)edge.getSourceNode(); final List<EObject> sourceSemanticElements = source.getSemanticElements(); for (final EObject sourceEObject : sourceSemanticElements) { for (final Property member : members) { if (sourceEObject.equals(member.getType())) { return member; } } } return null; }
Source:
protected HeaderBag getDefaultHeaders() { String subnetName = "subnet-" + properties.getProperty("graviton.workerId"); String authHeaderName = properties.getProperty("graviton.authentication.header.name"); return new HeaderBag.Builder() .set("Content-Type", "application/json") .set("Accept", "application/json") .set(authHeaderName, subnetName) .build(); }

Target:
protected HeaderBag getDefaultHeaders() { String authHeaderValue = properties.getProperty("graviton.authentication.prefix.username") .concat(properties.getProperty("graviton.workerId")); String authHeaderName = properties.getProperty("graviton.authentication.header.name"); return new HeaderBag.Builder() .set("Content-Type", "application/json") .set("Accept", "application/json") .set(authHeaderName, authHeaderValue) .build(); }
Source:
public String getDisplayName() { return "GitHub Configuration"; }

Target:
public String getDisplayName() { return "GitHub"; }
Source:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logInfo("Error writing the file "+file+" due to "+e.getMessage()); } finally { fLock.readLock().unlock(); } }

Target:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logError("Error writing the file "+file+" due to ", e); } finally { fLock.readLock().unlock(); } }
Source:
public int compareTo( @NotNull(message = "other can't be NULL") final RepoCommit other ) { return this.sha().compareTo(other.sha()); }

Target:
public int compareTo( @NotNull(message = "other can't be NULL") final RepoCommit other ) { return new CompareToBuilder().append( this.repo().coordinates(), other.repo().coordinates() ).append(this.sha(), other.sha()).build(); }
Source:
public Method getOnBinaryMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(byte[].class) || paraList.contains(ByteBuffer.class)) { return method; } } } return null; }

Target:
public Method getOnBinaryMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(byte[].class) || paraList.contains(ByteBuffer.class)) { return method; } } } return null; }
Source:
public void openedApp() { trackEvent(openedApp, null, null); }

Target:
public void openedApp() { trackEvent(OPENED); }