auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void doStop() { if (watchRoutine != null && !watchRoutine.isCancelled()) { watchRoutine.cancel(); } if (filesWatcher != null) { try { filesWatcher.close(); } catch (IOException ignored) { } } }

Target:
protected void doStop() { if (watchRoutine != null && !watchRoutine.isCancelled()) { watchRoutine.cancel(); watchRoutine = null; } IOUtils.closeWhileHandlingException(filesWatcher); }
Source:
protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); if (repo == null) { return null; } if (ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { Activator.logError(e.getMessage(), e); return null; } } return null; }).filter(Objects::nonNull).collect(Collectors.toList()); }

Target:
protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); if (repo != null && ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { Activator.logWarning(e.getLocalizedMessage(), e); } } return null; }).filter(Objects::nonNull).collect(Collectors.toList()); }
Source:
private static Map<String, Number> processInnodbMutex(ResultSet rs, String category) throws SQLException { String mutex; Number value; Map<String, Number> mutexes = new HashMap<String,Number>(); while (rs.next()) { mutex = buildString(category, SEPARATOR, rs.getString(2).replaceAll(INNODB_MUTEX_REGEX, EMPTY_STRING).replaceAll(ARROW, UNDERSCORE)); value = translateStringToNumber(rs.getString(3).substring(rs.getString(3).indexOf(EQUALS) +1)); if (mutexes.containsKey(mutex)) { Context.log(Level.FINE, "appending ", value); value = value.intValue() + mutexes.get(mutex).intValue(); } mutexes.put(mutex, value); } Context.log(Level.FINE, mutexes); return mutexes; }

Target:
private static Map<String, Number> processInnodbMutex(ResultSet rs, String category) throws SQLException { String mutex; Number value; Map<String, Number> mutexes = new HashMap<String,Number>(); while (rs.next()) { mutex = buildString(category, SEPARATOR, rs.getString(2).replaceAll(INNODB_MUTEX_REGEX, EMPTY_STRING).replaceAll(ARROW, UNDERSCORE)); value = translateStringToNumber(rs.getString(3).substring(rs.getString(3).indexOf(EQUALS) +1)); if (mutexes.containsKey(mutex)) { Context.log(Level.FINE, "appending ", value); value = value.intValue() + mutexes.get(mutex).intValue(); } mutexes.put(mutex, value); } Context.log(Level.FINE, "Mutexes: ", mutexes); return mutexes; }
Source:
private Class<? extends SecureStore> getSecureStoreImpl() { if (Strings.isNullOrEmpty(secureStoreClassName)) { return DefaultSecureStore.class; } else { try { return (Class<? extends SecureStore>) Class.forName(secureStoreClassName); } catch (Throwable e) { String msg = String.format("Cannot load secure store class: %s", secureStoreClassName); log.error(msg, e); throw new RuntimeException(msg, e); } } }

Target:
private Class<? extends SecureStore> getSecureStoreImpl() { if (Strings.isNullOrEmpty(secureStoreClassName)) { return DefaultSecureStore.class; } try { return (Class<? extends SecureStore>) Class.forName(secureStoreClassName); } catch (Throwable e) { String msg = String.format("Cannot load secure store class: %s", secureStoreClassName); log.error(msg, e); throw new RuntimeException(msg, e); } }
Source:
public void testDmnFromWBNoEdges() throws Exception { when(textAnnotationNode.getInEdges()).thenReturn(new ArrayList<Edge<View<Association>, ?>>()); when(textAnnotationNode.getOutEdges()).thenReturn(new ArrayList<Edge<View<Association>, ?>>()); List<org.kie.dmn.model.v1_1.Association> associations = AssociationConverter.dmnFromWB(textAnnotationNode); assertEquals(0, associations.size()); }

Target:
public void testDmnFromWBNoEdges() throws Exception { when(textAnnotationNode.getInEdges()).thenReturn(Collections.emptyList()); when(textAnnotationNode.getOutEdges()).thenReturn(Collections.emptyList()); List<org.kie.dmn.model.v1_1.Association> associations = AssociationConverter.dmnFromWB(textAnnotationNode); assertEquals(0, associations.size()); }
Source:
public Collection<Geofence> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("groupId") long groupId, @QueryParam("deviceId") long deviceId, @QueryParam("refresh") boolean refresh) throws SQLException { GeofenceManager geofenceManager = Context.getGeofenceManager(); if (refresh) { geofenceManager.refreshGeofences(); } Set<Long> result; if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { result = new HashSet<>(geofenceManager.getAllGeofencesIds()); } else { Context.getPermissionsManager().checkManager(getUserId()); result = new HashSet<>(geofenceManager.getManagedGeofencesIds(getUserId())); } } else { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); result = new HashSet<>(geofenceManager.getUserGeofencesIds(userId)); } if (groupId != 0) { Context.getPermissionsManager().checkGroup(getUserId(), groupId); result.retainAll(geofenceManager.getGroupGeofencesIds(groupId)); } if (deviceId != 0) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); result.retainAll(geofenceManager.getDeviceGeofencesIds(deviceId)); } return geofenceManager.getGeofences(result); }

Target:
public Collection<Geofence> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("groupId") long groupId, @QueryParam("deviceId") long deviceId, @QueryParam("refresh") boolean refresh) throws SQLException { GeofenceManager geofenceManager = Context.getGeofenceManager(); if (refresh) { geofenceManager.refreshGeofences(); } Set<Long> result = new HashSet<>(); if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { result.addAll(geofenceManager.getAllGeofencesIds()); } else { Context.getPermissionsManager().checkManager(getUserId()); result.addAll(geofenceManager.getManagedGeofencesIds(getUserId())); } } else { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); result.addAll(geofenceManager.getUserGeofencesIds(userId)); } if (groupId != 0) { Context.getPermissionsManager().checkGroup(getUserId(), groupId); result.retainAll(geofenceManager.getGroupGeofencesIds(groupId)); } if (deviceId != 0) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); result.retainAll(geofenceManager.getDeviceGeofencesIds(deviceId)); } return geofenceManager.getGeofences(result); }
Source:
public void testLoadWithNoInitCMandMissMatchedServerId() { assertNotNull(client.configMaps().withName(TEST_KIE_SERVER_ID).delete()); System.setProperty(KieServerConstants.KIE_SERVER_ID, TEST_KIE_SERVER_ID); assertEquals(TEST_KIE_SERVER_ID, repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID)); System.setProperty(KieServerConstants.KIE_SERVER_ID, "wrongId"); repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID); System.clearProperty(KieServerConstants.KIE_SERVER_ID); }

Target:
public void testLoadWithNoInitCMandMissMatchedServerId() { assertNotNull(client.configMaps().withName(TEST_KIE_SERVER_ID).delete()); System.setProperty(KieServerConstants.KIE_SERVER_ID, TEST_KIE_SERVER_ID); assertEquals(TEST_KIE_SERVER_ID, repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID)); System.setProperty(KieServerConstants.KIE_SERVER_ID, "wrongId"); repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID); }
Source:
private void validate() throws IOException { Map<String, Object> alwaysMatch = getAlwaysMatch(); if (alwaysMatch == null) { alwaysMatch = ImmutableMap.of(); } Map<String, Object> always = alwaysMatch; Collection<Map<String, Object>> firsts = getFirstMatches(); if (firsts == null) { firsts = ImmutableList.of(ImmutableMap.of()); } if (firsts.isEmpty()) { throw new IllegalArgumentException("First match w3c capabilities is zero length"); } firsts.stream() .peek(map -> { Set<String> overlap = Sets.intersection(always.keySet(), map.keySet()); if (!overlap.isEmpty()) { throw new IllegalArgumentException( "Overlapping keys between w3c always and first match capabilities: " + overlap); } }) .map(first -> { Map<String, Object> toReturn = new HashMap<>(); toReturn.putAll(always); toReturn.putAll(first); return toReturn; }) .peek(map -> { ImmutableSortedSet<String> nullKeys = map.entrySet().stream() .filter(entry -> entry.getValue() == null) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!nullKeys.isEmpty()) { throw new IllegalArgumentException( "Null values found in w3c capabilities. Keys are: " + nullKeys); } }) .peek(map -> { ImmutableSortedSet<String> illegalKeys = map.entrySet().stream() .filter(entry -> !ACCEPTED_W3C_PATTERNS.test(entry.getKey())) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!illegalKeys.isEmpty()) { throw new IllegalArgumentException( "Illegal key values seen in w3c capabilities: " + illegalKeys); } }) .forEach(map -> {}); }

Target:
private void validate() throws IOException { Map<String, Object> alwaysMatch = getAlwaysMatch(); if (alwaysMatch == null) { alwaysMatch = of(); } Map<String, Object> always = alwaysMatch; Collection<Map<String, Object>> firsts = getFirstMatch(); if (firsts == null) { firsts = ImmutableList.of(of()); } if (firsts.isEmpty()) { throw new IllegalArgumentException("First match w3c capabilities is zero length"); } firsts.stream() .peek(map -> { Set<String> overlap = Sets.intersection(always.keySet(), map.keySet()); if (!overlap.isEmpty()) { throw new IllegalArgumentException( "Overlapping keys between w3c always and first match capabilities: " + overlap); } }) .map(first -> { Map<String, Object> toReturn = new HashMap<>(); toReturn.putAll(always); toReturn.putAll(first); return toReturn; }) .peek(map -> { ImmutableSortedSet<String> nullKeys = map.entrySet().stream() .filter(entry -> entry.getValue() == null) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!nullKeys.isEmpty()) { throw new IllegalArgumentException( "Null values found in w3c capabilities. Keys are: " + nullKeys); } }) .peek(map -> { ImmutableSortedSet<String> illegalKeys = map.entrySet().stream() .filter(entry -> !ACCEPTED_W3C_PATTERNS.test(entry.getKey())) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!illegalKeys.isEmpty()) { throw new IllegalArgumentException( "Illegal key values seen in w3c capabilities: " + illegalKeys); } }); }
Source:
public long getUpdatedTime() { return sentTime; }

Target:
public long getUpdatedTime() { return receivedTime; }
Source:
private void sendHeartbeats() { if (!heartbeatQueue.isEmpty()) { HeartbeatLockRequest heartbeatLockRequest = heartbeatQueue.getFirst(); int remainingHeartbeat = Math.max(heartbeatLockRequest.getRemainingHeartbeatCount().get(), 0); if (remainingHeartbeat == 0) { log.warn("***MAX HEARTBEAT REACHED***. No longer sending heartbeats to {}", heartbeatLockRequest.getLock()); heartbeatQueue.remove(heartbeatLockRequest); } else { try { HeartbeatResponse heartbeatResponse = heartbeat(heartbeatLockRequest.getLock()); switch (heartbeatResponse.getLockStatus()) { case EXPIRED: case ERROR: log.warn("Lock status for {}", heartbeatResponse.getLockStatus(), heartbeatResponse.getLock()); heartbeatQueue.remove(heartbeatLockRequest); break; default: log.info("Remaining heartbeat count: {}. Refreshed lock {}", remainingHeartbeat, heartbeatResponse.getLock()); heartbeatLockRequest.setLock(heartbeatResponse.getLock()); } } catch (Exception e) { log.error("Heartbeat for failed", heartbeatLockRequest, heartbeatLockRequest.getLock(), e); heartbeatQueue.remove(heartbeatLockRequest); } heartbeatLockRequest.decrementRemainingHeartbeat(); } } }

Target:
private void sendHeartbeats() { if (heartbeatQueue.isEmpty()) { return; } HeartbeatLockRequest heartbeatLockRequest = heartbeatQueue.getFirst(); if (heartbeatLockRequest.timesUp()) { log.warn("***MAX HEARTBEAT REACHED***. No longer sending heartbeats to {}", heartbeatLockRequest.getLock()); heartbeatQueue.remove(heartbeatLockRequest); } else { try { HeartbeatResponse heartbeatResponse = heartbeat(heartbeatLockRequest.getLock()); switch (heartbeatResponse.getLockStatus()) { case EXPIRED: case ERROR: log.warn("Lock status for {}", heartbeatResponse.getLockStatus(), heartbeatResponse.getLock()); heartbeatQueue.remove(heartbeatLockRequest); break; default: log.debug("Remaining lock duration {}ms. Refreshed lock {}", heartbeatLockRequest.getRemainingLockDuration().toMillis(), heartbeatResponse.getLock()); heartbeatLockRequest.setLock(heartbeatResponse.getLock()); } } catch (Exception e) { log.error("Heartbeat for failed", heartbeatLockRequest, heartbeatLockRequest.getLock(), e); heartbeatQueue.remove(heartbeatLockRequest); } } }
Source:
public void verifyTitleUrl(String expectedUrl) { String titleUrl = titleLink.getAttribute("href"); Assertion.assertEquals(expectedUrl, titleUrl); }

Target:
public void verifyTitleUrl(String expectedUrl) { String titleUrl = titleLink.getAttribute("href"); Assertion.assertEquals(expectedUrl, titleUrl); PageObjectLogging.log("verifyTitleUrl", "Title URL is correct", true); }
Source:
public Object evaluate(Map<String, Object> requestData) { final PMML4Result toReturn = getPMML4Result(targetField); final KiePMMLSessionUtils kiePMMLSessionUtils = KiePMMLSessionUtils.builder(packageDescr, toReturn) .withAgendaEventListener(agendaEventListener) .withObjectsInSession(requestData, fieldTypeMap) .withOutputFieldsMap(outputFieldsMap) .build(); kiePMMLSessionUtils.fireAllRules(); return toReturn; }

Target:
public Object evaluate(Map<String, Object> requestData) { final PMML4Result toReturn = getPMML4Result(targetField); KiePMMLSessionUtils.Builder builder = KiePMMLSessionUtils.builder(packageDescr, toReturn) .withObjectsInSession(requestData, fieldTypeMap) .withOutputFieldsMap(outputFieldsMap); if (logger.isDebugEnabled()) { builder = builder.withAgendaEventListener(agendaEventListener); } final KiePMMLSessionUtils kiePMMLSessionUtils = builder.build(); kiePMMLSessionUtils.fireAllRules(); return toReturn; }
Source:
public void testCanReadInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); FileInputStream is = new FileInputStream(rasterfile); GeoTiffReader reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); }

Target:
public void testCanReadInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); GeoTiffReader reader = null; try(FileInputStream is = new FileInputStream(rasterfile)) { reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); gridCoverage.dispose(true); } finally { if(reader != null) { reader.dispose(); } } }
Source:
private void checkReleased() { if (isReleased()) { throw new IllegalStateException("Memory manager released"); } }

Target:
private void checkReleased() { if (released) { throw new IllegalStateException("Memory manager released"); } }
Source:
public boolean exists() { try { if (existsFlagSupplier == null) { return false; } return existsFlagSupplier.test(this); } catch (Exception e) { throw handleErrorInCallback(e, "existsFlagSupplier"); } }

Target:
public boolean exists() { try { if (existsFlagSupplier != null) { return existsFlagSupplier.test(this); } return false; } catch (Exception e) { throw handleErrorInCallback(e, "existsFlagSupplier"); } }
Source:
public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); vm.setOrigin(OriginType.HOSTED_ENGINE); dbFacade.getVmStaticDao().save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); dbFacade.getImageDao().save(disk.getImage()); dbFacade.getBaseDiskDao().save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); dbFacade.getImageStorageDomainMapDao().save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", 0, null, true, false, false, "", null, null, null); dbFacade.getVmDeviceDao().save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); dbFacade.getDiskVmElementDao().save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }

Target:
public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); vm.setOrigin(OriginType.HOSTED_ENGINE); dbFacade.getVmStaticDao().save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); dbFacade.getImageDao().save(disk.getImage()); dbFacade.getBaseDiskDao().save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); dbFacade.getImageStorageDomainMapDao().save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", 0, null, true, false, false, "", null, null, null); dbFacade.getVmDeviceDao().save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); dbFacade.getDiskVmElementDao().save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); dbFacade.getVmStaticDao().update(vm); domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }
Source:
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress(); if (remoteAddress != null) { logger.error("Exception: " + cause.getMessage() + ", from: " + remoteAddress.getHostString() + ":" + remoteAddress.getPort()); } else { logger.error("Exception: " + cause.getMessage()); } messageListener.onException(ctx, cause); ctx.close(); }

Target:
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress(); if (remoteAddress != null) { logger.info("Exception: " + cause.getMessage() + ", from: " + remoteAddress.toString()); } else { logger.info("Exception: " + cause.getMessage()); } messageListener.onException(ctx, cause); ctx.close(); }
Source:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; recipient = new Recipient(transport, name); }

Target:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; if (transport != null){ recipient = new Recipient(transport, name); } else { recipient = null; } }
Source:
private boolean getPreference() { IEclipsePreferences preferences = preferences(); boolean preferenceValue = preferences.getBoolean(PREFERENCE_NAME, false); return preferenceValue; }

Target:
private boolean getPreference() { IPreferencesService preferencesService = Platform.getPreferencesService(); boolean preferenceValue = preferencesService.getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_SHOW_STEP_RESULT, false, null); return preferenceValue; }
Source:
protected boolean canSelectFormat( Format format, int trackBitrate, float playbackSpeed, long effectiveBitrate) { boolean isNonIframeOnly = (format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) == 0; boolean canSelect = Math.round(trackBitrate * playbackSpeed) <= effectiveBitrate; return canSelect && isNonIframeOnly; }

Target:
protected boolean canSelectFormat( Format format, int trackBitrate, float playbackSpeed, long effectiveBitrate) { boolean isIframeOnlyFormat = (format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0; boolean canSelect = Math.round(trackBitrate * playbackSpeed) <= effectiveBitrate; return canSelect && !isIframeOnlyFormat; }
Source:
public boolean apply(final Resource item) { return "*".equals(role) || "*".equals(item.getRole()) || item.getRole().equals(role); }

Target:
public boolean apply(final Resource item) { return item.getRole().equals(role); }
Source:
public Statement apply( Statement base, Description description ) { Repeat repeat = description.getAnnotation( Repeat.class ); if ( repeat != null || defaultTimes > 1 ) { return new RepeatStatement( max( repeat != null ? repeat.times() : 1, defaultTimes ), base, description ); } return base; }

Target:
public Statement apply( Statement base, Description description ) { Repeat repeat = description.getAnnotation( Repeat.class ); if ( repeat != null ) { return new RepeatStatement( repeat.times(), base, description ); } if ( defaultTimes > 1 ) { return new RepeatStatement( defaultTimes, base, description ); } return base; }
Source:
private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); Configuration insertOpt = Configuration.create() .set("className", diffTable.style.insert()) .set("readOnly", true); Configuration deleteOpt = Configuration.create() .set("className", diffTable.style.delete()) .set("readOnly", true); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); for (int j = 0; j < delta; j++) { addPadding(cmA, lineA - 1); } for (int j = 0; j < delta; j++) { cmB.addLineClass(lineB, LineClassWhere.WRAP, diffTable.style.insert()); cmB.markText( LineCharacter.create(lineB, 0), LineCharacter.create(lineB, 0), insertOpt); lineB++; } } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); for (int j = 0; j < delta; j++) { addPadding(cmB, lineB - 1); } for (int j = 0; j < delta; j++) { cmA.addLineClass(lineA, LineClassWhere.WRAP, diffTable.style.delete()); cmA.markText( LineCharacter.create(lineA, 0), LineCharacter.create(lineA, 0), deleteOpt); lineA++; } } else { lineA += current.a().length(); lineB += current.a().length(); } } }

Target:
private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); Configuration insertOpt = Configuration.create() .set("className", diffTable.style.insert()) .set("readOnly", true); Configuration deleteOpt = Configuration.create() .set("className", diffTable.style.delete()) .set("readOnly", true); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); for (int j = 0; j < delta; j++) { addPadding(cmA, lineA - 1); } for (int j = 0; j < delta; j++) { cmB.addLineClass(lineB, LineClassWhere.WRAP, diffTable.style.insert()); LineCharacter from = LineCharacter.create(lineB, 0); cmB.markText(from, from, insertOpt); lineB++; } } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); for (int j = 0; j < delta; j++) { addPadding(cmB, lineB - 1); } for (int j = 0; j < delta; j++) { cmA.addLineClass(lineA, LineClassWhere.WRAP, diffTable.style.delete()); LineCharacter from = LineCharacter.create(lineA, 0); cmA.markText(from, from, deleteOpt); lineA++; } } else { lineA += current.a().length(); lineB += current.a().length(); } } }
Source:
protected DiscoveryEnabledServer createServer(final InstanceInfo instanceInfo, boolean useSecurePort, boolean useIpAddr) { DiscoveryEnabledServer server = new DiscoveryEnabledServer(instanceInfo, useSecurePort, useIpAddr); server.setZone(DiscoveryClient.getZone(instanceInfo)); return server; }

Target:
protected DiscoveryEnabledServer createServer(final InstanceInfo instanceInfo, boolean useSecurePort, boolean useIpAddr) { DiscoveryEnabledServer server = new DiscoveryEnabledServer(instanceInfo, useSecurePort, useIpAddr); EurekaClientConfig clientConfig = eurekaClientProvider.get().getEurekaClientConfig(); String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion()); String instanceZone = InstanceInfo.getZone(availZones, instanceInfo); server.setZone(instanceZone); return server; }
Source:
public void updateScore(Solution_ solution) { getScore(solution); }

Target:
public Score updateScore(Solution_ solution) { try (ScoreDirector<Solution_> scoreDirector = scoreDirectorFactory.buildScoreDirector()) { scoreDirector.setWorkingSolution(solution); return scoreDirector.calculateScore(); } }
Source:
public void delete(ClaudiaData claudiaData, TierInstance tierInstance, EnvironmentInstance envInstance) throws InfrastructureException, InvalidEntityException, EntityNotFoundException { log.error("before infrastructureManager.deleteVMReplica"); infrastructureManager.deleteVMReplica(claudiaData, tierInstance); log.error("before envInstance.removeTierInstance(tierInstance)"); envInstance.removeTierInstance(tierInstance); log.error("beforeenvironmentInstanceManager.update()"); environmentInstanceManager.update(envInstance); log.error("before removeSecurityGroup(claudiaData, tierInstance)"); removeSecurityGroup(claudiaData, tierInstance); log.error("before remove(tierInstance)"); remove(tierInstance); log.error("f"); }

Target:
public void delete(ClaudiaData claudiaData, TierInstance tierInstance, EnvironmentInstance envInstance) throws InfrastructureException, InvalidEntityException, EntityNotFoundException { infrastructureManager.deleteVMReplica(claudiaData, tierInstance); envInstance.removeTierInstance(tierInstance); environmentInstanceManager.update(envInstance); removeSecurityGroup(claudiaData, tierInstance); remove(tierInstance); }
Source:
private int weigh(DataType cqlType, int level) { switch (cqlType.getName()) { default: return 0; case LIST: case SET: case MAP: { int weight = level; for (DataType eltType : cqlType.getTypeArguments()) { weight += weigh(eltType, level + 1); } return weight; } case UDT: { int weight = level; for (UserType.Field field : ((UserType)cqlType)) { weight += weigh(field.getType(), level + 1); } return weight == 0 ? 1 : weight; } case TUPLE: { int weight = level; for (DataType componentType : ((TupleType)cqlType).getComponentTypes()) { weight += weigh(componentType, level + 1); } return weight == 0 ? 1 : weight; } case CUSTOM: return 1; } }

Target:
private int weigh(DataType cqlType, int level) { switch (cqlType.getName()) { case LIST: case SET: case MAP: { int weight = level; for (DataType eltType : cqlType.getTypeArguments()) { weight += weigh(eltType, level + 1); } return weight; } case UDT: { int weight = level; for (UserType.Field field : ((UserType)cqlType)) { weight += weigh(field.getType(), level + 1); } return weight == 0 ? 1 : weight; } case TUPLE: { int weight = level; for (DataType componentType : ((TupleType)cqlType).getComponentTypes()) { weight += weigh(componentType, level + 1); } return weight == 0 ? 1 : weight; } case CUSTOM: return 1; default: return 0; } }
Source:
public FloatDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new float[dictionaryPage.getDictionarySize()]; FloatPlainValuesReader floatReader = new FloatPlainValuesReader(); final ByteBufferInputStream in = ByteBufferInputStream.wrap(ByteBuffer.wrap(dictionaryPage.getSlice().getBytes())); floatReader.initFromPage(dictionaryPage.getDictionarySize(), in); for (int i = 0; i < content.length; i++) { content[i] = floatReader.readFloat(); } }

Target:
public FloatDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new float[dictionaryPage.getDictionarySize()]; FloatPlainValuesReader floatReader = new FloatPlainValuesReader(); ByteBuffer byteBuffer = ByteBuffer.wrap(dictionaryPage.getSlice().getBytes()); ByteBufferInputStream inputStream = ByteBufferInputStream.wrap(ImmutableList.of(byteBuffer)); floatReader.initFromPage(dictionaryPage.getDictionarySize(), inputStream); for (int i = 0; i < content.length; i++) { content[i] = floatReader.readFloat(); } }
Source:
public Object[][] getTestData() { String variant1="Can inject only one of <ITestContext, XmlTest> into a @%s annotated "; String variant2="Can inject only one of <ITestContext, XmlTest, Method, Object[]> into a @%s annotated "; String variant3="Can inject only one of <ITestContext, XmlTest, Method, Object[], ITestResult> into a @%s annotated "; return new Object[][] { {BadBeforeSuiteSample.class, "beforeSuite", String.format(variant1, BeforeSuite.class.getSimpleName())}, {BadBeforeTestSample.class, "beforeTest",String.format(variant1, BeforeTest.class.getSimpleName())}, {BadBeforeClassSample.class, "beforeClass",String.format(variant1, BeforeClass.class.getSimpleName())}, {BadBeforeMethodSample.class, "beforeMethod",String.format(variant3, BeforeMethod.class.getSimpleName())}, {BadAfterMethodSample.class, "afterMethod",String.format(variant3, AfterMethod.class.getSimpleName())}, {BadAfterClassSample.class, "afterClass",String.format(variant1, AfterClass.class.getSimpleName())}, {BadAfterTestSample.class, "afterTest",String.format(variant1, AfterTest.class.getSimpleName())}, {BadAfterSuiteSample.class, "afterSuite",String.format(variant1, AfterSuite.class.getSimpleName())}, {BadBeforeGroupsSample.class, "beforeGroups",String.format(variant1, BeforeGroups.class.getSimpleName())}, {BadAfterGroupsSample.class, "afterGroups",String.format(variant1, AfterGroups.class.getSimpleName())} }; }

Target:
public Object[][] getTestData() { String variant1="Can inject only one of <ITestContext, XmlTest> into a @%s annotated "; String variant2="Can inject only one of <ITestContext, XmlTest, Method, Object[], ITestResult> into a @%s annotated "; return new Object[][] { {BadBeforeSuiteSample.class, "beforeSuite", String.format(variant1, BeforeSuite.class.getSimpleName())}, {BadBeforeTestSample.class, "beforeTest",String.format(variant1, BeforeTest.class.getSimpleName())}, {BadBeforeClassSample.class, "beforeClass",String.format(variant1, BeforeClass.class.getSimpleName())}, {BadBeforeMethodSample.class, "beforeMethod",String.format(variant2, BeforeMethod.class.getSimpleName())}, {BadAfterMethodSample.class, "afterMethod",String.format(variant2, AfterMethod.class.getSimpleName())}, {BadAfterClassSample.class, "afterClass",String.format(variant1, AfterClass.class.getSimpleName())}, {BadAfterTestSample.class, "afterTest",String.format(variant1, AfterTest.class.getSimpleName())}, {BadAfterSuiteSample.class, "afterSuite",String.format(variant1, AfterSuite.class.getSimpleName())}, {BadBeforeGroupsSample.class, "beforeGroups",String.format(variant1, BeforeGroups.class.getSimpleName())}, {BadAfterGroupsSample.class, "afterGroups",String.format(variant1, AfterGroups.class.getSimpleName())} }; }
Source:
public void addModAsResource(ModContainer container) { Class<?> resourcePackType = container.getCustomResourcePackClass(); if (resourcePackType != null) { try { IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container); PackMetadataSection meta = (PackMetadataSection)pack.getPackMetadata(this.metaSerializer, "pack"); if (meta != null && meta.getPackFormat() == 2) { pack = new LegacyV2Adapter(pack); } resourcePackList.add(pack); resourcePackMap.put(container.getModId(), pack); } catch (NoSuchMethodException e) { FMLLog.log.error("The container (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName()); } catch (Exception e) { FMLLog.log.error("An unexpected exception occurred constructing the custom resource pack for {}", container.getName(), e); Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } } }

Target:
public void addModAsResource(ModContainer container) { Class<?> resourcePackType = container.getCustomResourcePackClass(); if (resourcePackType != null) { try { IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container); PackMetadataSection meta = (PackMetadataSection)pack.getPackMetadata(this.metaSerializer, "pack"); if (meta != null && meta.getPackFormat() == 2) { pack = new LegacyV2Adapter(pack); } resourcePackList.add(pack); resourcePackMap.put(container.getModId(), pack); } catch (NoSuchMethodException e) { FMLLog.log.error("The container (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName()); } catch (Exception e) { throw new RuntimeException("An unexpected exception occurred constructing the custom resource pack for " + container.getName(), e); } } }
Source:
public ApplicationStatus getApplicationStatus() { ApplicationStatus applicationStatus = new ApplicationStatus(); DiffViewerStatus status = new DiffViewerStatus(); applicationStatus.setDiffViewerStatus(status); applicationStatus.setConfiguration(getConfiguration()); applicationStatus.setSearchEngineStatus(SearchEngineStatus.create()); applicationStatus.setVersion(ApplicationVersionHolder.INSTANCE.getApplicationVersion()); return applicationStatus; }

Target:
public ApplicationStatus getApplicationStatus() { ApplicationStatus applicationStatus = new ApplicationStatus(); applicationStatus.setConfiguration(getConfiguration()); applicationStatus.setSearchEngineStatus(SearchEngineStatus.create()); applicationStatus.setVersion(ApplicationVersionHolder.INSTANCE.getApplicationVersion()); return applicationStatus; }
Source:
MetricValueCatcher getCatcherOrNull() { return gaugeSource instanceof DoubleMetricValueCatcher ? (DoubleMetricValueCatcher) gaugeSource : null; }

Target:
MetricValueCatcher getCatcherOrNull() { DoubleGaugeSource gaugeSourceCopy = this.gaugeSource; return gaugeSourceCopy instanceof DoubleMetricValueCatcher ? (DoubleMetricValueCatcher) gaugeSourceCopy : null; }
Source:
public void refresh() { start(); super.refresh(true); }

Target:
public void refresh() { start(); super.refresh(); }
Source:
public boolean isInvalid() { try { getSynonymFor(); return false; } catch (DbException e) { return true; } }

Target:
public boolean isInvalid() { return data.synonymForSchema.findTableOrView(data.session, data.synonymFor) == null; }
Source:
public List<ID3v2ChapterFrameData> getChapters() { if (obseleteFormat) { return Collections.emptyList(); } return extractChapterFrameData(ID_CHAPTER); }

Target:
public ArrayList<ID3v2ChapterFrameData> getChapters() { if (obseleteFormat) { return null; } return new ArrayList<>(extractChapterFrameData(ID_CHAPTER)); }
Source:
public boolean send(final StompConnection connection, final StompFrame frame) { if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { ActiveMQServerLogger.LOGGER.trace("sent " + frame); } invokeInterceptors(this.outgoingInterceptors, frame, connection); synchronized (connection) { if (connection.isDestroyed()) { new Exception("trace").printStackTrace(); ActiveMQStompProtocolLogger.LOGGER.connectionClosed(connection); return false; } try { connection.physicalSend(frame); } catch (Exception e) { ActiveMQStompProtocolLogger.LOGGER.errorSendingFrame(e, frame); return false; } return true; } }

Target:
public boolean send(final StompConnection connection, final StompFrame frame) { if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { ActiveMQServerLogger.LOGGER.trace("sent " + frame); } invokeInterceptors(this.outgoingInterceptors, frame, connection); synchronized (connection) { if (connection.isDestroyed()) { ActiveMQStompProtocolLogger.LOGGER.connectionClosed(connection); return false; } try { connection.physicalSend(frame); } catch (Exception e) { ActiveMQStompProtocolLogger.LOGGER.errorSendingFrame(e, frame); return false; } return true; } }
Source:
public RefreshItem(String keyInCache, AuthenticationRequest request, TokenCacheItem item) { if (item == null) { throw new IllegalArgumentException("item"); } mKey = keyInCache; mMultiResource = item.getIsMultiResourceRefreshToken(); mRefreshToken = item.getRefreshToken(); mUserInfo = item.getUserInfo(); mRawIdToken = item.getRawIdToken(); mTenantId = item.getTenantId(); if (item.getUserInfo() != null) { mKeyWithUserId = CacheKey.createCacheKey(request, item.getUserInfo() .getUserId()); mKeyWithDisplayableId = CacheKey.createCacheKey(request, item.getUserInfo() .getDisplayableId()); } }

Target:
public RefreshItem(String keyInCache, AuthenticationRequest request, TokenCacheItem item) { if (item == null) { throw new IllegalArgumentException("item"); } mKey = keyInCache; mMultiResource = item.getIsMultiResourceRefreshToken(); mRefreshToken = item.getRefreshToken(); mUserInfo = item.getUserInfo(); mRawIdToken = item.getRawIdToken(); mTenantId = item.getTenantId(); final UserInfo userInfo = item.getUserInfo(); if (userInfo != null) { mKeyWithUserId = CacheKey.createCacheKey(request, userInfo.getUserId()); mKeyWithDisplayableId = CacheKey.createCacheKey(request, userInfo.getDisplayableId()); } }
Source:
public String format(final String input) { Objects.requireNonNull(input); if (regex == null || replacement == null) { return input; } Matcher matcherOpeningCurlyBrace = PATTERN_ESCAPED_OPENING_CURLY_BRACE.matcher(input); final String openingCurlyBraceReplaced = matcherOpeningCurlyBrace.replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE); Matcher matcherClosingCurlyBrace = PATTERN_ESCAPED_CLOSING_CURLY_BRACE.matcher(openingCurlyBraceReplaced); final String closingCurlyBraceReplaced = matcherClosingCurlyBrace.replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE); final String regexApplied = replaceHonoringProtectedGroups(closingCurlyBraceReplaced); return regexApplied .replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE, "\\\\{") .replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE, "\\\\}"); }

Target:
public String format(final String input) { Objects.requireNonNull(input); if (regex == null || replacement == null) { return input; } Matcher escapedOpeningCurlyBrace = ESCAPED_OPENING_CURLY_BRACE.matcher(input); String inputWithPlaceholder = escapedOpeningCurlyBrace.replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE); Matcher escapedClosingCurlyBrace = ESCAPED_CLOSING_CURLY_BRACE.matcher(inputWithPlaceholder); inputWithPlaceholder = escapedClosingCurlyBrace.replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE); final String regexMatchesReplaced = replaceHonoringProtectedGroups(inputWithPlaceholder); return regexMatchesReplaced .replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE, "\\\\{") .replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE, "\\\\}"); }
Source:
private boolean runQuery(HttpServletRequest request, HttpServletResponse response, String sessionID) { BackendInternal backend = null; VdcQueryParametersBase params = null; VdcQueryReturnValue queryReturnValue = null; boolean returnValue = false; backend = (BackendInternal) EjbUtils.findBean(BeanType.BACKEND, BeanProxyType.LOCAL); log.debug("Calling ValidateSession query"); params = new VdcQueryParametersBase(); params.setHttpSessionId(sessionID); queryReturnValue = backend.runInternalQuery(VdcQueryType.ValidateSession, params); if (queryReturnValue != null) { returnValue = queryReturnValue.getSucceeded(); if (returnValue) { VdcUser vdcUser = (VdcUser) queryReturnValue.getReturnValue(); if (isAdminUser(vdcUser)) { log.debug("Getting user name"); printUPNToResponse(response, getUPN(vdcUser)); } else { log.error("User is not an administrator"); returnValue = false; } } } else { log.error("Got NULL from backend.RunQuery"); } return returnValue; }

Target:
private boolean runQuery(HttpServletRequest request, HttpServletResponse response, String sessionID) { BackendInternal backend = null; VdcQueryParametersBase params = null; VdcQueryReturnValue queryReturnValue = null; boolean returnValue = false; backend = (BackendInternal) EjbUtils.findBean(BeanType.BACKEND, BeanProxyType.LOCAL); log.debug("Calling ValidateSession query"); params = new VdcQueryParametersBase(); params.setHttpSessionId(sessionID); queryReturnValue = backend.runInternalQuery(VdcQueryType.ValidateSession, params); if (queryReturnValue != null) { returnValue = queryReturnValue.getSucceeded(); if (returnValue) { VdcUser vdcUser = (VdcUser) queryReturnValue.getReturnValue(); if (isAdminUser(vdcUser)) { log.debug("Getting user name"); printUPNToResponse(response, getUPN(vdcUser)); } else { log.error("User is not authorized to perform operation"); returnValue = false; } } } else { log.error("Got NULL from backend.RunQuery"); } return returnValue; }
Source:
public synchronized void clear() { fZoom.setFullRange(0L, 0L); fZoom.setNewRange(0L, 0L); fZoom.stop(); super.clear(); }

Target:
public synchronized void clear() { if (fZoom != null) { fZoom.setFullRange(0L, 0L); fZoom.setNewRange(0L, 0L); fZoom.stop(); } super.clear(); }
Source:
private void process(OpenGuiMessage msg) { EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity(); WorldClient world = FMLClientHandler.instance().getWorldClient(); Object owner = msg.provider.getOwner(player, world); if(owner == null) return; Object gui = msg.provider.getClientGuiElement(player, world, owner); FMLClientHandler.instance().showGuiScreen(gui); }

Target:
private void process(OpenGuiMessage msg) { EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity(); Object owner = msg.provider.getInstance().getOwner(player.worldObj, player); if(owner == null) return; Object gui = msg.provider.getInstance().clientElement(player.worldObj, player); FMLClientHandler.instance().showGuiScreen(gui); player.openContainer.windowId = msg.identifier; }
Source:
public <T extends JestResult> T retry(JestClient client, Action<T> clientRequest) { LOG.debug("Retry request"); if (cooldownInMs > 0) { LOG.debug("Sleep " + cooldownInMs + " before retrying"); try { Thread.sleep(cooldownInMs); } catch (InterruptedException e) { } } LOG.debug("Retrying now"); final T result = execute(client, clientRequest); return result; }

Target:
public <T extends JestResult> T retry(JestClient client, Action<T> clientRequest) { LOG.debug("Retry request"); if (cooldownInMs > 0) { LOG.debug("Sleep " + cooldownInMs + " before retrying"); try { Thread.sleep(cooldownInMs); } catch (InterruptedException e) { throw new RuntimeException("Thread interrupted.", e); } } LOG.debug("Retrying now"); final T result = execute(client, clientRequest); return result; }
Source:
private void dropReplicationSlot() throws SQLException { try { Statement dropStatement = sqlConnection.createStatement(); dropStatement.execute("select pg_drop_replication_slot('" + SLOT_NAME + "')"); dropStatement.close(); } catch (PSQLException e) { if ("55006".equals(e.getSQLState())) { Statement terminateStatement = sqlConnection.createStatement(); terminateStatement.execute("select pg_terminate_backend(active_pid) from pg_replication_slots " + "where active = true and slot_name='" + SLOT_NAME + "'" ); terminateStatement.close(); dropReplicationSlot(); } else { throw e; } } }

Target:
private void dropReplicationSlot() throws SQLException { try { Statement dropStatement = sqlConnection.createStatement(); dropStatement.execute("select pg_drop_replication_slot('" + SLOT_NAME + "')"); dropStatement.close(); } catch (PSQLException e) { if (PSQLState.OBJECT_IN_USE.equals(new PSQLState(e.getSQLState()))) { Statement terminateStatement = sqlConnection.createStatement(); terminateStatement.execute("select pg_terminate_backend(active_pid) from pg_replication_slots " + "where active = true and slot_name='" + SLOT_NAME + "'" ); terminateStatement.close(); dropReplicationSlot(); } else { throw e; } } }
Source:
public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return new double[] {sketch.getEstimate(), sketch.getLowerBound(numStdDevs), sketch.getUpperBound(numStdDevs)}; }

Target:
public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return new double[] {sketch.getEstimate(), sketch.getLowerBound(numStdDevs), sketch.getUpperBound(numStdDevs)}; }
Source:
private ServiceResponse<?> validateReleaseAndMode(String preffix, ReleaseId releaseId) { if(releaseId == null) { return new ServiceResponse(ResponseType.FAILURE, preffix + "Release Id is null"); } boolean isSnapshot = KieServerUtils.isSnapshot(releaseId); if(isSnapshot) { if(mode.equals(KieServerMode.REGULAR)) { return new ServiceResponse(ResponseType.FAILURE, preffix + "KieServers running on REGULAR mode doesn't support deploying SNAPSHOT modules."); } } else { if(mode.equals(KieServerMode.DEVELOPMENT)) { return new ServiceResponse(ResponseType.FAILURE, preffix + "KieServers running on DEVELOPMENT mode only support deploying SNAPSHOT modules."); } } return null; }

Target:
private <T> ServiceResponse<T> validateReleaseAndMode(String preffix, ReleaseId releaseId) { if (releaseId == null) { return new ServiceResponse<>(ResponseType.FAILURE, preffix + " Release Id is null"); } boolean isSnapshot = KieServerUtils.isSnapshot(releaseId); if (isSnapshot) { if (mode.equals(KieServerMode.REGULAR)) { return new ServiceResponse<>(ResponseType.FAILURE, preffix + " KieServer running on REGULAR mode doesn't support deploying SNAPSHOT modules."); } } else { if (mode.equals(KieServerMode.DEVELOPMENT)) { return new ServiceResponse<>(ResponseType.FAILURE, preffix + " KieServer running on DEVELOPMENT mode only support deploying SNAPSHOT modules."); } } return null; }
Source:
public void restrictPaginationByArrayed(Criteria criteria, boolean isArrayed, Consumer<String> errorHandler) { DetachedCriteria subquery = DetachedCriteria.forClass(Array.class) .createAlias("samples", "sample") .setProjection(Projections.property("sample.id")); criteria.add(Property.forName("id").in(subquery)); }

Target:
public void restrictPaginationByArrayed(Criteria criteria, boolean isArrayed, Consumer<String> errorHandler) { DetachedCriteria subquery = DetachedCriteria.forClass(Array.class) .createAlias("samples", "sample") .setProjection(Projections.property("sample.id")); if (isArrayed) { criteria.add(Property.forName("id").in(subquery)); } else { criteria.add(Property.forName("id").notIn(subquery)); } }
Source:
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { super.configure(name, params); String timeZoneStr = _configDao.getValue(Config.UsageAggregationTimezone.toString()); String aggregationRange = _configDao.getValue(Config.UsageStatsJobAggregationRange.toString()); if (timeZoneStr == null) { timeZoneStr = "GMT"; } _usageTimezone = TimeZone.getTimeZone(timeZoneStr); _aggregationDuration = Integer.parseInt(aggregationRange); if (_aggregationDuration < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) { s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN); _aggregationDuration = UsageUtils.USAGE_AGGREGATION_RANGE_MIN; } s_logger.info("Usage timezone = " + _usageTimezone + " AggregationDuration=" + _aggregationDuration); return true; }

Target:
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { super.configure(name, params); String timeZoneStr = _configDao.getValue(Config.UsageAggregationTimezone.toString()); String aggregationRange = _configDao.getValue(Config.UsageStatsJobAggregationRange.toString()); if (timeZoneStr == null) { timeZoneStr = "GMT"; } _usageTimezone = TimeZone.getTimeZone(timeZoneStr); _aggregationDuration = Integer.parseInt(aggregationRange); if (_aggregationDuration < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) { s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN); _aggregationDuration = UsageUtils.USAGE_AGGREGATION_RANGE_MIN; } if (s_logger.isDebugEnabled()){ s_logger.debug("Usage timezone = " + _usageTimezone + " AggregationDuration=" + _aggregationDuration); } return true; }