auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void processIdent(DetailAST ast) { final DetailAST parent = ast.getParent(); final int parentType = parent.getType(); if ((parentType != TokenTypes.DOT && parentType != TokenTypes.METHOD_DEF || parentType == TokenTypes.DOT && ast.getNextSibling() != null) && !innerInterfaceOrClass(parentType)) { referenced.add(ast.getText()); } }

Target:
private void processIdent(DetailAST ast) { final DetailAST parent = ast.getParent(); final int parentType = parent.getType(); if ((parentType != TokenTypes.DOT && parentType != TokenTypes.METHOD_DEF || parentType == TokenTypes.DOT && ast.getNextSibling() != null) && !isEnumDefinitionOrType(ast) && !isAnnotation(ast) && !isInnerInterfaceOrClass(parentType)) { referenced.add(ast.getText()); } }
Source:
public void addItem(final Element enumerationItem) { enumerationItem.setAttribute("data-position", items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); }

Target:
public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); }
Source:
protected void doRun() throws Exception { URL url = Trigger.all().get(GitHubPushTrigger.DescriptorImpl.class).getHookUrl(); List<AbstractProject> jobs = Jenkins.getInstance().getAllItems(AbstractProject.class); List<GitHubRepositoryName> aliveRepos = from(jobs) .filter(withTrigger(GitHubPushTrigger.class)) .transformAndConcat(associatedNames()).toList(); while (!сleanQueue.isEmpty()) { GitHubRepositoryName name = сleanQueue.poll(); WebhookManager.forHookUrl(url).unregisterFor(name, aliveRepos); } }

Target:
protected void doRun() throws Exception { URL url = Trigger.all().get(GitHubPushTrigger.DescriptorImpl.class).getHookUrl(); List<AbstractProject> jobs = Jenkins.getInstance().getAllItems(AbstractProject.class); List<GitHubRepositoryName> aliveRepos = from(jobs) .filter(isAlive()) .transformAndConcat(associatedNames()).toList(); while (!сleanQueue.isEmpty()) { GitHubRepositoryName name = сleanQueue.poll(); WebhookManager.forHookUrl(url).unregisterFor(name, aliveRepos); } }
Source:
public float getPrefHeight() { return Editor.getWidth() * this.width; }

Target:
public float getPrefHeight() { return this.viewport.x * this.width; }
Source:
public void reloadsConfiguration() throws Exception { Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); final File path = this.temp.newFolder(); final SSHD sshd = new SSHD(path); try { sshd.start(); final File key = this.temp.newFile(); FileUtils.write(key, sshd.key()); this.manifest(path, sshd.login(), sshd.port(), key); final String bin = String.format( "%s.sh", RandomStringUtils.randomAlphanumeric(128) ); final File script = this.temp.newFile(bin); final File marker = this.temp.newFile(); FileUtils.writeStringToFile( script, Joiner.on("\n").join( "#!/bin/bash", "function sighup(){", String.format(" echo restarted > %s", marker.toString()), " exit 0", "}", String.format(" echo running > %s", marker.toString()), "trap 'sighup' HUP", "sleep 30", String.format(" echo stopped > %s", marker.toString()) ) ); final ProcessBuilder builder = new ProcessBuilder( "/bin/bash", script.toString() ); builder.redirectInput(new File("/dev/null")); builder.redirectOutput(new File("/dev/null")); builder.redirectError(new File("/dev/null")); final Process process = builder.start(); new Nginx(bin).update("", 1, "", 2); process.waitFor(); MatcherAssert.assertThat( FileUtils.readFileToString(marker), Matchers.equalTo("restarted\n") ); } finally { sshd.stop(); } }

Target:
public void reloadsConfiguration() throws Exception { Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); final SSHD sshd = new SSHD(temp); sshd.start(); final File key = File.createTempFile("ssh", "key", temp); FileUtils.write(key, sshd.key()); this.manifest(temp, sshd.login(), sshd.port(), key); final String bin = String.format( "%s.sh", RandomStringUtils.randomAlphanumeric(128) ); final File script = File.createTempFile("script", bin, temp); final File marker = File.createTempFile("marker", "temp", temp); FileUtils.writeStringToFile( script, Joiner.on("\n").join( "#!/bin/bash", "function sighup(){", String.format(" echo restarted > %s", marker.toString()), " exit 0", "}", String.format(" echo running > %s", marker.toString()), "trap 'sighup' HUP", "sleep 30", String.format(" echo stopped > %s", marker.toString()) ) ); final ProcessBuilder builder = new ProcessBuilder( "/bin/bash", script.toString() ); builder.redirectInput(new File("/dev/null")); builder.redirectOutput(new File("/dev/null")); builder.redirectError(new File("/dev/null")); final Process process = builder.start(); try { new Nginx(bin).update("", 1, "", 2); process.waitFor(); } finally { sshd.stop(); } MatcherAssert.assertThat( FileUtils.readFileToString(marker), Matchers.equalTo("restarted\n") ); }
Source:
public void createWithPrimaryKeyField_invalidClassNameThrows() { String[] names = { null, "", TestHelper.getRandomString(57) }; for (String name : names) { try { realmSchema.createWithPrimaryKeyField(name, "pkField", int.class); fail(); } catch (IllegalArgumentException ignored) { } assertFalse(String.format("'%s' failed", name), realmSchema.contains(name)); } }

Target:
public void createWithPrimaryKeyField_invalidClassNameThrows() { String[] invalidNames = { null, "", TestHelper.getRandomString(57) }; for (String name : invalidNames) { try { realmSchema.createWithPrimaryKeyField(name, "pkField", int.class); fail(); } catch (IllegalArgumentException ignored) { } assertFalse(String.format("'%s' failed", name), realmSchema.contains(name)); } }
Source:
public ConnectivityReceiver() { MerlinsBeardRetriever merlinsBeardRetriever = new MerlinsBeardRetriever() { @Override public MerlinsBeard getMerlinsBeard(Context context) { return MerlinsBeard.from(context); } }; MerlinBinderRetriever merlinBinderRetriever = new MerlinBinderRetriever() { @Override public IBinder getBinder(Context context) { return peekService(context, new Intent(context, MerlinService.class)); } }; ConnectivityChangeEventCreator creator = new ConnectivityChangeEventCreator(); connectivityChangeNotifier = new ConnectivityChangeNotifier(merlinsBeardRetriever, merlinBinderRetriever, creator); }

Target:
public ConnectivityReceiver() { MerlinsBeardCreator merlinsBeardCreator = new MerlinsBeardCreator() { @Override public MerlinsBeard createMerlinsBeard(Context context) { return MerlinsBeard.from(context); } }; MerlinBinderRetriever merlinBinderRetriever = new MerlinBinderRetriever() { @Override public IBinder retrieveMerlinLocalServiceBinderIfAvailable(Context context) { return peekService(context, new Intent(context, MerlinService.class)); } }; ConnectivityChangeEventCreator creator = new ConnectivityChangeEventCreator(); connectivityChangeNotifier = new ConnectivityChangeNotifier(merlinsBeardCreator, merlinBinderRetriever, creator); }
Source:
public static <V> V get(Future<V> future, Timeout millis) { try { return com.google.common.util.concurrent.Futures.makeUninterruptible(future).get(millis.getValue(), TimeUnit.MILLISECONDS); } catch (ExecutionException e) { log.error("Execution failed {}", Throwables.getStackTraceAsString(e)); throw Throwables.propagate(e); } catch (TimeoutException e) { log.error("Timeout of failed \n{}", millis.toString(), Throwables.getStackTraceAsString(e)); throw Throwables.propagate(e); } }

Target:
public static <V> V get(Future<V> future, Timeout millis) { try { return com.google.common.util.concurrent.Futures.makeUninterruptible(future).get(millis.getValue(), TimeUnit.MILLISECONDS); } catch (ExecutionException e) { log.error("Execution failed {}", e); throw Throwables.propagate(e); } catch (TimeoutException e) { log.error("Timeout of failed \n{}", millis.toString(), e); throw Throwables.propagate(e); } }
Source:
public void preProcess(INDArray array, MinMaxStats stats) { if (array.rank() == 2) { array.subiRowVector(stats.getLower()); array.diviRowVector(stats.getRange()); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getUpper(), array, 1)); } array.muli(maxRange - minRange); array.addi(minRange); }

Target:
public void preProcess(INDArray array, MinMaxStats stats) { if (array.rank() <= 2) { array.subiRowVector(stats.getLower()); array.diviRowVector(stats.getRange()); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getRange(), array, 1)); } array.muli(maxRange - minRange); array.addi(minRange); }
Source:
protected ResourceManager registerInRM(final Credentials credentials, final String rmURL, final String nodeName, final List<Node> nodes) { RMAuthentication auth = joinResourceManager(rmURL); final ResourceManager rm = loginToResourceManager(credentials, auth); if(!disabledMonitoring) { SigarExposer sigarExposer = new SigarExposer(nodeName); final RMAuthentication rmAuth = auth; sigarExposer.boot(auth, false, new PermissionChecker() { @Override public boolean checkPermission(Credentials cred) { ResourceManager rm = null; try { rm = rmAuth.login(cred); if (NB_OF_ADD_NODE_ATTEMPTS == 0) return true; boolean isAdmin = rm.isNodeAdmin(nodes.get(0).getNodeInformation().getURL()) .getBooleanValue(); if (!isAdmin) { throw new SecurityException("Permission denied"); } return true; } catch (LoginException e) { throw new SecurityException(e); } finally { if (rm != null) { rm.disconnect(); } } } }); for (final Node node : nodes) { try { node.setProperty(JMX_URL + JMXTransportProtocol.RMI, sigarExposer.getAddress( JMXTransportProtocol.RMI).toString()); node.setProperty(JMX_URL + JMXTransportProtocol.RO, sigarExposer.getAddress( JMXTransportProtocol.RO).toString()); } catch (Exception e) { logger.error("", e); } } }else { logger.info("JMX monitoring is disabled."); } for (final Node node : nodes) { addNodeToResourceManager(rmURL, node, rm); } return rm; }

Target:
protected ResourceManager registerInRM(final Credentials credentials, final String rmURL, final String nodeName, final List<Node> nodes) { RMAuthentication auth = joinResourceManager(rmURL); final ResourceManager rm = loginToResourceManager(credentials, auth); SigarExposer sigarExposer = null; if(!disabledMonitoring) { sigarExposer = new SigarExposer(nodeName); final RMAuthentication rmAuth = auth; sigarExposer.boot(auth, false, new PermissionChecker() { @Override public boolean checkPermission(Credentials cred) { ResourceManager rm = null; try { rm = rmAuth.login(cred); if (NB_OF_ADD_NODE_ATTEMPTS == 0) return true; boolean isAdmin = rm.isNodeAdmin(nodes.get(0).getNodeInformation().getURL()) .getBooleanValue(); if (!isAdmin) { throw new SecurityException("Permission denied"); } return true; } catch (LoginException e) { throw new SecurityException(e); } finally { if (rm != null) { rm.disconnect(); } } } }); }else { logger.info("JMX monitoring is disabled."); } for (final Node node : nodes) { nodeSetJmxUrl(sigarExposer, node); addNodeToResourceManager(rmURL, node, rm); } return rm; }
Source:
BlobBatchAsyncClient(String accountUrl, HttpPipeline pipeline, BlobServiceVersion version) { this.client = new AzureBlobStorageBuilder() .url(accountUrl) .pipeline(pipeline) .version(version.getVersionString()) .build(); }

Target:
BlobBatchAsyncClient(String accountUrl, HttpPipeline pipeline, BlobServiceVersion version) { this.client = new AzureBlobStorageBuilder() .url(accountUrl) .pipeline(pipeline) .version(version.getVersion()) .build(); }
Source:
public void saveOrder_shouldFailDiscontinueNonCodedDrugOrderIfOrderableOfPreviousAndNewOrderDontMatch() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-nonCodedDrugs.xml"); DrugOrder previousOrder = (DrugOrder) orderService.getOrder(584); DrugOrder drugOrder = previousOrder.cloneForDiscontinuing(); drugOrder.setDrugNonCoded("non coded drug paracetemol"); drugOrder.setPreviousOrder(previousOrder); drugOrder.setDateActivated(new Date()); drugOrder.setOrderer(providerService.getProvider(1)); drugOrder.setEncounter(encounterService.getEncounter(6)); expectedException.expect(APIException.class); expectedException.expectMessage("The orderable of the previous order and the new one order don't match"); orderService.saveOrder(drugOrder, null); }

Target:
public void saveOrder_shouldFailDiscontinueNonCodedDrugOrderIfOrderableOfPreviousAndNewOrderDontMatch() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-nonCodedDrugs.xml"); DrugOrder previousOrder = (DrugOrder) orderService.getOrder(584); DrugOrder drugOrder = previousOrder.cloneForDiscontinuing(); drugOrder.setDrugNonCoded("non coded drug citrigine"); drugOrder.setPreviousOrder(previousOrder); drugOrder.setDateActivated(new Date()); drugOrder.setOrderer(providerService.getProvider(1)); drugOrder.setEncounter(encounterService.getEncounter(6)); expectedException.expect(APIException.class); expectedException.expectMessage("The orderable of the previous order and the new one order don't match"); orderService.saveOrder(drugOrder, null); }
Source:
private int getAbsoluteVolumeIndex(int index) { if (index == 0) { index = 0; } else if (index == 1) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[0]) /10; } else if (index == 2) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[1]) /10; } else if (index == 3) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[2]) /10; } else { index = (mIndexMax + 5)/10; } return index; }

Target:
private int getAbsoluteVolumeIndex(int index) { if (index == 0) { index = 0; } else if (index > 0 && index <= 3) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[index - 1]) /10; } else { index = (mIndexMax + 5)/10; } return index; }
Source:
OrcFileWriter( List<Long> columnIds, List<Type> columnTypes, File target, boolean writeMetadata, boolean validate, OrcWriterStats stats, TypeManager typeManager) { checkArgument(requireNonNull(columnIds, "columnIds is null").size() == requireNonNull(columnTypes, "columnTypes is null").size(), "ids and types mismatch"); checkArgument(isUnique(columnIds), "ids must be unique"); StorageTypeConverter converter = new StorageTypeConverter(typeManager); List<Type> storageTypes = columnTypes.stream() .map(converter::toStorageType) .collect(toImmutableList()); List<String> columnNames = columnIds.stream().map(Object::toString).collect(toImmutableList()); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(FileSystem.class.getClassLoader())) { Map<String, String> userMetadata = ImmutableMap.of(); if (writeMetadata) { ImmutableMap.Builder<Long, TypeSignature> columnTypesMap = ImmutableMap.builder(); for (int i = 0; i < columnIds.size(); i++) { columnTypesMap.put(columnIds.get(i), storageTypes.get(i).getTypeSignature()); } userMetadata = ImmutableMap.of(OrcFileMetadata.KEY, METADATA_CODEC.toJson(new OrcFileMetadata(columnTypesMap.build()))); } orcWriter = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(target)), columnNames, storageTypes, ORC, SNAPPY, DEFAULT_OPTION, userMetadata, DEFAULT_STORAGE_TIMEZONE, validate, HASHED, stats); } catch (IOException e) { throw new PrestoException(RAPTOR_ERROR, "Failed to create writer", e); } }

Target:
OrcFileWriter( List<Long> columnIds, List<Type> columnTypes, File target, boolean writeMetadata, boolean validate, OrcWriterStats stats, TypeManager typeManager) { checkArgument(requireNonNull(columnIds, "columnIds is null").size() == requireNonNull(columnTypes, "columnTypes is null").size(), "ids and types mismatch"); checkArgument(isUnique(columnIds), "ids must be unique"); StorageTypeConverter converter = new StorageTypeConverter(typeManager); List<Type> storageTypes = columnTypes.stream() .map(converter::toStorageType) .collect(toImmutableList()); List<String> columnNames = columnIds.stream().map(Object::toString).collect(toImmutableList()); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(FileSystem.class.getClassLoader())) { Map<String, String> userMetadata = ImmutableMap.of(); if (writeMetadata) { ImmutableMap.Builder<Long, TypeSignature> columnTypesMap = ImmutableMap.builder(); for (int i = 0; i < columnIds.size(); i++) { columnTypesMap.put(columnIds.get(i), columnTypes.get(i).getTypeSignature()); } userMetadata = ImmutableMap.of(OrcFileMetadata.KEY, METADATA_CODEC.toJson(new OrcFileMetadata(columnTypesMap.build()))); } orcWriter = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(target)), columnNames, storageTypes, ORC, SNAPPY, DEFAULT_OPTION, userMetadata, DEFAULT_STORAGE_TIMEZONE, validate, HASHED, stats); } catch (IOException e) { throw new PrestoException(RAPTOR_ERROR, "Failed to create writer", e); } }
Source:
private Optional<Vertex> getPredicateValueTypeVertexFor(Vre vre) { return graph.traversal().V() .has(T.label, LabelP.of(Vre.DATABASE_LABEL)) .has(Vre.VRE_NAME_PROPERTY_NAME, vre.getVreName()) .out(Vre.HAS_PREDICATE_VALUE_TYPE_VERTEX_RELATION_NAME) .toStream() .findAny(); }

Target:
private Optional<Vertex> getPredicateValueTypeVertexFor(Vre vre) { return getVreTraversal(vre.getVreName()) .out(Vre.HAS_PREDICATE_VALUE_TYPE_VERTEX_RELATION_NAME) .toStream() .findAny(); }
Source:
public Principal createIdentity(String username) throws LoginException { log.debug("createIdentity: " + username); try { NuxeoPrincipal[] principals = new NuxeoPrincipal[1]; if (manager == null) { principals[0] = new NuxeoPrincipalImpl(username); } else { Framework.doPrivileged(() -> principals[0] = manager.getPrincipal(username)); if (principals[0] == null) { throw new LoginException(String.format("principal %s does not exist", username)); } } NuxeoPrincipal principal = principals[0]; String principalId = String.valueOf(random.nextLong()); principal.setPrincipalId(principalId); return principal; } catch (LoginException e) { log.error("createIdentity failed", e); LoginException le = new LoginException("createIdentity failed for user " + username); le.initCause(e); throw le; } }

Target:
public Principal createIdentity(String username) throws LoginException { log.debug("createIdentity: " + username); try { NuxeoPrincipal principal; if (manager == null) { principal = new NuxeoPrincipalImpl(username); } else { principal = Framework.doPrivileged(() -> manager.getPrincipal(username)); if (principal == null) { throw new LoginException(String.format("principal %s does not exist", username)); } } String principalId = String.valueOf(random.nextLong()); principal.setPrincipalId(principalId); return principal; } catch (LoginException e) { log.error("createIdentity failed", e); LoginException le = new LoginException("createIdentity failed for user " + username); le.initCause(e); throw le; } }
Source:
private String read(String prompt, Character mask) { Prompt origPrompt = null; if (!console.getPrompt().getPromptAsString().equals(prompt)) { origPrompt = console.getPrompt(); console.setPrompt(new Prompt(prompt, mask)); } try { return console.getInputLine(); } catch (InterruptedException e) { e.printStackTrace(); } finally { if (origPrompt != null) { console.setPrompt(origPrompt); } } return null; }

Target:
private String read(String prompt, Character mask) { Prompt origPrompt = null; if (!console.getPrompt().getPromptAsString().equals(prompt)) { origPrompt = console.getPrompt(); console.setPrompt(new Prompt(prompt, mask)); } try { return console.getInputLine(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { if (origPrompt != null) { console.setPrompt(origPrompt); } } return null; }
Source:
private Set<Publisher> getPublishers(String publisher, Application application) { if (!Strings.isNullOrEmpty(publisher)) { return Sets.intersection(publishersFrom(publisher), application.getConfiguration().getEnabledReadSources()); } if (application.getConfiguration().isPrecedenceEnabled()) { return ImmutableSet.of(application.getConfiguration().getEnabledReadSources().asList().get(0)); } throw new IllegalArgumentException("Need precedence enabled"); }

Target:
private Set<Publisher> getPublishers(String publisher, Application application) { if (!Strings.isNullOrEmpty(publisher)) { return Sets.intersection( publishersFrom(publisher), application.getConfiguration().getEnabledReadSources() ); } if (application.getConfiguration().isPrecedenceEnabled()) { return ImmutableSet.of( application.getConfiguration() .getReadPrecedenceOrdering() .sortedCopy(application.getConfiguration().getEnabledReadSources()) .get(0) ); } throw new IllegalArgumentException("Need precedence enabled"); }
Source:
public final String getContent() throws IOException { if (content == null) { return null; } ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteStreams.copy(new ByteArrayInputStream(content), out); return out.toString(charset.name()); }

Target:
public final String getContent() { if (content == null) { return null; } try { return new String(content, charset.name()); } catch (UnsupportedEncodingException exception) { } return null; }
Source:
public WifiSsidPreference(Context context, AttributeSet attrs) { super(context, attrs); setDialogLayoutResource(R.layout.preference_wifi_ssids); }

Target:
public WifiSsidPreference(Context context, AttributeSet attrs) { super(context, attrs); }
Source:
public void updateGenericPomNoOptionalJson() { String prj = "/target/test-classes/generic_no_json/"; Path path = Paths.get("file:" + currentDir + prj + "pom.xml"); Path pathCopy = Paths.get("file:" + currentDir + prj + "copy_pom.xml"); Files.copy(path, pathCopy); try { Model original = editor.getModel(path); assertEquals(original.getPackaging(), "jar"); assertTrue(original.getBuild().getPlugins().size() == 1); assertTrue(original.getDependencies().size() == 3); assertTrue(original.getRepositories().size() == 2); assertTrue(original.getPluginRepositories().size() == 1); Model modelUpdated = editor.updatePomWithoutWrite(path); assertNotNull(modelUpdated); assertEquals(modelUpdated.getPackaging(), "kjar"); assertTrue(modelUpdated.getBuild().getPlugins().size() == 1); assertTrue(modelUpdated.getDependencies().size() == 6); assertTrue(modelUpdated.getRepositories().size() == 0); assertTrue(modelUpdated.getPluginRepositories().size() == 0); } catch (Exception e) { logger.error(e.getMessage(), e); throw new AssertionError(e.getMessage()); } finally { Files.delete(path); Files.copy(pathCopy, path); Files.delete(pathCopy); } }

Target:
public void updateGenericPomNoOptionalJson() { String prj = "/target/test-classes/generic_no_json/"; path = Paths.get("file:" + currentDir + prj + "pom.xml"); pathCopy = Paths.get("file:" + currentDir + prj + "copy_pom.xml"); Files.copy(path, pathCopy); try { Model original = editor.getModel(path); assertThat(original.getPackaging()).isEqualToIgnoringCase("jar"); assertThat(original.getBuild().getPlugins()).hasSize(1); assertThat(original.getDependencies()).hasSize(3); assertThat(original.getRepositories()).hasSize(2); assertThat(original.getPluginRepositories()).hasSize(1); Model modelUpdated = editor.updatePomWithoutWrite(path); assertThat(modelUpdated).isNotNull(); assertThat(modelUpdated.getPackaging()).isEqualToIgnoringCase("kjar"); assertThat(modelUpdated.getBuild().getPlugins()).hasSize(1); assertThat(modelUpdated.getDependencies()).hasSize(6); assertThat(modelUpdated.getRepositories()).hasSize(0); assertThat(modelUpdated.getPluginRepositories()).hasSize(0); } catch (Exception e) { logger.error(e.getMessage(), e); throw new AssertionError(e.getMessage()); } }
Source:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); boolean allowEditSnapshotSchedule = false; if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getEditSnapshotScheduleCommand().setIsAvailable(allowEditSnapshotSchedule); }

Target:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; boolean allowEditSnapshotSchedule = false; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); getEditSnapshotScheduleCommand().setIsAvailable(allowEditSnapshotSchedule); }
Source:
protected void close(boolean flushBeforeClose) { synchronized (lock) { closed = true; if(flushBeforeClose && responseFlushed) { ResteasyContext.pushContextDataMap(contextDataMap); try { AsyncOutputStream aos = response.getAsyncOutputStream(); aos.asyncFlush().toCompletableFuture().get(); }catch(IOException | InterruptedException | ExecutionException x) { }finally { ResteasyContext.removeContextDataLevel(); } } if (asyncContext.isSuspended()) { ResteasyAsynchronousResponse asyncResponse = asyncContext.getAsyncResponse(); if (asyncResponse != null) { try { asyncResponse.complete(); } catch(RuntimeException x) { Throwable cause = x; while(cause.getCause() != null) cause = cause.getCause(); if(cause instanceof IOException) { }else { throw x; } } } } clearContextData(); } }

Target:
protected void close(boolean flushBeforeClose) { synchronized (lock) { closed = true; if(flushBeforeClose && responseFlushed) { ResteasyContext.pushContextDataMap(contextDataMap); try { AsyncOutputStream aos = response.getAsyncOutputStream(); aos.asyncFlush().toCompletableFuture().get(); }catch(IOException | InterruptedException | ExecutionException x) { }finally { ResteasyContext.removeContextDataLevel(); } } if (asyncContext.isSuspended()) { ResteasyAsynchronousResponse asyncResponse = asyncContext.getAsyncResponse(); if (asyncResponse != null) { try { asyncResponse.complete(); } catch(RuntimeException x) { Throwable cause = x; while(cause.getCause() != null) cause = cause.getCause(); if(cause instanceof IOException) { }else { LOG.debug(cause.getMessage()); return; } } } } clearContextData(); } }
Source:
public DRepresentationDescriptor getRepresentationDescriptor() { DRepresentationDescriptor result = null; if (representation instanceof DSemanticDecorator) { if (session == null) { session = SessionManager.INSTANCE.getSession(((DSemanticDecorator) representation).getTarget()); } if (session != null) { Collection<EStructuralFeature.Setting> usages = session.getSemanticCrossReferencer().getInverseReferences(representation); for (EStructuralFeature.Setting setting : usages) { if (ViewpointPackage.Literals.DREPRESENTATION_DESCRIPTOR.isInstance(setting.getEObject()) && setting.getEStructuralFeature() == ViewpointPackage.Literals.DREPRESENTATION_DESCRIPTOR__REPRESENTATION) { result = (DRepresentationDescriptor) setting.getEObject(); } } if (result == null) { EObject eObject = session.getAllSessionResources().iterator().next().getContents().get(0); if (eObject instanceof DAnalysis) { EList<DView> ownedViews = ((DAnalysis) eObject).getOwnedViews(); for (DView view : ownedViews) { EList<DRepresentationDescriptor> ownedRepresentationDescriptors = view.getOwnedRepresentationDescriptors(); for (DRepresentationDescriptor descriptor : ownedRepresentationDescriptors) { DRepresentation representationTemp = descriptor.getRepresentation(); if (representation.equals(representationTemp)) { result = descriptor; break; } } } } } } } return result; }

Target:
public DRepresentationDescriptor getRepresentationDescriptor() { DRepresentationDescriptor result = null; if (representation instanceof DSemanticDecorator) { if (session == null) { session = SessionManager.INSTANCE.getSession(((DSemanticDecorator) representation).getTarget()); } if (session != null) { result = findDescriptorFromCrossReferencer(); if (result == null) { result = findDescriptorFromAnalysis(); } } } return result; }
Source:
public void testAddMessageWillWaitWhenCapacityIsFull() throws InterruptedException { AddMessage addMessage = new AddMessage(); new Thread(addMessage).start(); assertThat("Should never exceed capacity", list.size(), lessThanOrEqualTo(capacity)); long wait = 500; Thread.sleep(wait); list.completeMessage(p1); Thread.sleep(100); assertThat("Should never exceed capacity", list.size(), lessThanOrEqualTo(capacity)); long elapse = addMessage.end - addMessage.start; assertThat("Should have waited message to be completed", elapse, greaterThan(wait)); }

Target:
public void testAddMessageWillWaitWhenCapacityIsFull() throws InterruptedException { AddMessage addMessage = new AddMessage(); Thread add = new Thread(addMessage); add.start(); assertThat("Should never exceed capacity", list.size(), is(capacity)); long wait = 500; Thread.sleep(wait); list.completeMessage(p1); add.join(); assertThat("Should never exceed capacity", list.size(), is(capacity)); long elapse = addMessage.end - addMessage.start; assertThat("Should have waited message to be completed", elapse, greaterThanOrEqualTo(wait)); }
Source:
protected void executeCommand() { if (isUnregisteredDiskExists()) { addDiskMapping(); return; } MoveOrCopyImageGroupParameters p = prepareChildParameters(); VdcReturnValueBase vdcRetValue = runInternalActionWithTasksContext( getImagesActionType(), p); if (!vdcRetValue.getSucceeded()) { setSucceeded(false); getReturnValue().setFault(vdcRetValue.getFault()); } else { setSucceeded(true); if (getParameters().getOperation() == ImageOperation.Copy && !isTemplate()) { ImagesHandler.addDiskImageWithNoVmDevice(getImage()); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } }

Target:
protected void executeCommand() { if (isUnregisteredDiskExistsForCopyTemplate()) { addDiskMapping(); return; } MoveOrCopyImageGroupParameters p = prepareChildParameters(); VdcReturnValueBase vdcRetValue = runInternalActionWithTasksContext( getImagesActionType(), p); if (!vdcRetValue.getSucceeded()) { setSucceeded(false); getReturnValue().setFault(vdcRetValue.getFault()); } else { setSucceeded(true); if (getParameters().getOperation() == ImageOperation.Copy && !isTemplate()) { ImagesHandler.addDiskImageWithNoVmDevice(getImage()); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } }
Source:
public void testMigrateCreateRequest() throws Exception { Result result = mock(Result.class); Metacard workspace = getWorkspaceMetacard("workspaceId"); doReturn(workspace).when(result).getMetacard(); doReturn(Collections.singletonList(result)).when(queryResponse).getResults(); ArgumentCaptor<CreateRequest> createRequestArgumentCaptor = ArgumentCaptor.forClass(CreateRequest.class); workspaceQueryMigration.migrateWorkspaces(); verify(catalogFramework, times(1)).create(createRequestArgumentCaptor.capture()); CreateRequest actualCreateRequest = createRequestArgumentCaptor.getValue(); List<Metacard> createMetacards = actualCreateRequest.getMetacards(); assertThat(createMetacards, hasSize(2)); assertThat(createMetacards.get(0).getTags(), is(ImmutableSet.of("query"))); assertThat(createMetacards.get(1).getTags(), is(ImmutableSet.of("query"))); }

Target:
public void testMigrateCreateRequest() throws Exception { ArgumentCaptor<CreateRequest> createRequestArgumentCaptor = ArgumentCaptor.forClass(CreateRequest.class); workspaceQueryMigration.migrate(); verify(catalogFramework, times(1)).create(createRequestArgumentCaptor.capture()); CreateRequest actualCreateRequest = createRequestArgumentCaptor.getValue(); List<Metacard> createMetacards = actualCreateRequest.getMetacards(); assertThat(createMetacards, hasSize(2)); assertThat(createMetacards.get(0).getTags(), is(ImmutableSet.of("query"))); assertThat(createMetacards.get(1).getTags(), is(ImmutableSet.of("query"))); }
Source:
public void killOlderThan(long timestamp) throws IOException { log.info("Deleting all task logs from Azure storage location [bucket: '%s' prefix: '%s'] older than %s.", config.getContainer(), config.getPrefix(), new Date(timestamp) ); try { AzureUtils.deleteObjectsInPath( azureStorage, inputDataConfig, accountConfig, azureCloudBlobIterableFactory, config.getContainer(), config.getPrefix(), (object) -> object.getLastModifed().getTime() < timestamp ); } catch (Exception e) { log.error("Error occurred while deleting task log files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }

Target:
public void killOlderThan(long timestamp) throws IOException { log.info( "Deleting all task logs from Azure storage location [bucket: '%s' prefix: '%s'] older than %s.", config.getContainer(), config.getPrefix(), new Date(timestamp) ); try { AzureUtils.deleteObjectsInPath( azureStorage, inputDataConfig, accountConfig, azureCloudBlobIterableFactory, config.getContainer(), config.getPrefix(), (object) -> object.getLastModifed().getTime() < timestamp ); } catch (Exception e) { log.error("Error occurred while deleting task log files from Azure. Error: %s", e.getMessage()); throw new IOException(e); } }
Source:
private static Quantity safeGet(Container parent, Container template, Function<ResourceRequirements, Map<String, Quantity>> resourceTypeMapper, String field) { Quantity templateField = resourceTypeMapper.apply(template.getResources()).get(field); if (templateField != null && !Strings.isNullOrEmpty(templateField.getAmount())) { return templateField; } else { return (parent.getResources() != null) && (resourceTypeMapper.apply(parent.getResources()) != null) ? resourceTypeMapper.apply(parent.getResources()).get(field) : new Quantity(""); } }

Target:
private static Quantity safeGet(Container parent, Container template, Function<ResourceRequirements, Map<String, Quantity>> resourceTypeMapper, String field) { return Optional.ofNullable(template.getResources()) .map(resourceTypeMapper) .map(rT -> rT.get(field)) .filter(tF -> !Strings.isNullOrEmpty(tF.getAmount())) .orElse(Optional.ofNullable(parent.getResources()) .map(resourceTypeMapper) .map(rT -> rT.get(field)) .orElse(new Quantity("")) ); }
Source:
public FastaReferenceWriter build() throws IOException { if (fastaFile == null && fastaOutput == null) { throw new IllegalArgumentException("Both fastaFile and fastaOutput were null. Please set one of them to be non-null."); } if (indexFile == null && indexOutput == null) { indexFile = defaultFaiFile(makeFaiOutput, fastaFile); } if (dictFile == null && dictOutput == null) { dictFile = defaultDictFile(makeDictOutput, fastaFile); } checkBasesPerLine(basesPerLine); if (fastaFile != null) { fastaOutput = Files.newOutputStream(fastaFile); } if (indexFile != null) { indexOutput = Files.newOutputStream(indexFile); } if (dictFile != null) { dictOutput = Files.newOutputStream(dictFile); } return new FastaReferenceWriter(basesPerLine, fastaOutput, indexOutput, dictOutput); }

Target:
public FastaReferenceWriter build() throws IOException { if (fastaFile == null && fastaOutput == null) { throw new IllegalArgumentException("Both fastaFile and fastaOutput were null. Please set one of them to be non-null."); } if(fastaFile != null) { if (indexFile == null && indexOutput == null) { indexFile = defaultFaiFile(makeFaiOutput, fastaFile); } else if (indexFile != null && indexOutput != null) { throw new IllegalArgumentException("Both indexFile and indexOutput were non-null. Please set one of them to be null."); } if (dictFile == null && dictOutput == null) { dictFile = defaultDictFile(makeDictOutput, fastaFile); } else if (dictFile != null && dictOutput != null) { throw new IllegalArgumentException("Both dictFile and dictOutput were non-null. Please set one of them to be null."); } } checkBasesPerLine(basesPerLine); if (fastaFile != null) { fastaOutput = Files.newOutputStream(fastaFile); } if (indexFile != null) { indexOutput = Files.newOutputStream(indexFile); } if (dictFile != null) { dictOutput = Files.newOutputStream(dictFile); } return new FastaReferenceWriter(basesPerLine, fastaOutput, indexOutput, dictOutput); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (Companion.getDEBUG()) Log.e(TAG, "onOptionsItemSelected"); switch (item.getItemId()) { case R.id.search_submit: search(); break; case R.id.select_forums: SearchForumsFragment frag = new SearchForumsFragment(this); frag.setStyle(DialogFragment.STYLE_NO_TITLE,0); frag.show(getFragmentManager(), "searchforums"); break; case R.id.search_threadid: insertSearchTerm(SEARCHTERM.THREADID); break; case R.id.search_intitle: insertSearchTerm(SEARCHTERM.INTITLE); break; case R.id.search_userid: insertSearchTerm(SEARCHTERM.USERID); break; case R.id.search_quoting: insertSearchTerm(SEARCHTERM.QUOTING); break; case R.id.search_username: insertSearchTerm(SEARCHTERM.USERNAME); break; default: return super.onOptionsItemSelected(item); } return true; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { Timber.v("onOptionsItemSelected"); switch (item.getItemId()) { case R.id.search_submit: search(); break; case R.id.select_forums: SearchForumsFragment frag = new SearchForumsFragment(this); frag.setStyle(DialogFragment.STYLE_NO_TITLE,0); frag.show(getFragmentManager(), "searchforums"); break; case R.id.search_threadid: insertSearchTerm(SEARCHTERM.THREADID); break; case R.id.search_intitle: insertSearchTerm(SEARCHTERM.INTITLE); break; case R.id.search_userid: insertSearchTerm(SEARCHTERM.USERID); break; case R.id.search_quoting: insertSearchTerm(SEARCHTERM.QUOTING); break; case R.id.search_username: insertSearchTerm(SEARCHTERM.USERNAME); break; default: return super.onOptionsItemSelected(item); } return true; }
Source:
public void unannounceSegment(DataSegment segment) throws IOException { final String path = segmentLookup.get(segment.getIdentifier()); Set<DataSegment> zkSegments = segmentReader.read(path); zkSegments.remove(segment); log.info("Unannouncing segment[%s] at path[%s]", segment.getIdentifier(), path); if (zkSegments.isEmpty()) { announcer.unannounce(path); } else if (zkSegments.size() < config.getSegmentsPerNode()) { zNodes.put(path, zkSegments.size()); announcer.update(path, jsonMapper.writeValueAsBytes(zkSegments)); } }

Target:
public void unannounceSegment(DataSegment segment) throws IOException { final SegmentZNode segmentZNode = segmentLookup.remove(segment); segmentZNode.removeSegment(segment); log.info("Unannouncing segment[%s] at path[%s]", segment.getIdentifier(), segmentZNode.getPath()); if (segmentZNode.getCount() == 0) { availableZNodes.remove(segmentZNode); announcer.unannounce(segmentZNode.getPath()); } else { announcer.update(segmentZNode.getPath(), segmentZNode.getBytes()); availableZNodes.add(segmentZNode); } }
Source:
public int hashCode() { int hash = 7; hash = 73 * hash + this.getMeta(); hash = 73 * hash + this.getDimId(); hash = 73 * hash + this.getPos().hashCode(); hash = 73 * hash + (this.getNbt() != null ? this.getNbt().hashCode() : 0); hash = 73 * hash + (this.getRegistryName() != null ? this.getRegistryName().hashCode() : 0); return hash; }

Target:
public int hashCode() { int hash = 7; hash = 73 * hash + this.getMeta(); hash = 73 * hash + this.getDimId(); hash = 73 * hash + this.getPos().hashCode(); hash = 73 * hash + this.getRegistryName().hashCode(); hash = 73 * hash + Objects.hashCode(this.getNbt()); return hash; }
Source:
private AuthenticationResult tryRT() throws AuthenticationException { final String user = getUser(); final TokenCacheItem regularRTItem = mTokenCacheAccessor.getRegularTokenCacheItemWithAT(mAuthRequest.getResource(), mAuthRequest.getClientId(), user); if (regularRTItem == null) { Logger.v(TAG, "Regular token cache entry does not exist, try with MRRT."); return tryMRRT(); } if (regularRTItem.getIsMultiResourceRefreshToken() || isMRRTExisted()) { Logger.v(TAG, "Regular token cache entry exists but it's marked as MRRT, try with MRRT."); return tryMRRT(); } Logger.v(TAG, "Send request to use regular RT for new AT."); return acquireTokenWithCachedItem(regularRTItem); }

Target:
private AuthenticationResult tryRT() throws AuthenticationException { final TokenCacheItem regularRTItem = mTokenCacheAccessor.getRegularRefreshTokenCacheItem(mAuthRequest.getResource(), mAuthRequest.getClientId(), mAuthRequest.getUserFromRequest()); if (regularRTItem == null) { Logger.v(TAG, "Regular token cache entry does not exist, try with MRRT."); return tryMRRT(); } if (regularRTItem.getIsMultiResourceRefreshToken() || isMRRTEntryExisted()) { final String statusMessage = regularRTItem.getIsMultiResourceRefreshToken() ? "Found RT and it's also a MRRT, retry with MRRT" : "RT is found and there is a MRRT entry existed, try with MRRT"; Logger.v(TAG, statusMessage); return tryMRRT(); } Logger.v(TAG, "Send request to use regular RT for new AT."); return acquireTokenWithCachedItem(regularRTItem); }
Source:
public Collection<RelatedArticleView> getRelatedArticles(Article article) { List<ArticleRelationship> rawRelationships = article.getRelatedArticles(); List<RelatedArticleView> relatedArticleViews = Lists.newArrayListWithCapacity(rawRelationships.size()); for (ArticleRelationship rawRelationship : rawRelationships) { if (rawRelationship.getOtherArticleID() == null) { continue; } String otherArticleDoi = rawRelationship.getOtherArticleDoi(); Article relatedArticle = (Article) DataAccessUtils.uniqueResult((List<?>) hibernateTemplate.findByCriteria(DetachedCriteria.forClass(Article.class) .add(Restrictions.eq("doi", otherArticleDoi)))); RelatedArticleView relatedArticleView = (relatedArticle == null) ? new RelatedArticleView(rawRelationship, null, null) : new RelatedArticleView(rawRelationship, relatedArticle.getTitle(), relatedArticle.getAuthors()); relatedArticleViews.add(relatedArticleView); } return relatedArticleViews; }

Target:
public Collection<RelatedArticleView> getRelatedArticles(Article article) { List<ArticleRelationship> rawRelationships = article.getRelatedArticles(); List<RelatedArticleView> relatedArticleViews = Lists.newArrayListWithCapacity(rawRelationships.size()); for (ArticleRelationship rawRelationship : rawRelationships) { if (rawRelationship.getOtherArticleID() == null) { continue; } String otherArticleDoi = rawRelationship.getOtherArticleDoi(); Article relatedArticle = (Article) DataAccessUtils.uniqueResult((List<?>) hibernateTemplate.findByCriteria(DetachedCriteria.forClass(Article.class) .add(Restrictions.eq("doi", otherArticleDoi)))); RelatedArticleView relatedArticleView = new RelatedArticleView(rawRelationship, relatedArticle.getTitle(), relatedArticle.getAuthors()); relatedArticleViews.add(relatedArticleView); } return relatedArticleViews; }
Source:
protected String getDefaultDocumentTypeName() { return "AFU"; }

Target:
protected String getDefaultDocumentTypeName() { return CuFPConstants.AccountFundsUpdateDocumentConstants.ACCOUNT_FUNDS_UPDATE_DOCUMENT_TYPE_NAME; }
Source:
public boolean verifyCredential(final Object credential) throws RealmUnavailableException { try { if (credential instanceof char[]) { final Password password = map.get(name).getPassword(); return PasswordFactory.getInstance(password.getAlgorithm()).verify(password, (char[]) credential); } else if (credential instanceof ClearPassword) { final Password password = map.get(name).getPassword(); return PasswordFactory.getInstance(password.getAlgorithm()).verify(password, ((ClearPassword) credential).getPassword()); } else { return false; } } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new RealmUnavailableException(e); } }

Target:
public boolean verifyCredential(final Object credential) throws RealmUnavailableException { try { SimpleRealmEntry entry = map.get(name); if (entry == null) { return false; } if (credential instanceof char[]) { final Password password = entry.getPassword(); return PasswordFactory.getInstance(password.getAlgorithm()).verify(password, (char[]) credential); } else if (credential instanceof ClearPassword) { final Password password = entry.getPassword(); return PasswordFactory.getInstance(password.getAlgorithm()).verify(password, ((ClearPassword) credential).getPassword()); } else { return false; } } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new RealmUnavailableException(e); } }
Source:
private static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation(format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException(new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } }

Target:
private static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation(format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException(new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } }
Source:
public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); for (VmDeviceUpdate device : getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params)) { if (!device.getName().isEmpty()) { fields.add(device.getName()); } else { switch (device.getType()) { case UNKNOWN: case VIRTIO: fields.add(device.getGeneralType().name()); break; default: fields.add(device.getType().getName()); break; } } } return new HashSet<>(fields); }

Target:
public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); List<VmDeviceUpdate> devices = getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params); fields.addAll(devices.stream().map(d -> d.getName()).collect(Collectors.toList())); return new HashSet<>(fields); }
Source:
protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception { CharSequence acceptedEncoding; List<String> acceptEncodingHeaders = msg.headers().getAll(ACCEPT_ENCODING); if (acceptEncodingHeaders.isEmpty()) { acceptedEncoding = HttpContentDecoder.IDENTITY; } else if (acceptEncodingHeaders.size() == 1) { acceptedEncoding = acceptEncodingHeaders.get(0); } else { acceptedEncoding = StringUtil.join(",", acceptEncodingHeaders.iterator()); } HttpMethod method = msg.method(); if (HttpMethod.HEAD.equals(method)) { acceptedEncoding = ZERO_LENGTH_HEAD; } else if (HttpMethod.CONNECT.equals(method)) { acceptedEncoding = ZERO_LENGTH_CONNECT; } acceptEncodingQueue.add(acceptedEncoding); out.add(ReferenceCountUtil.retain(msg)); }

Target:
protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception { CharSequence acceptEncoding; List<String> acceptEncodingHeaders = msg.headers().getAll(ACCEPT_ENCODING); switch (acceptEncodingHeaders.size()) { case 0: acceptEncoding = HttpContentDecoder.IDENTITY; break; case 1: acceptEncoding = acceptEncodingHeaders.get(0); break; default: acceptEncoding = StringUtil.join(",", acceptEncodingHeaders); break; } HttpMethod method = msg.method(); if (HttpMethod.HEAD.equals(method)) { acceptEncoding = ZERO_LENGTH_HEAD; } else if (HttpMethod.CONNECT.equals(method)) { acceptEncoding = ZERO_LENGTH_CONNECT; } acceptEncodingQueue.add(acceptEncoding); out.add(ReferenceCountUtil.retain(msg)); }
Source:
public void stop() { executorService.shutdownNow(); try { executorService.awaitTermination(4, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void stop() throws InterruptedException { executorService.shutdown(); executorService.awaitTermination(4, TimeUnit.SECONDS); }
Source:
public boolean delete(String name) { Path file = generateFileName(name); return FileUtils.moveToDeleted(file, this.deletedDataDir); }

Target:
public boolean delete(String name) { Path file = generateFileName(name); return FileUtils.move(file, this.deletedDataDir); }
Source:
private Boolean checkMatchpassword(String password, String password2) { if (!password.equals(password2)) { return false; } else { return true; } }

Target:
private Boolean checkMatchpassword(String password, String password2) { return (password.equals(password2)); }
Source:
protected JavaPackageInfoSource updateTypeNames(String name) { throw new ParserException(); }

Target:
protected JavaPackageInfoSource updateTypeNames(String name) { throw new UnsupportedOperationException("A package-info doesn't contain any types which can be updated"); }