auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String publishToFacebook(byte[] inputBytes, String type, String fileName, String message, String videoTitle) { JsonObject response; List<Parameter> parameters = Lists.newArrayList(); if (type.equals("photo")) { type = "photos"; parameters.add(Parameter.with("message", message)); } else if (type.equals("video")) { type = "videos"; parameters.add(Parameter.with("description", message)); parameters.add(Parameter.with("title", videoTitle)); } else { return null; } try { response = client.publish("me/" + type, JsonObject.class, BinaryAttachment.with(fileName, inputBytes), parameters.toArray(new Parameter[parameters.size()])); } catch (FacebookException e) { return null; } return response.toString(); }

Target:
public String publishToFacebook(byte[] inputBytes, String type, String fileName, String message, String videoTitle) { List<Parameter> parameters = Lists.newArrayList(); if (type.equals("photo")) { parameters.add(Parameter.with("message", message)); } else { parameters.add(Parameter.with("description", message)); parameters.add(Parameter.with("title", videoTitle)); } JsonObject response; try { response = client.publish("me/" + type + "s", JsonObject.class, BinaryAttachment.with(fileName, inputBytes), parameters.toArray(new Parameter[parameters.size()])); } catch (FacebookException e) { return null; } return response.toString(); }
Source:
public User getBlockedUser(Process process) { User result = null; if (MetadatenSperrung.isLocked(process.getId())) { String userID = this.msp.getLockBenutzer(process.getId()); try { result = serviceManager.getUserService().getById(Integer.valueOf(userID)); } catch (Exception e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(Helper.getTranslation("userNotFound"), e); } } return result; }

Target:
public User getBlockedUser(Process process) { User result = null; if (MetadatenSperrung.isLocked(process.getId())) { String userID = this.msp.getLockBenutzer(process.getId()); try { result = serviceManager.getUserService().getById(Integer.valueOf(userID)); } catch (DAOException | RuntimeException e) { Helper.setErrorMessage(Helper.getTranslation("userNotFound"), logger, e); } } return result; }
Source:
private void invokeSyncOperation(InvokeContext context, EhcacheSyncMessage message) throws ClusterException { switch (message.getMessageType()) { case DATA: EhcacheDataSyncMessage dataSyncMessage = (EhcacheDataSyncMessage) message; ServerSideServerStore store = stateService.getStore(storeIdentifier); dataSyncMessage.getChainMap().entrySet().forEach(entry -> { store.put(entry.getKey(), entry.getValue()); }); break; case STATE_REPO: EhcacheStateRepoSyncMessage stateRepoSyncMessage = (EhcacheStateRepoSyncMessage) message; stateService.getStateRepositoryManager().processSyncMessage(stateRepoSyncMessage); break; case MESSAGE_TRACKER: EhcacheMessageTrackerMessage messageTrackerMessage = (EhcacheMessageTrackerMessage) message; if (messageTrackerMessage.getSegmentId() != EhcacheMessageTrackerMessage.UNKNOWN_SEGMENT) { messageTrackerMessage.getTrackedMessages().entrySet().forEach(entry -> messageHandler.loadTrackedResponsesForSegment(messageTrackerMessage.getSegmentId(), context.makeClientSourceId(entry.getKey()), entry.getValue()) ); } else { messageTrackerMessage.getTrackedMessages().entrySet().forEach(entry -> messageHandler.loadOnSync(context.makeClientSourceId(entry.getKey()), entry.getValue()) ); } break; default: throw new AssertionError("Unsupported Sync operation " + message.getMessageType()); } }

Target:
private void invokeSyncOperation(InvokeContext context, EhcacheSyncMessage message) throws ClusterException { switch (message.getMessageType()) { case DATA: EhcacheDataSyncMessage dataSyncMessage = (EhcacheDataSyncMessage) message; ServerSideServerStore store = stateService.getStore(storeIdentifier); dataSyncMessage.getChainMap().forEach(store::put); break; case STATE_REPO: EhcacheStateRepoSyncMessage stateRepoSyncMessage = (EhcacheStateRepoSyncMessage) message; stateService.getStateRepositoryManager().processSyncMessage(stateRepoSyncMessage); break; case MESSAGE_TRACKER: EhcacheMessageTrackerMessage messageTrackerMessage = (EhcacheMessageTrackerMessage) message; if (messageTrackerMessage.getSegmentId() != EhcacheMessageTrackerMessage.UNKNOWN_SEGMENT) { messageTrackerMessage.getTrackedMessages().forEach((key, value) -> messageHandler.loadTrackedResponsesForSegment(messageTrackerMessage.getSegmentId(), context.makeClientSourceId(key), value)); } else { messageTrackerMessage.getTrackedMessages().forEach((key, value) -> messageHandler.loadOnSync(context.makeClientSourceId(key), value)); } break; default: throw new AssertionError("Unsupported Sync operation " + message.getMessageType()); } }
Source:
private void updateActionAvailability() { NetworkView network = getEntity(); getNewCommand().setIsExecutionAllowed(network != null && network.isExternal()); getRemoveCommand().setIsExecutionAllowed((getSelectedItems() != null && getSelectedItems().size() > 0)); }

Target:
private void updateActionAvailability() { getRemoveCommand().setIsExecutionAllowed((getSelectedItems() != null && getSelectedItems().size() > 0)); }
Source:
public void updateTopic(Topic topic) { groupService.checkGroupExists(topic.getName().getGroupName()); Topic retrieved = getTopicDetails(topic.getName()); Topic modified = Patch.apply(retrieved, topic); if (!retrieved.equals(modified)) { if (Topic.ContentType.AVRO == topic.getContentType() || !isNullOrEmpty(modified.getMessageSchema())) { schemaValidatorProvider.provide(topic.getContentType()).check(modified.getMessageSchema()); } if (retrieved.getRetentionTime() != modified.getRetentionTime()) { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.updateTopic(topic.getName(), modified.getRetentionTime()) ); } topicRepository.updateTopic(modified); } }

Target:
public void updateTopic(Topic topic) { groupService.checkGroupExists(topic.getName().getGroupName()); Topic retrieved = getTopicDetails(topic.getName()); Topic modified = Patch.apply(retrieved, topic); if (!retrieved.equals(modified)) { if (topic.isSchemaValidationRequired()) { schemaValidatorProvider.provide(topic.getContentType()).check(modified.getMessageSchema()); } if (retrieved.getRetentionTime() != modified.getRetentionTime()) { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.updateTopic(topic.getName(), modified.getRetentionTime()) ); } topicRepository.updateTopic(modified); } }
Source:
private void restore(File root, File buRoot, Set<File> unrestorable) { File[] children = buRoot.listFiles(); if (children == null) { unrestorable.add(buRoot); return; } for (File children1 : children) { File bu = new File(buRoot, children1.getName()); File target = new File(root, bu.getName()); if (bu.isDirectory()) { if (!target.exists() && !target.mkdir()) { unrestorable.add(bu); continue; } else if (target.exists() && !target.isDirectory()) { target.delete(); if (!target.mkdir()) { unrestorable.add(bu); continue; } } restore(target, bu, unrestorable); } else { if (bu.getName().equals(dummyName)) { restoreCounter++; continue; } if (target.exists()) fullyDelete(target); if (!bu.renameTo(target)) { try { Util.copyStream(new FileInputStream(bu), true, new FileOutputStream(target), true); restoreCounter++; } catch (FileNotFoundException e) { unrestorable.add(bu); continue; } catch (IOException e) { unrestorable.add(bu); continue; } if (!bu.delete()) { logWarning(NLS.bind(Messages.BackupStore_can_not_delete_tmp_file, bu.getAbsolutePath())); } } else restoreCounter++; } } }

Target:
private void restore(File root, File buRoot, Set<File> unrestorable) { File[] children = buRoot.listFiles(); if (children == null) { unrestorable.add(buRoot); return; } for (File child : children) { File bu = new File(buRoot, child.getName()); File target = new File(root, bu.getName()); if (bu.isDirectory()) { if (!target.exists() && !target.mkdir()) { unrestorable.add(bu); continue; } else if (target.exists() && !target.isDirectory()) { target.delete(); if (!target.mkdir()) { unrestorable.add(bu); continue; } } restore(target, bu, unrestorable); } else { if (bu.getName().equals(dummyName)) { restoreCounter++; continue; } if (target.exists()) fullyDelete(target); if (!bu.renameTo(target)) { try { Util.copyStream(new FileInputStream(bu), true, new FileOutputStream(target), true); restoreCounter++; } catch (FileNotFoundException e) { unrestorable.add(bu); continue; } catch (IOException e) { unrestorable.add(bu); continue; } if (!bu.delete()) { logWarning(NLS.bind(Messages.BackupStore_can_not_delete_tmp_file, bu.getAbsolutePath())); } } else restoreCounter++; } } }
Source:
public void testRemoveClientScope() { ClientScopeRepresentation templateRep = new ClientScopeRepresentation(); templateRep.setName("scope1"); String template1Id = createClientScope(templateRep); List<ClientScopeRepresentation> clientScopes = clientScopes().findAll(); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope1")); templateRep = new ClientScopeRepresentation(); templateRep.setName("scope2"); String template2Id = createClientScope(templateRep); clientScopes = clientScopes().findAll(); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope2")); removeClientScope(template1Id); clientScopes = clientScopes().findAll(); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope1")); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope2")); removeClientScope(template2Id); clientScopes = clientScopes().findAll(); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope1")); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope2")); }

Target:
public void testRemoveClientScope() { ClientScopeRepresentation scopeRep = new ClientScopeRepresentation(); scopeRep.setName("scope1"); String scope1Id = createClientScope(scopeRep); List<ClientScopeRepresentation> clientScopes = clientScopes().findAll(); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope1")); scopeRep = new ClientScopeRepresentation(); scopeRep.setName("scope2"); String scope2Id = createClientScope(scopeRep); clientScopes = clientScopes().findAll(); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope2")); removeClientScope(scope1Id); clientScopes = clientScopes().findAll(); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope1")); Assert.assertTrue(getClientScopeNames(clientScopes).contains("scope2")); removeClientScope(scope2Id); clientScopes = clientScopes().findAll(); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope1")); Assert.assertFalse(getClientScopeNames(clientScopes).contains("scope2")); }
Source:
public static void copyLabels(ReviewDb db, LabelTypes labelTypes, Iterable<PatchSetApproval> sourceApprovals, PatchSet.Id source, PatchSet dest, boolean trivialRebase) throws OrmException { List<PatchSetApproval> copied = Lists.newArrayList(); List<String> labelsCopiedForTrivialRebase = Lists.newArrayList(); for (PatchSetApproval a : sourceApprovals) { if (source.equals(a.getPatchSetId())) { LabelType type = labelTypes.byLabel(a.getLabelId()); if (type == null) { continue; } else if (type.isCopyMinScore() && type.isMaxNegative(a)) { copied.add(new PatchSetApproval(dest.getId(), a)); } else if (type.isCopyMaxScore() && type.isMaxPositive(a)) { copied.add(new PatchSetApproval(dest.getId(), a)); } else if (type.isCopyAllScoresOnTrivialRebase() && trivialRebase) { labelsCopiedForTrivialRebase.add(type.getName()); copied.add(new PatchSetApproval(dest.getId(), a)); } } } if (!labelsCopiedForTrivialRebase.isEmpty()) { ChangeMessage cmsg = new ChangeMessage(new ChangeMessage.Key(dest.getId().getParentKey(), ChangeUtil.messageUUID(db)), dest.getUploader(), dest.getId()); cmsg.setMessage("Patch Set " + dest + ": Label" + (labelsCopiedForTrivialRebase.size() > 1 ? "s" : "") + " " + StringUtils.join(labelsCopiedForTrivialRebase, ", ") + " copied for trivial rebase"); db.changeMessages().beginTransaction(cmsg.getKey()); db.changeMessages().insert(Collections.singleton(cmsg)); } db.patchSetApprovals().insert(copied); }

Target:
public static void copyLabels(ReviewDb db, LabelTypes labelTypes, Iterable<PatchSetApproval> sourceApprovals, PatchSet.Id source, PatchSet dest, boolean trivialRebase) throws OrmException { List<PatchSetApproval> copied = Lists.newArrayList(); for (PatchSetApproval a : sourceApprovals) { if (source.equals(a.getPatchSetId())) { LabelType type = labelTypes.byLabel(a.getLabelId()); if (type == null) { continue; } else if (type.isCopyMinScore() && type.isMaxNegative(a)) { copied.add(new PatchSetApproval(dest.getId(), a)); } else if (type.isCopyMaxScore() && type.isMaxPositive(a)) { copied.add(new PatchSetApproval(dest.getId(), a)); } else if (type.isCopyAllScoresOnTrivialRebase() && trivialRebase) { copied.add(new PatchSetApproval(dest.getId(), a)); } } } db.patchSetApprovals().insert(copied); }
Source:
public Filter springSecurityFilterChain() throws Exception { boolean hasConfigurers = webSecurityConfigurers != null && !webSecurityConfigurers.isEmpty(); boolean hasFilterChain = !securityFilterChains.isEmpty(); if (hasConfigurers && hasFilterChain) { throw new IllegalStateException( "Found WebSecurityConfigurerAdapter as well as SecurityFilterChain." + "Please select just one."); } if (!hasConfigurers && !hasFilterChain) { WebSecurityConfigurerAdapter adapter = objectObjectPostProcessor .postProcess(new WebSecurityConfigurerAdapter() { }); webSecurity.apply(adapter); } for (SecurityFilterChain securityFilterChain : securityFilterChains) { webSecurity.addSecurityFilterChain(securityFilterChain); for (Filter filter : securityFilterChain.getFilters()) { if (filter instanceof FilterSecurityInterceptor) { webSecurity.securityInterceptor((FilterSecurityInterceptor) filter); break; } } } return webSecurity.build(); }

Target:
public Filter springSecurityFilterChain() throws Exception { boolean hasConfigurers = webSecurityConfigurers != null && !webSecurityConfigurers.isEmpty(); boolean hasFilterChain = !securityFilterChains.isEmpty(); if (hasConfigurers && hasFilterChain) { throw new IllegalStateException( "Found WebSecurityConfigurerAdapter as well as SecurityFilterChain." + "Please select just one."); } if (!hasConfigurers && !hasFilterChain) { WebSecurityConfigurerAdapter adapter = objectObjectPostProcessor .postProcess(new WebSecurityConfigurerAdapter() { }); webSecurity.apply(adapter); } for (SecurityFilterChain securityFilterChain : securityFilterChains) { webSecurity.addSecurityFilterChainBuilder(() -> securityFilterChain); for (Filter filter : securityFilterChain.getFilters()) { if (filter instanceof FilterSecurityInterceptor) { webSecurity.securityInterceptor((FilterSecurityInterceptor) filter); break; } } } return webSecurity.build(); }
Source:
if (logger.isTraceEnabled()) { CLIENT_STATS = new MetricRegistry(); final Slf4jReporter reporter = Slf4jReporter.forRegistry(CLIENT_STATS) .outputTo(logger) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES); }

Target:
if (logger.isTraceEnabled()) { enable(); final Slf4jReporter reporter = Slf4jReporter.forRegistry(getClientStats()) .outputTo(logger) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES); }
Source:
private static TypeUrl ofTypeUrl(String typeUrl) { final String[] parts = typeUrlSeparatorPattern.split(typeUrl); if (parts.length != 2 || parts[0].trim() .isEmpty() || parts[1].trim() .isEmpty()) { throw new IllegalArgumentException( new InvalidProtocolBufferException("Invalid Protobuf type URL encountered: " + typeUrl)); } return create(parts[0], parts[1]); }

Target:
private static TypeUrl ofTypeUrl(String typeUrl) { final String[] parts = typeUrlSeparatorPattern.split(typeUrl); if (parts.length != 2) { throw malformedTypeUrl(typeUrl); } final String prefix = parts[0].trim(); if (prefix.isEmpty()) { throw malformedTypeUrl(typeUrl); } final String typeName = parts[1].trim(); if (typeName.isEmpty()) { throw malformedTypeUrl(typeUrl); } return create(prefix, typeName); }
Source:
public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException { if (!getModel().getTaskData().isNew() && attachContext) { monitor.subTask(org.eclipse.mylyn.internal.tasks.ui.wizards.Messages.TaskAttachmentWizard_Attaching_context); TaskData taskData = getModel().getTaskData(); TaskAttribute taskAttribute = taskData.getRoot().createAttribute( taskData.getAttributeMapper().mapToRepositoryKey(taskData.getRoot(), TaskAttribute.NEW_ATTACHMENT)); AttachmentUtil.postContext(connector, getModel().getTaskRepository(), task, "", taskAttribute, monitor); } }

Target:
public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException { if (!getModel().getTaskData().isNew() && attachContext) { TaskData taskData = getModel().getTaskData(); TaskAttribute taskAttribute = null; if (taskData != null) { taskAttribute = taskData.getRoot().createMappedAttribute(TaskAttribute.NEW_ATTACHMENT); } AttachmentUtil.postContext(connector, getModel().getTaskRepository(), task, "", taskAttribute, monitor); } }
Source:
public static WebAppDescriptor.Builder getBuilder() { if (!isCompatApiEnabled()) { return getBuilderForVladimir(); } else { return getBuilderForLegacyApi(); } }

Target:
public static WebAppDescriptor.Builder getBuilder() { if (isCompatApiEnabled()) { return getBuilderForVladimir(); } else { return getBuilderForLegacyApi(); } }
Source:
@Override public Set<BigInteger> getTokens() { Set<BigInteger> tokens = getAttribute(CassandraNode.TOKENS); if (tokens == null) { BigInteger token = getAttribute(CassandraNode.TOKEN); if (token != null) { tokens = ImmutableSet.of(token); } } if (tokens == null) { tokens = getAttribute(CassandraNode.TOKENS); } if (tokens == null) { BigInteger token = getAttribute(CassandraNode.TOKEN); if (token != null) { tokens = ImmutableSet.of(token); } } return tokens; }

Target:
@Override public Set<BigInteger> getTokens() { Set<BigInteger> tokens = getAttribute(CassandraNode.TOKENS); if (tokens == null) { BigInteger token = getAttribute(CassandraNode.TOKEN); if (token != null) { tokens = ImmutableSet.of(token); } } if (tokens == null) { tokens = getConfig(CassandraNode.TOKENS); } if (tokens == null) { BigInteger token = getConfig(CassandraNode.TOKEN); if (token != null) { tokens = ImmutableSet.of(token); } } return tokens; }
Source:
public static String formatString(final IUser user, final String permBase, final String input) { if (input == null) { return null; } String message; if (user.isAuthorized(permBase + ".color")) { message = replaceColor(input, REPLACE_COLOR_PATTERN); } else { message = stripColor(stripColor(input, REPLACE_COLOR_PATTERN), VANILLA_COLOR_PATTERN); } if (user.isAuthorized(permBase + ".magic")) { message = replaceColor(message, REPLACE_MAGIC_PATTERN); } else { message = stripColor(stripColor(message, REPLACE_MAGIC_PATTERN), VANILLA_MAGIC_PATTERN); } if (user.isAuthorized(permBase + ".format")) { message = replaceColor(message, REPLACE_FORMAT_PATTERN); } else { message = stripColor(stripColor(message, REPLACE_FORMAT_PATTERN), VANILLA_FORMAT_PATTERN); } return message; }

Target:
public static String formatString(final IUser user, final String permBase, final String input) { if (input == null) { return null; } String message; if (user.isAuthorized(permBase + ".color")) { message = replaceColor(input, REPLACE_COLOR_PATTERN); } else { message = stripColor(input, VANILLA_COLOR_PATTERN); } if (user.isAuthorized(permBase + ".magic")) { message = replaceColor(message, REPLACE_MAGIC_PATTERN); } else { message = stripColor(message, VANILLA_MAGIC_PATTERN); } if (user.isAuthorized(permBase + ".format")) { message = replaceColor(message, REPLACE_FORMAT_PATTERN); } else { message = stripColor(message, VANILLA_FORMAT_PATTERN); } return message; }
Source:
public void testMaxRetries() { EasyMock.expectLastCall().times(20); EasyMock.replay(registry); props.setProperty(GET_SCHEMA_BY_ID_MAX_RETIRES, "10"); props.setProperty(GET_SCHEMA_BY_ID_MIN_INTERVAL_SECONDS, "0"); cachedRegistry = new CachedSchemaRegistry<Schema>(registry, props); for (int i = 0; i < 100; i++) { try { cachedRegistry.getSchemaByID("dummyTopic", "dummyID"); } catch (SchemaNotFoundException e) { } try { cachedRegistry.getSchemaByID("dummyTopic", "dummyID2"); } catch (SchemaNotFoundException e) { } } EasyMock.verify(registry); }

Target:
public void testMaxRetries() { EasyMock.expect(registry.getSchemaByID(EasyMock.anyString(), EasyMock.anyString())).andThrow( new SchemaNotFoundException()); EasyMock.expectLastCall().times(20); EasyMock.replay(registry); props.setProperty(GET_SCHEMA_BY_ID_MAX_RETIRES, "10"); props.setProperty(GET_SCHEMA_BY_ID_MIN_INTERVAL_SECONDS, "0"); cachedRegistry = new CachedSchemaRegistry<Schema>(registry, props); for (int i = 0; i < 100; i++) { try { cachedRegistry.getSchemaByID("dummyTopic", "dummyID"); } catch (SchemaNotFoundException e) { } try { cachedRegistry.getSchemaByID("dummyTopic", "dummyID2"); } catch (SchemaNotFoundException e) { } } EasyMock.verify(registry); }
Source:
public void tearDown() { _warrantMgr.dispose(); _warrantMgr = null; _OBlockMgr.dispose(); _OBlockMgr = null; _sensorMgr.dispose(); _sensorMgr = null; if (InstanceManager.containsDefault(ShutDownManager.class)) { ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); List<Runnable> rlist = sm.getRunnables(); while (!rlist.isEmpty()) { if (rlist.get(0) instanceof jmri.jmrit.logix.WarrantShutdownTask) { sm.deregister((ShutDownTask)rlist.get(0)); rlist = sm.getRunnables(); } } } JUnitUtil.tearDown(); }

Target:
public void tearDown() { _warrantMgr.dispose(); _warrantMgr = null; _OBlockMgr.dispose(); _OBlockMgr = null; _sensorMgr.dispose(); _sensorMgr = null; if (InstanceManager.containsDefault(ShutDownManager.class)) { List<ShutDownTask> list = new ArrayList<>(); ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); for (Runnable r : sm.getRunnables()) { if (r instanceof jmri.jmrit.logix.WarrantShutdownTask) { list.add((ShutDownTask)r); } } for ( ShutDownTask t : list) { sm.deregister(t); } } JUnitUtil.clearShutDownManager(); JUnitUtil.tearDown(); }
Source:
public void post(final Object entity, final InputStream stdin, final ResultCallback<Frame> resultCallback) { HttpRequestProvider requestProvider = httpPostRequestProvider(entity); FramedResponseStreamHandler streamHandler = new FramedResponseStreamHandler(resultCallback); final Channel channel = getChannel(); channel.closeFuture().addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { resultCallback.onComplete(); } }); HttpResponseHandler responseHandler = new HttpResponseHandler(requestProvider, resultCallback); HttpConnectionHijackHandler hijackHandler = new HttpConnectionHijackHandler(responseHandler); HttpClientCodec httpClientCodec = channel.pipeline().get(HttpClientCodec.class); channel.pipeline().addLast( new HttpClientUpgradeHandler(httpClientCodec, hijackHandler, Integer.MAX_VALUE)); channel.pipeline().addLast(streamHandler); sendRequest(requestProvider, channel); hijackHandler.awaitUpgrade(); if (stdin != null) { new Thread(new Runnable() { private int read(InputStream is, byte[] buf) { try { return is.read(buf); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void run() { byte[] buffer = new byte[1024]; int read; while ((read = read(stdin, buffer)) != -1) { channel.writeAndFlush(Unpooled.copiedBuffer(buffer, 0, read)); } if (channel instanceof DuplexChannel) { ((DuplexChannel) channel).shutdownOutput(); } } }).start(); } }

Target:
public void post(final Object entity, final InputStream stdin, final ResultCallback<Frame> resultCallback) { HttpRequestProvider requestProvider = httpPostRequestProvider(entity); FramedResponseStreamHandler streamHandler = new FramedResponseStreamHandler(resultCallback); final DuplexChannel channel = getChannel(); channel.closeFuture().addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { resultCallback.onComplete(); } }); HttpResponseHandler responseHandler = new HttpResponseHandler(requestProvider, resultCallback); HttpConnectionHijackHandler hijackHandler = new HttpConnectionHijackHandler(responseHandler); HttpClientCodec httpClientCodec = channel.pipeline().get(HttpClientCodec.class); channel.pipeline().addLast( new HttpClientUpgradeHandler(httpClientCodec, hijackHandler, Integer.MAX_VALUE)); channel.pipeline().addLast(streamHandler); sendRequest(requestProvider, channel); hijackHandler.awaitUpgrade(); if (stdin != null) { new Thread(new Runnable() { private int read(InputStream is, byte[] buf) { try { return is.read(buf); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void run() { byte[] buffer = new byte[1024]; int read; while ((read = read(stdin, buffer)) != -1) { channel.writeAndFlush(Unpooled.copiedBuffer(buffer, 0, read)); } channel.shutdownOutput(); } }).start(); } }
Source:
public ParameterizedExecutableType methodFromUse(MethodInvocationTree tree) { ParameterizedExecutableType mType = super.methodFromUse(tree); AnnotatedExecutableType method = mType.executableType; systemGetPropertyHandler.handle(tree, method); collectionToArrayHeuristics.handle(tree, method); System.out.printf("tree: %s%n", tree); if (TreeUtils.isMethodInvocation(tree, classGetCanonicalName, processingEnv)) { System.out.printf("is invocation%n"); ExpressionTree receiver = ((MemberSelectTree) tree.getMethodSelect()).getExpression(); System.out.printf("receiver: %s%n", receiver); if ((receiver instanceof MemberSelectTree) && ((MemberSelectTree) receiver).getIdentifier().contentEquals("class")) { AnnotatedTypeMirror type = method.getReturnType(); type.replaceAnnotation(NONNULL); } } return mType; }

Target:
public ParameterizedExecutableType methodFromUse(MethodInvocationTree tree) { ParameterizedExecutableType mType = super.methodFromUse(tree); AnnotatedExecutableType method = mType.executableType; systemGetPropertyHandler.handle(tree, method); collectionToArrayHeuristics.handle(tree, method); if (TreeUtils.isMethodInvocation(tree, classGetCanonicalName, processingEnv)) { ExpressionTree receiver = ((MemberSelectTree) tree.getMethodSelect()).getExpression(); if (TreeUtils.isClassLiteral(receiver)) { AnnotatedTypeMirror type = method.getReturnType(); type.replaceAnnotation(NONNULL); } } return mType; }
Source:
public ResolveScenarioWizardDialog(JFrame parent, boolean modal, ResolveScenarioTracker t) { super(parent, modal); this.frame = parent; this.tracker = t; loots = tracker.getPotentialLoot(); salvageables = new ArrayList<>(); if(tracker.getMission() instanceof Contract) { salvageEmployer = ((Contract)tracker.getMission()).getSalvagedByEmployer(); salvageUnit = ((Contract)tracker.getMission()).getSalvagedByUnit(); maxSalvagePct = ((Contract)tracker.getMission()).getSalvagePct(); currentSalvagePct = 0; if (salvageUnit.plus(salvageEmployer).isPositive()) { currentSalvagePct = salvageUnit.getAmount() .multiply(new BigDecimal(100)) .divide(salvageUnit.plus(salvageEmployer).getAmount(), RoundingMode.HALF_EVEN) .intValue(); } } currentPanel = UNITSPANEL; initComponents(); setLocationRelativeTo(parent); }

Target:
public ResolveScenarioWizardDialog(JFrame parent, boolean modal, ResolveScenarioTracker t) { super(parent, modal); this.frame = parent; this.tracker = t; loots = tracker.getPotentialLoot(); salvageables = new ArrayList<>(); if(tracker.getMission() instanceof Contract) { salvageEmployer = ((Contract)tracker.getMission()).getSalvagedByEmployer(); salvageUnit = ((Contract)tracker.getMission()).getSalvagedByUnit(); maxSalvagePct = ((Contract)tracker.getMission()).getSalvagePct(); currentSalvagePct = 0; if (salvageUnit.plus(salvageEmployer).isPositive()) { currentSalvagePct = salvageUnit .multipliedBy(100) .dividedBy(salvageUnit.plus(salvageEmployer)) .getAmount().intValue(); } } currentPanel = UNITSPANEL; initComponents(); setLocationRelativeTo(parent); }
Source:
public void setErrorMessageProvider(Function<Throwable, String> errorMessageProvider) { this.errorMessageProvider = errorMessageProvider; }

Target:
public void setErrorMessageProvider(Function<Throwable, String> errorMessageProvider) { if (errorMessageProvider == null) { throw new IllegalArgumentException(Messages.LogThroughActiveDialectEditorLogListener_wrongErrorMessageProvider); } else { this.errorMessageProvider = errorMessageProvider; } }
Source:
public ArrayInterface insertString(int index, String value) { return insertObject(index, value); }

Target:
public Array insertString(int index, String value) { return insertObject(index, value); }
Source:
public ClearAlarmRegisterResponse getClearAlarmRegisterResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ClearAlarmRegisterAsyncRequest request) throws OsgpException { LOGGER.info("Incoming clear alarm register request for meter: {}", request.getDeviceIdentification()); ClearAlarmRegisterResponse response = null; try { response = new ClearAlarmRegisterResponse(); final MeterResponseData meterResponseData = this.meterResponseDataService .dequeue(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "Clear alarm register"); response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } catch (final FunctionalException e) { throw e; } catch (final Exception e) { LOGGER.error("Exception: while sending clear alarm register request of device: for organisation {}.", e.getMessage(), request.getDeviceIdentification(), organisationIdentification); this.handleException(e); } return response; }

Target:
public ClearAlarmRegisterResponse getClearAlarmRegisterResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ClearAlarmRegisterAsyncRequest request) throws OsgpException { LOGGER.info("Incoming clear alarm register request for meter: {}", request.getDeviceIdentification()); ClearAlarmRegisterResponse response = null; try { response = new ClearAlarmRegisterResponse(); final MeterResponseData meterResponseData = this.meterResponseDataService .dequeue(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "Retrieving clear alarm register"); response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } catch (final FunctionalException e) { throw e; } catch (final Exception e) { LOGGER.error("Exception: while sending clear alarm register request of device: for organisation {}.", e.getMessage(), request.getDeviceIdentification(), organisationIdentification); this.handleException(e); } return response; }
Source:
public void notifySuperUsers(String messageCode, Exception cause, Object... messageArguments) { String message = Context.getMessageSourceService().getMessage(messageCode, messageArguments, Context.getLocale()); if (cause != null) { StringBuilder stackTrace = new StringBuilder(); for (StackTraceElement traceElement : cause.getStackTrace()) { stackTrace.append(traceElement); stackTrace.append("\n"); if (stackTrace.length() >= Alert.TEXT_MAX_LENGTH) { break; } } message = message + ":" + stackTrace; message = message.substring(0, Math.min(message.length(), Alert.TEXT_MAX_LENGTH)); } Alert alert = new Alert(message, Context.getUserService().getUsersByRole(new Role(RoleConstants.SUPERUSER))); alert.setSatisfiedByAny(true); if (alert.getCreator() == null) { TimerSchedulerTask task = new TimerSchedulerTask(new AbstractTask(){ @Override public void execute() { log.info("Creating alert as Daemon User."); User user = Daemon.getDaemonThreadUser(); alert.setCreator(user); Context.getAlertService().saveAlert(alert); stopExecuting(); shutdown(); } }); task.run(); } else { Context.getAlertService().saveAlert(alert); } }

Target:
public void notifySuperUsers(String messageCode, Exception cause, Object... messageArguments) { String message = Context.getMessageSourceService().getMessage(messageCode, messageArguments, Context.getLocale()); if (cause != null) { StringBuilder stackTrace = new StringBuilder(); for (StackTraceElement traceElement : cause.getStackTrace()) { stackTrace.append(traceElement); stackTrace.append("\n"); if (stackTrace.length() >= Alert.TEXT_MAX_LENGTH) { break; } } message = message + ":" + stackTrace; message = message.substring(0, Math.min(message.length(), Alert.TEXT_MAX_LENGTH)); } Alert alert = new Alert(message, Context.getUserService().getUsersByRole(new Role(RoleConstants.SUPERUSER))); alert.setSatisfiedByAny(true); if (alert.getCreator() == null) { User daemonUser = Context.getUserService().getUserByUuid(Daemon.getDaemonUserUuid()); alert.setCreator(daemonUser); } Context.getAlertService().saveAlert(alert); }
Source:
private List<CatalogItemDtoAbstract<?,?>> collectCatalogItems(String yaml) { Map<?,?> itemDef = Yamls.getAs(Yamls.parseAll(yaml), Map.class); Map<?,?> catalogMetadata = getFirstAsMap(itemDef, "brooklyn.catalog").orNull(); if (catalogMetadata==null) log.warn("No `brooklyn.catalog` supplied in catalog request; using legacy mode for "+itemDef); catalogMetadata = MutableMap.copyOf(catalogMetadata); List<CatalogItemDtoAbstract<?, ?>> result = MutableList.of(); collectCatalogItems(Yamls.getTextOfYamlAtPath(yaml, "brooklyn.catalog").getMatchedYamlTextOrWarn(), catalogMetadata, result, null); itemDef.remove("brooklyn.catalog"); catalogMetadata.remove("item"); catalogMetadata.remove("items"); if (!itemDef.isEmpty()) { log.debug("Reading brooklyn.catalog peer keys as item ('top-level syntax')"); Map<String,?> rootItem = MutableMap.of("item", (Object) itemDef); String rootItemYaml = yaml; YamlExtract yamlExtract = Yamls.getTextOfYamlAtPath(rootItemYaml, "brooklyn.catalog"); String match = yamlExtract.withOriginalIndentation(true).withKeyIncluded(true).getMatchedYamlTextOrWarn(); if (match!=null) { if (rootItemYaml.startsWith(match)) rootItemYaml = Strings.removeFromStart(rootItemYaml, match); else rootItemYaml = Strings.replaceAllNonRegex(rootItemYaml, "\n"+match, ""); } collectCatalogItems("item:\n"+makeAsIndentedObject(rootItemYaml), rootItem, result, catalogMetadata); } return result; }

Target:
private List<CatalogItemDtoAbstract<?,?>> collectCatalogItems(String yaml) { Map<?,?> itemDef = Yamls.getAs(Yamls.parseAll(yaml), Map.class); Map<?,?> catalogMetadata = getFirstAsMap(itemDef, "brooklyn.catalog").orNull(); if (catalogMetadata==null) log.warn("No `brooklyn.catalog` supplied in catalog request; using legacy mode for "+itemDef); catalogMetadata = MutableMap.copyOf(catalogMetadata); List<CatalogItemDtoAbstract<?, ?>> result = MutableList.of(); collectCatalogItems(Yamls.getTextOfYamlAtPath(yaml, "brooklyn.catalog").getMatchedYamlTextOrWarn(), catalogMetadata, result, null); itemDef.remove("brooklyn.catalog"); catalogMetadata.remove("item"); catalogMetadata.remove("items"); if (!itemDef.isEmpty()) { log.debug("Reading brooklyn.catalog peer keys as item ('top-level syntax')"); Map<String,?> rootItem = MutableMap.of("item", itemDef); String rootItemYaml = yaml; YamlExtract yamlExtract = Yamls.getTextOfYamlAtPath(rootItemYaml, "brooklyn.catalog"); String match = yamlExtract.withOriginalIndentation(true).withKeyIncluded(true).getMatchedYamlTextOrWarn(); if (match!=null) { if (rootItemYaml.startsWith(match)) rootItemYaml = Strings.removeFromStart(rootItemYaml, match); else rootItemYaml = Strings.replaceAllNonRegex(rootItemYaml, "\n"+match, ""); } collectCatalogItems("item:\n"+makeAsIndentedObject(rootItemYaml), rootItem, result, catalogMetadata); } return result; }
Source:
public PlanWithProperties visitOutput(OutputNode node, Context context) { PlanWithProperties child = planChild(node, context.withPreferredProperties(PreferredProperties.undistributed())); if ((child.getNode() instanceof ExchangeNode) && ((ExchangeNode) child.getNode()).getType() == ExchangeNode.Type.GATHER) { return rebaseAndDeriveProperties(node, child); } if (!child.getProperties().isSingleNode()) { child = withDerivedProperties( gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } else if (!child.getProperties().isCoordinatorOnly()) { child = withDerivedProperties( gatheringOrderSensitiveExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }

Target:
public PlanWithProperties visitOutput(OutputNode node, Context context) { PlanWithProperties child = planChild(node, context.withPreferredProperties(PreferredProperties.undistributed())); if ((child.getNode() instanceof ExchangeNode) && ((ExchangeNode) child.getNode()).getType() == ExchangeNode.Type.GATHER) { return rebaseAndDeriveProperties(node, child); } if (!child.getProperties().isSingleNode()) { child = withDerivedProperties( gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } else if (!child.getProperties().isCoordinatorOnly() && isExchangeAddedBelowOutput(session)) { child = withDerivedProperties( gatheringOrderSensitiveExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }
Source:
public void scale(String streamName, String appName, int count, Map<String, String> properties) { this.skipperClient.scale(streamName, appName, count, properties); }

Target:
public void scale(String streamName, String appName, int count, Map<String, String> properties) { this.skipperClient.scale(streamName, ScaleRequest.of(appName, count, properties)); }
Source:
private List<HudsonMatrixMatrixProject> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonMatrixMatrixProject>>(client) { @Override protected List<HudsonMatrixMatrixProject> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(2) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonMatrixMatrixProject> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonMatrixMatrixProject> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonMatrixMatrixProject job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(2) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final Color other = (Color) obj; return Objects.equals(this.red, other.red) && Objects.equals(this.green, other.green) && Objects.equals(this.blue, other.blue); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final Color other = (Color) obj; return this.red == other.red && this.green == other.green && this.blue == other.blue; }
Source:
public void execute(EntityPlayer player) { if(player != null && player.world != null && !player.world.isRemote) { if(ServerEditHandler.getData(player) != null) return; if(this.type == MODUS && player.openContainer instanceof ContainerCaptchaDeck) CaptchaDeckHandler.useItem((EntityPlayerMP) player); else if(this.type == CAPTCHALOUGE && !player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND).isEmpty()) CaptchaDeckHandler.captchalougeItem((EntityPlayerMP) player); else if(this.type == CAPTCHALOUGE_INV) CaptchaDeckHandler.captchalougeInventoryItem((EntityPlayerMP) player); else if(this.type == GET) CaptchaDeckHandler.getItem((EntityPlayerMP) player, itemIndex, getCard); else if(this.type == VALUE && CaptchaDeckHandler.getModus(player) != null) CaptchaDeckHandler.getModus(player).setValue(valueType, value); } else { if(this.type == DATA) { CaptchaDeckHandler.clientSideModus = CaptchaDeckHandler.readFromNBT(nbt, true); if(CaptchaDeckHandler.clientSideModus != null) CaptchaDeckHandler.clientSideModus.getGuiHandler().updateContent(); else Debug.debug("Lost modus"); } } }

Target:
public void execute(EntityPlayer player) { if(player != null && player.world != null && !player.world.isRemote) { if(ServerEditHandler.getData(player) != null) return; if(this.type == MODUS && player.openContainer instanceof ContainerCaptchaDeck) CaptchaDeckHandler.useItem((EntityPlayerMP) player); else if(this.type == CAPTCHALOUGE && !player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND).isEmpty()) CaptchaDeckHandler.captchalougeItem((EntityPlayerMP) player); else if(this.type == CAPTCHALOUGE_INV) { CaptchaDeckHandler.captchalougeInventoryItem((EntityPlayerMP) player, slotIndex); } else if(this.type == GET) CaptchaDeckHandler.getItem((EntityPlayerMP) player, itemIndex, getCard); else if(this.type == VALUE && CaptchaDeckHandler.getModus(player) != null) CaptchaDeckHandler.getModus(player).setValue(valueType, value); } else { if(this.type == DATA) { CaptchaDeckHandler.clientSideModus = CaptchaDeckHandler.readFromNBT(nbt, true); if(CaptchaDeckHandler.clientSideModus != null) CaptchaDeckHandler.clientSideModus.getGuiHandler().updateContent(); else Debug.debug("Lost modus"); } } }
Source:
public void getKiePMMLModel() throws Exception { }

Target:
public void getKiePMMLModel() throws Exception { throw new UnsupportedOperationException(); }
Source:
private void destroyTooltips() { $("[title]").as(Tooltip).destroy(); }

Target:
private void destroyTooltips() { $("[title]", asWidget()).as(Tooltip).destroy(); }
Source:
private void test(int qos) throws MqttException { String subscriberId = UUID.randomUUID().toString(); String senderId = UUID.randomUUID().toString(); String topic = UUID.randomUUID().toString(); subscriber = createMqttClient(subscriberId); subscriber.subscribe(topic, qos); sender = createMqttClient(senderId); sender.publish(topic, UUID.randomUUID().toString().getBytes(), qos, false); sender.publish(topic, UUID.randomUUID().toString().getBytes(), qos, false); Awaitility.await().atMost(5_000, TimeUnit.MILLISECONDS).until(() -> messageIds.size() == 2); subscriber.messageArrivedComplete(messageIds.getLast(), qos); subscriber.disconnect(); subscriber.close(); messageArrived = false; Awaitility.await().atMost(60_000, TimeUnit.MILLISECONDS).until(() -> { try { subscriber = createMqttClient(subscriberId); return true; } catch (MqttException e) { return false; } }); Awaitility.await().atMost(5_000, TimeUnit.MILLISECONDS).until(() -> messageArrived == true); }

Target:
private void test(int qos) throws Exception { String subscriberId = UUID.randomUUID().toString(); String senderId = UUID.randomUUID().toString(); String topic = UUID.randomUUID().toString(); subscriber = createMqttClient(subscriberId); subscriber.subscribe(topic, qos); sender = createMqttClient(senderId); sender.publish(topic, UUID.randomUUID().toString().getBytes(), qos, false); sender.publish(topic, UUID.randomUUID().toString().getBytes(), qos, false); boolean satisfied = Wait.waitFor(() -> messageIds.size() == 2, 5_000); if (!satisfied) { Assert.fail(); } subscriber.messageArrivedComplete(messageIds.getLast(), qos); subscriber.disconnect(); subscriber.close(); messageArrived = false; satisfied = Wait.waitFor(() -> { try { subscriber = createMqttClient(subscriberId); return true; } catch (MqttException e) { return false; } }, 60_000); if (!satisfied) { Assert.fail(); } satisfied = Wait.waitFor(() -> messageArrived == true, 5_000); if (!satisfied) { Assert.fail(); } }
Source:
protected static Integer convertVolumePercent(final Double maxDecibels, final Integer volumePercent) { if (volumePercent > 100 || volumePercent < 0) { throw new IllegalArgumentException(String.format("volumePercent must be in the range [0, 100], not %s", volumePercent)); } final double decibelOffsetFromMaximum = 33.22 * Math.log10(volumePercent / 100.0); final double decibels = maxDecibels + decibelOffsetFromMaximum; return (int) Math.round((decibels / maxDecibels) * 100); }

Target:
protected static Integer convertVolumePercent(final Double maxDecibels, final Integer volumePercent) { if (volumePercent > 100 || volumePercent <= 0) { throw new IllegalArgumentException(String.format("volumePercent must be in the range (0, 100], not %s", volumePercent)); } final double decibelOffsetFromMaximum = 33.22 * Math.log10(volumePercent / 100.0); final double decibels = maxDecibels + decibelOffsetFromMaximum; return (int) Math.round((decibels / maxDecibels) * 100); }
Source:
public void dispose() { Iterator<AbstractAttributeEditor> editorIterator = editors.iterator(); while (editorIterator.hasNext()) { AbstractAttributeEditor editor = editorIterator.next(); editor.dispose(); } }

Target:
public void dispose() { for (AbstractAttributeEditor editor : editors) { editor.dispose(); } editors.clear(); }
Source:
public void close() { if (shuttingDown.getAndSet(true)) { return; } logger.info("closing started"); if (requesterPool != null) { try { requesterPool.shutdown(); requesterPool.awaitTermination(1, TimeUnit.MINUTES); } catch (Exception e) { logger.error("Error while shutting down requesterPool in coordinator {}", e); } this.requesterPool = null; } if (connectionPool != null) { try { connectionPool.shutdown(); } catch (Exception e) { logger.error("Error while shutting down connectionPool in coordinator {}", e); } connectionPool = null; } try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } logger.info("clsoing completed"); }

Target:
public void close() { if (shuttingDown.getAndSet(true)) { return; } logger.info("closing started"); if (requesterPool != null) { try { requesterPool.shutdown(); requesterPool.awaitTermination(1, TimeUnit.MINUTES); } catch (Exception e) { logger.error("Error while shutting down requesterPool in coordinator {}", e); } this.requesterPool = null; } if (connectionPool != null) { try { connectionPool.shutdown(); } catch (Exception e) { logger.error("Error while shutting down connectionPool in coordinator {}", e); } connectionPool = null; } try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } logger.info("closing completed"); }
Source:
public GeodeRedisServer() { this(null, 0, null); }

Target:
public GeodeRedisServer() { this(null, RANDOM_PORT_INDICATOR, null); }