auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int hashCode() { return Objects.hashCode( account, invoice, subscription, uuid, taxInCents, currency, description, productCode, recurring, createdAt, updatedAt, details ); }

Target:
public int hashCode() { return Objects.hashCode( account, invoice, subscription, uuid, taxInCents, currency, description, productCode, recurring, createdAt, updatedAt, details, message, gatewayType, gatewayErrorCodes, origin, approvalCode, failureType ); }
Source:
private void handleExecutionException(Exception e) { boolean didCleanup = false; AsyncCheckpointState currentState = asyncCheckpointState.get(); while (AsyncCheckpointState.DISCARDED != currentState) { if (asyncCheckpointState.compareAndSet(currentState, AsyncCheckpointState.DISCARDED)) { didCleanup = true; try { cleanup(); } catch (Exception cleanupException) { e.addSuppressed(cleanupException); } Exception checkpointException = new Exception( "Could not materialize checkpoint " + checkpointMetaData.getCheckpointId() + " for operator " + taskName + '.', e); try { taskEnvironment.declineCheckpoint(checkpointMetaData.getCheckpointId(), new CheckpointException(CheckpointFailureReason.EXCEPTION, checkpointException)); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); asyncExceptionHandler.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } currentState = AsyncCheckpointState.DISCARDED; } else { currentState = asyncCheckpointState.get(); } } if (!didCleanup) { LOG.trace("Caught followup exception from a failed checkpoint thread. This can be ignored.", e); } }

Target:
private void handleExecutionException(Exception e) { boolean didCleanup = false; AsyncCheckpointState currentState = asyncCheckpointState.get(); while (AsyncCheckpointState.DISCARDED != currentState) { if (asyncCheckpointState.compareAndSet(currentState, AsyncCheckpointState.DISCARDED)) { didCleanup = true; try { cleanup(); } catch (Exception cleanupException) { e.addSuppressed(cleanupException); } Exception checkpointException = new Exception( "Could not materialize checkpoint " + checkpointMetaData.getCheckpointId() + " for operator " + taskName + '.', e); try { taskEnvironment.declineCheckpoint( checkpointMetaData.getCheckpointId(), new CheckpointException(CheckpointFailureReason.CHECKPOINT_ASYNC_EXCEPTION, checkpointException)); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); asyncExceptionHandler.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } currentState = AsyncCheckpointState.DISCARDED; } else { currentState = asyncCheckpointState.get(); } } if (!didCleanup) { LOG.trace("Caught followup exception from a failed checkpoint thread. This can be ignored.", e); } }
Source:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { mReferenceIndex = resolveIndexFromName(mReferenceName, mHeader, false); if (null == mReferenceIndex) { return NO_ALIGNMENT_REFERENCE_INDEX; } } return mReferenceIndex; }

Target:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { mReferenceIndex = resolveIndexFromName(mReferenceName, mHeader, false); if (null == mReferenceIndex) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } } return mReferenceIndex; }
Source:
private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); if (accessorFactory != null && accessorFactory instanceof IModelUpdateStrategyProvider) { ret = (IModelUpdateStrategyProvider)accessorFactory; } else { ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }

Target:
private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); if (accessorFactory instanceof IModelUpdateStrategyProvider) { ret = (IModelUpdateStrategyProvider)accessorFactory; } else { ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }
Source:
public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception { Bundle bundle = new BundleImpl(osgi, lookupBundle(name), null); RuntimeContext ctx = new OSGiRuntimeContext(runtime, bundle); listBundleComponents(bundle).map(URLStreamRef::new).forEach(component -> { try { deployPartialComponent(ctx, targetExtensions, component); } catch (IOException e) { log.error("PartialBundle: " + name + " failed to load: " + component, e); } }); return ctx; }

Target:
public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception { Bundle bundle = new BundleImpl(osgi, lookupBundle(name), getClass().getClassLoader()); RuntimeContext ctx = new OSGiRuntimeContext(runtime, bundle); listBundleComponents(bundle).map(URLStreamRef::new).forEach(component -> { try { deployPartialComponent(ctx, targetExtensions, component); } catch (IOException e) { log.error("PartialBundle: " + name + " failed to load: " + component, e); } }); return ctx; }
Source:
void createHandle(int index) { state |= HANDLE | THEME_BACKGROUND; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = OS.gtk_frame_new (null); if (handle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); OS.g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (clientHandle, true); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); if ((style & SWT.SHADOW_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_IN); } if ((style & SWT.SHADOW_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_OUT); } if ((style & SWT.SHADOW_ETCHED_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_IN); } if ((style & SWT.SHADOW_ETCHED_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_OUT); } if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { setFontDescription(defaultFont().handle); } }

Target:
void createHandle(int index) { state |= HANDLE | THEME_BACKGROUND; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = OS.gtk_frame_new (null); if (handle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); OS.g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (clientHandle, true); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); if ((style & SWT.SHADOW_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_IN); } if ((style & SWT.SHADOW_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_OUT); } if ((style & SWT.SHADOW_ETCHED_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_IN); } if ((style & SWT.SHADOW_ETCHED_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_OUT); } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
protected AbstractProcessor(final String[] sourceExtensions, final String[] headerExtensions) { this.sourceExtensions = sourceExtensions.clone(); if(headerExtensions != null) { this.headerExtensions = (String[]) headerExtensions.clone(); } else { this.headerExtensions = null; } }

Target:
protected AbstractProcessor(final String[] sourceExtensions, final String[] headerExtensions) { this.sourceExtensions = sourceExtensions.clone(); this.headerExtensions = headerExtensions.clone(); }
Source:
protected void initializeModelHandlers(BookmarkListModel model) { super.initializeModelHandlers(model); model.getItemSavedEvent().addListener((ev, sender, args) -> clearSelection()); getModel().getSelectionModel().addSelectionChangeHandler(event -> { if (!getModel().getSelectedObjects().isEmpty()) { BookmarkModelProvider.this.getModel().setSelectedItem(getModel().getSelectedObjects().get(0)); } else { BookmarkModelProvider.this.getModel().setSelectedItem(null); } }); }

Target:
protected void initializeModelHandlers(BookmarkListModel model) { super.initializeModelHandlers(model); model.getItemSavedEvent().addListener((ev, sender, args) -> clearSelection()); getModel().getSelectionModel().addSelectionChangeHandler(event -> { Bookmark bookmark = getModel().getSelectedObjects().isEmpty() ? null : (Bookmark) getModel().getSelectedObjects().get(0); BookmarkModelProvider.this.getModel().setSelectedItem(bookmark); }); }
Source:
public void refresh() { }

Target:
public void refresh() { super.refresh(); for (AbstractAttributeEditor editor : editors) { if (editor.hasIncomingChanges()) { getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); } } }
Source:
public void testDynamicChanges() throws Exception { deployContrib("org.nuxeo.ecm.core.schema.tests", "OSGI-INF/CoreTestExtensions.xml"); applyInlineDeployments(); postSetUp(); DocumentType t = schemaManager.getDocumentType("myDoc3"); Set<String> ts = new HashSet<String>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<String>(Arrays.asList("schema1", "schema2")), ts); assertEquals(Collections.singleton("myfacet"), t.getFacets()); deployContrib("org.nuxeo.ecm.core.schema.tests", "OSGI-INF/test-change-doctype.xml"); applyInlineDeployments(); postSetUp(); t = schemaManager.getDocumentType("myDoc3"); ts = new HashSet<String>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<String>(Arrays.asList("schema1", "common")), ts); assertEquals(0, t.getFacets().size()); }

Target:
public void testDynamicChanges() throws Exception { pushInlineDeployments("org.nuxeo.ecm.core.schema.tests:OSGI-INF/CoreTestExtensions.xml"); DocumentType t = schemaManager.getDocumentType("myDoc3"); Set<String> ts = new HashSet<>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<>(Arrays.asList("schema1", "schema2")), ts); assertEquals(Collections.singleton("myfacet"), t.getFacets()); pushInlineDeployments("org.nuxeo.ecm.core.schema.tests:OSGI-INF/test-change-doctype.xml"); t = schemaManager.getDocumentType("myDoc3"); ts = new HashSet<>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<>(Arrays.asList("schema1", "common")), ts); assertEquals(0, t.getFacets().size()); }
Source:
private String extractNextLink(HttpResponse canvasResponse, HttpSession session) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getHeaders("Link"); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); String[] splitPairs = headerPair.split(";"); splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = "/canvasCourseManager/manager" + links.get(searchPhrase).substring(links.get(searchPhrase).indexOf("/api"), links.get(searchPhrase).length()); if(linkValueNext.contains("as_user_id") && session.getAttribute(SectionUtilityToolFilter.LAUNCH_TYPE) == "lti"){ linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }

Target:
private String extractNextLink(HttpResponse canvasResponse, HttpSession session) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getHeaders("Link"); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); String[] splitPairs = headerPair.split(";"); splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = "/canvasCourseManager/manager" + links.get(searchPhrase).substring(links.get(searchPhrase).indexOf("/api"), links.get(searchPhrase).length()); if(linkValueNext.contains("as_user_id") && session.getAttribute(SectionUtilityToolFilter.LAUNCH_TYPE) == LTI){ linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }
Source:
public String toString() { final ToStringBuilder builder = new ToStringBuilder(this); builder .attr("name", m_name) .attr("type", m_type) .attr("resolveMethod", m_resolveMethod) .attr("properties", m_properties); return builder.toString(); }

Target:
public String toString() { return new ToStringBuilder(this) .attr("name", m_name) .attr("type", m_type) .attr("resolveMethod", m_resolveMethod) .attr("properties", m_properties) .toString(); }
Source:
public SWTBotMenu contextMenu(int row, int col, String text) throws WidgetNotFoundException { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); rightClick(row, col); Rectangle location = widget.getBoundsByPosition(col, row); return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2), text); }

Target:
public SWTBotMenu contextMenu(int row, int col, String text) throws WidgetNotFoundException { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); Rectangle location = widget.getBoundsByPosition(col, row); return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2), text); }
Source:
private static String normalizeIccid(String data) throws CorrelationAttributeNormalizationException { final String validIccidRegex = "^([8][9][f0-9]{17,22})$"; final String iccidWithoutSeperators = data.toLowerCase().replaceAll(SEPERATORS_REGEX, ""); if (iccidWithoutSeperators.matches(validIccidRegex)) { return iccidWithoutSeperators; } else { throw new CorrelationAttributeNormalizationException("Data provided was not a valid ICCID. : " + data); } }

Target:
private static String normalizeIccid(String data) throws CorrelationAttributeNormalizationException { final String validIccidRegex = "^89[f0-9]{17,22}$"; final String iccidWithoutSeperators = data.toLowerCase().replaceAll(SEPERATORS_REGEX, ""); if (iccidWithoutSeperators.matches(validIccidRegex)) { return iccidWithoutSeperators; } else { throw new CorrelationAttributeNormalizationException("Data provided was not a valid ICCID. : " + data); } }
Source:
public void testGetMilisToNextSunset() { System.out.println("getMilisToNextSunset"); Calendar calendar = Calendar.getInstance(); long nextSunset = DateTimeUtils.getMilisToNextSunset(calendar, 40.4131699, -3.6830699); assertTrue(nextSunset < 86400000); }

Target:
public void testGetMilisToNextSunset() { System.out.println("getMilisToNextSunset"); Calendar calendar = Calendar.getInstance(); long nextSunset = DateTimeUtils.getMilisToNextSunset(calendar, LATITUDE, LONGITUDE); assertTrue(nextSunset < DAYTOMILIS); }
Source:
void downloadArchiveForValidExperimentAccessions() throws Exception { String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.toString().replace("[", "").replace("]", ""))) .andExpect(status().isOk()) .andExpect( header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }

Target:
void downloadArchiveForValidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1))); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); ImmutableList<String> sourceFileNames = getSourceValidFileNames(); ArrayList<String> contentFileNames = new ArrayList<>(); ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { contentFileNames.add(Paths.get(entry.getName()).getFileName().toString()); } assertThat(sourceFileNames.containsAll(contentFileNames)).isTrue(); result.andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)); }
Source:
protected List<Resource<?>> doListResources() { return Collections.emptyList(); }

Target:
protected List<Resource<?>> doListResources() { if (isDirectory()) { if (isStale()) { listCache = null; } if (listCache == null) { refresh(); listCache = new LinkedList<>(); Path[] files = getPathOperations().listResources(getUnderlyingResourceObject()); if (files != null) { for (Path f : files) { listCache.add(getResourceFactory().create(f)); } } } return listCache; } else { return Collections.emptyList(); } }
Source:
private Runnable createPollTaskForStartOrder(long startOrder) { return () -> { ReentrantReadWriteLock.ReadLock lock = startStopLock.readLock(); lock.lock(); try { if (startOrder == currentStartOrder) { poll(); } } catch (Exception e) { log.makeAlert(e, "uncaught exception in segment manager polling thread").emit(); } finally { lock.unlock(); } }; }

Target:
private Runnable createPollTaskForStartOrder(long startOrder) { return () -> { ReentrantReadWriteLock.ReadLock lock = startStopLock.readLock(); lock.lock(); try { if (startOrder == currentStartOrder) { poll(); } else { log.debug("startOrder = currentStartOrder = %d, skipping poll()", startOrder); } } catch (Exception e) { log.makeAlert(e, "uncaught exception in segment manager polling thread").emit(); } finally { lock.unlock(); } }; }
Source:
public void setBitreserveRequestInterceptorWithEmptyTokenShouldSetTheBitreserveCustomHeadersWithoutAuthenticationHeader() throws Exception { MockRestAdapter<Card> adapter = new MockRestAdapter<>("", null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, Card>() { @Override public Promise<Card> call(BitreserveRestAdapter adapter) { User user = Fixtures.loadUser(); user.setBitreserveRestAdapter(adapter); return user.getCardById("foobar"); } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().size(), 3); Assert.assertTrue(request.getHeaders().contains(new Header("Accept", "application/json"))); Assert.assertFalse(request.getHeaders().contains(new Header("Authorization", "Basic Zm9vYmFyOlgtT0F1dGgtQmFzaWM="))); Assert.assertTrue(request.getHeaders().contains(new Header("Content-Type", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("User-Agent", "bitreserve-android-sdk 0.1 (<LINK_0>"))); }

Target:
public void setBitreserveRequestInterceptorWithEmptyTokenShouldSetTheBitreserveCustomHeadersWithoutAuthenticationHeader() throws Exception { MockRestAdapter<Card> adapter = new MockRestAdapter<>("", null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, Card>() { @Override public Promise<Card> call(BitreserveRestAdapter adapter) { User user = Fixtures.loadUser(); user.setBitreserveRestAdapter(adapter); return user.getCardById("foobar"); } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().size(), 3); Assert.assertTrue(request.getHeaders().contains(new Header("Accept", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("Content-Type", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("User-Agent", "bitreserve-android-sdk 0.1 (<LINK_0>"))); }
Source:
public void testSubmitAndScheduleExtensionJob() throws Exception { clearDB(); submitCluster(); createExtensionPackage(); String packageBuildLib = new Path(EXTENSION_PATH, "libs/build/").toString(); String result = registerExtension("testExtension", EXTENSION_PATH, "testExtension"); Assert.assertEquals(result, "Extension :testExtension registered successfully."); createDir(PROCESS_APP_PATH); copyExtensionJar(packageBuildLib); APIResult submitResult = submitAndScheduleExtensionJob("testExtension", "testJob", null, null); assertStatus(submitResult); }

Target:
public void testSubmitAndScheduleExtensionJob() throws Exception { clearDB(); submitCluster(); createExtensionPackage(); String packageBuildLib = new Path(EXTENSION_PATH, "libs/build/").toString(); String result = registerExtension("testExtension", EXTENSION_PATH, "testExtension"); Assert.assertEquals(result, "Extension :testExtension registered successfully."); createDir(PROCESS_APP_PATH); copyExtensionJar(packageBuildLib); APIResult apiResult = submitAndScheduleExtensionJob("testExtension", "testJob", null, null); assertStatus(apiResult); apiResult = getClient().getStatus(EntityType.PROCESS, "sample", CLUSTER_NAME, null, false); assertStatus(apiResult); Assert.assertEquals(apiResult.getMessage(), "RUNNING"); }
Source:
private static void testDiscardCorrectlyUpdatesLastAccessed(boolean discardSome) { CompositeByteBuf cbuf = compositeBuffer(); List<ByteBuf> buffers = new ArrayList<ByteBuf>(4); for (int i = 0; i < 4; i++) { ByteBuf buf = buffer().writeInt(i); cbuf.capacity(cbuf.writerIndex()).addComponent(true, buf); buffers.add(buf); } cbuf.skipBytes(2); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(4, cbuf.numComponents()); cbuf.skipBytes(3); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(3, cbuf.numComponents()); cbuf.skipBytes(3); assertEquals(2, cbuf.readInt()); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(1, cbuf.numComponents()); assertEquals(3, cbuf.readInt()); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(0, cbuf.numComponents()); for (ByteBuf buffer: buffers) { assertEquals(0, buffer.refCnt()); } assertTrue(cbuf.release()); }

Target:
private static void testDiscardCorrectlyUpdatesLastAccessed(boolean discardSome) { CompositeByteBuf cbuf = compositeBuffer(); List<ByteBuf> buffers = new ArrayList<ByteBuf>(4); for (int i = 0; i < 4; i++) { ByteBuf buf = buffer().writeInt(i); cbuf.addComponent(true, buf); buffers.add(buf); } cbuf.skipBytes(2); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(4, cbuf.numComponents()); cbuf.skipBytes(3); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(3, cbuf.numComponents()); cbuf.skipBytes(3); assertEquals(2, cbuf.readInt()); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(1, cbuf.numComponents()); assertEquals(3, cbuf.readInt()); if (discardSome) { cbuf.discardSomeReadBytes(); } else { cbuf.discardReadBytes(); } assertEquals(0, cbuf.numComponents()); for (ByteBuf buffer: buffers) { assertEquals(0, buffer.refCnt()); } assertTrue(cbuf.release()); }
Source:
public Method getOnCloseMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(OnClose.class)) { return method; } } return null; }

Target:
public Method getOnCloseMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } for (Method method : methods) { if (method.isAnnotationPresent(OnClose.class)) { return method; } } return null; }
Source:
QueryResult executeQuery(String sql, QueryParam... params) throws QueryExecutionException; QueryResult executeQuery(String sql, QueryType queryType, QueryParam... params) throws QueryExecutionException; Connection getConnection(); Optional<String> getConnector(); void close(); static QueryResult query(String sql, QueryParam... params) throws QueryExecutionException { return defaultQueryExecutor().executeQuery(sql, params); }

Target:
QueryResult executeQuery(String sql, QueryParam... params) throws QueryExecutionException; QueryResult executeQuery(String sql, QueryType queryType, QueryParam... params) throws QueryExecutionException; Connection getConnection(); void close(); static QueryResult query(String sql, QueryParam... params) throws QueryExecutionException { return defaultQueryExecutor().executeQuery(sql, params); }
Source:
public EnketoAccountResponse savePformRegistration() { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add("Authorization", "Basic " + userPasswdCombo); headers.add("Accept-Charset", "UTF-8"); EnketoAccountRequest body = new EnketoAccountRequest(ocURL, token); HttpEntity<EnketoAccountRequest> request = new HttpEntity<EnketoAccountRequest>(body, headers); RestTemplate rest = new RestTemplate(); ResponseEntity<EnketoAccountResponse> response = null; if (!checkExistingEnketoAccount()) { response = rest.postForEntity(enketoURL + "/accounts/api/v1/account", request, EnketoAccountResponse.class); } else { try { response = rest.exchange(enketoURL + "/accounts/api/v1/account", HttpMethod.PUT, request, EnketoAccountResponse.class, new HashMap<String, String>()); } catch (Exception e) { logger.error(e.getMessage()); } } return response.getBody(); }

Target:
public EnketoAccountResponse savePformRegistration() { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add("Authorization", "Basic " + userPasswdCombo); headers.add("Accept-Charset", "UTF-8"); EnketoAccountRequest body = new EnketoAccountRequest(ocURL, token); HttpEntity<EnketoAccountRequest> request = new HttpEntity<EnketoAccountRequest>(body, headers); RestTemplate rest = new RestTemplate(); ResponseEntity<EnketoAccountResponse> response = null; if (!checkExistingEnketoAccount()) { response = rest.postForEntity(enketoURL + "/accounts/api/v1/account", request, EnketoAccountResponse.class); } else { try { response = rest.exchange(enketoURL + "/accounts/api/v1/account", HttpMethod.PUT, request, EnketoAccountResponse.class, new HashMap<String, String>()); } catch (Exception e) { logger.error("Error while changing the EnketoURL: ", e); } } return response.getBody(); }
Source:
public static String getGzBaseName(String fname) { if (isGz(fname)) { return fname.substring(0, fname.length() - GZ_SUFFIX.length()); } throw new IAE("[%s] is not a valid gz file name", fname); }

Target:
public static String getGzBaseName(String fname) { final String reducedFname = Files.getNameWithoutExtension(fname); if (isGz(fname) && !reducedFname.isEmpty()) { return reducedFname; } throw new IAE("[%s] is not a valid gz file name", fname); }
Source:
public void insertTest() { String insertKey = "user0"; Map<String, ByteIterator> insertMap = insertRow(insertKey); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); ODatabaseDocumentTx db = pool.acquire(); try { ODictionary<ORecord> dictionary = db.getDictionary(); ODocument result = dictionary.get(insertKey); assertTrue("Assert a row was inserted.", result != null); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert all inserted columns have correct values.", result.field(FIELD_PREFIX + i), insertMap.get(FIELD_PREFIX + i).toString()); } } finally { db.close(); } }

Target:
public void insertTest() { String insertKey = "user0"; Map<String, ByteIterator> insertMap = insertRow(insertKey); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); try(ODatabaseDocumentTx db = pool.acquire()) { ODictionary<ORecord> dictionary = db.getDictionary(); ODocument result = dictionary.get(insertKey); assertTrue("Assert a row was inserted.", result != null); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert all inserted columns have correct values.", result.field(FIELD_PREFIX + i), insertMap.get(FIELD_PREFIX + i).toString()); } } }
Source:
private void askToOpenProject(StagingEntry stagingEntry) { IResource resource = CommonUtils.getAdapterForObject(stagingEntry, IResource.class); if (resource != null) { IProject project = resource.getProject(); if (!project.isOpen()) { if (MessageDialog.openQuestion(getSite().getShell(), UIText.StagingView_ProjectIsClosed, MessageFormat.format(UIText.StagingView_OpenProject, project.getName()))) { try { project.open(null); } catch (CoreException e) { Activator.handleError( UIText.StagingView_openingProjectFailed, e, true); } } } } }

Target:
private void askToOpenProject(StagingEntry stagingEntry) { IResource resource = CommonUtils.getAdapterForObject(stagingEntry, IResource.class); if (resource != null) { IProject project = resource.getProject(); if (!project.isOpen() && project.exists()) { if (MessageDialog.openQuestion(getSite().getShell(), UIText.StagingView_ProjectIsClosed, MessageFormat.format(UIText.StagingView_OpenProject, project.getName()))) { try { project.open(null); } catch (CoreException e) { Activator.handleError( UIText.StagingView_openingProjectFailed, e, true); } } } } }
Source:
private void updateChecksum(SPath docPath, Set<SPath> localEditors, Set<SPath> remoteEditors) { DocumentChecksum checksum = documentChecksums.get(docPath); if (checksum == null) { checksum = new DocumentChecksum(docPath); documentChecksums.put(docPath, checksum); } if (!docPath.getFile().exists()) { LOG.debug("Marking checksum for " + docPath + " as dirty as the file no longer exists locally: " + checksum); checksum.markDirty(); checksum.update(null); return; } else if (!checksum.isDirty()) { return; } String content = editorManager.getContent(checksum.getPath()); if (content == null) { if (localEditors.contains(checksum.getPath())) { LOG.error("EditorManager is in an inconsistent state. " + "It is reporting a locally open editor but no" + " document could be found in the underlying file system: " + checksum); } if (!remoteEditors.contains(checksum.getPath())) { documentChecksums.remove(checksum.getPath()); return; } } checksum.update(content); }

Target:
private void updateChecksum(SPath docPath, Set<SPath> localEditors, Set<SPath> remoteEditors) { DocumentChecksum checksum = documentChecksums.get(docPath); if (checksum == null) { checksum = new DocumentChecksum(docPath); documentChecksums.put(docPath, checksum); } if (checksum.getHash() != DocumentChecksum.NOT_AVAILABLE && !docPath .getFile().exists()) { LOG.debug("Updating checksum for " + docPath + " to correctly " + "represent that the file no longer exists locally: " + checksum); checksum.markDirty(); checksum.update(null); return; } else if (!checksum.isDirty()) { return; } String content = editorManager.getContent(checksum.getPath()); if (content == null) { if (localEditors.contains(checksum.getPath())) { LOG.error("EditorManager is in an inconsistent state. " + "It is reporting a locally open editor but no" + " document could be found in the underlying file system: " + checksum); } if (!remoteEditors.contains(checksum.getPath())) { documentChecksums.remove(checksum.getPath()); return; } } checksum.update(content); }
Source:
public StoreChangelogReader(final Time time, final StreamsConfig config, final LogContext logContext, final Consumer<byte[], byte[]> restoreConsumer, final StateRestoreListener stateRestoreListener) { this.time = time; this.log = logContext.logger(StoreChangelogReader.class); this.state = ChangelogReaderState.ACTIVE_RESTORING; this.restoreConsumer = restoreConsumer; this.stateRestoreListener = stateRestoreListener; this.pollTimeMs = Duration.ofMillis(config.getLong(StreamsConfig.POLL_MS_CONFIG)); this.updateOffsetIntervalMs = config.getLong(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG) == Long.MAX_VALUE ? DEFAULT_OFFSET_UPDATE_MS : config.getLong(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG); this.lastUpdateOffsetTime = 0L; this.changelogs = new HashMap<>(); }

Target:
public StoreChangelogReader(final Time time, final StreamsConfig config, final LogContext logContext, final Consumer<byte[], byte[]> restoreConsumer, final StateRestoreListener stateRestoreListener) { this.time = time; this.log = logContext.logger(StoreChangelogReader.class); this.state = ChangelogReaderState.ACTIVE_RESTORING; this.restoreConsumer = restoreConsumer; this.stateRestoreListener = stateRestoreListener; this.pollTime = Duration.ofMillis(config.getLong(StreamsConfig.POLL_MS_CONFIG)); this.updateOffsetIntervalMs = config.getLong(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG) == Long.MAX_VALUE ? DEFAULT_OFFSET_UPDATE_MS : config.getLong(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG); this.lastUpdateOffsetTime = 0L; this.changelogs = new HashMap<>(); }
Source:
public void started() { try { startDicomOrderFiller(); } catch (Exception e) { } typeAndRoles(); }

Target:
public void started() { startDicomOrderFiller(); typeAndRoles(); }
Source:
public void setMinZoom(final int level) { if (this.minZoom != level) { this.minZoom = level; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); if (target != null && findPage() != null) { target.appendJavaScript(getJSsetMinZoom(minZoom)); } } }

Target:
public void setMinZoom(final int level) { if (this.minZoom != level) { this.minZoom = level >= 0 ? level : 0; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); if (target != null && findPage() != null) { target.appendJavaScript(getJSsetMinZoom(minZoom)); } } }
Source:
public String toString() { return TimeTZType.formatTime(this); }

Target:
public String toString() { return TimeTZParser.formatTime(this); }
Source:
public static ObjectInserter createDryRunInserter() { return new ObjectInserter() { @Override public ObjectId insert(int objectType, long length, InputStream in) throws IOException { return createRandomObjectId(); } @Override public PackParser newPackParser(InputStream in) throws IOException { throw new UnsupportedOperationException(); } @Override public void flush() throws IOException { } @Override public void release() { } }; }

Target:
public static ObjectInserter createDryRunInserter() { return new ObjectInserter() { private final MutableObjectId buf = new MutableObjectId(); private final static int LAST_BYTE = Constants.OBJECT_ID_LENGTH - 1; @Override public ObjectId insert(int objectType, long length, InputStream in) throws IOException { buf.setByte(LAST_BYTE, buf.getByte(LAST_BYTE) + 1); return buf.copy(); } @Override public PackParser newPackParser(InputStream in) throws IOException { throw new UnsupportedOperationException(); } @Override public void flush() throws IOException { } @Override public void release() { } }; }
Source:
public void testPointAsText() throws Exception { Client client = getClient(); populateTables(client); VoltTable vt = client.callProcedure("@AdHoc", "select loc, asText(loc) from places order by pk").getResults()[0]; while (vt.advanceRow()) { GeographyPointValue gpv = vt.getPoint(0); if (gpv == null) { assertEquals(null, vt.getString(1)); } else { String wkt = vt.getString(1); assertEquals(gpv.toString().toLowerCase(), wkt.toLowerCase()); } } }

Target:
public void testPointAsText() throws Exception { Client client = getClient(); populateTables(client); client.callProcedure("places.Insert", 50, "Someplace1", GeographyPointValue.geographyPointFromText("POINT(13.4999999999995 17)")); client.callProcedure("places.Insert", 51, "Someplace2", GeographyPointValue.geographyPointFromText("POINT(-13.499999999999999995 -17)")); VoltTable vt = client.callProcedure("@AdHoc", "select loc, asText(loc) from places order by pk").getResults()[0]; while (vt.advanceRow()) { GeographyPointValue gpv = vt.getPoint(0); if (gpv == null) { assertEquals(null, vt.getString(1)); } else { assertEquals(gpv.toString(), vt.getString(1)); } } }
Source:
private void retryTransferTask(InboundTransferTask task, Set<Address> excludedSources) { if (trace) log.tracef("Retrying failed task: %s", task); synchronized (StateConsumerImpl.this) { Set<Integer> failedSegments = new HashSet<Integer>(); if (removeTransfer(task)) { excludedSources.add(task.getSource()); failedSegments.addAll(task.getSegments()); } failedSegments.retainAll(getOwnedSegments(cacheTopology.getWriteConsistentHash())); failedSegments.removeAll(getOwnedSegments(cacheTopology.getReadConsistentHash())); Map<Address, Set<Integer>> sources = new HashMap<Address, Set<Integer>>(); findSources(failedSegments, sources, excludedSources); for (Map.Entry<Address, Set<Integer>> e : sources.entrySet()) { addTransfer(e.getKey(), e.getValue()); } } }

Target:
private void retryTransferTask(InboundTransferTask task, Set<Address> excludedSources) { if (trace) log.tracef("Retrying failed task: %s", task); synchronized (transferMapsLock) { Set<Integer> failedSegments = new HashSet<Integer>(); if (removeTransfer(task)) { excludedSources.add(task.getSource()); failedSegments.addAll(task.getSegments()); } failedSegments.retainAll(getOwnedSegments(cacheTopology.getWriteConsistentHash())); failedSegments.removeAll(getOwnedSegments(cacheTopology.getReadConsistentHash())); Map<Address, Set<Integer>> sources = new HashMap<Address, Set<Integer>>(); findSources(failedSegments, sources, excludedSources); for (Map.Entry<Address, Set<Integer>> e : sources.entrySet()) { addTransfer(e.getKey(), e.getValue()); } } }
Source:
@Override protected boolean isNumericVector(VectorStorage storage) { try { Field f = storage.getClass().getDeclaredField("data"); f.setAccessible(true); double[] arr = (double[]) f.get(storage); return storage.isNumeric() && (arr != null || !isRaw(storage)); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
@Override protected boolean isNumericVector(VectorStorage storage) { try { double[] arr = ((DenseVectorStorage)storage).getData(); return storage.isNumeric() && (arr != null || !isRaw(storage)); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public AnnotationVisitor visitAnnotation(String desc, boolean visible) { Type type = getType(desc); for (Type annotationType : annotationTypes) { if (annotationType.equals(type)) { Type[] args = methodDesc == null ? new Type[0] : getArgumentTypes(methodDesc); Class[] argClasses = new Class[args.length]; for (int i = 0; i < args.length; i++) { try { switch(args[i].getSort()) { case OBJECT: case ARRAY: argClasses[i] = classFromInternalName(args[i].getInternalName()); break; case BOOLEAN: argClasses[i] = boolean.class; break; case BYTE: argClasses[i] = byte.class; break; case CHAR: argClasses[i] = char.class; break; case DOUBLE: argClasses[i] = double.class; break; case FLOAT: argClasses[i] = float.class; break; case INT: argClasses[i] = int.class; break; case LONG: argClasses[i] = long.class; break; case SHORT: argClasses[i] = short.class; break; } } catch(NullPointerException e) { System.out.println("here"); } } try { if("<init>".equals(name)) annotatedConstructors.add(selfClass().getDeclaredConstructor(argClasses)); else annotatedMethods.add(selfClass().getDeclaredMethod(name, argClasses)); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } break; } } return super.visitAnnotation(desc, visible); }

Target:
public AnnotationVisitor visitAnnotation(String desc, boolean visible) { Type type = getType(desc); for (Type annotationType : annotationTypes) { if (annotationType.equals(type)) { Type[] args = methodDesc == null ? new Type[0] : getArgumentTypes(methodDesc); Class[] argClasses = new Class[args.length]; for (int i = 0; i < args.length; i++) { switch(args[i].getSort()) { case OBJECT: case ARRAY: argClasses[i] = classFromInternalName(args[i].getInternalName()); break; case BOOLEAN: argClasses[i] = boolean.class; break; case BYTE: argClasses[i] = byte.class; break; case CHAR: argClasses[i] = char.class; break; case DOUBLE: argClasses[i] = double.class; break; case FLOAT: argClasses[i] = float.class; break; case INT: argClasses[i] = int.class; break; case LONG: argClasses[i] = long.class; break; case SHORT: argClasses[i] = short.class; break; } } try { if("<init>".equals(name)) annotatedConstructors.add(selfClass().getDeclaredConstructor(argClasses)); else annotatedMethods.add(selfClass().getDeclaredMethod(name, argClasses)); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } break; } } return super.visitAnnotation(desc, visible); }
Source:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { if ((json = MAPPER.parser().parseMap(stream)) == null) { LOGGER.debug("Json not found"); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); } if (json != null) { try { FileUtils.writeStringToFile(userAttributesFile, Boon.toPrettyJson(json)); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } } }

Target:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { json = MAPPER.parser().parseMap(stream); } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } try { FileUtils.writeStringToFile( userAttributesFile, Boon.toPrettyJson(json), Charset.defaultCharset()); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } }
Source:
public static void login(HttpClient client, String username, String password) throws IOException, InterruptedException, SAXException, ParserConfigurationException { ContentExchange exchange = new ContentExchange(); exchange.setMethod("POST"); exchange.setURL(getSoapURL()); exchange.setRequestContentSource(new ByteArrayInputStream(soapXmlForLogin( username, password))); exchange.setRequestHeader("Content-Type", "text/xml"); exchange.setRequestHeader("SOAPAction", "''"); exchange.setRequestHeader("PrettyPrint", "Yes"); client.send(exchange); exchange.waitForDone(); String response = exchange.getResponseContent(); String tagSession = "<sessionId>"; String tagserverUrl = "<serverUrl>"; String serverUrl = response.substring(response.indexOf(tagserverUrl) + tagserverUrl.length(), response.indexOf("</serverUrl>")); sessionId = response.substring(response.indexOf(tagSession) + tagSession.length(), response.indexOf("</sessionId>")); LoginUrl = serverUrl.substring(0, serverUrl.indexOf("/services")); }

Target:
public static void login(HttpClient client, String username, String password) throws IOException, InterruptedException, SAXException, ParserConfigurationException { try { ContentExchange exchange = new ContentExchange(); exchange.setMethod("POST"); exchange.setURL(getSoapURL()); exchange.setRequestContentSource(new ByteArrayInputStream(soapXmlForLogin( username, password))); exchange.setRequestHeader("Content-Type", "text/xml"); exchange.setRequestHeader("SOAPAction", "''"); exchange.setRequestHeader("PrettyPrint", "Yes"); client.send(exchange); exchange.waitForDone(); try { String response = exchange.getResponseContent(); String tagSession = "<sessionId>"; String tagServerUrl = "<serverUrl>"; String serverUrl = response.substring(response.indexOf(tagServerUrl) + tagServerUrl.length(), response.indexOf("</serverUrl>")); sessionId = response.substring(response.indexOf(tagSession) + tagSession.length(), response.indexOf("</sessionId>")); LoginUrl = serverUrl.substring(0, serverUrl.indexOf("/services")); } catch (IndexOutOfBoundsException e) { log.error("Login credentials of Salesforce is wrong...."); throw new SynapseException("Login credentials of Salesforce is wrong....", e); } } catch (MalformedURLException e) { log.error("Error while building URL", e); } catch (InterruptedException e) { log.error("Error in exchange the asynchronous message", e); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { log.error("Error while login to Salesforce" + e.getMessage(), e); } }
Source:
public <V> V run(String callableName, Callable<V> callable) throws Exception { requireNonNull(callableName, "callableName is null"); requireNonNull(callable, "callable is null"); long startTime = System.nanoTime(); int attempt = 0; while (true) { attempt++; try { return callable.call(); } catch (Exception e) { if (attempt >= maxAttempts || Duration.nanosSince(startTime).compareTo(maxRetryTime) >= 0) { throw e; } log.debug("Failed on executing %s with attempt %d, will retry. Exception: %s", callableName, attempt, e.getMessage()); int delayInMs = (int) Math.min(DEFAULT_SLEEP_TIME.toMillis() * Math.pow(scaleFactor, attempt - 1), DEFAULT_SLEEP_TIME.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); try { TimeUnit.MILLISECONDS.sleep(delayInMs + jitter); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RuntimeException(ie); } } } }

Target:
public <V> V run(String callableName, Callable<V> callable) throws Exception { requireNonNull(callableName, "callableName is null"); requireNonNull(callable, "callable is null"); List<Throwable> suppressedExceptions = new ArrayList<>(); long startTime = System.nanoTime(); int attempt = 0; while (true) { attempt++; try { return callable.call(); } catch (Exception e) { if (attempt >= maxAttempts || Duration.nanosSince(startTime).compareTo(maxRetryTime) >= 0) { addSuppressed(e, suppressedExceptions); throw e; } log.debug("Failed on executing %s with attempt %d, will retry. Exception: %s", callableName, attempt, e.getMessage()); suppressedExceptions.add(e); int delayInMs = (int) Math.min(DEFAULT_SLEEP_TIME.toMillis() * Math.pow(DEFAULT_SCALE_FACTOR, attempt - 1), DEFAULT_SLEEP_TIME.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); try { MILLISECONDS.sleep(delayInMs + jitter); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RuntimeException(ie); } } } }
Source:
public ASTNode transform(KApp node) throws TransformerException { ASTNode rez = node.getChild().accept(this); if (rez == null) node.setChild(KList.EMPTY); else if (rez instanceof KList) node.setChild((KList) rez); else { KList contents = new KList(); contents.getContents().add((Term) rez); node.setChild(contents); } return node; }

Target:
public ASTNode transform(KApp node) throws TransformerException { ASTNode rez = node.getChild().accept(this); assert rez != null; if (rez instanceof KList) node.setChild((KList) rez); else { KList contents = new KList(); contents.getContents().add((Term) rez); node.setChild(contents); } return node; }
Source:
protected boolean isValid() { return binder.isValid(); }

Target:
public boolean isValid() { return binder.isValid(); }