auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Object computeInput(IWorkbenchPart part, ISelection selection, IJavaElement input, IProgressMonitor monitor) { if (getControl() == null || input == null) return null; String javadocHtml; switch (input.getElementType()) { case IJavaElement.COMPILATION_UNIT: try { IType[] types= ((ICompilationUnit) input).getTypes(); if (types.length == 0 && JavaModelUtil.isPackageInfo((ICompilationUnit) input)) { javadocHtml= getJavadocHtml(new IJavaElement[] { input.getParent() }, part, selection, monitor); } else { javadocHtml= getJavadocHtml(types, part, selection, monitor); } } catch (JavaModelException ex) { javadocHtml= null; } break; case IJavaElement.CLASS_FILE: if (input instanceof IModularClassFile) { try { javadocHtml= getJavadocHtml(new IJavaElement[] { ((IModularClassFile) input).getModule() }, part, selection, monitor); } catch (JavaModelException e) { return null; } } else { javadocHtml= getJavadocHtml(new IJavaElement[] { ((IOrdinaryClassFile) input).getType() }, part, selection, monitor); } break; default: javadocHtml= getJavadocHtml(new IJavaElement[] { input }, part, selection, monitor); } return javadocHtml; }

Target:
protected Object computeInput(IWorkbenchPart part, ISelection selection, IJavaElement input, IProgressMonitor monitor) { if (getControl() == null || input == null) return null; String javadocHtml; switch (input.getElementType()) { case IJavaElement.COMPILATION_UNIT: try { IType[] types= ((ICompilationUnit) input).getTypes(); if (types.length == 0 && JavaModelUtil.isPackageInfo((ICompilationUnit) input)) { javadocHtml= getJavadocHtml(new IJavaElement[] { input.getParent() }, part, selection, monitor); } else { javadocHtml= getJavadocHtml(types, part, selection, monitor); } } catch (JavaModelException ex) { javadocHtml= null; } break; case IJavaElement.CLASS_FILE: if (JavaModelUtil.PACKAGE_INFO_CLASS.equals(input.getElementName())) { javadocHtml= getJavadocHtml(new IJavaElement[] { input.getParent() }, part, selection, monitor); } else if (input instanceof IModularClassFile) { try { javadocHtml= getJavadocHtml(new IJavaElement[] { ((IModularClassFile) input).getModule() }, part, selection, monitor); } catch (JavaModelException e) { return null; } } else { javadocHtml= getJavadocHtml(new IJavaElement[] { ((IOrdinaryClassFile) input).getType() }, part, selection, monitor); } break; default: javadocHtml= getJavadocHtml(new IJavaElement[] { input }, part, selection, monitor); } return javadocHtml; }
Source:
public void assignConsumerForSubscription(Subscription subscription) { logger.info("Creating consumer for {}", subscription.getQualifiedName()); try { Consumer consumer = consumerFactory.createConsumer(subscription); Signal start = Signal.of(Signal.SignalType.START, subscription.getQualifiedName(), consumer); logger.info("Created consumer for {}. Initialized start signal with id {}", subscription.getQualifiedName(), start.getId()); backgroundProcess.accept(start); if (subscription.getState() == PENDING) { subscriptionRepository.updateSubscriptionState(subscription.getTopicName(), subscription.getName(), ACTIVE); } logger.info("Consumer for was added for execution", subscription.getQualifiedName()); } catch (Exception ex) { logger.error("Failed to create consumer for subscription {}", subscription.getQualifiedName(), ex); } }

Target:
public void assignConsumerForSubscription(Subscription subscription) { logger.info("Creating consumer for {}", subscription.getQualifiedName()); try { Consumer consumer = consumerFactory.createConsumer(subscription); Signal start = Signal.of(Signal.SignalType.START, subscription.getQualifiedName(), consumer); logger.info("Created consumer for {}. {}", subscription.getQualifiedName(), start.getLogWithIdAndType()); backgroundProcess.accept(start); if (subscription.getState() == PENDING) { subscriptionRepository.updateSubscriptionState(subscription.getTopicName(), subscription.getName(), ACTIVE); } logger.info("Consumer for was added for execution. {}", subscription.getQualifiedName(), start.getLogWithIdAndType()); } catch (Exception ex) { logger.error("Failed to create consumer for subscription {}", subscription.getQualifiedName(), ex); } }
Source:
public final boolean visit(ThisExpression node) { Name q= node.getQualifier(); if (q == null) { return false; } if (q.isSimpleName()) { if (((SimpleName) q).getIdentifier().equals(fDeclaringType.getElementName())) { fRewrite.set(node, ThisExpression.QUALIFIER_PROPERTY, null, null); } } else if (q.getFullyQualifiedName().equals(fDeclaringType.getFullyQualifiedName())) { fRewrite.set(node, ThisExpression.QUALIFIER_PROPERTY, null, null); } return false; }

Target:
public final boolean visit(ThisExpression node) { Name q= node.getQualifier(); if (q == null) { return false; } String qName = q.getFullyQualifiedName(); if (qName.equals(fDeclaringType.getElementName()) || qName.equals(fDeclaringType.getFullyQualifiedName())) { fRewrite.set(node, ThisExpression.QUALIFIER_PROPERTY, null, null); } return false; }
Source:
public void testCreateOneTopic() throws Throwable { Map<String, NewTopic> newTopics = Collections.singletonMap(TEST_TOPIC, NEW_TEST_TOPIC); WorkerUtils.createTopics(log, adminClient, newTopics, true, 3, 2500); assertEquals(Collections.singleton(TEST_TOPIC), adminClient.listTopics().names().get()); assertEquals( new TopicDescription( TEST_TOPIC, false, Collections.singletonList( new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()))), adminClient.describeTopics( Collections.singleton(TEST_TOPIC)).values().get(TEST_TOPIC).get() ); }

Target:
public void testCreateOneTopic() throws Throwable { Map<String, NewTopic> newTopics = Collections.singletonMap(TEST_TOPIC, NEW_TEST_TOPIC); WorkerUtils.createTopics(log, adminClient, newTopics, true, WorkerUtils.DEFAULT_TOPIC_VERIFY_RETRIES, WorkerUtils.DEFAULT_TOPIC_VERIFY_BACKOFF); assertEquals(Collections.singleton(TEST_TOPIC), adminClient.listTopics().names().get()); assertEquals( new TopicDescription( TEST_TOPIC, false, Collections.singletonList( new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()))), adminClient.describeTopics( Collections.singleton(TEST_TOPIC)).values().get(TEST_TOPIC).get() ); }
Source:
public void setUp() throws Exception { Session.SessionBuilder sessionBuilder = testSessionBuilder(); generatedEvents = new TestEventListener.EventsBuilder(); queryRunner = DistributedQueryRunner.builder(sessionBuilder.build()) .setExtraProperties(ImmutableMap.of("testing-warning-collector.preloaded-warnings", String.valueOf(TEST_WARNINGS))) .setNodeCount(1) .build(); queryRunner.installPlugin(new TestEventListenerPlugin.TestingEventListenerPlugin(generatedEvents)); generatedEvents.initialize(EXPECTED_EVENTS); }

Target:
public void setUp() throws Exception { SessionBuilder sessionBuilder = testSessionBuilder(); generatedEvents = new EventsBuilder(); queryRunner = DistributedQueryRunner.builder(sessionBuilder.build()) .setExtraProperties(ImmutableMap.of("testing-warning-collector.preloaded-warnings", String.valueOf(TEST_WARNINGS))) .setNodeCount(1) .build(); queryRunner.installPlugin(new TestingEventListenerPlugin(generatedEvents)); generatedEvents.initialize(EXPECTED_EVENTS); }
Source:
protected Event createEventByType(String eventType, String topic, String payload, String source) throws Exception { Event event = null; if (eventType.equals(ItemCommandEvent.TYPE)) { event = createCommandEvent(topic, payload, source); } else if (eventType.equals(ItemStateEvent.TYPE)) { event = createStateEvent(topic, payload, source); } else if (eventType.equals(ItemStateChangedEvent.TYPE)) { event = createStateChangedEvent(topic, payload); } else if (eventType.equals(ItemAddedEvent.TYPE)) { event = createAddedEvent(topic, payload); } else if (eventType.equals(ItemUpdatedEvent.TYPE)) { event = createUpdatedEvent(topic, payload); } else if (eventType.equals(ItemRemovedEvent.TYPE)) { event = createRemovedEvent(topic, payload); } else if (eventType.equals(GroupItemStateChangedEvent.TYPE)){ event = createGroupStateChangedEvent(topic, payload); }else if (eventType.equals(GroupItemStateEvent.TYPE)){ event = createGroupStateEvent(topic, payload, source); } return event; }

Target:
protected Event createEventByType(String eventType, String topic, String payload, String source) throws Exception { Event event = null; if (eventType.equals(ItemCommandEvent.TYPE)) { event = createCommandEvent(topic, payload, source); } else if (eventType.equals(ItemStateEvent.TYPE)) { event = createStateEvent(topic, payload, source); } else if (eventType.equals(ItemStateChangedEvent.TYPE)) { event = createStateChangedEvent(topic, payload); } else if (eventType.equals(ItemAddedEvent.TYPE)) { event = createAddedEvent(topic, payload); } else if (eventType.equals(ItemUpdatedEvent.TYPE)) { event = createUpdatedEvent(topic, payload); } else if (eventType.equals(ItemRemovedEvent.TYPE)) { event = createRemovedEvent(topic, payload); } else if (eventType.equals(GroupItemStateChangedEvent.TYPE)) { event = createGroupStateChangedEvent(topic, payload); } return event; }
Source:
private PartialJoinOperatorImpl createPartialJoinOperatorImpl(OperatorSpec prevOperatorSpec, JoinOperatorSpec joinOpSpec, Config config, TaskContext context, Clock clock) { Pair<PartialJoinFunction, PartialJoinFunction> joinFunctions = getOrCreatePartialJoinFunctions(joinOpSpec); if (joinOpSpec.getLeftInputOpSpec().equals(prevOperatorSpec)) { return new PartialJoinOperatorImpl(joinOpSpec, true, joinFunctions.getLeft(), joinFunctions.getRight(), config, context, clock); } else { return new PartialJoinOperatorImpl(joinOpSpec, false, joinFunctions.getRight(), joinFunctions.getLeft(), config, context, clock); } }

Target:
private PartialJoinOperatorImpl createPartialJoinOperatorImpl(OperatorSpec prevOperatorSpec, JoinOperatorSpec joinOpSpec, Config config, TaskContext context, Clock clock) { Pair<PartialJoinFunction, PartialJoinFunction> partialJoinFunctions = getOrCreatePartialJoinFunctions(joinOpSpec); if (joinOpSpec.getLeftInputOpSpec().equals(prevOperatorSpec)) { return new PartialJoinOperatorImpl(joinOpSpec, true, partialJoinFunctions.getLeft(), partialJoinFunctions.getRight(), config, context, clock); } else { return new PartialJoinOperatorImpl(joinOpSpec, false, partialJoinFunctions.getRight(), partialJoinFunctions.getLeft(), config, context, clock); } }
Source:
public void start_passwordCheckerSaysOk_doesNotThrow() { try (CryptoSession cryptoSession = CryptoSession.start(Optional.of(PASSWORD1), CryptoSessionTest::passwordIsOk)) { assertThat("Password checker returned OK", true); } }

Target:
public void start_passwordCheckerSaysOk_doesNotThrow() { try (CryptoSession cryptoSession = CryptoSession.start(Optional.of(PASSWORD1), CryptoSessionTest::passwordIsOk)) { } }
Source:
public void asEnumMapWithUnknownValue() { NodeAdapter subject = newNodeAdapterForTest("{ key : { unknown : 7 } }"); assertEquals(Map.<AnEnum, Double>of(), subject.asEnumMap("key", AnEnum.class, NodeAdapter::asDouble)); Logger log = Mockito.mock(Logger.class); subject.logUnusedParameters(log); Mockito.verify(log).warn(Mockito.anyString(), Mockito.eq("Test/key/unknown")); }

Target:
public void asEnumMapWithUnknownValue() { NodeAdapter subject = newNodeAdapterForTest("{ key : { unknown : 7 } }"); assertEquals(Map.<AnEnum, Double>of(), subject.asEnumMap("key", AnEnum.class, NodeAdapter::asDouble)); Logger log = Mockito.mock(Logger.class); subject.logUnusedParameters(log); Mockito.verify(log) .warn( Mockito.anyString(), Mockito.eq("key.unknown"), Mockito.eq("Test") ); }
Source:
private static File locateMainArtifact(String version, File target, boolean enterprise) { File artifact = new File(LOCAL_M2_REPOSITORY_PREFIX + constructPath(version, enterprise)); if (artifact.exists()) { return artifact; } else { return downloadMember(version, target, enterprise); } }

Target:
private static File locateMainArtifact(String version, File target, boolean enterprise) { File artifact = new File(LOCAL_M2_REPOSITORY_PREFIX + constructPath(version, enterprise)); if (artifact.exists()) { return artifact; } else { return downloadMainArtifact(version, target, enterprise); } }
Source:
@Override public JsonWriter jsonValue(String value) throws IOException { put(new JsonValue(value)); return this; }

Target:
@Override public JsonWriter jsonValue(String value) throws IOException { put(JsonParser.parseString(value)); return this; }
Source:
public RequestExecutor(final CloseableHttpClient client, final HttpHost host, final Ds3Request ds3Request) throws IOException { this.client = client; this.ds3Request = ds3Request; this.host = host; this.content = ds3Request.getStream(); if (this.content != null && !this.content.markSupported()) { throw new RequiresMarkSupportedException(); } Object[] paramArray = {this.ds3Request.getVerb(), this.host.toString(), getEscapedRequestPath(this.ds3Request)}; LOG.info("Sending request: {}", paramArray ); this.checksumType = ds3Request.getChecksumType(); this.hash = this.buildHash(); }

Target:
public RequestExecutor(final CloseableHttpClient client, final HttpHost host, final Ds3Request ds3Request) throws IOException { this.client = client; this.ds3Request = ds3Request; this.host = host; this.content = ds3Request.getStream(); if (this.content != null && !this.content.markSupported()) { throw new RequiresMarkSupportedException(); } final Object[] paramArray = {this.ds3Request.getVerb(), this.host.toString(), getEscapedRequestPath(this.ds3Request)}; LOG.info("Sending request: {}", paramArray ); this.checksumType = ds3Request.getChecksumType(); this.hash = this.buildHash(); }
Source:
public void toggleAnonymous() throws Exception { final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); final boolean initialValue = false; try { elytronAuthenticationOperations.performActionOnAttributeAndRevertItsValueToOriginal( authenticationConfigurationAddress, () -> { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ANONYMOUS, !initialValue) .verifyFormSaved() .verifyAttribute(ANONYMOUS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ANONYMOUS, initialValue) .verifyFormSaved() .verifyAttribute(ANONYMOUS, initialValue); }, ANONYMOUS); } finally { ops.removeIfExists(authenticationConfigurationAddress); } }

Target:
public void toggleAnonymous() throws Exception { final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); final boolean initialValue = false; try { elytronAuthenticationOperations.performActionOnAttributeAndRevertItsValueToOriginal( authenticationConfigurationAddress, ANONYMOUS, () -> { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ANONYMOUS, !initialValue) .verifyFormSaved() .verifyAttribute(ANONYMOUS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ANONYMOUS, initialValue) .verifyFormSaved() .verifyAttribute(ANONYMOUS, initialValue); } ); } finally { ops.removeIfExists(authenticationConfigurationAddress); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CacheKey cacheKey = (CacheKey) o; if (name != null ? !name.equals(cacheKey.name) : cacheKey.name != null) return false; if (sqlObjectType != null ? !sqlObjectType.equals(cacheKey.sqlObjectType) : cacheKey.sqlObjectType != null) return false; return sqlObjectMethod != null ? sqlObjectMethod.equals(cacheKey.sqlObjectMethod) : cacheKey.sqlObjectMethod == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CacheKey that = (CacheKey) o; return eq(this.name, that.name) && eq(this.sqlObjectType, that.sqlObjectType) && eq(this.sqlObjectMethod, that.sqlObjectMethod); }
Source:
private void updateThreadParent() throws NodeStoreException { if (null == inReplyTo) return; channelManager.updateThreadParent(node, inReplyTo); }

Target:
private void updateThreadParent() throws NodeStoreException { if (null == inReplyTo) { return; } channelManager.updateThreadParent(node, inReplyTo); }
Source:
public void renderHead(Component component, IHeaderResponse response) { response.render(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(this.getClass(), "tooltipsy.min.js"))); if (getHostComponent() != null) { String selector = "#" + getHostComponent().getMarkupId(); if (!overrideSelector.equals("")) { selector = overrideSelector; } String javascript = "$('" + selector + "').tooltipsy(" + options.getParameterString() + ");"; response.render(OnLoadHeaderItem.forScript(javascript)); } }

Target:
public void renderHead(Component component, IHeaderResponse response) { response.render(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(this.getClass(), TOOLTIPSY_JS_FILENAME))); if (component != null) { String selector = "#" + component.getMarkupId(); if (!overrideSelector.equals("")) { selector = overrideSelector; } String javascript = "$('" + selector + "').tooltipsy(" + options.getParameterString() + ");"; response.render(OnLoadHeaderItem.forScript(javascript)); } }
Source:
public void close() { if (noCurrentGraphFrame()) { return; } Tab curFrame = (Tab) aTabbedPane.getSelectionModel().getSelectedItem(); if (curFrame != null) { GraphFrame openFrame = (GraphFrame) curFrame; if (openFrame.getGraphPanel().isModified()) { Alert alert = new Alert(AlertType.CONFIRMATION, aEditorResources.getString("dialog.close.ok"), ButtonType.YES, ButtonType.NO); alert.initOwner(aMainStage); alert.setTitle(aEditorResources.getString("dialog.close.title")); alert.setHeaderText(aEditorResources.getString("dialog.close.title")); alert.showAndWait(); if (alert.getResult() == ButtonType.YES) { removeTab(curFrame); } return; } else { removeTab(curFrame); } } }

Target:
public void close() { if (noCurrentGraphFrame()) { return; } Tab currentFrame = (Tab) aTabbedPane.getSelectionModel().getSelectedItem(); if (currentFrame != null) { GraphFrame openFrame = (GraphFrame) currentFrame; if (openFrame.getGraphPanel().isModified()) { Alert alert = new Alert(AlertType.CONFIRMATION, aEditorResources.getString("dialog.close.ok"), ButtonType.YES, ButtonType.NO); alert.initOwner(aMainStage); alert.setTitle(aEditorResources.getString("dialog.close.title")); alert.setHeaderText(aEditorResources.getString("dialog.close.title")); alert.showAndWait(); if (alert.getResult() == ButtonType.YES) { removeTab(currentFrame); } return; } else { removeTab(currentFrame); } } }
Source:
public void TestOverflowToDisk() throws Exception { RowMapBuffer buffer = new RowMapBuffer(2); RowMap r; buffer.add(new RowMap("insert", "foo", "bar", 1L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); buffer.add(new RowMap("insert", "foo", "bar", 2L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); buffer.add(new RowMap("insert", "foo", "bar", 3L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); assertThat(buffer.size(), is(3L)); assertThat(buffer.removeFirst().getTimestamp(), is(1L)); assertThat(buffer.removeFirst().getTimestamp(), is(2L)); assertThat(buffer.removeFirst().getTimestamp(), is(3L)); }

Target:
public void TestOverflowToDisk() throws Exception { RowMapBuffer buffer = new RowMapBuffer(2); RowMap r; buffer.add(new RowMap("insert", "foo", "bar", 1L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); buffer.add(new RowMap("insert", "foo", "bar", 2L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); buffer.add(new RowMap("insert", "foo", "bar", 3L, new ArrayList<String>(), new BinlogPosition(3, "mysql.1"))); assertThat(buffer.size(), is(3L)); assertThat(buffer.inMemorySize(), is(2L)); assertThat(buffer.removeFirst().getTimestamp(), is(1L)); assertThat(buffer.removeFirst().getTimestamp(), is(2L)); assertThat(buffer.removeFirst().getTimestamp(), is(3L)); }
Source:
public IPluginBase createPluginBase(boolean isFragment) { if (fPluginBase != null) return fPluginBase; if (isFragment) { fPluginBase = new FragmentNode(); fPluginBase.setXMLTagName("fragment"); } else { fPluginBase = new PluginNode(); fPluginBase.setXMLTagName("plugin"); } fPluginBase.setInTheModel(true); fPluginBase.setModel(this); return fPluginBase; }

Target:
public IPluginBase createPluginBase(boolean isFragment) { if (fPluginBase != null) { return fPluginBase; } if (isFragment) { fPluginBase = new FragmentNode(); fPluginBase.setXMLTagName("fragment"); } else { fPluginBase = new PluginNode(); fPluginBase.setXMLTagName("plugin"); } fPluginBase.setInTheModel(true); fPluginBase.setModel(this); return fPluginBase; }
Source:
public static BigtableDataSettings createBigtableDataSettings(@Nonnull final BigtableOptions options) throws IOException { checkState(options.getProjectId() != null, "Project ID is required"); checkState(options.getInstanceId() != null, "Instance ID is required"); checkState(options.getRetryOptions().enableRetries(), "Disabling retries is not currently supported."); final BigtableDataSettings.Builder builder = BigtableDataSettings.newBuilder(); builder.setProjectId(options.getProjectId()); builder.setInstanceId(options.getInstanceId()); builder.setAppProfileId(options.getAppProfileId()); builder.setEndpoint(options.getDataHost() + ":" + options.getPort()); builder.setCredentialsProvider(buildCredentialProvider(options.getCredentialOptions())); buildBulkMutationsSettings(builder, options); buildCheckAndMutateRowSettings(builder, options.getCallOptionsConfig().getShortRpcTimeoutMs()); buildReadModifyWriteSettings(builder, options.getCallOptionsConfig().getShortRpcTimeoutMs()); buildReadRowSettings(builder, options); buildReadRowsSettings(builder, options); buildMutateRowSettings(builder, options); buildSampleRowKeysSettings(builder, options); builder.setTransportChannelProvider(createChannelProvider(options.getDataHost(), options)); return builder.build(); }

Target:
public static BigtableDataSettings createBigtableDataSettings( @Nonnull final BigtableOptions options) throws IOException { checkState(options.getRetryOptions().enableRetries(), "Disabling retries is not currently supported."); checkState(!options.useCachedChannel(), "cachedDataPool is not currently supported."); final BigtableDataSettings.Builder builder = BigtableDataSettings.newBuilder(); final Builder dataSettingStub = builder.stubSettings(); Duration shortRpcTimeoutMs = ofMillis(options.getCallOptionsConfig().getShortRpcTimeoutMs()); builder .setProjectId(options.getProjectId()) .setInstanceId(options.getInstanceId()) .setAppProfileId(options.getAppProfileId()); dataSettingStub .setEndpoint(options.getDataHost() + ":" + options.getPort()) .setHeaderProvider(buildHeaderProvider(options.getUserAgent())) .setCredentialsProvider(buildCredentialProvider(options.getCredentialOptions())); if(options.usePlaintextNegotiation()){ dataSettingStub .setTransportChannelProvider(buildChannelProvider(dataSettingStub.getEndpoint(), options)); } dataSettingStub.checkAndMutateRowSettings() .setSimpleTimeoutNoRetries(shortRpcTimeoutMs); dataSettingStub.readModifyWriteRowSettings() .setSimpleTimeoutNoRetries(shortRpcTimeoutMs); buildBulkMutationsSettings(dataSettingStub, options); buildReadRowsSettings(dataSettingStub, options); buildReadRowSettings(dataSettingStub, options); buildMutateRowSettings(dataSettingStub, options); buildSampleRowKeysSettings(dataSettingStub, options); return builder.build(); }
Source:
protected ModelAndView uploadReportTemplate(HttpServletRequest request, @RequestParam MultipartFile templateFile) throws IOException { if (!templateFile.isEmpty()) { try { mrrtReportTemplateService.importMrrtReportTemplate(templateFile.getInputStream()); request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.report.template.imported"); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } } else { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "radiology.report.template.not.imported.empty"); } return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); }

Target:
protected ModelAndView uploadReportTemplate(HttpServletRequest request, @RequestParam MultipartFile templateFile) throws IOException { if (templateFile.isEmpty()) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "radiology.MrrtReportTemplate.not.imported.empty"); return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); } try { mrrtReportTemplateService.importMrrtReportTemplate(templateFile.getInputStream()); request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.MrrtReportTemplate.imported"); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } catch (APIException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); }
Source:
public void shouldAddUser() { controller.add(user); verify(userDao).add(user); assertEquals("User " + user.getName() + " successfully added", result.included().get("notice")); }

Target:
public void shouldAddUser() { controller.add(user); verify(userDao).add(user); assertThat(result.included().get("notice").toString(), is("User " + user.getName() + " successfully added")); }
Source:
public void tearDown() throws Exception { FileUtils.deleteQuietly(nuxeoHome); originSystemProps.forEach((key, originValue) -> { if (originValue == null) { System.clearProperty(key); } else { System.setProperty(key, originValue); } }); originSystemProps.clear(); }

Target:
public void tearDown() throws Exception { FileUtils.deleteQuietly(nuxeoHome); originSystemProps.forEach((key, value) -> { if (value == null) { System.clearProperty(key); } else { System.setProperty(key, value); } }); originSystemProps.clear(); }
Source:
private void setCommandScriptContent(String str) { if (str != null && str.length() > EDITOR_SCRIPT_MAX_SIZE_THRESHOLD) { getTxtOutput().setText(""); largeScriptContent = str; isLargeScriptContent = true; } else { if (str == null) { getTxtOutput().setText(""); } else { getTxtOutput().append(str); } largeScriptContent = ""; isLargeScriptContent = false; } setSyntaxHighlightTextAreaVisible(); }

Target:
private void setCommandScriptContent(String str) { if (str.length() > EDITOR_SCRIPT_MAX_SIZE_THRESHOLD) { getTxtOutput().setText(""); largeScriptContent = str; largeScriptContentSet = true; } else { getTxtOutput().setText(str); largeScriptContent = ""; largeScriptContentSet = false; } if (largeScriptContentSet) { this.remove(getJScrollPane()); this.add(largeScriptPanel, largeScriptPanel.getName()); largeScriptLabel.setText(Constant.messages.getString("scripts.dialog.script.large.warning", largeScriptContent.length())); } else { this.remove(largeScriptPanel); this.add(getJScrollPane(), getJScrollPane().getName()); } }
Source:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(INITIAL, MULTIPLIER); builder.append(path); builder.append(type); return builder.toHashCode(); }

Target:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(path); builder.append(type); return builder.toHashCode(); }
Source:
private ZapTable getMessagesTable() { if (messagesTable == null) { messagesTable = new HistoryReferencesTable(EMPTY_RESULTS_MODEL); messagesTable.setName(MESSAGE_CONTAINER_NAME); messagesTable.setAutoCreateColumnsFromModel(false); } return messagesTable; }

Target:
private HistoryReferencesTable getMessagesTable() { if (messagesTable == null) { messagesTable = new HistoryReferencesTable(EMPTY_RESULTS_MODEL); messagesTable.setName(MESSAGE_CONTAINER_NAME); messagesTable.setAutoCreateColumnsFromModel(false); } return messagesTable; }
Source:
public Integer getRecursiveStmtId() { return m_sharedScan.getBestCostRecurseStmtId(); }

Target:
public Integer getRecursiveStmtId() { return m_sharedScan.getBestCostRecursiveStmtId(); }
Source:
@Test public void responseConverterFactoryNoMatchThrows() { Type type = String.class; Annotation[] annotations = new Annotation[0]; NonMatchingConverterFactory nonMatchingFactory = new NonMatchingConverterFactory(); Retrofit retrofit = new Retrofit.Builder() .baseUrl("<LINK_0>") .addConverterFactory(nonMatchingFactory) .build(); try { retrofit.responseBodyConverter(type, annotations); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("" + "Could not locate ResponseBody converter for class java.lang.String.\n" + " Tried:\n" + " * retrofit2.BuiltInConverters\n" + " * retrofit2.helpers.NonMatchingConverterFactory"); } assertThat(nonMatchingFactory.called).isTrue(); }

Target:
@Test public void responseConverterFactoryNoMatchThrows() { Type type = String.class; Annotation[] annotations = new Annotation[0]; NonMatchingConverterFactory nonMatchingFactory = new NonMatchingConverterFactory(); Retrofit retrofit = new Retrofit.Builder() .baseUrl("<LINK_0>") .addConverterFactory(nonMatchingFactory) .build(); try { retrofit.responseBodyConverter(type, annotations); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("" + "Could not locate ResponseBody converter for class java.lang.String.\n" + " Tried:\n" + " * retrofit2.BuiltInConverters\n" + " * retrofit2.helpers.NonMatchingConverterFactory"); } assertThat(nonMatchingFactory.called).isTrue(); }
Source:
public void shouldReturnNetAmountIfFeeExists() { long chargeId = nextInt(); String externalChargeId = RandomIdGenerator.newId(); long feeCollected = 100L; long defaultAmount = 6234L; long defaultCorporateSurchargeAmount = 150L; createCharge(externalChargeId, chargeId); databaseTestHelper.addFee(RandomIdGenerator.newId(), chargeId, 100L, feeCollected, ZonedDateTime.now(), "irrelevant_id"); connectorRestApiClient .withAccountId(accountId) .withChargeId(externalChargeId) .getCharge() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("fee", is(100)) .body("net_amount", is(defaultAmount + defaultCorporateSurchargeAmount - feeCollected)); }

Target:
public void shouldReturnNetAmountIfFeeExists() { long chargeId = nextInt(); String externalChargeId = RandomIdGenerator.newId(); long feeCollected = 100L; long defaultAmount = 6234L; long defaultCorporateSurchargeAmount = 150L; createCharge(externalChargeId, chargeId); databaseTestHelper.addFee(RandomIdGenerator.newId(), chargeId, 100L, feeCollected, ZonedDateTime.now(), "irrelevant_id"); connectorRestApiClient .withAccountId(accountId) .withChargeId(externalChargeId) .getCharge() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("fee", is(100)) .body("net_amount", is(Long.valueOf(defaultAmount + defaultCorporateSurchargeAmount - feeCollected).intValue())); }
Source:
public SignUpRequest(final Activity activity, HashMap<String, String> params, final Response.Listener<Session> listener, final Response.Listener<APIError> errorListener) { super(Request.Method.POST, makeURL("users"), signUpRequestParams(activity, params), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { String sessionJson = jsonObject.get("session").toString(); ObjectMapper mapper = getNetworkManager(activity.getApplicationContext()).getObjectMapper(); Session session = mapper.readValue(sessionJson, new TypeReference<Session>() { }); listener.onResponse(session); } catch (Exception e) { Log.e("Json exception", e.toString()); } } }, activity); }

Target:
public SignUpRequest(final Activity activity, HashMap<String, String> params, final Response.Listener<Session> listener, final Response.Listener<APIError> errorListener) { super(Request.Method.POST, makeURL("users"), signUpRequestParams(activity, params), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { String sessionJson = jsonObject.get("session").toString(); ObjectMapper mapper = getNetworkManager(activity.getApplicationContext()).getObjectMapper(); Session session = mapper.readValue(sessionJson, new TypeReference<Session>() { }); listener.onResponse(session); } catch (Exception e) { Log.e("Json exception", e.toString()); } } }, errorListener, activity); }
Source:
public void parse(Scanner in) throws Exception { String line = null; int lineNum = 0; String sectionName = null; Map<String, String> section = null; while (in.hasNextLine()) { line = in.nextLine(); lineNum++; line = line.replaceAll("^\\s+", ""); if (line.isEmpty() || line.startsWith("#")) { continue; } else if (line.startsWith("[")) { if (!line.endsWith("]")) { String msg = MessageFormat.format("Error in service file line {0}: missing ].", lineNum); throw new Exception(msg); } sectionName = line.substring(1, line.length() - 1); section = new HashMap(); sections.put(sectionName, section); } else if (section == null) { String msg = MessageFormat.format("Error in service file line {0}: not in section.", lineNum); throw new Exception(msg); } else { String[] segment = line.split("="); if (segment.length != 2) { String msg = MessageFormat.format("Error in service file line {0}: bad syntax.", lineNum); throw new Exception(msg); } section.put(segment[0], segment[1]); } } }

Target:
private void parse(Scanner in) throws Exception { int lineNum = 0; String sectionName = null; Map<String, String> section = null; while (in.hasNextLine()) { String line = in.nextLine(); lineNum++; line = line.replaceAll("^\\s+", ""); if (line.isEmpty() || line.startsWith("#")) { continue; } else if (line.startsWith("[")) { if (!line.endsWith("]")) { String msg = MessageFormat.format("Error in service file line {0}: missing ].", lineNum); throw new ParseException(msg, lineNum); } sectionName = line.substring(1, line.length() - 1); section = new HashMap(); sections.put(sectionName, section); } else if (section == null) { String msg = MessageFormat.format("Error in service file line {0}: not in section.", lineNum); throw new ParseException(msg, lineNum); } else { String[] segment = line.split("=", 2); if (segment.length != 2) { String msg = MessageFormat.format("Error in service file line {0}: bad syntax.", lineNum); throw new ParseException(msg, lineNum); } section.put(segment[0], segment[1]); } } }
Source:
public String describeModule(Module<Flow> module) { String result; try { ModuleMetaData moduleMetaData = new ModuleMetaDataImpl(); moduleMetaData.setName(module.getName()); moduleMetaData.setDescription(module.getDescription()); moduleMetaData.setVersion(module.getVersion()); for(Flow flow: module.getFlows()) { moduleMetaData.getFlows().add(flowMetaDataProvider .deserialiseFlow(flowMetaDataProvider.describeFlow(flow))); } ObjectMapper mapper = new ObjectMapper(); result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(moduleMetaData); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data json!", e); } return result; }

Target:
public String describeModule(Module<Flow> module) { String result; try { ModuleMetaData moduleMetaData = new ModuleMetaDataImpl(); moduleMetaData.setName(module.getName()); moduleMetaData.setDescription(module.getDescription()); moduleMetaData.setVersion(module.getVersion()); for(Flow flow: module.getFlows()) { moduleMetaData.getFlows().add(flowMetaDataProvider .deserialiseFlow(flowMetaDataProvider.describeFlow(flow))); } result = this.mapper.writerWithDefaultPrettyPrinter().writeValueAsString(moduleMetaData); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data json!", e); } return result; }
Source:
public List<LunModel> getLunsToRemove() { ArrayList<LunModel> luns = new ArrayList<>(); if (!getIsGrouppedByTarget()) { List<LunModel> items = (List<LunModel>) getItems(); for (LunModel lun : items) { if (lun.getIsIncluded() && lun.isRemoveLunSelected() && luns.stream().noneMatch(new Linq.LunPredicate(lun))) { luns.add(lun); } } } return luns; }

Target:
public List<LunModel> getLunsToRemove() { if (getIsGrouppedByTarget()) { return Collections.emptyList(); } return ((List<LunModel>) getItems()).stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isRemoveLunSelected) .distinct() .collect(Collectors.toList()); }
Source:
public void createUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); CommunityRest comm = new CommunityRest(); comm.setName("Test Top-Level Community"); MetadataEntryRest title = new MetadataEntryRest(); title.setKey("dc.title"); title.setValue("Title Text"); comm.setMetadata(Arrays.asList(title)); getClient().perform(post("/api/core/communities") .content(mapper.writeValueAsBytes(comm)) .contentType(contentType)) .andExpect(status().isForbidden()); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/communities") .content(mapper.writeValueAsBytes(comm)) .contentType(contentType)) .andExpect(status().isForbidden()); }

Target:
public void createUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); CommunityRest comm = new CommunityRest(); comm.setName("Test Top-Level Community"); MetadataEntryRest title = new MetadataEntryRest(); title.setKey("dc.title"); title.setValue("Title Text"); comm.setMetadata(Arrays.asList(title)); getClient().perform(post("/api/core/communities") .content(mapper.writeValueAsBytes(comm)) .contentType(contentType)) .andExpect(status().isUnauthorized()); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/communities") .content(mapper.writeValueAsBytes(comm)) .contentType(contentType)) .andExpect(status().isForbidden()); }
Source:
private static SslContext createSslContext() throws SSLException { SslContextBuilder builder = getSslBuilder(); return builder == null ? null : builder.build(); }

Target:
private static SslContext createSslContext() throws SSLException { return getSslBuilder().build(); }
Source:
public Call<MwQueryResponse<SiteInfo>> request(final Callback cb) { Retrofit retrofitClient = RetrofitFactory.newInstance(apiBaseUrl, new WikiSite(apiBaseUrl)); Service request = retrofitClient.create(Service.class); Call<MwQueryResponse<SiteInfo>> call = request.requestSiteinfo(); call.enqueue(new retrofit2.Callback<MwQueryResponse<SiteInfo>>() { @Override public void onResponse(Call<MwQueryResponse<SiteInfo>> call, Response<MwQueryResponse<SiteInfo>> response) { if (response.isSuccessful() && response.body().success()) { cb.onSuccess(response.body().query()); } else { cb.onFailure(new HttpStatusException(response.raw())); } } @Override public void onFailure(Call<MwQueryResponse<SiteInfo>> call, Throwable t) { cb.onFailure(t); } }); return call; }

Target:
public Call<MwQueryResponse<SiteInfo>> request(final Callback cb) { Retrofit retrofitClient = RetrofitFactory.newInstance(apiBaseUrl, new WikiSite(apiBaseUrl)); Service request = retrofitClient.create(Service.class); Call<MwQueryResponse<SiteInfo>> call = request.requestSiteinfo(); call.enqueue(new retrofit2.Callback<MwQueryResponse<SiteInfo>>() { @Override public void onResponse(Call<MwQueryResponse<SiteInfo>> call, Response<MwQueryResponse<SiteInfo>> response) { if (response.isSuccessful() && response.body() != null && response.body().success()) { cb.onSuccess(response.body().query()); } else { cb.onFailure(new HttpStatusException(response.raw())); } } @Override public void onFailure(Call<MwQueryResponse<SiteInfo>> call, Throwable t) { cb.onFailure(t); } }); return call; }
Source:
private void addItemWithName(Set<GenericItem> items, String itemName) { if (itemName != null) { try { Item item = itemRegistry.getItem(itemName); if (item instanceof GenericItem) { final GenericItem gItem = (GenericItem) item; items.add(gItem); } } catch (ItemNotFoundException e) { } } }

Target:
private void addItemWithName(Set<GenericItem> items, String itemName) { if (itemName != null) { try { Item item = renderer.getItemUIRegistry().getItem(itemName); if (item instanceof GenericItem) { final GenericItem gItem = (GenericItem) item; items.add(gItem); } } catch (ItemNotFoundException e) { } } }
Source:
public void addCommand(ReceiveCommand cmd, String rawLine) { received = true; commands.add(cmd); rawCommands.append(rawLine); }

Target:
public void addCommand(ReceiveCommand cmd, String rawLine) { commands.add(cmd); rawCommands.append(rawLine); }
Source:
public static ISideEffectFactory createFactory(Widget disposableWidget) { ICompositeSideEffect compositeSideEffect = ICompositeSideEffect.create(); disposableWidget.setData(ICompositeSideEffect.class.getName(), compositeSideEffect); disposableWidget.addDisposeListener(e -> compositeSideEffect.dispose()); return ISideEffectFactory.createFactory(compositeSideEffect::add); }

Target:
public static ISideEffectFactory createFactory(Widget disposableWidget) { ICompositeSideEffect compositeSideEffect = (ICompositeSideEffect) disposableWidget .getData(ICompositeSideEffect.class.getName()); if (compositeSideEffect == null) { ICompositeSideEffect newCompositeSideEffect = ICompositeSideEffect.create(); disposableWidget.setData(ICompositeSideEffect.class.getName(), newCompositeSideEffect); disposableWidget.addDisposeListener(e -> newCompositeSideEffect.dispose()); compositeSideEffect = newCompositeSideEffect; } return ISideEffectFactory.createFactory(compositeSideEffect::add); }
Source:
protected ConsumerRecords<?, ?> pollRecords(long pollInterval) throws Exception { ConsumerRecords<?, ?> records; try { long curPollTime = System.currentTimeMillis(); _lastPolledTimeMillis = curPollTime; records = _consumer.poll(pollInterval); long pollDurationMillis = System.currentTimeMillis() - curPollTime; if (pollDurationMillis > pollInterval + POLL_BUFFER_TIME_MILLIS) { _logger.warn("ConsumerId: {}, Kafka client poll took ms (> poll timeout + buffer time ms)", _taskName, pollDurationMillis, pollInterval, POLL_BUFFER_TIME_MILLIS); _consumerMetrics.updateClientPollOverTimeout(1); } _consumerMetrics.updateNumPolls(1); _consumerMetrics.updateEventCountsPerPoll(records.count()); if (!records.isEmpty()) { _consumerMetrics.updateEventsProcessedRate(records.count()); _consumerMetrics.updateLastEventReceivedTime(Instant.now()); } _pollAttempts = 0; try { sendPollInfoToPositionTracker(_consumer, records); } catch (WakeupException | InterruptException e) { throw e; } catch (Exception e) { _logger.warn("Got uncaught exception while processing position tracker code (swallowing and continuing)", e); } return records; } catch (NoOffsetForPartitionException e) { handleNoOffsetForPartitionException(e); return ConsumerRecords.EMPTY; } catch (WakeupException e) { _logger.warn("Got a WakeupException, shutdown in progress.", e); return ConsumerRecords.EMPTY; } catch (Exception e) { handlePollRecordsException(e); return ConsumerRecords.EMPTY; } }

Target:
protected ConsumerRecords<?, ?> pollRecords(long pollInterval) throws Exception { ConsumerRecords<?, ?> records; try { long curPollTime = System.currentTimeMillis(); _lastPolledTimeMillis = curPollTime; records = _consumer.poll(pollInterval); long pollDurationMillis = System.currentTimeMillis() - curPollTime; if (pollDurationMillis > pollInterval + POLL_BUFFER_TIME_MILLIS) { _logger.warn("ConsumerId: {}, Kafka client poll took ms (> poll timeout + buffer time ms)", _taskName, pollDurationMillis, pollInterval, POLL_BUFFER_TIME_MILLIS); _consumerMetrics.updateClientPollOverTimeout(1); } _consumerMetrics.updateNumPolls(1); _consumerMetrics.updateEventCountsPerPoll(records.count()); if (!records.isEmpty()) { _consumerMetrics.updateEventsProcessedRate(records.count()); _consumerMetrics.updateLastEventReceivedTime(Instant.now()); } _pollAttempts = 0; sendPollInfoToPositionTracker(_consumer, records); return records; } catch (NoOffsetForPartitionException e) { handleNoOffsetForPartitionException(e); return ConsumerRecords.EMPTY; } catch (WakeupException e) { _logger.warn("Got a WakeupException, shutdown in progress.", e); return ConsumerRecords.EMPTY; } catch (Exception e) { handlePollRecordsException(e); return ConsumerRecords.EMPTY; } }
Source:
public void initializeColumnMap(Schema schema) { columnNames = schema.getFields(); keyMethodMap = new ArrayList<Getter>(); for (int i = 0; i < columnNames.size(); i++) { try { keyMethodMap.add(generateGettersForField(cls, columnNames.get(i).name())); } catch (NoSuchFieldException | SecurityException e) { throw new RuntimeException("Failed to initialize pojo class getters for field: ", e); } } }

Target:
private void initializeColumnMap(Schema schema) { setColumnNames(schema.getFields()); keyMethodMap = new ArrayList<Getter>(); for (int i = 0; i < getColumnNames().size(); i++) { try { keyMethodMap.add(generateGettersForField(cls, getColumnNames().get(i).name())); } catch (NoSuchFieldException | SecurityException e) { throw new RuntimeException("Failed to initialize pojo class getters for field - ", e); } } }
Source:
private void doOpen() throws IOException { try { if (invalid) throw new PackInvalidException(packFile); synchronized (readLock) { fd = new RandomAccessFile(packFile, "r"); length = fd.length(); onOpenPack(); } } catch (InterruptedIOException e) { openFail(false); throw e; } catch (FileNotFoundException fn) { openFail(!packFile.exists()); throw fn; } catch (EOFException | AccessDeniedException | NoSuchFileException | CorruptObjectException | NoPackSignatureException | PackMismatchException | UnpackException | UnsupportedPackVersionException pe) { openFail(true); throw pe; } catch (IOException | RuntimeException ge) { openFail(false); throw ge; } catch (Error e) { openFail(true); throw e; } }

Target:
private void doOpen() throws IOException { try { if (invalid) throw new PackInvalidException(packFile); synchronized (readLock) { fd = new RandomAccessFile(packFile, "r"); length = fd.length(); onOpenPack(); } } catch (InterruptedIOException e) { openFail(false); throw e; } catch (FileNotFoundException fn) { openFail(!packFile.exists()); throw fn; } catch (EOFException | AccessDeniedException | NoSuchFileException | CorruptObjectException | NoPackSignatureException | PackMismatchException | UnpackException | UnsupportedPackIndexVersionException | UnsupportedPackVersionException pe) { openFail(true); throw pe; } catch (IOException | RuntimeException ge) { openFail(false); throw ge; } catch (Error e) { openFail(true); throw e; } }