auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public UpdateProjection(Symbol uidSymbol, String[] assignmentsColumns, Symbol[] assignments, Version version, Symbol[] outputs, @Nullable Symbol[] returnValues, @Nullable Long requiredVersion) { this.uidSymbol = uidSymbol; this.assignmentsColumns = assignmentsColumns; this.assignments = assignments; this.allOn4_1 = version.onOrAfter(Version.V_4_1_0); this.returnValues = returnValues; assert Arrays.stream(outputs).noneMatch(s -> SymbolVisitors.any(Symbols.IS_COLUMN.or(x -> x instanceof SelectSymbol), s)) : "Cannot operate on Reference, Field or SelectSymbol symbols: " + outputs; this.outputs = outputs; this.requiredVersion = requiredVersion; }

Target:
public UpdateProjection(Symbol uidSymbol, String[] assignmentsColumns, Symbol[] assignments, Version version, Symbol[] outputs, @Nullable Symbol[] returnValues, @Nullable Long requiredVersion) { this.uidSymbol = uidSymbol; this.assignmentsColumns = assignmentsColumns; this.assignments = assignments; this.allOn4_2 = version.onOrAfter(Version.V_4_2_0); this.returnValues = returnValues; assert Arrays.stream(outputs).noneMatch(s -> SymbolVisitors.any(Symbols.IS_COLUMN.or(x -> x instanceof SelectSymbol), s)) : "Cannot operate on Reference, Field or SelectSymbol symbols: " + outputs; this.outputs = outputs; this.requiredVersion = requiredVersion; }
Source:
public void ShouldReturnAllIdentifierType() throws Exception { when(Context.isAuthenticated()).thenReturn(true); when(Context.hasPrivilege("Get Identifier Types")).thenReturn(true); final IdentifierSource identifierSource = new IdentifierSource("source-uuid", "some name", "SOM"); final IdentifierType bahmniIdentifierType = new IdentifierType("uuid", "bahmni", "description", ".*", true, true, Arrays.asList(identifierSource)); when(serviceWrapper.getPrimaryAndExtraIdentifierTypes()).thenReturn(Arrays.asList(bahmniIdentifierType)); ResponseEntity<String> allIdentifierType = controller.getPrimaryAndExtraIdentifierTypes(); List<IdentifierType> identifierTypes = new ObjectMapper().readValue(allIdentifierType.getBody(), new TypeReference<List<IdentifierType>>() {}); assertEquals(1, identifierTypes.size()); assertEquals(bahmniIdentifierType.getUuid(), identifierTypes.get(0).getUuid()); assertEquals(bahmniIdentifierType.getFormat(), identifierTypes.get(0).getFormat()); assertEquals(bahmniIdentifierType.getName(), identifierTypes.get(0).getName()); assertEquals(bahmniIdentifierType.getIdentifierSources().size(), identifierTypes.get(0).getIdentifierSources().size()); }

Target:
public void ShouldReturnAllIdentifierType() throws Exception { when(Context.isAuthenticated()).thenReturn(true); when(Context.hasPrivilege("Get Identifier Types")).thenReturn(true); final IdentifierSource identifierSource = new IdentifierSource("source-uuid", "some name", "SOM"); final IdentifierType openmrsIdentifierType = new IdentifierType("uuid", "openmrs", "description", ".*", true, true, Arrays.asList(identifierSource)); when(serviceWrapper.getPrimaryAndExtraIdentifierTypes()).thenReturn(Arrays.asList(openmrsIdentifierType)); ResponseEntity<String> allIdentifierType = controller.getPrimaryAndExtraIdentifierTypes(); List<IdentifierType> identifierTypes = new ObjectMapper().readValue(allIdentifierType.getBody(), new TypeReference<List<IdentifierType>>() {}); assertEquals(1, identifierTypes.size()); assertEquals(openmrsIdentifierType.getUuid(), identifierTypes.get(0).getUuid()); assertEquals(openmrsIdentifierType.getFormat(), identifierTypes.get(0).getFormat()); assertEquals(openmrsIdentifierType.getName(), identifierTypes.get(0).getName()); assertEquals(openmrsIdentifierType.getIdentifierSources().size(), identifierTypes.get(0).getIdentifierSources().size()); }
Source:
public void ldapAuthenticationProviderCustom() { this.spring.register(CustomLdapAuthenticationProviderConfig.class).autowire(); LdapAuthenticationProvider provider = findAuthenticationProvider(LdapAuthenticationProvider.class); LdapAuthoritiesPopulator authoritiesPopulator = getAuthoritiesPopulator(provider); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupRoleAttribute", "cn"); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchBase", "ou=groups"); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchFilter", "(member={0})"); assertThat(getAuthoritiesMapper(provider)).hasFieldOrPropertyWithValue("prefix", "PREFIX_"); LdapAuthenticator authenticator = getAuthenticator(provider); assertThat(callGetUserDns(authenticator, "user")).isEqualTo(Collections.singletonList("uid=user,ou=people")); assertThat(authenticator).hasFieldOrPropertyWithValue("userSearch.searchBase", "ou=users"); assertThat(authenticator).hasFieldOrPropertyWithValue("userSearch.searchFilter", "(uid={0})"); }

Target:
public void ldapAuthenticationProviderCustom() throws Exception { this.spring.register(CustomLdapAuthenticationProviderConfig.class).autowire(); this.mockMvc.perform(formLogin().user("bob").password("bobspassword")) .andExpect(authenticated().withAuthorities(Collections.singleton(new SimpleGrantedAuthority("PREFIX_DEVELOPERS")))); }
Source:
private void collapseDeclarationOfNameAndDescendants(Name n, String alias) { boolean canCollapseChildNames = n.canCollapseUnannotatedChildNames(); if (n.canCollapse()) { if (n.docInfo != null && n.docInfo.isNoCollapse() && n.parent != null && n.parent.type == Name.Type.OBJECTLIT && n.parent.docInfo != null && n.parent.docInfo.hasEnumParameterType()) { compiler.report( JSError.make(n.docInfo.getAssociatedNode(), INVALID_NOCOLLAPSE)); } updateObjLitOrFunctionDeclaration(n, alias, canCollapseChildNames); } if (n.props != null) { for (Name p : n.props) { collapseDeclarationOfNameAndDescendants( p, appendPropForAlias(alias, p.getBaseName())); if (!p.inExterns && canCollapseChildNames && p.getDeclaration() != null && p.canCollapse() && p.getDeclaration().node != null && p.getDeclaration().node.getParent() != null && p.getDeclaration().node.getParent().isAssign()) { updateSimpleDeclaration( appendPropForAlias(alias, p.getBaseName()), p, p.getDeclaration()); } } } }

Target:
private void collapseDeclarationOfNameAndDescendants(Name n, String alias) { boolean canCollapseChildNames = n.canCollapseUnannotatedChildNames(); if (n.canCollapse()) { if (n.docInfo != null && n.docInfo.isNoCollapse() && n.isDescendantOfEnum()) { compiler.report( JSError.make(n.docInfo.getAssociatedNode(), INVALID_NOCOLLAPSE)); } updateObjLitOrFunctionDeclaration(n, alias, canCollapseChildNames); } if (n.props != null) { for (Name p : n.props) { collapseDeclarationOfNameAndDescendants( p, appendPropForAlias(alias, p.getBaseName())); if (!p.inExterns && canCollapseChildNames && p.getDeclaration() != null && p.canCollapse() && p.getDeclaration().node != null && p.getDeclaration().node.getParent() != null && p.getDeclaration().node.getParent().isAssign()) { updateSimpleDeclaration( appendPropForAlias(alias, p.getBaseName()), p, p.getDeclaration()); } } } }
Source:
public void setup() throws Exception { super.setup(); srcDir = absolutepath("source"); dstDir = absolutepath("target"); srcFile = new Path(srcDir, "source.txt"); dstFile = new Path(dstDir, "dst.txt"); zeroByteFile = new Path(srcDir, "zero.txt"); byte[] block = dataset(TEST_FILE_LEN, 0, 255); createFile(getFileSystem(), srcFile, true, block); touch(getFileSystem(), zeroByteFile); fs = getFileSystem(); skipIfUnsupported(SUPPORTS_NATIVE_COPY); }

Target:
public void setup() throws Exception { super.setup(); skipIfUnsupported(SUPPORTS_NATIVE_COPY); srcDir = absolutepath("source"); dstDir = absolutepath("target"); srcFile = new Path(srcDir, "source.txt"); dstFile = new Path(dstDir, "dst.txt"); zeroByteFile = new Path(srcDir, "zero.txt"); srcData = dataset(TEST_FILE_LEN, 0, 255); createFile(getFileSystem(), srcFile, true, srcData); touch(getFileSystem(), zeroByteFile); fs = getFileSystem(); }
Source:
public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) { String lastKnownLocalModValue = task .getAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey()); TaskAttribute latestRemoteModAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION); String latestRemoteModValue = latestRemoteModAttribute != null ? latestRemoteModAttribute.getValue() : null; if (latestRemoteModValue == null && lastKnownLocalModValue == null) { return false; } if (latestRemoteModValue != null && lastKnownLocalModValue != null) { return !latestRemoteModValue.equals(lastKnownLocalModValue); } return true; }

Target:
public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) { String lastKnownLocalModValue = task .getAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey()); TaskAttribute latestRemoteModAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION); String latestRemoteModValue = latestRemoteModAttribute != null ? latestRemoteModAttribute.getValue() : null; if (latestRemoteModValue == null && lastKnownLocalModValue == null) { return false; } return !Objects.equal(latestRemoteModValue, lastKnownLocalModValue); }
Source:
private String buildExceptionMessage(EventMessage failedEvent) { String eventDescription = format("An event with identifier [%s] could not be persisted", failedEvent.getIdentifier()); if (isFirstDomainEvent(failedEvent)) { DomainEventMessage failedDomainEvent = (DomainEventMessage) failedEvent; eventDescription = format("An aggregate of type [%s] with id [%s] was already created.", failedDomainEvent.getType(), failedDomainEvent.getAggregateIdentifier()); } else if (failedEvent instanceof DomainEventMessage<?>) { DomainEventMessage failedDomainEvent = (DomainEventMessage) failedEvent; eventDescription = format("An event for aggregate [%s] at sequence [%d] was already inserted", failedDomainEvent.getAggregateIdentifier(), failedDomainEvent.getSequenceNumber()); } return eventDescription; }

Target:
private String buildExceptionMessage(EventMessage failedEvent) { String eventDescription = format("An event with identifier [%s] could not be persisted", failedEvent.getIdentifier()); if (isFirstDomainEvent(failedEvent)) { DomainEventMessage failedDomainEvent = (DomainEventMessage) failedEvent; eventDescription = format( "Cannot reuse aggregate identifier [%s] to create aggregate [%s] since identifiers need to be unique.", failedDomainEvent.getAggregateIdentifier(), failedDomainEvent.getType()); } else if (failedEvent instanceof DomainEventMessage<?>) { DomainEventMessage failedDomainEvent = (DomainEventMessage) failedEvent; eventDescription = format("An event for aggregate [%s] at sequence [%d] was already inserted", failedDomainEvent.getAggregateIdentifier(), failedDomainEvent.getSequenceNumber()); } return eventDescription; }
Source:
public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler, Consumer<ZMQException> exceptionHandler) { ZMsg msg = null; try { msg = ZMsg.recvMsg(socket, flags); } catch (ZMQException e) { exceptionHandler.accept(e); } handler.accept(msg); }

Target:
public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler, Consumer<ZMQException> exceptionHandler) { try { handler.accept(ZMsg.recvMsg(socket, flags)); } catch (ZMQException e) { exceptionHandler.accept(e); } }
Source:
public ArrayList<OCShare> getPrivateSharesForAFile(String filePath, String accountName){ String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"+ "AND" + " (" + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? ) "; String whereArgs = new String[]{ filePath, accountName , Integer.toString(ShareType.USER.getValue()), Integer.toString(ShareType.GROUP.getValue()), Integer.toString(ShareType.FEDERATED.getValue())}; Cursor c = null; if (getContentResolver() != null) { c = getContentResolver().query( ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } else { try { c = getContentProviderClient().query( ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } catch (RemoteException e) { Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage()); c = null; } } ArrayList<OCShare> shares = new ArrayList<>(); OCShare share = null; if (c != null) { if (c.moveToFirst()) { do { share = createShareInstance(c); shares.add(share); } while (c.moveToNext()); } c.close(); } return shares; }

Target:
public ArrayList<OCShare> getPrivateSharesForAFile(String filePath, String accountName){ String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"+ "AND" + " (" + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? ) "; String whereArgs = new String[]{ filePath, accountName , Integer.toString(ShareType.USER.getValue()), Integer.toString(ShareType.GROUP.getValue()), Integer.toString(ShareType.FEDERATED.getValue())}; Cursor c; if (getContentResolver() != null) { c = getContentResolver().query( ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } else { try { c = getContentProviderClient().query( ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } catch (RemoteException e) { Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage()); c = null; } } ArrayList<OCShare> privateShares = new ArrayList<>(); OCShare privateShare; if (c != null) { if (c.moveToFirst()) { do { privateShare = createShareInstance(c); privateShares.add(privateShare); } while (c.moveToNext()); } c.close(); } return privateShares; }
Source:
private void writeParameters(JarOutputStream target, String parameters) { try (InputStream in = new ByteArrayInputStream(parameters.getBytes(Charset.forName("UTF-8")))) { JarEntry entry = new JarEntry("config/composedjob.properties"); target.putNextEntry(entry); StreamUtils.copy(in, target); target.closeEntry(); } catch(IOException ioe){ throw new IllegalStateException(ioe.getMessage(), ioe); } }

Target:
private void writeParameters(JarOutputStream target, String parameters) { try (InputStream in = new ByteArrayInputStream(parameters.getBytes(Charset.forName(StandardCharsets.UTF_8.name())))) { JarEntry entry = new JarEntry("config/composedjob.properties"); target.putNextEntry(entry); StreamUtils.copy(in, target); target.closeEntry(); } catch(IOException ioe){ throw new IllegalStateException(ioe.getMessage(), ioe); } }
Source:
int getNumberOfProjects(final OrganizationalUnit organizationalUnit) { for (final OrganizationalUnit unit : numberOfProjectsByOrganizationalUnit.keySet()) { if (unit.getName().equals(organizationalUnit.getName())) { return numberOfProjectsByOrganizationalUnit.get(unit); } } return 0; }

Target:
int getNumberOfProjects(final OrganizationalUnit organizationalUnit) { final Integer count = numberOfProjectsByOrganizationalUnit.get(organizationalUnit); return count != null ? count.intValue() : 0; }
Source:
public HttpResponse execute(HttpRequest req) throws UncheckedIOException { Optional<Map<String, List<String>>> params = FormEncodedData.getData(req); String cmd = getValue("cmd", params, req); SessionId sessionId = null; if (getValue("sessionId", params, req) != null) { sessionId = new SessionId(getValue("sessionId", params, req)); } String[] args = deserializeArgs(params, req); if (cmd == null) { return sendError(HTTP_NOT_FOUND, "Unable to find cmd query parameter"); } StringBuilder printableArgs = new StringBuilder("["); Joiner.on(", ").appendTo(printableArgs, args); printableArgs.append("]"); LOG.finest(String.format("Command request: %s%s on session %s", cmd, printableArgs, sessionId)); if ("getNewBrowserSession".equals(cmd)) { return startNewSession(args[0], args[1], args.length == 4 ? args[3] : ""); } else if ("testComplete".equals(cmd)) { CommandProcessor commandProcessor = PROCESSORS.get(sessionId); sessions.invalidate(sessionId); if (commandProcessor == null) { return sendError(HTTP_NOT_FOUND, "Unable to find command processor for " + sessionId); } return sendResponse(null); } CommandProcessor commandProcessor = PROCESSORS.get(sessionId); if (commandProcessor == null) { return sendError(HTTP_NOT_FOUND, "Unable to find command processor for " + sessionId); } try { String result = commandProcessor.doCommand(cmd, args); return sendResponse(result); } catch (SeleniumException e) { return sendError(HTTP_OK, e.getMessage()); } }

Target:
public HttpResponse execute(HttpRequest req) throws UncheckedIOException { Optional<Map<String, List<String>>> params = FormEncodedData.getData(req); String cmd = getValue("cmd", params, req); SessionId sessionId = null; if (getValue("sessionId", params, req) != null) { sessionId = new SessionId(getValue("sessionId", params, req)); } String[] args = deserializeArgs(params, req); if (cmd == null) { return sendError(HTTP_NOT_FOUND, "Unable to find cmd query parameter"); } StringBuilder printableArgs = new StringBuilder("["); Joiner.on(", ").appendTo(printableArgs, args); printableArgs.append("]"); LOG.info(String.format("Command request: %s%s on session %s", cmd, printableArgs, sessionId)); if ("getNewBrowserSession".equals(cmd)) { return startNewSession(args[0], args[1], args.length == 4 ? args[3] : ""); } else if ("testComplete".equals(cmd)) { CommandProcessor commandProcessor = PROCESSORS.get(sessionId); sessions.invalidate(sessionId); if (commandProcessor == null) { return sendError(HTTP_NOT_FOUND, "Unable to find command processor for " + sessionId); } return sendResponse(null); } CommandProcessor commandProcessor = PROCESSORS.get(sessionId); if (commandProcessor == null) { return sendError(HTTP_NOT_FOUND, "Unable to find command processor for " + sessionId); } try { String result = commandProcessor.doCommand(cmd, args); return sendResponse(result); } catch (SeleniumException e) { return sendError(HTTP_OK, e.getMessage()); } }
Source:
FeatureAttributeEntry(String attributeName, String featureName, String templateText) { this.attributeName = attributeName; this.featureName = featureName; this.templateText = templateText; this.toStringValue = new ToStringBuilder(this) .append(attributeName) .append(featureName) .append(templateText) .toString(); Handlebars handleBars = new Handlebars(); handleBars.registerHelpers(StringHelpers.class); try { this.template = handleBars.compileInline(templateText); } catch (IOException e) { LOGGER.error("Could not compile handlebars template: '" + templateText + "'. ", e); } }

Target:
FeatureAttributeEntry(String attributeName, String featureName, String templateText) { this.attributeName = attributeName; this.featureName = featureName; this.templateText = templateText; this.toStringValue = new ToStringBuilder(this) .append(attributeName) .append(featureName) .append(templateText) .toString(); Handlebars handleBars = new Handlebars(); handleBars.registerHelpers(StringHelpers.class); try { this.template = handleBars.compileInline(templateText); } catch (IOException e) { LOGGER.error("Could not compile handlebars template: {}. ", templateText, e); } }
Source:
LazyIfNumber(List<LazyNumber> lazyParams) { this.lazyParams = lazyParams; }

Target:
public LazyIfNumber(List<LazyNumber> lazyParams) { this.lazyParams = lazyParams; }
Source:
public static int getAppVersion() { return CommCareApplication.instance().getCurrentApp().getAppRecord().getVersionNumber(); }

Target:
public static int getAppVersion() { try { return CommCareApplication.instance().getCurrentApp().getAppRecord().getVersionNumber(); } catch (Exception e) { return -1; } }
Source:
public void testExecutionBuilder() { Assert.assertNotNull(builder); Path input = Paths.get("../../test-files/src_example"); Path output = getDefaultPath(); ExecutionResults results = builder.begin(Paths.get(".")) .setInput(input) .setOutput(output) .includePackage("org.windup.examples.ejb.messagedriven") .ignore("\\.class$") .execute(); Assert.assertNotNull(results.getClassifications()); Assert.assertNotNull(results.getHints()); }

Target:
public void testExecutionBuilder() { Assert.assertNotNull(builder); Assert.assertNotNull(testProvider); Path input = Paths.get("../../test-files/src_example"); Path output = getDefaultPath(); ExecutionResults results = builder.begin(Paths.get(".")) .setInput(input) .setOutput(output) .includePackage("org.windup.examples.ejb.messagedriven") .ignore("\\.class$") .execute(); Assert.assertNotNull(results.getClassifications()); Assert.assertNotNull(results.getHints()); Assert.assertTrue(results.getHints().iterator().hasNext()); Assert.assertTrue(results.getClassifications().iterator().hasNext()); }
Source:
private Durability getMincEventDurability(KeyExtent extent) { TableConfiguration conf; if (extent.isMeta() || extent.isRootTablet()) { conf = confFactory.getTableConfiguration(RootTable.ID); } else { conf = confFactory.getTableConfiguration(MetadataTable.ID); } Durability durability = DurabilityImpl.fromString(conf.get(Property.TABLE_DURABILITY)); return durability; }

Target:
private Durability getMincEventDurability(KeyExtent extent) { TableConfiguration conf; if (extent.isMeta()) { conf = confFactory.getTableConfiguration(RootTable.ID); } else { conf = confFactory.getTableConfiguration(MetadataTable.ID); } Durability durability = DurabilityImpl.fromString(conf.get(Property.TABLE_DURABILITY)); return durability; }
Source:
public void testMetricToPatterns() { PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put("meterA", meterSpecA); spec.getInclude().put(".+B", meterSpecB); spec.getInclude().put(".+C.*", meterSpecC); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); PrototypeMeasurementFilter.MeterFilterPattern meterPatternA = new PrototypeMeasurementFilter.MeterFilterPattern("meterA", meterSpecA); PrototypeMeasurementFilter.MeterFilterPattern meterPatternB = new PrototypeMeasurementFilter.MeterFilterPattern(".+B", meterSpecB); PrototypeMeasurementFilter.MeterFilterPattern meterPatternC = new PrototypeMeasurementFilter.MeterFilterPattern(".+C.*", meterSpecC); final List<PrototypeMeasurementFilter.ValueFilterPattern> emptyList = new ArrayList<PrototypeMeasurementFilter.ValueFilterPattern>(); Assert.assertEquals( filter.metricToPatterns("meterA"), new PrototypeMeasurementFilter.IncludeExcludePatterns( meterPatternA.getValues(), emptyList)); Assert.assertEquals( filter.metricToPatterns("meterBefore"), new PrototypeMeasurementFilter.IncludeExcludePatterns( emptyList, emptyList)); Assert.assertEquals( filter.metricToPatterns("meterCthing"), new PrototypeMeasurementFilter.IncludeExcludePatterns( meterPatternC.getValues(), emptyList)); }

Target:
public void testMetricToPatterns() { PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put("meterA", meterSpecA); spec.getInclude().put(".+B", meterSpecB); spec.getInclude().put(".+C.*", meterSpecC); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); PrototypeMeasurementFilter.MeterFilterPattern meterPatternA = new PrototypeMeasurementFilter.MeterFilterPattern("meterA", meterSpecA); PrototypeMeasurementFilter.MeterFilterPattern meterPatternC = new PrototypeMeasurementFilter.MeterFilterPattern(".+C.*", meterSpecC); final List<PrototypeMeasurementFilter.ValueFilterPattern> emptyList = new ArrayList<PrototypeMeasurementFilter.ValueFilterPattern>(); Assert.assertEquals( filter.metricToPatterns("meterA"), new PrototypeMeasurementFilter.IncludeExcludePatterns( meterPatternA.getValues(), emptyList)); Assert.assertEquals( filter.metricToPatterns("meterBextra"), new PrototypeMeasurementFilter.IncludeExcludePatterns( emptyList, emptyList)); Assert.assertEquals( filter.metricToPatterns("meterCthing"), new PrototypeMeasurementFilter.IncludeExcludePatterns( meterPatternC.getValues(), emptyList)); }
Source:
public int setExtraData(int index, Vector3i pos, int value) { extendExtraDataTo(index); Integer prevValue = extraData.get(index).get(pos); extraData.get(index).put(pos, value); if (prevValue == null) { return 0; } return prevValue; }

Target:
public int setExtraData(int index, Vector3i pos, int value) { Integer prevValue = getExtraDataLayer(index).put(pos, value); return prevValue == null ? 0 : prevValue; }
Source:
public void validationOfBusinessEventShouldAllowSpanCtxtInMetadata() { final EventType et = EventTypeTestBuilder.builder().name("some-event-type") .schema(basicSchema()).compatibilityMode(CompatibilityMode.COMPATIBLE).build(); et.setCategory(EventCategory.BUSINESS); final JSONObject event = new JSONObject("{\"metadata\":{" + "\"occurred_at\":\"1992-08-03T10:00:00Z\"," + "\"eid\":\"329ed3d2-8366-11e8-adc0-fa7ae01bbebc\"," + "\"span_ctx\": {" + " \"ot-tracer-spanid\": \"b268f901d5f2b865\"," + " \"ot-tracer-traceid\": \"e9435c17dabe8238\"," + " \"ot-baggage-foo\": \"bar\"" + "}}," + "\"foo\": \"bar\"}"); final Optional<ValidationError> error = EventValidation.forType(et).validate(event); assertThat(error, isAbsent()); }

Target:
public void validationOfBusinessEventShouldAllowSpanCtxtInMetadata() { final EventType et = EventTypeTestBuilder.builder().name("some-event-type") .schema(basicSchema()).compatibilityMode(CompatibilityMode.COMPATIBLE).build(); et.setCategory(EventCategory.BUSINESS); final JSONObject validEvent = new JSONObject("{\"metadata\":{" + "\"occurred_at\":\"1992-08-03T10:00:00Z\"," + "\"eid\":\"329ed3d2-8366-11e8-adc0-fa7ae01bbebc\"," + "\"span_ctx\": {" + " \"ot-tracer-spanid\": \"b268f901d5f2b865\"," + " \"ot-tracer-traceid\": \"e9435c17dabe8238\"," + " \"ot-baggage-foo\": \"bar\"" + "}}," + "\"foo\": \"bar\"}"); final Optional<ValidationError> noError = EventValidation.forType(et).validate(validEvent); assertThat(noError, isAbsent()); final JSONObject invalidEvent = new JSONObject("{\"metadata\":{" + "\"occurred_at\":\"1992-08-03T10:00:00Z\"," + "\"eid\":\"329ed3d2-8366-11e8-adc0-fa7ae01bbebc\"," + "\"span_ctx\": {" + " \"ot-tracer-spanid\": 42," + " \"ot-tracer-traceid\": \"e9435c17dabe8238\"," + " \"ot-baggage-foo\": \"bar\"" + "}}," + "\"foo\": \"bar\"}"); final Optional<ValidationError> error = EventValidation.forType(et).validate(invalidEvent); assertThat(error.get().getMessage(), equalTo("#/metadata/span_ctx/ot-tracer-spanid: expected type: String, found: Integer")); }
Source:
public void testSocket() throws Exception { Socket s = new Socket(); s.connect(server.getLocalAddress()); s.close(); assertEquals(Collections.EMPTY_MAP, tagger.getLiveDescriptors()); }

Target:
public void testSocket() throws Exception { Socket s = new Socket(); s.connect(server.getLocalAddress()); assertEquals(1, tagger.getLiveDescriptors().size()); s.close(); assertEquals(Collections.EMPTY_MAP, tagger.getLiveDescriptors()); }
Source:
public String getOpenPinName() { waitForElementByElement(pinTitle); String pinName = pinTitle.getText(); return pinName; }

Target:
public String getOpenPinName() { waitForElementByElement(pinTitle); return pinTitle.getText(); }
Source:
private boolean isSameList(@NonNull List<MediaModel> mediaList) { if (mediaList.size() != mMediaList.size()) { return false; } for (MediaModel media: mediaList) { int index = indexOfId(media.getId()); if (index == INVALID_POSITION) { return false; } MediaModel thisMedia = mMediaList.get(index); if (!thisMedia.equals(media)) { return false; } } return true; }

Target:
private boolean isSameList(@NonNull List<MediaModel> mediaList) { if (mediaList.size() != mMediaList.size()) { return false; } for (MediaModel media: mediaList) { MediaModel thisMedia = getMediaFromId(media.getId()); if (thisMedia == null || !thisMedia.equals(media)) { return false; } } return true; }
Source:
public File mergeQueryableIndex( List<QueryableIndex> indexes, final AggregatorFactory[] metricAggs, File outDir, IndexSpec indexSpec, ProgressIndicator progress ) throws IOException { List<IndexableAdapter> indexAdapteres = new ArrayList<IndexableAdapter>(); for (QueryableIndex index : indexes) { indexAdapteres.add(new QueryableIndexIndexableAdapter(index)); } return merge( indexAdapteres, metricAggs, outDir, null, indexSpec, progress ); }

Target:
public File mergeQueryableIndex( List<QueryableIndex> indexes, final AggregatorFactory[] metricAggs, File outDir, IndexSpec indexSpec, ProgressIndicator progress ) throws IOException { return merge( Lists.transform( indexes, new Function<QueryableIndex, IndexableAdapter>() { @Override public IndexableAdapter apply(final QueryableIndex input) { return new QueryableIndexIndexableAdapter(input); } } ), metricAggs, outDir, null, indexSpec, progress ); }
Source:
protected void prepareProcess(ProcessBuilder pb) { List<String> args = pb.command(); args.add("-catalogUrl"); args.add("\"" + CATALOG_URL.get() + "\""); args.add("-refreshInterval"); args.add(CATALOG_REFRESH_INTERVAL.get()); }

Target:
protected void prepareProcess(ProcessBuilder pb) { List<String> args = pb.command(); args.add("-catalogUrl"); args.add(CATALOG_URL.get()); args.add("-refreshInterval"); args.add(CATALOG_REFRESH_INTERVAL.get()); }
Source:
private void rewriteWhereStat(ListIterator<Statement> stats) throws InvalidSpecCompileException { Statement stat = stats.next(); BinaryExpression binExpr = AstUtil.getExpression(stat, BinaryExpression.class); if (binExpr != null && binExpr.getClass() == BinaryExpression.class) { int type = binExpr.getOperation().getType(); if (type == Types.LEFT_SHIFT) { Expression leftExpr = binExpr.getLeftExpression(); if (leftExpr instanceof VariableExpression) rewriteSimpleParameterization(binExpr, stat); else if (leftExpr instanceof ListExpression) rewriteMultiParameterization(binExpr, stat); else notAParameterization(stat); } else if (type == Types.ASSIGN) rewriteDerivedParameterization(binExpr, stat); else if (getOrExpression(binExpr) != null) { stats.previous(); rewriteTableLikeParameterization(stats); } else notAParameterization(stat); } else if (!AstUtil.isDataTableSeparator(AstUtil.getExpression(stat, Expression.class))) { notAParameterization(stat); } }

Target:
private void rewriteWhereStat(ListIterator<Statement> stats) throws InvalidSpecCompileException { Statement stat = stats.next(); BinaryExpression binExpr = AstUtil.getExpression(stat, BinaryExpression.class); if (binExpr != null && binExpr.getClass() == BinaryExpression.class) { int type = binExpr.getOperation().getType(); if (type == Types.LEFT_SHIFT) { Expression leftExpr = binExpr.getLeftExpression(); if (leftExpr instanceof VariableExpression) rewriteSimpleParameterization(binExpr, stat); else if (leftExpr instanceof ListExpression) rewriteMultiParameterization(binExpr, stat); else notAParameterization(stat); } else if (type == Types.ASSIGN) rewriteDerivedParameterization(binExpr, stat); else if (getOrExpression(binExpr) != null) { stats.previous(); rewriteTableLikeParameterization(stats); } else notAParameterization(stat); } else if (!isDataTableSeparator(stat)) { notAParameterization(stat); } }
Source:
public void testLogEventWithMarker() { Marker marker = SecureLogging.SECURITY_SUCCESS; String logmsg = "security log message"; this.loggerLogback.info(marker, logmsg); verify(this.mockAppender).doAppend(this.captorLoggingEvent.capture()); final LoggingEvent loggingEvent = this.captorLoggingEvent.getValue(); assertThat(loggingEvent.getLevel()).isEqualTo(Level.INFO); String layoutMessage = this.encoder.getLayout().doLayout(loggingEvent); System.out.println("test(): layoutMessage = " + layoutMessage); assertTrue("formatted log message must contain the original message.", layoutMessage.contains(logmsg)); assertTrue("formatted log message must contain the name of its marker.", layoutMessage.contains(marker.getName())); }

Target:
public void testLogEventWithMarker() { Marker marker = SecureLogging.SECURITY_SUCCESS; String logmsg = "security log message"; LOG.info(marker, logmsg); final LoggingEvent loggingEvent = getLastLogEvent(); assertThat(loggingEvent.getLevel()).isEqualTo(Level.INFO); String layoutMessage = this.encoder.getLayout().doLayout(loggingEvent); assertThat(layoutMessage.contains(logmsg)).as("formatted log message contains original message.").isTrue(); assertThat(layoutMessage.contains(marker.getName())).as("log message contains name of marker.").isTrue(); }
Source:
private void readOrthogonalPlanes() throws Exception { ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME); if (debug) { root.setLevel(Level.DEBUG); } else { root.setLevel(Level.INFO); } ImageReader reader = this.initialiseReader(this.input); reader.setSeries(0); OMETiffWriter writer = this.initialiseWriter(this.output, reader); int index; writer.setSeries(0); for (int y = 0; y < reader.getSizeY(); y++) { ByteBuffer bufferXZ = ByteBuffer.allocate( (int) (0.125 * reader.getBitsPerPixel()) * reader.getSizeX() * reader.getSizeZ()); for (int z = 0; z < reader.getSizeZ(); z++) { index = reader.getIndex(z, 0, 0); byte[] line = reader.openBytes( index, 0, y, reader.getSizeX(), 1); bufferXZ.put(line); } log.info("y: {}, {}", y, bufferXZ.array().length); writer.saveBytes(y, bufferXZ.array()); } writer.setSeries(1); for (int x = 0; x < reader.getSizeX(); x++) { ByteBuffer bufferYZ = ByteBuffer.allocate( (int) (0.125 * reader.getBitsPerPixel()) * reader.getSizeY() * reader.getSizeZ()); for (int z = 0; z < reader.getSizeZ(); z++) { index = reader.getIndex(z, 0, 0); byte[] line = reader.openBytes( index, x, 0, 1, reader.getSizeY()); bufferYZ.put(line); } log.info("x: {}, {}", x, bufferYZ.array().length); writer.saveBytes(x, bufferYZ.array()); } reader.close(); writer.close(); }

Target:
private void readOrthogonalPlanes() throws Exception { ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME); if (debug) { root.setLevel(Level.DEBUG); } else { root.setLevel(Level.INFO); } ImageReader reader = this.initialiseReader(this.input); reader.setSeries(0); OMETiffWriter writer = this.initialiseWriter(this.output, reader); int index; writer.setSeries(0); for (int y = 0; y < reader.getSizeY(); y++) { ByteBuffer bufferXZ = ByteBuffer.allocate( (int) (0.125 * reader.getBitsPerPixel()) * reader.getSizeX() * reader.getSizeZ()); for (int z = 0; z < reader.getSizeZ(); z++) { index = reader.getIndex(z, 0, 0); byte[] line = reader.openBytes( index, 0, y, reader.getSizeX(), 1); bufferXZ.put(line); } log.debug("y: {}, {}", y, bufferXZ.array().length); writer.saveBytes(y, bufferXZ.array()); } writer.setSeries(1); for (int x = 0; x < reader.getSizeX(); x++) { ByteBuffer bufferYZ = ByteBuffer.allocate( (int) (0.125 * reader.getBitsPerPixel()) * reader.getSizeY() * reader.getSizeZ()); for (int z = 0; z < reader.getSizeZ(); z++) { index = reader.getIndex(z, 0, 0); byte[] line = reader.openBytes( index, x, 0, 1, reader.getSizeY()); bufferYZ.put(line); } log.debug("x: {}, {}", x, bufferYZ.array().length); writer.saveBytes(x, bufferYZ.array()); } reader.close(); writer.close(); }
Source:
String getServerActualContextId(final String planContextId) { return serverEvalIdToCtx.containsKey(planContextId) ? serverEvalIdToCtx.get(planContextId).getId() : planContextId; }

Target:
String getServerActualContextId(final String planContextId) { return ctxIdToAddedServerCtx.containsKey(planContextId) ? ctxIdToAddedServerCtx.get(planContextId).getId() : planContextId; }
Source:
public void showFAQ(Activity activity, Tag origin) { if (origin == null) { origin = Tag.ORIGIN_UNKNOWN; } Map<String, Object> properties = new HashMap<String, Object>(); properties.put(HELPSHIFT_SCREEN_KEY, "faq"); properties.put(HELPSHIFT_ORIGIN_KEY, origin.toString()); AnalyticsTracker.track(Stat.SUPPORT_OPENED_HELPSHIFT_SCREEN, properties); addPlanTags(); addTags(new Tag[]{origin}); HashMap config = getHelpshiftConfig(activity); Support.showFAQs(activity, config); }

Target:
public void showFAQ(Activity activity, Tag origin) { if (origin == null) { origin = Tag.ORIGIN_UNKNOWN; } Map<String, Object> properties = new HashMap<String, Object>(); properties.put(HELPSHIFT_SCREEN_KEY, "faq"); properties.put(HELPSHIFT_ORIGIN_KEY, origin.toString()); AnalyticsTracker.track(Stat.SUPPORT_OPENED_HELPSHIFT_SCREEN, properties); addTags(new Tag[]{origin}); HashMap config = getHelpshiftConfig(activity); Support.showFAQs(activity, config); }
Source:
protected Long getAgent() { Long agentId = getRawAgentId(); if (agentId != null) { log.error("getAgent(): [{}]", agentId); return agentId; } String type = ApiContext.getContext().getApiRequest().getSchemaFactory().getSchemaName(Agent.class); ResourceManager rm = getLocator().getResourceManagerByType(type); List<?> list = rm.list(type, null, Pagination.limit(2)); if (list.size() != 1) { throw new ValidationErrorException(ValidationErrorCodes.MISSING_REQUIRED, "agentId"); } Object agent = list.get(0); if (!(agent instanceof Agent) || !STATES.contains(((Agent) agent).getState())) throw new ValidationErrorException(ValidationErrorCodes.MISSING_REQUIRED, "agentId"); return ((Agent) agent).getId(); }

Target:
protected Long getAgent() { Long agentId = getRawAgentId(); if (agentId != null) { return agentId; } String type = ApiContext.getContext().getApiRequest().getSchemaFactory().getSchemaName(Agent.class); ResourceManager rm = getLocator().getResourceManagerByType(type); List<?> list = rm.list(type, null, Pagination.limit(2)); if (list.size() > 0) { if (list.size() > 1) { throw new ValidationErrorException(ValidationErrorCodes.MISSING_REQUIRED, "agentId"); } Object agent = list.get(0); if ((agent instanceof Agent) || STATES.contains(((Agent) agent).getState())) { return ((Agent) agent).getId(); } } return null; }
Source:
public Optional<URL> findFullText(BibEntry entry) throws IOException { Objects.requireNonNull(entry); Optional<DOI> doi = entry.getDOI(); if (doi.isPresent()) { String id; try { id = getId(doi.get().getDOI()); } catch (FileNotFoundException e) { return Optional.empty(); } String pdfRequest = PDF_URL + id; int code = Unirest.get(pdfRequest).asJson().getStatus(); if (code == 200) { LOGGER.info("Fulltext PDF found @ APS."); return Optional.of(new URL(pdfRequest)); } } return Optional.empty(); }

Target:
public Optional<URL> findFullText(BibEntry entry) throws IOException { Objects.requireNonNull(entry); return entry.getDOI().map(doi -> { String id; try { id = getId(doi.getDOI()); } catch (FileNotFoundException e) { return null; } catch (IOException e) { throw new UncheckedIOException(e); } String pdfRequest = PDF_URL + id; int code = Unirest.get(pdfRequest).asJson().getStatus(); if (code == 200) { LOGGER.info("Fulltext PDF found @ APS."); try { return new URL(pdfRequest); } catch (MalformedURLException e) { LOGGER.info("APS returned malformed URL, cannot find PDF."); return null; } } else { return null; } }); }
Source:
public void execute() { BasePanel basePanel = jabRefFrame.getCurrentBasePanel(); List<BibEntry> selectedEntries = basePanel.getSelectedEntries(); if (selectedEntries.size() != 2) { dialogService.showInformationDialogAndWait( Localization.lang("Merge entries"), Localization.lang("You have to choose exactly two entries to merge.")); return; } BibEntry one = selectedEntries.get(0); BibEntry two = selectedEntries.get(1); MergeEntriesDialog dlg = new MergeEntriesDialog(one, two, basePanel.getBibDatabaseContext().getMode()); dlg.setTitle(Localization.lang("Merge entries")); Optional<BibEntry> mergedEntry = dlg.showAndWait(); if (mergedEntry.isPresent()) { basePanel.insertEntry(mergedEntry.get()); NamedCompound ce = new NamedCompound(Localization.lang("Merge entries")); ce.addEdit(new UndoableInsertEntry(basePanel.getDatabase(), mergedEntry.get())); List<BibEntry> entriesToRemove = new ArrayList<>(); entriesToRemove.add(one); entriesToRemove.add(two); ce.addEdit(new UndoableRemoveEntries(basePanel.getDatabase(), entriesToRemove)); basePanel.getDatabase().removeEntries(entriesToRemove); ce.end(); basePanel.getUndoManager().addEdit(ce); dialogService.notify(Localization.lang("Merged entries")); } else { dialogService.notify(Localization.lang("Canceled merging entries")); } }

Target:
public void execute() { BasePanel basePanel = jabRefFrame.getCurrentBasePanel(); List<BibEntry> selectedEntries = basePanel.getSelectedEntries(); if (selectedEntries.size() != 2) { dialogService.showInformationDialogAndWait( Localization.lang("Merge entries"), Localization.lang("You have to choose exactly two entries to merge.")); return; } BibEntry one = selectedEntries.get(0); BibEntry two = selectedEntries.get(1); MergeEntriesDialog dlg = new MergeEntriesDialog(one, two, basePanel.getBibDatabaseContext().getMode()); dlg.setTitle(Localization.lang("Merge entries")); Optional<BibEntry> mergedEntry = dlg.showAndWait(); if (mergedEntry.isPresent()) { basePanel.insertEntry(mergedEntry.get()); NamedCompound ce = new NamedCompound(Localization.lang("Merge entries")); ce.addEdit(new UndoableInsertEntry(basePanel.getDatabase(), mergedEntry.get())); List<BibEntry> entriesToRemove = Arrays.asList(one, two); ce.addEdit(new UndoableRemoveEntries(basePanel.getDatabase(), entriesToRemove)); basePanel.getDatabase().removeEntries(entriesToRemove); ce.end(); basePanel.getUndoManager().addEdit(ce); dialogService.notify(Localization.lang("Merged entries")); } else { dialogService.notify(Localization.lang("Canceled merging entries")); } }
Source:
protected String[] getAllProtocols() { return WolfSSL.getProtocolsMask(ssl.getOptions()); }

Target:
protected String[] getAllProtocols() { if(ssl != null) return WolfSSL.getProtocolsMask(ssl.getOptions()); else return WolfSSL.getProtocols(); }
Source:
public Future<File> submit(Topology app, Map<String, Object> config) throws Exception { if (config == null) config = new HashMap<>(); if (!config.containsKey(ContextProperties.TOOLKIT_DIR)) { config.put(ContextProperties.TOOLKIT_DIR, Files .createTempDirectory(Paths.get(""), "tk").toAbsolutePath().toString()); } File toolkitRoot = super.submit(app, config).get(); Path zipOutPath = Paths.get(toolkitRoot.getAbsolutePath() + ".zip"); pack(toolkitRoot.toPath(), zipOutPath); return new CompletedFuture<File>(zipOutPath.toFile()); }

Target:
public Future<File> submit(Topology app, Map<String, Object> config) throws Exception { File toolkitRoot = super.submit(app, config).get(); Path zipOutPath = pack(toolkitRoot.toPath()); JSONObject jso = new OrderedJSONObject(); addConfigToJSON(jso, config); return deleteToolkitAndProduceCompletedFuture(toolkitRoot, jso, zipOutPath); }
Source:
private List<CellTsPairInfo> loadNextPage() { try (ConnectionSupplier conns = new ConnectionSupplier(connectionPool); AgnosticLightResultSet resultSet = selectNextPage(conns)) { List<CellTsPairInfo> ret = new ArrayList<>(); for (AgnosticLightResultRow row : resultSet) { Preconditions.checkState(AgnosticLightResultRowImpl.class.isInstance(row), "Expected row to be of type AgnosticLightResultRowImpl, but found unknown type : " + row.getClass().toString()); byte[] rowName = row.getBytes("row_name"); byte[] colName = row.getBytes("col_name"); if (request.shouldCheckIfLatestValueIsEmpty()) { long[] sortedTimestamps = castAndSortTimestamps( (Object[]) ((AgnosticLightResultRowImpl) row).getArray("timestamps")); boolean isLatestValEmpty = row.getBoolean("latest_val_empty"); for (int i = 0; i < sortedTimestamps.length - 1; ++i) { ret.add(new CellTsPairInfo(rowName, colName, sortedTimestamps[i], false)); } ret.add(new CellTsPairInfo( rowName, colName, sortedTimestamps[sortedTimestamps.length - 1], isLatestValEmpty)); } else { long ts = row.getLong("ts"); ret.add(new CellTsPairInfo(rowName, colName, ts, false)); } } return ret; } }

Target:
private List<CellTsPairInfo> loadNextPage() { try (ConnectionSupplier conns = new ConnectionSupplier(connectionPool); AgnosticLightResultSet resultSet = selectNextPage(conns)) { List<CellTsPairInfo> ret = new ArrayList<>(); for (AgnosticLightResultRow row : resultSet) { Preconditions.checkState(AgnosticLightResultRowImpl.class.isInstance(row), "Expected row to be of type AgnosticLightResultRowImpl, but found unknown type %s", row.getClass().toString()); byte[] rowName = row.getBytes("row_name"); byte[] colName = row.getBytes("col_name"); if (request.shouldCheckIfLatestValueIsEmpty()) { long[] sortedTimestamps = castAndSortTimestamps( (Object[]) ((AgnosticLightResultRowImpl) row).getArray("timestamps")); boolean isLatestValEmpty = row.getBoolean("latest_val_empty"); for (int i = 0; i < sortedTimestamps.length - 1; ++i) { ret.add(new CellTsPairInfo(rowName, colName, sortedTimestamps[i], false)); } ret.add(new CellTsPairInfo( rowName, colName, sortedTimestamps[sortedTimestamps.length - 1], isLatestValEmpty)); } else { long ts = row.getLong("ts"); ret.add(new CellTsPairInfo(rowName, colName, ts, false)); } } return ret; } }
Source:
public void close() throws IOException { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Closing backingStream and response {}", this.backingStream, httpResponse); } if (backingStream instanceof EofSensorInputStream) { ((EofSensorInputStream) backingStream).close(); closeHttpResponse(); } else { try { if (backingStream != null) { backingStream.close(); } } catch (IOException e) { closeHttpResponse(); } finally { closeHttpResponse(); } } }

Target:
public void close() throws IOException { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Closing backingStream and response {}", this.backingStream, httpResponse); } if (backingStream instanceof EofSensorInputStream) { ((EofSensorInputStream) backingStream).close(); closeHttpResponse(); } else { try { if (backingStream != null) { backingStream.close(); } } catch (IOException e) { MantaIOException mio = new MantaResourceCloseException(e); LOGGER.error("Unable to close backing stream", mio); } finally { closeHttpResponse(); } } }
Source:
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mode.setTag(TAB_ACTION_MODE_TAG); parentActivity.getContext().findViewById(R.id.action_mode_bar).setClickable(true); return false; }

Target:
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mode.setTag(TAB_ACTION_MODE_TAG); getActionBar().setClickable(true); return false; }
Source:
void hideLoadingPopup() { @SuppressWarnings("GwtToHtmlReferences") final Element e = RootPanel.get( "loading" ).getElement(); new Animation() { @Override protected void onUpdate( double progress ) { e.getStyle().setOpacity( 1.0 - progress ); } @Override protected void onComplete() { e.getStyle().setVisibility( Style.Visibility.HIDDEN ); } }.run( 500 ); }

Target:
public void hideLoadingPopup() { @SuppressWarnings("GwtToHtmlReferences") final Element e = RootPanel.get( "loading" ).getElement(); new Animation() { @Override protected void onUpdate( double progress ) { e.getStyle().setOpacity( 1.0 - progress ); } @Override protected void onComplete() { e.getStyle().setVisibility( Style.Visibility.HIDDEN ); } }.run( 500 ); }
Source:
public void catchesExceptionThrownByResponse() throws Exception { final Take take = request -> new RsOf( () -> new RsEmpty().head(), () -> { throw new RsForward("/b"); } ); MatcherAssert.assertThat( new RsPrint( new TkForward(take).act(new RqFake()) ).print(), Matchers.startsWith("HTTP/1.1 303") ); }

Target:
public void catchesExceptionThrownByResponse() throws Exception { final Take take = request -> new ResponseOf( () -> new RsEmpty().head(), () -> { throw new RsForward("/b"); } ); MatcherAssert.assertThat( new RsPrint( new TkForward(take).act(new RqFake()) ).print(), Matchers.startsWith("HTTP/1.1 303") ); }