auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public long getMeanTimeToRecovery(Run<?, ?> run) { if (buildFailed(run.getPreviousBuiltBuild())) { Run<?, ?> firstFailedRun = run.getPreviousBuiltBuild(); while (firstFailedRun != null && buildFailed(firstFailedRun.getPreviousBuiltBuild())) { firstFailedRun = firstFailedRun.getPreviousBuiltBuild(); } if (firstFailedRun != null) { long mttf = run.getStartTimeInMillis() - firstFailedRun.getStartTimeInMillis(); return mttf; } } return 0; }

Target:
private long getMeanTimeToRecovery(Run<?, ?> run) { if (isFailedBuild(run.getPreviousBuiltBuild())) { Run<?, ?> firstFailedRun = run.getPreviousBuiltBuild(); while (firstFailedRun != null && isFailedBuild(firstFailedRun.getPreviousBuiltBuild())) { firstFailedRun = firstFailedRun.getPreviousBuiltBuild(); } if (firstFailedRun != null) { return getStartTimeInMillis(run) - getStartTimeInMillis(firstFailedRun); } } return 0; }
Source:
public void cascadeConnectionState(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (oldValue != newValue) { boolean cascadedFurther = false; if (this instanceof OutputBlock) { OutputBlock oblock = (OutputBlock) this; for (Optional<? extends ConnectionAnchor> anchor : oblock.getOutputAnchor().getOppositeAnchors()) { if (anchor.isPresent()) { anchor.get().getBlock().setConnectionState((int) newValue); cascadedFurther = true; } } } if (!cascadedFurther) { try { this.getExpr().analyze(getPane().getEnvInstance()); getPane().setErrorOccurred(false); } catch (HaskellTypeError e) { int index = -1; if (e.getHaskellObject() instanceof Expr) { Expr errorExpr = (Expr) e.getHaskellObject(); while (errorExpr instanceof Apply) { errorExpr = ((Apply) errorExpr).getChildren().get(0); index++; } getPane().getExprToFunction(errorExpr).getInput(index).setErrorState(true); getPane().setErrorOccurred(true); } else { informUnkownHaskellException(); throw new TypeUnavailableException(); } } catch (HaskellException e) { informUnkownHaskellException(); throw new TypeUnavailableException(); } this.setVisualState((int) newValue); } } }

Target:
public void cascadeConnectionState(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (oldValue != newValue) { boolean cascadedFurther = false; if (this instanceof OutputBlock) { OutputBlock oblock = (OutputBlock) this; for (Optional<? extends ConnectionAnchor> anchor : oblock.getOutputAnchor().getOppositeAnchors()) { if (anchor.isPresent()) { anchor.get().getBlock().setConnectionState(newValue.intValue()); cascadedFurther = true; } } } if (!cascadedFurther) { try { this.getExpr().analyze(getPane().getEnvInstance()); getPane().setErrorOccurred(false); } catch (HaskellTypeError e) { int index = -1; if (e.getHaskellObject() instanceof Expr) { Expr errorExpr = (Expr) e.getHaskellObject(); while (errorExpr instanceof Apply) { errorExpr = ((Apply) errorExpr).getChildren().get(0); index++; } getPane().getExprToFunction(errorExpr).getInput(index).setErrorState(true); getPane().setErrorOccurred(true); } else { informUnkownHaskellException(); throw new TypeUnavailableException(); } } catch (HaskellException e) { informUnkownHaskellException(); throw new TypeUnavailableException(); } this.setVisualState((int) newValue); } } }
Source:
protected Stream<WebElement> headerCells() { return headerCells.stream().filter(WebElement::isDisplayed); }

Target:
protected Stream<WebElement> headerCells() { return headerCells.stream(); }
Source:
public static String getWindowsEveryonePrincipalName() { Runtime rt = Runtime.getRuntime(); Process pr = null; try { pr = rt.exec("whoami /groups | find \"S-1-1-0\""); } catch (IOException e) { return "Everyone"; } try { pr.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } try ( InputStreamReader reader = new InputStreamReader(pr.getInputStream(), Charsets.UTF_8)) { return CharStreams.toString(reader).split(" ")[0]; } catch (IOException e) { return "Everyone"; } }

Target:
public static final String getWindowsEveryonePrincipalName() { if (isWindows()) { try { Process process = new ProcessBuilder("whoami", "/groups").start(); try { String line; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { while ((line = reader.readLine()) != null) { if (line.indexOf("S-1-1-0") != -1) { return line.split(" ")[0]; } } } } finally { process.destroy(); } } catch (IOException e) { } } return "Everyone"; }
Source:
public void testUrlFromPath() throws MalformedURLException { URL url = new URL("http://localhost:8080/my/path"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.path"); ba.setValue(url.toString()); Span span = new Span(Arrays.asList(ba)); URL spanURL = span.url(); assertEquals(url, spanURL); }

Target:
public void testUrlFromPath() throws MalformedURLException { URL url = new URL("http://localhost:8080/my/path"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.path"); ba.setValue(url.getPath()); Span span = new Span(Arrays.asList(ba)); URL spanURL = span.url(); assertEquals(url.getPath(), spanURL.getPath()); }
Source:
private ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option, String valueType) { Type toType = getToType(option); switch(valueType) { case "coalesce": return newColumnGetter(con, task, column, option, sqlTypeToValueType(column, column.getSqlType())); case "long": return new LongColumnGetter(to, toType); case "float": return new FloatColumnGetter(to, toType); case "double": return new DoubleColumnGetter(to, toType); case "boolean": return new BooleanColumnGetter(to, toType); case "string": return new StringColumnGetter(to, toType); case "json": return new JsonColumnGetter(to, toType); case "date": return new DateColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "time": return new TimeColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "timestamp": return new TimestampColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "decimal": return new BigDecimalColumnGetter(to, toType); case "array": return new ArrayColumnGetter(to, toType); default: throw new ConfigException(String.format(ENGLISH, "Unknown value_type '%s' for column '%s'", option.getValueType(), column.getName())); } }

Target:
private ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option, String valueType) { Type toType = getToType(option); switch(valueType) { case "coalesce": return newColumnGetter(con, task, column, option, sqlTypeToValueType(column, column.getSqlType())); case "long": return new LongColumnGetter(to, toType); case "float": return new FloatColumnGetter(to, toType); case "double": return new DoubleColumnGetter(to, toType); case "boolean": return new BooleanColumnGetter(to, toType); case "string": return new StringColumnGetter(to, toType); case "json": return new JsonColumnGetter(to, toType); case "date": return new DateColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "time": return new TimeColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "timestamp": return new TimestampColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "decimal": return new BigDecimalColumnGetter(to, toType); default: throw new ConfigException(String.format(ENGLISH, "Unknown value_type '%s' for column '%s'", option.getValueType(), column.getName())); } }
Source:
private boolean isExpired(Long issuedAt, Long lifetime) { return lifetime != -1 && issuedAt + lifetime < System.currentTimeMillis() / 1000; }

Target:
private boolean isExpired(Long issuedAt, Long lifetime) { return lifetime != -1 && ((issuedAt + lifetime) < (System.currentTimeMillis() / 1000)); }
Source:
private static int getConfiguredNumberOfThreads() { if (CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.isSet()) { try { return CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getValue(); } catch (Exception e) { logger.error("Invalid value for " + CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getName(), e); return Runtime.getRuntime().availableProcessors() * 2 - 1; } } else { return Runtime.getRuntime().availableProcessors() * 2 - 1; } }

Target:
private static int getConfiguredNumberOfThreads() { if (CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.isSet()) { try { return CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getValue(); } catch (Exception e) { logger.error("Invalid value for " + CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getName(), e); return DEFAULT_NUMBER_OF_THREADS; } } else { return DEFAULT_NUMBER_OF_THREADS; } }
Source:
private static SQLExecutor buildExecutor(ClusterService clusterService) throws IOException { return SQLExecutor.builder(clusterService, 2, RandomizedTest.getRandom()) .enableDefaultTables() .addPartitionedTable( TableDefinitions.PARTED_PKS_TABLE_DEFINITION, new PartitionName(new RelationName("doc", "parted_pks"), singletonList("1395874800000")).asIndexName(), new PartitionName(new RelationName("doc", "parted_pks"), singletonList("1395961200000")).asIndexName()) .addPartitionedTable(TableDefinitions.TEST_EMPTY_PARTITIONED_TABLE_DEFINITION) .build(); }

Target:
private static SQLExecutor buildExecutor(ClusterService clusterService) throws IOException { return SQLExecutor.builder(clusterService, 2, RandomizedTest.getRandom()) .addTable(TableDefinitions.USER_TABLE_DEFINITION) .build(); }
Source:
private void validateParams( final UUID id, final IPentahoSession session ) { if ( id == null ) { throw new NullPointerException( "uuid is null" ); } if ( session == null ) { throw new NullPointerException( "Session is null" ); } }

Target:
private void validateParams( final UUID id, final IPentahoSession session ) { ArgumentNullException.validate( "uuid", id ); ArgumentNullException.validate( "session", session ); }
Source:
protected void mapDynamicOutputData(Map<String, Object> results) { if (results != null && !results.isEmpty()) { VariableScope variableScope = (VariableScope) ((ContextContainer) getProcessInstance().getProcess()).getDefaultContext( VariableScope.VARIABLE_SCOPE ); VariableScopeInstance variableScopeInstance = (VariableScopeInstance)(VariableScopeInstance)getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);; for (Entry<String, Object> result : results.entrySet()) { String variableName = result.getKey(); Variable variable = variableScope.findVariable(variableName); if (variable == null) { variableName = VariableScope.CASE_FILE_PREFIX + variableName; List<String> definedVariables = Arrays.asList(variableScope.getVariableNames()); if (definedVariables.contains(variableName)) { variable = variableScope.findVariable(variableName); } } if (variable != null) { variableScopeInstance.getVariableScope().validateVariable(getProcessInstance().getProcessName(), variableName, result.getValue()); variableScopeInstance.setVariable(variableName, result.getValue()); } } } }

Target:
protected void mapDynamicOutputData(Map<String, Object> results) { if (results != null && !results.isEmpty()) { VariableScope variableScope = (VariableScope) ((ContextContainer) getProcessInstance().getProcess()).getDefaultContext( VariableScope.VARIABLE_SCOPE ); VariableScopeInstance variableScopeInstance = (VariableScopeInstance)getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE); for (Entry<String, Object> result : results.entrySet()) { String variableName = result.getKey(); Variable variable = variableScope.findVariable(variableName); if (variable == null) { variableName = VariableScope.CASE_FILE_PREFIX + variableName; List<String> definedVariables = Arrays.asList(variableScope.getVariableNames()); if (definedVariables.contains(variableName)) { variable = variableScope.findVariable(variableName); } } if (variable != null) { variableScopeInstance.getVariableScope().validateVariable(getProcessInstance().getProcessName(), variableName, result.getValue()); variableScopeInstance.setVariable(variableName, result.getValue()); } } } }
Source:
public void scanFile() { file = new File("src/test/resources/org/sonar/plugins/python/highlighting.py"); DefaultInputFile inputFile = new DefaultInputFile("moduleKey", file.getName()) .initMetadata(new FileMetadata().readMetadata(file, Charsets.UTF_8)); context = SensorContextTester.create(new File("src/test/resources/org/sonar/plugins/python").getAbsoluteFile()); context.fileSystem().add(inputFile); PythonHighlighter pythonHighlighter = new PythonHighlighter(context); PythonAstScanner.scanSingleFile(file, pythonHighlighter); }

Target:
public void scanFile() { String dir = "src/test/resources/org/sonar/plugins/python"; file = new File(dir + "/pythonHighlighter.py"); DefaultInputFile inputFile = new DefaultInputFile("moduleKey", file.getName()) .initMetadata(new FileMetadata().readMetadata(file, Charsets.UTF_8)); context = SensorContextTester.create(new File(dir)); context.fileSystem().add(inputFile); PythonHighlighter pythonHighlighter = new PythonHighlighter(context); PythonAstScanner.scanSingleFile(file, pythonHighlighter); }
Source:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); g.writeObjectFieldStart("data"); for ( String key: this.data.keySet() ) { Object data = this.data.get(key); if ( data == null ) continue; if ( data instanceof List) { List<String> stringList = (List<String>) data; g.writeArrayFieldStart(key); for ( String s : stringList ) { g.writeString(s); } g.writeEndArray(); } else { g.writeObjectField(key, data); } } g.writeEndObject(); if ( !this.oldData.isEmpty()) { g.writeObjectFieldStart("old"); for (String key : this.oldData.keySet()) { Object data = this.oldData.get(key); if (data instanceof List) { List<String> stringList = (List<String>) data; g.writeArrayFieldStart(key); for (String s : stringList) { g.writeString(s); } g.writeEndArray(); } else { g.writeObjectField(key, data); } } g.writeEndObject(); } g.writeEndObject(); g.flush(); return jsonFromStream(); }

Target:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty()) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }
Source:
public void upgrade_movePasswordTwice_idemPotent() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePasswordTwice_idemPotent"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.takeVpnPassword(), equalTo(Optional.empty())); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.takeVpnPassword(), equalTo(Optional.empty())); }

Target:
public void upgrade_movePasswordTwice_idemPotent() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePasswordTwice_idemPotent"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.getAndClearVpnPassword(), equalTo(Optional.empty())); }
Source:
public void loginViaSocialAccount(String email, String idToken, String service, boolean isPasswordRequired) { LoginEmailPasswordFragment loginEmailPasswordFragment = LoginEmailPasswordFragment.newInstance(email, null, null, null, isPasswordRequired); slideInFragment(loginEmailPasswordFragment, true, LoginEmailPasswordFragment.TAG); }

Target:
public void loginViaSocialAccount(String email, String idToken, String service, boolean isPasswordRequired) { LoginEmailPasswordFragment loginEmailPasswordFragment = LoginEmailPasswordFragment.newInstance(email, null, idToken, service, isPasswordRequired); slideInFragment(loginEmailPasswordFragment, true, LoginEmailPasswordFragment.TAG); }
Source:
public static Set<TaskStatus> taskStatuses(boolean pending, boolean running, boolean finished) { List<String> aggregatedStatuses = new LinkedList<>(); if (pending) { aggregatedStatuses.add("Pending"); } if (running) { aggregatedStatuses.add("Running"); } if (finished) { aggregatedStatuses.add("Finished"); } return TaskStatus.expandAggregatedStatusesToRealStatuses(aggregatedStatuses); }

Target:
public static Set<TaskStatus> taskStatuses(boolean pending, boolean running, boolean finished) { List<String> aggregatedStatuses = new LinkedList<>(); if (pending) { aggregatedStatuses.add(TaskStatus.SUBMITTED.name); aggregatedStatuses.add(TaskStatus.PENDING.name); } if (running) { aggregatedStatuses.add(TaskStatus.RUNNING.name); } if (finished) { aggregatedStatuses.add(TaskStatus.FINISHED.name); } return TaskStatus.expandAggregatedStatusesToRealStatuses(aggregatedStatuses); }
Source:
public void testMmsRetrievingAll() { final ContentValues mmsValues = new ContentValues(2); mmsValues.put(Telephony.Mms.TEXT_ONLY, 1); mmsValues.put(Telephony.Mms.MESSAGE_TYPE, 128); mmsValues.put(Telephony.Mms.SUBJECT, mmsSubject); final Uri mmsUri = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues); assertThat(mmsUri).isNotNull(); final long mmsId = ContentUris.parseId(mmsUri); mmsValues.put(Telephony.Mms.TEXT_ONLY, 1); mmsValues.put(Telephony.Mms.MESSAGE_TYPE, 128); mmsValues.put(Telephony.Mms.SUBJECT, mmsSubject); final Uri mmsUri1 = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues); assertThat(mmsUri1).isNotNull(); final long mmsId1 = ContentUris.parseId(mmsUri1); Cursor cursor = mContentResolver.query(Telephony.Mms.CONTENT_URI, null, null, null); assertThat(cursor.getCount()).isEqualTo(2); }

Target:
public void testMmsRetrievingAll() { cleanup(); Uri mmsUri1 = insertInToMmsTable(false, MMS_SUBJECT_ONE); assertThat(mmsUri1).isNotNull(); Uri mmsUri2 = insertInToMmsTable(true, MMS_SUBJECT_TWO); assertThat(mmsUri2).isNotNull(); Cursor cursor = mContentResolver.query(Telephony.Mms.CONTENT_URI, null, null, null); assertThat(cursor.getCount()).isEqualTo(2); assertThat(cursor.moveToFirst()).isEqualTo(true); assertThat(cursor.getString(cursor.getColumnIndex(Telephony.Mms.SUBJECT))).isEqualTo(MMS_SUBJECT_ONE); assertThat(cursor.moveToNext()).isEqualTo(true); assertThat(cursor.getString(cursor.getColumnIndex(Telephony.Mms.SUBJECT))).isEqualTo(MMS_SUBJECT_TWO); }
Source:
protected Builder() { id("oneandone") .name("OneAndOne REST Compute") .apiMetadata(new OneAndOneApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .iso3166Codes("de", "us", "es", "gb") .endpoint("<LINK_0>") .defaultProperties(OneAndOneProviderMetadata.defaultProperties()); }

Target:
protected Builder() { id("oneandone") .name("OneAndOne REST Compute") .apiMetadata(new OneAndOneApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") .defaultProperties(OneAndOneProviderMetadata.defaultProperties()); }
Source:
private void notifyDirtyListeners() { if (listeners == null) { return; } Display.getCurrent().asyncExec(new Runnable() { public void run() { boolean dirty = isDirty(); for (IDirtyListener listener : listeners) { listener.dirtyChanged(dirty); } } }); }

Target:
private void notifyDirtyListeners() { if (dirtyListeners == null) { return; } Display.getCurrent().asyncExec(new Runnable() { public void run() { boolean dirty = isDirty(); final Object[] listeners = dirtyListeners.getListeners(); for (int i = 0; i < listeners.length; i++) { IDirtyListener dirtyListener = (IDirtyListener) listeners[i]; dirtyListener.dirtyChanged(dirty); } } }); }
Source:
public int compareTo(PrioritizedListenableFutureTask otherTask) { return comparator.compare(this, otherTask); }

Target:
public int compareTo(PrioritizedListenableFutureTask otherTask) { return PRIORITY_COMPARATOR.compare(this, otherTask); }
Source:
private void shareSnippet(@NonNull CharSequence input) { final String selectedText = StringUtil.sanitizeText(input.toString()); final PageTitle title = fragment.getTitle(); new ImageLicenseFetchClient().request(title.getWikiSite(), new PageTitle("File:" + fragment.getPage().getPageProperties().getLeadImageName(), title.getWikiSite()), new ImageLicenseFetchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull List<MwQueryImageLicensePage> pages) { MwQueryImageLicensePage page = pages.get(0); ImageLicense leadImageLicense = new ImageLicense(page.imageLicense(), page.imageLicenseShortName(), page.imageLicenseUrl()); final Bitmap snippetBitmap = SnippetImage.getSnippetImage(fragment.getContext(), fragment.getLeadImageBitmap(), title.getDisplayText(), fragment.getPage().isMainPage() ? "" : StringUtils.capitalize(title.getDescription()), selectedText, leadImageLicense); fragment.showBottomSheet(new PreviewDialog(fragment, snippetBitmap, title, selectedText, funnel)); } @Override public void failure(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull Throwable caught) { L.d("Error fetching image license info for " + title.getDisplayText() + ": " + caught.getMessage(), caught); } }); }

Target:
private void shareSnippet(@NonNull CharSequence input) { final String selectedText = StringUtil.sanitizeText(input.toString()); final PageTitle title = fragment.getTitle(); final String leadImageNameText = fragment.getPage().getPageProperties().getLeadImageName() != null ? fragment.getPage().getPageProperties().getLeadImageName() : ""; new ImageLicenseFetchClient().request(title.getWikiSite(), new PageTitle(Namespace.FILE.toLegacyString(), leadImageNameText, title.getWikiSite()), new ImageLicenseFetchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull List<MwQueryImageLicensePage> pages) { MwQueryImageLicensePage page = pages.get(0); ImageLicense leadImageLicense = new ImageLicense(page.imageLicense(), page.imageLicenseShortName(), page.imageLicenseUrl()); final Bitmap snippetBitmap = SnippetImage.getSnippetImage(fragment.getContext(), fragment.getLeadImageBitmap(), title.getDisplayText(), fragment.getPage().isMainPage() ? "" : StringUtils.capitalize(title.getDescription()), selectedText, leadImageLicense); fragment.showBottomSheet(new PreviewDialog(fragment, snippetBitmap, title, selectedText, funnel)); } @Override public void failure(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull Throwable caught) { L.e("Error fetching image license info for " + title.getDisplayText(), caught); } }); }
Source:
public CompletableFuture<Configuration> createCache(String cacheName, Configuration configuration, EnumSet<CacheContainerAdmin.AdminFlag> flags) { return null; }

Target:
public CompletableFuture<Configuration> createCache(String cacheName, Configuration configuration, EnumSet<CacheContainerAdmin.AdminFlag> flags) { return CompletableFutures.completedNull(); }
Source:
public void patchPermanentGroupUnprocessable() throws Exception { context.turnOffAuthorisationSystem(); GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); final String name = group.getName(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); String requestBody = " [\n" + " {\n" + " \"op\": \"replace\",\n" + " \"path\": \"/name\",\n" + " \"value\": \"new name\"\n" + " }\n" + " ]"; getClient(token) .perform(patch("/api/eperson/groups/" + group.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + group.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(group.getID(), name)) )); }

Target:
public void patchPermanentGroupUnprocessable() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); final String name = group.getName(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<>(); ReplaceOperation replaceOperation = new ReplaceOperation("/name", "new name"); ops.add(replaceOperation); String requestBody = getPatchContent(ops); getClient(token) .perform(patch("/api/eperson/groups/" + group.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + group.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(group.getID(), name)) )); }
Source:
public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final ISelection selection = HandlerUtil.getCurrentSelection(event); IResourceUIModel selectedResource = UIUtils.getFirstElement(selection, IResourceUIModel.class); if(selectedResource == null && (selection instanceof IStructuredSelection)) { final Object selected = ((IStructuredSelection)selection).getFirstElement(); if(selected instanceof IService || selected instanceof IRoute) { selectedResource = new IResourceUIModel() { @Override public Object getParent() { return null; } @Override public IResource getResource() { return (IResource)selected; } }; } } final IServer openShiftServer = getOpenShiftServer(selectedResource); if (openShiftServer != null) { openServersView(openShiftServer, workbenchWindow); } return null; }

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final ISelection selection = HandlerUtil.getCurrentSelection(event); IResourceUIModel selectedResourceModel = UIUtils.getFirstElement(selection, IResourceUIModel.class); IResource selectedResource = (selectedResourceModel != null) ? selectedResourceModel.getResource() : UIUtils.getFirstElement(selection, IResource.class); final IServer openShiftServer = getOpenShiftServer(selectedResource); if (openShiftServer != null) { openServersView(openShiftServer, workbenchWindow); } return null; }
Source:
public void testTimerStateRestorable() throws Exception { Path path = new Path(folder.newFolder().toURI()); OperatorSubtaskState state; KeyedStateBootstrapOperator<Long, Long> bootstrapOperator = new KeyedStateBootstrapOperator<>(0L, path, new TimerBootstrapFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, TaggedOperatorSubtaskState> harness = getHarness(bootstrapOperator)) { harness.open(); harness.processElement(1L, 0L); harness.processElement(2L, 0L); harness.processElement(3L, 0L); bootstrapOperator.endInput(); state = harness.extractOutputValues().get(0).state; } KeyedProcessOperator<Long, Long, Tuple3<Long, Long, TimeDomain>> procOperator = new KeyedProcessOperator<>(new SimpleProcessFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, Tuple3<Long, Long, TimeDomain>> harness = getHarness(procOperator)) { harness.initializeState(state); harness.open(); harness.processWatermark(EVENT_TIMER); harness.setProcessingTime(PROC_TIMER); Assert.assertThat(harness.extractOutputValues(), Matchers.containsInAnyOrder( Tuple3.of(1L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(2L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(3L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(1L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(2L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(3L, PROC_TIMER, TimeDomain.PROCESSING_TIME))); harness.snapshot(0L, 0L); } }

Target:
public void testTimerStateRestorable() throws Exception { Path path = new Path(folder.newFolder().toURI()); OperatorSubtaskState state; KeyedStateBootstrapOperator<Long, Long> bootstrapOperator = new KeyedStateBootstrapOperator<>(0L, path, new TimerBootstrapFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, TaggedOperatorSubtaskState> harness = getHarness(bootstrapOperator)) { processElements(harness, 1L, 2L, 3L); state = getState(bootstrapOperator, harness); } KeyedProcessOperator<Long, Long, Tuple3<Long, Long, TimeDomain>> procOperator = new KeyedProcessOperator<>(new SimpleProcessFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, Tuple3<Long, Long, TimeDomain>> harness = getHarness(procOperator, state)) { harness.processWatermark(EVENT_TIMER); harness.setProcessingTime(PROC_TIMER); assertHarnessOutput(harness, Tuple3.of(1L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(2L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(3L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(1L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(2L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(3L, PROC_TIMER, TimeDomain.PROCESSING_TIME)); } }
Source:
private static synchronized Iterable<ISegmentGenerationListener> getListeners(ListenerList listenersList) { List<ISegmentGenerationListener> listeners = new ArrayList<>(); for (Object listener : listenersList.getListeners()) { if (listener != null) { listeners.add((ISegmentGenerationListener) listener); } } return listeners; }

Target:
private static synchronized Iterable<ISegmentGenerationListener> getListeners(ListenerList listenersList) { List<ISegmentGenerationListener> listeners = new ArrayList<>(); for (Object listener : listenersList.getListeners()) { if (listener instanceof ISegmentGenerationListener) { listeners.add((ISegmentGenerationListener) listener); } } return listeners; }
Source:
public HashMap<String, Comparison> getColumnPredicates() { return columnPredicates; }

Target:
public Multimap<String, Comparison> getColumnPredicates() { return columnPredicates; }
Source:
private static void updateTimeoutLogableObject(AuditLogableBase auditLogable, AuditLogType logType) { int duplicateEventsIntrvalValue = (auditLogable.isExternal()) ? Math.max(auditLogable.getEventFloodInSec(), 30) : logType.getDuplicateEventsIntervalValue(); if (duplicateEventsIntrvalValue > 0) { auditLogable.setEndTime(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(logType.getDuplicateEventsIntervalValue())); auditLogable.setTimeoutObjectId(composeObjectId(auditLogable, logType)); } }

Target:
private static void updateTimeoutLogableObject(AuditLogableBase auditLogable, AuditLogType logType) { int duplicateEventsIntrvalValue = (auditLogable.isExternal()) ? Math.max(auditLogable.getEventFloodInSec(), 30) : logType.getDuplicateEventsIntervalValue(); if (duplicateEventsIntrvalValue > 0) { auditLogable.setEndTime(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(duplicateEventsIntrvalValue)); auditLogable.setTimeoutObjectId(composeObjectId(auditLogable, logType)); } }
Source:
public synchronized void invokeCallbackMethods() { initCommandExecutor(); for (Iterator<Guid> iterator = cmdCallBackMap.keySet().iterator(); iterator.hasNext();) { Guid cmdId = iterator.next(); CommandCallBack callBack = cmdCallBackMap.get(cmdId); CommandStatus status = coco.getCommandStatus(cmdId); switch(status) { case FAILED: callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case ACTIVE_SYNC: coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; case ACTIVE: case ACTIVE_ASYNC: callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); break; default: break; } } }

Target:
public synchronized void invokeCallbackMethods() { initCommandExecutor(); for (Iterator<Entry<Guid, CommandCallBack>> iterator = cmdCallBackMap.entrySet().iterator(); iterator.hasNext();) { Entry<Guid, CommandCallBack> entry = iterator.next(); Guid cmdId = entry.getKey(); CommandCallBack callBack = entry.getValue(); CommandStatus status = coco.getCommandStatus(cmdId); switch(status) { case FAILED: callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case ACTIVE_SYNC: coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; case ACTIVE: case ACTIVE_ASYNC: callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); break; default: break; } } }
Source:
public Long[] cardIds() { Long[] cids; if (mDid < 0) { cids = Utils.list2ObjectArray(mCol.getDb().queryColumn(Long.class, "select id from cards", 0)); } else { cids = mCol.getDecks().cids(mDid, true); } mCount = cids.length; return cids; }

Target:
public Long[] cardIds() { Long[] cids; if (mDid == null) { cids = Utils.list2ObjectArray(mCol.getDb().queryColumn(Long.class, "select id from cards", 0)); } else { cids = mCol.getDecks().cids(mDid, true); } mCount = cids.length; return cids; }
Source:
public void forceVaultRemoval() { Vault vault = api().getVault(vaultName); if (vault != null) { if ((vault.properties().enableSoftDelete() != null) && vault.properties().enableSoftDelete()) { api().deleteVault(vaultName); Object[] args = { resourceGroupName, vaultName, true }; checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); } else { return; } } DeletedVault deletedVault = api().getDeletedVault(LOCATION, vaultName); if (deletedVault != null) { api().purgeVault(LOCATION, vaultName); Object[] args = { resourceGroupName, vaultName, true }; checkState(deletedVaultStatus.create(resourceGroupName, false).apply(vaultName), "vault was not purged before timeout"); } }

Target:
public void forceVaultRemoval() { Vault vault = api().getVault(vaultName); if (vault != null) { if ((vault.properties().enableSoftDelete() != null) && vault.properties().enableSoftDelete()) { api().deleteVault(vaultName); checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); } else { return; } } DeletedVault deletedVault = api().getDeletedVault(LOCATION, vaultName); if (deletedVault != null) { api().purgeVault(LOCATION, vaultName); checkState(deletedVaultStatus.create(resourceGroupName, false).apply(vaultName), "vault was not purged before timeout"); } }
Source:
private void fixFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { fixFeedbackQuestionsOfFeedbackSession(session); fixFeedbackResponsesOfFeedbackSession(session); fixFeedbackResponseCommentsOfFeedbackSession(session); FeedbackSessionAttributes sessionAttribute = new FeedbackSessionAttributes(session); feedbackSessionsDb.deleteEntity(sessionAttribute); sessionAttribute.feedbackSessionName = StringHelper.removeExtraSpace(sessionAttribute.getFeedbackSessionName()); feedbackSessionsDb.createEntity(sessionAttribute); }

Target:
private void fixFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { if (feedbackSessionsDb.getFeedbackSession(session.getCourseId(), StringHelper.removeExtraSpace(session.getFeedbackSessionName())) != null) { throw new EntityAlreadyExistsException( "Will be unable to rename session as a session with the extra-space-removed name exists"); } fixFeedbackQuestionsOfFeedbackSession(session); fixFeedbackResponsesOfFeedbackSession(session); fixFeedbackResponseCommentsOfFeedbackSession(session); FeedbackSessionAttributes sessionAttribute = new FeedbackSessionAttributes(session); feedbackSessionsDb.deleteEntity(sessionAttribute); sessionAttribute.setFeedbackSessionName( StringHelper.removeExtraSpace(sessionAttribute.getFeedbackSessionName())); feedbackSessionsDb.createEntity(sessionAttribute); }
Source:
public void updateElement(UIElement element, Map parameters) { Repository repo = null; List<RepositoryTreeNode<?>> nodes = getSelectedNodes(); if (nodes.size() == 1) { repo = nodes.get(0).getRepository(); } element.setText( SimpleConfigurePushDialog.getSimplePushCommandLabel(repo)); }

Target:
public void updateElement(UIElement element, Map parameters) { RemoteConfig config = null; List<RepositoryTreeNode<?>> nodes = getSelectedNodes(); if (nodes.size() == 1) { config = getRemoteConfigCached(nodes.get(0)); } element.setText( SimpleConfigurePushDialog.getSimplePushCommandLabel(config)); }
Source:
protected Map<DropStrategy, List<Command>> findExtendedStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { List<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else if(strategy instanceof TransactionalDropStrategy){ Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); matchingStrategies.put(defaultDropStrategy, selectedCommands); return matchingStrategies; }

Target:
protected Map<DropStrategy, List<Command>> findExtendedStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { List<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else{ Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); matchingStrategies.put(defaultDropStrategy, selectedCommands); return matchingStrategies; }
Source:
public Build execute() { try (ArtifactoryDependenciesClient dependenciesClient = (ArtifactoryDependenciesClient) clientBuilder.build()) { client = dependenciesClient; validateArtifactoryVersion(); validateNpmVersion(); validateRepoExists("Source repo must be specified"); NpmProject npmProject = new NpmProject(args, repo, workingDir); return buildInfoExtractor.extract(npmProject); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e), e); } return null; }

Target:
public Build execute() { try (ArtifactoryDependenciesClient dependenciesClient = (ArtifactoryDependenciesClient) clientBuilder.build()) { client = dependenciesClient; validateArtifactoryVersion(); validateNpmVersion(); validateRepoExists("Source repo must be specified"); NpmProject npmProject = new NpmProject(installArgs, repo, workingDir); return buildInfoExtractor.extract(npmProject); } catch (Exception e) { logger.error("Failed during NpmInstall", e); } return null; }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (volume.getAsyncTask() != null && (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE || volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK)) { addCanDoActionMessageVariable("asyncTask", volume.getAsyncTask().getType().name().toLowerCase()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_ASYNC_OPERATION_IN_PROGRESS); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (!brick.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (volume.getAsyncTask() != null && (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE || volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK) && volume.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { addCanDoActionMessageVariable("asyncTask", volume.getAsyncTask().getType().name().toLowerCase()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_ASYNC_OPERATION_IN_PROGRESS); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (!brick.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }
Source:
private Set<String> moduleNames() { Set<String> moduleNames= new HashSet<>(); if (fSourceJavaElements != null) { for (IJavaElement fSourceJavaElement : fSourceJavaElements) { if (fSourceJavaElement instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) fSourceJavaElement).getModuleDescription(); if (module != null) { moduleNames.add(module.getElementName()); } } } } return moduleNames; }

Target:
private Set<String> moduleNames() { Set<String> moduleNames= new HashSet<>(); if (fSourceJavaElements != null) { for (IJavaElement element : fSourceJavaElements) { if (element instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) element).getModuleDescription(); if (module != null) { moduleNames.add(module.getElementName()); } } } } return moduleNames; }
Source:
public JsonRuntimeReporterHelper() { try { File workingDir = new File(Config.getConfigProperty(ConfigProperty.WORK_DIR)); boolean isCreated = workingDir.mkdirs(); logger.log(Level.FINER,"Is working directory creation successful:"+ isCreated); jsonCompletedTest = File.createTempFile("selion-rrct", null, workingDir); jsonCompletedTest.deleteOnExit(); jsonCompletedConfig = File.createTempFile("selion-rrcf", null, workingDir); jsonCompletedConfig.deleteOnExit(); } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); throw new ReporterException(e); } }

Target:
public JsonRuntimeReporterHelper() { try { File workingDir = new File(Config.getConfigProperty(ConfigProperty.WORK_DIR)); boolean isCreated = workingDir.mkdirs(); logger.log(Level.FINER, "Working directory created successfully: " + isCreated); jsonCompletedTest = File.createTempFile("selion-rrct", null, workingDir); jsonCompletedTest.deleteOnExit(); jsonCompletedConfig = File.createTempFile("selion-rrcf", null, workingDir); jsonCompletedConfig.deleteOnExit(); } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); throw new ReporterException(e); } }
Source:
public void uploadSnapshotTest_alreadyExistingIndex() throws IOException, InterruptedException, ExecutionException{ String indexName = getLiveIndex(); File snapshot = null; try { snapshot = esIndexAPI.createSnapshot(ESIndexAPI.BACKUP_REPOSITORY, "backup", indexName); ZipFile file = new ZipFile(snapshot.getAbsolutePath()); String pathToRepo = Config.getStringProperty("es.path.repo","test-resources"); File tempDir = new File(pathToRepo); esIndexAPI.uploadSnapshot(file, tempDir.getAbsolutePath(), "backup"); } catch (DotStateException | IllegalArgumentException | IOException e) { e.printStackTrace(); }finally{ snapshot.delete(); } }

Target:
public void uploadSnapshotTest_alreadyExistingIndex() throws IOException, InterruptedException, ExecutionException{ String indexName = getLiveIndex(); File snapshot = null; snapshot = esIndexAPI.createSnapshot(ESIndexAPI.BACKUP_REPOSITORY, "backup", indexName); ZipFile file = new ZipFile(snapshot.getAbsolutePath()); String pathToRepo = Config.getStringProperty("es.path.repo","test-resources"); File tempDir = new File(pathToRepo); esIndexAPI.uploadSnapshot(file, tempDir.getAbsolutePath()); if(snapshot!=null){ snapshot.delete(); } }
Source:
public void before() throws IOException, MembershipConfigurationException { localHost = InetAddress.getLocalHost(); dsfidSerializer = new DSFIDSerializerImpl(); socketCreator = new TcpSocketCreatorImpl(); }

Target:
public void before() throws IOException, MembershipConfigurationException { localHost = LocalHostUtil.getLocalHost(); dsfidSerializer = new DSFIDSerializerImpl(); socketCreator = new TcpSocketCreatorImpl(); }
Source:
private void toggleDivider() { if (divider == null) return; if (!showDivider) { divider.setVisibility(GONE); } boolean shallHide = ( date != null && date.getVisibility() != VISIBLE && weatherLayout.getVisibility() != VISIBLE ); if (shallHide) { if (showDivider) { divider.setVisibility(INVISIBLE); } setBackgroundColor(Color.parseColor("#00000000")); } else { if (showDivider) { divider.setVisibility(VISIBLE); } GradientDrawable shape = new GradientDrawable(); shape.setCornerRadius( Settings.getRoundCorners(context) ); shape.setColor(Color.parseColor("#44000000")); setBackground(shape); } }

Target:
private void toggleDivider() { if (divider == null) return; if (!showDivider) { divider.setVisibility(GONE); } boolean shallHide = ( date != null && date.getVisibility() != VISIBLE && weatherLayout.getVisibility() != VISIBLE ); if (shallHide) { if (showDivider) { divider.setVisibility(INVISIBLE); } setBackgroundColor(Color.parseColor("#00000000")); } else { if (showDivider) { divider.setVisibility(VISIBLE); } GradientDrawable shape = new GradientDrawable(); shape.setCornerRadius(30); shape.setColor(Color.parseColor("#44000000")); setBackground(shape); } }