auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void emailConsentAgreementDoesNotSuppressEmailNotification() { account.setConsentSignatureHistory(SUBPOP_GUID, ImmutableList.of(CONSENT_SIGNATURE)); consentService.resendConsentAgreement(study, SUBPOP_GUID, PARTICIPANT); verify(sendMailService).sendEmail(emailCaptor.capture()); Set<String> recipients = emailCaptor.getValue().getRecipientEmails(); assertEquals(1, recipients.size()); assertTrue(recipients.contains(PARTICIPANT.getEmail())); }

Target:
public void emailConsentAgreementDoesNotSuppressEmailNotification() { account.setConsentSignatureHistory(SUBPOP_GUID, ImmutableList.of(CONSENT_SIGNATURE)); consentService.resendConsentAgreement(study, SUBPOP_GUID, PARTICIPANT); verify(subpopulation, never()).isAutoSendConsentSuppressed(); verify(sendMailService).sendEmail(emailCaptor.capture()); Set<String> recipients = emailCaptor.getValue().getRecipientEmails(); assertEquals(1, recipients.size()); assertTrue(recipients.contains(PARTICIPANT.getEmail())); }
Source:
private Promise<Channel> acquireUploadChannel() { Promise<Channel> channelReady = eventLoop.next().newPromise(); channelPool .acquire() .addListener( (Future<Channel> channelAcquired) -> { if (!channelAcquired.isSuccess()) { channelReady.setFailure(channelAcquired.cause()); return; } try { Channel ch = channelAcquired.getNow(); ChannelPipeline p = ch.pipeline(); if (!isChannelPipelineEmpty(p)) { channelReady.setFailure( new IllegalStateException("Channel pipeline is not empty.")); return; } p.addFirst( "timeout-handler", new IdleTimeoutHandler(timeoutSeconds, WriteTimeoutException.INSTANCE)); p.addLast(new HttpResponseDecoder()); p.addLast(new HttpObjectAggregator(10 * 1024)); p.addLast(new HttpRequestEncoder()); p.addLast(new ChunkedWriteHandler()); synchronized (credentialsLock) { p.addLast(new HttpUploadHandler(creds, extraHttpHeaders)); } if (!ch.eventLoop().inEventLoop()) { ch.eventLoop().execute(() -> channelReady.setSuccess(ch)); } else { channelReady.setSuccess(ch); } } catch (Throwable t) { channelReady.setFailure(t); } }); return channelReady; }

Target:
private Promise<Channel> acquireUploadChannel() { Promise<Channel> channelReady = eventLoop.next().newPromise(); channelPool .acquire() .addListener( (Future<Channel> channelAcquired) -> { if (!channelAcquired.isSuccess()) { channelReady.setFailure(channelAcquired.cause()); return; } try { Channel channel = channelAcquired.getNow(); ChannelPipeline pipeline = channel.pipeline(); if (!isChannelPipelineEmpty(pipeline)) { channelReady.setFailure( new IllegalStateException("Channel pipeline is not empty.")); return; } pipeline.addFirst( "timeout-handler", new IdleTimeoutHandler(timeoutSeconds, WriteTimeoutException.INSTANCE)); pipeline.addLast(new HttpResponseDecoder()); pipeline.addLast(new HttpObjectAggregator(10 * 1024)); pipeline.addLast(new HttpRequestEncoder()); pipeline.addLast(new ChunkedWriteHandler()); synchronized (credentialsLock) { pipeline.addLast(new HttpUploadHandler(creds, extraHttpHeaders)); } if (!channel.eventLoop().inEventLoop()) { channel.eventLoop().execute(() -> channelReady.setSuccess(channel)); } else { channelReady.setSuccess(channel); } } catch (Throwable t) { channelReady.setFailure(t); } }); return channelReady; }
Source:
private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { Iterator<StorageLocation> locations = strategy.getLocations(segment, storageDirStr); int numLocationsToTry = this.locations.size(); while (locations.hasNext() && numLocationsToTry > 0) { StorageLocation loc = locations.next(); numLocationsToTry--; File storageDir = loc.reserve(storageDirStr, segment); if (null != storageDir) { try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { try { log.makeAlert( e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath() ).addData("location", loc.getPath().getAbsolutePath()).emit(); } finally { loc.removeSegmentDir(storageDir, segment); cleanupCacheFiles(loc.getPath(), storageDir); } } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getId()); }

Target:
private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { Iterator<StorageLocation> locationsIterator = strategy.getLocations(); while (locationsIterator.hasNext()) { StorageLocation loc = locationsIterator.next(); File storageDir = loc.reserve(storageDirStr, segment); if (storageDir != null) { try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { try { log.makeAlert( e, "Failed to load segment in current location [%s], try next location if any", loc.getPath().getAbsolutePath() ).addData("location", loc.getPath().getAbsolutePath()).emit(); } finally { loc.removeSegmentDir(storageDir, segment); cleanupCacheFiles(loc.getPath(), storageDir); } } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getId()); }
Source:
protected LockProperties getLockingPropertiesSettings() { return new LockProperties().setObtainLock(false); }

Target:
protected LockProperties getLockingPropertiesSettings() { return new LockProperties(); }
Source:
public void onCreateButtonClicked() { Set<String> mods = modManagerController.apply().stream() .map(ModVersion::getUid) .collect(Collectors.toSet()); int minRating = 0; int maxRating = 3000; boolean enforceRating = false; if (!minRankingTextField.getText().isEmpty()) { minRating = Integer.parseInt(minRankingTextField.getText()); } if(!maxRankingTextField.getText().isEmpty()) { maxRating = Integer.parseInt(maxRankingTextField.getText()); } enforceRating = enforceRankingCheckBox.isSelected(); NewGameInfo newGameInfo = new NewGameInfo( titleTextField.getText(), Strings.emptyToNull(passwordTextField.getText()), featuredModListView.getSelectionModel().getSelectedItem(), mapListView.getSelectionModel().getSelectedItem().getFolderName(), mods, onlyForFriendsCheckBox.isSelected() ? GameVisibility.PRIVATE : GameVisibility.PUBLIC, minRating, maxRating, enforceRating); gameService.hostGame(newGameInfo).exceptionally(throwable -> { log.warn("Game could not be hosted", throwable); notificationService.addNotification( new ImmediateErrorNotification( i18n.get("errorTitle"), i18n.get("game.create.failed"), throwable, i18n, reportingService )); return null; }); onCloseButtonClicked(); }

Target:
public void onCreateButtonClicked() { Set<String> mods = modManagerController.apply().stream() .map(ModVersion::getUid) .collect(Collectors.toSet()); Integer minRating = null; Integer maxRating = null; boolean enforceRating; if (!minRankingTextField.getText().isEmpty()) { minRating = Integer.parseInt(minRankingTextField.getText()); } if(!maxRankingTextField.getText().isEmpty()) { maxRating = Integer.parseInt(maxRankingTextField.getText()); } enforceRating = enforceRankingCheckBox.isSelected(); NewGameInfo newGameInfo = new NewGameInfo( titleTextField.getText(), Strings.emptyToNull(passwordTextField.getText()), featuredModListView.getSelectionModel().getSelectedItem(), mapListView.getSelectionModel().getSelectedItem().getFolderName(), mods, onlyForFriendsCheckBox.isSelected() ? GameVisibility.PRIVATE : GameVisibility.PUBLIC, minRating, maxRating, enforceRating); gameService.hostGame(newGameInfo).exceptionally(throwable -> { log.warn("Game could not be hosted", throwable); notificationService.addImmediateErrorNotification(throwable, "game.create.failed"); return null; }); onCloseButtonClicked(); }
Source:
private Map<String, String> getActivatedParcels(Stack stack) { if (stack.isDatalake()) { Set<ClusterComponent> components = clusterComponentConfigProvider.getComponentsByClusterId(stack.getCluster().getId()); ClusterComponent stackComponent = components.stream() .filter(clusterComponent -> clusterComponent.getName().equals(StackType.CDH.name())) .findFirst().orElse(null); if (Objects.isNull(stackComponent)) { throw new NotFoundException("Runtime component not found!"); } ClouderaManagerProduct stackProduct = stackComponent.getAttributes().getSilent(ClouderaManagerProduct.class); return Map.of(stackProduct.getName(), stackProduct.getVersion()); } else { ClusterApi connector = clusterApiConnectors.getConnector(stack); return connector.gatherInstalledParcels(stack.getName()); } }

Target:
private Map<String, String> getActivatedParcels(Stack stack) { if (stack.isDatalake()) { Set<ClusterComponent> components = clusterComponentConfigProvider.getComponentsByClusterId(stack.getCluster().getId()); ClusterComponent stackComponent = components.stream() .filter(clusterComponent -> clusterComponent.getName().equals(StackType.CDH.name())) .findFirst().orElseThrow(() -> new NotFoundException("Runtime component not found!")); ClouderaManagerProduct stackProduct = stackComponent.getAttributes().getSilent(ClouderaManagerProduct.class); LOGGER.debug("For datalake clusters only the CDH parcel is activated in CM: {}", stackProduct); return Map.of(stackProduct.getName(), stackProduct.getVersion()); } else { ClusterApi connector = clusterApiConnectors.getConnector(stack); Map<String, String> installedParcels = connector.gatherInstalledParcels(stack.getName()); LOGGER.debug("The activated parcels for the datahub cluster: {}", installedParcels); return installedParcels; } }
Source:
public void waitSafely(Runnable o) { try { o.run(); } catch (TimeoutException e) { PageObjectLogging.log("Timed out waiting", e.getMessage(), true); } }

Target:
public void waitSafely(Runnable o) { try { o.run(); } catch (TimeoutException e) { PageObjectLogging.log("Timed out waiting", e, true); } }
Source:
public Properties getDataNucleusPropertiesForInternalInfrastructure() { Properties properties = new Properties(); properties.putAll(coreConfigurationService.loadDatanucleusConfig()); properties.remove("javax.jdo.option.Optimistic"); properties.remove("datanucleus.flush.mode"); addBeanValidationFactoryProperty(properties); properties.put("javax.jdo.option.ConnectionURL", getSchemaConnectionURL(properties)); return properties; }

Target:
public Properties getDataNucleusPropertiesForInternalInfrastructure() { Properties properties = new Properties(); properties.putAll(coreConfigurationService.loadDatanucleusSchemaConfig()); addBeanValidationFactoryProperty(properties); return properties; }
Source:
public RegionLocations locateMeta(byte[] row, RegionLocateType locateType) throws IOException { if (locateType == RegionLocateType.AFTER) { row = Arrays.copyOf(row, row.length + 1); locateType = RegionLocateType.CURRENT; } Scan scan = MetaTableAccessor.createLocateRegionScan(TableName.META_TABLE_NAME, row, locateType, 1); try (RegionScanner scanner = masterRegion.getScanner(scan)) { boolean moreRows; List<Cell> cells = new ArrayList<>(); do { moreRows = scanner.next(cells); if (cells.isEmpty()) { continue; } Result result = Result.create(cells); cells.clear(); RegionLocations locs = MetaTableAccessor.getRegionLocations(result); if (locs == null || locs.getDefaultRegionLocation() == null) { LOG.warn("No location found when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } HRegionLocation loc = locs.getDefaultRegionLocation(); RegionInfo info = loc.getRegion(); if (info == null) { LOG.warn("HRegionInfo is null when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } if (info.isSplitParent()) { continue; } return locs; } while (moreRows); LOG.warn("No location available when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } }

Target:
public RegionLocations locateMeta(byte[] row, RegionLocateType locateType) throws IOException { if (locateType == RegionLocateType.AFTER) { row = Arrays.copyOf(row, row.length + 1); locateType = RegionLocateType.CURRENT; } Scan scan = CatalogFamilyFormat.createRegionLocateScan(TableName.META_TABLE_NAME, row, locateType, 1); try (RegionScanner scanner = masterRegion.getScanner(scan)) { boolean moreRows; List<Cell> cells = new ArrayList<>(); do { moreRows = scanner.next(cells); if (cells.isEmpty()) { continue; } Result result = Result.create(cells); cells.clear(); RegionLocations locs = CatalogFamilyFormat.getRegionLocations(result); if (locs == null || locs.getDefaultRegionLocation() == null) { LOG.warn("No location found when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } HRegionLocation loc = locs.getDefaultRegionLocation(); RegionInfo info = loc.getRegion(); if (info == null) { LOG.warn("HRegionInfo is null when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } if (info.isSplitParent()) { continue; } return locs; } while (moreRows); LOG.warn("No location available when locating meta region with row='{}', locateType={}", Bytes.toStringBinary(row), locateType); return null; } }
Source:
public void test_create_tag() throws Exception { w.init(); String gitDir = w.repoPath() + File.separator + ".git"; w.commitEmpty("init"); ObjectId init = w.git.revParse("HEAD"); w.git.tag("test", "this is a tag"); ObjectId testTag = w.git.getHeadRev(gitDir, "test"); if (w.git instanceof JGitAPIImpl) { assertEquals("Annotated tag does not match SHA1", init, testTag); } else { assertNull("Annotated tag unexpectedly not null", testTag); } ObjectId testTagCommit = w.git.getHeadRev(gitDir, "refs/tags/test"); assertEquals("Annotated tag doesn't match queried commit SHA1", init, testTagCommit); assertEquals(init, w.git.revParse("test")); assertEquals(init, w.git.revParse("refs/tags/test")); assertTrue("test tag not created", w.cmd("git tag").contains("test")); String message = w.cmd("git tag -l -n1"); assertTrue("unexpected test tag message : " + message, message.contains("this is a tag")); assertNull(w.git.getHeadRev(gitDir, "not-a-valid-tag")); }

Target:
public void test_create_tag() throws Exception { w.init(); String gitDir = w.repoPath() + File.separator + ".git"; w.commitEmpty("init"); ObjectId commitId = w.git.revParse("HEAD"); w.git.tag("test", "this is an annotated tag"); String shortTagRef = "test"; ObjectId tagHeadIdByShortRef = w.git.getHeadRev(gitDir, shortTagRef); if (w.git instanceof JGitAPIImpl) { assertEquals("annotated tag does not match commit SHA1", commitId, tagHeadIdByShortRef); } else { assertNull("annotated tag unexpectedly not null", tagHeadIdByShortRef); } assertEquals("annotated tag does not match commit SHA1", commitId, w.git.revParse(shortTagRef)); String longTagRef = "refs/tags/test"; assertEquals("annotated tag does not match commit SHA1", commitId, w.git.getHeadRev(gitDir, longTagRef)); assertEquals("annotated tag does not match commit SHA1", commitId, w.git.revParse(longTagRef)); String tagNames = w.cmd("git tag -l").trim(); assertEquals("tag not created", "test", tagNames); String tagNamesWithMessages = w.cmd("git tag -l -n1"); assertTrue("unexpected tag message : " + tagNamesWithMessages, tagNamesWithMessages.contains("this is an annotated tag")); ObjectId invalidTagId = w.git.getHeadRev(gitDir, "not-a-valid-tag"); assertNull("did not expect reference for invalid tag but got : " + invalidTagId, invalidTagId); }
Source:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { ComposedCompletionStage<Void> composedCompletionStage = null; if (cacheNotifier.hasListener(CacheEntryRemoved.class)) { composedCompletionStage = CompletionStages.composedCompletionStage(); for (InternalCacheEntry e : dataContainer) { composedCompletionStage.dependsOn(cacheNotifier.notifyCacheEntryRemoved(e.getKey(), e.getValue(), e.getMetadata(), true, ctx, command)); } composedCompletionStage.freeze(); } return stageOrNullSyncValue(composedCompletionStage); }

Target:
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { AggregateCompletionStage<Void> aggregateCompletionStage = null; if (cacheNotifier.hasListener(CacheEntryRemoved.class)) { aggregateCompletionStage = CompletionStages.aggregateCompletionStage(); for (InternalCacheEntry e : dataContainer) { aggregateCompletionStage.dependsOn(cacheNotifier.notifyCacheEntryRemoved(e.getKey(), e.getValue(), e.getMetadata(), true, ctx, command)); } } return delayedNull(aggregateCompletionStage != null ? aggregateCompletionStage.freeze() : null); }
Source:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.isEmpty()) { throw new IllegalArgumentException("function 'timestampFromEpoch' needs at least 1 argument"); } ExprEval value = args.get(0).eval(bindings); if (value.type() != ExprType.STRING) { throw new IllegalArgumentException("first argument should be string type but got " + value.type() + " type"); } DateFormat formatter = ISO8601; if (args.size() > 1) { ExprEval format = args.get(1).eval(bindings); if (format.type() != ExprType.STRING) { throw new IllegalArgumentException("first argument should be string type but got " + format.type() + " type"); } formatter = new SimpleDateFormat(format.stringValue()); } Date date; try { date = formatter.parse(value.stringValue()); } catch (ParseException e) { throw new IllegalArgumentException("invalid value " + value.stringValue()); } return toValue(date); }

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 1 && args.size() != 2) { throw new IAE("function '%s' needs 1 or 2 arguments", name()); } ExprEval value = args.get(0).eval(bindings); if (value.type() != ExprType.STRING) { throw new IAE("first argument should be string type but got %s type", value.type()); } DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser(); if (args.size() > 1) { ExprEval format = args.get(1).eval(bindings); if (format.type() != ExprType.STRING) { throw new IAE("second argument should be string type but got %s type", format.type()); } formatter = DateTimeFormat.forPattern(format.asString()); } DateTime date; try { date = DateTime.parse(value.asString(), formatter); } catch (IllegalArgumentException e) { throw new IAE(e, "invalid value %s", value.asString()); } return toValue(date); }
Source:
public void testNotEqualsSql() { final TestDao dao = getDao(); Expression notEqualsExpression = RootTable.FIELD_TEST.not().eq("1"); assertThat(notEqualsExpression.buildSql(dao).first, is("(NOT (root.test) == ?)")); }

Target:
public void testNotEqualsSql() { final TestDao dao = getDao(); Expression notEqualsExpression = RootTable.FIELD_TEST.ne("1"); assertThat(notEqualsExpression.buildSql(dao).first, is("(root.test != ?)")); }
Source:
public Image(Device device, ImageDataProvider imageDataProvider) { super(device); this.imageDataProvider = imageDataProvider; currentDeviceZoom = getDeviceZoom (); boolean[] found = new boolean[1]; ImageData data = DPIUtil.validateAndGetImageDataAtZoom(imageDataProvider, currentDeviceZoom, found); if (found[0]) { init(data); } else { float scaleFactor = currentDeviceZoom / 100; ImageData resizedData = data.scaledTo((int)(data.width * scaleFactor), (int)(data.height * scaleFactor)); init (resizedData); } init(); }

Target:
public Image(Device device, ImageDataProvider imageDataProvider) { super(device); this.imageDataProvider = imageDataProvider; currentDeviceZoom = getDeviceZoom (); boolean[] found = new boolean[1]; ImageData data = DPIUtil.validateAndGetImageDataAtZoom(imageDataProvider, currentDeviceZoom, found); if (found[0]) { init(data); } else { ImageData resizedData = DPIUtil.autoScaleImageData(data, currentDeviceZoom); init (resizedData); } init(); }
Source:
protected void newStreamOpenWaitForFeaturesSequence(String waitFor) throws InterruptedException, SmackException, XMPPException { prepareToWaitForFeaturesReceived(); StreamOpenFactory streamOpenFactory = activeTransport.getStreamOpenFactory(); sendStreamOpen(streamOpenFactory.getStreamOpen()); waitForFeaturesReceived(waitFor); }

Target:
protected void newStreamOpenWaitForFeaturesSequence(String waitFor) throws InterruptedException, SmackException, XMPPException { prepareToWaitForFeaturesReceived(); StreamOpenAndCloseFactory streamOpenAndCloseFactory = activeTransport.getStreamOpenAndCloseFactory(); CharSequence from = null; CharSequence localpart = connectionInternal.connection.getConfiguration().getUsername(); DomainBareJid xmppServiceDomain = getXMPPServiceDomain(); if (localpart != null) { from = XmppStringUtils.completeJidFrom(localpart, xmppServiceDomain); } StreamOpen streamOpen = streamOpenAndCloseFactory.createStreamOpen(xmppServiceDomain, from, getStreamId(), getConfiguration().getXmlLang()); sendStreamOpen(streamOpen); waitForFeaturesReceived(waitFor); }
Source:
private static File createFileFromInputStream(InputStream inputStream, String encoding) { final File file; final File tempDir = FileHelper.getTempDir(); File fileCandidate = null; boolean usableName = false; int index = 0; while (!usableName) { index++; fileCandidate = new File(tempDir, "metamodel" + index + ".csv"); usableName = !fileCandidate.exists(); } file = fileCandidate; final BufferedWriter writer = FileHelper.getBufferedWriter(file, encoding); final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(encoding))); try { file.createNewFile(); file.deleteOnExit(); boolean firstLine = true; for (String line = reader.readLine(); line != null; line = reader.readLine()) { if (firstLine) { firstLine = false; } else { writer.write('\n'); } writer.write(line); } } catch (IOException e) { throw new IllegalStateException(e); } finally { FileHelper.safeClose(writer, reader); } return file; }

Target:
private static File createFileFromInputStream(InputStream inputStream, String encoding) { final File file; final File tempDir = FileHelper.getTempDir(); File fileCandidate = null; boolean usableName = false; int index = 0; while (!usableName) { index++; fileCandidate = new File(tempDir, "metamodel" + index + ".csv"); usableName = !fileCandidate.exists(); } file = fileCandidate; final BufferedWriter writer = FileHelper.getBufferedWriter(file, encoding); final BufferedReader reader = FileHelper.getBufferedReader(inputStream, encoding); try { file.createNewFile(); file.deleteOnExit(); boolean firstLine = true; for (String line = reader.readLine(); line != null; line = reader.readLine()) { if (firstLine) { firstLine = false; } else { writer.write('\n'); } writer.write(line); } } catch (IOException e) { throw new IllegalStateException(e); } finally { FileHelper.safeClose(writer, reader); } return file; }
Source:
public Session performOpenSession(URI representationsFileURI, IProgressMonitor monitor) { Session session = null; try { monitor.beginTask(Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { monitor.worked(1); session = trySessionOpening(representationsFileURI, monitor); monitor.worked(1); } } catch (SiriusResourceVersionMismatchException e) { UICallBack uiCallback = SiriusEditPlugin.getPlugin().getUiCallback(); if (uiCallback instanceof UICallBack2) { UICallBack2 uiCallBack2 = (UICallBack2) uiCallback; uiCallBack2.askSessionReopeningWithResourceVersionMismatch(e); try { SiriusResourceVersionMismatchException.ignoreVersionMismatch = true; session = trySessionOpening(representationsFileURI, monitor); monitor.worked(1); } catch (RuntimeException ex) { SiriusEditPlugin.getPlugin().log(ex); } finally { SiriusResourceVersionMismatchException.ignoreVersionMismatch = false; } } } catch (RuntimeException e) { SiriusEditPlugin.getPlugin().log(e); } finally { monitor.done(); } return session; }

Target:
public Session performOpenSession(URI representationsFileURI, IProgressMonitor monitor) { Session session = null; try { monitor.beginTask(Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { monitor.worked(1); session = trySessionOpening(representationsFileURI, monitor); monitor.worked(1); } } catch (SiriusResourceVersionMismatchException e) { UICallBack uiCallback = SiriusEditPlugin.getPlugin().getUiCallback(); if (uiCallback != null) { uiCallback.askSessionReopeningWithResourceVersionMismatch(e); try { MigrationUtil.ignoreVersionMismatch = true; session = trySessionOpening(representationsFileURI, monitor); monitor.worked(1); } catch (RuntimeException ex) { SiriusEditPlugin.getPlugin().log(ex); } finally { MigrationUtil.ignoreVersionMismatch = false; } } } catch (RuntimeException e) { SiriusEditPlugin.getPlugin().log(e); } finally { monitor.done(); } return session; }
Source:
protected Set<Guid> getStorageDomainsIds() { Set<Guid> storageIds = new HashSet<>(); for (DiskImage disk : getSourceImages()) { storageIds.addAll(disk.getStorageIds()); } return storageIds; }

Target:
protected Collection<Guid> getStorageDomainsIds() { return ImagesHandler.getAllStorageIdsForImageIds(getSourceImages()); }
Source:
public void setScenarioModifiers(List<AtBScenarioModifier> scenarioModifiers) { this.scenarioModifiers = scenarioModifiers; }

Target:
public void setScenarioModifiers(List<AtBScenarioModifier> scenarioModifiers) { scenarioModifiers = new ArrayList<>(); Collections.copy(this.scenarioModifiers, scenarioModifiers); }
Source:
public void write(ChannelHandlerContext ctx, int allowedBytes) { int queuedData = queue.readableBytes(); if (!endOfStream) { if (queuedData == 0) { if (queue.isEmpty()) { padding = dataSize = 0; return; } ChannelPromise writePromise = ctx.newPromise().addListener(this); ctx.write(queue.remove(0, writePromise), writePromise); return; } if (allowedBytes == 0) { return; } } int writableData = min(queuedData, allowedBytes); ChannelPromise writePromise = ctx.newPromise().addListener(this); ByteBuf toWrite = queue.remove(writableData, writePromise); dataSize = queue.readableBytes(); int writablePadding = min(allowedBytes - writableData, padding); padding -= writablePadding; frameWriter().writeData(ctx, stream.id(), toWrite, writablePadding, endOfStream && size() == 0, writePromise); }

Target:
public void write(ChannelHandlerContext ctx, int allowedBytes) { int queuedData = queue.readableBytes(); if (!endOfStream) { if (queuedData == 0) { if (queue.isEmpty()) { padding = dataSize = 0; } else { ChannelPromise writePromise = ctx.newPromise().addListener(this); ctx.write(queue.remove(0, writePromise), writePromise); } return; } if (allowedBytes == 0) { return; } } int writableData = min(queuedData, allowedBytes); ChannelPromise writePromise = ctx.newPromise().addListener(this); ByteBuf toWrite = queue.remove(writableData, writePromise); dataSize = queue.readableBytes(); int writablePadding = min(allowedBytes - writableData, padding); padding -= writablePadding; frameWriter().writeData(ctx, stream.id(), toWrite, writablePadding, endOfStream && size() == 0, writePromise); }
Source:
private LookupEntry lookupEntryForIdOrUri(@Nullable String id, @Nullable String uri) { Iterable<LookupEntry> lookupEntries; if (!Strings.isNullOrEmpty(uri)) { lookupEntries = lookupEntryStore.entriesForCanonicalUris(ImmutableList.of(uri)); if (!lookupEntries.iterator().hasNext()) { throw new IllegalArgumentException("No lookup entry found for uri " + uri); } } else if (!Strings.isNullOrEmpty(id)) { lookupEntries = lookupEntryStore.entriesForIds( ImmutableList.of( SubstitutionTableNumberCodec.lowerCaseOnly().decode(id).longValue() ) ); if (!lookupEntries.iterator().hasNext()) { throw new IllegalArgumentException("No lookup entry found for id " + id); } } else { throw new IllegalArgumentException("No id or uri specified"); } if (!lookupEntries.iterator().hasNext()) { throw new IllegalArgumentException("No lookup entry found"); } return Iterables.getOnlyElement(lookupEntries); }

Target:
private LookupEntry lookupEntryForIdOrUri(@Nullable String id, @Nullable String uri) { Iterable<LookupEntry> lookupEntries; if (!Strings.isNullOrEmpty(uri)) { lookupEntries = lookupEntryStore.entriesForCanonicalUris(ImmutableList.of(uri)); if (!lookupEntries.iterator().hasNext()) { throw new IllegalArgumentException("No lookup entry found for uri " + uri); } } else if (!Strings.isNullOrEmpty(id)) { lookupEntries = lookupEntryStore.entriesForIds( ImmutableList.of(codec.decode(id).longValue()) ); if (!lookupEntries.iterator().hasNext()) { throw new IllegalArgumentException("No lookup entry found for id " + id); } } else { throw new IllegalArgumentException("No id or uri specified"); } return Iterables.getOnlyElement(lookupEntries); }
Source:
private void writePage(Page page) { int[] writerIndexes = getWriterIndexes(page); int[] sizes = new int[writers.size()]; for (int index : writerIndexes) { sizes[index]++; } int[][] writerPositions = new int[writers.size()][]; int[] counts = new int[writers.size()]; for (int position = 0; position < page.getPositionCount(); position++) { int index = writerIndexes[position]; int count = counts[index]; if (count == 0) { writerPositions[index] = new int[sizes[index]]; } writerPositions[index][count] = position; counts[index] = count + 1; } Page dataPage = getDataPage(page); for (int index = 0; index < writerPositions.length; index++) { int[] positions = writerPositions[index]; if (positions == null) { continue; } Page pageForWriter = dataPage; if (positions.length != dataPage.getPositionCount()) { pageForWriter = pageForWriter.getPositions(positions, 0, positions.length); } HiveWriter writer = writers.get(index); long currentWritten = writer.getWrittenBytes(); long currentMemory = writer.getSystemMemoryUsage(); writer.append(pageForWriter); writtenBytes += (writer.getWrittenBytes() - currentWritten); systemMemoryUsage += (writer.getSystemMemoryUsage() - currentMemory); } }

Target:
private void writePage(Page page) { int[] writerIndexes = getWriterIndexes(page); int[] sizes = new int[writers.size()]; for (int index : writerIndexes) { sizes[index]++; } int[][] writerPositions = new int[writers.size()][]; int[] counts = new int[writers.size()]; for (int position = 0; position < page.getPositionCount(); position++) { int index = writerIndexes[position]; int count = counts[index]; if (count == 0) { writerPositions[index] = new int[sizes[index]]; } writerPositions[index][count] = position; counts[index] = count + 1; } Page dataPage = getDataPage(page); for (int index = 0; index < writerPositions.length; index++) { int[] positions = writerPositions[index]; if (positions == null) { continue; } Page pageForWriter = dataPage; if (positions.length != dataPage.getPositionCount()) { verify(positions.length == counts[index]); pageForWriter = pageForWriter.getPositions(positions, 0, positions.length); } HiveWriter writer = writers.get(index); long currentWritten = writer.getWrittenBytes(); long currentMemory = writer.getSystemMemoryUsage(); writer.append(pageForWriter); writtenBytes += (writer.getWrittenBytes() - currentWritten); systemMemoryUsage += (writer.getSystemMemoryUsage() - currentMemory); } }
Source:
public void shouldParseConnectScriptWithOptions() throws Exception { String script = "connect option transport \"localhost:8888\"\n" + "connect tcp://localhost:7788\n" + "connected\n" + "close\n" + "closed\n"; ScriptParserImpl parser = new ScriptParserImpl(); AstScriptNode actual = parser.parseWithStrategy(script, SCRIPT); }

Target:
public void shouldParseConnectScriptWithOptions() throws Exception { String script = "connect http://localhost:7788\n" + " option transport tcp://localhost:8888\n" + "connected\n" + "close\n" + "closed\n"; ScriptParserImpl parser = new ScriptParserImpl(); AstScriptNode actual = parser.parseWithStrategy(script, SCRIPT); AstLocation location = new AstLocationLiteral(URI.create("http://localhost:7788")); AstLocation transport = new AstLocationLiteral(URI.create("tcp://localhost:8888")); AstScriptNode expected = new AstScriptNodeBuilder() .addConnectStream() .setLocation(location) .setTransport(transport) .addConnectedEvent().done() .addCloseCommand().done() .addClosedEvent().done() .done() .done(); assertEquals(expected, actual); }
Source:
public static int purgeMobs() { int removed = 0; for (World world : Bukkit.getWorlds()) { for (Entity ent : world.getLivingEntities()) { if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient || ent instanceof Squid) { ent.remove(); removed++; } } } return removed; }

Target:
public static int purgeMobs() { int removed = 0; for (World world : Bukkit.getWorlds()) { for (Entity ent : world.getLivingEntities()) { if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient || ent instanceof WaterMob) { ent.remove(); removed++; } } } return removed; }
Source:
private void showAssigneePicker(TurboIssue issue) { List<TurboUser> assigneeList = ui.logic.getRepo(issue.getRepoId()).getUsers(); AssigneePickerDialog assigneePickerDialog = new AssigneePickerDialog(stage, issue, assigneeList); Optional<AssigneePickerDialogResponse> assigneeDialogResponse = assigneePickerDialog.showAndWait(); if (wasCancelled(assigneeDialogResponse)) { return; } Optional<String> newlyAssignedAssignee = assigneeDialogResponse.get().getAssigneeLoginName(); if (!issue.getAssignee().equals(newlyAssignedAssignee)) { addActionIfAssigneeChanged(issue, newlyAssignedAssignee); } }

Target:
private void showAssigneePicker(TurboIssue issue) { List<TurboUser> assignees = ui.logic.getRepo(issue.getRepoId()).getUsers(); Optional<AssigneePickerDialog.AssigneePickerDialogResponse> assigneeDialogResponse = new AssigneePickerDialog(stage, issue, assignees).showAndWait(); if (wasCancelled(assigneeDialogResponse)) { return; } Optional<String> newlyAssignedAssignee = assigneeDialogResponse.get().getAssigneeLoginName(); changeAssignee(issue, newlyAssignedAssignee); }
Source:
public void recenterMap(fr.free.nrw.commons.location.LatLng curLatLng) { if (curLatLng == null) { return; } else if (!locationManager.isLocationEnabled()) { showEnableLocationDialog(); } addCurrentLocationMarker(curLatLng); CameraPosition position; if (ViewUtil.isPortrait(getActivity())) { position = new CameraPosition.Builder() .target(isListBottomSheetExpanded() ? new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT, curLatLng.getLongitude()) : new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) .zoom(isListBottomSheetExpanded() ? ZOOM_LEVEL : mapBox.getCameraPosition().zoom) .build(); } else { position = new CameraPosition.Builder() .target(isListBottomSheetExpanded() ? new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE, curLatLng.getLongitude()) : new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) .zoom(isListBottomSheetExpanded() ? ZOOM_LEVEL : mapBox.getCameraPosition().zoom) .build(); } mapBox.animateCamera(CameraUpdateFactory.newCameraPosition(position), 1000); }

Target:
public void recenterMap(fr.free.nrw.commons.location.LatLng curLatLng) { if (curLatLng == null) { if (!(locationManager.isNetworkProviderEnabled() || locationManager.isGPSProviderEnabled())) { showLocationOffDialog(); } return; } addCurrentLocationMarker(curLatLng); CameraPosition position; if (ViewUtil.isPortrait(getActivity())) { position = new CameraPosition.Builder() .target(isListBottomSheetExpanded() ? new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT, curLatLng.getLongitude()) : new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) .zoom(isListBottomSheetExpanded() ? ZOOM_LEVEL : mapBox.getCameraPosition().zoom) .build(); } else { position = new CameraPosition.Builder() .target(isListBottomSheetExpanded() ? new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE, curLatLng.getLongitude()) : new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) .zoom(isListBottomSheetExpanded() ? ZOOM_LEVEL : mapBox.getCameraPosition().zoom) .build(); } mapBox.animateCamera(CameraUpdateFactory.newCameraPosition(position), 1000); }
Source:
public CommandResult<CanvasViolation> translate( final Element element, final double dx, final double dy ) { final Double[] p; try { p = GraphUtils.getPosition( ( View ) element.getContent() ); } catch ( ClassCastException e ) { LOGGER.log( Level.WARNING, "Update element's position comman only cannot be applied to View elements." ); return CanvasCommandResultBuilder.FAILED; } final double tx = p[ 0 ] + dx; final double ty = p[ 1 ] + dy; return move( element, tx, ty ); }

Target:
public CommandResult<CanvasViolation> translate( final Element element, final double dx, final double dy ) { final Point2D p; try { p = GraphUtils.getPosition( ( View ) element.getContent() ); } catch ( ClassCastException e ) { LOGGER.log( Level.WARNING, "Update element's position command only cannot be applied to View elements." ); return CanvasCommandResultBuilder.FAILED; } final double tx = p.getX() + dx; final double ty = p.getY() + dy; return move( element, tx, ty ); }
Source:
public boolean canSave(IPath file) { IRemoteFileProxy proxy = null; URI fileURI = null; try { fileURI = new URI(file.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(fileURI); } catch (URISyntaxException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } IFileStore fileStore = proxy.getResource(fileURI.getPath()); if (fileStore.fetchInfo().exists()) { String msg = MessageFormat.format( Messages.PerfSaveSession_file_exists_msg, new Object[] { fileStore.getName() }); return MessageDialog.openQuestion(Display.getCurrent() .getActiveShell(), Messages.PerfSaveSession_file_exists_title, msg); } return true; }

Target:
public boolean canSave(IPath file) { IRemoteFileProxy proxy = null; URI fileURI = null; try { fileURI = new URI(file.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(fileURI); } catch (URISyntaxException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } catch (CoreException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } IFileStore fileStore = proxy.getResource(fileURI.getPath()); if (fileStore.fetchInfo().exists()) { String msg = MessageFormat.format( Messages.PerfSaveSession_file_exists_msg, new Object[] { fileStore.getName() }); return MessageDialog.openQuestion(Display.getCurrent() .getActiveShell(), Messages.PerfSaveSession_file_exists_title, msg); } return true; }
Source:
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { LOG.debug("resourceOffers: Currently have " + _offers.size() + " offers buffered" + (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (_offers != null && isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: " + offer.getHostname() + ", offerId: " + offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { LOG.debug("resourceOffers: Declining offer from host: " + offer.getHostname() + ", offerId: " + offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have " + _offers.size() + " offers buffered:" + offerMapToString(_offers)); } }

Target:
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { if (_offers == null) { return; } LOG.debug("resourceOffers: Currently have " + _offers.size() + " offers buffered" + (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: " + offer.getHostname() + ", offerId: " + offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { LOG.debug("resourceOffers: Declining offer from host: " + offer.getHostname() + ", offerId: " + offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have " + _offers.size() + " offers buffered:" + offerMapToString(_offers)); } }
Source:
public void continueOrPropagate(RetryableException ex) { ExceptionRetryBehaviour retryBehaviour = ExceptionRetryBehaviour.getRetryBehaviourForException(ex); synchronized (this) { if (mostRecentServerIndex.get() != null && mostRecentServerIndex.get() == failoverCount.get()) { long failures = failuresSinceLastSwitch.incrementAndGet(); if (shouldSwitchNode(retryBehaviour, failures)) { failoverToNextNode(retryBehaviour); } else if (retryBehaviour.shouldRetryInfinitelyManyTimes()) { failuresSinceLastSwitch.set(0); } } } checkAndHandleFailure(ex); if (retryBehaviour.shouldBackoffAndTryOtherNodes()) { if (failoverCount.get() % servers.size() == 0) { pauseForBackoff(ex, 1000L); } else { pauseForBackoff(ex); } } }

Target:
public void continueOrPropagate(RetryableException ex) { ExceptionRetryBehaviour retryBehaviour = ExceptionRetryBehaviour.getRetryBehaviourForException(ex); synchronized (this) { if (mostRecentServerIndex.get() != null && mostRecentServerIndex.get() == failoverCount.get()) { long failures = failuresSinceLastSwitch.incrementAndGet(); if (shouldSwitchNode(retryBehaviour, failures)) { failoverToNextNode(retryBehaviour); } else if (retryBehaviour.shouldRetryInfinitelyManyTimes()) { failuresSinceLastSwitch.set(0); } } } checkAndHandleFailure(ex); if (retryBehaviour.shouldBackoffAndTryOtherNodes()) { int numFailovers = failoverCount.get(); if (numFailovers > 0 && numFailovers % servers.size() == 0) { pauseForBackoff(ex, BACKOFF_BEFORE_ROUND_ROBIN_RETRY_MILLIS); } else { pauseForBackoff(ex); } } }
Source:
public void testInitFromRDFS() throws IOException, InterruptedException { String separator = System.getProperty("file.separator"); String classpath = System.getProperty("java.class.path"); String java = System.getProperty("java.home") + separator + "bin" + separator + "java"; List<String> args = Arrays.asList(java, "-cp", classpath, "org.apache.jena.test.RDFSJenaInitTestApp"); Process child = new ProcessBuilder().command(args) .redirectError(ProcessBuilder.Redirect.INHERIT) .redirectOutput(ProcessBuilder.Redirect.PIPE) .start(); Assert.assertEquals(0, child.waitFor()); Assert.assertEquals(RDFS.subClassOf.toString()+"\n", IOUtils.toString(child.getInputStream())); }

Target:
public void testInitFromRDFS() throws IOException, InterruptedException { String separator = System.getProperty("file.separator"); String classpath = System.getProperty("java.class.path"); String java = System.getProperty("java.home") + separator + "bin" + separator + "java"; if (SystemUtils.IS_OS_WINDOWS) java += ".exe"; List<String> args = Arrays.asList(java, "-cp", classpath, "org.apache.jena.test.RDFSJenaInitTestApp"); Process child = new ProcessBuilder().command(args) .redirectError(ProcessBuilder.Redirect.INHERIT) .redirectOutput(ProcessBuilder.Redirect.PIPE) .start(); Assert.assertEquals(0, child.waitFor()); Assert.assertEquals(RDFS.subClassOf.toString()+"\n", IOUtils.toString(child.getInputStream())); }
Source:
public void publish(EventMessage<?> msg, P declaringInstance) { if (forwardEvents) { Iterable<C> targets = eventTargetResolver.apply(msg, declaringInstance); if (targets != null) { Collection<C> copy = new ArrayList<>(); targets.forEach(copy::add); copy.forEach(target -> this.entityModel.publish(msg, target)); } } }

Target:
public void publish(EventMessage<?> msg, P declaringInstance) { if (forwardEvents) { Iterable<C> targets = eventTargetResolver.apply(msg, declaringInstance); if (targets != null) { safeForEach(targets, target -> this.entityModel.publish(msg, target)); } } }
Source:
public static String getAttributeKeyString(final Set<Integer> keys, final Schema schema) { String keyString = ""; int counter = 1; for (int key : keys) { keyString += schema.getColumnName(key); if (counter != keys.size()) { keyString += ","; } counter++; } return keyString; }

Target:
public static String getAttributeKeyString(final Set<Integer> keys, final Schema schema) { return Joiner.on(",").join(getAttributeKeySchema(keys, schema).getColumnNames()); }
Source:
public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) { getCertificateClient(httpClient, serviceVersion); createCertificateRunner((policy) -> { getCertificateClient(httpClient, serviceVersion); String certName = generateResourceId("testCer"); SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName, policy); certPoller.waitForCompletion(); KeyVaultCertificateWithPolicy expected = certPoller.getFinalResult(); assertEquals(certName, expected.getName()); assertNotNull(expected.getProperties().getCreatedOn()); deleteAndPurgeCertificate(certName); }); }

Target:
public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) { createCertificateClient(httpClient, serviceVersion); createCertificateRunner((policy) -> { String certName = generateResourceId("testCer"); SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName, policy); certPoller.waitForCompletion(); KeyVaultCertificateWithPolicy expected = certPoller.getFinalResult(); assertEquals(certName, expected.getName()); assertNotNull(expected.getProperties().getCreatedOn()); deleteAndPurgeCertificate(certName); }); }
Source:
public static String encode(final FastqRecord record) { final int capacity = record.getReadLength() * 2 + record.getReadName().length() + 5; return write(new StringBuilder(capacity), record).toString(); }

Target:
public static String encode(final FastqRecord record) { int capacity = record.getReadLength() * 2 + 5; if (record.getReadName() != null) { capacity += record.getReadName().length(); } return write(new StringBuilder(capacity), record).toString(); }
Source:
public TaskletConfiguration getWorkerTaskletConf() { return TaskletConfiguration.newBuilder() .setId(dolphinJobId + "-" + WorkerTasklet.TASKLET_ID_PREFIX) .setTaskletClass(WorkerTasklet.class) .setTaskletMsgHandlerClass(WorkerSideMsgHandler.class) .setUserParamConf(Configurations.merge( Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(DolphinJobId.class, dolphinJobId) .bindNamedParameter(StartingEpochIdx.class, Integer.toString(progressTracker.getGlobalMinEpochIdx())) .bindNamedParameter(ModelTableId.class, modelTableId) .bindNamedParameter(InputTableId.class, inputTableId) .bindNamedParameter(OfflineModelEvaluation.class, Boolean.toString(offlineModelEval)) .build(), workerConf)).build(); }

Target:
public TaskletConfiguration getWorkerTaskletConf() { return TaskletConfiguration.newBuilder() .setId(dolphinJobId + "-" + WorkerTasklet.TASKLET_ID) .setTaskletClass(WorkerTasklet.class) .setTaskletMsgHandlerClass(WorkerSideMsgHandler.class) .setUserParamConf(Configurations.merge( Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(DolphinJobId.class, dolphinJobId) .bindNamedParameter(StartingEpochIdx.class, Integer.toString(progressTracker.getGlobalMinEpochIdx())) .bindNamedParameter(ModelTableId.class, modelTableId) .bindNamedParameter(InputTableId.class, inputTableId) .bindNamedParameter(OfflineModelEvaluation.class, Boolean.toString(offlineModelEval)) .build(), workerConf)).build(); }
Source:
public JSONObject(JSONTokener x) throws JSONException { this(); char c; String key; if (x.nextClean() != '{') { throw x.syntaxError("A JSONObject text must begin with '{'"); } for (;;) { c = x.nextClean(); switch (c) { case 0: throw x.syntaxError("A JSONObject text must end with '}'"); case '}': return; default: x.back(); key = x.nextValue().toString(); } c = x.nextClean(); if (c != ':') { throw x.syntaxError("Expected a ':' after a key"); } try { this.putOnce(key, x.nextValue()); } catch (JSONException _e) { throw x.syntaxError(_e.getMessage()); } switch (x.nextClean()) { case ';': case ',': if (x.nextClean() == '}') { return; } x.back(); break; case '}': return; default: throw x.syntaxError("Expected a ',' or '}'"); } } }

Target:
public JSONObject(JSONTokener x) throws JSONException { this(); char c; String key; if (x.nextClean() != '{') { throw x.syntaxError("A JSONObject text must begin with '{'"); } for (;;) { c = x.nextClean(); switch (c) { case 0: throw x.syntaxError("A JSONObject text must end with '}'"); case '}': return; default: x.back(); key = x.nextValue().toString(); } c = x.nextClean(); if (c != ':') { throw x.syntaxError("Expected a ':' after a key"); } try { this.putOnce(key, x.nextValue()); } catch (JSONException e) { throw x.syntaxError(e.getMessage()); } switch (x.nextClean()) { case ';': case ',': if (x.nextClean() == '}') { return; } x.back(); break; case '}': return; default: throw x.syntaxError("Expected a ',' or '}'"); } } }