auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Note getNoteFromUrl(final String hash, AuthenticationInfo subject) throws IOException { Callable<Note> task = new Callable<Note>() { @Override public Note call() throws Exception { return getNote(hash); } }; Future<Note> noteFuture = executorService.submit(task); Note note = null; try { note = noteFuture.get(15, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Failed to download Note, Interrupted", e); } catch (ExecutionException e) { LOG.error("Failed to get note", e); Throwable cause = e.getCause(); if (cause instanceof IOException) throw (IOException) cause; } catch (TimeoutException e) { LOG.error("TimeOut reached", e); } finally { noteFuture.cancel(true); } return note; }

Target:
public Note getNoteFromUrl(final String hash, AuthenticationInfo subject) throws IOException { Callable<Note> task = new Callable<Note>() { @Override public Note call() throws Exception { return getNote(hash); } }; Future<Note> noteFuture = executorService.submit(task); Note note = null; try { note = noteFuture.get(15, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Failed to download Note, Interrupted", e); } catch (ExecutionException e) { LOG.error("Failed to get note", e); Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } } catch (TimeoutException e) { LOG.error("TimeOut reached", e); } finally { noteFuture.cancel(true); } return note; }
Source:
public PostListingController(PostListingURL url, final Context context) { if(url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) { if(url.asSubredditPostListURL().order == null) { url = url.asSubredditPostListURL().sort(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { if(url.asUserPostListURL().order == null) { url = url.asUserPostListURL().sort(defaultOrder(context)); } } this.url = url; }

Target:
public PostListingController(PostListingURL url, final Context context) { if(url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) { if(url.asSubredditPostListURL().order == null) { url = url.asSubredditPostListURL().sort(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { if(url.asUserPostListURL().order == null) { url = url.asUserPostListURL().sort(PostSort.NEW); } } this.url = url; }
Source:
private long getMillisSinceLastCompact() { AgnosticResultSet rs = conns.get().selectResultSetUnregisteredQuery( "SELECT FLOOR(EXTRACT(EPOCH FROM GREATEST( " + " last_vacuum, last_autovacuum, last_analyze, last_autoanalyze" + "))*1000) AS last, " + "FLOOR(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)*1000) AS current " + "FROM pg_stat_user_tables WHERE relname = ?", prefixedTableName()); AgnosticResultRow row = Iterables.getOnlyElement(rs.rows()); long last = row.getLong("last", -1); if (last == -1) { return Long.MAX_VALUE; } long current = row.getLong("current"); return current - last; }

Target:
private long getMillisSinceLastCompact() { AgnosticResultSet rs = conns.get().selectResultSetUnregisteredQuery( "SELECT FLOOR(EXTRACT(EPOCH FROM GREATEST( " + " last_vacuum, last_autovacuum, last_analyze, last_autoanalyze" + "))*1000) AS last, " + "FLOOR(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)*1000) AS current " + "FROM pg_stat_user_tables WHERE relname = ?", prefixedTableName()); AgnosticResultRow row = Iterables.getOnlyElement(rs.rows()); Optional<Long> lastVacuumTime = getLastVacuumTime(row); if (vacuumWasNeverRun(lastVacuumTime)) { return Long.MAX_VALUE; } long currentVacuumTime = row.getLong("current"); long timeSinceLastCompact = currentVacuumTime - lastVacuumTime.orElseThrow( () -> new IllegalStateException("Should not calculate time since last compact if it doesn't exist!")); log.info("For table {}, we compacted ms ago", timeSinceLastCompact, prefixedTableName()); return timeSinceLastCompact; }
Source:
static void clientWithQueryOptions(DatabaseId db) { SpannerOptions options = SpannerOptions.newBuilder() .setDefaultQueryOptions( db, QueryOptions.newBuilder().setOptimizerVersion("latest").build()) .build(); Spanner spanner = options.getService(); DatabaseClient dbClient = spanner.getDatabaseClient(db); try (ResultSet resultSet = dbClient .singleUse() .executeQuery(Statement.of("SELECT SingerId, AlbumId, AlbumTitle FROM Albums"))) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }

Target:
static void clientWithQueryOptions(DatabaseId db) { SpannerOptions options = SpannerOptions.newBuilder() .setDefaultQueryOptions( db, QueryOptions.newBuilder().setOptimizerVersion("1").build()) .build(); Spanner spanner = options.getService(); DatabaseClient dbClient = spanner.getDatabaseClient(db); try (ResultSet resultSet = dbClient .singleUse() .executeQuery(Statement.of("SELECT SingerId, AlbumId, AlbumTitle FROM Albums"))) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }
Source:
public void bundleChanged(BundleEvent event) { int eventType = event.getType(); if (eventType == BundleEvent.STARTING) { progressMonitor.split(5); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); spinEventQueueToUpdateUi(displayForStartupListener); } if (eventType == BundleEvent.STARTED) { progressMonitor.split(5); progressMonitor.subTask(WorkbenchMessages.Startup_Loading_Workbench); } }

Target:
public void bundleChanged(BundleEvent event) { int eventType = event.getType(); if (eventType == BundleEvent.STARTING) { progressMonitor.split(9); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); spinEventQueueToUpdateUi(displayForStartupListener); } if (eventType == BundleEvent.STARTED) { progressMonitor.split(9); progressMonitor.subTask(WorkbenchMessages.Startup_Loading_Workbench); } }
Source:
protected int getMaxBinSize() { if (maxBinSize == -1) { maxBinSize = calculateBinIndex(maxFileSizeUpperBound) + 1; } return maxBinSize; }

Target:
int getMaxBinSize() { if (maxBinSize == -1) { maxBinSize = nextClosestPowerIndexOfTwo(maxFileSizeUpperBound) - 10 + 1; } return maxBinSize; }
Source:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableListMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }

Target:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }
Source:
private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) { if (bond.getBonding().isSetSlaves()) { for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) { if (!slave.isSetName() && slave.isSetId()){ Guid slaveId = new Guid(slave.getId()); String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName(); slave.setName(slaveNameFromBackend); } } } }

Target:
private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) { if (bond.isSetBonding() && bond.getBonding().isSetSlaves()) { for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) { if (!slave.isSetName() && slave.isSetId()){ Guid slaveId = new Guid(slave.getId()); String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName(); slave.setName(slaveNameFromBackend); } } } }
Source:
public String getExceptionMessage(Throwable t) { if (t instanceof CompletionException) { Throwable cause = t.getCause(); if (cause != null) t = cause; } String message = t.getLocalizedMessage(); if (t instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t; final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } if (StringUtils.isEmpty(message) && t.getCause() != null) { if (t.getCause() instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t.getCause(); final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } else { message = t.getCause().getLocalizedMessage(); } } if (StringUtils.isEmpty(message)) { message = t.toString(); } return message; }

Target:
public String getExceptionMessage(Throwable t) { if (t instanceof CompletionException) { Throwable cause = t.getCause(); if (cause != null) return getExceptionMessage(cause); } String message = t.getLocalizedMessage(); if (t instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t; final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } if (StringUtils.isEmpty(message) && t.getCause() != null) { if (t.getCause() instanceof LocalizedException) { final LocalizedException localizedException = (LocalizedException) t.getCause(); final String key = localizedException.getMessageKey(); if (keysMap.containsKey(key)) { message = getLocalizedMessage(keysMap.get(key), (Object[]) localizedException.getMessageParameters()); } } else { message = t.getCause().getLocalizedMessage(); } } if (StringUtils.isEmpty(message)) { message = t.toString(); } return message; }
Source:
private void testStartAndCompleteTask(ResponseHandler responseHandler) { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertThat(processInstanceId).isNotNull(); List<ProcessInstance> processInstances = queryClient.findProcessInstances(0, 100); assertThat(processInstances).isNotNull().hasSize(1); assertThat(processInstances.get(0)).isNotNull(); assertThat(processInstances.get(0).getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE); List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); Long taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); delay(); taskClient.setResponseHandler(new RequestReplyResponseHandler()); tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); delay(); ProcessInstance processInstance = queryClient.findProcessInstanceById(processInstanceId); assertThat(processInstance).isNotNull(); assertThat(processInstance.getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED); }

Target:
private void testStartAndCompleteTask(ResponseHandler responseHandler) throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertThat(processInstanceId).isNotNull(); List<ProcessInstance> processInstances = queryClient.findProcessInstances(0, 100); assertThat(processInstances).isNotNull().hasSize(1); assertThat(processInstances.get(0)).isNotNull(); assertThat(processInstances.get(0).getState()).isEqualTo(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE); List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); Long taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); taskClient.setResponseHandler(new RequestReplyResponseHandler()); KieServerSynchronization.waitForTaskStatus(taskClient, taskId, Status.Completed.name()); tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertThat(tasks).hasSize(1); taskId = tasks.get(0).getId(); taskClient.setResponseHandler(responseHandler); taskClient.startTask(CONTAINER_ID, taskId, USER_YODA); taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>()); KieServerSynchronization.waitForProcessInstanceToFinish(processClient, CONTAINER_ID, processInstanceId); }
Source:
public void testTDJobRequestParamsWithHiveEngineVersion() throws Exception { Path projectPath = Paths.get("").normalize().toAbsolutePath(); Config config = newConfig() .set("database", "testdb") .set("query", "select 1") .set("engine", "hive") .set("hive_engine_version", "stable") .set("presto_engine_version", "current"); when(op.submitNewJobWithRetry(any(TDJobRequest.class))).thenReturn(""); when(op.getDatabase()).thenReturn("testdb"); TDJobRequest jobRequest = testTDJobRequestParams(projectPath, config); assertEquals("testdb", jobRequest.getDatabase()); assertEquals("select 1", jobRequest.getQuery()); assertEquals("hive", jobRequest.getType().toString() ); assertTrue(jobRequest.getEngineVersion().isPresent()); assertEquals("stable", jobRequest.getEngineVersion().get().toString()); }

Target:
public void testTDJobRequestParamsWithHiveEngineVersion() throws Exception { Path projectPath = Paths.get("").normalize().toAbsolutePath(); String stmt = "select 1"; Config config = newConfig() .set("database", "testdb") .set("query", stmt) .set("engine", "hive") .set("hive_engine_version", "stable"); when(op.submitNewJobWithRetry(any(TDJobRequest.class))).thenReturn(""); when(op.getDatabase()).thenReturn("testdb"); TDJobRequest jobRequest = testTDJobRequestParams(projectPath, config); assertEquals("testdb", jobRequest.getDatabase()); assertEquals(wrapStmtWithComment(taskRequest, stmt), jobRequest.getQuery()); assertEquals("hive", jobRequest.getType().toString() ); assertTrue(jobRequest.getEngineVersion().isPresent()); assertEquals("stable", jobRequest.getEngineVersion().get().toString()); }
Source:
private static List<String> getEndpointURLs(JSONObject endpointConfig, String type, String apiName) { List<String> urls = new ArrayList<>(); if (endpointConfig != null) { try { Object item; item = endpointConfig.get(type); if (item instanceof JSONArray) { JSONArray endpointsJSON = new JSONArray(endpointConfig.getJSONArray(type).toString()); for (int i = 0; i < endpointsJSON.length(); i++) { try { String urlValue = endpointsJSON.getJSONObject(i).get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoints JSON object failed in API: " + apiName, ex); } } } else if (item instanceof JSONObject) { JSONObject endpointJSON = new JSONObject(endpointConfig.getJSONObject(type).toString()); try { String urlValue = endpointJSON.get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoint JSON object failed in API: " + apiName, ex); } } } catch (JSONException ex) { log.info("Endpoint type: " + type + " not found in API: " + apiName); } } return urls; }

Target:
private static List<String> getEndpointURLs(JSONObject endpointConfig, String type, String apiName) throws APIImportExportException { List<String> urls = new ArrayList<>(); if (endpointConfig != null) { try { Object item; item = endpointConfig.get(type); if (item instanceof JSONArray) { JSONArray endpointsJSON = new JSONArray(endpointConfig.getJSONArray(type).toString()); for (int i = 0; i < endpointsJSON.length(); i++) { try { String urlValue = endpointsJSON.getJSONObject(i).get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoints JSON object failed in API: " + apiName, ex); } } } else if (item instanceof JSONObject) { JSONObject endpointJSON = new JSONObject(endpointConfig.getJSONObject(type).toString()); try { String urlValue = endpointJSON.get(APIConstants.API_DATA_URL).toString(); urls.add(urlValue); } catch (JSONException ex) { log.error("Endpoint URL extraction from endpoint JSON object failed in API: " + apiName, ex); } } } catch (JSONException ex) { String errorMsg = "Endpoint type: " + type + " not found in API: " + apiName; throw new APIImportExportException(errorMsg); } } return urls; }
Source:
private Map<String, String> getTableOptions(final int tableId) throws CatalogException { Connection conn = null; PreparedStatement pstmt = null; ResultSet res = null; Map<String, String> options = TUtil.newHashMap(); try { String tidSql = "SELECT key_, value_ FROM " + TB_OPTIONS + " WHERE TID=?"; conn = getConnection(); pstmt = conn.prepareStatement(tidSql); pstmt.setInt(1, tableId); res = pstmt.executeQuery(); while (res.next()) { String key = res.getString("KEY_"); String value = res.getString("VALUE_"); options.put(key, value); } } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return options; }

Target:
private Map<String, String> getTableOptions(final int tableId) throws CatalogException { Connection conn = null; PreparedStatement pstmt = null; ResultSet res = null; Map<String, String> options = TUtil.newHashMap(); try { String tidSql = "SELECT key_, value_ FROM " + TB_OPTIONS + " WHERE TID=?"; conn = getConnection(); pstmt = conn.prepareStatement(tidSql); pstmt.setInt(1, tableId); res = pstmt.executeQuery(); while (res.next()) { options.put(res.getString("KEY_"), res.getString("VALUE_")); } } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return options; }
Source:
protected String decrypt(String value) { try { Logger.d(TAG, "Started decrypt"); final byte[] bytes = value != null ? Base64.decode(value, Base64.DEFAULT) : new byte[0]; SecretKey secretKey = getSecretKeyForAPI(); Cipher pbeCipher = Cipher.getInstance(CIPHER_ALGORITHM); IvParameterSpec ivSpec = new IvParameterSpec(IV); pbeCipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec); String decrypted = new String(pbeCipher.doFinal(bytes), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished decryption"); return decrypted; } catch (Exception e) { Logger.e(TAG, "It failed to use encryption", "", ADALError.ENCRYPTION_FAILED); } return value; }

Target:
protected String decrypt(String value) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, KeyStoreException, CertificateException, NoSuchProviderException, InvalidAlgorithmParameterException, UnrecoverableEntryException, IOException, InvalidKeyException, DigestException, IllegalBlockSizeException, BadPaddingException { Logger.d(TAG, "Starting decryption"); if (StringExtensions.IsNullOrBlank(value)) { throw new IllegalArgumentException("input is empty or null"); } if (!value.substring(0, ENCODE_VERSION_LENGTH).equals(ENCODE_VERSION)) { throw new IllegalArgumentException("Encode version does not match"); } final byte[] bytes = Base64.decode(value.substring(ENCODE_VERSION_LENGTH), Base64.DEFAULT); String keyVersionCheck = new String(bytes, 0, KEY_VERSION_BLOB_LENGTH, AuthenticationConstants.ENCODING_UTF8); SecretKey versionKey = getKeyForVersion(keyVersionCheck); SecretKey versionMacKey = getMacKey(versionKey); int ivIndex = bytes.length - DATA_KEY_LENGTH - MAC_LENGTH; int macIndex = bytes.length - MAC_LENGTH; int encryptedLength = ivIndex - KEY_VERSION_BLOB_LENGTH; if (ivIndex < 0 || macIndex < 0 || encryptedLength < 0) { throw new IllegalArgumentException( "Given value is smaller than the IV vector and MAC length"); } Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(versionMacKey); mac.update(bytes, 0, macIndex); byte[] macDigest = mac.doFinal(); assertMac(bytes, macIndex, bytes.length, macDigest); cipher.init(Cipher.DECRYPT_MODE, versionKey, new IvParameterSpec(bytes, ivIndex, DATA_KEY_LENGTH)); String decrypted = new String(cipher.doFinal(bytes, KEY_VERSION_BLOB_LENGTH, encryptedLength), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished decryption"); return decrypted; }
Source:
public UnassociatedEditorStrategyRegistry getUnassociatedEditorStrategyRegistry() { if (unassociatedEditorStrategyRegistry == null) { unassociatedEditorStrategyRegistry = new UnassociatedEditorStrategyRegistry(); } return unassociatedEditorStrategyRegistry; }

Target:
public synchronized UnassociatedEditorStrategyRegistry getUnassociatedEditorStrategyRegistry() { if (unassociatedEditorStrategyRegistry == null) { unassociatedEditorStrategyRegistry = new UnassociatedEditorStrategyRegistry(); } return unassociatedEditorStrategyRegistry; }
Source:
private static void count(Object inputBase, long inputAddress, int inputSize, int[] counts) { long input = inputAddress; Arrays.fill(counts, 0); if (inputSize != 0) { for (int i = 0; i < inputSize; i++) { int symbol = UNSAFE.getByte(inputBase, input) & 0xFF; input++; counts[symbol]++; } } }

Target:
private static void count(Object inputBase, long inputAddress, int inputSize, int[] counts) { long input = inputAddress; Arrays.fill(counts, 0); for (int i = 0; i < inputSize; i++) { int symbol = UNSAFE.getByte(inputBase, input) & 0xFF; input++; counts[symbol]++; } }
Source:
public List<String> filterAllRunningServers(List<String> servers) { List<String> running = new LinkedList<>(); for (String server : servers) { Library.letsSleep(100); if (isServerRunning(server)) { running.add(server); } } return running; }

Target:
public List<String> filterAllRunningServers(List<String> servers) { List<String> running = new LinkedList<>(); for (String server : servers) { if (isServerRunning(server)) { running.add(server); } } return running; }
Source:
private static boolean isNullableThroughNonNull(Symbol symbol) { List<SymbolMetadata.AnnotationValue> valuesForAnnotation = symbol.metadata().valuesForAnnotation("javax.annotation.Nonnull"); if (valuesForAnnotation == null) { return false; } if (valuesForAnnotation.isEmpty()) { return false; } return checkAnnotationParameter(valuesForAnnotation, "when", "MAYBE") || checkAnnotationParameter(valuesForAnnotation, "when", "UNKNOWN"); }

Target:
private static boolean isNullableThroughNonNull(Symbol symbol) { List<SymbolMetadata.AnnotationValue> valuesForAnnotation = symbol.metadata().valuesForAnnotation("javax.annotation.Nonnull"); if (valuesForAnnotation == null || valuesForAnnotation.isEmpty()) { return false; } return checkAnnotationParameter(valuesForAnnotation, "when", "MAYBE") || checkAnnotationParameter(valuesForAnnotation, "when", "UNKNOWN"); }
Source:
public void testGetAllFolders() { this.studyTDI.createFolderTestData(this.commonTestProject.getUniqueID()); this.studyTDI.createFolderTestData(null); final List<FolderReference> allFolders = this.manager.getAllFolders(); Assert.assertTrue(allFolders.size() >= 2); }

Target:
public void testGetAllFolders() { final int originalSize = this.manager.getAllFolders().size(); this.studyTDI.createFolderTestData(this.commonTestProject.getUniqueID()); this.studyTDI.createFolderTestData(null); final int newSize = this.manager.getAllFolders().size(); Assert.assertEquals("The new size should be equal to the original size + 2", originalSize+2, newSize); }
Source:
private Boolean messageComplete(String messageKey, String value) { Boolean exists = redisClientDelegate.withCommandsClient(c -> { return c.exists(messageKey); }); return exists && redisClientDelegate.withCommandsClient(c -> { return c.get(messageKey).equals(value); }); }

Target:
private Boolean messageComplete(String messageKey, String value) { return redisClientDelegate.withCommandsClient(c -> { return getCRC32(value).equals(c.get(messageKey)); }); }
Source:
public SrvResolver build() { DnsSrvResolver srvResolver = this.srvResolver; if (srvResolver == null) { srvResolver = DnsSrvResolvers.newBuilder().cachingLookups(true).retainingDataOnFailures(true).build(); } return new SrvResolver(srvResolver, srvRecord); }

Target:
public SrvResolver build() { DnsSrvResolver srvResolver = this.srvResolver; if (srvResolver == null) { srvResolver = DEFAULT_DNS_RESOLVER.get(); } return new SrvResolver(srvResolver, srvRecord); }
Source:
protected Model readModelWorker(Model model, String filenameOrURI, String baseURI, String syntax) { String mappedURI = mapURI(filenameOrURI) ; if ( log.isDebugEnabled() && !mappedURI.equals(filenameOrURI) ) log.debug("Map: " + filenameOrURI + " => " + mappedURI) ; Lang lang = (syntax != null) ? RDFLanguages.nameToLang(syntax) : RDFLanguages.resourceNameToLang(mappedURI, Lang.RDFXML) ; if ( baseURI == null ) baseURI = SysRIOT.chooseBaseIRI(filenameOrURI) ; try(TypedInputStream in = streamManager.openNoMapOrNull(mappedURI)) { if ( in == null ) { if ( log.isDebugEnabled() ) log.debug("Failed to locate '"+mappedURI+"'") ; throw new NotFoundException("Not found: "+filenameOrURI) ; } Lang lang2 = RDFDataMgr.determineLang(mappedURI, in.getContentType(), lang); model.read(in, baseURI, lang2.getName()) ; } return model ; }

Target:
protected Model readModelWorker(Model model, String filenameOrURI, String baseURI, String syntax) { String mappedURI = mapURI(filenameOrURI) ; if ( log.isDebugEnabled() && !mappedURI.equals(filenameOrURI) ) log.debug("Map: " + filenameOrURI + " => " + mappedURI) ; Lang lang = (syntax != null) ? RDFLanguages.nameToLang(syntax) : RDFLanguages.resourceNameToLang(mappedURI, Lang.RDFXML) ; if ( baseURI == null ) baseURI = SysRIOT.chooseBaseIRI(filenameOrURI) ; try(TypedInputStream in = streamManager.openNoMapOrNull(mappedURI)) { if ( in == null ) { FmtLog.debug(log, "Failed to locate '%s'", mappedURI); throw new NotFoundException("Not found: "+filenameOrURI) ; } Lang lang2 = RDFDataMgr.determineLang(mappedURI, in.getContentType(), lang); model.read(in, baseURI, lang2.getName()) ; } return model ; }
Source:
private void createClass() throws JClassAlreadyExistsException { builderClass = holder.getGeneratedClass()._class(PUBLIC | STATIC, "IntentBuilder" + ModelConstants.generationSuffix()); builderClass._extends(getSuperClass()); holder.setIntentBuilderClass(builderClass); contextField = ref("context"); intentField = ref("intent"); }

Target:
private void createClass() throws JClassAlreadyExistsException { builderClass = holder.getGeneratedClass()._class(PUBLIC | STATIC, "IntentBuilder" + generationSuffix()); builderClass._extends(getSuperClass()); holder.setIntentBuilderClass(builderClass); contextField = ref("context"); intentField = ref("intent"); }
Source:
private java.io.File writeDataIfEmptyFile(Folder folder, String fileName, java.io.File fileData) throws IOException{ Logger.warn(this, "The file " + folder.getPath() + fileName + " that is trying to be uploaded is empty. A byte will be written to the file because empty files are not allowed in the system"); FileUtil.write(fileData, emptyFileData); return fileData; }

Target:
private java.io.File writeDataIfEmptyFile(Folder folder, String fileName, java.io.File fileData) throws IOException{ if(fileData.length() == 0 && !Config.getBooleanProperty("CONTENT_ALLOW_ZERO_LENGTH_FILES", false)){ Logger.warn(this, "The file " + folder.getPath() + fileName + " that is trying to be uploaded is empty. A byte will be written to the file because empty files are not allowed in the system"); FileUtil.write(fileData, emptyFileData); } return fileData; }
Source:
public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEventDmcSet.remove(e.getDMContext())) { return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } else { MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); if (threadState.fLatestEvent instanceof SuspendedEvent) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } } }

Target:
public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEventDmcSet.remove(e.getDMContext())) { return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } else { MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); if (threadState.fLatestEvent instanceof ISuspendedDMEvent) { getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } } }
Source:
private boolean isSelectedValue(final List<CaptureObjectDefinitionDto> selectedValues, final DataObject dataObject) throws ProtocolAdapterException { final CosemObjectDefinitionDto cosemObjectDefinitionDto = this.dlmsHelperService .readObjectDefinition(dataObject, "capture-object"); final int classId = cosemObjectDefinitionDto.getClassId(); final byte[] obisBytes = cosemObjectDefinitionDto.getLogicalName().toByteArray(); final byte attributeIndex = (byte) cosemObjectDefinitionDto.getAttributeIndex(); final int dataIndex = cosemObjectDefinitionDto.getDataIndex(); if (InterfaceClass.CLOCK.id() == classId && Arrays.equals(OBIS_BYTES_CLOCK, obisBytes) && ClockAttribute.TIME.attributeId() == attributeIndex && 0 == dataIndex) { return true; } for (final CaptureObjectDefinitionDto captureObjectDefinition : selectedValues) { final int classIdSelectedValue = captureObjectDefinition.getClassId(); final byte[] obisBytesSelectedValue = captureObjectDefinition.getLogicalName().toByteArray(); final byte attributeIndexSelectedValue = captureObjectDefinition.getAttributeIndex(); final int dataIndexSelectedValue; if (captureObjectDefinition.getDataIndex() == null) { dataIndexSelectedValue = 0; } else { dataIndexSelectedValue = captureObjectDefinition.getDataIndex(); } if (classIdSelectedValue == classId && Arrays.equals(obisBytesSelectedValue, obisBytes) && attributeIndexSelectedValue == attributeIndex && dataIndexSelectedValue == dataIndex) { return true; } } return false; }

Target:
private boolean isSelectedValue(final List<CaptureObjectDefinitionDto> selectedValues, final DataObject dataObject) throws ProtocolAdapterException { final CosemObjectDefinitionDto cosemObjectDefinitionDto = this.dlmsHelperService .readObjectDefinition(dataObject, "capture-object"); if (this.isClockDefinition(cosemObjectDefinitionDto)) { return true; } for (final CaptureObjectDefinitionDto captureObjectDefinition : selectedValues) { if (this.isDefinitionOfSameObject(cosemObjectDefinitionDto, captureObjectDefinition)) { return true; } } return false; }
Source:
public void testSetAclRecursive() throws Exception { final ZooKeeper zk = createClient(); final byte[] EMPTY = new byte[0]; zk.setData("/", EMPTY, -1); zk.create("/a", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/b", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/b/c", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/d", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); ZooKeeperMain zkMain = new ZooKeeperMain(zk); String setAclCommand = "setAcl -R /a world:anyone:r"; zkMain.cl.parseCommand(setAclCommand); Assert.assertFalse(zkMain.processZKCmd(zkMain.cl)); Assert.assertEquals(zk.getACL("/a", new Stat()), Ids.READ_ACL_UNSAFE); Assert.assertEquals(zk.getACL("/a/b", new Stat()), Ids.READ_ACL_UNSAFE); Assert.assertEquals(zk.getACL("/a/b/c", new Stat()), Ids.READ_ACL_UNSAFE); Assert.assertEquals(zk.getACL("/a/d", new Stat()), Ids.READ_ACL_UNSAFE); }

Target:
public void testSetAclRecursive() throws Exception { final ZooKeeper zk = createClient(); final byte[] EMPTY = new byte[0]; zk.setData("/", EMPTY, -1); zk.create("/a", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/b", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/b/c", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/a/d", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create("/e", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); ZooKeeperMain zkMain = new ZooKeeperMain(zk); String setAclCommand = "setAcl -R /a world:anyone:r"; zkMain.cl.parseCommand(setAclCommand); Assert.assertFalse(zkMain.processZKCmd(zkMain.cl)); Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a", new Stat())); Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/b", new Stat())); Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/b/c", new Stat())); Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/d", new Stat())); Assert.assertEquals(Ids.OPEN_ACL_UNSAFE, zk.getACL("/e", new Stat())); }
Source:
public TimeZoneType getTimeZoneType() { VmOsType vmOsType = (VmOsType) getModel().getOSType().getSelectedItem(); return vmOsType == null ? null : TimeZoneType.getTimeZoneByOs(vmOsType); }

Target:
public TimeZoneType getTimeZoneType() { VmOsType vmOsType = (VmOsType) getModel().getOSType().getSelectedItem(); return vmOsType == null ? TimeZoneType.GENERAL_TIMEZONE : TimeZoneType.getTimeZoneByOs(vmOsType); }
Source:
public static DataContainer readDataFromRegion(DataInputStream stream) throws IOException { if (stream == null) { return null; } NBTTagCompound data = CompressedStreamTools.read(stream); if (!data.hasKey("Level", NbtDataUtil.TAG_COMPOUND)) { return null; } NBTTagCompound level = data.getCompoundTag("Level"); if (!level.hasKey("Sections", NbtDataUtil.TAG_LIST)) { return null; } return NbtTranslator.getInstance().translateFrom(level); }

Target:
public static DataContainer readDataFromRegion(DataInputStream stream) throws IOException { if (stream == null) { return null; } NBTTagCompound data = CompressedStreamTools.read(stream); if (!data.hasKey(NbtDataUtil.CHUNK_DATA_LEVEL, NbtDataUtil.TAG_COMPOUND)) { return null; } NBTTagCompound level = data.getCompoundTag(NbtDataUtil.CHUNK_DATA_LEVEL); if (!level.hasKey(NbtDataUtil.CHUNK_DATA_SECTIONS, NbtDataUtil.TAG_LIST)) { return null; } return NbtTranslator.getInstance().translateFrom(level); }
Source:
private <T> T getEntity(ResponseBody body, Class<T> as) { try { if ( as == InputStream.class ) { return (T) body.byteStream(); } else if ( as == byte[].class ) { return (T) body.bytes(); } else if ( as == Reader.class ) { return (T) body.charStream(); } else if ( as == String.class ) { return (T) body.string(); } else if ( as == MimeMultipart.class ) { ByteArrayDataSource dataSource = new ByteArrayDataSource(body.byteStream(), body.contentType().toString()); return (T) new MimeMultipart(dataSource); } else if ( as == File.class ) { String suffix = ".unknown"; boolean isBinary = true; MediaType mediaType = body.contentType(); if ( mediaType != null ) { suffix = "." + mediaType.subtype(); for ( String type : new String[] {"json", "xml", "xquery", "sjs", "javascript", "html"} ) { if ( type.equalsIgnoreCase(mediaType.subtype()) ) { isBinary = false; } } if ( isBinary == true && "text".equalsIgnoreCase(mediaType.type()) ) { suffix = ".txt"; isBinary = false; } } Path path = Files.createTempFile("tmp", suffix); if ( isBinary == true ) { Utilities.write(body.byteStream(), (OutputStream) path); } else { Writer out = Files.newBufferedWriter(path, Charset.forName("UTF-8")); try { out.write(body.string()); } finally { out.close(); } } return (T) path.toFile(); } else { throw new IllegalArgumentException( "Handle recieveAs returned " + as + " which is not a supported type. " + "Try InputStream, Reader, String, byte[], File."); } } catch (IOException e) { throw new MarkLogicIOException(e); } catch (MessagingException e) { throw new MarkLogicIOException(e); } }

Target:
private <T> T getEntity(ResponseBody body, Class<T> as) { try { if ( as == InputStream.class ) { return (T) body.byteStream(); } else if ( as == byte[].class ) { return (T) body.bytes(); } else if ( as == Reader.class ) { return (T) body.charStream(); } else if ( as == String.class ) { return (T) body.string(); } else if ( as == MimeMultipart.class ) { ByteArrayDataSource dataSource = new ByteArrayDataSource(body.byteStream(), body.contentType().toString()); return (T) new MimeMultipart(dataSource); } else if ( as == File.class ) { String suffix = ".unknown"; boolean isBinary = true; MediaType mediaType = body.contentType(); if ( mediaType != null ) { suffix = "." + mediaType.subtype(); for ( String type : new String[] {"json", "xml", "xquery", "sjs", "javascript", "html"} ) { if ( type.equalsIgnoreCase(mediaType.subtype()) ) { isBinary = false; } } if ( isBinary == true && "text".equalsIgnoreCase(mediaType.type()) ) { suffix = ".txt"; isBinary = false; } } Path path = Files.createTempFile("tmp", suffix); if ( isBinary == true ) { Files.copy(body.byteStream(), path); } else { try(Writer out = Files.newBufferedWriter(path, Charset.forName("UTF-8"))) { Utilities.write(body.charStream(), out); } } return (T) path.toFile(); } else { throw new IllegalArgumentException( "Handle recieveAs returned " + as + " which is not a supported type. " + "Try InputStream, Reader, String, byte[], File."); } } catch (IOException e) { throw new MarkLogicIOException(e); } catch (MessagingException e) { throw new MarkLogicIOException(e); } }
Source:
public void edit() { final T qos = (T) getSelectedItem(); if (getWindow() != null) { return; } final EditQosModel<T, P> qosModel = getEditQosModel(qos); setWindow(qosModel); qosModel.getDataCenters().setItems(Arrays.asList(getEntity())); qosModel.getDataCenters().setSelectedItem(getEntity()); }

Target:
public void edit() { T qos = (T) getSelectedItem(); if (getWindow() != null) { return; } final EditQosModel<T, P> qosModel = getEditQosModel(qos); setWindow(qosModel); qosModel.getDataCenters().setItems(Arrays.asList(getEntity()), getEntity()); }
Source:
private static String getDirIfLlvmFound(String candidatePath, String subPath) { String llvmPath = candidatePath; if (llvmPath.endsWith(Separators.getFileSeparator()) && llvmPath.length() > 1) { llvmPath = llvmPath.substring(0, candidatePath.length() - 1); } if (null != subPath && !subPath.isEmpty()) { llvmPath = llvmPath + Separators.getFileSeparator() + subPath; } if (llvmPath == null) return null; return getBinDirIfLlvm_ar(llvmPath); }

Target:
private static String getDirIfLlvmFound(String candidatePath, String subPath) { String llvmPath = candidatePath; if (llvmPath.endsWith(Separators.getFileSeparator()) && llvmPath.length() > 1) { llvmPath = llvmPath.substring(0, candidatePath.length() - 1); } if (null != subPath && !subPath.isEmpty()) { llvmPath = llvmPath + Separators.getFileSeparator() + subPath; } return getBinDirIfLlvm_ar(llvmPath); }
Source:
private static PoolingOptions getPoolingOptions(int numHosts){ final PoolingOptions poolingOptions = new PoolingOptions(); poolingOptions .setCoreConnectionsPerHost(HostDistance.LOCAL, 15) .setMaxConnectionsPerHost(HostDistance.LOCAL, ioconfig.getMaxConnPerHost(numHosts)) .setCoreConnectionsPerHost(HostDistance.REMOTE, 2) .setMaxConnectionsPerHost(HostDistance.REMOTE, 4) .setHeartbeatIntervalSeconds(60); return poolingOptions; }

Target:
private static PoolingOptions getPoolingOptions(int numHosts){ final PoolingOptions poolingOptions = new PoolingOptions(); poolingOptions .setCoreConnectionsPerHost(HostDistance.LOCAL, ioconfig.getInitialConn()) .setMaxConnectionsPerHost(HostDistance.LOCAL, ioconfig.getMaxConnPerHost(numHosts)); return poolingOptions; }
Source:
public void run() { InvocationStatus invocationStatus = null; try { invocationStatus = beforeInvoke(); switch (invocationStatus) { case CONTINUE: response = handler.invokePerform(command); break; case CACHE_NOT_FOUND: response = CacheNotFoundResponse.INSTANCE; break; case DEFERRED: return; } afterInvoke(); } catch (InterruptedException e) { response = handler.interruptedException(command); onException(e); } catch (OutdatedTopologyException oe) { response = handler.outdatedTopology(oe); onException(oe); } catch (IllegalLifecycleStateException e) { response = CacheNotFoundResponse.INSTANCE; onException(e); } catch (Exception e) { response = handler.exceptionHandlingCommand(command, e); onException(e); } catch (Throwable throwable) { response = handler.exceptionHandlingCommand(command, throwable); onException(throwable); } finally { if (invocationStatus != InvocationStatus.DEFERRED) { reply.reply(response); onFinally(); } } }

Target:
public void run() { if (sync) { runSync(); } else { runAsync(); } }
Source:
private static Statement rhsAssignZeroValue(VariableDeclarationExpr vdExpr) { if (vdExpr.getVars().size() != 1) { return null; } Type type = vdExpr.getType(); if (type instanceof PrimitiveType) { switch (((PrimitiveType) type).getType()) { case Boolean: return rhsAssignWithValue(vdExpr, "false"); case Char: return rhsAssignWithValue(vdExpr, ""); default: return rhsAssignWithValue(vdExpr, "0"); } } return rhsAssignWithValue(vdExpr, null); }

Target:
private static List<Statement> rhsAssignZeroValue(VariableDeclarationExpr vdExpr) { List<Statement> resultList = new ArrayList<Statement>(); if (vdExpr.getVars().size() != 1) { return resultList; } Type type = vdExpr.getType(); if (type instanceof PrimitiveType) { resultList.add(rhsAssignWithValue(vdExpr, type, null)); } else { resultList.add(rhsAssignWithValue(vdExpr, type, null)); ReferenceType rType = (ReferenceType) type; if (rType.getType() instanceof ClassOrInterfaceType) { ClassOrInterfaceType classType = (ClassOrInterfaceType) rType.getType(); if (classType.isBoxedType()) { resultList.add(rhsAssignWithValue(vdExpr, classType.toUnboxedType(), null)); } } } return resultList; }
Source:
protected void analyze(InputFile file, SensorContext context) { try { TypeScriptAnalysisRequest request = new TypeScriptAnalysisRequest(file, rules, tsConfigs(context)); AnalysisResponse response = eslintBridgeServer.analyzeTypeScript(request); saveIssues(file, context, response.issues); saveHighlights(file, context, response.highlights); saveMetrics(file, context, response.metrics); } catch (IOException e) { LOG.error("Failed to get response while analyzing " + file, e); } }

Target:
protected void analyze(InputFile file, SensorContext context) { try { AnalysisRequest request = new AnalysisRequest(file, rules, tsConfigs(context)); AnalysisResponse response = eslintBridgeServer.analyzeTypeScript(request); saveMetrics(file, context, response.metrics); saveIssues(file, context, response.issues); saveHighlights(file, context, response.highlights); saveCpd(file, context, response.cpdTokens); } catch (IOException e) { LOG.error("Failed to get response while analyzing " + file, e); } }
Source:
public static Collection<Object> getConvertersToRegister() { List<Object> converters = new ArrayList<Object>(); converters.add(RowToNumberConverterFactory.INSTANCE); converters.add(RowToBooleanConverter.INSTANCE); converters.add(RowToDateConverter.INSTANCE); converters.add(RowToInetAddressConverter.INSTANCE); converters.add(RowToStringConverter.INSTANCE); converters.add(RowToUuidConverter.INSTANCE); converters.add(new RowToListConverter()); converters.add(new RowToMapConverter()); return converters; }

Target:
public static Collection<Object> getConvertersToRegister() { List<Object> converters = new ArrayList<Object>(); converters.add(RowToNumberConverterFactory.INSTANCE); converters.add(RowToBooleanConverter.INSTANCE); converters.add(RowToDateConverter.INSTANCE); converters.add(RowToInetAddressConverter.INSTANCE); converters.add(RowToStringConverter.INSTANCE); converters.add(RowToUuidConverter.INSTANCE); converters.add(RowToListConverter.INSTANCE); converters.add(RowToMapConverter.INSTANCE); return converters; }
Source:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); if (!"<LINK_0>".equalsIgnoreCase( urlopen.getCurrentURI())) { response = urlopen.open("<LINK_0>"); } Matcher matcher = reBalance.matcher(response); if (matcher.find()) { BigDecimal b = Helpers.parseBalance(matcher.group(1)); accounts.add(new Account("Saldo", b, "1")); balance = balance.add(Helpers.parseBalance(matcher.group(1))); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); if (!urlopen.getCurrentURI().equalsIgnoreCase(URL_OVERVIEW)) { response = urlopen.open(URL_OVERVIEW); } Matcher matcher = reBalance.matcher(response); if (matcher.find()) { BigDecimal b = Helpers.parseBalance(matcher.group(1)); accounts.add(new Account("Saldo", b, "1")); balance = balance.add(Helpers.parseBalance(matcher.group(1))); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }