auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private long determineCanonicalizedLength(InputStream raw) throws IOException { long length = 0; final EolCanonicalizingInputStream is = new EolCanonicalizingInputStream( raw); for (int read = 0; read != -1; read = is.read(contentReadBuffer)) { length += read; } return length; }

Target:
private long determineCanonicalizedLength(InputStream raw) throws IOException { long length = 0; final InputStream is = new EolCanonicalizingInputStream(raw); for (;;) { int r = is.read(contentReadBuffer); if (r <= 0) break; length += r; } return length; }
Source:
public ActionResult execute() { String frontendUrl = getRequestParamValue("frontendUrl"); if (frontendUrl == null) { frontendUrl = ""; } AuthInfo output; if (userInfo == null) { output = new AuthInfo( gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.STUDENT_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.INSTRUCTOR_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.ADMIN_HOME_PAGE) ); } else { String googleId = userInfo.getId(); AccountAttributes accountInfo = logic.getAccount(googleId); String institute = null; if (accountInfo != null) { institute = accountInfo.getInstitute(); } output = new AuthInfo(userInfo, institute, authType == AuthType.MASQUERADE); } String csrfToken = StringHelper.encrypt(req.getSession().getId()); String existingCsrfToken = HttpRequestHelper.getCookieValueFromRequest(req, Const.CsrfConfig.TOKEN_COOKIE_NAME); if (!csrfToken.equals(existingCsrfToken)) { Cookie csrfTokenCookie = new Cookie(Const.CsrfConfig.TOKEN_COOKIE_NAME, csrfToken); csrfTokenCookie.setSecure(!Config.isDevServer()); csrfTokenCookie.setPath("/"); resp.addCookie(csrfTokenCookie); ArrayList<Cookie> cookieLst = new ArrayList<>(); cookieLst.add(csrfTokenCookie); return new JsonResult(output, cookieLst); } return new JsonResult(output); }

Target:
public ActionResult execute() { String frontendUrl = getRequestParamValue("frontendUrl"); if (frontendUrl == null) { frontendUrl = ""; } AuthInfo output; if (userInfo == null) { output = new AuthInfo( gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.STUDENT_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.INSTRUCTOR_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.ADMIN_HOME_PAGE) ); } else { String googleId = userInfo.getId(); AccountAttributes accountInfo = logic.getAccount(googleId); String institute = null; if (accountInfo != null) { institute = accountInfo.getInstitute(); } output = new AuthInfo(userInfo, institute, authType == AuthType.MASQUERADE); } String csrfToken = StringHelper.encrypt(req.getSession().getId()); String existingCsrfToken = HttpRequestHelper.getCookieValueFromRequest(req, Const.CsrfConfig.TOKEN_COOKIE_NAME); if (!csrfToken.equals(existingCsrfToken)) { Cookie csrfTokenCookie = new Cookie(Const.CsrfConfig.TOKEN_COOKIE_NAME, csrfToken); csrfTokenCookie.setSecure(!Config.isDevServer()); csrfTokenCookie.setPath("/"); List<Cookie> cookieList = Arrays.asList(csrfTokenCookie); return new JsonResult(output, cookieList); } return new JsonResult(output); }
Source:
private void checkRoleIsAssumableWithoutExternalId(CredentialVerificationContext credentialVerificationContext, AwsCredentialView awsCredential) { if (credentialVerificationContext.getCreationVerification()) { String roleArn = awsCredential.getRoleArn(); try { credentialClient.retrieveSessionCredentialsWithoutExternalId(awsCredential); String message = String.format("CDP Control Pane is able to perform 'sts:AssumeRole' on '%s' role without external id. " + "The role is vulnerable and could be exploited by confused deputy attacks. " + "Please update the role's trust relationship to have a condition on external id " + "or re-create the role with external id configured in the create role wizard.", roleArn); LOGGER.warn(message); throw new AwsPossibleConfusedDeputyException(message); } catch (AmazonClientException ae) { if (ae.getMessage().contains(ROLE_IS_NOT_ASSUMABLE_ERROR_MESSAGE_INDICATOR)) { String msg = String.format("Consider the specified role as secured. " + "CDP Control Pane is not authorized to perform sts:AssumeRole on '%s' role without external Id.", roleArn); LOGGER.info(msg); } else { throw ae; } } } }

Target:
private void checkRoleIsAssumableWithoutExternalId(CredentialVerificationContext credentialVerificationContext, AwsCredentialView awsCredential) { if (credentialVerificationContext.getCreationVerification()) { String roleArn = awsCredential.getRoleArn(); try { credentialClient.retrieveSessionCredentialsWithoutExternalId(awsCredential); String message = String.format("CDP Control Pane is able to perform 'sts:AssumeRole' on '%s' role without external id. " + "The role is vulnerable and could be exploited by confused deputy attacks. " + "Please update the role's trust relationship to have a condition on external id " + "or re-create the role with external id configured in the create role wizard.", roleArn); LOGGER.warn(message); throw new AwsConfusedDeputyException(message); } catch (AmazonClientException ae) { if (ae.getMessage().contains(ROLE_IS_NOT_ASSUMABLE_ERROR_MESSAGE_INDICATOR)) { String msg = String.format("Consider the specified role as secured. " + "CDP Control Pane is not authorized to perform sts:AssumeRole on '%s' role without external Id.", roleArn); LOGGER.info(msg); } else { throw ae; } } } }
Source:
public static Optional<InsightCard> getInsights(final Long accountId, final DeviceId deviceId, final DeviceDataInsightQueryDAO deviceDataDAO, final SleepStatsDAODynamoDB sleepStatsDAODynamoDB) { final Optional<Integer> timeZoneOffsetOptional = sleepStatsDAODynamoDB.getTimeZoneOffset(accountId); if (!timeZoneOffsetOptional.isPresent()) { LOGGER.debug("action=insight_absent-insight=bed_light_duration-reason=timezoneoffset_absent-account_id={}", accountId); return Optional.absent(); } final Integer timeZoneOffset = timeZoneOffsetOptional.get(); final List<DeviceData> deviceDatas = getDeviceData(accountId, deviceId, deviceDataDAO, timeZoneOffset); if (deviceDatas.isEmpty()) { LOGGER.debug("action=insight_absent-insight=bed_light_duration-reason=device_datas_empty-account_id={}", accountId); return Optional.absent(); } final Integer avgLightOn = getInsightsHelper(deviceDatas, accountId); return scoreCardBedLightDuration(avgLightOn, accountId); }

Target:
public static Optional<InsightCard> getInsights(final Long accountId, final DeviceId deviceId, final DeviceDataInsightQueryDAO deviceDataDAO, final SleepStatsDAODynamoDB sleepStatsDAODynamoDB) { final Optional<Integer> timeZoneOffsetOptional = sleepStatsDAODynamoDB.getTimeZoneOffset(accountId); if (!timeZoneOffsetOptional.isPresent()) { LOGGER.debug("action=insight_absent insight=bed_light_duration reason=timezoneoffset_absent account_id={}", accountId); return Optional.absent(); } final Integer timeZoneOffset = timeZoneOffsetOptional.get(); final List<DeviceData> deviceDatas = getDeviceData(accountId, deviceId, deviceDataDAO, timeZoneOffset); if (deviceDatas.isEmpty()) { LOGGER.debug("action=insight_absent insight=bed_light_duration reason=device_datas_empty account_id={}", accountId); return Optional.absent(); } final Integer avgLightOn = getInsightsHelper(deviceDatas, accountId); return scoreCardBedLightDuration(avgLightOn, accountId); }
Source:
private void configureFetchSpec(CloneOperation op, GitRepositoryInfo gitRepositoryInfo, String remoteName) { for (String fetchRefSpec : gitRepositoryInfo.getFetchRefSpecs()) { op.addPostCloneTask(new ConfigureFetchAfterCloneTask(remoteName, fetchRefSpec)); } }

Target:
private void configureFetchSpec(CloneOperation op, GitRepositoryInfo gitRepositoryInfo, String remoteName) { for (String fetchRefSpec : gitRepositoryInfo.getFetchRefSpecs()) op.addPostCloneTask(new ConfigureFetchAfterCloneTask(remoteName, fetchRefSpec)); }
Source:
default void checkTimeoutPrecision(Duration duration, String timeoutName) { checkArgument(duration.minusMillis(duration.toMillis()).isZero(), "Timeout should be a multiple of milliseconds", SafeArg.of("timeoutName", timeoutName), SafeArg.of("duration", duration), UnsafeArg.of("uris", uris())); }

Target:
default void checkTimeoutPrecision(Duration duration, String timeoutName) { checkArgument(duration.minusMillis(duration.toMillis()).isZero(), "Timeouts with sub-millisecond precision are not supported", SafeArg.of("timeoutName", timeoutName), SafeArg.of("duration", duration), UnsafeArg.of("uris", uris())); }
Source:
void onEditMessage(ClickEvent e) { if (Gerrit.isSignedIn()) { editCommitMessageAction.onEdit(); } else { Gerrit.doSignIn(getToken()); } }

Target:
void onEditMessage(ClickEvent e) { editMessageAction.onEdit(); }
Source:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); RevWalk walk = new RevWalk(repo); try { RevObject obj = walk.parseAny(view.getRevision().getId()); switch (obj.getType()) { case OBJ_COMMIT: try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { out.write(((RevCommit)obj).getRawBuffer()); } break; default: res.setStatus(SC_NOT_FOUND); break; } } finally { walk.release(); } }

Target:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); ObjectLoader loader = reader.open(view.getRevision().getId(), OBJ_COMMIT); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { loader.copyTo(out); } } }
Source:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = fTopIndex + countPerPage(); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } }

Target:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage(), items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } }
Source:
protected Object doReceive() { Assert.state(this.running.get(), getComponentName() + " is not running"); AbstractFileInfo<F> file = poll(); if (file != null) { try { String remotePath = remotePath(file); Session<?> session = this.remoteFileTemplate.getSession(); try { return getMessageBuilderFactory() .withPayload(session.readRaw(remotePath)) .setHeader(IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE, session) .setHeader(FileHeaders.REMOTE_DIRECTORY, file.getRemoteDirectory()) .setHeader(FileHeaders.REMOTE_FILE, file.getFilename()) .setHeader(FileHeaders.REMOTE_FILE_INFO, this.fileInfoJson ? file.toJson() : file); } catch (IOException e) { throw new MessagingException("IOException when retrieving " + remotePath, e); } } catch (RuntimeException e) { resetFilterIfnecessary(file); throw e; } } return null; }

Target:
protected Object doReceive() { Assert.state(this.running.get(), () -> getComponentName() + " is not running"); AbstractFileInfo<F> file = poll(); if (file != null) { try { String remotePath = remotePath(file); Session<?> session = this.remoteFileTemplate.getSession(); try { return getMessageBuilderFactory() .withPayload(session.readRaw(remotePath)) .setHeader(IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE, session) .setHeader(FileHeaders.REMOTE_DIRECTORY, file.getRemoteDirectory()) .setHeader(FileHeaders.REMOTE_FILE, file.getFilename()) .setHeader(FileHeaders.REMOTE_FILE_INFO, this.fileInfoJson ? file.toJson() : file); } catch (IOException e) { throw new UncheckedIOException("IOException when retrieving " + remotePath, e); } } catch (RuntimeException e) { resetFilterIfNecessary(file); throw e; } } return null; }
Source:
private static void assertGeometryEquals(OGCGeometry actual, OGCGeometry expected) { if (expected.isEmpty()) { assertTrue(actual.isEmpty()); } else { actual.setSpatialReference(null); expected.setSpatialReference(null); assertEquals(actual, expected); } }

Target:
private static void assertGeometryEquals(OGCGeometry actual, OGCGeometry expected) { actual.setSpatialReference(null); expected.setSpatialReference(null); ensureEnvelopeLoaded(actual); ensureEnvelopeLoaded(expected); assertEquals(actual, expected); }
Source:
protected Boolean visitInListExpression(InListExpression actual, Node expected) { if (!(expected instanceof InListExpression)) { return false; } InListExpression expectedInList = (InListExpression) expected; if (actual.getValues().size() == expectedInList.getValues().size()) { boolean verified = true; for (int i = 0; i < actual.getValues().size(); i++) { verified &= process(actual.getValues().get(i), expectedInList.getValues().get(i)); } return verified; } return false; }

Target:
protected Boolean visitInListExpression(InListExpression actual, Node expected) { if (!(expected instanceof InListExpression)) { return false; } InListExpression expectedInList = (InListExpression) expected; return process(actual.getValues(), expectedInList.getValues()); }
Source:
protected void doTestTrashCheckedInDocument(boolean expectCheckedIn) { DocumentModel folder = session.createDocumentModel("/", "folder", "Folder"); folder = session.createDocument(folder); DocumentModel doc = session.createDocumentModel(folder.getPathAsString(), "doc", "File"); doc = session.createDocument(doc); doc.checkIn(VersioningOption.MAJOR, null); assertFalse(doc.isCheckedOut()); session.save(); trashService.trashDocument(doc); doc = session.getDocument(new IdRef(doc.getId())); assertTrue(doc.isTrashed()); if (expectCheckedIn) { assertFalse(doc.isCheckedOut()); } else { assertTrue(doc.isCheckedOut()); } trashService.untrashDocument(doc); doc = session.getDocument(new IdRef(doc.getId())); assertFalse(doc.isTrashed()); if (expectCheckedIn) { assertFalse(doc.isCheckedOut()); } else { assertTrue(doc.isCheckedOut()); } DocumentModel doc2 = session.createDocumentModel("/folder", "doc2", "File"); doc2 = session.createDocument(doc2); doc2.checkIn(VersioningOption.MAJOR, null); session.save(); session.followTransition(doc2, "approve"); doc2 = session.getDocument(new IdRef(doc2.getId())); assertEquals("approved", doc2.getCurrentLifeCycleState()); assertTrue(doc2.isCheckedOut()); }

Target:
protected void doTestTrashCheckedInDocument(boolean expectCheckedIn) { DocumentModel folder = session.createDocumentModel("/", "folder", "Folder"); folder = session.createDocument(folder); DocumentModel doc = session.createDocumentModel("/folder", "doc", "File"); doc = session.createDocument(doc); doc.checkIn(VersioningOption.MAJOR, null); assertFalse(doc.isCheckedOut()); session.save(); trashService.trashDocument(doc); doc = session.getDocument(new IdRef(doc.getId())); assertTrue(doc.isTrashed()); if (expectCheckedIn) { assertFalse(doc.isCheckedOut()); } else { assertTrue(doc.isCheckedOut()); } trashService.untrashDocument(doc); doc = session.getDocument(new IdRef(doc.getId())); assertFalse(doc.isTrashed()); if (expectCheckedIn) { assertFalse(doc.isCheckedOut()); } else { assertTrue(doc.isCheckedOut()); } DocumentModel doc2 = session.createDocumentModel("/folder", "doc2", "File"); doc2 = session.createDocument(doc2); doc2.checkIn(VersioningOption.MAJOR, null); session.save(); session.followTransition(doc2, "approve"); doc2 = session.getDocument(new IdRef(doc2.getId())); assertEquals("approved", doc2.getCurrentLifeCycleState()); assertTrue(doc2.isCheckedOut()); }
Source:
public static String generateJsonDiskDescription(Disk disk) throws IOException { String diskAlias = disk.getDiskAlias(); String diskDescription = disk.getDiskDescription() != null ? disk.getDiskDescription() : ""; int diskDescriptionMetadataPotentialLength = METADATA_DESCRIPTION_VALUE_MAX_LENGTH - DESCRIPTION_METADATA_OVERHEAD_LENGTH; if (diskAlias.length() <= diskDescriptionMetadataPotentialLength) { diskDescriptionMetadataPotentialLength -= diskAlias.length(); if (diskDescription.length() > diskDescriptionMetadataPotentialLength) { diskDescription = diskDescription.substring(0, diskDescriptionMetadataPotentialLength); log.warn("Can't store full disk description since it's too long. " + "Truncating and storing {}={}.", disk.getId(), DISK_DESCRIPTION, diskDescription); } } else { diskAlias = diskAlias.substring(0, diskDescriptionMetadataPotentialLength); diskDescription = StringUtils.EMPTY; log.warn("Can't store full disk alias since it's too long. " + "Truncating and storing {}={}.", disk.getId(), DISK_ALIAS, diskAlias); log.warn("Can't store disk description since the alias is too long. " + "The description will be stored as an empty string.", disk.getId()); } Map<String, Object> description = new TreeMap<>(); description.put(DISK_ALIAS, diskAlias); description.put(DISK_DESCRIPTION, diskDescription); return JsonHelper.mapToJson(description, false); }

Target:
public String generateJsonDiskDescription(Disk disk) throws IOException { Map<String, Object> description = new TreeMap<>(); description.put(DISK_ALIAS, disk.getDiskAlias()); description.put(DISK_DESCRIPTION, StringUtils.defaultString(disk.getDiskDescription())); return JsonHelper.mapToJson(generateJsonDiskDescription(description, DESCRIPTION_FIELDS_PRIORITY), false); }
Source:
protected void beforeTest() { beforeTestSetup(); client = clientSetup(pipeline -> new KeyClientBuilder() .pipeline(pipeline) .vaultUrl(getEndpoint()) .buildAsyncClient()); }

Target:
protected void beforeTest() { beforeTestSetup(); }
Source:
public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { switch (n.getToken()) { case SCRIPT: enterModule(n, t.getInput().getPath()); break; case IMPORT: case EXPORT: visitImportOrExport(t, n); break; case CALL: if (n.isCall() && n.getFirstChild().matchesQualifiedName("goog.loadModule")) { loadModuleCall = n; enterModule(n, null); } break; case MODULE_BODY: currentModule.hasModuleBody = true; break; case DYNAMIC_IMPORT: visitDynamicImport(t, n); default: break; } return true; }

Target:
public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { switch (n.getToken()) { case SCRIPT: enterModule(t, n, t.getInput().getPath()); break; case IMPORT: case EXPORT: visitImportOrExport(t, n); break; case CALL: if (n.isCall() && n.getFirstChild().matchesQualifiedName("goog.loadModule")) { loadModuleCall = n; enterModule(t, n, null); } break; case MODULE_BODY: currentModule.hasModuleBody = true; break; case DYNAMIC_IMPORT: visitDynamicImport(n); break; default: break; } return true; }
Source:
public static LoggingConfigWatchdog configureAndWatch(long delay) { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); URL url = contextClassLoader.getResource("log4j.xml"); if (url == null) { return null; } try { return Log4jWatchdog.watch(url.getFile(), delay); } catch (LinkageError cause) { return null; } }

Target:
public static Log4jWatchdogHandle configureAndWatch(long delay) { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); URL url = contextClassLoader.getResource("log4j.xml"); if (url == null) { return null; } try { return Log4jWatchdog.watch(url.getFile(), delay); } catch (LinkageError cause) { return null; } }
Source:
public Optional<Context> getModelClass() { final Context context = new Context(); return Optional.of(context); }

Target:
public Optional<Context> getModelClass() { return Optional.of(new Context()); }
Source:
private void glusterHostRemove(Guid sourceClusterId) { VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostRemove, new GlusterHostRemoveVDSParameters((getClusterUtils().getUpServer(sourceClusterId)).getId(), getVds().gethost_name(), false)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_REMOVE_FAILED; return; } }

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 (getSucceeded()) { return true; } else { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_REMOVE_FAILED; return false; } }
Source:
private void copyData(VmBase source, VmBase dest) { for (Field srcFld : VmBase.class.getDeclaredFields()) { try { if (srcFld.getAnnotation(CopyOnNewVersion.class) != null) { srcFld.setAccessible(true); Field dstFld = VmBase.class.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(dest, srcFld.get(source)); } } catch (Exception exp) { log.errorFormat("Failed to copy field {0} of new version to VM {1} ({2}), error: {3}", srcFld.getName(), source.getName(), source.getId(), exp.getMessage()); } } }

Target:
private boolean copyData(VmBase source, VmBase dest) { for (Field srcFld : VmBase.class.getDeclaredFields()) { try { if (srcFld.getAnnotation(CopyOnNewVersion.class) != null) { srcFld.setAccessible(true); Field dstFld = VmBase.class.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(dest, srcFld.get(source)); } } catch (Exception exp) { log.errorFormat("Failed to copy field {0} of new version to VM {1} ({2}), error: {3}", srcFld.getName(), source.getName(), source.getId(), exp.getMessage()); return false; } } return true; }
Source:
public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); mBlockInStream = null; } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; }

Target:
public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; }
Source:
public String getImage() { return getText(); }

Target:
public String getImage() { return null; }
Source:
public BluetoothDevice getDevice(BluetoothAddress address) { if (devices.containsKey(address.toString())) { return devices.get(address.toString()); } else { synchronized (devices) { if (devices.containsKey(address.toString())) { return devices.get(address.toString()); } else { BluetoothDevice device = new BlueZBluetoothDevice(this, address, ""); devices.put(address.toString(), device); return device; } } } }

Target:
public BluetoothDevice getDevice(BluetoothAddress address) { if (devices.containsKey(address.toString())) { return devices.get(address.toString()); } else { synchronized (devices) { if (devices.containsKey(address.toString())) { return devices.get(address.toString()); } else { BlueZBluetoothDevice device = new BlueZBluetoothDevice(this, address, ""); device.initialize(); devices.put(address.toString(), device); return device; } } } }
Source:
public Long saveOrUpdate(ChannelDTO channel) { Assert.notNull(channel); Assert.notNull(channel.getName()); ChannelEntity channelEntity = this.channelRepository.findByName(channel.getName()); if (channelEntity == null) { channelEntity = this.converterService.convert(channel, ChannelEntity.class); } else if (channelEntity.isDeleted() != null && channelEntity.isDeleted()) { channelEntity.setDeleted(false); } else { throw new DuplicateChannelException(channel.getName()); } ChannelEntity savedEntity = this.channelRepository.saveAndFlush(channelEntity); try { return savedEntity.getId(); } catch (NullPointerException ex) { return -1L; } }

Target:
public Long saveOrUpdate(ChannelDTO channel) { Assert.notNull(channel); Assert.notNull(channel.getName()); ChannelEntity channelEntity = this.channelRepository.findByName(channel.getName()); if (channelEntity == null) { channelEntity = this.converterService.convert(channel, ChannelEntity.class); } else if (channelEntity.isDeleted() != null && channelEntity.isDeleted()) { channelEntity.setDeleted(false); } else { throw new DuplicateChannelException(channel.getName()); } this.channelRepository.saveAndFlush(channelEntity); return channelEntity.getId(); }
Source:
public Hardware apply(VMHardware from) { final HardwareBuilder builder = new HardwareBuilder() .name(from.name) .providerId("azurecompute-arm") .id(from.name) .processors(ImmutableList.of(new Processor(from.numberOfCores, 2))) .ram(from.memoryInMB) .location(from.globallyAvailable ? null : FluentIterable.from(locations.get()) .firstMatch(LocationPredicates.idEquals(from.location)) .get()); if (from.resourceDiskSizeInMB != null) { builder.volume(new VolumeBuilder() .size(Float.valueOf(from.resourceDiskSizeInMB)) .type(Volume.Type.LOCAL) .build()); } if (from.osDiskSizeInMB != null) { builder.volume(new VolumeBuilder() .size(Float.valueOf(from.osDiskSizeInMB)) .type(Volume.Type.LOCAL) .build()); } ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder(); metadata.put("maxDataDiskCount", String.valueOf(from.maxDataDiskCount)); builder.userMetadata(metadata.build()); return builder.build(); }

Target:
public Hardware apply(VMHardware from) { final HardwareBuilder builder = new HardwareBuilder() .name(from.name()) .providerId(from.name()) .id(from.name()) .processors(ImmutableList.of(new Processor(from.numberOfCores(), 2))) .ram(from.memoryInMB()) .location(from.globallyAvailable() ? null : FluentIterable.from(locations.get()) .firstMatch(LocationPredicates.idEquals(from.location())) .get()); if (from.resourceDiskSizeInMB() != null) { builder.volume(new VolumeBuilder() .size(Float.valueOf(from.resourceDiskSizeInMB())) .type(Volume.Type.LOCAL) .build()); } if (from.osDiskSizeInMB() != null) { builder.volume(new VolumeBuilder() .size(Float.valueOf(from.osDiskSizeInMB())) .type(Volume.Type.LOCAL) .build()); } ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder(); metadata.put("maxDataDiskCount", String.valueOf(from.maxDataDiskCount())); builder.userMetadata(metadata.build()); return builder.build(); }
Source:
public void deleteElementOnComputeFunctionReturningNull() { LocalMap<String, String> map = sharedData.getLocalMap("foo"); map.put("hello", "world"); map.computeIfPresent("hello", (key, oldValue) -> null); assertNull(map.get("hello")); map.compute("hello", (key, oldValue) -> null); assertNull(map.get("hello")); map.put("hello", "world"); map.merge("hello", "world!!!!!!", (key, oldValue) -> null); assertNull(map.get("hello")); map.computeIfAbsent("hello", key -> null); assertNull(map.get("hello")); }

Target:
public void deleteElementOnComputeFunctionReturningNull() { LocalMap<String, String> map = sharedData.getLocalMap("foo"); map.put("hello", "world"); map.computeIfPresent("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); map.compute("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); map.put("hello", "world"); map.merge("hello", "world!!!!!!", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); map.computeIfAbsent("hello", key -> null); assertFalse(map.containsKey("hello")); }
Source:
public void configure(Binder binder) { binder.disableCircularProxies(); jaxrsBinder(binder).bindInjectionProvider(ClientInfo.class).to(ClientInfoSupplier.class); jaxrsBinder(binder).bindAdmin(ParsingExceptionMapper.class); jaxrsBinder(binder).bindAdmin(QueryParamExceptionMapper.class); jaxrsBinder(binder).bindAdmin(OverrideMethodFilter.class); jaxrsBinder(binder).bindAdmin(ThreadDumpResource.class); bindConfig(binder).bind(JaxrsConfig.class); newSetBinder(binder, Object.class, JaxrsResource.class).permitDuplicates(); newSetBinder(binder, JaxrsBinding.class, JaxrsResource.class).permitDuplicates(); newMapBinder(binder, new TypeLiteral<Class<?>>() {}, new TypeLiteral<Supplier<?>>() {}, JaxrsInjectionProvider.class); }

Target:
public void configure(Binder binder) { binder.disableCircularProxies(); jaxrsBinder(binder).bindInjectionProvider(ClientInfo.class).to(ClientInfoSupplier.class); jaxrsBinder(binder).bindAdmin(ParsingExceptionMapper.class); jaxrsBinder(binder).bindAdmin(QueryParamExceptionMapper.class); jaxrsBinder(binder).bindAdmin(ThreadDumpResource.class); newSetBinder(binder, Object.class, JaxrsResource.class).permitDuplicates(); newSetBinder(binder, JaxrsBinding.class, JaxrsResource.class).permitDuplicates(); newMapBinder(binder, new TypeLiteral<Class<?>>() { }, new TypeLiteral<Supplier<?>>() { }, JaxrsInjectionProvider.class); }
Source:
MethodHandle superMethodHandle(Method method) throws Exception { try { Class<?> declaringClass = method.getDeclaringClass(); return MethodHandles.lookup().findSpecial(declaringClass, method.getName(), MethodType.methodType(method.getReturnType(), method.getParameterTypes()), declaringClass); } catch (Exception e) { SUPER_METHOD_LOOKUP = PRIVATE_LOOKUP; return PRIVATE_LOOKUP.superMethodHandle(method); } }

Target:
MethodHandle superMethodHandle(Method method) throws Exception { try { return MethodHandles.lookup().unreflectSpecial(method, method.getDeclaringClass()); } catch (Exception e) { SUPER_METHOD_LOOKUP = FIND_SPECIAL; return FIND_SPECIAL.superMethodHandle(method); } }
Source:
protected void applyValidation() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (getControls().values().iterator().next().isDisposed()) { return; } Label validationIcon = null; switch (getControls().size()) { case 3: validationIcon = Label.class.cast(getControls().get( new SWTGridCell(0, 1, CustomControlSWTRenderer.this))); break; default: break; } if (validationIcon != null && !validationIcon.isDisposed()) { validationIcon.setImage(getValidationIcon(getVElement().getDiagnostic().getHighestSeverity())); validationIcon.setToolTipText(getVElement().getDiagnostic().getMessage()); } if (swtCustomControl != null) { swtCustomControl.applyValidation(); } } }); }

Target:
protected void applyValidation() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (getControls().size() == 0 || getControls().values().iterator().next().isDisposed()) { return; } Label validationIcon = null; switch (getControls().size()) { case 3: validationIcon = Label.class.cast(getControls().get( new SWTGridCell(0, 1, CustomControlSWTRenderer.this))); break; default: break; } if (validationIcon != null && !validationIcon.isDisposed()) { validationIcon.setImage(getValidationIcon(getVElement().getDiagnostic().getHighestSeverity())); validationIcon.setToolTipText(getVElement().getDiagnostic().getMessage()); } if (swtCustomControl != null) { swtCustomControl.applyValidation(); } } }); }
Source:
public void read_FOUND() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { Judgment firstJudgment = createCcJudgment(1); Judgment secondJudgment = createCcJudgment(2); Judgment thirdJudgment = createCcJudgment(3); Page<Judgment> firstPage = new PageImpl<Judgment>(Lists.newArrayList(firstJudgment, secondJudgment), new PageRequest(0, 2), 3); Page<Judgment> secondPage = new PageImpl<Judgment>(Lists.newArrayList(thirdJudgment), new PageRequest(1, 1), 3); Page<Judgment> thirdPage = new PageImpl<Judgment>(Lists.newArrayList()); when(judgmentRepository.findAllToIndex(any(Pageable.class))).thenReturn(firstPage, secondPage, thirdPage); Judgment actualFirst = judgmentIndexingReader.read(); Judgment actualSecond = judgmentIndexingReader.read(); Judgment actualThird = judgmentIndexingReader.read(); Judgment actualFourth = judgmentIndexingReader.read(); ArgumentCaptor<Pageable> pageArgCapture = ArgumentCaptor.forClass(Pageable.class); verify(judgmentRepository, atLeast(2)).findAllToIndex(pageArgCapture.capture()); Pageable firstPageRequestArg = pageArgCapture.getAllValues().get(0); assertEquals(0, firstPageRequestArg.getPageNumber()); Pageable secondPageRequestArg = pageArgCapture.getAllValues().get(1); assertEquals(1, secondPageRequestArg.getPageNumber()); assertEquals(firstJudgment.getId(), actualFirst.getId()); assertEquals(secondJudgment.getId(), actualSecond.getId()); assertEquals(thirdJudgment.getId(), actualThird.getId()); assertNull(actualFourth); }

Target:
public void read_FOUND() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { Judgment firstJudgment = createCcJudgment(1); Judgment secondJudgment = createCcJudgment(2); Judgment thirdJudgment = createCcJudgment(3); Page<Judgment> firstPage = new PageImpl<Judgment>(Lists.newArrayList(firstJudgment, secondJudgment), new PageRequest(0, 2), 3); Page<Judgment> secondPage = new PageImpl<Judgment>(Lists.newArrayList(thirdJudgment), new PageRequest(1, 1), 3); Page<Judgment> thirdPage = new PageImpl<Judgment>(Lists.newArrayList()); @SuppressWarnings({ "unused", "unchecked" }) OngoingStubbing<Page<Judgment>> thenReturn = when(judgmentRepository.findAllToIndex(any(Pageable.class))).thenReturn(firstPage, secondPage, thirdPage); Judgment actualFirst = judgmentIndexingReader.read(); Judgment actualSecond = judgmentIndexingReader.read(); Judgment actualThird = judgmentIndexingReader.read(); Judgment actualFourth = judgmentIndexingReader.read(); ArgumentCaptor<Pageable> pageArgCapture = ArgumentCaptor.forClass(Pageable.class); verify(judgmentRepository, atLeast(2)).findAllToIndex(pageArgCapture.capture()); Pageable firstPageRequestArg = pageArgCapture.getAllValues().get(0); assertEquals(0, firstPageRequestArg.getPageNumber()); Pageable secondPageRequestArg = pageArgCapture.getAllValues().get(1); assertEquals(1, secondPageRequestArg.getPageNumber()); assertEquals(firstJudgment.getId(), actualFirst.getId()); assertEquals(secondJudgment.getId(), actualSecond.getId()); assertEquals(thirdJudgment.getId(), actualThird.getId()); assertNull(actualFourth); }
Source:
@Test public void platformTypeThrows() throws IOException { Moshi moshi = new Moshi.Builder().build(); try { moshi.adapter(File.class); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Platform class java.io.File annotated requires explicit JsonAdapter to be registered"); } }

Target:
@Test public void platformTypeThrows() throws IOException { Moshi moshi = new Moshi.Builder().build(); try { moshi.adapter(File.class); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Platform class java.io.File annotated requires explicit JsonAdapter to be registered"); } try { moshi.adapter(KeyGenerator.class); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Platform class javax.crypto.KeyGenerator annotated requires explicit JsonAdapter to be registered"); } try { moshi.adapter(Pair.class); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Platform class android.util.Pair annotated requires explicit JsonAdapter to be registered"); } }
Source:
public void setNoMorePagesForLifespan(Lifespan lifespan) { noMorePagesForLifespan.add(lifespan); }

Target:
public void setNoMorePagesForLifespan(Lifespan lifespan) { requireNonNull(lifespan, "lifespan is null"); noMorePagesForLifespan.add(lifespan); }
Source:
protected Object executeScript( final ScriptableObject scriptable, final Scriptable scope, final String script, final Context cx ) throws Exception { ScriptableObject.defineClass( scope, JavaScriptResultSet.class ); @SuppressWarnings( "unchecked" ) Set<String> inputNames = getInputNames(); Iterator<String> inputNamesIterator = inputNames.iterator(); String inputName; Object inputValue; while ( inputNamesIterator.hasNext() ) { inputName = (String) inputNamesIterator.next(); if ( inputName.indexOf( '-' ) >= 0 ) { throw new IllegalArgumentException( Messages.getInstance().getErrorString( "JSRULE.ERROR_0006_INVALID_JS_VARIABLE", inputName ) ); } inputValue = getInputValue( inputName ); Object wrapper; if ( inputValue instanceof IPentahoResultSet ) { JavaScriptResultSet results = new JavaScriptResultSet(); results.setPrototype( scriptable ); results.setResultSet( (IPentahoResultSet) inputValue ); wrapper = Context.javaToJS( inputValue, results ); } else { inputValue = Encode.forHtml( Context.toString( inputValue ) ); wrapper = Context.javaToJS( inputValue, scope ); } ScriptableObject.putProperty( scope, inputName, wrapper ); } Object wrappedOut = Context.javaToJS( System.out, scope ); Object wrappedThis = Context.javaToJS( this, scope ); ScriptableObject.putProperty( scope, "out", wrappedOut ); ScriptableObject.putProperty( scope, "rule", wrappedThis ); return cx.evaluateString( scope, script, "<cmd>", 1, null ); }

Target:
protected Object executeScript( final ScriptableObject scriptable, final Scriptable scope, final String script, final Context cx ) throws Exception { ScriptableObject.defineClass( scope, JavaScriptResultSet.class ); @SuppressWarnings( "unchecked" ) Set<String> inputNames = getInputNames(); Iterator<String> inputNamesIterator = inputNames.iterator(); String inputName; Object inputValue; while ( inputNamesIterator.hasNext() ) { inputName = (String) inputNamesIterator.next(); if ( inputName.indexOf( '-' ) >= 0 ) { throw new IllegalArgumentException( Messages.getInstance().getErrorString( "JSRULE.ERROR_0006_INVALID_JS_VARIABLE", inputName ) ); } inputValue = getInputValue( inputName ); Object wrapper; if ( inputValue instanceof IPentahoResultSet ) { JavaScriptResultSet results = new JavaScriptResultSet(); results.setPrototype( scriptable ); results.setResultSet( (IPentahoResultSet) inputValue ); wrapper = Context.javaToJS( inputValue, results ); } else { wrapper = Context.javaToJS( inputValue, scope ); } ScriptableObject.putProperty( scope, inputName, wrapper ); } Object wrappedOut = Context.javaToJS( System.out, scope ); Object wrappedThis = Context.javaToJS( this, scope ); ScriptableObject.putProperty( scope, "out", wrappedOut ); ScriptableObject.putProperty( scope, "rule", wrappedThis ); return cx.evaluateString( scope, script, "<cmd>", 1, null ); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_travel_guide); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = setupDrawerToggle(); nvDrawer = (NavigationView) findViewById(R.id.nvView); View header = LayoutInflater.from(this).inflate(R.layout.nav_header, null); nvDrawer.addHeaderView(header); setupDrawerContent(nvDrawer); ivProfile = (ImageView) header.findViewById(R.id.ivProfile); tvProfileUsername = (TextView) header.findViewById(R.id.tvProfileUsername); tvProfileEmail = (TextView) header.findViewById(R.id.tvProfileEmail); mDrawer.setDrawerListener(drawerToggle); getSupportFragmentManager().addOnBackStackChangedListener(this); FoursquareConstants.setClientIdAndSecret( getApplicationContext().getResources().getString(R.string.foursquare_client_id), getApplicationContext().getResources().getString(R.string.foursquare_client_secret)); buildSettingsDialog(); city = "Any"; group = "Any"; season = "Any"; MenuItem item = nvDrawer.getMenu().findItem(R.id.login_fragment); if (Preferences.readBoolean(this, Preferences.User.LOG_IN_STATUS)) item.setTitle("LOGOUT"); else item.setTitle("LOGIN"); loginStatus = Preferences.readBoolean(this, Preferences.User.LOG_IN_STATUS); setContentFragment(new TripPlanListFragment()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_travel_guide); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = setupDrawerToggle(); nvDrawer = (NavigationView) findViewById(R.id.nvView); View header = LayoutInflater.from(this).inflate(R.layout.nav_header, null); nvDrawer.addHeaderView(header); setupDrawerContent(nvDrawer); ivProfile = (ImageView) header.findViewById(R.id.ivProfile); tvProfileUsername = (TextView) header.findViewById(R.id.tvProfileUsername); tvProfileEmail = (TextView) header.findViewById(R.id.tvProfileEmail); mDrawer.setDrawerListener(drawerToggle); getSupportFragmentManager().addOnBackStackChangedListener(this); FoursquareConstants.setClientIdAndSecret( getApplicationContext().getResources().getString(R.string.foursquare_client_id), getApplicationContext().getResources().getString(R.string.foursquare_client_secret)); buildSettingsDialog(); city = "Any"; group = "Any"; season = "Any"; mLoginStatus = Preferences.readBoolean(this, Preferences.User.LOG_IN_STATUS); setMenuItemLoginTitle(); setContentFragment(new TripPlanListFragment()); }
Source:
protected List<String> setupDefaultMaster(String... args) throws Exception { if (isIntegration()) { checkArgument(args.length == 0, "cannot start default master in integration test with arguments passed"); return null; } final CuratorFramework curator = zk.curator(); curator.newNamespaceAwareEnsurePath(Paths.configHosts()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.configJobs()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.configJobRefs()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.statusHosts()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.statusMasters()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.historyJobs()).ensure(curator.getZookeeperClient()); List<String> argsList = Lists.newArrayList("-vvvv", "--no-log-setup", "--http", masterEndpoint(), "--admin=" + masterAdminPort(), "--name", TEST_MASTER, "--domain", "", "--zk", zk.connectString()); argsList.addAll(asList(args)); return argsList; }

Target:
protected List<String> setupDefaultMaster(String... args) throws Exception { if (isIntegration()) { checkArgument(args.length == 0, "cannot start default master in integration test with arguments passed"); return null; } final CuratorFramework curator = zk.curator(); curator.newNamespaceAwareEnsurePath(Paths.configHosts()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.configJobs()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.configJobRefs()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.statusHosts()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.statusMasters()).ensure(curator.getZookeeperClient()); curator.newNamespaceAwareEnsurePath(Paths.historyJobs()).ensure(curator.getZookeeperClient()); final List<String> argsList = Lists.newArrayList("-vvvv", "--no-log-setup", "--http", masterEndpoint(), "--admin=" + masterAdminPort(), "--name", TEST_MASTER, "--domain", "", "--zk", zk.connectString()); argsList.addAll(asList(args)); return argsList; }
Source:
public void dispose() { log.info("vdsManager::disposing"); SchedulerUtilQuartzImpl.getInstance().deleteJob(onTimerJobId); XmlRpcUtils.shutDownConnection(_vdsProxy.getHttpClient()); if (JsonRpcVdsServer.class.isInstance(_vdsProxy)) { ((JsonRpcVdsServer) _vdsProxy).close(); } }

Target:
public void dispose() { log.info("vdsManager::disposing"); SchedulerUtilQuartzImpl.getInstance().deleteJob(onTimerJobId); _vdsProxy.close(); }
Source:
private void enableImmutableTables(ConnectionQueryServices queryServices, ArrayList<String> immutableList, long startWaitTime) { int retryCount = 0; long endWaitTime = System.currentTimeMillis(); long waitMore = getWaitMoreTime(endWaitTime, startWaitTime); while (retryCount < 5 && !waited) { LOGGER.info("waiting for more " + waitMore + " ms for client cache " + "to expire for immutable tables"); try { startWaitTime = System.currentTimeMillis(); Thread.sleep(waitMore); waited = true; } catch (InterruptedException e) { endWaitTime = System.currentTimeMillis(); waitMore = getWaitMoreTime(endWaitTime, startWaitTime); retryCount++; LOGGER.warning("Sleep before starting index rebuild is interrupted. " + "Attempting to sleep again! " + e.getMessage()); } } if (retryCount == 5) { LOGGER.info("Sleep was interrupted multiple times for immutable tables, " + "we'll still go ahead and enable the table."); } try (Admin admin = queryServices.getAdmin()) { for (String dataTableFullName: immutableList) { dataTableFullNameGlobal = dataTableFullName; HashSet<String> indexes = tablesAndIndexes.get(dataTableFullName); enableTable(admin, dataTableFullName, indexes); } } catch (IOException | SQLException e) { LOGGER.severe("Something went wrong while enabling immutable table " + dataTableFullNameGlobal); tablesAndIndexes.remove(dataTableFullNameGlobal); immutableList.remove(dataTableFullNameGlobal); throw new RuntimeException("Manually enable the table " + dataTableFullNameGlobal + " and run the index rebuild ", e); } }

Target:
private void enableImmutableTables(ConnectionQueryServices queryServices, ArrayList<String> immutableList, long startWaitTime) { long endWaitTime = EnvironmentEdgeManager.currentTimeMillis(); long waitMore = getWaitMoreTime(endWaitTime, startWaitTime); while (waitMore>0) { LOGGER.info("waiting for more " + waitMore + " ms for client cache " + "to expire for immutable tables"); try { startWaitTime = EnvironmentEdgeManager.currentTimeMillis(); Thread.sleep(waitMore); waited = true; } catch (InterruptedException e) { endWaitTime = EnvironmentEdgeManager.currentTimeMillis(); waitMore = getWaitMoreTime(endWaitTime, startWaitTime); LOGGER.warning("Sleep before starting index rebuild is interrupted. " + "Attempting to sleep again! " + e.getMessage()); } } for (String dataTableFullName: immutableList) { try (Admin admin = queryServices.getAdmin()) { HashSet<String> indexes = tablesAndIndexes.get(dataTableFullName); enableTable(admin, dataTableFullName, indexes); } catch (IOException | SQLException e) { LOGGER.severe("Something went wrong while enabling immutable table " + e); tablesAndIndexes.remove(dataTableFullName); immutableList.remove(dataTableFullName); throw new RuntimeException("Manually enable the following tables " + getSubListString(immutableList, dataTableFullName) + " and run the index rebuild ", e); } } }
Source:
public MigrationURLConnection(URL url, ImportMigrationContext context) throws MalformedURLException { super(url); Validate.notNull(url, "invalid null URL"); this.context = context; this.path = URL_TO_PATHS.get(url.getPath()); if (this.path == null) { throw new MalformedURLException(String.format("Could not resolve URL <%s>.", url.toString())); } }

Target:
public MigrationURLConnection(URL url, ImportMigrationContext context) throws FileNotFoundException { super(url); Validate.notNull(url, "invalid null URL"); final Path path = Paths.get("etc" + url.getPath()); this.entry = context.getEntry(path); if (this.entry == null) { throw new FileNotFoundException(); } }