auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testSmudgeFilter_modifyExisting() throws IOException, GitAPIException { File script = writeTempFile("sed s/o/e/ -"); StoredConfig config = git.getRepository().getConfig(); config.setString("filter", "tstFilter", "smudge", "sh " + script.getPath()); config.save(); writeTrashFile(".gitattributes", "*.txt filter=tstFilter"); git.add().addFilepattern(".gitattributes").call(); git.commit().setMessage("add filter").call(); writeTrashFile("src/a.tmp", "x"); writeTrashFile("src/a.txt", "x"); git.add().addFilepattern("src/a.tmp").addFilepattern("src/a.txt") .call(); RevCommit content1 = git.commit().setMessage("add content").call(); writeTrashFile("src/a.tmp", "foo"); writeTrashFile("src/a.txt", "foo"); git.add().addFilepattern("src/a.tmp").addFilepattern("src/a.txt") .call(); RevCommit content2 = git.commit().setMessage("changed content").call(); git.checkout().setName(content1.getName()).call(); git.checkout().setName(content2.getName()).call(); assertEquals( "[.gitattributes, mode:100644, content:*.txt filter=tstFilter][Test.txt, mode:100644, content:Some change][src/a.tmp, mode:100644, content:foo][src/a.txt, mode:100644, content:foo]", indexState(CONTENT)); assertEquals("foo", read("src/a.tmp")); assertEquals("feo", read("src/a.txt")); }

Target:
public void testSmudgeFilter_modifyExisting() throws IOException, GitAPIException { File script = writeTempFile("tr o e"); StoredConfig config = git.getRepository().getConfig(); config.setString("filter", "tstFilter", "smudge", "sh " + script.getPath()); config.save(); writeTrashFile(".gitattributes", "*.txt filter=tstFilter"); git.add().addFilepattern(".gitattributes").call(); git.commit().setMessage("add filter").call(); writeTrashFile("src/a.tmp", "x"); writeTrashFile("src/a.txt", "x"); git.add().addFilepattern("src/a.tmp").addFilepattern("src/a.txt") .call(); RevCommit content1 = git.commit().setMessage("add content").call(); writeTrashFile("src/a.tmp", "foo"); writeTrashFile("src/a.txt", "foo"); git.add().addFilepattern("src/a.tmp").addFilepattern("src/a.txt") .call(); RevCommit content2 = git.commit().setMessage("changed content").call(); git.checkout().setName(content1.getName()).call(); git.checkout().setName(content2.getName()).call(); assertEquals( "[.gitattributes, mode:100644, content:*.txt filter=tstFilter][Test.txt, mode:100644, content:Some change][src/a.tmp, mode:100644, content:foo][src/a.txt, mode:100644, content:foo]", indexState(CONTENT)); assertEquals("foo", read("src/a.tmp")); assertEquals("fee", read("src/a.txt")); }
Source:
private void onDataChanged(Object data) { ODKView odkView = getCurrentViewIfODKView(); if (odkView != null) { QuestionWidget widgetGettingNewValue = getWidgetWaitingForBinaryData(); setBinaryWidgetData(data); widgetValueChanged(widgetGettingNewValue); } }

Target:
private void onDataChanged(Object data) { ODKView odkView = getCurrentViewIfODKView(); if (odkView != null) { QuestionWidget widgetGettingNewValue = getWidgetWaitingForBinaryData(); setWidgetData(data); widgetValueChanged(widgetGettingNewValue); } }
Source:
private void validateClientID(ClientSession validateSession, String clientID) throws InvalidClientIDException { try { validateSession.addUniqueMetaData(ClientSession.JMS_SESSION_CLIENT_ID_PROPERTY, clientID); } catch (ActiveMQException e) { if (e.getType() == ActiveMQExceptionType.DUPLICATE_METADATA) { throw new InvalidClientIDException("clientID=" + clientID + " was already set into another connection"); } else { throw new InvalidClientIDException("Error setting clientID=" + clientID + ": " + e.getMessage()); } } }

Target:
private void validateClientID(ClientSession validateSession, String clientID) throws InvalidClientIDException, ActiveMQException { try { validateSession.addUniqueMetaData(ClientSession.JMS_SESSION_CLIENT_ID_PROPERTY, clientID); } catch (ActiveMQException e) { if (e.getType() == ActiveMQExceptionType.DUPLICATE_METADATA) { throw new InvalidClientIDException("clientID=" + clientID + " was already set into another connection"); } else { throw e; } } }
Source:
public void onLoadMore() { if (TextUtils.isEmpty(mSearchTerm)) { if (mCanLoadMorePosts && !mIsFetchingPosts) { requestPosts(true); } } else if (mCanSearchMore && !mIsSearching) { showLoadMoreProgress(); mSearchOffset = mSearchResults.size(); mHandler.post(mSearchRunnable); } }

Target:
public void onLoadMore() { if (TextUtils.isEmpty(mSearchTerm)) { if (mCanLoadMorePosts && !mIsFetchingPosts) { requestPosts(true); } } else if (mCanSearchMore && !mIsSearching) { mSearchOffset = mSearchResults.size(); mHandler.post(mSearchRunnable); } }
Source:
protected ContainerAttributesResource instantiateResource(ContainerAttributes entity) { return new ContainerAttributesResource(entity.getId(), entity.getPid(), entity.getHost(), entity.getIp()); }

Target:
protected ContainerAttributesResource instantiateResource(ContainerAttributes entity) { return new ContainerAttributesResource(entity); }
Source:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); final AsyncWorkerDataSet[] asyncWorkerDataSets = divideDataSets(); final ExecutorService executorService = Executors.newFixedThreadPool(numWorkerThreads); final Future[] futures = new Future[numWorkerThreads]; LOG.log(Level.INFO, "Initializing {0} worker threads", numWorkerThreads); for (int index = 0; index < numWorkerThreads; index++) { final Injector forkedInjector = injector.forkInjector(); forkedInjector.bindVolatileInstance(DataSet.class, asyncWorkerDataSets[index]); final Worker worker = forkedInjector.getInstance(Worker.class); final ParameterWorker parameterWorker = forkedInjector.getInstance(ParameterWorker.class); futures[index] = executorService.submit(new Runnable() { @Override public void run() { worker.initialize(); synchronizer.globalBarrier(); for (int iteration = 0; iteration < maxIterations; ++iteration) { if (aborted) { LOG.log(Level.INFO, "Abort a thread to completely close the task"); return; } worker.run(); parameterWorker.clock(); } synchronizer.globalBarrier(); worker.cleanup(); } }); } for (int index = 0; index < numWorkerThreads; index++) { futures[index].get(); } return null; }

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); final AsyncWorkerDataSet[] asyncWorkerDataSets = divideDataSets(); final ExecutorService executorService = Executors.newFixedThreadPool(numWorkerThreads); final Future[] futures = new Future[numWorkerThreads]; LOG.log(Level.INFO, "Initializing {0} worker threads", numWorkerThreads); for (int index = 0; index < numWorkerThreads; index++) { final Injector forkedInjector = injector.forkInjector(); forkedInjector.bindVolatileInstance(DataSet.class, asyncWorkerDataSets[index]); final Worker worker = forkedInjector.getInstance(Worker.class); futures[index] = executorService.submit(new Runnable() { @Override public void run() { worker.initialize(); synchronizer.globalBarrier(); for (int iteration = 0; iteration < maxIterations; ++iteration) { if (aborted) { LOG.log(Level.INFO, "Abort a thread to completely close the task"); return; } worker.run(); if (staleness >= 0) { parameterAccessor.clock(); } } synchronizer.globalBarrier(); worker.cleanup(); } }); } for (int index = 0; index < numWorkerThreads; index++) { futures[index].get(); } return null; }
Source:
public void testEmptyBinaryArray() throws SQLException { PreparedStatement pstmt = conn.prepareStatement("SELECT '{}'::int[]"); ((org.postgresql.PGStatement)pstmt).setPrepareThreshold(-1); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { Array array = rs.getArray(1); if (!rs.wasNull()) { ResultSet ars = array.getResultSet(); try { ars.getMetaData().getColumnType(1); } catch (NullPointerException ex) { assertTrue("should not get here",true); } } } }

Target:
public void testEmptyBinaryArray() throws SQLException { PreparedStatement pstmt = conn.prepareStatement("SELECT '{}'::int[]"); ((org.postgresql.PGStatement)pstmt).setPrepareThreshold(-1); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { Array array = rs.getArray(1); if (!rs.wasNull()) { ResultSet ars = array.getResultSet(); assertEquals("get columntype should return Types.INTEGER",java.sql.Types.INTEGER,ars.getMetaData().getColumnType(1)); } } }
Source:
public boolean exists(String path) throws IOException { Assert.hasText(path, "'path' must not be empty"); boolean exists = false; InputStream inputStream = null; try { inputStream = this.client.retrieveFileStream(path); } finally { if (inputStream != null) { inputStream.close(); if (!this.client.completePendingCommand()) { inputStream = null; } } } if (inputStream == null) { String currentWorkingPath = this.client.printWorkingDirectory(); Assert.state(currentWorkingPath != null, "working directory cannot be determined; exists check can not be completed"); try { exists = this.client.changeWorkingDirectory(path); } finally { this.client.changeWorkingDirectory(currentWorkingPath); } } else { exists = true; } return exists; }

Target:
public boolean exists(String path) throws IOException { Assert.hasText(path, "'path' must not be empty"); String[] names = this.client.listNames(path); boolean exists = !ObjectUtils.isEmpty(names); if (!exists) { String currentWorkingPath = this.client.printWorkingDirectory(); Assert.state(currentWorkingPath != null, "working directory cannot be determined; exists check can not be completed"); try { exists = this.client.changeWorkingDirectory(path); } finally { this.client.changeWorkingDirectory(currentWorkingPath); } } return exists; }
Source:
default boolean exist(@NotNull String accountId) throws ServerException { try { getById(requireNonNull(accountId, "Required non-null account id")); return true; } catch (NotFoundException ignored) { return false; } }

Target:
default boolean exist(@NotNull String accountId) throws ServerException { try { getById(requireNonNull(accountId, "Required non-null account id")); return true; } catch (NotFoundException nfEx) { return false; } }
Source:
public ResourceInvoker match(HttpRequest request, int start) { if (!CACHE) { return root.match(request, start).invoker; } MatchCache.Key key = new MatchCache.Key(request, start); MatchCache match = cache.get(key); if (match != null) { request.setAttribute(RESTEASY_CHOSEN_ACCEPT, match.chosen); } else { match = root.match(request, start); if (cache.size() < CACHE_SIZE && match.match != null && match.match.expression.getNumGroups() == 0 && match.invoker instanceof ResourceMethodInvoker) { match.match = null; { cache.putIfAbsent(key, match); } } } return match.invoker; }

Target:
public ResourceInvoker match(HttpRequest request, int start) { if (!CACHE || (request.getHttpHeaders().getMediaType() !=null && !request.getHttpHeaders().getMediaType().getParameters().isEmpty())) { return root.match(request, start).invoker; } MatchCache.Key key = new MatchCache.Key(request, start); MatchCache match = cache.get(key); if (match != null) { request.setAttribute(RESTEASY_CHOSEN_ACCEPT, match.chosen); } else { match = root.match(request, start); if (match.match != null && match.match.expression.getNumGroups() == 0 && match.invoker instanceof ResourceMethodInvoker) { match.match = null; if (cache.size() >= CACHE_SIZE) { cache.clear(); } cache.putIfAbsent(key, match); } } return match.invoker; }
Source:
public void init(final Collection<NamedIndexDir> luceneIndexes) { if (luceneIndexes == null || luceneIndexes.isEmpty()) { LOGGER.log(Level.INFO, "No index directories found, exiting..."); return; } if (!projectsEnabled && luceneIndexes.size() > 1) { throw new IllegalArgumentException("Projects are not enabled and multiple Lucene indexes were passed"); } synchronized (lock) { long startTime = System.currentTimeMillis(); LOGGER.log(Level.INFO, "Initializing suggester"); ExecutorService executor = Executors.newWorkStealingPool(rebuildParallelismLevel); for (NamedIndexDir indexDir : luceneIndexes) { submitInitIfIndexExists(executor, indexDir); } shutdownAndAwaitTermination(executor, startTime, "Suggester successfully initialized"); } }

Target:
public void init(final Collection<NamedIndexDir> luceneIndexes) { if (luceneIndexes == null || luceneIndexes.isEmpty()) { logger.log(Level.INFO, "No index directories found, exiting..."); return; } if (!projectsEnabled && luceneIndexes.size() > 1) { throw new IllegalArgumentException("Projects are not enabled and multiple Lucene indexes were passed"); } synchronized (lock) { Instant start = Instant.now(); logger.log(Level.INFO, "Initializing suggester"); ExecutorService executor = Executors.newWorkStealingPool(rebuildParallelismLevel); for (NamedIndexDir indexDir : luceneIndexes) { submitInitIfIndexExists(executor, indexDir); } shutdownAndAwaitTermination(executor, start, "Suggester successfully initialized"); } }
Source:
private void handleWanSyncAllMaps(HttpPostCommand command) throws UnsupportedEncodingException { String res; final String[] params = decodeParams(command, 4); final String wanRepName = params[0]; final String targetGroup = params[1]; final long fromTimestamp = params.length > 2 && params[2] != null ? Long.valueOf(params[2]) : Long.MIN_VALUE; final long toTimestamp = params.length > 3 && params[3] != null ? Long.valueOf(params[3]) : Long.MAX_VALUE; final WanReplicationService service = textCommandService.getNode().getNodeEngine().getWanReplicationService(); try { if (fromTimestamp == Long.MIN_VALUE && toTimestamp == Long.MAX_VALUE) { service.syncAllMaps(wanRepName, targetGroup); } else { service.syncAllMaps(wanRepName, targetGroup, fromTimestamp, toTimestamp); } res = response(ResponseType.SUCCESS, "message", "Sync initiated"); } catch (Exception ex) { logger.warning("Error occurred while syncing maps", ex); res = exceptionResponse(ex); } sendResponse(command, res); }

Target:
private void handleWanSyncAllMaps(HttpPostCommand command) throws UnsupportedEncodingException { String res; final String[] params = decodeParams(command, 4); final String wanRepName = params[0]; final String targetGroup = params[1]; final long fromTimestamp = params.length > 2 && params[2] != null ? Long.parseLong(params[2]) : Long.MIN_VALUE; final long toTimestamp = params.length > 3 && params[3] != null ? Long.parseLong(params[3]) : Long.MAX_VALUE; final WanReplicationService service = textCommandService.getNode().getNodeEngine().getWanReplicationService(); try { if (fromTimestamp == Long.MIN_VALUE && toTimestamp == Long.MAX_VALUE) { service.syncAllMaps(wanRepName, targetGroup); } else { service.syncAllMaps(wanRepName, targetGroup, fromTimestamp, toTimestamp); } res = response(ResponseType.SUCCESS, "message", "Sync initiated"); } catch (Exception ex) { logger.warning("Error occurred while syncing maps", ex); res = exceptionResponse(ex); } sendResponse(command, res); }
Source:
public static OVirtNodeInfo[] get() { final String prefix[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(":"); final String path[] = Config.resolveOVirtISOsRepositoryPath().split(":"); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(":"); if (prefix.length != minimumVersion.length || prefix.length != path.length) { throw new IllegalArgumentException("Illegal Node Info"); } List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); for (int i=0;i<prefix.length;i++) { info.add(new OVirtNodeInfo(prefix[i], path[i], minimumVersion[i])); } return info.toArray(new OVirtNodeInfo[info.size()]); }

Target:
public static OVirtNodeInfo[] get() { final String delimiter = ":"; final String prefix[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String path[] = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String pattern = Config.<String> GetValue(ConfigValues.OvirtPattern); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); if (prefix.length != minimumVersion.length || prefix.length != path.length) { throw new IllegalArgumentException("Illegal Node Info"); } List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); for (int i=0;i<prefix.length;i++) { info.add(new OVirtNodeInfo(prefix[i], path[i], minimumVersion[i], pattern)); } return info.toArray(new OVirtNodeInfo[info.size()]); }
Source:
protected void initializeConfigParams() { String value = null; try { value = getManagedProperty(DataSourceSettings.getInstance().getProperties(), DEPLOYMENTS_INITIALIZATION_RETRIES, Long.toString(deploymentsInitializationRetries)); deploymentsInitializationRetries = Long.parseLong(value); } catch (NumberFormatException e) { logger.warn("Wrong integer value: " + value + " was set for property: " + DEPLOYMENTS_INITIALIZATION_RETRIES); } try { value = getManagedProperty(DataSourceSettings.getInstance().getProperties(), DEPLOYMENTS_INITIALIZATION_DELAY, Long.toString(deploymentsInitializationDelay)); deploymentsInitializationDelay = Long.parseLong(value); } catch (NumberFormatException e) { logger.warn("Wrong integer value: " + value + " was set for property: " + DEPLOYMENTS_INITIALIZATION_DELAY); } }

Target:
protected void initializeConfigParams() { String value = null; try { value = getManagedProperty(DataSourceSettings.getInstance().getProperties(), DEPLOYMENTS_INITIALIZATION_RETRIES, Long.toString(deploymentsInitializationRetries)); deploymentsInitializationRetries = Long.parseLong(value); } catch (NumberFormatException e) { logger.warn("Wrong integer value: " + value + " was set for property: " + DEPLOYMENTS_INITIALIZATION_RETRIES + " The by default value: " + deploymentsInitializationRetries + " will be used instead."); } try { value = getManagedProperty(DataSourceSettings.getInstance().getProperties(), DEPLOYMENTS_INITIALIZATION_DELAY, Long.toString(deploymentsInitializationDelay)); deploymentsInitializationDelay = Long.parseLong(value); } catch (NumberFormatException e) { logger.warn("Wrong integer value: " + value + " was set for property: " + DEPLOYMENTS_INITIALIZATION_DELAY + " The by default value: " + deploymentsInitializationDelay + " will be used instead."); } }
Source:
public void service(HttpRequest request, HttpResponse response) throws IOException { String name; String contentType = request.getContentType().get(); switch (contentType) { case "application/json": JsonObject body = gson.fromJson(request.getReader(), JsonObject.class); if (body.has("name")) { name = body.get("name").getAsString(); break; } case "application/octet-stream": name = new String(Base64.getDecoder().decode(request.getInputStream().readAllBytes()), StandardCharsets.UTF_8); break; case "text/plain": name = request.getReader().readLine(); break; case "application/x-www-form-urlencoded": Optional<String> nameParam = request.getFirstQueryParameter("name"); if (nameParam.isPresent()) { name = nameParam.get(); break; } default: response.setStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); return; } if (name != null) { BufferedWriter writer = response.getWriter(); writer.write(String.format("Hello %s!", name)); } }

Target:
public void service(HttpRequest request, HttpResponse response) throws IOException { String name; String contentType = request.getContentType().orElse(""); switch (contentType) { case "application/json": JsonObject body = gson.fromJson(request.getReader(), JsonObject.class); if (body.has("name")) { name = body.get("name").getAsString(); break; } case "application/octet-stream": name = new String(Base64.getDecoder().decode(request.getInputStream().readAllBytes()), StandardCharsets.UTF_8); break; case "text/plain": name = request.getReader().readLine(); break; case "application/x-www-form-urlencoded": Optional<String> nameParam = request.getFirstQueryParameter("name"); if (nameParam.isPresent()) { name = nameParam.get(); break; } default: response.setStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); return; } if (name != null) { BufferedWriter writer = response.getWriter(); writer.write(String.format("Hello %s!", name)); } }
Source:
public void dispose() { mBaseHandler.removeCallbacksAndMessages(null); if(this.records != null) { this.records.removeAll(this.records); } this.records = null; this.mLock = null; this.adnCache = null; this.mBaseHandler = null; this.phone = null; }

Target:
public void dispose() { }
Source:
public void testLoadOrderedPublicEvents_10() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", "lastmodified") .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {"EVN21", "EVN20", "EVN25", "EVN24", "EVN23", "EVN192", "EVN191", "EVN194", "EVN193"}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } }

Target:
public void testLoadOrderedPublicEvents_10() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", "lastmodified") .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN21"))) .andExpect(jsonPath("$.payload[1].id", is("EVN20"))) .andExpect(jsonPath("$.payload[2].id", is("EVN25"))) .andExpect(jsonPath("$.payload[3].id", is("EVN24"))) .andExpect(jsonPath("$.payload[4].id", is("EVN23"))) .andExpect(jsonPath("$.payload[5].id", is("EVN192"))) .andExpect(jsonPath("$.payload[6].id", is("EVN191"))) .andExpect(jsonPath("$.payload[7].id", is("EVN194"))) .andExpect(jsonPath("$.payload[8].id", is("EVN193"))); }
Source:
abstract public void release() throws PublisherException; } private Node tail = new Node(null, 0); private int windowCount; public synchronized void add(PublisherPush item) throws PublisherException { Node prev = tail; tail = new Node(item, windowCount); if (windowCount == 0) item.close(); prev.setNext(tail); }

Target:
abstract public void release() throws PublisherException; } private Node tail = new Node(null, 0); private int windowCount; public synchronized void add(PublisherPush item) throws PublisherException { boolean hasWindows; synchronized (this) { hasWindows = windowCount != 0; if (hasWindows) { Node prev = tail; tail = new Node(item, windowCount); prev.setNext(tail); } } if (!hasWindows) item.close(); }
Source:
public boolean matches(Calendar cal) { long matchStart = start != null ? start.getTimeInMillis() : DateTimeUtils.truncateToMidnight(cal).getTimeInMillis(); long matchEnd = end != null ? end.getTimeInMillis() : DateTimeUtils.truncateToMidnight(cal).getTimeInMillis(); return cal.getTimeInMillis() >= matchStart && cal.getTimeInMillis() < matchEnd; }

Target:
public boolean matches(Calendar cal) { if (start == null && end == null) { return false; } long matchStart = start != null ? start.getTimeInMillis() : DateTimeUtils.truncateToMidnight(cal).getTimeInMillis(); long matchEnd = end != null ? end.getTimeInMillis() : DateTimeUtils.endOfDayDate(cal).getTimeInMillis(); return cal.getTimeInMillis() >= matchStart && cal.getTimeInMillis() < matchEnd; }
Source:
public void testInit() { final DataTypeListItem expectedListItem = mock(DataTypeListItem.class); final DataType datatype = mock(DataType.class); final String expectedConstraint = "constraint"; final ConstraintType expectedType = mock(ConstraintType.class); when(expectedListItem.getDataType()).thenReturn(datatype); when(datatype.getConstraint()).thenReturn(expectedConstraint); when(datatype.getConstraintType()).thenReturn(expectedType); dataTypeConstraint.init(expectedListItem); final DataTypeListItem actualListItem = dataTypeConstraint.getListItem(); final String actualConstraint = dataTypeConstraint.getValue(); final ConstraintType actualType = dataTypeConstraint.getConstraintType(); assertEquals(expectedType, actualType); assertEquals(expectedListItem, actualListItem); assertEquals(expectedConstraint, actualConstraint); verify(dataTypeConstraint).refreshView(); verify(datatype).getConstraintType(); verify(datatype).getConstraintType(); }

Target:
public void testInit() { final DataTypeListItem expectedListItem = mock(DataTypeListItem.class); final DataType datatype = mock(DataType.class); final String expectedConstraint = "constraint"; final ConstraintType expectedType = mock(ConstraintType.class); when(expectedListItem.getDataType()).thenReturn(datatype); when(datatype.getConstraint()).thenReturn(expectedConstraint); when(datatype.getConstraintType()).thenReturn(expectedType); dataTypeConstraint.init(expectedListItem); final DataTypeListItem actualListItem = dataTypeConstraint.getListItem(); final String actualConstraint = dataTypeConstraint.getValue(); final ConstraintType actualType = dataTypeConstraint.getConstraintType(); assertEquals(expectedType, actualType); assertEquals(expectedListItem, actualListItem); assertEquals(expectedConstraint, actualConstraint); verify(dataTypeConstraint).refreshView(); }
Source:
private boolean hasNewServers(VDSGroup cluster, List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { if (GlusterFeatureSupported.glusterHostUuidSupported(cluster.getcompatibility_version())) { for (GlusterServerInfo fetchedServer : fetchedServers) { GlusterServer glusterServer = getGlusterServerDao().getByGlusterServerUuid(fetchedServer.getUuid()); if (glusterServer == null || getVdsDao().get(glusterServer.getId()) == null) { return true; } } } else { for (GlusterServerInfo fetchedServer : fetchedServers) { for (VDS existingServer: existingServers) { List<String> vdsIps = getVdsIps(existingServer); if (!fetchedServer.getHostnameOrIp().equals(existingServer.getHostName()) && !vdsIps.contains(fetchedServer.getHostnameOrIp())) { return true; } } } } return false; }

Target:
private boolean hasNewServers(VDSGroup cluster, List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { if (GlusterFeatureSupported.glusterHostUuidSupported(cluster.getcompatibility_version())) { for (GlusterServerInfo fetchedServer : fetchedServers) { GlusterServer glusterServer = getGlusterServerDao().getByGlusterServerUuid(fetchedServer.getUuid()); if (glusterServer == null) { return true; } } } else { for (GlusterServerInfo fetchedServer : fetchedServers) { for (VDS existingServer: existingServers) { List<String> vdsIps = getVdsIps(existingServer); if (!fetchedServer.getHostnameOrIp().equals(existingServer.getHostName()) && !vdsIps.contains(fetchedServer.getHostnameOrIp())) { return true; } } } } return false; }
Source:
private HyperparameterValues calculateMLEHyperparameterValues(final AllelicCountCollection counts) { double meanBias = AlleleFractionInitializer.INITIAL_MEAN_BIAS; double biasVariance = AlleleFractionInitializer.INITIAL_BIAS_VARIANCE; double previousIterationLogLikelihood; double nextIterationLogLikelihood = Double.NEGATIVE_INFINITY; int iteration = 1; logger.info(String.format("Initializing MLE hyperparameter values for allelic panel of normals. Iterating until log likelihood converges to within %.3f.", AlleleFractionInitializer.LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD)); do { previousIterationLogLikelihood = nextIterationLogLikelihood; meanBias = estimateMeanBias(meanBias, biasVariance, counts); biasVariance = estimateBiasVariance(meanBias, biasVariance, counts); nextIterationLogLikelihood = AlleleFractionLikelihoods.logLikelihoodForAllelicPanelOfNormals(meanBias, biasVariance, counts); logger.info(String.format("Iteration %d, model log likelihood = %.3f.", iteration, nextIterationLogLikelihood)); iteration++; } while (iteration < AlleleFractionInitializer.MAX_ITERATIONS && nextIterationLogLikelihood - previousIterationLogLikelihood > AlleleFractionInitializer.LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD); final double alpha = alpha(meanBias, biasVariance); final double beta = beta(meanBias, biasVariance); logger.info("MLE hyperparameter values for allelic panel of normals found:"); logger.info("alpha = " + alpha); logger.info("beta = " + beta); return new HyperparameterValues(alpha, beta); }

Target:
private HyperparameterValues calculateMLEHyperparameterValues(final AllelicCountCollection counts) { double meanBias = AlleleFractionInitializer.INITIAL_MEAN_BIAS; double biasVariance = AlleleFractionInitializer.INITIAL_BIAS_VARIANCE; double previousIterationLogLikelihood; double nextIterationLogLikelihood = Double.NEGATIVE_INFINITY; logger.info(String.format("Initializing MLE hyperparameter values for allelic panel of normals. Iterating until log likelihood converges to within %.3f.", AlleleFractionInitializer.LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD)); int iteration = 1; do { previousIterationLogLikelihood = nextIterationLogLikelihood; meanBias = estimateMeanBias(meanBias, biasVariance, counts); biasVariance = estimateBiasVariance(meanBias, biasVariance, counts); nextIterationLogLikelihood = AlleleFractionLikelihoods.logLikelihoodForAllelicPanelOfNormals(meanBias, biasVariance, counts); logger.info(String.format("Iteration %d, model log likelihood = %.3f.", iteration, nextIterationLogLikelihood)); iteration++; } while (iteration < AlleleFractionInitializer.MAX_ITERATIONS && nextIterationLogLikelihood - previousIterationLogLikelihood > AlleleFractionInitializer.LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD); final double alpha = alpha(meanBias, biasVariance); final double beta = beta(meanBias, biasVariance); logger.info("MLE hyperparameter values for allelic panel of normals found:"); logger.info("alpha = " + alpha); logger.info("beta = " + beta); return new HyperparameterValues(alpha, beta); }
Source:
private Double calculateSelfHealEta() { if (this.getUnSyncedEntries() == null || this.getUnSyncedEntriesTrend() == null || this.getUnSyncedEntriesTrend().size() < 2) { return 0D; } List<Double> healRates = new ArrayList<>(); for (int index = 0; index < this.getUnSyncedEntriesTrend().size() - 1; index++) { Integer entries = this.unSyncedEntriesTrend.get(index); Integer entriesRemaining = this.unSyncedEntriesTrend.get(index); if (entries >= 0 && entriesRemaining >= 0) { double healRate = ((double) entries - entriesRemaining) / (Config.<Integer> getValue(ConfigValues.GlusterRefreshRateHealInfo)); if (healRate > 0) { healRates.add(healRate); } } } if (healRates.isEmpty()) { return 0D; } Double healRateSum = 0D; for (Double healRate : healRates) { healRateSum += healRate; } Double healRateAvg = healRateSum / healRates.size(); return this.getUnSyncedEntries() / healRateAvg; }

Target:
private Double calculateSelfHealEta() { if (this.getUnSyncedEntries() == null || this.getUnSyncedEntriesTrend() == null || this.getUnSyncedEntriesTrend().size() < 2) { return 0D; } List<Double> healRates = new ArrayList<>(); for (int index = 0; index < this.getUnSyncedEntriesTrend().size() - 1; index++) { Integer entries = this.unSyncedEntriesTrend.get(index); Integer entriesRemaining = this.unSyncedEntriesTrend.get(index + 1); if (entries >= 0 && entriesRemaining >= 0) { double healRate = ((double) entries - entriesRemaining) / (Config.<Integer> getValue(ConfigValues.GlusterRefreshRateHealInfo)); if (healRate > 0) { healRates.add(healRate); } } } if (healRates.isEmpty()) { return 0D; } Double healRateSum = 0D; for (Double healRate : healRates) { healRateSum += healRate; } Double healRateAvg = healRateSum / healRates.size(); return this.getUnSyncedEntries() / healRateAvg; }
Source:
public final int hashCode() { if (hashCode == Utils.NO_HASHCODE) { int accum = computeHash(); hashCode = accum == 0 ? 1 : accum; } return hashCode; }

Target:
public final int hashCode() { int h = hashCode; if (h == Utils.NO_HASHCODE) { h = computeHash(); hashCode = h == 0 ? 1 : h; } return h; }
Source:
protected void serializeToFile(Component component, Object from) throws IOException { String jsonOutputString = gson.toJson(from); try { checkComplianceWithSchema(jsonOutputString); } catch (ValidationException exception) { log.error(component.getKey() + " json not compliant with schema"); throw exception; } File file = new File(outputDirectory, component.getKey() + ".json"); log.info("Generate json data for plugin " + component.getKey() + " in: " + file); FileUtils.writeStringToFile(file, jsonOutputString, UTF_8); FileUtils.copyURLToFile( PluginsJsonGenerator.class.getResource("/" + resourceFile), new File(outputDirectory, resourceFile)); }

Target:
protected void serializeToFile(Component component, Object from) throws IOException { String jsonOutputString = gson.toJson(from); try { checkComplianceWithSchema(jsonOutputString); } catch (ValidationException exception) { log.error(component.getKey() + " json not compliant with schema"); throw exception; } File file = new File(outputDirectory, component.getKey() + ".json"); log.info("Generate json data for component " + component.getKey() + " in: " + file); FileUtils.writeStringToFile(file, jsonOutputString, UTF_8); FileUtils.copyURLToFile( PluginsJsonGenerator.class.getResource("/" + resourceFile), new File(outputDirectory, resourceFile)); }
Source:
protected void runWrongValidationTest(boolean skipGetModel) { model.setValue(-123); model.getUser().setLastName(""); model.getUser().setAddress(""); assertFalse(formHandler.validate()); verify(proxy).deepUnwrap(); if (!skipGetModel) { verify(binder, times(formFieldProvider.getAll().size() + 1)).getModel(); verify(proxy, times(formFieldProvider.getAll().size())).get(anyString()); } assertFalse(formHandler.validate(VALUE_FIELD)); assertTrue(formHandler.validate(USER_NAME_FIELD)); assertFalse(formHandler.validate(USER_LAST_NAME_FIELD)); assertTrue(formHandler.validate(USER_BIRTHDAY_FIELD)); assertTrue(formHandler.validate(USER_MARRIED_FIELD)); assertFalse(formHandler.validate(USER_ADDRESS_FIELD)); verify(proxy, times(7)).deepUnwrap(); }

Target:
protected void runWrongValidationTest(boolean skipGetModel) { model.setValue(-123); model.getUser().setLastName(""); model.getUser().setAddress(""); assertFalse(formHandler.validate()); verify(proxy).deepUnwrap(); if (!skipGetModel) { verify(binder, times(7)).getModel(); verify(proxy, times(6)).get(anyString()); } assertFalse(formHandler.validate(VALUE_FIELD_NAME)); assertTrue(formHandler.validate(USER_NAME_FIELD_NAME)); assertFalse(formHandler.validate(USER_LAST_NAME_FIELD_NAME)); assertTrue(formHandler.validate(USER_BIRTHDAY_FIELD_NAME)); assertTrue(formHandler.validate(USER_MARRIED_FIELD_NAME)); assertFalse(formHandler.validate(USER_ADDRESS_FIELD_NAME)); verify(proxy, times(7)).deepUnwrap(); }
Source:
public <T extends RealType<T>> boolean areCongruent(final IterableInterval<T> in, final RandomAccessible<T> out, final double epsilon){ Cursor<T> cin = in.localizingCursor(); RandomAccess<T> raOut = out.randomAccess(); while(cin.hasNext()){ cin.fwd(); raOut.setPosition(cin); if((cin.get().getRealDouble() - raOut.get().getRealDouble()) > epsilon) return false; } return true; }

Target:
public <T extends RealType<T>> boolean areCongruent(final IterableInterval<T> in, final RandomAccessible<T> out, final double epsilon){ Cursor<T> cin = in.localizingCursor(); RandomAccess<T> raOut = out.randomAccess(); while(cin.hasNext()){ cin.fwd(); raOut.setPosition(cin); if(Math.abs(cin.get().getRealDouble() - raOut.get().getRealDouble()) > epsilon) return false; } return true; }
Source:
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); element.setAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE, ProcessingConfig.Test.class.getCanonicalName()); List<Element> list = DomUtils.getChildElements(element); ManagedList tests = new ManagedList(list.size()); for (Element el : list){ if (!el.getAttribute(XMLConstants.ATTRIBUTE_REF).isEmpty()){ tests.add(new RuntimeBeanReference(el.getAttribute(XMLConstants.ATTRIBUTE_REF))); }else{ if (el.getTagName().equals(XMLConstants.TEST)){ tests.add(parserContext.getDelegate().parseCustomElement(el, builder.getBeanDefinition())); }else{ if (el.getTagName().equals(XMLConstants.ATTRIBUTE_REF)){ if (!el.getAttribute(XMLConstants.LOCAL).isEmpty()){ tests.add(new RuntimeBeanReference(el.getAttribute(XMLConstants.LOCAL))); }else{ tests.add(new RuntimeBeanReference(el.getAttribute(XMLConstants.BEAN))); } } } } } builder.addPropertyValue(XMLConstants.TESTS,tests); }

Target:
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); element.setAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE, ProcessingConfig.Test.class.getCanonicalName()); List<Element> list = DomUtils.getChildElements(element); ManagedList tests = new ManagedList(list.size()); for (Element el : list){ if (!el.getAttribute(XMLConstants.ATTRIBUTE_REF).isEmpty()){ tests.add(new RuntimeBeanReference(el.getAttribute(XMLConstants.ATTRIBUTE_REF))); }else{ tests.add(parserContext.getDelegate().parsePropertySubElement(el, builder.getBeanDefinition())); } } builder.addPropertyValue(XMLConstants.TESTS,tests); }
Source:
public String getBundleDir() { if (configurationService != null) { BootstrapConfig bootstrapConfig = configurationService.loadBootstrapConfig(); if (bootstrapConfig != null) { return bootstrapConfig.getMotechDir() + "/bundles"; } } return bundleDir; }

Target:
public String getBundleDir() { return bundleDir; }
Source:
V call(@Nonnull Callable<V,T> callable, @CheckForNull Duration performTimeout, @CheckForNull Duration executionTimeout) throws IOException, T, InterruptedException { UserRequest<V,T> request=null; try(Timeout t = Timeout.optLimit(executionTimeout)) { request = new UserRequest<V, T>(this, callable, performTimeout, executionTimeout); UserResponse<V,T> r = request.call(this); return r.retrieve(this, UserRequest.getClassLoader(callable)); } catch (ClassNotFoundException e) { IOException x = new IOException("Remote call on "+name+" failed"); x.initCause(e); throw x; } catch (Error e) { IOException x = new IOException("Remote call on "+name+" failed"); x.initCause(e); throw x; } finally { if(request!=null) request.releaseExports(); } }

Target:
V call(@Nonnull Callable<V,T> callable, @CheckForNull Duration performTimeout, @CheckForNull Duration executionTimeout) throws IOException, T, InterruptedException { if (isClosingOrClosed()) { throw new ChannelClosedException("Remote call on " + name + " failed. " + "The channel is closing down or has closed down", getCloseRequestCause()); } UserRequest<V,T> request=null; try(Timeout t = Timeout.optLimit(executionTimeout)) { request = new UserRequest<V, T>(this, callable, performTimeout, executionTimeout); UserResponse<V,T> r = request.call(this); return r.retrieve(this, UserRequest.getClassLoader(callable)); } catch (ClassNotFoundException e) { IOException x = new IOException("Remote call on "+name+" failed"); x.initCause(e); throw x; } catch (Error e) { IOException x = new IOException("Remote call on "+name+" failed"); x.initCause(e); throw x; } finally { if(request!=null) request.releaseExports(); } }
Source:
private LineNumberRulerColumn createLineNumberRulerColumn() { LineNumberRulerColumn lnrc = new LineNumberRulerColumn() { @Override protected String createDisplayString(int line) { line -= prefixeLineCount; return super.createDisplayString(line); } }; lnrc.setForeground(getViewer().getTextWidget().getForeground()); lnrc.setBackground(getViewer().getTextWidget().getBackground()); return lnrc; }

Target:
private LineNumberRulerColumn createLineNumberRulerColumn() { LineNumberRulerColumn lnrc = new LineNumberRulerColumn() { @Override protected String createDisplayString(int line) { line -= prefixLineCount; return super.createDisplayString(line); } }; lnrc.setForeground(getViewer().getTextWidget().getForeground()); lnrc.setBackground(getViewer().getTextWidget().getBackground()); return lnrc; }
Source:
public void testChangeTheStatusOfTheAPIToDeprecated() throws Exception { restAPIPublisher.changeAPILifeCycleStatus(apiId, APILifeCycleAction.DEPRECATE.getAction()); assertTrue(restAPIPublisher.getLifecycleStatus(apiId).getData().equals("Deprecated"), apiNameTest + " status not updated as Deprecate"); HttpResponse deprecatedApiResponse = restAPIPublisher.getAPI(apiId); assertEquals(deprecatedApiResponse.getResponseCode(), Response.Status.OK.getStatusCode(), apiNameTest + " is not visible in publisher"); assertTrue(deprecatedApiResponse.getData().contains(apiNameTest), apiNameTest + " is not visible in " + "publisher"); }

Target:
public void testChangeTheStatusOfTheAPIToDeprecated() throws Exception { restAPIPublisher.changeAPILifeCycleStatus(apiId, APILifeCycleAction.DEPRECATE.getAction()); assertTrue(APILifeCycleState.DEPRECATED.getState().equals(restAPIPublisher.getLifecycleStatus(apiId).getData()), apiNameTest + " status not updated as Deprecate"); HttpResponse deprecatedApiResponse = restAPIPublisher.getAPI(apiId); assertEquals(deprecatedApiResponse.getResponseCode(), Response.Status.OK.getStatusCode(), apiNameTest + " is not visible in publisher"); assertTrue(deprecatedApiResponse.getData().contains(apiNameTest), apiNameTest + " is not visible in " + "publisher"); }
Source:
private void changeTheme() { radiotDarkBtn = (RadioButton) getView().findViewById(R.id.radiotDarkBtn); radiotLightBtn = (RadioButton)getView().findViewById(R.id.radiotLightBtn); if(Utility.getTheme(getApplicationContext()) == PhimpMe.THEME_dark) { radiotLightBtn.setChecked(false); radiotDarkBtn.setChecked(true); }else { radiotDarkBtn.setChecked(false); radiotLightBtn.setChecked(true); } radiotDarkBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Utility.setTheme(getApplicationContext(), 2); recreateActivity(); } }); radiotLightBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Utility.setTheme(getApplicationContext(), 1); recreateActivity(); } }); }

Target:
private void changeTheme() { radiotDarkBtn = (RadioButton) getView().findViewById(R.id.radiotDarkBtn); radiotLightBtn = (RadioButton)getView().findViewById(R.id.radiotLightBtn); if(Utility.getTheme(getApplicationContext()) == PhimpMe.ThemeDark) { radiotLightBtn.setChecked(false); radiotDarkBtn.setChecked(true); } else { radiotDarkBtn.setChecked(false); radiotLightBtn.setChecked(true); } radiotDarkBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Utility.setTheme(getApplicationContext(), 2); recreateActivity(); } }); radiotLightBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Utility.setTheme(getApplicationContext(), 1); recreateActivity(); } }); }
Source:
private void impl$addAndApplyTradeMutators(MerchantOffers givenMerchantOffers, VillagerTrades.ITrade[] newTrades, int maxNumbers, CallbackInfo ci) { if ((Object) this instanceof VillagerEntity) { VillagerEntity villager = (VillagerEntity) (Object) this; SpongeVillagerRegistry.getInstance().populateOffers((Villager) this, (List<TradeOffer>) (List<?>) impl$newOffers, (Profession) villager.getVillagerData().getProfession(), villager.getVillagerData().getLevel(), this.rand); givenMerchantOffers.addAll(this.impl$newOffers); this.impl$newOffers.clear(); } }

Target:
protected void impl$addAndApplyTradeMutators(MerchantOffers givenMerchantOffers, VillagerTrades.ITrade[] newTrades, int maxNumbers, CallbackInfo ci) { }
Source:
protected String doInBackground(String... params) { String fullUri = params[0] + params[1]; Log.v(TAG, "Calling Rest API at " + fullUri); if (params.length >= 5) { LinkedList<NameValuePair> urlParams = new LinkedList<>(); int paramCounter = 3; while (paramCounter + 1 < params.length) { urlParams.add(new BasicNameValuePair(params[paramCounter++], params[paramCounter++])); } fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); } for (int i = 0; i < 10; i++) { HttpClient httpclient = Https.createHttpsClient(mHttpsCertPath); HttpGet get = new HttpGet(fullUri); get.addHeader(new BasicHeader(RestApi.HEADER_API_KEY, params[2])); if (isCancelled()) return null; try { HttpResponse response = httpclient.execute(get); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream is = entity.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; String result = ""; while ((line = br.readLine()) != null) { result += line; } br.close(); Log.v(TAG, "API call result: " + result); return result; } } catch (IOException|IllegalArgumentException e) { Log.w(TAG, "Failed to call Rest API at " + fullUri, e); } try { Thread.sleep(500 * i); } catch (InterruptedException e) { Log.w(TAG, e); } Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)"); } return null; }

Target:
protected String doInBackground(String... params) { String fullUri = params[0] + params[1]; Log.v(TAG, "Calling Rest API at " + fullUri); if (params.length >= 5) { LinkedList<NameValuePair> urlParams = new LinkedList<>(); for (int paramCounter = 3; paramCounter + 1 < params.length; ) { urlParams.add(new BasicNameValuePair(params[paramCounter++], params[paramCounter++])); } fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); } for (int i = 0; i < 10; i++) { HttpClient httpclient = Https.createHttpsClient(mHttpsCertPath); HttpGet get = new HttpGet(fullUri); get.addHeader(new BasicHeader(RestApi.HEADER_API_KEY, params[2])); if (isCancelled()) return null; try { HttpResponse response = httpclient.execute(get); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream is = entity.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; String result = ""; while ((line = br.readLine()) != null) { result += line; } br.close(); Log.v(TAG, "API call result: " + result); return result; } } catch (IOException|IllegalArgumentException e) { Log.w(TAG, "Failed to call Rest API at " + fullUri, e); } try { Thread.sleep(500 * i); } catch (InterruptedException e) { Log.w(TAG, e); } Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)"); } return null; }
Source:
public synchronized int decrementInstallCount() throws CoreException { int count = 0; if(this.getMarker().getAttribute(MOVE_BACK_BREAKPOINT)!=null && this.getMarker().getAttribute(MOVE_BACK_BREAKPOINT).equals(Boolean.TRUE)){ count = super.decrementInstallCount(); if (count == 0) { resetInstalledLocation(); } } return count; }

Target:
public synchronized int decrementInstallCount() throws CoreException { int count = super.decrementInstallCount(); if(Boolean.TRUE.equals(this.getMarker().getAttribute(RESET_INSTALLED_LOCATION))){ if (count == 0) { resetInstalledLocation(); } } return count; }
Source:
public void initialise() throws IOException { myRes = getDataDirectory().get("/mydir/myres"); try (OutputStreamWriter os = new OutputStreamWriter(myRes.out())) { os.append("This is my test."); } try (OutputStreamWriter os = new OutputStreamWriter(getDataDirectory().get("/mydir2/fake.png").out())) { os.append("This is not a real png file."); } IOUtils.copyStream(getClass().getResourceAsStream("testimage.png"), getDataDirectory().get("/mydir2/imagewithoutextension").out(), true, true); }

Target:
public void initialise() throws IOException { myRes = getDataDirectory().get("/mydir/myres"); try (OutputStreamWriter os = new OutputStreamWriter(myRes.out())) { os.append(STR_MY_TEST); } try (OutputStreamWriter os = new OutputStreamWriter(getDataDirectory().get("/mydir2/fake.png").out())) { os.append("This is not a real png file."); } try (OutputStreamWriter os = new OutputStreamWriter(getDataDirectory().get("/poëzie/café").out())) { os.append("The content of this file is irrelevant."); } IOUtils.copyStream(getClass().getResourceAsStream("testimage.png"), getDataDirectory().get("/mydir2/imagewithoutextension").out(), true, true); }