auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void initPort() { Integer portParam = getInitParameter("port", Integer.class); setPort((portParam == null) ? DEFAULT_PORT : portParam); if (isDebug()) { LOGGER.debug("port: {}", getPort()); } }

Target:
protected void initPort() { setPort(Optional.ofNullable(getInitParameter("port", Integer.class)).orElse(DEFAULT_PORT)); if (isDebug()) { LOGGER.debug("port: {}", getPort()); } }
Source:
public void testDeviceClassification() { String userAgentSample = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0"; DeviceClassification d = new DeviceClassification(); d.classifyUseragent(userAgentSample); assertEquals("Vendor as expected", "HTC" , d.getVendor()); assertEquals("Model as expected" , "A6366", d.getModel()); }

Target:
public void testDeviceClassification() { String userAgentSample = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0"; DeviceClassification d = new DeviceClassification(); d.classifyUseragent(userAgentSample); assertEquals("Vendor as expected", "HTC" , d.getVendor()); assertEquals("Model as expected" , "A6380", d.getModel()); }
Source:
public static boolean initialize(Context context) { if (isCloudNotificationsEnabled(context)) { NotificationSubscriber.subscribeToFirebaseServices(); return true; } NotificationSubscriber.unsubscribeFromFirebaseServices(); return false; }

Target:
public static boolean initialize(Context context) { boolean isEnabled = isCloudNotificationsEnabled(context); if (isEnabled) { messagingService.subscribe(); } else { messagingService.unsubscribe(); } return isEnabled; }
Source:
private void checkSanity(CompactionDetails details) { List<String> segmentsUnderCompaction = details.getLogSegmentsUnderCompaction(); LogSegment lastSegment = null; for (String segmentName : segmentsUnderCompaction) { lastSegment = srcLog.getSegment(segmentName); if (lastSegment == null) { throw new IllegalArgumentException(segmentName + " does not exist in the log"); } } Offset lastSegmentEndOffset = new Offset(lastSegment.getName(), lastSegment.getEndOffset()); if (lastSegmentEndOffset.compareTo(srcIndex.journal.getFirstOffset()) >= 0) { throw new IllegalArgumentException("Some of the offsets provided for compaction are within the jounral"); } }

Target:
private void checkSanity(CompactionDetails details) { List<String> segmentsUnderCompaction = details.getLogSegmentsUnderCompaction(); LogSegment lastSegment = null; for (String segmentName : segmentsUnderCompaction) { lastSegment = srcLog.getSegment(segmentName); if (lastSegment == null) { throw new IllegalArgumentException(segmentName + " does not exist in the log"); } } Offset lastSegmentEndOffset = new Offset(lastSegment.getName(), lastSegment.getEndOffset()); if (lastSegmentEndOffset.compareTo(srcIndex.journal.getFirstOffset()) >= 0) { throw new IllegalArgumentException("Some of the offsets provided for compaction are within the journal"); } }
Source:
public SearchResult(SearchResultDto searchResultDto) { name = searchResultDto.getItemReference().getName(); path = searchResultDto.getItemReference().getPath(); project = searchResultDto.getItemReference().getProject(); final List<Link> links = searchResultDto.getItemReference().getLinks(); if (!links.isEmpty() && links.contains(Constants.LINK_REL_GET_CONTENT)) { contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); } final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); occurrences = new ArrayList<>(dtos.size()); for (SearchOccurrence dto : dtos) { occurrences.add(new SearchOccurrenceImpl(dto)); } }

Target:
public SearchResult(SearchResultDto searchResultDto) { name = searchResultDto.getItemReference().getName(); path = searchResultDto.getItemReference().getPath(); project = searchResultDto.getItemReference().getProject(); if (searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT) != null) { contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); } final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); occurrences = new ArrayList<>(dtos.size()); for (SearchOccurrence dto : dtos) { occurrences.add(new SearchOccurrenceImpl(dto)); } }
Source:
public ServiceBuilder<RemoteCacheContainer> build(ServiceTarget target) { Function<RemoteCacheManager, RemoteCacheContainer> mapper = remoteCacheManager -> new ManagedRemoteCacheContainer(this.name, remoteCacheManager); Supplier<RemoteCacheManager> supplier = () -> { Configuration configuration = this.configuration.getValue(); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration); remoteCacheManager.start(); InfinispanLogger.ROOT_LOGGER.debugf("%s remote cache container started", this.name); return remoteCacheManager; }; Consumer<RemoteCacheManager> destroyer = remoteCacheManager -> { remoteCacheManager.stop(); InfinispanLogger.ROOT_LOGGER.debugf("%s remote cache container stopped", this.name); }; Service<RemoteCacheContainer> service = new SuppliedValueService<>(mapper, supplier, destroyer); ServiceBuilder<RemoteCacheContainer> builder = target.addService(this.getServiceName(), service) .setInitialMode(ServiceController.Mode.PASSIVE) ; return this.configuration.register(builder); }

Target:
public ServiceBuilder<RemoteCacheContainer> build(ServiceTarget target) { Service<RemoteCacheContainer> service = new SuppliedValueService<>(this, this, this); ServiceBuilder<RemoteCacheContainer> builder = new AsynchronousServiceBuilder<>(this.getServiceName(), service).build(target) .setInitialMode(ServiceController.Mode.ON_DEMAND); return this.configuration.register(builder); }
Source:
boolean parseDescriptor(String descriptor) { if (descriptor != null) { String[] descriptorTokens = descriptor.split(" "); if (descriptorTokens.length >= 1) { String model = descriptorTokens[0]; if (model.equals("iPhone")) { String versionString = descriptorTokens[1]; String[] validVersions = {"X", "XS", "XR"}; if (Arrays.asList(validVersions).contains(versionString)) { return true; } if (versionString.matches("\\d[^\\d]")) { versionString = versionString.substring(0, 1); } else if (versionString.matches("\\d{2}[^\\d]")) { versionString = versionString.substring(0, 2); } try { int version = Integer.parseInt(versionString); return version > 5; } catch (Throwable ignore) { } } else { return (model.equals("iPad")) && descriptorTokens[1].equals("Pro"); } } } return false; }

Target:
boolean parseDescriptor(String descriptor) { if (descriptor != null) { String[] descriptorTokens = descriptor.split(" "); if (descriptorTokens.length >= 1) { String model = descriptorTokens[0]; if (model.equals("iPhone")) { String versionString = descriptorTokens[1]; String[] validVersions = {"X", "XS", "XR"}; if (Arrays.asList(validVersions).contains(versionString)) { return true; } String versionSuffix = ""; if (versionString.matches("\\d[^\\d]")) { versionSuffix = versionString.substring(1); versionString = versionString.substring(0, 1); } else if (versionString.matches("\\d{2}[^\\d]")) { versionSuffix = versionString.substring(2); versionString = versionString.substring(0, 2); } try { int version = Integer.parseInt(versionString); return version > 6 || (version == 6 && versionSuffix.equalsIgnoreCase("s")); } catch (Throwable ignore) { } } else { return (model.equals("iPad")) && descriptorTokens[1].equals("Pro"); } } } return false; }
Source:
private static boolean isSingleLineLambda(DetailAST lambda) { boolean result = false; final DetailAST block = lambda.getLastChild(); if (block.getType() != TokenTypes.SLIST) { result = lambda.getLineNo() == block.getLineNo(); final DetailAST elist = block.getFirstChild().findFirstToken(TokenTypes.ELIST); if (elist != null) { result = result && block.getLineNo() == elist.getLastChild().getLineNo(); final DetailAST expr = elist.findFirstToken(TokenTypes.EXPR); if (expr != null && expr.getLastChild().getChildCount() > 1) { result = result && expr.getLastChild().getLastChild().getLineNo() == expr.getLastChild().getLineNo(); } } } return result; }

Target:
private static boolean isSingleLineLambda(DetailAST lambda) { boolean result = false; final DetailAST block = lambda.getLastChild(); if (block.getType() != TokenTypes.SLIST) { result = lambda.getLineNo() == block.getLineNo(); final DetailAST elist = block.getFirstChild().findFirstToken(TokenTypes.ELIST); if (result && elist != null) { result = block.getLineNo() == elist.getLastChild().getLineNo(); final DetailAST expr = elist.findFirstToken(TokenTypes.EXPR); if (result && expr.getLastChild().getChildCount() > 1) { result = expr.getLastChild().getLastChild().getLineNo() == expr.getLastChild().getLineNo(); } } } return result; }
Source:
private void processCommand(final ISYBindingConfig config, final Command command) { if (!this.insteonClient.isISYReady()) { this.logger.warn("ISY is not ready"); return; } UDNode node = null; try { node = this.insteonClient.getNodes().get(config.getController()); } catch (Exception e) { this.logger.warn("no such device, " + config.getController(), e); } if (node == null) { try { node = this.insteonClient.getGroups().get( config.getController()); } catch (Exception e) { this.logger.warn( "no such group found, " + config.getController(), e); } } if (node != null) { executeCommand(config, node, command); } else { this.logger.warn("No node found for address " + config.getController()); } }

Target:
private void processCommand(final ISYBindingConfig config, final Command command) { if (!this.insteonClient.isISYReady()) { this.logger .warn("ISY is not ready; dropping command '{}'", command); return; } UDNode node = null; try { node = this.insteonClient.getNodes().get(config.getController()); } catch (Exception e) { this.logger.warn("no such device: '{}' - ", config.getController(), e); } if (node == null) { try { node = this.insteonClient.getGroups().get( config.getController()); } catch (Exception e) { this.logger.warn("no such group found: '{}' - {}", config.getController(), e); } } if (node != null) { executeCommand(config, node, command); } else { this.logger.warn("No node found for address: '{}' ", config.getController()); } }
Source:
public IPAddress getAllocatedTask(final String appId) { while (true) { try { final List<String> taskList = appTaskListMap.getTaskListForApp(appId); if (taskList == null) { List<String> allTaskList; do { allTaskList = taskStatsMap.getTaskList(); } while (allTaskList.isEmpty()); final String selectedTask = getRandomTask(allTaskList); appTaskListMap.addTaskToApp(appId, selectedTask); return taskAddressInfoMap.getClientToTaskAddress(selectedTask); } else { final String selectedTask = getRandomTask(taskList); final double selectedTaskLoad = taskStatsMap.get(selectedTask).getTaskLoad(); if (selectedTaskLoad > overloadedTaskThreshold) { final List<String> remainingList = taskStatsMap.getTaskList(); remainingList.removeAll(taskList); if (!remainingList.isEmpty()) { final String taskCandidate = getRandomTask(remainingList); if (taskStatsMap.get(taskCandidate).getTaskLoad() < overloadedTaskThreshold) { appTaskListMap.addTaskToApp(appId, taskCandidate); return taskAddressInfoMap.getClientToTaskAddress(taskCandidate); } } } return taskAddressInfoMap.getClientToTaskAddress(selectedTask); } } catch (final Exception e) { e.printStackTrace(); LOG.log(Level.INFO, "Exception thrown! This might be because of synchronization issue... Try again!"); } } }

Target:
public IPAddress getAllocatedTask(final String appId) { taskInfoRWLock.readLock().lock(); final List<String> taskList = appTaskListMap.getTaskListForApp(appId); if (taskList == null) { final List<String> allTaskList = taskStatsMap.getTaskList(); final String selectedTask = getRandomTask(allTaskList); appTaskListMap.addTaskToApp(appId, selectedTask); final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(selectedTask); taskInfoRWLock.readLock().unlock(); return result; } else { final String selectedTask = getRandomTask(taskList); final double selectedTaskLoad = taskStatsMap.get(selectedTask).getTaskLoad(); if (selectedTaskLoad > overloadedTaskThreshold) { final List<String> remainingList = taskStatsMap.getTaskList(); remainingList.removeAll(taskList); if (!remainingList.isEmpty()) { final String taskCandidate = getRandomTask(remainingList); if (taskStatsMap.get(taskCandidate).getTaskLoad() < overloadedTaskThreshold) { appTaskListMap.addTaskToApp(appId, taskCandidate); final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(taskCandidate); taskInfoRWLock.readLock().unlock(); return result; } } } final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(selectedTask); taskInfoRWLock.readLock().unlock(); return result; } }
Source:
public int compareTo(SwiftResource that) { if (that == null) return 1; if (this == that) return 0; return this.getTransactionId().compareTo(that.getTransactionId()); }

Target:
public int compareTo(SwiftResource that) { return this.getTransactionId().compareTo(that.getTransactionId()); }
Source:
public void onState(final ProgramAB programab) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { startSessionButton.setEnabled(true); if (programab.getSessions().isEmpty()) { startSessionButton.setText("Start Session"); startSessionButton.setBackground(Color.RED); } else { startSessionButton.setText("Force reload ( kill csv )"); startSessionButton.setBackground(Color.GREEN); } if (programab.loading) { startSessionButton.setText("Loading..."); startSessionButton.setBackground(Color.ORANGE); startSessionButton.setEnabled(false); } if (programab.aimlError) { startSessionButton.setText("AIML error"); startSessionButton.setBackground(Color.RED); startSessionButton.setEnabled(false); } progABPath.setText(new File(programab.getPath()).getAbsolutePath()); userName.setText(programab.getCurrentUserName()); botName.setText(programab.getCurrentBotName()); textAreacontent = "<font face=\"Verdana\" size=-1>"; programab.getConversationHistory().stream().forEach(conversation -> { if (conversation == null) { conversation = "ERROR: NULL"; } textAreacontent = textAreacontent + conversation + "<br>"; }); response.setText(textAreacontent); } }); }

Target:
public void onState(final ProgramAB programab) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String botname = programab.getCurrentBotName(); String username = programab.getCurrentUserName(); startSession.setEnabled(true); if (programab.getSessions().isEmpty() || !programab.isReady()) { startSession.setBackground(Color.RED); } else { startSession.setBackground(Color.GREEN); } progABPath.setText(new File(programab.getPath()).getAbsolutePath()); userName.setText(username); botName.removeAllItems(); Iterator<String> iterator = programab.getBots().iterator(); while (iterator.hasNext()) { botName.addItem(iterator.next()); } if (programab.getCurrentBotName() != null) { botName.setSelectedItem(programab.getCurrentBotName()); } } }); }
Source:
public void testSaveTable() { long waiterId = 2L; getRestTestClientBuilder().setUser("chief"); getRestTestClientBuilder().setPassword("chief"); this.service = getRestTestClientBuilder().build(TablemanagementRestService.class); TableEto table = new TableEtoBuilder().number(NUMBER_TABLE_NEW).waiterId(ID_WAITER).createNew(); assertThat(table.getId()).isNull(); TableEto savedTable = this.service.saveTable(table); assertThat(savedTable).isNotNull(); assertThat(savedTable.getId()).isNotNull(); assertThat(savedTable.getState()).isEqualTo(TableState.FREE); assertThat(savedTable.getNumber()).isEqualTo(NUMBER_TABLE_NEW); assertThat(savedTable.getWaiterId()).isEqualTo(ID_WAITER); }

Target:
public void testSaveTable() { getRestTestClientBuilder().setUser("chief"); getRestTestClientBuilder().setPassword("chief"); this.service = getRestTestClientBuilder().build(TablemanagementRestService.class); TableEto table = new TableEtoBuilder().createNew(); assertThat(table.getId()).isNull(); TableEto savedTable = this.service.saveTable(table); assertThat(savedTable).isNotNull(); assertThat(savedTable.getId()).isNotNull(); assertThat(savedTable.getState()).isEqualTo(TableState.FREE); assertThat(savedTable.getNumber()).isEqualTo(NUMBER_TABLE_NEW); assertThat(savedTable.getWaiterId()).isEqualTo(ID_WAITER); }
Source:
public <I, F extends ScanFormatFactory<I>> ScanFormat<I> discoverScanFormat( Class<F> formatFactoryClass, ConfigOption<String> formatOption, String formatPrefix) { return discoverOptionalScanFormat(formatFactoryClass, formatOption, formatPrefix) .orElseThrow(() -> new ValidationException( String.format("Could not find required scan format option '%s'.", formatOption.key()))); }

Target:
public <I, F extends ScanFormatFactory<I>> ScanFormat<I> discoverScanFormat( Class<F> formatFactoryClass, ConfigOption<String> formatOption, String formatPrefix) { return discoverOptionalScanFormat(formatFactoryClass, formatOption, formatPrefix) .orElseThrow(() -> new ValidationException( String.format("Could not find required scan format '%s'.", formatOption.key()))); }
Source:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); boolean isDefaultIsGiven = true; Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { isDefaultIsGiven = false; } return isDefaultIsGiven; }

Target:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); boolean isDefaultIsGiven = true; Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions == null) { securityDefinitions = new HashMap<>(); } OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { isDefaultIsGiven = false; } return isDefaultIsGiven; }
Source:
public PathComponent build() { if (this.path.length() == 0) { return null; } String path = UrlPathHelper.getSanitizedPath(this.path); return new HierarchicalUriComponents.FullPathComponent(path); }

Target:
public PathComponent build() { if (this.path.length() == 0) { return null; } String sanitized = getSanitizedPath(this.path); return new HierarchicalUriComponents.FullPathComponent(sanitized); }
Source:
private void createDoubleClickListener(TreeViewer treeViewer) { treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection selection = (TreeSelection) event.getSelection(); if (selection.getFirstElement() instanceof ITimeGraphEntry) { ITimeGraphEntry entry = (ITimeGraphEntry) selection.getFirstElement(); if (entry.hasChildren()) { fTimeGraphWrapper.setExpandedState(entry, !fTimeGraphWrapper.getExpandedState(entry)); } } } } }); }

Target:
private void createDoubleClickListener(TreeViewer treeViewer) { treeViewer.addDoubleClickListener(event -> { if (event.getSelection() instanceof TreeSelection) { TreeSelection selection = (TreeSelection) event.getSelection(); if (selection.getFirstElement() instanceof ITimeGraphEntry) { ITimeGraphEntry entry = (ITimeGraphEntry) selection.getFirstElement(); if (entry.hasChildren()) { fTimeGraphWrapper.setExpandedState(entry, !fTimeGraphWrapper.getExpandedState(entry)); } } } }); }
Source:
public void serialize() { byte[] result = serializer.serialize("someKey", value); System.out.println(Arrays.toString(result)); assertArrayEquals(expectedResult, result); }

Target:
public void serialize() { byte[] result = serializer.serialize("someKey", value); assertArrayEquals(expectedResult, result); }
Source:
void handleFinished() { int ret = doUnmountVolume(path, true, removeEncryption); Slog.i(TAG, "Unmount completed: " + path + ", result code: " + ret); this.mountShutdownLatch.countDown(); }

Target:
void handleFinished() { int ret = doUnmountVolume(path, true, removeEncryption); Slog.i(TAG, "Unmount completed: " + path + ", result code: " + ret); mMountShutdownLatch.countDown(); }
Source:
static void assertAccountInAccountService(Account account, AccountService accountService) { Account accountFoundById = accountService.getAccountById(account.getId()); Account accountFoundByName = accountService.getAccountByName(account.getName()); assertEquals("Account got by id from accountService does not match account got by name.", accountFoundById, accountFoundByName); try { System.out.println(accountFoundById.toJson()); System.out.println(account.toJson()); } catch (JSONException e) { e.printStackTrace(); } assertEquals("Account got by id from accountService does not match the account to assert", accountFoundById, account); assertEquals("The number of containers in the account is wrong.", accountFoundById.getAllContainers().size(), account.getAllContainers().size()); for (Container container : account.getAllContainers()) { assertContainerInAccountService(container, accountService); } }

Target:
static void assertAccountInAccountService(Account account, AccountService accountService) { Account accountFoundById = accountService.getAccountById(account.getId()); Account accountFoundByName = accountService.getAccountByName(account.getName()); assertEquals("Account got by id from accountService does not match account got by name.", accountFoundById, accountFoundByName); assertEquals("Account got by id from accountService does not match the account to assert", accountFoundById, account); assertEquals("The number of containers in the account is wrong.", accountFoundById.getAllContainers().size(), account.getAllContainers().size()); for (Container container : account.getAllContainers()) { assertContainerInAccountService(container, accountService); } }
Source:
public void testBasic() { ExpectedValueProvider<FunctionCall> aggregationPattern = PlanMatchPattern.functionCall("count", false, ImmutableList.of(anySymbol())); tester().assertThat(new AddIntermediateAggregations()) .setSystemProperty(ENABLE_INTERMEDIATE_AGGREGATIONS, "true") .setSystemProperty(TASK_CONCURRENCY, "4") .on(p -> p.aggregation(af -> { p.variable("a", BIGINT); p.variable("b", BIGINT); p.variable("c", BIGINT); af.globalGrouping() .step(AggregationNode.Step.FINAL) .addAggregation(p.variable(p.symbol("c")), p.rowExpression("count(b)")) .source( p.gatheringExchange( ExchangeNode.Scope.REMOTE_STREAMING, p.aggregation(ap -> ap.globalGrouping() .step(AggregationNode.Step.PARTIAL) .addAggregation(p.variable(p.symbol("b")), p.rowExpression("count(a)")) .source( p.values(p.variable("a")))))); })) .matches( aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), FINAL, exchange(LOCAL, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), INTERMEDIATE, exchange(LOCAL, REPARTITION, exchange(REMOTE_STREAMING, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), INTERMEDIATE, exchange(LOCAL, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), PARTIAL, values(ImmutableMap.of("a", 0))))))))))); }

Target:
public void testBasic() { ExpectedValueProvider<FunctionCall> aggregationPattern = PlanMatchPattern.functionCall("count", false, ImmutableList.of(anySymbol())); tester().assertThat(new AddIntermediateAggregations()) .setSystemProperty(ENABLE_INTERMEDIATE_AGGREGATIONS, "true") .setSystemProperty(TASK_CONCURRENCY, "4") .on(p -> p.aggregation(af -> { p.variable("a", BIGINT); p.variable("b", BIGINT); p.variable("c", BIGINT); af.globalGrouping() .step(AggregationNode.Step.FINAL) .addAggregation(p.variable("c"), p.rowExpression("count(b)")) .source( p.gatheringExchange( ExchangeNode.Scope.REMOTE_STREAMING, p.aggregation(ap -> ap.globalGrouping() .step(AggregationNode.Step.PARTIAL) .addAggregation(p.variable("b"), p.rowExpression("count(a)")) .source( p.values(p.variable("a")))))); })) .matches( aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), FINAL, exchange(LOCAL, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), INTERMEDIATE, exchange(LOCAL, REPARTITION, exchange(REMOTE_STREAMING, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), INTERMEDIATE, exchange(LOCAL, GATHER, aggregation( globalAggregation(), ImmutableMap.of(Optional.empty(), aggregationPattern), ImmutableMap.of(), Optional.empty(), PARTIAL, values(ImmutableMap.of("a", 0))))))))))); }
Source:
public void testAtomFeed() { Map<String, Object> metadata = (Map<String, Object>)expectedFeed.get("metadata"); AtomFeed found = AtomFeed.parseStream(this.xmlStream); assertEquals(metadata.get("itemsPerPage"), found.itemsPerPage); assertEquals(metadata.get("startIndex"), found.startIndex); assertEquals(metadata.get("totalResults"), found.totalResults); List<Map<String, Object>> expectedEntries = (List<Map<String, Object>>)expectedFeed.get("entries"); List<AtomEntry> foundEntries = (List<AtomEntry>)found.entries; for (int i = 0; i < foundEntries.size(); i++) { AtomEntry foundEntry = foundEntries.get(i); Map<String, Object> expectedEntry = expectedEntries.get(i); assertEquals(expectedEntry.get("id"), foundEntry.id); assertEquals(expectedEntry.get("title"), foundEntry.title); assertEquals(expectedEntry.get("updated"), foundEntry.updated); Map<String, String> expectedLinks = (Map<String, String>)expectedEntry.get("links"); for (String linkName : foundEntry.links.keySet()) { assertEquals(expectedLinks.get(linkName), foundEntry.links.get(linkName)); } if (expectedEntry.containsKey("content")) { Map<String, Object> expectedContent = (Map<String, Object>)expectedEntry.get("content"); for (String key : foundEntry.content.keySet()) { if (!key.startsWith("eai:")) { assertEquals("Mismatch on " + key, expectedContent.get(key), foundEntry.content.get(key)); } } } else { assertNull(foundEntry.content); } } }

Target:
public void testAtomFeed() { Map<String, Object> expectedMetadata = (Map<String, Object>)expectedFeed.get("metadata"); AtomFeed actualFeed = AtomFeed.parseStream(this.xmlStream); assertEquals(expectedMetadata.get("itemsPerPage"), actualFeed.itemsPerPage); assertEquals(expectedMetadata.get("startIndex"), actualFeed.startIndex); assertEquals(expectedMetadata.get("totalResults"), actualFeed.totalResults); List<Map<String, Object>> expectedEntries = (List<Map<String, Object>>)expectedFeed.get("entries"); List<AtomEntry> actualEntries = (List<AtomEntry>)actualFeed.entries; for (int i = 0; i < actualEntries.size(); i++) { AtomEntry actualEntry = actualEntries.get(i); Map<String, Object> expectedEntry = expectedEntries.get(i); assertEquals(expectedEntry.get("id"), actualEntry.id); assertEquals(expectedEntry.get("title"), actualEntry.title); assertEquals(expectedEntry.get("updated"), actualEntry.updated); Map<String, String> expectedLinks = (Map<String, String>)expectedEntry.get("links"); for (String linkName : actualEntry.links.keySet()) { assertEquals(expectedLinks.get(linkName), actualEntry.links.get(linkName)); } if (expectedEntry.containsKey("content")) { Map<String, Object> expectedContent = (Map<String, Object>)expectedEntry.get("content"); for (String key : actualEntry.content.keySet()) { if (!key.startsWith("eai:")) { assertEquals("Mismatch on " + key, expectedContent.get(key), actualEntry.content.get(key)); } } } else { assertNull(actualEntry.content); } } }
Source:
public LabelType(String name, List<LabelValue> valueList) { this.name = checkName(name); canOverride = true; branch = Arrays.asList("project"); values = sortValues(valueList); abbreviation = defaultAbbreviation(name); functionName = "MaxWithBlock"; maxNegative = Short.MIN_VALUE; maxPositive = Short.MAX_VALUE; if (values.size() > 0) { if (values.get(0).getValue() < 0) { maxNegative = values.get(0).getValue(); } if (values.get(values.size() - 1).getValue() > 0) { maxPositive = values.get(values.size() - 1).getValue(); } } }

Target:
public LabelType(String name, List<LabelValue> valueList) { this.name = checkName(name); canOverride = true; values = sortValues(valueList); abbreviation = defaultAbbreviation(name); functionName = "MaxWithBlock"; maxNegative = Short.MIN_VALUE; maxPositive = Short.MAX_VALUE; if (values.size() > 0) { if (values.get(0).getValue() < 0) { maxNegative = values.get(0).getValue(); } if (values.get(values.size() - 1).getValue() > 0) { maxPositive = values.get(values.size() - 1).getValue(); } } }
Source:
public static CallNotPermittedException getCallNotPermittedException(CircuitBreaker circuitBreaker) { boolean disableStackTraces = circuitBreaker.getCircuitBreakerConfig().isDisableStackTraces(); String message = String.format("CircuitBreaker '%s' is %s and does not permit further calls", circuitBreaker.getName(), circuitBreaker.getState()); if (disableStackTraces) { return new CallNotPermittedException(message, false); } else { return new CallNotPermittedException(message, true); } }

Target:
public static CallNotPermittedException getCallNotPermittedException(CircuitBreaker circuitBreaker) { boolean writableStackTraceEnabled = circuitBreaker.getCircuitBreakerConfig().isWritableStackTraceEnabled(); String message = String.format("CircuitBreaker '%s' is %s and does not permit further calls", circuitBreaker.getName(), circuitBreaker.getState()); return new CallNotPermittedException(message, writableStackTraceEnabled); }
Source:
public void close() { releaseCurrentSortBuffer(); if (fileWriter != null) { fileWriter.releaseQuietly(); } super.close(); }

Target:
public void close() { releaseCurrentSortBuffer(); super.close(); IOUtils.closeQuietly(fileWriter); }
Source:
void initializeSystemColors () { COLOR_WIDGET_DARK_SHADOW_RGBA = new GdkRGBA (); COLOR_WIDGET_DARK_SHADOW_RGBA.alpha = 1.0; initializeColorList(); byte buffer = OS.GTK_THEME_SET ? Converter.wcsToMbcs (OS.GTK_THEME_NAME, true) : OS.getThemeNameBytes(); byte darkBuffer = OS.GTK_THEME_DARK ? darkBuffer = Converter.wcsToMbcs ("dark", true) : null; long themeProvider = GTK.gtk_css_provider_get_named(buffer, darkBuffer); String cssOutput = gtk_css_provider_to_string(themeProvider); initializeSystemColorsWidget(cssOutput); initializeSystemColorsList(cssOutput); initializeSystemColorsTitle(cssOutput); initializeSystemColorsLink(cssOutput); if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { initializeSystemColorsTooltip_3_20(); } else { initializeSystemColorsTooltip_old(cssOutput); } COLOR_TITLE_FOREGROUND_RGBA = COLOR_LIST_SELECTION_TEXT_RGBA; COLOR_TITLE_BACKGROUND_RGBA = COLOR_LIST_SELECTION_RGBA; COLOR_TITLE_BACKGROUND_GRADIENT_RGBA = toGdkRGBA (COLOR_LIST_SELECTION_RGBA, 1.3); COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT_RGBA = toGdkRGBA (COLOR_TITLE_INACTIVE_BACKGROUND_RGBA, 1.3); }

Target:
void initializeSystemColors () { COLOR_WIDGET_DARK_SHADOW_RGBA = new GdkRGBA (); COLOR_WIDGET_DARK_SHADOW_RGBA.alpha = 1.0; initializeColorList(); byte buffer = OS.GTK_THEME_SET ? Converter.wcsToMbcs (OS.GTK_THEME_NAME, true) : OS.getThemeNameBytes(); byte darkBuffer = OS.GTK_THEME_DARK ? darkBuffer = Converter.wcsToMbcs ("dark", true) : null; long themeProvider = GTK.gtk_css_provider_get_named(buffer, darkBuffer); String cssOutput = gtk_css_provider_to_string(themeProvider); initializeSystemColorsWidget(cssOutput); initializeSystemColorsList(cssOutput); initializeSystemColorsTitle(cssOutput); initializeSystemColorsLink(cssOutput); initializeSystemColorsTooltip(cssOutput); COLOR_TITLE_FOREGROUND_RGBA = COLOR_LIST_SELECTION_TEXT_RGBA; COLOR_TITLE_BACKGROUND_RGBA = COLOR_LIST_SELECTION_RGBA; COLOR_TITLE_BACKGROUND_GRADIENT_RGBA = toGdkRGBA (COLOR_LIST_SELECTION_RGBA, 1.3); COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT_RGBA = toGdkRGBA (COLOR_TITLE_INACTIVE_BACKGROUND_RGBA, 1.3); }
Source:
public void backfillDataPoints(String auth, String metric, String metricType, String orgId, Map<String,String> dimensions, List<SignalFxProtocolBuffers.PointValue> datumPoints) throws SignalFxMetricsException { if (datumPoints.isEmpty()) { return; } List<NameValuePair> params = Lists.newArrayList(); params.add(new BasicNameValuePair("orgid", orgId)); params.add(new BasicNameValuePair("metric_type", metricType)); params.add(new BasicNameValuePair("metric", metric)); for(Map.Entry<String,String> entry : dimensions.entrySet()) { params.add(new BasicNameValuePair("sfxdim_" + entry.getKey(), entry.getValue())); } try { CloseableHttpResponse resp = null; try { resp = postToEndpoint(auth, new InputStreamEntity( new ProtocolBufferStreamingInputStream<SignalFxProtocolBuffers.PointValue>( datumPoints.iterator()), PROTO_TYPE), "/v1/backfill?" + URLEncodedUtils.format(params, "UTF-8"), false); int code = resp.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_OK) { throw new SignalFxMetricsException("Invalid status code " + code); } } finally { if (resp != null) { resp.close(); } } } catch (IOException e) { throw new SignalFxMetricsException("Exception posting to backfillDataPoints", e); } }

Target:
public void backfillDataPoints(String auth, String metric, String metricType, String orgId, Map<String,String> dimensions, List<SignalFxProtocolBuffers.PointValue> datumPoints) throws SignalFxMetricsException { if (datumPoints.isEmpty()) { return; } List<NameValuePair> params = Lists.newArrayList(); params.add(new BasicNameValuePair("orgid", orgId)); params.add(new BasicNameValuePair("metric_type", metricType)); params.add(new BasicNameValuePair("metric", metric)); for (Map.Entry<String,String> entry : dimensions.entrySet()) { params.add(new BasicNameValuePair("sfxdim_" + entry.getKey(), entry.getValue())); } try { CloseableHttpResponse resp = null; try { resp = postToEndpoint(auth, new InputStreamEntity( new ProtocolBufferStreamingInputStream<SignalFxProtocolBuffers.PointValue>( datumPoints.iterator()), PROTO_TYPE), "/v1/backfill?" + URLEncodedUtils.format(params, StandardCharsets.UTF_8), false); int code = resp.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_OK) { throw new SignalFxMetricsException("Invalid status code " + code); } } finally { if (resp != null) { resp.close(); } } } catch (IOException e) { throw new SignalFxMetricsException("Exception posting to backfillDataPoints", e); } }
Source:
public ClueWeb09Collection.FileSegment createFileSegment(Path p) throws IOException { return new FileSegment(p); }

Target:
public FileSegment createFileSegment(Path p) throws IOException { return new FileSegment(p); }
Source:
public static void disableVersioning_test() throws Exception { if (!mintEnv) { System.out.println("Test: disableVersioning(DisableVersioningArgs args)"); } long startTime = System.currentTimeMillis(); try { String name = getRandomName(); client.makeBucket(MakeBucketArgs.builder().bucket(name).build()); client.disableVersioning(DisableVersioningArgs.builder().bucket(name).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(name).build()); mintSuccessLog("disableVersioning(DisableVersioningArgs args)", null, startTime); } catch (Exception e) { ErrorResponse errorResponse = null; if (e instanceof ErrorResponseException) { ErrorResponseException exp = (ErrorResponseException) e; errorResponse = exp.errorResponse(); } if (errorResponse != null && errorResponse.errorCode() == ErrorCode.NOT_IMPLEMENTED) { mintIgnoredLog("disableVersioning(DisableVersioningArgs args)", null, startTime); } else { mintFailedLog( "disableVersioning(DisableVersioningArgs args)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } }

Target:
public static void disableVersioning_test() throws Exception { if (!mintEnv) { System.out.println("Test: disableVersioning(DisableVersioningArgs args)"); } long startTime = System.currentTimeMillis(); try { String name = getRandomName(); client.makeBucket(MakeBucketArgs.builder().bucket(name).build()); client.disableVersioning(DisableVersioningArgs.builder().bucket(name).build()); client.enableVersioning(EnableVersioningArgs.builder().bucket(name).build()); client.disableVersioning(DisableVersioningArgs.builder().bucket(name).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(name).build()); mintSuccessLog("disableVersioning(DisableVersioningArgs args)", null, startTime); } catch (Exception e) { ErrorResponse errorResponse = null; if (e instanceof ErrorResponseException) { ErrorResponseException exp = (ErrorResponseException) e; errorResponse = exp.errorResponse(); } if (errorResponse != null && errorResponse.errorCode() == ErrorCode.NOT_IMPLEMENTED) { mintIgnoredLog("disableVersioning(DisableVersioningArgs args)", null, startTime); } else { mintFailedLog( "disableVersioning(DisableVersioningArgs args)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } }
Source:
public void testGetResultListSizeWithTypedQuery() throws Exception { List<Helicopter> helicopters = em.createQuery( "FROM Helicopter", Helicopter.class ) .getResultList(); Assertions.assertThat( helicopters.size() ).isEqualTo( 2 ); }

Target:
public void testGetResultListSizeWithTypedQuery() throws Exception { List<Helicopter> helicopters = em.createQuery( "FROM Helicopter", Helicopter.class ) .getResultList(); assertThat( helicopters.size() ).isEqualTo( 2 ); }
Source:
protected void refreshVisuals() { super.refreshVisuals(); DSemanticDiagram dSemanticDiagram = getDSemanticDiagram(); if (dSemanticDiagram != null) { ColorDescription backgroundColor = dSemanticDiagram.getDescription().getBackgroundColor(); if (backgroundColor != null && getFigure() != null) { RGBValues rgbBackgroundValues = new AbstractColorUpdater().getRGBValuesFromColorDescription(dSemanticDiagram.getTarget(), backgroundColor); Color colorUpdate = new Color(null, rgbBackgroundValues.getRed(), rgbBackgroundValues.getGreen(), rgbBackgroundValues.getBlue()); if (getFigure().getBackgroundColor() != colorUpdate) { if (isWhiteColor(rgbBackgroundValues)) { getFigure().setBackgroundColor(null); getFigure().setOpaque(false); } else { getFigure().setBackgroundColor(colorUpdate); getFigure().setOpaque(true); } } } } }

Target:
protected void refreshVisuals() { super.refreshVisuals(); configureBackground(getFigure()); }
Source:
public void valueMapShouldReturnAProperDeserializedJsonList() { String json = "[\"red\",\"green\",\"blue\"]"; List<String> expected = new ArrayList<String>(asList("red","green","blue")); ValueMap valueMap = new ValueMap().withJSON(KEY, json); List<String> actual = (List<String>)valueMap.get(KEY); assertThat(actual.size(), is(expected.size())); for (int counter = 0; counter < actual.size(); counter++) { assertThat(actual.get(counter), is(expected.get(counter))); } }

Target:
public void valueMapShouldReturnAProperDeserializedJsonList() { String json = "[\"red\",\"green\",\"blue\"]"; ValueMap valueMap = new ValueMap().withJSON(KEY, json); List<String> actual = (List<String>)valueMap.get(KEY); assertThat(actual.size(), is(3)); assertThat(actual, hasItems("red", "green", "blue")); }
Source:
public static boolean isTabListEmpty() { List<Tab> tabs = getTabs(); return !tabs.isEmpty() && !tabs.get(0).getBackStack().isEmpty(); }

Target:
public static boolean isTabListEmpty() { List<Tab> tabs = getTabs(); return tabs.isEmpty() || (tabs.size() == 1 && tabs.get(0).getBackStack().isEmpty()); }
Source:
public HighPassNode(Context context) { RenderingConfig renderingConfig = context.get(Config.class).getRendering(); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); renderingConfig.subscribe(RenderingConfig.BLOOM, this); requiresCondition(renderingConfig::isBloom); requiresFBO(HIGH_PASS_FBO_CONFIG, displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(HIGH_PASS_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(HIGH_PASS_FBO, displayResolutionDependentFBOs)); highPass = getMaterial(HIGH_PASS_MATERIAL); addDesiredStateChange(new EnableMaterial(HIGH_PASS_MATERIAL)); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFBO(textureSlot, READONLY_GBUFFER, ColorTexture, displayResolutionDependentFBOs, HIGH_PASS_MATERIAL, "tex")); }

Target:
public HighPassNode(Context context) { super(context); RenderingConfig renderingConfig = context.get(Config.class).getRendering(); renderingConfig.subscribe(RenderingConfig.BLOOM, this); requiresCondition(renderingConfig::isBloom); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(HIGH_PASS_FBO_CONFIG, displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(HIGH_PASS_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(HIGH_PASS_FBO, displayResolutionDependentFBOs)); highPass = getMaterial(HIGH_PASS_MATERIAL); addDesiredStateChange(new EnableMaterial(HIGH_PASS_MATERIAL)); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFBO(textureSlot, READONLY_GBUFFER, ColorTexture, displayResolutionDependentFBOs, HIGH_PASS_MATERIAL, "tex")); }
Source:
public Signature createSignature(final X509Certificate certificate, final PrivateKey privateKey, final PublicKey publicKey) throws SAMLAssertionBuilderException { final BasicX509Credential credential = new BasicX509Credential(certificate, privateKey); credential.setEntityCertificate(certificate); credential.setPrivateKey(privateKey); final Signature signature = OpenSAMLUtil.buildSignature(); signature.setSigningCredential(credential); signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); try { signature.setKeyInfo(getKeyInfo(publicKey)); } catch (final Exception ex) { LOG.error("Get HL7 Prefix Property exception: {}", ex.getLocalizedMessage(), ex); throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } return signature; }

Target:
public Signature createSignature(final X509Certificate certificate, final PrivateKey privateKey, final PublicKey publicKey) throws SAMLAssertionBuilderException { final BasicX509Credential credential = new BasicX509Credential(certificate, privateKey); credential.setEntityCertificate(certificate); credential.setPrivateKey(privateKey); final Signature signature = OpenSAMLUtil.buildSignature(); signature.setSigningCredential(credential); signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); try { signature.setKeyInfo(getKeyInfo(publicKey)); } catch (final Exception ex) { throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } return signature; }
Source:
public void doJobInFuture(String username, String password, String insightURL, String[] participantLabels, String fullPath, String reportId, JobDetail jobDetail, String fileName) { String response = insightReportService.runReport(username, password, insightURL, participantLabels, fullPath,reportId); if (response != null) { CompletableFuture<Object> future = CompletableFuture.supplyAsync(() -> { try { insightReportService.saveToFile(response.toString(), fullPath); userService.persistJobCompleted(jobDetail, fileName); }catch(Exception e) { logger.error("Exeception is thrown while creating file : " + e); } return null; }); } }

Target:
public void doJobInFuture(String username, String password, String insightURL, String[] participantLabels, String fullPath, String reportId, JobDetail jobDetail, String fileName) { CompletableFuture<Object> future = CompletableFuture.supplyAsync(() -> { try { String response = insightReportService.runReport(username, password, insightURL, participantLabels, fullPath, reportId); insightReportService.saveToFile(response.toString(), fullPath); userService.persistJobCompleted(jobDetail, fileName); }catch(Exception e) { logger.error("Exception is thrown while creating file : " + e); userService.persistJobFailed(jobDetail, fileName); } return null; }); }
Source:
public void rewriteResourceZip(@NonNull File source, @NonNull File dest) throws IOException { if (dest.exists()) { boolean deleted = dest.delete(); if (!deleted) { throw new IOException("Could not delete " + dest); } } JarInputStream zis = null; try { FileInputStream fis = new FileInputStream(source); try { FileOutputStream fos = new FileOutputStream(dest); zis = new JarInputStream(fis); JarOutputStream zos = new JarOutputStream(fos); try { zos.setLevel(Deflater.DEFAULT_COMPRESSION); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); boolean directory = entry.isDirectory(); Resource resource = getResourceByJarPath(name); if (resource == null || resource.reachable) { JarEntry outEntry = new JarEntry(entry.getName()); if (entry.getTime() != -1L) { outEntry.setTime(entry.getTime()); } int method = entry.getMethod(); outEntry.setMethod(method); if (method == ZipEntry.STORED) { outEntry.setCompressedSize(entry.getCompressedSize()); outEntry.setSize(entry.getSize()); outEntry.setCrc(entry.getCrc()); } zos.putNextEntry(outEntry); if (!directory) { byte[] bytes = ByteStreams.toByteArray(zis); if (bytes != null) { zos.write(bytes); } } zos.closeEntry(); } else if (isVerbose()) { System.out.println("Skipped unused resource " + name + ": " + entry.getSize() + " bytes"); } entry = zis.getNextEntry(); } zos.flush(); } finally { Closeables.close(zos, false); } } finally { Closeables.close(fis, true); } } finally { Closeables.close(zis, false); } }

Target:
public void rewriteResourceZip(@NonNull File source, @NonNull File dest) throws IOException { if (dest.exists()) { boolean deleted = dest.delete(); if (!deleted) { throw new IOException("Could not delete " + dest); } } JarInputStream zis = null; try { FileInputStream fis = new FileInputStream(source); try { FileOutputStream fos = new FileOutputStream(dest); zis = new JarInputStream(fis); JarOutputStream zos = new JarOutputStream(fos); try { zos.setLevel(Deflater.DEFAULT_COMPRESSION); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); boolean directory = entry.isDirectory(); Resource resource = getResourceByJarPath(name); if (resource == null || resource.reachable) { JarEntry outEntry = new JarEntry(entry); zos.putNextEntry(outEntry); if (!directory) { byte[] bytes = ByteStreams.toByteArray(zis); if (bytes != null) { zos.write(bytes); } } zos.closeEntry(); } else if (isVerbose()) { System.out.println("Skipped unused resource " + name + ": " + entry.getSize() + " bytes"); } entry = zis.getNextEntry(); } zos.flush(); } finally { Closeables.close(zos, false); } } finally { Closeables.close(fis, true); } } finally { Closeables.close(zis, false); } }