auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCaseWithBoundaryTimerFiredAtStage() throws InterruptedException { ByteArrayOutputStream outContent = new ByteArrayOutputStream(); PrintStream originalOut = System.out; System.setOut(new PrintStream(outContent)); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), "CaseWithBoundaryTimerStage"); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); Thread.sleep(3000); try { Collection<CaseStageInstance> stages = caseRuntimeDataService.getCaseInstanceStages(caseId, false, null); assertThat(stages).isNotNull().hasSize(2); Iterator<CaseStageInstance> iterator = stages.iterator(); CaseStageInstance stage1 = iterator.next(); assertThat(stage1.getName()).isEqualTo("Stage 1"); assertThat(stage1.getStatus()).isEqualTo(StageStatus.Completed); CaseStageInstance stage2 = iterator.next(); assertThat(stage2.getName()).isEqualTo("Stage 2"); assertThat(stage2.getStatus()).isEqualTo(StageStatus.Active); assertThat(outContent.toString(), containsString("timer on stage")); assertThat(outContent.toString(), containsString("timer on task")); caseService.cancelCase(caseId); CaseInstance instance = caseService.getCaseInstance(caseId); assertThat(instance.getStatus()).isEqualTo(CaseStatus.CANCELLED.getId()); caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } System.setOut(originalOut); } }

Target:
public void testCaseWithBoundaryTimerFiredAtStage() throws InterruptedException { String caseId = caseService.startCase(deploymentUnit.getIdentifier(), "CaseWithBoundaryTimerStage"); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); ((NodeLeftCountDownProcessEventListener) CountDownListenerFactory.getExisting(getClass().getSimpleName() + "2")).waitTillCompleted(); try { Collection<CaseStageInstance> stages = caseRuntimeDataService.getCaseInstanceStages(caseId, false, null); assertThat(stages).isNotNull().hasSize(2); Iterator<CaseStageInstance> iterator = stages.iterator(); CaseStageInstance stage1 = iterator.next(); assertThat(stage1.getName()).isEqualTo("Stage 1"); assertThat(stage1.getStatus()).isEqualTo(StageStatus.Completed); CaseStageInstance stage2 = iterator.next(); assertThat(stage2.getName()).isEqualTo("Stage 2"); assertThat(stage2.getStatus()).isEqualTo(StageStatus.Active); caseService.cancelCase(caseId); CaseInstance instance = caseService.getCaseInstance(caseId); assertThat(instance.getStatus()).isEqualTo(CaseStatus.CANCELLED.getId()); caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } } }
Source:
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException { if (location == null || clazz == null) { throw new IllegalArgumentException("Location or entity class cannot be null"); } Entity entity = null; Class<? extends GlowEntity> entityClass = ENTITY_REGISTRY.get(clazz); try { entity = entityClass.getConstructor(Location.class).newInstance(location); } catch (Exception e) { e.printStackTrace(); } if (entity != null) { return (T) entity; } throw new IllegalArgumentException("Cannot spawn an entity for " + clazz.getName()); }

Target:
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException { if (location == null || clazz == null) { throw new IllegalArgumentException("Location or entity class cannot be null"); } Entity entity = null; Class<? extends GlowEntity> entityClass = ENTITY_REGISTRY.get(clazz); try { entity = entityClass.getConstructor(Location.class).newInstance(location); } catch (Exception e) { throw new IllegalArgumentException("Cannot spawn an entity for " + clazz.getName(), e); } return (T) entity; }
Source:
protected boolean checkIfCpusSameManufacture(Cluster group) { if (!cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), getParameters().getCluster().getCompatibilityVersion())) { return true; } return cpuFlagsManagerHandler.checkIfCpusSameManufacture(group.getCpuName(), getCluster().getCpuName(), getCluster().getCompatibilityVersion()); }

Target:
protected boolean checkIfCpusSameManufacture(Cluster group) { if (!cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), getParameters().getCluster().getCompatibilityVersion()) || !cpuFlagsManagerHandler.checkIfCpusExist(getCluster().getCpuName(), getParameters().getCluster().getCompatibilityVersion())) { return true; } return cpuFlagsManagerHandler.checkIfCpusSameManufacture(group.getCpuName(), getCluster().getCpuName(), getCluster().getCompatibilityVersion()); }
Source:
public static void printStateGraph(PrintWriter pw, boolean breakStateName) throws XmppStringprepException { ModularXmppClientToServerConnectionConfiguration.Builder configurationBuilder = ModularXmppClientToServerConnectionConfiguration.builder() .setUsernameAndPassword("user", "password") .setXmppDomain("example.org") .removeModule(XmppWebsocketTransportModuleDescriptor.class); ModularXmppClientToServerConnectionConfiguration configuration = configurationBuilder.build(); configuration.printStateGraphInDotFormat(pw, breakStateName); pw.flush(); }

Target:
public static void printStateGraph(PrintWriter pw, boolean breakStateName) throws XmppStringprepException { ModularXmppClientToServerConnectionConfiguration.Builder configurationBuilder = ModularXmppClientToServerConnectionConfiguration.builder() .setUsernameAndPassword("user", "password") .setXmppDomain("example.org"); ModularXmppClientToServerConnectionConfiguration configuration = configurationBuilder.build(); configuration.printStateGraphInDotFormat(pw, breakStateName); pw.flush(); }
Source:
public void handleEvent(ITmfEvent event, Map<String, TmfXmlTest> transitionMap) { if (!validatePreconditions(event, transitionMap)) { return; } for (TmfXmlScenario scenario : fNewScenariosList) { fActiveScenariosList.add(scenario); } for (Iterator<TmfXmlScenario> currentItr = fActiveScenariosList.iterator(); currentItr.hasNext();) { TmfXmlScenario scenario = currentItr.next(); if (!scenario.isActive()) { currentItr.remove(); } else { handleScenario(scenario, event); } } fNewScenariosList.clear(); }

Target:
public void handleEvent(ITmfEvent event, Map<String, TmfXmlTest> transitionMap) { if (!validatePreconditions(event, transitionMap)) { return; } for (Iterator<TmfXmlScenario> currentItr = fActiveScenariosList.iterator(); currentItr.hasNext();) { TmfXmlScenario scenario = currentItr.next(); if (!scenario.isActive()) { currentItr.remove(); } else { handleScenario(scenario, event); } } }
Source:
public void setWorld(World p_70029_1_) { Log.warn("Ender IO Farming station fake player is being transfered to world '" + p_70029_1_ + "'. Trying to reject transfer. Call stack follows:"); (new Exception()).printStackTrace(); }

Target:
public void setWorld(World p_70029_1_) { Log.warn("Ender IO Farming station fake player is being transfered to world '" + p_70029_1_ + "'. Trying to reject transfer. Call stack follows:"); Thread.dumpStack(); }
Source:
private static boolean mayHaveValidDate(final String value) { List<String> matches = fetchDateStrings(value); if (!matches.isEmpty()) { try { DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-MM-dd"); matches.forEach(dateTimeFormat::parseStrict); } catch (Exception e) { return false; } } return true; }

Target:
private static boolean mayHaveValidDate(final String value) { List<String> matches = fetchDateStrings(value); if (!matches.isEmpty()) { try { DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-MM-dd"); matches.forEach(dateTimeFormat::parseStrict); } catch (IllegalArgumentException e) { return false; } } return true; }
Source:
public static String getTracingInfoFormat(HttpRequest request) { return getHeaderString(request, RESTEasyTracing.HEADER_ACCEPT_FORMAT); }

Target:
protected static String getTracingInfoFormat(HttpRequest request) { return getHeaderString(request, RESTEasyTracing.HEADER_ACCEPT_FORMAT); }
Source:
public CloseableIterator<InputRow> read() throws IOException { final CloseableIterator<T> intermediateRowIterator = intermediateRowIterator(); return new CloseableIterator<InputRow>() { Iterator<InputRow> rows = null; @Override public boolean hasNext() { if (rows == null || !rows.hasNext()) { if (!intermediateRowIterator.hasNext()) { return false; } final T row = intermediateRowIterator.next(); try { rows = parseInputRows(row).iterator(); } catch (IOException e) { throw new ParseException(e, "Unable to parse row [%s]", row); } } return rows.hasNext() || intermediateRowIterator.hasNext(); } @Override public InputRow next() { if (!hasNext()) { throw new NoSuchElementException(); } return rows.next(); } @Override public void close() throws IOException { intermediateRowIterator.close(); } }; }

Target:
public CloseableIterator<InputRow> read() throws IOException { final CloseableIterator<T> intermediateRowIterator = intermediateRowIterator(); return new CloseableIterator<InputRow>() { Iterator<InputRow> rows = null; @Override public boolean hasNext() { if (rows == null || !rows.hasNext()) { if (!intermediateRowIterator.hasNext()) { return false; } final T row = intermediateRowIterator.next(); try { rows = parseInputRows(row).iterator(); } catch (IOException e) { rows = new ExceptionThrowingIterator(new ParseException(e, "Unable to parse row [%s]", row)); } catch (ParseException e) { rows = new ExceptionThrowingIterator(e); } } return true; } @Override public InputRow next() { if (!hasNext()) { throw new NoSuchElementException(); } return rows.next(); } @Override public void close() throws IOException { intermediateRowIterator.close(); } }; }
Source:
public KeyMaterialFactory newKeyMaterialFactory(final URL endpoint, @Nonnull VirtualChannel target) throws InterruptedException, IOException { target.call(new Callable<Void, IOException>() { @Override public Void call() throws IOException { JSONObject json; JSONObject auths; synchronized (DockerRegistryToken.class) { File config = new File(System.getProperty("user.home"), ".docker/config.json"); if (config.exists()) { json = JSONObject.fromObject(FileUtils.readFileToString(config, "UTF-8")); auths = json.getJSONObject("auths"); } else { File dockercfg = new File(System.getProperty("user.home"), ".dockercfg"); config = dockercfg; if (dockercfg.exists()) { auths = json = JSONObject.fromObject(FileUtils.readFileToString(dockercfg, "UTF-8")); } else { auths = json = new JSONObject(); } } auths.put(endpoint.toString(), new JSONObject() .accumulate("auth", getToken()) .accumulate("email", getEmail())); FileUtils.writeStringToFile(config, json.toString(2), "UTF-8"); } return null; } }); return KeyMaterialFactory.NULL; }

Target:
public KeyMaterialFactory newKeyMaterialFactory(final URL endpoint, @Nonnull VirtualChannel target) throws InterruptedException, IOException { target.call(new Callable<Void, IOException>() { @Override public Void call() throws IOException { JSONObject json; JSONObject auths; synchronized (DockerRegistryToken.class) { File config = new File(System.getProperty("user.home"), ".docker/config.json"); if (config.exists()) { json = JSONObject.fromObject(FileUtils.readFileToString(config, "UTF-8")); auths = json.getJSONObject("auths"); } else { config = new File(System.getProperty("user.home"), ".dockercfg"); if (config.exists()) { auths = json = JSONObject.fromObject(FileUtils.readFileToString(config, "UTF-8")); } else { auths = json = new JSONObject(); } } auths.put(endpoint.toString(), new JSONObject() .accumulate("auth", getToken()) .accumulate("email", getEmail())); FileUtils.writeStringToFile(config, json.toString(2), "UTF-8"); } return null; } }); return KeyMaterialFactory.NULL; }
Source:
public MISTCepQuery<T> build() { return new MISTCepQuery(groupId, cepInput, cepEventSequence, cepQualifier, windowTime, cepAction); }

Target:
public MISTCepQuery<T> build() { if (groupId == null || cepInput == null || cepEventSequence == null || cepQualifier == null || windowTime < 0 || cepAction == null) { throw new IllegalStateException( "One of group id, input, event sequence, qualifier, window, or action is not set!"); } return new MISTCepQuery(groupId, cepInput, cepEventSequence, cepQualifier, windowTime, cepAction); }
Source:
public boolean process(AudioEvent audioEvent) { currentTime = audioEvent.getTimeStamp(); if (transitionTime == 0) { return true; } if (!hasTransitioned && currentTime > transitionTime) { System.out.println(transitionTime); System.out.println("what"); new Thread(transition).start(); hasTransitioned = true; } return true; }

Target:
public boolean process(AudioEvent audioEvent) { currentTime = audioEvent.getTimeStamp(); if (transitionTime == 0) { return true; } if (!hasTransitioned && currentTime > transitionTime) { new Thread(transition).start(); hasTransitioned = true; } return true; }
Source:
private boolean isAPSJournal(BibEntry entry, String doiAsString) { if (!entry.getType().equals(StandardEntryType.Article)) { return false; } Pattern apsJournalSuffixPattern = Pattern.compile("([\\w]+\\.)([\\w]+\\.)([\\w]+)"); String suffix = doiAsString.substring(doiAsString.lastIndexOf('/') + 1); return apsJournalSuffixPattern.matcher(suffix).matches(); }

Target:
private boolean isAPSJournal(BibEntry entry, String doiAsString) { if (!entry.getType().equals(StandardEntryType.Article)) { return false; } String suffix = doiAsString.substring(doiAsString.lastIndexOf('/') + 1); String organizationId = doiAsString.substring(doiAsString.indexOf('.') + 1, doiAsString.indexOf('/')); return organizationId.equals(APS_JOURNAL_ORG_DOI_ID) && APS_SUFFIX_PATTERN.matcher(suffix).matches(); }
Source:
private int[][] calculateResponseFrequency(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails fqd) { int[][] responseFrequency = new int[fqd.numOfRubricSubQuestions][]; int totalNumberPosition = fqd.numOfRubricChoices; for (int i = 0; i < responseFrequency.length; i++) { responseFrequency[i] = new int[fqd.numOfRubricChoices + 1]; for (int j = 0; j < responseFrequency[i].length; j++) { responseFrequency[i][j] = 0; } } for (FeedbackResponseAttributes response : responses) { FeedbackRubricResponseDetails frd = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < fqd.numOfRubricSubQuestions; i++) { int chosenChoice = frd.getAnswer(i); if (chosenChoice != -1) { responseFrequency[i][chosenChoice] += 1; responseFrequency[i][totalNumberPosition] += 1; } } } return responseFrequency; }

Target:
private int[][] calculateResponseFrequency(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails fqd) { int[][] responseFrequency = new int[fqd.numOfRubricSubQuestions][fqd.numOfRubricChoices + 1]; int responseTotalIndex = fqd.numOfRubricChoices; for (FeedbackResponseAttributes response : responses) { FeedbackRubricResponseDetails frd = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < fqd.numOfRubricSubQuestions; i++) { int chosenChoice = frd.getAnswer(i); if (chosenChoice != -1) { responseFrequency[i][chosenChoice] += 1; responseFrequency[i][responseTotalIndex] += 1; } } } return responseFrequency; }
Source:
private ServerConfiguration toServerConfiguration(Node node) { NodeContext nodeContext = nodeContextSupplier.get(); return new ServerConfiguration() { @Override public InetSocketAddress getTsaPort() { return InetSocketAddress.createUnresolved(substitutor.substitute(node.getNodeBindAddress()), node.getNodePort()); } @Override public InetSocketAddress getGroupPort() { return InetSocketAddress.createUnresolved(substitutor.substitute(node.getNodeGroupBindAddress()), node.getNodeGroupPort()); } @Override public String getHost() { return node.getNodeHostname(); } @Override public String getName() { return node.getNodeName(); } @Override public int getClientReconnectWindow() { return nodeContext.getCluster().getClientReconnectWindow().getExactQuantity(TimeUnit.SECONDS).intValueExact(); } public void setClientReconnectWindow(int value) { nodeContext.getCluster().setClientReconnectWindow(value, TimeUnit.SECONDS); } @Override public File getLogsLocation() { String sanitizedNodeName = node.getNodeName().replace(":", "-"); return (unConfigured) ? null : substitutor.substitute(pathResolver.resolve(node.getNodeLogDir().resolve(sanitizedNodeName))).toFile(); } @Override public String toString() { return node.getNodeName() + "@" + node.getNodeAddress(); } }; }

Target:
private ServerConfiguration toServerConfiguration(Node node) { NodeContext nodeContext = nodeContextSupplier.get(); return new ServerConfiguration() { @Override public InetSocketAddress getTsaPort() { return InetSocketAddress.createUnresolved(substitutor.substitute(node.getNodeBindAddress()), node.getNodePort()); } @Override public InetSocketAddress getGroupPort() { return InetSocketAddress.createUnresolved(substitutor.substitute(node.getNodeGroupBindAddress()), node.getNodeGroupPort()); } @Override public String getHost() { return node.getNodeHostname(); } @Override public String getName() { return node.getNodeName(); } @Override public int getClientReconnectWindow() { return nodeContext.getCluster().getClientReconnectWindow().getExactQuantity(TimeUnit.SECONDS).intValueExact(); } @Override public File getLogsLocation() { String sanitizedNodeName = node.getNodeName().replace(":", "-"); return (unConfigured) ? null : substitutor.substitute(pathResolver.resolve(node.getNodeLogDir().resolve(sanitizedNodeName))).toFile(); } @Override public String toString() { return node.getNodeName() + "@" + node.getNodeAddress(); } }; }
Source:
public Builder mergeFrom(io.netty.example.worldclock.WorldClockProtocol.LocalTime other) { if (other == io.netty.example.worldclock.WorldClockProtocol.LocalTime.getDefaultInstance()) { return this; } if (other.hasYear()) { setYear(other.getYear()); } if (other.hasMonth()) { setMonth(other.getMonth()); } if (other.hasDayOfMonth()) { setDayOfMonth(other.getDayOfMonth()); } if (other.hasDayOfWeek()) { setDayOfWeek(other.getDayOfWeek()); } if (other.hasHour()) { setHour(other.getHour()); } if (other.hasMinute()) { setMinute(other.getMinute()); } if (other.hasSecond()) { setSecond(other.getSecond()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }

Target:
public Builder mergeFrom(io.netty.example.worldclock.WorldClockProtocol.LocalTime other) { if (other == io.netty.example.worldclock.WorldClockProtocol.LocalTime.getDefaultInstance()) return this; if (other.hasYear()) { setYear(other.getYear()); } if (other.hasMonth()) { setMonth(other.getMonth()); } if (other.hasDayOfMonth()) { setDayOfMonth(other.getDayOfMonth()); } if (other.hasDayOfWeek()) { setDayOfWeek(other.getDayOfWeek()); } if (other.hasHour()) { setHour(other.getHour()); } if (other.hasMinute()) { setMinute(other.getMinute()); } if (other.hasSecond()) { setSecond(other.getSecond()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
Source:
public TableViewer createTableViewer(Composite parent, int style, EClass type) { Composite viewerContainer = new Composite(parent, SWT.NONE); TableColumnLayout layout = new TableColumnLayout(); viewerContainer.setLayout(layout); TableViewer tableViewer = new TableViewer(viewerContainer, style); build2(tableViewer, type); return tableViewer; }

Target:
public TableViewer createTableViewer(Composite parent, int style, EClass type) { TableViewer tableViewer = internal_createTableViewer(parent, style); build2(tableViewer, type); return tableViewer; }
Source:
public void updateDrawState(TextPaint textPaint) { textPaint.setColor(itemView.getContext().getResources().getColor(R.color.primary)); }

Target:
public void updateDrawState(TextPaint textPaint) { textPaint.setColor(itemView.getResources().getColor(R.color.primary)); }
Source:
public void testDeleteAccount() { CreateAccount createAccount = new CreateAccount(1); createAccount.exe(); long id = createAccount.getAccountList().get(0).getId(); boolean result = mAccountMapper.deleteAccount(id); assertTrue(result); }

Target:
public void testDeleteAccount() { CreateAccount createAccount = new CreateAccount(1); createAccount.exe(); long id = createAccount.getAccountList().get(0).getId(); boolean result = mAccountMapper.deleteAccount(id); assertTrue(result); assertNull(mAccountMapper.getAccount(id)); }
Source:
public void testEquals() { String rawText = "some raw text"; int position = 1; List<TypedId> identifiers = Lists.newArrayList(new TypedId("someValue", "someType", 0.9f)); BlobCitationEntry blobCitationEntry = new BlobCitationEntry(rawText); blobCitationEntry.setPosition(position); blobCitationEntry.setIdentifiers(identifiers); assertNotEquals(null, blobCitationEntry); assertNotEquals("string", blobCitationEntry); BlobCitationEntry otherBlobCitationEntry = new BlobCitationEntry("other raw text"); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(identifiers); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(2); otherBlobCitationEntry.setIdentifiers(identifiers); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(Lists.newArrayList(new TypedId("someOtherValue", "someType", 0.9f))); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(identifiers); assertEquals(blobCitationEntry, otherBlobCitationEntry); }

Target:
public void testEquals() { String rawText = "some raw text"; int position = 1; List<TypedId> identifiers = Lists.newArrayList(new TypedId("someValue", "someType", 0.9f)); BlobCitationEntry blobCitationEntry = new BlobCitationEntry(rawText); blobCitationEntry.setPosition(position); blobCitationEntry.setIdentifiers(identifiers); assertNotNull(blobCitationEntry); assertNotEquals("string", blobCitationEntry); BlobCitationEntry otherBlobCitationEntry = new BlobCitationEntry("other raw text"); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(identifiers); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(2); otherBlobCitationEntry.setIdentifiers(identifiers); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(Lists.newArrayList(new TypedId("someOtherValue", "someType", 0.9f))); assertNotEquals(blobCitationEntry, otherBlobCitationEntry); otherBlobCitationEntry = new BlobCitationEntry(rawText); otherBlobCitationEntry.setPosition(position); otherBlobCitationEntry.setIdentifiers(identifiers); assertEquals(blobCitationEntry, otherBlobCitationEntry); }
Source:
protected void getCommentsList(@NonNull final InfiniteScrollUtils.PageLoadCallback<DiscussionComment> callback) { if (getCommentsListCall != null) { getCommentsListCall.cancel(); } final List<String> requestedFields = Collections.singletonList( DiscussionRequestFields.PROFILE_IMAGE.getQueryParamValue()); getCommentsListCall = discussionService.getCommentsList( discussionResponse.getIdentifier(), nextPage, requestedFields); getCommentsListCall.enqueue(new ErrorHandlingCallback<Page<DiscussionComment>>( getActivity(), null, new SnackbarErrorNotification(discussionCommentsListView)) { @Override protected void onResponse(@NonNull final Page<DiscussionComment> threadCommentsPage) { ++nextPage; callback.onPageLoaded(threadCommentsPage); discussionCommentsAdapter.notifyDataSetChanged(); hasMorePages = threadCommentsPage.hasNext(); } @Override protected void onFailure(@NonNull final Throwable error) { callback.onError(); nextPage = 1; hasMorePages = false; } }); }

Target:
protected void getCommentsList(@NonNull final InfiniteScrollUtils.PageLoadCallback<DiscussionComment> callback) { if (getCommentsListCall != null) { getCommentsListCall.cancel(); } final List<String> requestedFields = Collections.singletonList( DiscussionRequestFields.PROFILE_IMAGE.getQueryParamValue()); getCommentsListCall = discussionService.getCommentsList( discussionResponse.getIdentifier(), nextPage, requestedFields); final Activity activity = getActivity(); final TaskMessageCallback mCallback = activity instanceof TaskMessageCallback ? (TaskMessageCallback) activity : null; getCommentsListCall.enqueue(new ErrorHandlingCallback<Page<DiscussionComment>>(activity, null, mCallback, CallTrigger.LOADING_UNCACHED) { @Override protected void onResponse(@NonNull final Page<DiscussionComment> threadCommentsPage) { ++nextPage; callback.onPageLoaded(threadCommentsPage); discussionCommentsAdapter.notifyDataSetChanged(); hasMorePages = threadCommentsPage.hasNext(); } @Override protected void onFailure(@NonNull final Throwable error) { callback.onError(); nextPage = 1; hasMorePages = false; } }); }
Source:
public void removeResourceSelfServiceUser(PerunSession sess, Resource resource, User user) throws InternalErrorException, PrivilegeException, UserNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addResourceSelfServiceUser"); } getResourcesManagerBl().removeResourceSelfServiceUser(sess, resource, user); }

Target:
public void removeResourceSelfServiceUser(PerunSession sess, Resource resource, User user) throws InternalErrorException, PrivilegeException, UserNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "removeResourceSelfServiceUser"); } getResourcesManagerBl().removeResourceSelfServiceUser(sess, resource, user); }
Source:
void testRetryService() throws Exception { MockConnectedThriftServiceProvider mockServiceProvider = new MockConnectedThriftServiceProvider(); ThriftConnectorConfig config = new ThriftConnectorConfig() .setMaxRetryAttempts(3) .setMinRetrySleepTime(new Duration(10, MILLISECONDS)) .setMaxRetrySleepTime(new Duration(20, MILLISECONDS)); RetryingPrestoThriftServiceProvider retryingServiceProvider = new RetryingPrestoThriftServiceProvider(mockServiceProvider, retryExecutor, config); mockServiceProvider.setPendingFailuresToGenerate(2); retryingServiceProvider.runOnAnyHost(PrestoThriftService::listSchemaNames); assertEquals(mockServiceProvider.getOpenServiceCount(), 0); }

Target:
void testRetryService() { TestingConnectedThriftServiceProvider testingServiceProvider = new TestingConnectedThriftServiceProvider(2); ThriftConnectorConfig config = new ThriftConnectorConfig() .setMaxRetryAttempts(3) .setMinRetrySleepTime(new Duration(10, MILLISECONDS)) .setMaxRetrySleepTime(new Duration(20, MILLISECONDS)); RetryingPrestoThriftServiceProvider retryingServiceProvider = new RetryingPrestoThriftServiceProvider(testingServiceProvider, retryExecutor, config); retryingServiceProvider.runOnAnyHost(PrestoThriftService::listSchemaNames); assertEquals(testingServiceProvider.getOpenServiceCount(), 3, "Must open thrift connections for 3 times"); assertEquals(testingServiceProvider.getCloseServiceCount(), 3, "Must close all 3 opened connections"); }
Source:
public ChangeVmClusterValidator(VmCommand parentCommand, Guid targetClusterId, Version vmCustomCompatibilityVersion) { this.parentCommand = parentCommand; this.targetClusterId = targetClusterId; this.vmCompatibilityVersion = vmCustomCompatibilityVersion; }

Target:
private ChangeVmClusterValidator(VmCommand parentCommand, Guid targetClusterId, Version vmCustomCompatibilityVersion) { this.parentCommand = parentCommand; this.targetClusterId = targetClusterId; this.vmCompatibilityVersion = vmCustomCompatibilityVersion; }
Source:
public void testUnzipInsecureFile() throws IOException { final File zipFile = new File("myTest.zip"); final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile)); final ZipEntry entry = new ZipEntry("../../../../../evil.txt"); out.putNextEntry(entry); out.close(); final ZipFile source = new ZipFile(zipFile); final File dest = Utils.createTempDir(); assertThatThrownBy(() -> Utils.unzip(source, dest)).isInstanceOf(IOException.class) .hasMessageContaining("Extracting zip entry would have resulted in a file outside the " + "specified destination directory."); }

Target:
public void testUnzipInsecureFile() throws IOException { final File zipFile = new File("myTest.zip"); try (final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile))) { final ZipEntry entry = new ZipEntry("../../../../../evil.txt"); out.putNextEntry(entry); } final ZipFile source = new ZipFile(zipFile); final File dest = Utils.createTempDir(); assertThatThrownBy(() -> Utils.unzip(source, dest)).isInstanceOf(IOException.class) .hasMessageContaining("Extracting zip entry would have resulted in a file outside the " + "specified destination directory."); }
Source:
private static void filteringSimpleProbableThreats() { LOGGER.info(" ### Filtering ProbabilisticThreatAwareSystem by probability ###"); ProbableThreat trojanArcBomb = new SimpleProbableThreat("Trojan-ArcBomb", 1, ThreatType.TROJAN, 0.99); ProbableThreat rootkit = new SimpleProbableThreat("Rootkit-Kernel", 2, ThreatType.ROOTKIT, 0.8); List<ProbableThreat> probableThreats = List.of(trojanArcBomb, rootkit); ProbabilisticThreatAwareSystem probabilisticThreatAwareSystem = new SimpleProbabilisticThreatAwareSystem("System-1", probableThreats); LOGGER.info("Filtering ProbabilisticThreatAwareSystem. Initial : " + probabilisticThreatAwareSystem); ProbabilisticThreatAwareSystem filtered = probabilisticThreatAwareSystem.filtered() .by(probableThreat -> Double.compare(probableThreat.probability(), 0.99) == 0); LOGGER.info("Filtered by probability = 0.99 : " + filtered); }

Target:
private static void filteringSimpleProbableThreats() { LOGGER.info(" ### Filtering ProbabilisticThreatAwareSystem by probability ###"); var trojanArcBomb = new SimpleProbableThreat("Trojan-ArcBomb", 1, ThreatType.TROJAN, 0.99); var rootkit = new SimpleProbableThreat("Rootkit-Kernel", 2, ThreatType.ROOTKIT, 0.8); List<ProbableThreat> probableThreats = List.of(trojanArcBomb, rootkit); var probabilisticThreatAwareSystem = new SimpleProbabilisticThreatAwareSystem("Sys-1", probableThreats); LOGGER.info("Filtering ProbabilisticThreatAwareSystem. Initial : " + probabilisticThreatAwareSystem); var filteredThreatAwareSystem = probabilisticThreatAwareSystem.filtered() .by(probableThreat -> Double.compare(probableThreat.probability(), 0.99) == 0); LOGGER.info("Filtered by probability = 0.99 : " + filteredThreatAwareSystem); }
Source:
protected void executeQueryCommand() { try { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetPasswordlessSshStatus, new PasswordlessSshVDSParameters(getParameters().getServerId(), getParameters().getRemoteServerName(), getParameters().getRemoteServerFingerpirnt(), getParameters().getUserName())); getQueryReturnValue().setSucceeded(returnValue.getSucceeded()); if (!returnValue.getSucceeded()) { getQueryReturnValue().setExceptionString(returnValue.getVdsError().getMessage()); } } catch (Exception e) { log.error(e.getMessage()); getQueryReturnValue().setSucceeded(false); getQueryReturnValue().setExceptionString(e.getMessage()); } }

Target:
protected void executeQueryCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetPasswordlessSshStatus, new PasswordlessSshVDSParameters(getParameters().getServerId(), getParameters().getRemoteServerName(), getParameters().getRemoteServerFingerpirnt(), getParameters().getUserName())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }
Source:
public static void testPutObject(String testTags, PutObjectArgs args, String errorCode) throws Exception { String methodName = "putObject()"; long startTime = System.currentTimeMillis(); ObjectWriteResponse objectInfo = null; try { try { objectInfo = client.putObject(args); } catch (ErrorResponseException e) { if (errorCode == null || !e.errorResponse().code().equals(errorCode)) { throw e; } } if (testTags.equals("[With Retention]")) { client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(args.bucket()) .object(args.object()) .config(new Retention()) .bypassGovernanceMode(true) .build()); } client.removeObject( RemoveObjectArgs.builder() .bucket(args.bucket()) .object(args.object()) .versionId(objectInfo != null ? objectInfo.versionId() : null) .build()); mintSuccessLog(methodName, testTags, startTime); } catch (Exception e) { handleException(methodName, testTags, startTime, e); } }

Target:
public static void testPutObject(String testTags, PutObjectArgs args, String errorCode) throws Exception { String methodName = "putObject()"; long startTime = System.currentTimeMillis(); try { ObjectWriteResponse objectInfo = null; try { objectInfo = client.putObject(args); } catch (ErrorResponseException e) { if (errorCode == null || !e.errorResponse().code().equals(errorCode)) { throw e; } } if (args.retention() != null) { client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(args.bucket()) .object(args.object()) .config(new Retention()) .bypassGovernanceMode(true) .build()); } client.removeObject( RemoveObjectArgs.builder() .bucket(args.bucket()) .object(args.object()) .versionId(objectInfo != null ? objectInfo.versionId() : null) .build()); mintSuccessLog(methodName, testTags, startTime); } catch (Exception e) { handleException(methodName, testTags, startTime, e); } }
Source:
private void serveCheckComponentName(ResourceRequest request, ResourceResponse response) throws IOException { JSONObject responseJson; List<Component> resultComponents = new ArrayList<>(); List<String> errors = new ArrayList<>(); String cName = request.getParameter(PortalConstants.COMPONENT_NAME); if (cName != null && !cName.isEmpty()) { List<Component> similarComponents = new ArrayList<>(); Map<String, Set<String>> filterMap = new HashMap<>(); Set<String> splittedCName = Sets.newHashSet(cName.split("\\W")); Set<String> splittedExtendedCName = splittedCName.stream().map(v -> v + "*").collect(Collectors.toSet()); try { ComponentService.Iface cClient = thriftClients.makeComponentClient(); filterMap.put(Component._Fields.NAME.getFieldName(), splittedExtendedCName); similarComponents.addAll(cClient.refineSearch(null, filterMap)); filterMap.remove(Component._Fields.NAME.getFieldName()); filterMap.put(Component._Fields.VENDOR_NAMES.getFieldName(), splittedExtendedCName); similarComponents.addAll(cClient.refineSearch(null, filterMap)); resultComponents = similarComponents.stream().distinct().sorted(Comparator.comparing(c -> c.getName())) .collect(Collectors.toList()); } catch (TException e) { log.error("Error getting similar components from backend", e); errors.add(e.getMessage()); } } responseJson = createSimilarComponentsResponseJson(request, resultComponents, errors); writeJSON(request, response, responseJson); }

Target:
private void serveCheckComponentName(ResourceRequest request, ResourceResponse response) throws IOException { List<Component> resultComponents = new ArrayList<>(); List<String> errors = new ArrayList<>(); String cName = request.getParameter(PortalConstants.COMPONENT_NAME); if (cName != null && !cName.isEmpty()) { List<Component> similarComponents = new ArrayList<>(); Map<String, Set<String>> filterMap = new HashMap<>(); Set<String> splitCName = Sets.newHashSet(cName.split("\\W")); Set<String> splitExtendedCName = splitCName.stream().map(v -> v + "*").collect(Collectors.toSet()); try { ComponentService.Iface cClient = thriftClients.makeComponentClient(); filterMap.put(Component._Fields.NAME.getFieldName(), splitExtendedCName); similarComponents.addAll(cClient.refineSearch(null, filterMap)); filterMap.remove(Component._Fields.NAME.getFieldName()); filterMap.put(Component._Fields.VENDOR_NAMES.getFieldName(), splitExtendedCName); similarComponents.addAll(cClient.refineSearch(null, filterMap)); resultComponents = similarComponents.stream().distinct().sorted(Comparator.comparing(c -> c.getName())) .collect(Collectors.toList()); } catch (TException e) { log.error("Error getting similar components from backend", e); errors.add(e.getMessage()); } } respondSimilarComponentsResponseJson(request, response, resultComponents, errors); }
Source:
public static Text getLittleLight() { return new Text("Hello, Darkness", "You don't have a light on. Good." ); }

Target:
public static Text getLittleLight() { return new Text("Doing well", "Your bedroom is dim at night, which is great for your sleep." ); }
Source:
protected void executeQueryCommand() { VM vm = getVm(); if (vm == null) { return; } VM nextRunVm = vmHandler.getNextRunVmConfiguration(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (nextRunVm != null) { vm.setCustomCompatibilityVersion(nextRunVm.getCustomCompatibilityVersion()); } updateVMDetails(vm); getQueryReturnValue().setReturnValue(vm); }

Target:
protected void executeQueryCommand() { VM vm = getVm(); if (vm == null) { return; } VM nextRunVm = vmHandler.getNextRunVmConfiguration(getParameters().getId(), getUserID(), getParameters().isFiltered(), false); if (nextRunVm != null) { vm.setCustomCompatibilityVersion(nextRunVm.getCustomCompatibilityVersion()); } updateVMDetails(vm); getQueryReturnValue().setReturnValue(vm); }
Source:
protected static String getZookeeperQuorum(String url) throws SQLException { int endIndex = url.indexOf(';'); endIndex = endIndex == -1 ? url.length() : endIndex; int begIndex = PhoenixRuntime.EMBEDDED_JDBC_PROTOCOL.length(); if (endIndex > begIndex) { return url.substring(begIndex, endIndex); } throw new SQLExceptionInfo.Builder(SQLExceptionCodeEnum.CANNOT_CONNECT_TO_ZOOKEEPER) .setMessage("connection url: " + url).build().buildException(); }

Target:
protected static String getZookeeperQuorum(String url) throws SQLException { int endIndex = url.indexOf(';'); endIndex = endIndex == -1 ? url.length() : endIndex; int begIndex = PhoenixRuntime.EMBEDDED_JDBC_PROTOCOL.length(); if (endIndex > begIndex) { return url.substring(begIndex, endIndex); } throw new SQLExceptionInfo.Builder(SQLExceptionCode.MALFORMED_ZOOKEEPER_URL) .setMessage(url).build().buildException(); }
Source:
public void shouldExpireWithPaymentProvider_whenGatewayStateIsCancellable(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withAmount(200L) .withCreatedDate(ZonedDateTime.now()) .withStatus(status) .withGatewayAccountEntity(gatewayAccount) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockWorldpayCancelResponse.cancelStatus()).thenReturn(CancelStatus.CANCELLED); when(mockChargeDao.findByExternalId(chargeEntity.getExternalId())).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProvider.cancel(any())).thenReturn(gatewayResponse); ArgumentCaptor<CancelGatewayRequest> cancelCaptor = ArgumentCaptor.forClass(CancelGatewayRequest.class); ChargeEntity expiredCharge = mockExpiredChargeEntity(); when(mockChargeService.transitionChargeState(any(String.class), any())).thenReturn(expiredCharge); chargeExpiryService.expire(singletonList(chargeEntity)); verify(mockPaymentProvider).cancel(cancelCaptor.capture()); assertThat(cancelCaptor.getValue().getTransactionId(), is(chargeEntity.getGatewayTransactionId())); verify(mockChargeService).transitionChargeState(chargeEntity.getExternalId(), EXPIRED); }

Target:
public void shouldExpireWithPaymentProvider_whenGatewayStateIsCancellable(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withAmount(200L) .withCreatedDate(ZonedDateTime.now()) .withStatus(status) .withGatewayAccountEntity(gatewayAccount) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockWorldpayCancelResponse.cancelStatus()).thenReturn(CancelStatus.CANCELLED); when(mockChargeDao.findByExternalId(chargeEntity.getExternalId())).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProvider.cancel(any())).thenReturn(gatewayResponse); ArgumentCaptor<CancelGatewayRequest> cancelCaptor = ArgumentCaptor.forClass(CancelGatewayRequest.class); ChargeEntity expiredCharge = mockExpiredChargeEntity(); when(mockChargeService.transitionChargeState(chargeEntity.getExternalId(), EXPIRED)).thenReturn(expiredCharge); chargeExpiryService.expire(singletonList(chargeEntity)); verify(mockPaymentProvider).cancel(cancelCaptor.capture()); assertThat(cancelCaptor.getValue().getTransactionId(), is(chargeEntity.getGatewayTransactionId())); }
Source:
public void testChannelEventNotification() throws Exception { final AtomicBoolean chunkArrivalNotified = new AtomicBoolean(false); final AtomicBoolean closeNotified = new AtomicBoolean(false); ByteBufferAsyncWritableChannel channel = new ByteBufferAsyncWritableChannel(new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { if (e == ByteBufferAsyncWritableChannel.EventType.ChunkArrival) { chunkArrivalNotified.set(true); } else if (e == ByteBufferAsyncWritableChannel.EventType.Close) { closeNotified.set(true); } } }); channel.write(ByteBuffer.allocate(5), null); assertTrue("Write should have been notified", chunkArrivalNotified.get()); channel.close(); assertTrue("Close should have been notified", closeNotified.get()); }

Target:
public void testChannelEventNotification() throws Exception { final AtomicBoolean writeNotified = new AtomicBoolean(false); final AtomicBoolean closeNotified = new AtomicBoolean(false); ByteBufferAsyncWritableChannel channel = new ByteBufferAsyncWritableChannel(new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { if (e == ByteBufferAsyncWritableChannel.EventType.Write) { writeNotified.set(true); } else if (e == ByteBufferAsyncWritableChannel.EventType.Close) { closeNotified.set(true); } } }); assertFalse("No write notification should have come in before any write", writeNotified.get()); channel.write(ByteBuffer.allocate(5), null); assertTrue("Write should have been notified", writeNotified.get()); assertFalse("No close event notification should have come in before a close", closeNotified.get()); channel.close(); assertTrue("Close should have been notified", closeNotified.get()); }
Source:
void incrementTimestamp() { if (rollups_enabled) { if (rollup_index == 0) { final RollupInterval interval = node.rollupIntervals().get(rollup_index); timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { if (fallback_timestamp == null) { fallback_timestamp = getInitialTimestamp(rollup_index); } else if (rollup_index >= node.rollupIntervals().size()) { fallback_timestamp.add(Duration.of(1, ChronoUnit.HOURS)); } else { final RollupInterval interval = node.rollupIntervals().get(rollup_index); fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } } else { timestamp.add(Duration.of(1, ChronoUnit.HOURS)); } }

Target:
void incrementTimestamp() { if (rollups_enabled) { if (rollup_index == 0) { final RollupInterval interval = node.rollupIntervals().get(rollup_index); if (reversed) { timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() - (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } else { if (fallback_timestamp == null) { fallback_timestamp = getInitialTimestamp(rollup_index); } else if (rollup_index >= node.rollupIntervals().size()) { fallback_timestamp.add(Duration.of( (reversed ? - 1 : 1), ChronoUnit.HOURS)); } else { final RollupInterval interval = node.rollupIntervals().get(rollup_index); if (reversed) { fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() - (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } } } else { timestamp.add(Duration.of( (reversed ? -1 : 1), ChronoUnit.HOURS)); } }
Source:
public DataObjectCreatedEvent( Project currentProject, DataObject currentDataObject ) { super( null, currentProject, currentDataObject ); }

Target:
public DataObjectCreatedEvent( Project currentProject, DataObject currentDataObject ) { super( currentProject, currentDataObject ); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events); TextView eventLog = (TextView) findViewById(R.id.events_log); Button customButton = (Button) getLayoutInflater().inflate(R.layout.view_custom_button, null); new ShowcaseView.Builder(this) .withMaterialShowcase() .setStyle(R.style.CustomShowcaseTheme3) .setTarget(new ViewTarget(R.id.imageView, this)) .setContentTitle("Events") .setContentText("Listening to ShowcaseView events is easy!") .setShowcaseEventListener(new MultiEventListener(new LogToTextListener(eventLog), new ShakeButtonListener(customButton))) .replaceEndButton(customButton) .build(); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events); TextView eventLog = (TextView) findViewById(R.id.events_log); Button customButton = (Button) getLayoutInflater().inflate(R.layout.view_custom_button, null); MultiEventListener multiEventListener = new MultiEventListener(new LogToTextListener(eventLog), new ShakeButtonListener(customButton)); new ShowcaseView.Builder(this) .withMaterialShowcase() .setStyle(R.style.CustomShowcaseTheme3) .setTarget(new ViewTarget(R.id.imageView, this)) .setContentTitle("Events") .setContentText("Listening to ShowcaseView events is easy!") .setShowcaseEventListener(multiEventListener) .replaceEndButton(customButton) .build(); }
Source:
public static String getDisableFlash() { return String.valueOf(getProp("disableFlash")); }

Target:
public static String getDisableFlash() { return getProp("disableFlash"); }
Source:
public void close() throws IOException { if (selectObjectContent != null) { selectObjectContent.close(); } if (reader != null) { reader.close(); } if (selectClient != null) { selectClient.close(); } }

Target:
public void close() throws IOException { closer.close(); }