auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private GlusterVolumeEntity getReplicateVolume(Guid clusterId) { List<GlusterVolumeEntity> replicateVolumes = getReplicateVolumes(clusterId, getReplicateVolumeTypes()); if (replicateVolumes.size() > 0) { return replicateVolumes.get(0); } return null; }

Target:
private GlusterVolumeEntity getReplicateVolume(Guid clusterId) { List<GlusterVolumeEntity> replicateVolumes = getReplicateVolumes(clusterId, volumeTypes); if (replicateVolumes.size() > 0) { return replicateVolumes.get(0); } return null; }
Source:
public void trackEvent(HttpServletRequest request, String action, PID pid, AccessGroupSet principals) { try { AnalyticsUserData userData = new AnalyticsUserData(request); BriefObjectMetadata briefObject = solrSearchService.getObjectById(new SimpleIdRequest(pid, principals)); trackEvent(userData, briefObject.getParentCollection() == null ? "(no collection)" : briefObject.getParentCollectionName(), "download", briefObject.getTitle() + "|" + pid, null); } catch (Exception e) { log.warn("An exception occurred while recording event on {}", action, pid, e); } }

Target:
public void trackEvent(HttpServletRequest request, String action, PID pid, AccessGroupSet principals) { try { AnalyticsUserData userData = new AnalyticsUserData(request); BriefObjectMetadata briefObject = solrSearchService.getObjectById(new SimpleIdRequest(pid, principals)); String parentCollection = briefObject.getParentCollection() == null ? "(no collection)" : briefObject.getParentCollectionName(); String viewedObjectLabel = briefObject.getTitle() + "|" + pid; trackEvent(userData, parentCollection, "download", viewedObjectLabel, null); } catch (Exception e) { log.warn("An exception occurred while recording event on {}", action, pid, e); } }
Source:
private static double findUpgradeUnitEfficiency( final ProPurchaseOption ppo, final double strategicValue) { return strategicValue >= 1 ? ppo.getAttackEfficiency() * ppo.getDefenseEfficiency() * ppo.getCost() / ppo.getQuantity() : ppo.getAttackEfficiency() * ppo.getMovement() * ppo.getCost() / ppo.getQuantity(); }

Target:
private static double findUpgradeUnitEfficiency( final ProPurchaseOption ppo, final double strategicValue) { final double multiplier = (strategicValue >= 1) ? ppo.getDefenseEfficiency() : ppo.getMovement(); return ppo.getAttackEfficiency() * multiplier * ppo.getCost() / ppo.getQuantity(); }
Source:
boolean isCheckInSafe(final ContentletRelationships relationships, final ESIndexAPI esIndexAPI) { if (relationships != null && relationships.getRelationshipsRecords().size() > 0) { boolean isClusterReadOnly = esIndexAPI.isClusterInReadOnlyMode(); if (isClusterReadOnly) { for (ContentletRelationships.ContentletRelationshipRecords records : relationships .getRelationshipsRecords()) { if (!records.getRelationship().isRelationshipField()){ return false; } } } } return true; }

Target:
boolean isCheckInSafe(final ContentletRelationships relationships, final ESIndexAPI esIndexAPI) { if (relationships != null && relationships.getRelationshipsRecords().size() > 0) { boolean isClusterReadOnly = esIndexAPI.isClusterInReadOnlyMode(); if (isClusterReadOnly && hasLegacyRelationships(relationships)) { return false; } } return true; }
Source:
public void dbIndexShouldBePropagatedCorrectly() { LettuceConnectionFactory factory = new LettuceConnectionFactory(); factory.setDatabase(2); factory.afterPropertiesSet(); StringRedisConnection connectionToDbIndex2 = new DefaultStringRedisConnection(factory.getConnection()); try { String key = "key-in-db-2"; connectionToDbIndex2.set(key, "the wheel of time"); assertThat(connection.get(key), nullValue()); assertThat(connectionToDbIndex2.get(key), notNullValue()); } finally { connectionToDbIndex2.close(); } }

Target:
public void dbIndexShouldBePropagatedCorrectly() { LettuceConnectionFactory factory = new LettuceConnectionFactory(); factory.setDatabase(2); factory.afterPropertiesSet(); ConnectionFactoryTracker.add(factory); StringRedisConnection connectionToDbIndex2 = new DefaultStringRedisConnection(factory.getConnection()); try { String key = "key-in-db-2"; connectionToDbIndex2.set(key, "the wheel of time"); assertThat(connection.get(key), nullValue()); assertThat(connectionToDbIndex2.get(key), notNullValue()); } finally { connectionToDbIndex2.close(); } }
Source:
private static void setRGBLayout( ImageLayout result, RenderedImage reference, boolean hasAlpha) { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel cm; if (hasAlpha) { int[] nBits = new int[] {8, 8, 8, 8}; cm = new ComponentColorModel( cs, nBits, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); } else { int[] nBits = new int[] {8, 8, 8}; cm = new ComponentColorModel( cs, nBits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); } SampleModel sm = cm.createCompatibleSampleModel( reference.getSampleModel().getWidth(), reference.getSampleModel().getWidth()); result.setColorModel(cm); result.setSampleModel(sm); }

Target:
private static void setRGBLayout( ImageLayout result, RenderedImage reference, boolean hasAlpha) { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel cm; if (hasAlpha) { int[] nBits = new int[] {8, 8, 8, 8}; cm = new ComponentColorModel( cs, nBits, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); } else { int[] nBits = new int[] {8, 8, 8}; cm = new ComponentColorModel( cs, nBits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); } SampleModel sampleModel = reference.getSampleModel(); SampleModel sm = cm.createCompatibleSampleModel(sampleModel.getWidth(), sampleModel.getHeight()); result.setColorModel(cm); result.setSampleModel(sm); }
Source:
public void encrypt() { CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); try { String encryptedString = Base64.encode(cryptoUtil.encrypt(Base64.decode(passwordString)); String encryptedStringTest = Base64.encode(encryptWithSymmetricKey(Base64.decode(passwordString))); if(!encryptedString.equals(encryptedStringTest)){ Assert.hasText(encryptedString, "Error in encrypting with symmetric key"); } } catch (CryptoException e) { e.printStackTrace(); } }

Target:
public void encrypt() throws CryptoException { try { uploadApp(); String serviceEndpoint = "http://" + context.getInstance().getHosts().get("default") + ":" + (Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTP_PORT) + portOffset) + "/services/DssVerifierService/"; String endpoint = "encrypt"; String contentType = "application/json"; String jsonRequest = "{\"" + endpoint + "\":{\"plainText\":\"" + passwordString + "\"}}"; HttpResponse response = this.getHttpResponse(serviceEndpoint + endpoint, contentType, jsonRequest); String encryptedString = response.getData(); int statusCode = response.getResponseCode(); if (statusCode != 500) { String encryptedStringTest = Base64.encode(encryptWithSymmetricKey(Base64.decode(passwordString))); if (!encryptedString.equals(encryptedStringTest)) { Assert.hasText(encryptedString, "Error in encrypting with symmetric key"); } } } catch (CryptoException e) { throw new CryptoException("Error in encrypting with symmetric key"); } catch (Exception e) { throw new CryptoException("Error in encrypting with symmetric key"); } }
Source:
public static Set getBloomFilterColumns(Configuration conf) { String columnNames = conf.get(BLOOM_FILTER_COLUMN_NAMES); if (columnNames != null) { return new HashSet<>(Arrays.asList(columnNames.split(","))); } else { return new HashSet(); } }

Target:
public static Set<String> getBloomFilterColumns(Configuration conf) { String columnNames = conf.get(BLOOM_FILTER_COLUMN_NAMES); if (columnNames != null) { return new HashSet<>(Arrays.asList(columnNames.split(","))); } else { return new HashSet<>(); } }
Source:
private boolean issueSync(ZooKeeper zk) { String sessionId = Long.toHexString(zk.getSessionId()); ZkAsyncCallbacks.SyncCallbackHandler callbackHandler = new ZkAsyncCallbacks.SyncCallbackHandler(sessionId); final long startT = System.currentTimeMillis(); doAsyncSync(zk, SYNC_PATH, startT, callbackHandler); callbackHandler.waitForSuccess(); KeeperException.Code code = KeeperException.Code.get(callbackHandler.getRc()); if (code == KeeperException.Code.OK) { LOG.info("sycnOnNewSession with sessionID async return code: and proceeds", sessionId, code); return true; } LOG.warn( "sycnOnNewSession with sessionID async return code: and not retryable, stop calling handleNewSession", sessionId, code); return false; }

Target:
private boolean issueSync(ZooKeeper zk) { String sessionId = Long.toHexString(zk.getSessionId()); ZkAsyncCallbacks.SyncCallbackHandler callbackHandler = new ZkAsyncCallbacks.SyncCallbackHandler(sessionId); final long startT = System.currentTimeMillis(); doAsyncSync(zk, SYNC_PATH, startT, callbackHandler); callbackHandler.waitForSuccess(); KeeperException.Code code = KeeperException.Code.get(callbackHandler.getRc()); if (code == KeeperException.Code.OK) { LOG.info("sycnOnNewSession with sessionID async return code: and proceeds", sessionId, code); return true; } return false; }
Source:
public void testHasDefaultAnnotationWithImport() { String name = IsAnnotated.class.getCanonicalName(); TypeElement element = compilation.getElements().getTypeElement(name); AnnotationSpec annotation = AnnotationSpec.get(element.getAnnotationMirrors().get(0)); TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(IsAnnotated.class.getSimpleName()); typeBuilder.addAnnotation(annotation); JavaFile file = JavaFile.builder("com.squareup.javapoet", typeBuilder.build()).build(); assertThat(file.toString()).isEqualTo( "package com.squareup.javapoet;\n" + "\n" + "import java.lang.Double;\n" + "import java.lang.Float;\n" + "import java.lang.Override;\n" + "\n" + "@AnnotationSpecTest.HasDefaultsAnnotation(\n" + " o = AnnotationSpecTest.Breakfast.PANCAKES,\n" + " p = 1701,\n" + " f = 11.1,\n" + " m = {\n 9,\n 8,\n 1\n },\n" + " l = Override.class,\n" + " j = @AnnotationSpecTest.AnnotationA,\n" + " q = @AnnotationSpecTest.AnnotationC(\"bar\"),\n" + " r = {\n Float.class,\n Double.class\n }\n" + ")\n" + "class IsAnnotated {\n" + "}\n" ); }

Target:
public void testHasDefaultAnnotationWithImport() { String name = IsAnnotated.class.getCanonicalName(); TypeElement element = compilation.getElements().getTypeElement(name); AnnotationSpec annotation = AnnotationSpec.get(element.getAnnotationMirrors().get(0)); TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(IsAnnotated.class.getSimpleName()); typeBuilder.addAnnotation(annotation); JavaFile file = JavaFile.builder("com.squareup.javapoet", typeBuilder.build()).build(); assertThat(file.toString()).isEqualTo( "package com.squareup.javapoet;\n" + "\n" + "import java.lang.Double;\n" + "import java.lang.Float;\n" + "import java.lang.Override;\n" + "\n" + "@AnnotationSpecTest.HasDefaultsAnnotation(\n" + " o = AnnotationSpecTest.Breakfast.PANCAKES,\n" + " p = 1701,\n" + " f = 11.1,\n" + " m = {\n" + " 9,\n" + " 8,\n" + " 1\n" + " },\n" + " l = Override.class,\n" + " j = @AnnotationSpecTest.AnnotationA,\n" + " q = @AnnotationSpecTest.AnnotationC(\"bar\"),\n" + " r = {\n" + " Float.class,\n" + " Double.class\n" + " }\n" + ")\n" + "class IsAnnotated {\n" + "}\n" ); }
Source:
@Test public void basicSuiteArchiveId() throws Exception { archiver.setArchiveId("dasId"); FreeStyleBuild build = project.scheduleBuild2(0).get(10, TimeUnit.SECONDS); assertTestResults(build); WebClient wc = j.new WebClient(); wc.getPage(project); wc.getPage(build); wc.getPage(build, "testReport"); wc.getPage(build, "testReport/hudson.security"); wc.getPage(build, "testReport/hudson.security/HudsonPrivateSecurityRealmTest/"); HtmlPage methodPage = wc.getPage(build, "testReport/hudson.security/HudsonPrivateSecurityRealmTest/testDataCompatibilityWith1_282/"); j.assertStringContains(methodPage.asText(), "[dasId]"); TestResultAction testResultAction = build.getAction(TestResultAction.class); SuiteResult suite = testResultAction.getResult().getSuite("hudson.security.HudsonPrivateSecurityRealmTest"); assertNotNull(suite); assertEquals("dasId", suite.getArchiveId()); }

Target:
public void basicSuiteArchiveId() throws Exception { archiver.setArchiveId("dasId"); FreeStyleBuild build = project.scheduleBuild2(0).get(10, TimeUnit.SECONDS); assertTestResults(build); WebClient wc = j.new WebClient(); wc.getPage(project); wc.getPage(build); wc.getPage(build, "testReport"); wc.getPage(build, "testReport/hudson.security"); HtmlPage classPage = wc.getPage(build, "testReport/hudson.security/HudsonPrivateSecurityRealmTest/"); HtmlPage methodPage = wc.getPage(build, "testReport/hudson.security/HudsonPrivateSecurityRealmTest/testDataCompatibilityWith1_282/"); j.assertStringContains(methodPage.asText(), "[dasId]"); j.assertStringContains(classPage.asText(), "[dasId]"); TestResultAction testResultAction = build.getAction(TestResultAction.class); SuiteResult suite = testResultAction.getResult().getSuite("hudson.security.HudsonPrivateSecurityRealmTest"); assertNotNull(suite); assertEquals("dasId", suite.getArchiveId()); }
Source:
public OverlaysNode(Context context) { componentSystemManager = context.get(ComponentSystemManager.class); worldRenderer = context.get(WorldRenderer.class); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = context.get(Config.class).getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, context.get(DisplayResolutionDependentFBOs.class))); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }

Target:
public OverlaysNode(Context context) { componentSystemManager = context.get(ComponentSystemManager.class); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = context.get(Config.class).getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); worldRenderer = context.get(WorldRenderer.class); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, context.get(DisplayResolutionDependentFBOs.class))); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public List<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName) throws InternalErrorException, PrivilegeException { if (!AuthzResolver.isAuthorized(perunSession, Role.PERUNADMIN) && !AuthzResolver.isAuthorized(perunSession, Role.PERUNOBSERVER)) { throw new PrivilegeException(perunSession, "pollConsumerMessages"); } return getAuditMessagesManagerBl().pollConsumerMessages(perunSession, consumerName); }

Target:
public List<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName) throws InternalErrorException, PrivilegeException { if (!AuthzResolver.isAuthorized(perunSession, Role.PERUNADMIN)) { throw new PrivilegeException(perunSession, "pollConsumerMessages"); } return getAuditMessagesManagerBl().pollConsumerMessages(perunSession, consumerName); }
Source:
public void setBars() { int fakeA = valueA; int fakeB = valueB; if (valueA != null && valueB != null && valueA + valueB >= 99) { double factor = (double)98 / (valueA + valueB); fakeA = (int)Math.round(factor * valueA); fakeB = (int)Math.round(factor * valueB); fakeA = (fakeB == 0 ? 99 : fakeA); fakeB = (fakeA == 0 ? 99 : fakeB); } if (valueB != null) { String percentageB = valueB + "%"; String fakePercentageB = fakeB + "%"; percentageLabelB.setText(valueB < 10 ? "" : percentageB); percentageLabelB.setStyleName(style.percentageLabel()); percentageBarB.setWidth(fakePercentageB); percentageBarB.setVisible(valueB != 0); percentageBarB.setTitle(percentageB); } if (valueA != null) { String percentageA = valueA + "%"; String fakePercentageA = fakeA + "%"; percentageLabelA.setText(valueA < 10 ? "" : percentageA); percentageLabelA.setStyleName(style.percentageLabelBlack()); percentageBarA.setWidth(fakePercentageA); percentageBarA.setVisible(valueA != 0); percentageBarA.setTitle(percentageA); } }

Target:
public void setBars() { int fakeA = valueA; int fakeB = valueB; if (valueA != null && valueB != null && valueA + valueB >= FULL_WIDTH) { double factor = (double)(FULL_WIDTH-1) / (valueA + valueB); fakeA = (int)Math.round(factor * valueA); fakeB = (int)Math.round(factor * valueB); fakeA = (fakeB == 0 ? FULL_WIDTH : fakeA); fakeB = (fakeA == 0 ? FULL_WIDTH : fakeB); } setBar(percentageBarA, percentageLabelA, valueA, fakeA, style.percentageLabelBlack()); setBar(percentageBarB, percentageLabelB, valueB, fakeB, style.percentageLabel()); }
Source:
public ResultSet getResultSet() { return Objects.requireNonNull(this.resultSet); }

Target:
public ResultSet getResultSet() { return this.resultSet; }
Source:
public boolean ack(String deviceUUID, List<String> ackKeys) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkNotNull(ackKeys, "ackKeys parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); if (ackKeys.isEmpty()) return true; String url = "/sync/ack"; Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("ack_keys", ackKeys); String serialized = JsonSerializer.serialize(attributes); Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), serialized); boolean acked = response.getHttpStatus() == 202; if (!acked) { log.warn("Ack request was not accepted. Http status: {}. Response body: {}", response.getHttpStatus(), response.getBody()); } else { log.debug("Items acknowledged."); } return acked; }

Target:
public boolean ack(String deviceUUID, List<String> ackKeys) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkNotNull(ackKeys, "ackKeys parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); if (ackKeys.isEmpty()) return true; String url = "/sync/ack"; Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("ack_keys", ackKeys); String serialized = JsonSerializer.serialize(attributes); Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), serialized); boolean acked = response.getHttpStatus() == ACCEPTED.getStatusCode(); if (!acked) { log.warn("Ack request was not accepted for {}. Http status: {}. Response body: {}", ackKeys, response.getHttpStatus(), response.getBody()); } else { log.debug("{} items acknowledged.", ackKeys.size()); } return acked; }
Source:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("extendedAttributes", projectId); }

Target:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("projectId", projectId).add("progress", progress); }
Source:
public static void setup() throws Exception { setRunIntoMavenCLI(); fileSystemTestingUtils.setup(); ioService = fileSystemTestingUtils.getIoService(); settings_XML = TestUtilMaven.getSettingsFile(); }

Target:
public static void setup() throws Exception { setRunIntoMavenCLI(); fileSystemTestingUtils.setup(); ioService = fileSystemTestingUtils.getIoService(); mavenSettingsPath = TestUtilMaven.getSettingsFile(); }
Source:
PacketCubes(FriendlyByteBuf buf) { int count = buf.readVarInt(); this.cubes = new BigCube[count]; this.cubePositions = new CubePos[count]; for (int i = 0; i < count; i++) { cubePositions[i] = CubePos.of(buf.readInt(), buf.readInt(), buf.readInt()); } int length = MathUtil.ceilDiv(cubes.length, 64); this.cubeExists = BitSet.valueOf(buf.readLongArray(new long[length])); ByteBuffer biomeBuffer = ByteBuffer.allocate(count * CubeBiomeContainer.CUBE_BIOMES_SIZE * 4); buf.readBytes(biomeBuffer.array()); IntBuffer intBuf = biomeBuffer.asIntBuffer(); biomes = new int[intBuf.remaining()]; intBuf.get(biomes); int packetLength = buf.readVarInt(); if (packetLength > MAX_CUBE_SIZE * cubes.length) { throw new RuntimeException("Cubes Packet trying to allocate too much memory on read: " + packetLength + " bytes for " + cubes.length + " cubes"); } this.packetData = new byte[packetLength]; buf.readBytes(this.packetData); int teTagCount = buf.readVarInt(); this.tileEntityTags = new ArrayList<>(teTagCount); for (int i = 0; i < teTagCount; i++) { this.tileEntityTags.add(buf.readNbt()); } }

Target:
PacketCubes(FriendlyByteBuf buf) { int count = buf.readVarInt(); this.cubes = new BigCube[count]; this.cubePositions = new CubePos[count]; for (int i = 0; i < count; i++) { cubePositions[i] = CubePos.of(buf.readInt(), buf.readInt(), buf.readInt()); } int length = MathUtil.ceilDiv(cubes.length, 64); this.cubeExists = BitSet.valueOf(buf.readLongArray(new long[length])); biomeDataArrays = new ArrayList<>(); for (int i = 0; i < count; i++) { biomeDataArrays.add(buf.readVarIntArray()); } int packetLength = buf.readVarInt(); if (packetLength > MAX_CUBE_SIZE * cubes.length) { throw new RuntimeException("Cubes Packet trying to allocate too much memory on read: " + packetLength + " bytes for " + cubes.length + " cubes"); } this.packetData = new byte[packetLength]; buf.readBytes(this.packetData); int teTagCount = buf.readVarInt(); this.tileEntityTags = new ArrayList<>(teTagCount); for (int i = 0; i < teTagCount; i++) { this.tileEntityTags.add(buf.readNbt()); } }
Source:
public long averageSizePerRowInBytes() { if (numDocs == -1) { return numDocs; } return sizeInBytes / numDocs; }

Target:
public long averageSizePerRowInBytes() { if (numDocs == -1) { return -1; } return sizeInBytes / numDocs; }
Source:
public final void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (!(spec instanceof ApplicationConfigParameters)) { throw new InvalidAlgorithmParameterException("Unsupported spec: " + spec + ". Only " + ApplicationConfigParameters.class.getName() + " supported"); } mApplicationConfig = ((ApplicationConfigParameters) spec).config; }

Target:
public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (!(spec instanceof ApplicationConfigParameters)) { throw new InvalidAlgorithmParameterException("Unsupported spec: " + spec + ". Only " + ApplicationConfigParameters.class.getName() + " supported"); } mApplicationConfig = ((ApplicationConfigParameters) spec).config; }
Source:
private static void getAllConnectorIds(PlanNode node, ImmutableSet.Builder<ConnectorId> builder) { if (node.getSources().isEmpty()) { if (node instanceof TableScanNode) { builder.add(((TableScanNode) node).getTable().getConnectorId()); } else { builder.add(EMPTY_CONNECTOR_ID); } return; } for (PlanNode child : node.getSources()) { getAllConnectorIds(child, builder); } }

Target:
private static void getAllConnectorIds(PlanNode node, ImmutableSet.Builder<ConnectorId> builder) { if (node.getSources().isEmpty()) { if (node instanceof TableScanNode) { builder.add(((TableScanNode) node).getTable().getConnectorId()); } else { verify(node instanceof ValuesNode, "Unexpected node type: " + node.getClass().getSimpleName()); builder.add(EMPTY_CONNECTOR_ID); } return; } for (PlanNode child : node.getSources()) { getAllConnectorIds(child, builder); } }
Source:
public Obs unvoidObs(Obs obs) throws APIException { return Context.getObsService().saveObs(obs,"unretire obs"); }

Target:
public Obs unvoidObs(Obs obs) throws APIException { return Context.getObsService().saveObs(obs,"unvoid obs"); }
Source:
public String toString() { return "EntrySetCommand{" + "set=" + cache.size() + " elements" + '}'; }

Target:
public String toString() { return "EntrySetCommand{" + "cache=" + cache.getName() + '}'; }
Source:
public void setUp() throws InjectionException { final EvaluatorRequestor mockedEvaluatorRequestor = mock(EvaluatorRequestor.class); doAnswer(new Answer() { @Override public Object answer(final InvocationOnMock invocationOnMock) { final EvaluatorRequest request = (EvaluatorRequest) invocationOnMock.getArguments()[0]; for (int i = 0; i < request.getNumber(); i++) { final String evalId = EVAL_PREFIX + evalCounter.getAndIncrement(); eventStage.onNext(generateMockedEvaluator(evalId)); } return null; } }).when(mockedEvaluatorRequestor).submit(any(EvaluatorRequest.class)); final Injector injector = Tang.Factory.getTang().newInjector(); injector.bindVolatileInstance(EvaluatorRequestor.class, mockedEvaluatorRequestor); evaluatorManager = injector.getInstance(HomogeneousEvalManager.class); driverAEHandler = new EventHandler<AllocatedEvaluator>() { @Override public void onNext(final AllocatedEvaluator allocatedEvaluator) { evaluatorManager.onEvent(allocatedEvaluator); } }; driverACHandler = new EventHandler<ActiveContext>() { @Override public void onNext(final ActiveContext activeContext) { evaluatorManager.onEvent(activeContext); } }; eventStage = new ThreadPoolStage<>(new EventHandler<Object>() { @Override public void onNext(final Object o) { try { Thread.sleep(RandomUtils.nextInt(MAX_SLEEP_MILLIS)); } catch (final InterruptedException e) { throw new RuntimeException(e); } if (o instanceof AllocatedEvaluator) { driverAEHandler.onNext((AllocatedEvaluator) o); } else { driverACHandler.onNext((ActiveContext) o); } } }, THREAD_POOL_SIZE); evalCounter = new AtomicInteger(0); }

Target:
public void setUp() throws InjectionException { evaluatorManager = new HomogeneousEvalManager(generateMockedEvaluatorRequestor(), 0); evalCounter = new AtomicInteger(0); evalIdToActualContextIdStack = new ConcurrentHashMap<>(); evalIdToExpectedContextIdStack = new ConcurrentHashMap<>(); }
Source:
private void processData() { String timestampString = fData.get(CustomTraceDefinition.TAG_TIMESTAMP); String timestampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY); TmfTimestamp timestamp = null; if (timestampInputFormat != null && timestampString != null) { TmfTimestampFormat timestampFormat = new TmfTimestampFormat(timestampInputFormat); try { long time = timestampFormat.parseValue(timestampString); timestamp = new TmfTimestamp(time, ITmfTimestamp.NANOSECOND_SCALE); setTimestamp(timestamp); } catch (ParseException e) { setTimestamp(TmfTimestamp.ZERO); } } else { setTimestamp(TmfTimestamp.ZERO); } int i = 0; synchronized (fColumnData) { fColumnData = new TmfEventField[fDefinition.outputs.size()]; for (OutputColumn outputColumn : fDefinition.outputs) { String value = fData.get(outputColumn.name); if (outputColumn.name.equals(CustomTraceDefinition.TAG_TIMESTAMP) && timestamp != null) { TmfTimestampFormat timestampFormat = new TmfTimestampFormat(fDefinition.timeStampOutputFormat); fColumnData[i++] = new TmfEventField(outputColumn.name, timestampFormat.format(timestamp.getValue()), null); } else { fColumnData[i++] = new TmfEventField(outputColumn.name, (value != null ? value : ""), null); } } } CustomEventContent curContent = (CustomEventContent) getContent(); setContent(new CustomEventContent(curContent.getName(), curContent.getValue(), fColumnData)); fData = null; }

Target:
private void processData() { String timestampString = fData.get(CustomTraceDefinition.TAG_TIMESTAMP); String timestampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY); TmfTimestamp timestamp = null; if (timestampInputFormat != null && timestampString != null) { TmfTimestampFormat timestampFormat = new TmfTimestampFormat(timestampInputFormat); try { long time = timestampFormat.parseValue(timestampString); timestamp = new TmfTimestamp(time, ITmfTimestamp.NANOSECOND_SCALE); setTimestamp(timestamp); } catch (ParseException e) { setTimestamp(TmfTimestamp.ZERO); } } else { setTimestamp(TmfTimestamp.ZERO); } int i = 0; fColumnData = new TmfEventField[fDefinition.outputs.size()]; for (OutputColumn outputColumn : fDefinition.outputs) { String value = fData.get(outputColumn.name); if (outputColumn.name.equals(CustomTraceDefinition.TAG_TIMESTAMP) && timestamp != null) { TmfTimestampFormat timestampFormat = new TmfTimestampFormat(fDefinition.timeStampOutputFormat); fColumnData[i++] = new TmfEventField(outputColumn.name, timestampFormat.format(timestamp.getValue()), null); } else { fColumnData[i++] = new TmfEventField(outputColumn.name, (value != null ? value : ""), null); } } CustomEventContent curContent = (CustomEventContent) getContent(); setContent(new CustomEventContent(curContent.getName(), curContent.getValue(), fColumnData)); fData = null; }
Source:
public <T> T deserialize(Response response, Type returnType) throws ApiException { if (response == null || returnType == null) { return null; } if ("byte[]".equals(returnType.toString())) { try { return (T) response.body().bytes(); } catch (IOException e) { throw new ApiException(e); } } else if (returnType.equals(File.class)) { return (T) downloadFileFromResponse(response); } String respBody; try { if (response.body() != null) respBody = response.body().string(); else respBody = null; } catch (IOException e) { throw new ApiException(e); } if (respBody == null || "".equals(respBody)) { return null; } String contentType = response.headers().get("Content-Type"); if (contentType == null) { contentType = "application/json"; } if (isJsonMime(contentType)) { return json.deserialize(respBody, returnType); } else if (returnType.equals(String.class)) { return (T) respBody; } else { Gson gson = JSON.createGson().setPrettyPrinting().create(); ErrorResponse errorResponse = null; try { errorResponse = gson.fromJson(respBody, ErrorResponse.class); } catch (Exception e) { throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, e, response.code(), response.headers().toMultimap()); } throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), errorResponse); } }

Target:
public <T> T deserialize(Response response, Type returnType) throws ApiException { if (response == null || returnType == null) { return null; } if ("byte[]".equals(returnType.toString())) { try { return (T) response.body().bytes(); } catch (IOException e) { throw new ApiException(e); } } else if (returnType.equals(File.class)) { return (T) downloadFileFromResponse(response); } String respBody; try { if (response.body() != null) respBody = response.body().string(); else respBody = null; } catch (IOException e) { throw new ApiException(e); } if (respBody == null || "".equals(respBody)) { return null; } String contentType = response.headers().get("Content-Type"); if (contentType == null) { contentType = "application/json"; } if (isJsonMime(contentType)) { return json.deserialize(respBody, returnType); } else if (returnType.equals(String.class)) { return (T) respBody; } else { throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), respBody); } }
Source:
public void testGetReturnValueWait() throws InterruptedException, ExecutionException, TimeoutException { Object value = new Object(); InternalCacheEntry ice = when(mock(InternalCacheEntry.class, RETURNS_DEEP_STUBS).getValue()).thenReturn(value).getMock(); sync.runL1UpdateIfPossible(ice); assertEquals(value, sync.get()); }

Target:
public void testGetReturnValueWait() throws InterruptedException, ExecutionException, TimeoutException { Object value = new Object(); InternalCacheEntry ice = new ImmortalCacheEntry(value, value); sync.runL1UpdateIfPossible(ice); assertEquals(value, sync.get()); }
Source:
public SqlPersistenceServiceImpl(SqlPersistenceProvider provider, ConfigurationService configurationService) { this.provider = provider; this.configurationService = configurationService; }

Target:
public SqlPersistenceServiceImpl(SqlPersistenceProvider provider, ConfigurationService configurationService) { this.provider = provider; this.configurationService = configurationService; this.expiredObjectColumnName = getKeyColumnName(configurationService); }
Source:
public void testPut(Method method) { final String key1 = generateKey(method, 1); final String key2 = generateKey(method, 2); cache(0).put(key1, "value1"); assertNoLocks(key1); cache(0).put(key2, "value2"); assertNoLocks(key2); cache(1).put(key1, "value3"); assertNoLocks(key1); cache(1).put(key2, "value4"); assertNoLocks(key2); assertTopKeyAccesses(cache(0), key1, 1, false); assertTopKeyAccesses(cache(0), key2, 1, false); assertTopKeyAccesses(cache(0), key1, 0, true); assertTopKeyAccesses(cache(0), key2, 0, true); assertTopKeyAccesses(cache(1), key1, 1, false); assertTopKeyAccesses(cache(1), key2, 1, false); assertTopKeyAccesses(cache(1), key1, 0, true); assertTopKeyAccesses(cache(1), key2, 0, true); if (isPrimaryOwner(cache(0), key1)) { assertLockInformation(cache(0), key1, 2, 0, 0); assertLockInformation(cache(1), key1, 0, 0, 0); } else { assertLockInformation(cache(0), key1, 0, 0, 0); assertLockInformation(cache(1), key1, 2, 0, 0); } if (isPrimaryOwner(cache(0), key2)) { assertLockInformation(cache(0), key2, 2, 0, 0); assertLockInformation(cache(1), key2, 0, 0, 0); } else { assertLockInformation(cache(0), key2, 0, 0, 0); assertLockInformation(cache(1), key2, 2, 0, 0); } assertWriteSkew(cache(0), key1, 0); assertWriteSkew(cache(0), key2, 0); assertWriteSkew(cache(1), key1, 0); assertWriteSkew(cache(1), key2, 0); }

Target:
public void testPut(Method method) { final String key1 = k(method, 1); final String key2 = k(method, 2); cache(0).put(key1, "value1"); cache(0).put(key2, "value2"); assertNoLocks(key1); assertNoLocks(key2); cache(1).put(key1, "value3"); cache(1).put(key2, "value4"); assertTopKeyAccesses(cache(0), key1, 1, false); assertTopKeyAccesses(cache(0), key2, 1, false); assertTopKeyAccesses(cache(0), key1, 0, true); assertTopKeyAccesses(cache(0), key2, 0, true); assertTopKeyAccesses(cache(1), key1, 1, false); assertTopKeyAccesses(cache(1), key2, 1, false); assertTopKeyAccesses(cache(1), key1, 0, true); assertTopKeyAccesses(cache(1), key2, 0, true); if (isPrimaryOwner(cache(0), key1)) { assertLockInformation(cache(0), key1, 2, 0, 0); assertLockInformation(cache(1), key1, 0, 0, 0); } else { assertLockInformation(cache(0), key1, 0, 0, 0); assertLockInformation(cache(1), key1, 2, 0, 0); } if (isPrimaryOwner(cache(0), key2)) { assertLockInformation(cache(0), key2, 2, 0, 0); assertLockInformation(cache(1), key2, 0, 0, 0); } else { assertLockInformation(cache(0), key2, 0, 0, 0); assertLockInformation(cache(1), key2, 2, 0, 0); } assertWriteSkew(cache(0), key1, 0); assertWriteSkew(cache(0), key2, 0); assertWriteSkew(cache(1), key1, 0); assertWriteSkew(cache(1), key2, 0); }
Source:
protected void createPage3() { dependenciesEditor = new JobDependenciesEditor(this, designerEditor.isReadOnly()); try { int index = addPage(dependenciesEditor, getEditorInput()); setPageText(index, "Dependencies"); setPageImage(index, DesignerPlugin.getImageDescriptor("icons/dependencies/dependencies.gif").createImage()); } catch (PartInitException e) { ExceptionHandler.process(e); } }

Target:
protected void createPage3() { dependenciesEditor = new JobDependenciesEditor(this, designerEditor.isReadOnly()); try { int index = addPage(dependenciesEditor, getEditorInput()); setPageText(index, Messages.getString("AbstractMultiPageTalendEditor.DependenciesPage")); setPageImage(index, DesignerPlugin.getImageDescriptor("icons/dependencies/dependencies.gif").createImage()); } catch (PartInitException e) { ExceptionHandler.process(e); } }
Source:
public void beginWindow(long windowId) { super.beginWindow(windowId); currentWindowId = windowId; if ( currentWindowId != Stateless.WINDOW_ID) { if (currentWindowId > reconcilingWindowId) { isInSafeMode = false; isInReconcilingMode = false; } if (currentWindowId == reconcilingWindowId) { isInReconcilingMode = true; isInSafeMode = false; } if (currentWindowId < reconcilingWindowId) { isInReconcilingMode = false; isInSafeMode = true; } } numDeletedInThisWindow = 0; numInsertsInThisWindow = 0; numUpdatesInThisWindow = 0; numUpsertsInThisWindow = 0; }

Target:
public void beginWindow(long windowId) { super.beginWindow(windowId); currentWindowId = windowId; if ( currentWindowId != Stateless.WINDOW_ID) { if (currentWindowId > reconcilingWindowId) { isInReplayMode = false; isInReconcilingMode = false; } if (currentWindowId == reconcilingWindowId) { isInReconcilingMode = true; isInReplayMode = false; } if (currentWindowId < reconcilingWindowId) { isInReconcilingMode = false; isInReplayMode = true; } } numDeletes = 0; numInserts = 0; numUpdates = 0; numUpserts = 0; }
Source:
public DeviceFirmware convertFrom(final DeviceFirmwareFile source, final Type<DeviceFirmware> destinationType, final MappingContext mappingContext) { final DeviceFirmware destination = new DeviceFirmware(); destination.setDeviceIdentification(source.getDevice().getDeviceIdentification()); final FirmwareConverter firmwareConverter = new FirmwareConverter(); final Firmware firmware = firmwareConverter.convert(source.getFirmwareFile(), firmwareConverter.getBType(), mappingContext); destination.setFirmware(firmware); final GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(source.getInstallationDate()); try { destination.setInstallationDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar)); } catch (final DatatypeConfigurationException e) { LOGGER.error("Bad date format in the installation date", e); } destination.setInstalledBy(source.getInstalledBy()); destination.setActive(true); return destination; }

Target:
public DeviceFirmware convertFrom(final DeviceFirmwareFile source, final Type<DeviceFirmware> destinationType, final MappingContext mappingContext) { final DeviceFirmware destination = new DeviceFirmware(); destination.setDeviceIdentification(source.getDevice().getDeviceIdentification()); final Firmware firmware = this.mapperFacade.map(source.getFirmwareFile(), Firmware.class, mappingContext); destination.setFirmware(firmware); final GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(source.getInstallationDate()); try { destination.setInstallationDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar)); } catch (final DatatypeConfigurationException e) { LOGGER.error("Bad date format in the installation date", e); } destination.setInstalledBy(source.getInstalledBy()); destination.setActive(true); return destination; }
Source:
public Message<Object> receive() { for (Object key : correlationLocks.keySet()) { Object lock = getLock(key); synchronized (lock) { MessageGroup group = store.getMessageGroup(key); if (group != null) { if (releaseStrategy.canRelease(group)) { Message<?> nextMessage = null; Iterator<Message<?>> messages = group.getMessages().iterator(); if (messages.hasNext()) { nextMessage = messages.next(); this.store.removeMessagesFromGroup(key, Collections.<Message<?>>singletonList(nextMessage)); if (log.isDebugEnabled()) { log.debug(String.format("Released message for key [%s]: %s.", key, nextMessage)); } } else { remove(key); } @SuppressWarnings("unchecked") Message<Object> result = (Message<Object>) nextMessage; return result; } } } } return null; }

Target:
public Message<Object> receive() { for (Object key : correlationLocks.keySet()) { Object lock = getLock(key); synchronized (lock) { MessageGroup group = store.getMessageGroup(key); if (group != null) { if (releaseStrategy.canRelease(group)) { Message<?> nextMessage = null; Iterator<Message<?>> messages = group.getMessages().iterator(); if (messages.hasNext()) { nextMessage = messages.next(); this.store.removeMessagesFromGroup(key, nextMessage); if (log.isDebugEnabled()) { log.debug(String.format("Released message for key [%s]: %s.", key, nextMessage)); } } else { remove(key); } @SuppressWarnings("unchecked") Message<Object> result = (Message<Object>) nextMessage; return result; } } } } return null; }
Source:
private List<V> pullEncodedKeys(final List<EncodedKey<K>> encodedKeys) { final boolean traceEnabled = RAND.nextDouble() < traceProbability; final TraceScope pullListScope = traceEnabled ? Trace.startSpan("pull_list. num_keys: " + encodedKeys.size(), pwTraceScope.getSpan()) : NullScope.INSTANCE; try { final List<PullOp> pullOps = new ArrayList<>(encodedKeys.size()); for (final EncodedKey<K> encodedKey : encodedKeys) { Span detached = null; try (final TraceScope pullEnqueueScope = Trace.startSpan("pull. key: " + encodedKey.getKey(), pullListScope.getSpan())) { final int threadId = getThreadIndex(encodedKey.getHash()); detached = pullEnqueueScope.detach(); final PullOp pullOp = new PullOp(workerThreads[threadId], encodedKey, TraceInfo.fromSpan(detached)); pullOps.add(pullOp); workerThreads[threadId].enqueue(pullOp); } finally { Trace.continueSpan(detached).close(); } } final List<V> values = new ArrayList<>(pullOps.size()); for (final PullOp pullOp : pullOps) { values.add(pullOp.getResult()); } return values; } finally { pullListScope.close(); } }

Target:
private List<V> pullEncodedKeys(final List<EncodedKey<K>> encodedKeys) { final boolean traceEnabled = RAND.nextDouble() < traceProbability; try (final TraceScope pullListScope = traceEnabled ? Trace.startSpan(String.format("pull_list. num_keys: %d", encodedKeys.size()), pwTraceScope.getSpan()) : NullScope.INSTANCE) { final List<PullOp> pullOps = new ArrayList<>(encodedKeys.size()); for (final EncodedKey<K> encodedKey : encodedKeys) { Span detached = null; try (final TraceScope pullEnqueueScope = Trace.startSpan(String.format("pull. key: %s", encodedKey.getKey()), pullListScope.getSpan())) { final int threadId = getThreadIndex(encodedKey.getHash()); detached = pullEnqueueScope.detach(); final PullOp pullOp = new PullOp(workerThreads[threadId], encodedKey, TraceInfo.fromSpan(detached)); pullOps.add(pullOp); workerThreads[threadId].enqueue(pullOp); } finally { Trace.continueSpan(detached).close(); } } final List<V> values = new ArrayList<>(pullOps.size()); for (final PullOp pullOp : pullOps) { values.add(pullOp.getResult()); } return values; } }
Source:
public Integer getTopStateAssignmentTotalSize() { int totalSize = 0; for (Set<String> topStates : _currentTopStateAssignments.values()) { totalSize += topStates.size(); } return totalSize; }

Target:
public int getTopStateAssignmentTotalSize() { return _currentTopStateAssignments.values().stream().mapToInt(Set::size).sum(); }
Source:
public void execute(SensorContext context) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); Map<InputFile, Set<Integer>> linesOfCode = new HashMap<>(); boolean sqGreater61 = context.getSonarQubeVersion().isGreaterThanOrEqual(V6_2); treeVisitors.add(new MetricsVisitor(context, noSonarFilter, settings.getBoolean(JavaScriptPlugin.IGNORE_HEADER_COMMENTS), fileLinesContextFactory, linesOfCode, sqGreater61)); treeVisitors.add(new HighlighterVisitor(context, fileSystem)); treeVisitors.add(new SeChecksDispatcher(checks.seChecks())); treeVisitors.add(new CpdVisitor(fileSystem, context)); treeVisitors.addAll(checks.visitorChecks()); for (TreeVisitor check : treeVisitors) { if (check instanceof ParsingErrorCheck) { parsingErrorRuleKey = checks.ruleKeyFor((JavaScriptCheck) check); break; } } ProgressReport progressReport = new ProgressReport("Report about progress of Javascript analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); analyseFiles(context, treeVisitors, fileSystem.inputFiles(mainFilePredicate), progressReport); executeCoverageSensors(context, linesOfCode, sqGreater61); }

Target:
public void execute(SensorContext context) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); boolean isAtLeastSq62 = context.getSonarQubeVersion().isGreaterThanOrEqual(V6_2); MetricsVisitor metricsVisitor = new MetricsVisitor( context, noSonarFilter, settings.getBoolean(JavaScriptPlugin.IGNORE_HEADER_COMMENTS), fileLinesContextFactory, isAtLeastSq62); treeVisitors.add(metricsVisitor); treeVisitors.add(new HighlighterVisitor(context, fileSystem)); treeVisitors.add(new SeChecksDispatcher(checks.seChecks())); treeVisitors.add(new CpdVisitor(fileSystem, context)); treeVisitors.addAll(checks.visitorChecks()); for (TreeVisitor check : treeVisitors) { if (check instanceof ParsingErrorCheck) { parsingErrorRuleKey = checks.ruleKeyFor((JavaScriptCheck) check); break; } } ProgressReport progressReport = new ProgressReport("Report about progress of Javascript analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); analyseFiles(context, treeVisitors, fileSystem.inputFiles(mainFilePredicate), progressReport); executeCoverageSensors(context, metricsVisitor.linesOfCode(), isAtLeastSq62); }
Source:
public void testUnhandledNullModelObject() { IModel<String> nameModel = new LambdaModel<>(Model.of((Person)null), Person::getName); assertEquals("A", nameModel.getObject()); }

Target:
public void testUnhandledNullModelObject() { IModel<String> nameModel = new LambdaModel<>(Model.of((Person)null), Person::getName); nameModel.getObject(); }
Source:
private static void validateExistsArgument(Object exists) throws QueryException { if (!(exists instanceof Boolean)) { throw new QueryException("$exists operator expects true or false"); } }

Target:
private static void validateExistsArgument(Object exists) throws QueryException { if (!(exists instanceof Boolean)) { throw new QueryException("$exists operator requires operand to be true or false"); } }
Source:
public boolean isValidPhenotype(final Integer experimentId, final Integer phenotypeId) { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("phenotypeId", phenotypeId)); final ExperimentModel experiment = new ExperimentModel(); experiment.setNdExperimentId(experimentId); criteria.add(Restrictions.eq("experiment", experiment)); criteria.setProjection(Projections.property("phenotypeId")); final Integer id = (Integer) criteria.uniqueResult(); return id != null; }

Target:
public boolean isValidPhenotype(final Integer experimentId, final Integer phenotypeId) { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("phenotypeId", phenotypeId)); criteria.add(Restrictions.eq("experiment.ndExperimentId", experimentId)); criteria.setProjection(Projections.property("phenotypeId")); final Integer id = (Integer) criteria.uniqueResult(); return id != null; }
Source:
private static String findRootPath(File extFile) { File currPath = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { currPath = extFile; try { while (Environment.isExternalStorageRemovable(currPath.getParentFile())) { currPath = currPath.getParentFile(); } } catch (IllegalArgumentException e) { return currPath.getAbsolutePath(); } } return currPath.getAbsolutePath(); }

Target:
private static String findRootPath(File extFile) { if (extFile == null) { return null; } File currPath = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { currPath = extFile; try { while (Environment.isExternalStorageRemovable(currPath.getParentFile())) { currPath = currPath.getParentFile(); } } catch (IllegalArgumentException e) { return currPath.getAbsolutePath(); } } return currPath.getAbsolutePath(); }
Source:
public void onSignDye(PlayerInteractEvent event) { if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) return; Material clickedBlock = event.getClickedBlock().getBlockData().getMaterial(); Action action = event.getAction(); User user = ess.getUser(event.getPlayer()); Material itemInHand = user.getItemInHand().getType(); if (MaterialUtil.isSign(clickedBlock) && action == Action.RIGHT_CLICK_BLOCK && MaterialUtil.isDye(itemInHand)) { event.setCancelled(prot.getSettingBool(ProtectConfig.disable_sign_dyeing)); } }

Target:
public void onSignDye(PlayerInteractEvent event) { if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) return; Material clickedBlock = event.getClickedBlock().getBlockData().getMaterial(); Material itemInHand = event.getItem().getType(); Action action = event.getAction(); if (MaterialUtil.isSign(clickedBlock) && action == Action.RIGHT_CLICK_BLOCK && MaterialUtil.isDye(itemInHand)) { event.setCancelled(prot.getSettingBool(ProtectConfig.disable_sign_dyeing)); } }
Source:
public void shutdown(ShutdownInput shutDownInput) { if (isDebugEnabled()) { debug(null, "shard ID: " + (m_shardId.trim().isEmpty()? "unknown" : m_shardId) + ", shutdown reason: " + shutDownInput.getShutdownReason().name()); } if (ShutdownReason.TERMINATE.equals(shutDownInput.getShutdownReason())) { commitCheckPoint(shutDownInput.getCheckpointer()); } }

Target:
public void shutdown(ShutdownInput shutDownInput) { if (isDebugEnabled()) { debug(null, "shard ID: " + m_shardId + ", shutdown reason: " + shutDownInput.getShutdownReason().name()); } if (ShutdownReason.TERMINATE.equals(shutDownInput.getShutdownReason())) { commitCheckPoint(shutDownInput.getCheckpointer()); } }