auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { return "ServerConfig{" + "instanceName='" + instanceName + '\'' + ", hostName='" + hostName + '\'' + ", port=" + port + ", datacenterName='" + datacenterName + '\'' + ", sslPort=" + sslPort + ", http2Port=" + http2Port + ", rackId='" + rackId + '\'' + ", xid=" + xid + ", sealedReplicas=" + sealedReplicas + ", stoppedReplicas=" + stoppedReplicas + ", diskConfigs=" + diskConfigs + '}'; }

Target:
public String toString() { return "DataNodeConfig{" + "instanceName='" + instanceName + '\'' + ", hostName='" + hostName + '\'' + ", port=" + port + ", datacenterName='" + datacenterName + '\'' + ", sslPort=" + sslPort + ", http2Port=" + http2Port + ", rackId='" + rackId + '\'' + ", xid=" + xid + ", sealedReplicas=" + sealedReplicas + ", stoppedReplicas=" + stoppedReplicas + ", disabledReplicas=" + disabledReplicas + ", diskConfigs=" + diskConfigs + '}'; }
Source:
public void testDiagnosticRedrawingCalls() throws CoreException { IFile file = TestUtils.createUniqueTestFile(project, "Diagnostic Other Text\nDiagnostic Other Text"); final Range range1 = new Range(new Position(0, 0), new Position(0, 10)); final Range range2 = new Range(new Position(1, 0), new Position(1, 10)); final Diagnostic pos1Info1 = createDiagnostic("1", "message1", range1, DiagnosticSeverity.Error, "source1"); final Diagnostic pos1Info2 = createDiagnostic("2", "message2", range1, DiagnosticSeverity.Error, "source2"); final Diagnostic pos2Info2 = createDiagnostic("2", "message2", range2, DiagnosticSeverity.Error, "source2"); confirmResourceChanges(file, pos1Info1, 2); confirmResourceChanges(file, pos1Info2, 1); confirmResourceChanges(file, pos2Info2, 1); confirmResourceChanges(file, pos1Info1, 1); confirmResourceChanges(file, pos1Info1, 0); }

Target:
public void testDiagnosticRedrawingCalls() throws CoreException { IFile file = TestUtils.createUniqueTestFile(project, "Diagnostic Other Text\nDiagnostic Other Text"); final Range range1 = new Range(new Position(0, 0), new Position(0, 10)); final Range range2 = new Range(new Position(1, 0), new Position(1, 10)); final Diagnostic pos1Info1 = createDiagnostic("1", "message1", range1, DiagnosticSeverity.Error, "source1"); final Diagnostic pos1Info2 = createDiagnostic("2", "message2", range1, DiagnosticSeverity.Error, "source2"); final Diagnostic pos2Info2 = createDiagnostic("2", "message2", range2, DiagnosticSeverity.Error, "source2"); confirmResourceChanges(file, pos1Info1, 1); confirmResourceChanges(file, pos1Info2, 1); confirmResourceChanges(file, pos2Info2, 1); confirmResourceChanges(file, pos1Info1, 1); confirmResourceChanges(file, pos1Info1, 0); }
Source:
public double accumulate() { return result.setScale(Matrices.ROUND_FACTOR, RoundingMode.CEILING).doubleValue(); }

Target:
public double accumulate() { return result.setScale(Vectors.ROUND_FACTOR, RoundingMode.CEILING).doubleValue(); }
Source:
private void initNamesList(ILayer layer) { DataSource ds = layer.getDataSource(); Type geomType = null; try { geomType = ds.getMetadata().getFieldType(ds.getSpatialFieldIndex()); } catch (DriverException e) { e.printStackTrace(); } int simpleGeomType = SimpleGeometryType.getSimpleType(geomType); ArrayList<String> typeNames = new ArrayList<String>(); final int lineOrPolygon = SimpleGeometryType.LINE | SimpleGeometryType.POLYGON; if ((simpleGeomType & SimpleGeometryType.ALL) != 0) { typeNames.add(UniqueSymbolPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(UniqueSymbolLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(UniqueSymbolArea.NAME); } typeNames.add(RecodedPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(RecodedLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(RecodedArea.NAME); } typeNames.add(ProportionalPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(ProportionalLine.NAME); } typeNames.add(CategorizedPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(CategorizedLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(CategorizedArea.NAME); } } names = typeNames.toArray(new String[typeNames.size()]); }

Target:
private void initNamesList(ILayer layer) { DataSource ds = layer.getDataSource(); Type geomType = null; try { geomType = ds.getMetadata().getFieldType(ds.getSpatialFieldIndex()); } catch (DriverException e) { LOGGER.warn("Could not determine the specific geometry type for " + "this layer."); } int simpleGeomType = (geomType == null) ? SimpleGeometryType.ALL : SimpleGeometryType.getSimpleType(geomType); ArrayList<String> typeNames = new ArrayList<String>(); final int lineOrPolygon = SimpleGeometryType.LINE| SimpleGeometryType.POLYGON; if ((simpleGeomType & SimpleGeometryType.ALL) != 0) { typeNames.add(UniqueSymbolPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(UniqueSymbolLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(UniqueSymbolArea.NAME); } typeNames.add(RecodedPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(RecodedLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(RecodedArea.NAME); } typeNames.add(ProportionalPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(ProportionalLine.NAME); } typeNames.add(CategorizedPoint.NAME); if ((simpleGeomType & lineOrPolygon) != 0) { typeNames.add(CategorizedLine.NAME); } if ((simpleGeomType & SimpleGeometryType.POLYGON) != 0) { typeNames.add(CategorizedArea.NAME); } } names = typeNames.toArray(new String[typeNames.size()]); }
Source:
public ImportCertificateOptions(String name, byte[] certificate) { Objects.requireNonNull(certificate, "The certificate value parameter cannot be null."); this.name = name; this.certificate = CoreUtils.clone(certificate); }

Target:
public ImportCertificateOptions(String name, byte[] certificate) { Objects.requireNonNull(certificate, "The certificate parameter cannot be null."); this.name = name; this.certificate = CoreUtils.clone(certificate); }
Source:
public void process() { PerformanceMonitor.startActivity("Render World (Reflection)"); sceneReflected.bind(); OpenGLUtils.setViewportToSizeOf(sceneReflected); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL11.glCullFace(GL11.GL_FRONT); playerCamera.setReflected(true); playerCamera.lookThroughNormalized(); backdropRenderer.render(playerCamera); playerCamera.lookThrough(); if (renderingConfig.isReflectiveWater()) { chunkShader.activateFeature(ShaderProgramFeature.FEATURE_USE_FORWARD_LIGHTING); worldRenderer.renderChunks(renderQueues.chunksOpaqueReflection, ChunkMesh.RenderPhase.OPAQUE, playerCamera, WorldRendererImpl.ChunkRenderMode.REFLECTION); chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_USE_FORWARD_LIGHTING); } playerCamera.setReflected(false); GL11.glCullFace(GL11.GL_BACK); bindDisplay(); OpenGLUtils.setViewportToSizeOf(sceneOpaque); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("Render World (Reflection)"); FBO sceneReflected = frameBuffersManager.getFBO("sceneReflected"); FBO sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); sceneReflected.bind(); setViewportToSizeOf(sceneReflected); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL11.glCullFace(GL11.GL_FRONT); playerCamera.setReflected(true); playerCamera.lookThroughNormalized(); backdropRenderer.render(playerCamera); playerCamera.lookThrough(); if (renderingConfig.isReflectiveWater()) { chunkShader.activateFeature(ShaderProgramFeature.FEATURE_USE_FORWARD_LIGHTING); worldRenderer.renderChunks(renderQueues.chunksOpaqueReflection, ChunkMesh.RenderPhase.OPAQUE, playerCamera, WorldRendererImpl.ChunkRenderMode.REFLECTION); chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_USE_FORWARD_LIGHTING); } playerCamera.setReflected(false); GL11.glCullFace(GL11.GL_BACK); bindDisplay(); setViewportToSizeOf(sceneOpaque); PerformanceMonitor.endActivity(); }
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public GetMainSearchRequest(StructField reqArrayField) { StructType reqType = (StructType)((ArrayType)reqArrayField.dataType()).elementType(); indicesIdx = reqType.fieldIndex("indices"); queryTypeIdx = reqType.fieldIndex("querytype"); UDF2<String, Row[], Row> udfMethod = this::getMainSearchReq; this.userDefinedFunction = udf(udfMethod, reqType); }

Target:
public GetMainSearchRequest(StructField reqArrayField) { reqType = (StructType)((ArrayType)reqArrayField.dataType()).elementType(); indicesIdx = reqType.fieldIndex("indices"); queryTypeIdx = reqType.fieldIndex("querytype"); }
Source:
public Map<String, ResourceAssignment> getBaselineAssignment() { return _baselineAssignment; }

Target:
public Map<String, ResourceAssignment> getBaselineAssignment() { return _baselineAssignment == null || _baselineAssignment.isEmpty() ? Collections.emptyMap() : _baselineAssignment; }
Source:
protected String formatValue(Object value) { if ( value instanceof Timestamp ) { Time time = new java.sql.Time(((Timestamp) value).getTime()); String timeAsStr = String.valueOf(time); return objectWithPrecisionToString(timeAsStr, (Timestamp) value, this.columnLength); } else { return String.valueOf((Time) value); } }

Target:
protected String formatValue(Object value) { if ( value instanceof Timestamp ) { Time time = new Time(((Timestamp) value).getTime()); String timeAsStr = String.valueOf(time); return objectWithPrecisionToString(timeAsStr, (Timestamp) value, this.columnLength); } else { return String.valueOf((Time) value); } }
Source:
public VertexQuery queryVertex(Graph graph, Vertex vertex, String queryString, Authorizations authorizations) { return new ElasticSearchSearchVertexQuery( getClient(), getConfig().getIndicesToQuery(), graph, vertex, queryString, getAllPropertyDefinitions(), getConfig().getScoringStrategy(), getConfig().getNameSubstitutionStrategy(), authorizations); }

Target:
public VertexQuery queryVertex(Graph graph, Vertex vertex, String queryString, Authorizations authorizations) { return new ElasticSearchSearchVertexQuery( getClient(), getConfig().getIndicesToQuery(), graph, vertex, queryString, getAllPropertyDefinitions(), getConfig().getScoringStrategy(), this.nameSubstitutionStrategy, authorizations); }
Source:
SecurityDomain(final Map<String, SecurityRealm> realmMap, final String defaultRealmName, final NameRewriter[] preRealmRewriters, final RealmMapper realmMapper, final NameRewriter[] postRealmRewriters, RoleMapper roleMapper, Map<String, RoleMapper> realmRoleMappers) { assert realmMap.containsKey(defaultRealmName); this.realmMap = realmMap; this.defaultRealmName = defaultRealmName; this.preRealmRewriters = preRealmRewriters; this.realmMapper = realmMapper; this.postRealmRewriters = postRealmRewriters; this.roleMapper = roleMapper == null ? RoleMapper.DEFAULT_ROLE_MAPPER : roleMapper; this.realmRoleMappers = realmRoleMappers; anonymousAllowed = false; }

Target:
SecurityDomain(final Map<String, SecurityRealm> realmMap, final String defaultRealmName, final NameRewriter[] preRealmRewriters, final RealmMapper realmMapper, final NameRewriter[] postRealmRewriters, RoleMapper roleMapper, Map<String, RoleMapper> realmRoleMappers) { assert realmMap.containsKey(defaultRealmName); this.realmMap = realmMap; this.defaultRealmName = defaultRealmName; this.preRealmRewriters = preRealmRewriters; this.realmMapper = realmMapper; this.postRealmRewriters = postRealmRewriters; this.roleMapper = roleMapper == null ? RoleMapper.IDENTITY_ROLE_MAPPER : roleMapper; this.realmRoleMappers = realmRoleMappers; anonymousAllowed = false; }
Source:
public ChunkMeshBatch(World world, int baseX, int baseY, int baseZ) { super(new Point(world, baseX, baseY, baseZ), SIZE); modelMat = MathHelper.translate(new Vector3(baseX * SIZE_X, baseY * SIZE_Y, baseZ * SIZE_Z)); int id = 0; for (int i = baseX; i < baseX + SIZE_X; i++) { for (int j = baseY; j < baseY + SIZE_Y; j++) { for (int k = baseZ; k < baseZ + SIZE_Z; k++) { SpoutSnapshotLock lock = (SpoutSnapshotLock) Spout.getEngine().getScheduler().getSnapshotLock(); lock.coreReadLock("Generate mesh"); Chunk chunk = world.getChunk(i, j, k); meshes[id] = new ChunkMesh(chunk); lock.coreReadUnlock("Generate mesh"); id++; } } } }

Target:
public ChunkMeshBatch(World world, int baseX, int baseY, int baseZ) { super(new Point(world, baseX, baseY, baseZ), SIZE); modelMat = MathHelper.translate(new Vector3(baseX * SIZE_X, baseY * SIZE_Y, baseZ * SIZE_Z)); int id = 0; for (int i = baseX; i < baseX + SIZE_X; i++) { for (int j = baseY; j < baseY + SIZE_Y; j++) { for (int k = baseZ; k < baseZ + SIZE_Z; k++) { Chunk chunk = world.getChunk(i, j, k); meshes[id++] = new ChunkMesh(chunk,this); } } } }
Source:
public void testMaxSizePassed() throws ArrayIndexOutOfBoundsException { try{SizeLimitedVector slv = new SizeLimitedVector(1); slv.add(13); slv.add(14); } catch (ArrayIndexOutOfBoundsException e) { fail("array capacity is passed, capacity was 1, but 2 elements got added"); } }

Target:
public void testMaxSizePassed() throws ArrayIndexOutOfBoundsException { SizeLimitedVector slv = new SizeLimitedVector(1); slv.add(13); slv.add(14); assertEquals(slv.get(0), 14); }
Source:
public SpellResult perform(CastContext context) { Entity target = context.getTargetEntity(); if (target == null) { return SpellResult.NO_TARGET; } MageController controller = context.getController(); Mage mage = controller.getRegisteredMage(target); if (mage == null) { return SpellResult.NO_TARGET; } Player player = mage.getPlayer(); if (player == null) { return SpellResult.PLAYER_REQUIRED; } Wand wand = mage.getActiveWand(); MageClass activeClass = mage.getActiveClass(); CasterProperties caster = (wand != null && wand.getManaMax() > 0) ? wand : activeClass; if (caster == null) { caster = mage.getProperties(); } if (caster.getEffectiveManaMax() <= 0) { return SpellResult.NO_TARGET; } double currentMana = caster.getMana(); if (mana < 0 && currentMana <= 0) { return SpellResult.NO_TARGET; } int manaMax = caster.getEffectiveManaMax(); if (!bypassManaMax) { if (mana > 0 && currentMana >= manaMax) { return SpellResult.NO_TARGET; } } if (fillMana) { currentMana = manaMax; } else { currentMana = Math.min(Math.max(0, currentMana + mana), manaMax); } caster.setMana((float)currentMana); if (bypassManaMax && currentMana > manaMax) { caster.setManaMax((int)currentMana); } mage.updateMana(); return SpellResult.CAST; }

Target:
public SpellResult perform(CastContext context) { Entity target = context.getTargetEntity(); if (target == null) { return SpellResult.NO_TARGET; } MageController controller = context.getController(); Mage mage = controller.getRegisteredMage(target); if (mage == null) { return SpellResult.NO_TARGET; } Player player = mage.getPlayer(); if (player == null) { return SpellResult.PLAYER_REQUIRED; } Wand wand = mage.getActiveWand(); MageClass activeClass = mage.getActiveClass(); CasterProperties caster = (wand != null && wand.getManaMax() > 0) ? wand : activeClass; if (caster == null) { caster = mage.getProperties(); } if (caster.getEffectiveManaMax() <= 0) { return SpellResult.NO_TARGET; } double currentMana = caster.getMana(); if (mana < 0 && currentMana <= 0) { return SpellResult.NO_TARGET; } int manaMax = caster.getEffectiveManaMax(); if (!bypassManaMax && mana > 0 && currentMana >= manaMax) { return SpellResult.NO_TARGET; } if (fillMana) { currentMana = manaMax; } else { currentMana = Math.min(Math.max(0, currentMana + mana), manaMax); } caster.setMana((float)currentMana); if (bypassManaMax && currentMana > manaMax) { caster.setManaMax((int)currentMana); } mage.updateMana(); return SpellResult.CAST; }
Source:
public FieldValueGeneratorRuntime build() { if(field == null) { throw new IllegalArgumentException("field should always be set."); } if(value == null && script == null) { throw new IllegalArgumentException("Either value or script must exist."); } FieldValueGeneratorRuntime fieldValueGeneratorRuntime = new FieldValueGeneratorRuntime(field); if(value != null) { fieldValueGeneratorRuntime.value = value; } else if(script != null) { fieldValueGeneratorRuntime.groovyScript = new GroovyScript<>(script, new GroovyScriptEngine()); } return fieldValueGeneratorRuntime; }

Target:
public FieldValueGeneratorRuntime build() { if(field == null) { throw new IllegalArgumentException("field is required"); } if(value == null && script == null) { throw new IllegalArgumentException("Either value or script must exist."); } FieldValueGeneratorRuntime fieldValueGeneratorRuntime = new FieldValueGeneratorRuntime(field); if(value != null) { fieldValueGeneratorRuntime.value = value; } else if(script != null) { fieldValueGeneratorRuntime.groovyScript = new GroovyScript<>(script, new GroovyScriptEngine()); } return fieldValueGeneratorRuntime; }
Source:
public void concurrentDeleteTestOnSameBlob() throws Exception { MockId idToDelete = null; for (MockId id : liveKeys) { idToDelete = id; break; } assertNotNull(idToDelete); long logEndOffsetBeforeDelete = store.getLogEndOffsetInBytes(); long indexEndOffsetBeforeDelete = store.getSizeInBytes(); int count = 2; ExecutorService executorService = Executors.newFixedThreadPool(count); try { final MockId id = idToDelete; List<Future<Void>> futures = new ArrayList<>(); for (int i = 0; i < count; i++) { futures.add(executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { delete(id); return null; } })); } int failedCount = 0; int succeededCount = 0; for (Future<Void> future : futures) { try { future.get(); succeededCount++; } catch (ExecutionException e) { failedCount++; assertTrue(e.getCause() instanceof StoreException); assertEquals(StoreErrorCodes.ID_Deleted, ((StoreException) e.getCause()).getErrorCode()); } } assertEquals(1, succeededCount); assertEquals(count - succeededCount, failedCount); long logEndOffsetAfterDelete = store.getLogEndOffsetInBytes(); long indexEndOffsetAfterDelete = store.getSizeInBytes(); assertEquals((long) DELETE_RECORD_SIZE, logEndOffsetAfterDelete - logEndOffsetBeforeDelete); assertEquals((long) DELETE_RECORD_SIZE, indexEndOffsetAfterDelete - indexEndOffsetBeforeDelete); } finally { executorService.shutdownNow(); } }

Target:
public void concurrentDeleteTestOnSameBlob() throws Exception { final MockId idToDelete = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotNull(idToDelete); int count = 2; CountDownLatch latch = new CountDownLatch(count); ((MockBlobStore) store).setOperationBeforeSynchronizationFunc(() -> { latch.countDown(); try { latch.await(); } catch (Exception e) { } }); long logEndOffsetBeforeDelete = store.getLogEndOffsetInBytes(); long indexEndOffsetBeforeDelete = store.getSizeInBytes(); ExecutorService executorService = Executors.newFixedThreadPool(count); try { List<Future<Void>> futures = new ArrayList<>(); for (int i = 0; i < count; i++) { futures.add(executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { delete(idToDelete); return null; } })); } int failedCount = 0; int succeededCount = 0; for (Future<Void> future : futures) { try { future.get(); succeededCount++; } catch (ExecutionException e) { failedCount++; assertTrue(e.getCause() instanceof StoreException); assertEquals(StoreErrorCodes.ID_Deleted, ((StoreException) e.getCause()).getErrorCode()); } } assertEquals(1, succeededCount); assertEquals(count - 1, failedCount); long logEndOffsetAfterDelete = store.getLogEndOffsetInBytes(); long indexEndOffsetAfterDelete = store.getSizeInBytes(); assertEquals((long) DELETE_RECORD_SIZE, logEndOffsetAfterDelete - logEndOffsetBeforeDelete); assertEquals((long) DELETE_RECORD_SIZE, indexEndOffsetAfterDelete - indexEndOffsetBeforeDelete); } finally { ((MockBlobStore) store).setOperationBeforeSynchronizationFunc(null); executorService.shutdownNow(); } }
Source:
public Alert(int pluginId, int risk, int confidence, String name) { this(pluginId); setRiskConfidence(risk, confidence); setAlert(name); }

Target:
public Alert(int pluginId, int risk, int confidence, String name) { this(pluginId); setRiskConfidence(risk, confidence); setName(name); }
Source:
public void testRepeatableConstraint() { Validator validator = TestUtil.getValidatorUnderTest(); Set<ConstraintDescriptor<?>> descriptors = validator.getConstraintsForClass( Movie.class ) .getConstraintsForProperty( "title" ) .getConstraintDescriptors(); assertEquals( descriptors.size(), 2, "There should be two constraints on the title property." ); for ( ConstraintDescriptor<?> descriptor : descriptors ) { assertEquals( descriptor.getAnnotation().annotationType().getName(), Size.class.getName(), "Wrong annotation type." ); } Set<ConstraintViolation<Movie>> constraintViolations = validator.validate( new Movie( "A" ) ); assertCorrectNumberOfViolations( constraintViolations, 1 ); constraintViolations = validator.validate( new Movie( "Title" ) ); assertCorrectNumberOfViolations( constraintViolations, 0 ); constraintViolations = validator.validate( new Movie( "A movie title far too long which does not respect the constraint" ) ); assertCorrectNumberOfViolations( constraintViolations, 1 ); }

Target:
public void testRepeatableConstraint() { Validator validator = TestUtil.getValidatorUnderTest(); Set<ConstraintDescriptor<?>> descriptors = validator.getConstraintsForClass( Movie.class ) .getConstraintsForProperty( "title" ) .getConstraintDescriptors(); assertEquals( descriptors.size(), 2, "There should be two constraints on the title property." ); for ( ConstraintDescriptor<?> descriptor : descriptors ) { assertEquals( descriptor.getAnnotation().annotationType().getName(), Size.class.getName(), "Wrong annotation type." ); } Set<ConstraintViolation<Movie>> constraintViolations = validator.validate( new Movie( "Title" ) ); assertCorrectNumberOfViolations( constraintViolations, 0 ); constraintViolations = validator.validate( new Movie( "A" ) ); assertCorrectNumberOfViolations( constraintViolations, 1 ); constraintViolations = validator.validate( new Movie( "A movie title far too long which does not respect the constraint" ) ); assertCorrectNumberOfViolations( constraintViolations, 1 ); }
Source:
public boolean isCustomRole() { return role.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM); }

Target:
public boolean isCustomRole() { return Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM.equals(role); }
Source:
private PluginFQN parsePluginFQN(String plugin) throws InfrastructureException { String registry; String id; URI registryURI = null; Matcher matcher = PLUGIN_PATTERN.matcher(plugin); if (matcher.matches()) { registry = matcher.group("registry"); id = matcher.group("id"); } else { throw new InfrastructureException(format(INCORRECT_PLUGIN_FORMAT_TEMPLATE, plugin)); } if (!isNullOrEmpty(registry)) { try { registryURI = new URI(registry); } catch (URISyntaxException e) { throw new InfrastructureException( format( "Plugin registry URL '%s' is incorrect. Problematic plugin entry: '%s'", registry, plugin)); } } return new PluginFQN(registryURI, id); }

Target:
public ExtendedPluginFQN parsePluginFQN(String plugin) throws InfrastructureException { String registry; String id; String publisher; String name; String version; URI registryURI = null; Matcher matcher = PLUGIN_PATTERN.matcher(plugin); if (matcher.matches()) { registry = matcher.group("registry"); id = matcher.group("id"); publisher = matcher.group("publisher"); name = matcher.group("name"); version = matcher.group("version"); } else { throw new InfrastructureException(format(INCORRECT_PLUGIN_FORMAT_TEMPLATE, plugin)); } if (!isNullOrEmpty(registry)) { try { registryURI = new URI(registry); } catch (URISyntaxException e) { throw new InfrastructureException( format( "Plugin registry URL '%s' is invalid. Problematic plugin entry: '%s'", registry, plugin)); } } return new ExtendedPluginFQN(registryURI, id, publisher, name, version); }
Source:
public Object evaluate(Object feature) { Object arg0 = getExpression(0).evaluate(feature); Object arg1 = getExpression(1).evaluate(feature); if (arg0 == null || arg1 == null) { return null; } Hints hints0 = new Hints(); arg0 = Converters.convert( arg0, Double.class, hints0); arg1 = Converters.convert(arg1, Double.class, hints0); if (arg0 == null) { throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #0 - expected type double"); } if (arg1 == null) { throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #1 - expected type double"); } return (Math.IEEEremainder((Double) arg0, (Double) arg1)); }

Target:
public Object evaluate(Object feature) { Object arg0 = getExpression(0).evaluate(feature); Object arg1 = getExpression(1).evaluate(feature); if (arg0 == null || arg1 == null) { return null; } arg0 = Converters.convert( arg0, Double.class, new Hints()); arg1 = Converters.convert(arg1, Double.class, new Hints()); if (arg0 == null) { throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #0 - expected type double"); } if (arg1 == null) { throw new IllegalArgumentException( "Filter Function problem for function IEEEremainder argument #1 - expected type double"); } return (Math.IEEEremainder((Double) arg0, (Double) arg1)); }
Source:
private void commonAddScesimDataGroup(ScenarioSimulationModel.Type type, int scenarioIndex, String scenarioDescription, String expectedLabel) { ; Scenario scenario = new Scenario(); scenario.setDescription(scenarioDescription); ScenarioWithIndex scenarioWithIndex = new ScenarioWithIndex(scenarioIndex, scenario); Map<String, Integer> resultCounter = new HashMap<>(); coverageScenarioListPresenterSpy.addScesimDataGroup(scenarioWithIndex, resultCounter, type); verify(viewsProviderMock, times(1)).getCoverageScenarioListView(); verify(coverageScenarioListViewMock, times(1)).setPresenter(eq(coverageScenarioListPresenterSpy)); verify(coverageScenarioListViewMock, times(1)).setVisible(eq(false)); verify(coverageScenarioListViewMock, times(1)).getScenarioElement(); verify(coverageScenarioListViewMock, times(1)).setItemLabel(eq(expectedLabel)); verify(scenarioElementMock, times(1)).appendChild(isA(HTMLUListElement.class)); }

Target:
private void commonAddScesimDataGroup(ScenarioSimulationModel.Type type, int scenarioIndex, String scenarioDescription, String expectedLabel) { Scenario scenario = new Scenario(); scenario.setDescription(scenarioDescription); ScenarioWithIndex scenarioWithIndex = new ScenarioWithIndex(scenarioIndex, scenario); Map<String, Integer> resultCounter = new HashMap<>(); coverageScenarioListPresenterSpy.addScesimDataGroup(scenarioWithIndex, resultCounter, type); verify(viewsProviderMock, times(1)).getCoverageScenarioListView(); verify(coverageScenarioListViewMock, times(1)).setPresenter(eq(coverageScenarioListPresenterSpy)); verify(coverageScenarioListViewMock, times(1)).setVisible(eq(false)); verify(coverageScenarioListViewMock, times(1)).getScenarioElement(); verify(coverageScenarioListViewMock, times(1)).setItemLabel(eq(expectedLabel)); verify(scenarioElementMock, times(1)).appendChild(isA(HTMLUListElement.class)); }
Source:
public void testAutocreateFailsOnMultipleMatchingOrigins() throws Exception { File repoRootTemp = tempFolder.newFolder(); GitClient gitClientTemp = Git.with(TaskListener.NULL, new EnvVars()).in(repoRootTemp).using(gitImplName).getClient(); gitClientTemp.init(); gitClientTemp.clone_().url("file://" + repoRootTemp.getPath()).execute(); final URIish remote = new URIish(Constants.DEFAULT_REMOTE_NAME); try ( FileRepository repo = new FileRepository(repoRootTemp)) { StoredConfig config = repo.getConfig(); config.setString("remote", "upstream", "url", "file://" + repoRootTemp.getPath()); config.setString("remote", "upstream", "fetch", "+refs/heads/*:refs/remotes/upstream/*"); config.save(); } List<RefSpec> refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/origin/*")); gitClientTemp.fetch_().from(remote, refspecs).execute(); refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/upstream/*")); gitClientTemp.fetch_().from(remote, refspecs).execute(); try { gitClientTemp.checkout().ref(Constants.MASTER).execute(); fail("GitException expected"); } catch (GitException e) { } }

Target:
public void testAutocreateFailsOnMultipleMatchingOrigins() throws Exception { File repoRootTemp = tempFolder.newFolder(); GitClient gitClientTemp = Git.with(TaskListener.NULL, new EnvVars()).in(repoRootTemp).using(gitImplName).getClient(); gitClientTemp.init(); FilePath gitClientFilePath = gitClientTemp.getWorkTree(); FilePath gitClientTempFile = gitClientFilePath.createTextTempFile("aPre", ".txt", "file contents"); gitClientTemp.add("."); gitClientTemp.commit("Added " + gitClientTempFile.toURI().toString()); gitClient.clone_().url("file://" + repoRootTemp.getPath()).execute(); final URIish remote = new URIish(Constants.DEFAULT_REMOTE_NAME); try ( FileRepository repo = new FileRepository(new File(repoRoot, ".git"))) { StoredConfig config = repo.getConfig(); config.setString("remote", "upstream", "url", "file://" + repoRootTemp.getPath()); config.setString("remote", "upstream", "fetch", "+refs/heads/*:refs/remotes/upstream/*"); config.save(); } List<RefSpec> refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/origin/*")); gitClient.fetch_().from(remote, refspecs).execute(); refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/upstream/*")); gitClient.fetch_().from(remote, refspecs).execute(); try { gitClient.checkout().ref(Constants.MASTER).execute(); } catch (GitException e) { Set<String> refNames = gitClient.getRefNames("refs/heads/"); assertFalse("RefNames will not contain master", refNames.contains("refs/heads/master")); } }
Source:
public static void eventuallyEquals(String message, long expected, LongSupplier supplier) { eventually(() -> message + " expected:<" + expected + ">, got:<" + supplier.getAsLong() + ">", () -> expected == supplier.getAsLong()); }

Target:
protected void eventuallyEquals(String message, long expected, LongSupplier supplier) { eventually(() -> message + " expected:<" + expected + ">, got:<" + supplier.getAsLong() + ">", () -> expected == supplier.getAsLong()); }
Source:
public CompatibilityModeConfiguration(boolean enabled, Marshaller marshaller) { this.enabled = enabled; this.marshaller = marshaller; }

Target:
CompatibilityModeConfiguration(boolean enabled, Marshaller marshaller) { this.enabled = enabled; this.marshaller = marshaller; }
Source:
public org.eclipse.swt.graphics.Rectangle calculateImageRectangle(List editparts) { org.eclipse.swt.graphics.Rectangle sourceRect = super.calculateImageRectangle(editparts); return new org.eclipse.swt.graphics.Rectangle(sourceRect.x, sourceRect.y, scaleAsInt(sourceRect.width), scaleAsInt(sourceRect.height)); }

Target:
public org.eclipse.swt.graphics.Rectangle calculateImageRectangle(List editparts) { org.eclipse.swt.graphics.Rectangle sourceRect = super.calculateImageRectangle(editparts); return new org.eclipse.swt.graphics.Rectangle(scaleAsInt(sourceRect.x), scaleAsInt(sourceRect.y), scaleAsInt(sourceRect.width), scaleAsInt(sourceRect.height)); }
Source:
private static UInt128 getHash(Object resource, UInt128 seed) throws IOException { if (resource == null) { return MurmurHash3_128.hash128(HashSeeds.NULL, seed); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource, seed); } if (resource instanceof List) { return getHashFromList((List<Object>) resource, seed); } if (resource instanceof Boolean) { return (Boolean)resource ? MurmurHash3_128.hash128(HashSeeds.TRUE, seed) : MurmurHash3_128.hash128(HashSeeds.FALSE, seed); } if (resource instanceof Integer) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.INTEGER, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof Long) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.LONG, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof Double) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.DOUBLE, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof String) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.STRING, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof ValueNode) { return getHash(JsonSerializable.getValue((JsonNode) resource)); } if (resource instanceof ArrayNode) { return getHashFromArrayNode((ArrayNode) resource, seed); } if (resource instanceof ObjectNode) { return getHashFromObjectNode((ObjectNode) resource, seed); } throw new IllegalArgumentException(String.format("Unexpected type: %s", resource.getClass().toString())); }

Target:
private static UInt128 getHash(Object resource, UInt128 seed) throws IOException { if (resource == null) { return MurmurHash3_128.hash128(HashSeeds.NULL, seed); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource, seed); } if (resource instanceof List) { return getHashFromIterator(((List) resource).iterator(), seed); } if (resource instanceof Boolean) { return (Boolean)resource ? MurmurHash3_128.hash128(HashSeeds.TRUE, seed) : MurmurHash3_128.hash128(HashSeeds.FALSE, seed); } if (resource instanceof Integer) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.INTEGER, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof Long) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.LONG, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof Double) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.DOUBLE, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof String) { UInt128 hash = MurmurHash3_128.hash128(HashSeeds.STRING, seed); return MurmurHash3_128.hash128(resource, hash); } if (resource instanceof NullNode) { return getHash(null, seed); } if (resource instanceof ValueNode) { return getHash(JsonSerializable.getValue((JsonNode) resource), seed); } if (resource instanceof ArrayNode) { return getHashFromIterator(((ArrayNode) resource).iterator(), seed); } if (resource instanceof ObjectNode) { return getHashFromObjectNode((ObjectNode) resource, seed); } throw new IllegalArgumentException(String.format("Unexpected type: %s", resource.getClass().toString())); }
Source:
private void logError(EndPoint endPoint, Throwable exception) { logger.debug("[{}] Error querying {}", id, endPoint, exception); if (errors == null) { synchronized (RequestHandler.this) { if (errors == null) { errors = new ConcurrentHashMap<EndPoint, Throwable>(); } } } errors.put(endPoint, exception); }

Target:
private void logError(EndPoint endPoint, Throwable exception) { logger.debug("[{}] Error querying : {}", id, endPoint, exception.toString()); if (errors == null) { synchronized (RequestHandler.this) { if (errors == null) { errors = new ConcurrentHashMap<EndPoint, Throwable>(); } } } errors.put(endPoint, exception); }
Source:
private void startScanTask(long pollingInterval) { status = Status.RUNNING; this.pollingInterval = pollingInterval; timer = new Timer(true); timer.schedule(new ScanTask(this), pollingInterval, pollingInterval); }

Target:
private void startScanTask(long pollingInterval) { status = Status.RUNNING; this.pollingInterval = pollingInterval; timer = new Timer(true); timer.schedule(new ScanTask(), pollingInterval, pollingInterval); }
Source:
public void start() throws ReplicationException { if (persistor != null) { this.scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); } }

Target:
public void start() throws ReplicationException { virtualReplicatorCluster.addListener(new VirtualReplicatorClusterListener() { @Override public void onPartitionAdded(PartitionId partitionId) { try { addPartition(partitionId); } catch (ReplicationException e) { vcrMetrics.addPartitionErrorCount.inc(); logger.error("Exception on adding partition {}: ", partitionId, e); } catch (Exception e) { vcrMetrics.addPartitionErrorCount.inc(); logger.error("Unknown Exception on adding partition {}: ", partitionId, e); } } @Override public void onPartitionRemoved(PartitionId partitionId) { try { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.error("PartitionId not exist when remove from {}: ", partitionId, dataNodeId); vcrMetrics.removePartitionErrorCount.inc(); return; } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error("Exception on token write when remove partition {}: ", partitionId, e); vcrMetrics.removePartitionErrorCount.inc(); } } } catch (Exception e) { vcrMetrics.removePartitionErrorCount.inc(); logger.error("Unknown Exception on removing partition {}: ", partitionId, e); } } }); try { virtualReplicatorCluster.participate(InstanceType.PARTICIPANT); } catch (Exception e) { throw new ReplicationException("Cluster participate failed.", e); } scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); }
Source:
protected Object transformFromMessage(Message source, String outputEncoding) throws IOException, JMSException { if (logger.isDebugEnabled()) { logger.debug("Message type received is: " + ClassUtils.getSimpleName(source.getClass())); } String jmsSpec = JmsConstants.JMS_SPECIFICATION_102B; if (endpoint != null) { Connector connector = endpoint.getConnector(); if (connector instanceof JmsConnector) { jmsSpec = ((JmsConnector) connector).getSpecification(); } } return JmsMessageUtils.toObject(source, jmsSpec, outputEncoding); }

Target:
protected Object transformFromMessage(Message source, String outputEncoding) throws IOException, JMSException { if (logger.isDebugEnabled()) { logger.debug("Message type received is: " + getSimpleName(source.getClass())); } String jmsSpec = JmsConstants.JMS_SPECIFICATION_102B; if (endpoint != null) { Connector connector = endpoint.getConnector(); if (connector instanceof JmsConnector) { jmsSpec = ((JmsConnector) connector).getSpecification(); } } return JmsMessageUtils.toObject(source, jmsSpec, outputEncoding); }
Source:
public static boolean isGlobalIndexCheckerEnabled(PhoenixConnection connection, PName index) throws SQLException { TableDescriptor desc = desc = connection.getQueryServices().getTableDescriptor(index.getBytes()); if (desc != null) { if (desc.hasCoprocessor(GlobalIndexChecker.class.getName())) { return true; } } return false; }

Target:
public static boolean isGlobalIndexCheckerEnabled(PhoenixConnection connection, PName index) throws SQLException { String indexName = index.getString(); Boolean entry = indexNameGlobalIndexCheckerEnabledMap.getIfPresent(indexName); if (entry != null){ return entry; } boolean result = false; try { TableDescriptor desc = connection.getQueryServices().getTableDescriptor(index.getBytes()); if (desc != null) { if (desc.hasCoprocessor(GlobalIndexChecker.class.getName())) { result = true; } } indexNameGlobalIndexCheckerEnabledMap.put(indexName, result); } catch (TableNotFoundException ex) { } return result; }
Source:
public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.DEPOSIT); else if (AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.TAXES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.REMOVAL); else throw new IllegalArgumentException(); client.markDirty(); }

Target:
public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.DEPOSIT); else if (AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.TAXES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.REMOVAL); else throw new IllegalArgumentException(); client.markDirty(); }
Source:
public void testToJsonWithLengthLimitSimple() throws JsonLengthLimitExceededException { JsonCodec<ImmutablePerson> jsonCodec = jsonCodec(ImmutablePerson.class); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); try { jsonCodec.toJsonWithLengthLimit(person, 1011); fail("expected IllegalArgumentException"); } catch (JsonLengthLimitExceededException e) jsonCodec.toJsonWithLengthLimit(person, 1036); }

Target:
public void testToJsonWithLengthLimitSimple() { JsonCodec<ImmutablePerson> jsonCodec = jsonCodec(ImmutablePerson.class); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 0).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 1000).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 1035).isPresent()); jsonCodec.toJsonWithLengthLimit(person, 1036); }
Source:
public static LabelVote parse(String text) { checkArgument(!Strings.isNullOrEmpty(text), "Empty label vote"); if (text.charAt(0) == '-') { return new LabelVote(text.substring(1), (short) 0); } short sign = 0; int i; for (i = text.length() - 1; i >= 0; i--) { int c = text.charAt(i); if (c == '-') { sign = (short) -1; break; } else if (c == '+') { sign = (short) 1; break; } else if (!(c >= '0' && c <= '9')) { break; } } if (sign == 0) { return new LabelVote(text, (short) 1); } return new LabelVote(text.substring(0, i), (short)(sign * Short.parseShort(text.substring(i + 1)))); }

Target:
public static LabelVote parse(String text) { checkArgument(!Strings.isNullOrEmpty(text), "Empty label vote"); if (text.charAt(0) == '-') { return new LabelVote(text.substring(1), (short) 0); } short sign = 0; int i; for (i = text.length() - 1; i >= 0; i--) { int c = text.charAt(i); if (c == '-') { sign = (short) -1; break; } else if (c == '+') { sign = (short) 1; break; } else if (!('0' <= c && c <= '9')) { break; } } if (sign == 0) { return new LabelVote(text, (short) 1); } return new LabelVote(text.substring(0, i), (short)(sign * Short.parseShort(text.substring(i + 1)))); }
Source:
public void render(Response response) { CharSequence js = getJavaScript(); if (Strings.isEmpty(js) == false) { JavaScriptUtils.writeJavaScript(response, "var f = function() {" + js + ";};\nif ('loading' !== document.readyState) f(); else document.addEventListener('DOMContentLoaded', f);"); } }

Target:
public void render(Response response) { CharSequence js = getJavaScript(); if (Strings.isEmpty(js) == false) { JavaScriptUtils.writeJavaScript(response, "(function() {var f = function() {" + js + ";};\nif ('loading' !== document.readyState) f(); else document.addEventListener('DOMContentLoaded', f);})();"); } }
Source:
private void loadImage() { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); int size = Math.max(width, height); String mediaUri; if (isVideo()) { mediaUri = mMedia.getThumbnailUrl(); } else { mediaUri = mMedia.getUrl(); } if (TextUtils.isEmpty(mediaUri)) { if (isVideo()) { downloadVideoThumbnail(); } else { ToastUtils.showToast(this, R.string.error_media_load); } return; } showProgress(true); String imageUrl = mediaUri; if (SiteUtils.isPhotonCapable(mSite)) { imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, size, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, imageUrl, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@org.jetbrains.annotations.Nullable Drawable resource) { if (!isFinishing()) { if (resource != null) { showProgress(false); if (isMediaFromEditor()) { showImageDimensions(resource.getIntrinsicWidth(), resource.getIntrinsicHeight()); } } else { AppLog.e(T.MEDIA, "Loading image preview failed - resource is null"); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (!isFinishing()) { AppLog.e(T.MEDIA, e); showProgress(false); delayedFinishWithError(); } } }); }

Target:
private void loadImage() { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); int size = Math.max(width, height); String mediaUri; if (isVideo()) { mediaUri = mMedia.getThumbnailUrl(); } else { mediaUri = mMedia.getUrl(); } if (TextUtils.isEmpty(mediaUri)) { if (isVideo()) { downloadVideoThumbnail(); } else { ToastUtils.showToast(this, R.string.error_media_load); } return; } showProgress(true); String imageUrl = mediaUri; if (SiteUtils.isPhotonCapable(mSite)) { imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, size, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, imageUrl, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@NotNull Drawable resource) { if (!isFinishing()) { showProgress(false); if (isMediaFromEditor()) { showImageDimensions(resource.getIntrinsicWidth(), resource.getIntrinsicHeight()); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (!isFinishing()) { AppLog.e(T.MEDIA, e); showProgress(false); delayedFinishWithError(); } } }); }
Source:
public final void addMessages(SortedSet<LocalizedMessage> messages) { messageCollector.addAll(messages); }

Target:
protected final void addMessages(SortedSet<LocalizedMessage> messages) { messageCollector.addAll(messages); }