auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Map<String, String> parseSetAttributesAsTextArg(String text) { char[] chars = text.toCharArray(); String value = ""; String key = ""; String buffer = ""; Map<String, String> keyValuePairs = new HashMap<>(); boolean isInsideQuotes = false; for (char c : chars) { if (c == '=') { key = buffer; buffer = ""; } else if (c == '\"') { if (isInsideQuotes) { value = buffer; buffer = ""; } isInsideQuotes = !isInsideQuotes; } else if (c == ' ' && !isInsideQuotes) { keyValuePairs.put(key, value); } else { buffer += c; } } if (!key.isEmpty() && !value.isEmpty()) { keyValuePairs.put(key, value); } return keyValuePairs; }

Target:
protected Map<String, String> parseSetAttributesAsTextArg(String text) { String value = ""; String key = ""; StringBuilder buffer = new StringBuilder(); Map<String, String> keyValuePairs = new HashMap<>(); boolean isInsideQuotes = false; for (int i = 0; i < text.length(); ++i) { final char c = text.charAt(i); if (c == '=') { key = buffer.toString(); buffer.setLength(0); } else if (c == '\"') { if (isInsideQuotes) { value = buffer.toString(); buffer.setLength(0); } isInsideQuotes = !isInsideQuotes; } else if (c == ' ' && !isInsideQuotes) { keyValuePairs.put(key, value); } else { buffer.append(c); } } if (!key.isEmpty() && !value.isEmpty()) { keyValuePairs.put(key, value); } return keyValuePairs; }
Source:
public boolean addAll(int index, Collection<? extends E> c) { throw new UnsupportedOperationException("No addAll(index) in " + this.getClass().getName()); }

Target:
public boolean addAll(int index, Collection<? extends E> c) { throw new UnsupportedOperationException("No addAll(int, Collection<? extends E>) in " + this.getClass().getName()); }
Source:
public void dispose() { super.dispose(); fImageCache.dispose(); }

Target:
public void dispose() { super.dispose(); imageCache.dispose(); if(workbenchLabelProvider != null) workbenchLabelProvider.dispose(); }
Source:
private String getManagementOptions(FenceAgentOrder order) { String managementOptions = ""; VDSGroup cluster = DbFacade.getInstance().getVdsGroupDao().get(_vds.getVdsGroupId()); boolean isPPC = (cluster.getArchitecture() == ArchitectureType.ppc64); if (order == FenceAgentOrder.Primary) { managementOptions = VdsFenceOptions.getDefaultAgentOptions(_vds.getPmType(), _vds.getPmOptions(), isPPC); } else if (order == FenceAgentOrder.Secondary) { managementOptions = VdsFenceOptions.getDefaultAgentOptions(_vds.getPmSecondaryType(), _vds.getPmSecondaryOptions(), isPPC); } return managementOptions; }

Target:
private String getManagementOptions(FenceAgentOrder order) { String managementOptions = ""; VDS proxyHost = DbFacade.getInstance().getVdsDao().get(proxyHostId); ArchitectureType architectureType = null; if ( proxyHost.getCpuName() != null) { architectureType = proxyHost.getCpuName().getArchitecture(); } if (order == FenceAgentOrder.Primary) { managementOptions = VdsFenceOptions.getDefaultAgentOptions(_vds.getPmType(), _vds.getPmOptions(), architectureType); } else if (order == FenceAgentOrder.Secondary) { managementOptions = VdsFenceOptions.getDefaultAgentOptions(_vds.getPmSecondaryType(), _vds.getPmSecondaryOptions(), architectureType); } return managementOptions; }
Source:
private void updateItemsAndWidgets(EList<Widget> widgets) { this.widgets = widgets; this.items = getAllItems(widgets); for (Item item : items) { if (item instanceof GenericItem) { ((GenericItem) item).addStateChangeListener(this); } else if (item instanceof GroupItem) { ((GroupItem) item).addStateChangeListener(this); } } }

Target:
private void updateItemsAndWidgets(EList<Widget> widgets) { if (this.widgets != null) { items = getAllItems(this.widgets); for (Item item : items) { if (item instanceof GenericItem) { ((GenericItem) item).removeStateChangeListener(this); } } } this.widgets = widgets; items = getAllItems(widgets); for (Item item : items) { if (item instanceof GenericItem) { ((GenericItem) item).addStateChangeListener(this); } } }
Source:
public boolean isInsideWorkTree() throws GitException { final EmptyGitCommand emptyGitCommand = nativeGit.createEmptyGitCommand(); try { emptyGitCommand.setNextParameter("rev-parse") .setNextParameter("--is-inside-work-tree") .execute(); final String output = emptyGitCommand.getText(); return Boolean.valueOf(output); } catch(GitException ge) { if (ge.getMessage().matches("(?s).*fatal: Not a git repository.*(?s).*")) { return false; } throw ge; } }

Target:
public boolean isInsideWorkTree() throws GitException { final EmptyGitCommand emptyGitCommand = nativeGit.createEmptyGitCommand(); try { emptyGitCommand.setNextParameter("rev-parse") .setNextParameter("--is-inside-work-tree") .execute(); final String output = emptyGitCommand.getText(); return Boolean.valueOf(output); } catch(GitException ge) { String msg = ge.getMessage(); if (msg != null && notInGitRepoErrorPattern.matcher(msg).matches()) { return false; } throw ge; } }
Source:
public final void initStrollIntervalTimer() { cIntervalTimer = TimeKeeper.getInstance().getTimer(Timer.Global.INTERVAL.name()); System.out.println(cIntervalTimer.getRemainingTime() + ""); if(cIntervalTimer.getRemainingTime() > 0 ){ cTimer = new Label(Integer.toString(cIntervalTimer.getRemainingTime()), cGameSkin.get("default_labelStyle", Label.LabelStyle.class)); } else { cTimer = new Label("Ready", cGameSkin.get("default_labelStyle", Label.LabelStyle.class)); } TimeKeeper.getInstance().getTimer(Timer.Global.INTERVAL.name()).subscribe(new TimerTask() { @Override public void onTick(final int seconds) { HomeScreen.this.cTimer.setText(Integer.toString(seconds)); } @Override public void onStart(final int seconds) { } @Override public void onStop() { } }); cTable.row().expandY(); cTable.add(cTimer); }

Target:
public final void initStrollIntervalTimer() { cIntervalTimer = TimeKeeper.getInstance().getTimer(Timer.Global.INTERVAL.name()); createTimeRemainingLabel(); addTimerBevahiour(); cTable.row().expandY(); cTable.add(cTimer); }
Source:
public Counter newCounter() { Counter counter = new Counter(arrayLength); arrays.add(counter); return counter; }

Target:
public Counter newCounter() { final Counter counter = new Counter(arrayLength); arrays.add(counter); return counter; }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); Static.AssertPlayerNonNull(p, t); MCItemStack is; Construct m = null; if(args.length == 2){ is = Static.ParseItemNotation(this.getName(), args[0].val(), Static.getInt32(args[1], t), t); } else if(args.length == 3) { if(args[0] instanceof CString) { p = Static.GetPlayer(args[0], t); is = Static.ParseItemNotation(this.getName(), args[1].val(), Static.getInt32(args[2], t), t); } else { is = Static.ParseItemNotation(this.getName(), args[0].val(), Static.getInt32(args[1], t), t); m = args[2]; } } else { p = Static.GetPlayer(args[0], t); is = Static.ParseItemNotation(this.getName(), args[1].val(), Static.getInt32(args[2], t), t); m = args[3]; } MCItemMeta meta; if (m != null) { meta = ObjectGenerator.GetGenerator().itemMeta(m, is.getTypeId(), t); } else { meta = ObjectGenerator.GetGenerator().itemMeta(new CNull(), is.getTypeId(), t); } is.setItemMeta(meta); HashMap<Integer, MCItemStack> h = p.getInventory().addItem(is); if (h.isEmpty()) { return new CInt(0, t); } else { return new CInt(h.get(0).getAmount(), t); } }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCItemStack is; Construct m = null; if(args.length == 2){ is = Static.ParseItemNotation(this.getName(), args[0].val(), Static.getInt32(args[1], t), t); } else if(args.length == 3) { if(args[0] instanceof CString) { p = Static.GetPlayer(args[0], t); is = Static.ParseItemNotation(this.getName(), args[1].val(), Static.getInt32(args[2], t), t); } else { is = Static.ParseItemNotation(this.getName(), args[0].val(), Static.getInt32(args[1], t), t); m = args[2]; } } else { p = Static.GetPlayer(args[0], t); is = Static.ParseItemNotation(this.getName(), args[1].val(), Static.getInt32(args[2], t), t); m = args[3]; } Static.AssertPlayerNonNull(p, t); MCItemMeta meta; if (m != null) { meta = ObjectGenerator.GetGenerator().itemMeta(m, is.getTypeId(), t); } else { meta = ObjectGenerator.GetGenerator().itemMeta(new CNull(), is.getTypeId(), t); } is.setItemMeta(meta); HashMap<Integer, MCItemStack> h = p.getInventory().addItem(is); if (h.isEmpty()) { return new CInt(0, t); } else { return new CInt(h.get(0).getAmount(), t); } }
Source:
public IdentityProvider getResidentIdP() throws IdentityProviderManagementException { try { String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); IdentityProvider residentIdP = IdentityProviderManager.getInstance() .getResidentIdP(tenantDomain); return residentIdP; } catch (IdentityProviderManagementException idpException) { log.error("Error while getting ResidentIdP", idpException); throw idpException; } }

Target:
public IdentityProvider getResidentIdP() throws IdentityProviderManagementException { String tenantDomain = ""; try { tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); IdentityProvider residentIdP = IdentityProviderManager.getInstance() .getResidentIdP(tenantDomain); return residentIdP; } catch (IdentityProviderManagementException idpException) { log.error("Error while getting ResidentIdP in tenantDomain :" + tenantDomain, idpException); throw idpException; } }
Source:
public void testTooManyRepositoriesAreCappedToFive() { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); try { viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3, 4, 5, 6)) .subscribe(observer); } catch (Exception e) { Log.e("RepositoriesViewModelTest", e.getMessage()); } observer.awaitTerminalEvent(); assertEquals("Invalid number of repositories", 5, observer.getEvents().get(0).size()); }

Target:
public void testTooManyRepositoriesAreCappedToFive() { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); try { viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3, 4, 5, 6)) .subscribe(observer); } catch (Exception e) { Log.e("RepositoriesViewModelTest", e.getMessage()); } observer.awaitTerminalEvent(); assertEquals("Invalid number of repositories", 5, ((List)observer.getEvents().get(0).get(0)).size()); }
Source:
APIEvent(final String eventName) { getEventList().add(Pair.create(EventStrings.EVENT_NAME, eventName)); mEventName = eventName; }

Target:
APIEvent(final String eventName) { setEvent(EventStrings.EVENT_NAME, eventName); mEventName = eventName; }
Source:
public void updateElement(int index) { final TableViewer tableViewer = fTableViewer; final ISegment[] segmentArray = fSegmentArray; if ((tableViewer != null) && (segmentArray != null) && (segmentArray.length > index) && !fOngoingUpdate) { fOngoingUpdate = true; tableViewer.replace(segmentArray[index], index); fOngoingUpdate = false; } }

Target:
public void updateElement(int index) { final TableViewer tableViewer = fTableViewer; final ISegment[] segmentArray = fSegmentArray; if ((tableViewer != null) && (segmentArray != null) && (segmentArray.length > index)) { tableViewer.replace(segmentArray[index], index); } }
Source:
private void createProject() throws OrmException, Failure { List<RefRight> access = new ArrayList<RefRight>(); for (AccountGroup.Id ownerId : ownerIds) { final RefRight.Key prk = new RefRight.Key(nameKey, new RefRight.RefPattern( RefRight.ALL), ApprovalCategory.OWN, ownerId); final RefRight pr = new RefRight(prk); pr.setMaxValue((short) 1); pr.setMinValue((short) 1); access.add(pr); } db.refRights().insert(access); final Project newProject = new Project(nameKey); newProject.setDescription(projectDescription); newProject.setSubmitType(submitType); newProject.setUseContributorAgreements(contributorAgreements); newProject.setUseSignedOffBy(signedOffBy); newProject.setUseContentMerge(contentMerge); newProject.setRequireChangeID(requireChangeID); db.projects().insert(Collections.singleton(newProject)); if (parents.size() > 0) { final StringBuilder err = new StringBuilder(); ProjectControl ctrl = projectCache.get(nameKey).controlFor(currentUser); for (ProjectControl parent: parents) { err.append(util.addParent(ctrl, parent)); } projectCache.evictAll(); String e = err.toString(); if (! "".equals(e)) { throw new Failure(1, e); } } }

Target:
private void createProject() throws OrmException, Failure { List<RefRight> access = new ArrayList<RefRight>(); for (AccountGroup.Id ownerId : ownerIds) { final RefRight.Key prk = new RefRight.Key(nameKey, new RefRight.RefPattern( RefRight.ALL), ApprovalCategory.OWN, ownerId); final RefRight pr = new RefRight(prk); pr.setMaxValue((short) 1); pr.setMinValue((short) 1); access.add(pr); } db.refRights().insert(access); final Project newProject = new Project(nameKey); newProject.setDescription(projectDescription); newProject.setSubmitType(submitType); newProject.setUseContributorAgreements(contributorAgreements); newProject.setUseSignedOffBy(signedOffBy); newProject.setUseContentMerge(contentMerge); newProject.setRequireChangeID(requireChangeID); db.projects().insert(Collections.singleton(newProject)); if (parents.size() > 0) { final StringBuilder err = new StringBuilder(); ProjectControl ctrl = projectCache.get(nameKey).controlFor(currentUser); for (ProjectControl parent: parents) { err.append(util.addParent(ctrl, parent)); } String e = err.toString(); if (! "".equals(e)) { throw new Failure(1, e); } } }
Source:
public final boolean isProfileOwnerAction(String action) { return (action != null) ? action.equals(ACTION_PROVISION_MANAGED_PROFILE) || action.equals(ACTION_PROVISION_MANAGED_USER) : false; }

Target:
public final boolean isProfileOwnerAction(String action) { return ACTION_PROVISION_MANAGED_PROFILE.equals(action) || ACTION_PROVISION_MANAGED_USER.equals(action); }
Source:
public void testGetExpiryForAccessIsIgnored() { Expiry<Long, String> expiry = mock(Expiry.class); ChainResolver<Long, String> chainResolver = new ChainResolver<Long, String>(codec, expiry); when(expiry.getExpiryForCreation(anyLong(), anyString())).thenReturn(Duration.INFINITE); List<Operation<Long, String>> list = new ArrayList<Operation<Long, String>>(); list.add(new PutOperation<Long, String>(1L, "One", timeSource.getTimeMillis())); list.add(new PutOperation<Long, String>(1L, "Second", timeSource.getTimeMillis())); Chain chain = getChainFromOperations(list); ResolvedChain<Long, String> resolvedChain = chainResolver.resolve(chain, 1L, timeSource.getTimeMillis()); verify(expiry, times(0)).getExpiryForAccess(anyLong(), any(ValueSupplier.class)); verify(expiry, times(1)).getExpiryForCreation(anyLong(), anyString()); verify(expiry, times(1)).getExpiryForUpdate(anyLong(), any(ValueSupplier.class), anyString()); assertThat(resolvedChain.isCompacted(), is(true)); assertThat(resolvedChain.getCompactedSize(), is(2)); }

Target:
public void testGetExpiryForAccessIsIgnored() { Expiry<Long, String> expiry = mock(Expiry.class); ChainResolver<Long, String> chainResolver = new ChainResolver<Long, String>(codec, expiry); when(expiry.getExpiryForCreation(anyLong(), anyString())).thenReturn(Duration.INFINITE); List<Operation<Long, String>> list = new ArrayList<Operation<Long, String>>(); list.add(new PutOperation<Long, String>(1L, "One", timeSource.getTimeMillis())); list.add(new PutOperation<Long, String>(1L, "Second", timeSource.getTimeMillis())); Chain chain = getChainFromOperations(list); ResolvedChain<Long, String> resolvedChain = chainResolver.resolve(chain, 1L, timeSource.getTimeMillis()); verify(expiry, times(0)).getExpiryForAccess(anyLong(), any(ValueSupplier.class)); verify(expiry, times(1)).getExpiryForCreation(anyLong(), anyString()); verify(expiry, times(1)).getExpiryForUpdate(anyLong(), any(ValueSupplier.class), anyString()); assertThat(resolvedChain.isCompacted(), is(true)); }
Source:
public void newDoc(EditableFileType fileType, ResultCallback<EditingTarget, ServerError> callback) { if (fileType instanceof TextFileType) { ensureVisible(true); TextFileType textType = (TextFileType)fileType; server_.getSourceTemplate("", "default" + textType.getDefaultExtension(), new ServerRequestCallback<String>() { @Override public void onResponseReceived(String template) { newDoc(fileType, template, callback); } @Override public void onError(ServerError error) { newDoc(fileType, null, callback); } }); } else { newDoc(fileType, null, callback); } }

Target:
public void newDoc(EditableFileType fileType, ResultCallback<EditingTarget, ServerError> callback) { ensureVisible(true); if (fileType instanceof TextFileType) { TextFileType textType = (TextFileType)fileType; server_.getSourceTemplate("", "default" + textType.getDefaultExtension(), new ServerRequestCallback<String>() { @Override public void onResponseReceived(String template) { newDoc(fileType, template, callback); } @Override public void onError(ServerError error) { newDoc(fileType, null, callback); } }); } else { newDoc(fileType, null, callback); } }
Source:
protected void propagateNewPanelSize(int visibleWidth, int visibleHeight) { if (getDefaultGridLayer() == null) { return; } boolean toRefresh = false; for (GridWidget gridWidget : getDefaultGridLayer().getGridWidgets()) { toRefresh = toRefresh || gridWidget.getModel().setVisibleSizeAndRefresh(visibleWidth, visibleHeight); } if (toRefresh) { this.getDefaultGridLayer().draw(); } }

Target:
protected void propagateNewPanelSize(int visibleWidth, int visibleHeight) { if (getDefaultGridLayer() == null) { return; } boolean toRefresh = false; for (GridWidget gridWidget : getDefaultGridLayer().getGridWidgets()) { toRefresh = toRefresh || gridWidget.getModel().setVisibleSizeAndRefresh(visibleWidth, visibleHeight); } if (toRefresh) { this.getDefaultGridLayer().batch(); } }
Source:
public boolean isReady(TaskActionClient taskActionClient) throws Exception { return false; }

Target:
public boolean isReady(TaskActionClient taskActionClient) throws Exception { return true; }
Source:
private void createGame(String shipName, boolean shouldSpawnOnGalaxySpawnPosition) { SolShip.shipList.clear(); boolean isNewShip = shipName != null; ShipConfig shipConfig = readShipFromConfigOrLoadFromSaveIfNull(shipName, isNewShip); if (!respawnState.isPlayerRespawned()) { galaxyFiller.fill(this, hullConfigManager, itemManager, shipConfig.hull.getInternalName().split(":")[0]); } hero = new PlayerCreator().createPlayer(shipConfig, shouldSpawnOnGalaxySpawnPosition, respawnState, this, solApplication.getOptions().controlType == GameOptions.ControlType.MOUSE, isNewShip); hero.initialise(); }

Target:
private void createGame(String shipName, boolean shouldSpawnOnGalaxySpawnPosition) { boolean isNewShip = shipName != null; ShipConfig shipConfig = readShipFromConfigOrLoadFromSaveIfNull(shipName, isNewShip); if (!respawnState.isPlayerRespawned()) { galaxyFiller.fill(this, hullConfigManager, itemManager, shipConfig.hull.getInternalName().split(":")[0]); } hero = new PlayerCreator().createPlayer(shipConfig, shouldSpawnOnGalaxySpawnPosition, respawnState, this, solApplication.getOptions().controlType == GameOptions.ControlType.MOUSE, isNewShip); hero.initialise(); }
Source:
public Hook getHook(Hooks hooks) { for (Hook hook : hooks.getHooks()) { if (parent.generateHookId(hook.getEventName(), hook.getName(), hook.getMd5()).equals(guid)) { return hook; } } return null; }

Target:
public Hook getHook(Hooks hooks) { for (Hook hook : hooks.getHooks()) { if (HostMapper.generateHookId(hook.getEventName(), hook.getName(), hook.getMd5()).equals(guid)) { return hook; } } return notFound(); }
Source:
public void testSessionTokenDecode() throws Throwable { Text alice = new Text("alice"); Text renewer = new Text("yarn"); AbstractS3ATokenIdentifier identifier = new SessionTokenIdentifier(SESSION_TOKEN_KIND, alice, renewer, new URI("s3a://landsat-pds/"), new MarshalledCredentials("a", "b", ""), new EncryptionSecrets(S3AEncryptionMethods.SSE_S3, ""), "origin"); Token<AbstractS3ATokenIdentifier> t1 = new Token<>(identifier, new SessionSecretManager()); AbstractS3ATokenIdentifier decoded = t1.decodeIdentifier(); decoded.validate(); MarshalledCredentials creds = ((SessionTokenIdentifier) decoded).getMarshalledCredentials(); assertNotNull("credentials", MarshalledCredentialBinding.toAWSCredentials(creds, MarshalledCredentials.CredentialTypeRequired.AnyNonEmpty, "")); assertEquals(alice, decoded.getOwner()); UserGroupInformation decodedUser = decoded.getUser(); assertEquals("name of " + decodedUser, "alice", decodedUser.getUserName()); assertEquals(renewer, decoded.getRenewer()); assertEquals("Authentication method of " + decodedUser, UserGroupInformation.AuthenticationMethod.TOKEN, decodedUser.getAuthenticationMethod()); assertEquals("origin", decoded.getOrigin()); }

Target:
public void testSessionTokenDecode() throws Throwable { Text alice = new Text("alice"); Text renewer = new Text("yarn"); AbstractS3ATokenIdentifier identifier = new SessionTokenIdentifier(SESSION_TOKEN_KIND, alice, renewer, new URI("s3a://landsat-pds/"), new MarshalledCredentials("a", "b", ""), new EncryptionSecrets(S3AEncryptionMethods.SSE_S3, ""), "origin"); Token<AbstractS3ATokenIdentifier> t1 = new Token<>(identifier, new SessionSecretManager()); AbstractS3ATokenIdentifier decoded = t1.decodeIdentifier(); decoded.validate(); MarshalledCredentials creds = ((SessionTokenIdentifier) decoded).getMarshalledCredentials(); assertNotNull("credentials", MarshalledCredentialBinding.toAWSCredentials(creds, MarshalledCredentials.CredentialTypeRequired.AnyNonEmpty, "")); assertEquals(alice, decoded.getOwner()); UserGroupInformation decodedUser = decoded.getUser(); assertEquals("name of " + decodedUser, "alice", decodedUser.getUserName()); assertEquals("renewer", renewer, decoded.getRenewer()); assertEquals("Authentication method of " + decodedUser, UserGroupInformation.AuthenticationMethod.TOKEN, decodedUser.getAuthenticationMethod()); assertEquals("origin", decoded.getOrigin()); }
Source:
public RetryImpl(String name, RetryConfig config, Map<String, String> tags) { this.name = name; this.config = config; this.tags = Collections.unmodifiableMap(tags); this.maxAttempts = config.getMaxAttempts(); this.intervalFunction = config.getIntervalFunction(); this.exceptionPredicate = config.getExceptionPredicate(); this.resultPredicate = config.getResultPredicate(); this.metrics = this.new RetryMetrics(); this.eventProcessor = new RetryEventProcessor(); succeededAfterRetryCounter = new LongAdder(); failedAfterRetryCounter = new LongAdder(); succeededWithoutRetryCounter = new LongAdder(); failedWithoutRetryCounter = new LongAdder(); }

Target:
public RetryImpl(String name, RetryConfig config, Map<String, String> tags) { this.name = name; this.config = config; this.tags = tags; this.maxAttempts = config.getMaxAttempts(); this.intervalFunction = config.getIntervalFunction(); this.exceptionPredicate = config.getExceptionPredicate(); this.resultPredicate = config.getResultPredicate(); this.metrics = this.new RetryMetrics(); this.eventProcessor = new RetryEventProcessor(); succeededAfterRetryCounter = new LongAdder(); failedAfterRetryCounter = new LongAdder(); succeededWithoutRetryCounter = new LongAdder(); failedWithoutRetryCounter = new LongAdder(); }
Source:
protected void addNewWorkingSet(IWorkingSet workingSet) { int checkCount= 0; for (IAdaptable fElement : fElements) { IAdaptable adapted= adapt(workingSet, fElement); if (adapted != null && contains(workingSet, adapted)) { checkCount++; } } GrayedCheckedModelElement element= new GrayedCheckedModelElement(workingSet, checkCount, fElements.length); fModel.addElement(element); fTableViewer.setInput(fModel); fTableViewer.refresh(); fTableViewer.setCheckedElements(fModel.getChecked()); fTableViewer.setGrayedElements((Object[]) fModel.getGrayed()); fTableViewer.setSelection(new StructuredSelection(element)); }

Target:
protected void addNewWorkingSet(IWorkingSet workingSet) { int checkCount= 0; for (IAdaptable element : fElements) { IAdaptable adapted= adapt(workingSet, element); if (adapted != null && contains(workingSet, adapted)) { checkCount++; } } GrayedCheckedModelElement element= new GrayedCheckedModelElement(workingSet, checkCount, fElements.length); fModel.addElement(element); fTableViewer.setInput(fModel); fTableViewer.refresh(); fTableViewer.setCheckedElements(fModel.getChecked()); fTableViewer.setGrayedElements((Object[]) fModel.getGrayed()); fTableViewer.setSelection(new StructuredSelection(element)); }
Source:
public OrcFileTail getOrcFileTail(OrcDataSource orcDataSource, MetadataReader metadataReader, Optional<OrcWriteValidation> writeValidation, HiveFileContext hiveFileContext) throws IOException { try { return cache.get(orcDataSource.getId(), () -> delegate.getOrcFileTail(orcDataSource, metadataReader, writeValidation, hiveFileContext)); } catch (ExecutionException | UncheckedExecutionException e) { throwIfInstanceOf(e.getCause(), IOException.class); throw new IOException("Unexpected error in orc file tail reading after cache miss", e.getCause()); } }

Target:
public OrcFileTail getOrcFileTail(OrcDataSource orcDataSource, MetadataReader metadataReader, Optional<OrcWriteValidation> writeValidation, HiveFileContext hiveFileContext) throws IOException { try { if (hiveFileContext.isCacheable()) { return cache.get(orcDataSource.getId(), () -> delegate.getOrcFileTail(orcDataSource, metadataReader, writeValidation, hiveFileContext)); } return delegate.getOrcFileTail(orcDataSource, metadataReader, writeValidation, hiveFileContext); } catch (ExecutionException | UncheckedExecutionException e) { throwIfInstanceOf(e.getCause(), IOException.class); throw new IOException("Unexpected error in orc file tail reading after cache miss", e.getCause()); } }
Source:
public Set<Class<? extends AudioStream>> getSupportedStreams() { return Collections.emptySet(); }

Target:
public Set<Class<? extends AudioStream>> getSupportedStreams() { return SUPPORTED_AUDIO_STREAMS; }
Source:
static String uniqueSuffix(String name) { return Base64.encode(Hashing.sha256().hashString(name).asBytes()). replace('/', '_'). replace('+', '.'). replaceFirst("=+$", ""); }

Target:
static String uniqueSuffix(String name) { byte[] sha256; try { sha256 = MessageDigest.getInstance("SHA-256").digest(name.getBytes(Charsets.UTF_16LE)); } catch (NoSuchAlgorithmException x) { throw new AssertionError("<LINK_0>", x); } return new Base32(0).encodeToString(sha256).replaceFirst("=+$", ""); }
Source:
public void testDoNotUpdateDeviceWhenReadOnlyIsNotChanged() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(false); DiskImage diskFromDb = createDiskImage(); diskFromDb.setReadOnly(false); when(diskDao.get(diskImageGuid)).thenReturn(diskFromDb); initializeCommand(parameters); command.executeVmCommand(); verify(vmDeviceDAO, never()).update(any(VmDevice.class)); }

Target:
public void testDoNotUpdateDeviceWhenReadOnlyIsNotChanged() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(false); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); initializeCommand(parameters); command.executeVmCommand(); assertFalse(command.shouldUpdateReadOnly()); verify(vmDeviceDAO, never()).update(any(VmDevice.class)); }
Source:
public void testCRUD() throws InterruptedException, ExecutionException{ try { setClient.post("http://localhost:8080/rest-app/rest/post", ImmutableMap.of(1, "hello")).get(); }catch(Exception e){ e.printStackTrace(); } }

Target:
public void testCRUD() throws InterruptedException, ExecutionException{ assertThat(listClient.get("http://localhost:8080/rest-app/rest/get").get().get(0),is("ok")); try { setClient.post("http://localhost:8080/rest-app/rest/post", ImmutableMap.of(1, "hello")).get(); }catch(Exception e){ e.printStackTrace(); } assertThat(setClient.post("http://localhost:8080/rest-app/rest/post",ImmutableMap.of(1,"hello")).get(),is(ImmutableSet.of("hello"))); assertThat(setClient.put("http://localhost:8080/rest-app/rest/put",ImmutableMap.of(1,"hello")).get(),is(ImmutableSet.of("hello"))); assertThat(listClient.delete("http://localhost:8080/rest-app/rest/delete").get().get(0),is("ok")); }
Source:
public void testPrefixWithSpaces() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "prefix_with_spaces"; final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); try { helpers.ensureBucketExists(bucketName); final List<Ds3Object> objects = Lists.newArrayList( new Ds3Object("obj1_no_spaces.txt", 1024), new Ds3Object("has spaces obj2.txt", 1024), new Ds3Object("obj3_no_spaces.txt", 1024), new Ds3Object("has spaces obj4.txt", 1024)); final Ds3ClientHelpers.Job putJob = helpers.startWriteJob(bucketName, objects); putJob.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(String key) throws IOException { final byte[] randomData = IOUtils.toByteArray(new RandomDataInputStream(120, 1024)); final ByteBuffer randomBuffer = ByteBuffer.wrap(randomData); final ByteArraySeekableByteChannel channel = new ByteArraySeekableByteChannel(1024); channel.write(randomBuffer); return channel; } }); final Iterable<Contents> objs = helpers.listObjects(bucketName, "has spaces"); boolean foundObj2 = false; boolean foundObj4 = false; for( Contents obj : objs ) { LOG.info("prefix with spaces name: " + obj.getKey()); LOG.info("prefix with spaces size: " + obj.getSize()); if (obj.getKey().equals("has spaces obj2.txt")) foundObj2 = true; if (obj.getKey().equals("has spaces obj4.txt")) foundObj4 = true; } assertTrue(Iterables.size(objs) == 2); assertTrue(foundObj2); assertTrue(foundObj4); } finally { Util.deleteAllContents(client, bucketName); } }

Target:
public void testPrefixWithSpaces() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "prefix_with_spaces"; final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); try { helpers.ensureBucketExists(bucketName); final List<Ds3Object> objects = Lists.newArrayList( new Ds3Object("obj1_no_spaces.txt", 1024), new Ds3Object("has spaces obj2.txt", 1024), new Ds3Object("obj3_no_spaces.txt", 1024), new Ds3Object("has spaces obj4.txt", 1024)); final Ds3ClientHelpers.Job putJob = helpers.startWriteJob(bucketName, objects); final Iterable<Contents> objs = helpers.listObjects(bucketName, "has spaces"); boolean foundObj2 = false; boolean foundObj4 = false; for (final Contents obj : objs) { LOG.info("prefix with spaces name: " + obj.getKey()); LOG.info("prefix with spaces size: " + obj.getSize()); if (obj.getKey().equals("has spaces obj2.txt")) foundObj2 = true; if (obj.getKey().equals("has spaces obj4.txt")) foundObj4 = true; } assertTrue(Iterables.size(objs) == 2); assertTrue(foundObj2); assertTrue(foundObj4); final CancelJobResponse cancelJobResponse = client.cancelJob(new CancelJobRequest(putJob.getJobId())); assertEquals(204, cancelJobResponse.getStatusCode()); } finally { Util.deleteAllContents(client, bucketName); } }
Source:
public void testOrphanedAllocationCanBeRemapped() throws Exception { try (SlotPoolImpl slotPool = createSlotPoolImpl()) { final List<AllocationID> allocationIds = new ArrayList<>(); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.add(slotRequest.getAllocationId())); final List<AllocationID> canceledAllocations = new ArrayList<>(); resourceManagerGateway.setCancelSlotConsumer(canceledAllocations::add); setupSlotPool(slotPool, resourceManagerGateway, mainThreadExecutor); final Scheduler scheduler = setupScheduler(slotPool, mainThreadExecutor); final SlotRequestId slotRequestId1 = new SlotRequestId(); scheduler.allocateSlot( slotRequestId1, new DummyScheduledUnit(), SlotProfile.noRequirements(), timeout); final SlotRequestId slotRequestId2 = new SlotRequestId(); scheduler.allocateSlot( slotRequestId2, new DummyScheduledUnit(), SlotProfile.noRequirements(), timeout); final AllocationID allocationId1 = allocationIds.get(0); final AllocationID allocationId2 = allocationIds.get(1); final SlotOffer slotOffer = new SlotOffer(allocationId2, 0, ResourceProfile.ANY); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotOffer); assertThat(slotPool.getPendingRequests().values(), hasSize(1)); assertThat(slotPool.getPendingRequests().containsKeyA(slotRequestId2), is(true)); assertThat(slotPool.getPendingRequests().containsKeyB(allocationId1), is(true)); assertThat(canceledAllocations, hasSize(0)); } }

Target:
public void testOrphanedAllocationCanBeRemapped() throws Exception { final List<AllocationID> allocationIds = new ArrayList<>(); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.add(slotRequest.getAllocationId())); final List<AllocationID> canceledAllocations = new ArrayList<>(); resourceManagerGateway.setCancelSlotConsumer(canceledAllocations::add); try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { final SlotRequestId slotRequestId1 = new SlotRequestId(); final SlotRequestId slotRequestId2 = new SlotRequestId(); requestNewAllocatedSlots(slotPool, slotRequestId1, slotRequestId2); final AllocationID allocationId1 = allocationIds.get(0); final AllocationID allocationId2 = allocationIds.get(1); offerSlot(slotPool, allocationId2); assertThat(slotPool.getPendingRequests().values(), hasSize(1)); assertThat(slotPool.getPendingRequests().containsKeyA(slotRequestId2), is(true)); assertThat(slotPool.getPendingRequests().containsKeyB(allocationId1), is(true)); assertThat(canceledAllocations, hasSize(0)); } }
Source:
public void actionPerformed(AnActionEvent e) { VirtualFile[] selectedFiles = FileEditorManager.getInstance(e.getProject()).getSelectedFiles(); if(selectedFiles == null || selectedFiles.length == 0) { SonarLintConsole.getSonarQubeConsole(e.getProject()).error("No files for analysis"); return; } Module m = ModuleUtil.findModuleForFile(selectedFiles[0], e.getProject()); if(shouldAnalyze(selectedFiles[0], m)) { SonarlintAnalyzer analyzer = e.getProject().getComponent(SonarlintAnalyzer.class); analyzer.submit(m, Collections.singletonList(selectedFiles[0]), false); } else { SonarLintConsole.getSonarQubeConsole(e.getProject()).error("File " + selectedFiles[0] + " cannot be analyzed"); } }

Target:
public void actionPerformed(AnActionEvent e) { Project p = e.getProject(); VirtualFile[] selectedFiles = FileEditorManager.getInstance(p).getSelectedFiles(); SonarLintConsole console = SonarLintConsole.getSonarQubeConsole(p); if (selectedFiles.length == 0) { console.error("No files for analysis"); return; } Module m = ModuleUtil.findModuleForFile(selectedFiles[0], p); if (shouldAnalyze(selectedFiles[0], m)) { boolean background = ActionPlaces.isMainMenuOrActionSearch(e.getPlace()); SonarlintAnalyzer analyzer = p.getComponent(SonarlintAnalyzer.class); if(background) { analyzer.submitAsync(m, Collections.singletonList(selectedFiles[0])); } else { analyzer.submit(m, Collections.singletonList(selectedFiles[0])); } } else { console.error("File " + selectedFiles[0] + " cannot be analyzed"); } }
Source:
public void validateDatasetTypeIsImplemented(final Integer datasetTypeId, final Errors errors) { final DatasetType datasetType = this.datasetTypeService.getDatasetTypeById(datasetTypeId); if (!DatasetTypeEnum.isSubObservationType(datasetType.getDatasetTypeId())) { errors.reject("dataset.operation.not.implemented", new String[] {String.valueOf(datasetTypeId)}, ""); } }

Target:
public void validateDatasetTypeIsImplemented(final Integer datasetTypeId, final Errors errors) { final DatasetTypeDTO datasetType = this.datasetTypeService.getDatasetTypeById(datasetTypeId); if (!datasetType.isSubObservationType()) { errors.reject("dataset.operation.not.implemented", new String[] {String.valueOf(datasetTypeId)}, ""); } }
Source:
public void testMarkingAcl_someUseMarking_allowConstraintMask() throws Exception { addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.ALLOW, AccessRight.USE_MARKING_AS_INT, 0, "allowUser1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.ALLOW, 0, 0, "allowUser2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.ALLOW, 0, 0, "allowGroup1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.ALLOW, AccessRight.USE_MARKING_AS_INT, 0, "allowGroup2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.DENY, 0, 0, "denyUser1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.DENY, AccessRight.USE_MARKING_AS_INT, 0, "denyUser2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.DENY, AccessRight.USE_MARKING_AS_INT, 0, "denyGroup1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.DENY, 0, 0, "denyGroup2"); Permissions testPerms = new Permissions(perms); Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals( ImmutableSet.<String>of("allowUser1"), acl.getAllowUsers()); assertEquals( ImmutableSet.<String>of("allowGroup2", AUTHENTICATED_USERS), acl.getAllowGroups()); assertEquals( ImmutableSet.<String>of("denyUser2"), acl.getDenyUsers()); assertEquals( ImmutableSet.<String>of("denyGroup1"), acl.getDenyGroups()); }

Target:
public void testMarkingAcl_someUseMarking_allowConstraintMask() throws Exception { addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.ALLOW, AccessRight.USE_MARKING_AS_INT, 0, "allowUser1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.ALLOW, AccessRight.NONE_AS_INT, 0, "allowUser2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.ALLOW, AccessRight.NONE_AS_INT, 0, "allowGroup1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.ALLOW, AccessRight.USE_MARKING_AS_INT, 0, "allowGroup2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.DENY, VIEW_ACCESS_RIGHTS, 0, "denyUser1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.USER, AccessType.DENY, AccessRight.USE_MARKING_AS_INT, 0, "denyUser2"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.DENY, AccessRight.USE_MARKING_AS_INT, 0, "denyGroup1"); addAce(PermissionSource.MARKING, SecurityPrincipalType.GROUP, AccessType.DENY, AccessRight.NONE_AS_INT, 0, "denyGroup2"); Permissions testPerms = new Permissions(perms); Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals(ImmutableSet.of("allowUser1"), acl.getAllowUsers()); assertEquals(ImmutableSet.of("allowGroup2", AUTHENTICATED_USERS), acl.getAllowGroups()); assertEquals(ImmutableSet.of("denyUser2"), acl.getDenyUsers()); assertEquals(ImmutableSet.of("denyGroup1"), acl.getDenyGroups()); }
Source:
private boolean glusterHostRemove(Guid sourceClusterId) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostRemove, new GlusterHostRemoveVDSParameters((getClusterUtils().getUpServer(sourceClusterId)).getId(), hostName, false)); if (getSucceeded()) { return returnValue.getSucceeded(); } else { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_REMOVE_FAILED; return false; } }

Target:
private boolean glusterHostRemove(Guid sourceClusterId) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostRemove, new GlusterHostRemoveVDSParameters((getClusterUtils().getUpServer(sourceClusterId)).getId(), hostName, false)); if (!returnValue.getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_REMOVE_FAILED; return false; } return true; }
Source:
public static String getNumaIdForPort(Number port, Map<String, Object> stormConf) { Map validatedNumaMap = null; try { validatedNumaMap = getValidatedNumaMap(stormConf); } catch (KeyNotFoundException e) { LOG.error("Exception while getting NUMA config", e); return null; } for (Object numaEntry : validatedNumaMap.values()) { Map numaMap = (Map<String, Object>) numaEntry; List<Integer> portList = (List<Integer>) numaMap.get(NUMAS_PORTS); if (portList.contains(port)) { return (String) numaMap.get(NUMA_ID); } } return null; }

Target:
public static String getNumaIdForPort(Number port, Map<String, Object> stormConf) { Map<String, Object> validatedNumaMap = getNumaMap(stormConf); for (Entry<String, Object> numaEntry : validatedNumaMap.entrySet()) { Map numaMap = (Map<String, Object>) numaEntry.getValue(); List<Integer> portList = (List<Integer>) numaMap.get(NUMA_PORTS); if (portList.contains(port)) { return numaEntry.getKey(); } } return null; }
Source:
private void startProducer(MqttMessageProducer publisher) { logger.trace("Starting message producer for broker '{}'", name); publisher.setSenderChannel(new MqttSenderChannel() { @Override public void publish(String topic, byte[] payload) throws IOException { if (!started) { logger.warn("Broker connection not started. Cannot publish message to topic '{}'", topic); return; } MqttMessage message = new MqttMessage(payload); message.setQos(qos); message.setRetained(retain); MqttTopic mqttTopic = client.getTopic(topic); MqttDeliveryToken deliveryToken; try { deliveryToken = mqttTopic.publish(message); logger.debug("Publishing message to topic '{}'", deliveryToken.getMessageId(), topic); if (!async) { deliveryToken.waitForCompletion(10000); if (!deliveryToken.isComplete()) { logger.error( "Did not receive completion message within timeout limit whilst publishing to topic '{}'", topic); } } } catch (MqttException e) { logger.error("Could not publish message to topic {}", topic); } } }); }

Target:
private void startProducer(MqttMessageProducer publisher) { logger.trace("Starting message producer for broker '{}'", name); publisher.setSenderChannel(new MqttSenderChannel() { @Override public void publish(String topic, byte[] payload) throws IOException { if (!started) { logger.warn("Broker connection not started. Cannot publish message to topic '{}'", topic); return; } MqttMessage message = new MqttMessage(payload); message.setQos(qos); message.setRetained(retain); MqttTopic mqttTopic = client.getTopic(topic); MqttDeliveryToken deliveryToken; try { deliveryToken = mqttTopic.publish(message); logger.debug("Publishing message to topic '{}'", deliveryToken.getMessageId(), topic); if (!async) { deliveryToken.waitForCompletion(10000); if (!deliveryToken.isComplete()) { logger.error( "Did not receive completion message within timeout limit whilst publishing to topic '{}'", topic); } } } catch (MqttException e) { logger.error("Could not publish message to topic {}", topic, e); } } }); }
Source:
private RelNode possiblyWrapRootWithOuterLimitFromContext( RelRoot root ) { Object outerLimitObj = plannerContext.getQueryContext().get(PlannerContext.CTX_SQL_OUTER_LIMIT); Long outerLimit = DimensionHandlerUtils.convertObjectToLong(outerLimitObj, true); if (outerLimit == null) { return root.rel; } if (root.rel instanceof LogicalSort) { LogicalSort outerSort = (LogicalSort) root.rel; return LogicalSort.create( outerSort.getInput(), outerSort.collation, makeBigIntLiteral(0), makeBigIntLiteral(outerLimit) ); } return LogicalSort.create( root.rel, root.collation, makeBigIntLiteral(0), makeBigIntLiteral(outerLimit) ); }

Target:
private RelNode possiblyWrapRootWithOuterLimitFromContext( RelRoot root ) { Object outerLimitObj = plannerContext.getQueryContext().get(PlannerContext.CTX_SQL_OUTER_LIMIT); Long outerLimit = DimensionHandlerUtils.convertObjectToLong(outerLimitObj, true); if (outerLimit == null) { return root.rel; } if (root.rel instanceof Sort) { Sort innerSort = (Sort) root.rel; final int offset = Calcites.getOffset(innerSort); final int fetch = Calcites.collapseFetch( Calcites.getFetch(innerSort), Ints.checkedCast(outerLimit), 0 ); return LogicalSort.create( innerSort.getInput(), innerSort.collation, makeBigIntLiteral(offset), makeBigIntLiteral(fetch) ); } return LogicalSort.create( root.rel, root.collation, makeBigIntLiteral(0), makeBigIntLiteral(outerLimit) ); }
Source:
public void testSlice() throws Exception { Block block1 = readFile("test_dictionaries/string-dictionary.orc", VARCHAR); Block block2 = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VARCHAR); compare(VARCHAR, block1, block2); }

Target:
public void testSlice() throws Exception { Block expected = readFile("test_dictionaries/string-dictionary.orc", VARCHAR); Block actual = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VARCHAR); assertEqualBlocks(VARCHAR, expected, actual); }
Source:
public void run() { while (this.enabled) { try { this.ledManager.writeLed(true); Thread.sleep(CloudConnectionStatusEnum.SLOW_BLINKING_ON_TIME); this.ledManager.writeLed(false); Thread.sleep(CloudConnectionStatusEnum.SLOW_BLINKING_OFF_TIME); } catch (Exception ex) { break; } } }

Target:
public void run() { while (this.enabled) { try { this.ledManager.writeLed(true); Thread.sleep(CloudConnectionStatusEnum.SLOW_BLINKING_ON_TIME); this.ledManager.writeLed(false); Thread.sleep(CloudConnectionStatusEnum.SLOW_BLINKING_OFF_TIME); } catch (InterruptedException e) { Thread.currentThread().interrupt(); this.enabled = false; } catch (KuraException e) { this.enabled = false; } } }
Source:
} catch (final Exception exception) { log.warn("Error while loading kafka-streams-version.properties: {}", exception.getMessage()); }

Target:
} catch (final Exception exception) { log.warn("Error while loading kafka-streams-version.properties", exception); }
Source:
public JsonJavaArray extractImagesFromWikiPage(String pageHTML){ JsonJavaArray imageAttributeObjects = new JsonJavaArray(); Pattern p = Pattern.compile("<img([^>]*[^>]*)>([^<>]*)</img>"); Matcher m = p.matcher(pageHTML); while(m.find()) { String imgAttrs = m.group(1); if(imgAttrs==null){ break; } JsonJavaObject jsonAttrs = new JsonJavaObject(); imgAttrs = imgAttrs.trim(); String[] attrs = imgAttrs.split("\" "); for(int i = 0; i < attrs.length; i++){ String attr = attrs[i]; attr = attr.replaceAll("\"", ""); String[] nameValue = attr.split("="); if(nameValue.length == 2){ jsonAttrs.put(nameValue[0], nameValue[1]); }else if(nameValue.length == 1){ jsonAttrs.put(nameValue[0], ""); } } imageAttributeObjects.add(jsonAttrs); } return imageAttributeObjects; }

Target:
public JsonJavaArray extractImagesFromWikiPage(String pageHTML){ JsonJavaArray imageAttributeObjects = new JsonJavaArray(); Pattern p = Pattern.compile("<img([^>]*)>([^<>]*)</img>"); Matcher m = p.matcher(pageHTML); while(m.find()) { String imgAttrs = m.group(1); if(imgAttrs==null){ break; } JsonJavaObject jsonAttrs = new JsonJavaObject(); imgAttrs = imgAttrs.trim(); String[] attrs = imgAttrs.split("\" "); for(int i = 0; i < attrs.length; i++){ String attr = attrs[i]; attr = attr.replaceAll("\"", ""); String[] nameValue = attr.split("="); if(nameValue.length == 2){ jsonAttrs.put(nameValue[0], nameValue[1]); }else if(nameValue.length == 1){ jsonAttrs.put(nameValue[0], ""); } } imageAttributeObjects.add(jsonAttrs); } return imageAttributeObjects; }
Source:
public void skipTree() { if (currVisit != null) currVisit.ptr = currVisit.buf.length; }

Target:
public void skipTree() { if (currVisit != null) { currVisit.ptr = currVisit.buf.length; } }
Source:
public static String unlink(LinkType sourceLinkType, Artifact source, String content) throws OseeCoreException { LinkType linkType = checkLinkType(sourceLinkType); String modified = content; HashCollection<String, MatchRange> matchMap = parseOseeWordMLLinks(content); if (!matchMap.isEmpty()) { modified = modifiedContent(linkType, source, content, matchMap, true, null, null); } return modified; }

Target:
public static String unlink(LinkType sourceLinkType, Artifact source, String content) throws OseeCoreException { LinkType linkType = checkLinkType(sourceLinkType); String modified = content; HashCollection<String, MatchRange> matchMap = parseOseeWordMLLinks(content); if (!matchMap.isEmpty()) { modified = modifiedContent(linkType, source, content, matchMap, true, null); } return modified; }