auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void startRecording(Description des) { GraphicsConfiguration gc = GraphicsEnvironment .getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); File movieFolder = new File("target"); String mimeType = FormatKeys.MIME_QUICKTIME; String videoFormatName = VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION; String compressorName = VideoFormatKeys.COMPRESSOR_NAME_QUICKTIME_ANIMATION; Dimension outputDimension = gc.getBounds().getSize(); int bitDepth = BIT_DEPTH; float quality = QUALITY_RATIO; int screenRate = FRAME_RATE_PER_SEC; long maxRecordingTime = MAX_RECORDING_TIME_SECS; Format outputFormatForScreenCapture = getOutputFormatForScreenCapture(videoFormatName, compressorName, outputDimension, bitDepth, quality, screenRate); try { this.screenRecorder = new JUnitScreenRecorder (gc, gc.getBounds(), getFileFormat(mimeType), outputFormatForScreenCapture, null, null, movieFolder, des); this.screenRecorder.start(); } catch (IOException e) { <START> throw new IllegalArgumentException("Exception starting test recording.", e); <END> } catch (AWTException e) { throw new IllegalArgumentException("Exception starting test recording.", e); } }</code><technical_language>propagate exception,</technical_language>

Target:
private void startRecording(Description des) { GraphicsConfiguration gc = GraphicsEnvironment .getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); File movieFolder = new File(TARGET); String mimeType = FormatKeys.MIME_QUICKTIME; String videoFormatName = VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION; String compressorName = VideoFormatKeys.COMPRESSOR_NAME_QUICKTIME_ANIMATION; Dimension outputDimension = gc.getBounds().getSize(); int bitDepth = BIT_DEPTH; float quality = QUALITY_RATIO; int screenRate = FRAME_RATE_PER_SEC; long maxRecordingTime = MAX_RECORDING_TIME_SECS; Format outputFormatForScreenCapture = getOutputFormatForScreenCapture(videoFormatName, compressorName, outputDimension, bitDepth, quality, screenRate); try { this.screenRecorder = new JUnitScreenRecorder (gc, gc.getBounds(), getFileFormat(mimeType), outputFormatForScreenCapture, null, null, movieFolder, des); this.screenRecorder.start(); } catch (IOException e) { logger.warn("Exception starting test recording {}", e); } catch (AWTException e) { logger.warn("Exception starting test recording {}", e); } }
Source:
<code>public void run() { <START> shareFileClient.upload(createRandomInputStream(options.getSize()), options.getSize()); <END> }</code><technical_language>Reuse input stream</technical_language>

Target:
public void run() { inputStream.reset(); shareFileClient.upload(inputStream, options.getSize()); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView1 = (TextView)findViewById(R.id.textView1); mLoginProgressDialog = new ProgressDialog(this); mLoginProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mLoginProgressDialog.setMessage("Login in progress..."); try { Utils.setupKeyForSample(); mAuthContext = new AuthenticationContext(MainActivity.this, Constants.AUTHORITY_URL, false); } catch (Exception e) { <START> Toast.makeText(getApplicationContext(), "Encryption is failed", Toast.LENGTH_SHORT) <END> .show(); } Toast.makeText(getApplicationContext(), TAG + "done", Toast.LENGTH_SHORT).show(); }</code><technical_language>"Encryption failed"</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView1 = (TextView) findViewById(R.id.textView1); mLoginProgressDialog = new ProgressDialog(this); mLoginProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mLoginProgressDialog.setMessage("Login in progress..."); try { Utils.setupKeyForSample(); mAuthContext = new AuthenticationContext(MainActivity.this, Constants.AUTHORITY_URL, false); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Encryption failed", Toast.LENGTH_SHORT).show(); } Toast.makeText(getApplicationContext(), TAG + "done", Toast.LENGTH_SHORT).show(); }
Source:
<code>private void createX509KeyManager(Socket socket) { if (!(socket instanceof SSLSocket)) { logAndThrow("Expected a SSLSocket to extract the domain from SNI extension."); } SSLSocket sslSocket = (SSLSocket) socket; String hostname = extractHostname(sslSocket.getHandshakeSession()); if (hostname == null) { <START> logger.info("No domain extracted from SSL/TLS handshake session."); <END> } try { initKeyManagerFactoryWithCertForHostname(keyManagerFactory, hostname, listeningAddress); } catch (InvalidKeyException | UnrecoverableKeyException | NoSuchAlgorithmException | CertificateException | NoSuchProviderException | SignatureException | KeyStoreException | IOException e) { logAndThrow("Failed to generate the certificate for '" + hostname + "' caused by: " + e.getMessage(), e); } x509KeyManager = getX509KeyManager(keyManagerFactory.getKeyManagers()); if (x509KeyManager == null) { logAndThrow("No X509KeyManager found in: " + Arrays.toString(keyManagerFactory.getKeyManagers())); } }</code><technical_language>This debug longer critical (we validate/fail a more relevant message)</technical_language>

Target:
private void createX509KeyManager(Socket socket) { if (!(socket instanceof SSLSocket)) { logAndThrow("Expected a SSLSocket to extract the domain from SNI extension."); } SSLSocket sslSocket = (SSLSocket) socket; String hostname = extractHostname(sslSocket.getHandshakeSession()); if (hostname == null) { logger.debug("No domain extracted from SSL/TLS handshake session."); } try { initKeyManagerFactoryWithCertForHostname(keyManagerFactory, hostname, listeningAddress); } catch (InvalidKeyException | UnrecoverableKeyException | NoSuchAlgorithmException | CertificateException | NoSuchProviderException | SignatureException | KeyStoreException | IOException e) { logAndThrow("Failed to generate the certificate for '" + hostname + "' caused by: " + e.getMessage(), e); } x509KeyManager = getX509KeyManager(keyManagerFactory.getKeyManagers()); if (x509KeyManager == null) { logAndThrow("No X509KeyManager found in: " + Arrays.toString(keyManagerFactory.getKeyManagers())); } }
Source:
<code>public void run(@Nonnull JDefinedClassOrInterface type) throws Exception { if (type instanceof JDefinedClass) { JDefinedClass definedClass = (JDefinedClass) type; if (!DirectlyDerivedClassesMarker.hasDirectlyDerivedClasses(definedClass)) { if (!type.isAbstract()) { EffectivelyFinalMarker.markAsEffectivelyFinal(definedClass); if (!preserveReflections()) { definedClass.setFinal(); <START> tracer.getStatistic(TYPES_FINALIZED).incValue(); <END> } } } } }</code><technical_language>Avoid counting final class in statistic</technical_language>

Target:
public void run(@Nonnull JDefinedClassOrInterface type) throws Exception { if (type instanceof JDefinedClass) { JDefinedClass definedClass = (JDefinedClass) type; if (!DirectlyDerivedClassesMarker.hasDirectlyDerivedClasses(definedClass)) { if (!type.isAbstract() && !type.isFinal()) { EffectivelyFinalClassMarker.markAsEffectivelyFinal(definedClass); if (!preserveReflections()) { definedClass.setFinal(); tracer.getStatistic(TYPES_FINALIZED).incValue(); } } } } }
Source:
<code>public String getBlogUuid() { <START> return super.getUid(); <END> }</code><technical_language>please remove unnecessary super. this. ? Thanks</technical_language>

Target:
public String getBlogUuid() { return getUid(); }
Source:
<code>public Builder expiry(int duration, TimeUnit unit) { <START> int expiry = (int) TimeUnit.SECONDS.convert(duration, unit); <END> validateExpiry(expiry); operations.add(args -> args.expiry = expiry); return this; }</code><technical_language>do return expiry((int) unit.toSeconds(duration));</technical_language>

Target:
public Builder expiry(int duration, TimeUnit unit) { return expiry((int) unit.toSeconds(duration)); }
Source:
<code>public static boolean copy(FileSystem srcFS, FileStatus srcStatus, FileSystem dstFS, Path dst, boolean deleteSource, boolean overwrite, Configuration conf) throws IOException { Path src = srcStatus.getPath(); dst = checkDest(src.getName(), dstFS, dst, overwrite); if (dst != null && src != null && <START> src.toUri().equals(dst.toUri())) { <END> throw new PathOperationException("Source (" + src + ") and destination " + "(" + dst + ") are equal in the copy command."); } if (srcStatus.isDirectory()) { checkDependencies(srcFS, src, dstFS, dst); if (!dstFS.mkdirs(dst)) { return false; } FileStatus contents[] = srcFS.listStatus(src); for (int i = 0; i < contents.length; i++) { copy(srcFS, contents[i], dstFS, new Path(dst, contents[i].getPath().getName()), deleteSource, overwrite, conf); } } else { InputStream in=null; OutputStream out = null; try { in = srcFS.open(src); out = dstFS.create(dst, overwrite); IOUtils.copyBytes(in, out, conf, true); } catch (IOException e) { IOUtils.closeStream(out); IOUtils.closeStream(in); throw e; } } if (deleteSource) { return srcFS.delete(src, true); } else { return true; } }</code><technical_language>srcFS.makeQualified(src).equals(dstFS.makeQualified(dst)) instead of uri comparison, I Jira, this URI comparison working HDFS</technical_language>

Target:
public static boolean copy(FileSystem srcFS, FileStatus srcStatus, FileSystem dstFS, Path dst, boolean deleteSource, boolean overwrite, Configuration conf) throws IOException { Path src = srcStatus.getPath(); dst = checkDest(src.getName(), dstFS, dst, overwrite); if (srcFS.makeQualified(src).equals(dstFS.makeQualified(dst))) { throw new PathOperationException("Source (" + src + ") and destination " + "(" + dst + ") are equal in the copy command."); } if (srcStatus.isDirectory()) { checkDependencies(srcFS, src, dstFS, dst); if (!dstFS.mkdirs(dst)) { return false; } FileStatus contents[] = srcFS.listStatus(src); for (int i = 0; i < contents.length; i++) { copy(srcFS, contents[i], dstFS, new Path(dst, contents[i].getPath().getName()), deleteSource, overwrite, conf); } } else { InputStream in=null; OutputStream out = null; try { in = srcFS.open(src); out = dstFS.create(dst, overwrite); IOUtils.copyBytes(in, out, conf, true); } catch (IOException e) { IOUtils.closeStream(out); IOUtils.closeStream(in); throw e; } } if (deleteSource) { return srcFS.delete(src, true); } else { return true; } }
Source:
<code>private void _cleanUpCloseDNSMulticast(List<Throwable> errors) { if(dnsMultiCast!=null) { <START> LOGGER.log(Level.FINE, "Closing DNS multi-cast service-discovery"); <END> try { dnsMultiCast.close(); } catch (OutOfMemoryError e) { throw e; } catch (LinkageError e) { LOGGER.log(SEVERE, "Failed to close DNS Multicast service", e); } catch (Throwable e) { LOGGER.log(SEVERE, "Failed to close DNS Multicast service", e); errors.add(e); } } }</code><technical_language>ant: multicast is word</technical_language>

Target:
private void _cleanUpCloseDNSMulticast(List<Throwable> errors) { if(dnsMultiCast!=null) { LOGGER.log(Level.FINE, "Closing DNS Multicast service"); try { dnsMultiCast.close(); } catch (OutOfMemoryError e) { throw e; } catch (LinkageError e) { LOGGER.log(SEVERE, "Failed to close DNS Multicast service", e); } catch (Throwable e) { LOGGER.log(SEVERE, "Failed to close DNS Multicast service", e); errors.add(e); } } }
Source:
<code>public void testDnaStringHasInvalidNucleotides() { <START> expectedException.expect(NullPointerException.class); <END> NucleotideCounter nucleotideCounter = new NucleotideCounter("AGXXACT"); Map<Character, Integer> counts = nucleotideCounter.nucleotideCounts(); }</code><technical_language>Instead of leaving program throw a NullPointerException, IllegalArgumentException similar - a custom exception if wanted</technical_language>

Target:
public void testDnaStringHasInvalidNucleotides() { expectedException.expect(IllegalArgumentException.class); NucleotideCounter nucleotideCounter = new NucleotideCounter("AGXXACT"); }
Source:
<code><START> protected void finalize() throws Throwable { <END> try { if (mState != State.CLOSED) { LOG.warn("Finalizing unclosed AsyncHBaseKijiBufferedWriter in state {}.", this, mState); close(); } } catch (Throwable thr) { LOG.warn("Throwable thrown by close() in finalize of AsyncHBaseKijiBufferedWriter: {}\n{}", thr.getMessage(), StringUtils.stringifyException(thr)); } finally { super.finalize(); } }</code><technical_language>guys typically overriding finalizers in AsyncKiji? I Dan is generally this I reasoning sense. I guess this buffered data want flushes if user fails close it</technical_language>

Target:
protected void finalize() throws Throwable { try { if (mState != State.CLOSED) { CLEANUP_LOG.warn( "Finalizing unclosed AsyncHBaseKijiBufferedWriter in state {}.", this, mState); close(); } } catch (Throwable thr) { LOG.warn("Throwable thrown by close() in finalize of AsyncHBaseKijiBufferedWriter: {}\n{}", thr.getMessage(), StringUtils.stringifyException(thr)); } finally { super.finalize(); } }
Source:
<code>public SplunkServiceFactory(List<SplunkServer> splunkServers) { <START> this.splunkServers = splunkServers; <END> }</code><technical_language>Need reinstate list, avoid mutations in case of reference</technical_language>

Target:
public SplunkServiceFactory(List<SplunkServer> splunkServers) { Assert.notEmpty(splunkServers); this.splunkServers = new ArrayList<SplunkServer>(splunkServers); }
Source:
<code>public URI getAnonymousExecutionURI() { for (Link l : this.links) { if (l.getRelation() == Relation.UNRECOGNIZED) { return l.getHref(); } } <START> return null; <END> }</code><technical_language>try avoid returning null express absence. this method refactored return Optional<URI></technical_language>

Target:
public Optional<URI> getAnonymousExecutionURI() { for (Link l : this.links) { if (l.getRelation() == Relation.UNRECOGNIZED) { return Optional.of(l.getHref()); } } return Optional.absent(); }
Source:
<code>private void setCowVirtualSizeAndQcowCompat(DiskImage diskImage, Image glanceImage) { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(glanceImage.getId()).execute(); try (InputStream inputStream = downloadImage.getInputStream()) { int bytesRead = inputStream.read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to read image header: " + bytesRead); } } catch (IOException e) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to download image"); } ByteBuffer b = ByteBuffer.wrap(imgContent); int qcow2Signature = b.getInt(); int qcow2Version = b.getInt(); if (qcow2Signature == QCOW2_SIGNATURE && <START> QCOW2_VERSIONS.contains(qcow2Version)) { <END> b.position(QCOW2_SIZE_OFFSET); diskImage.setSize(b.getLong()); diskImage.setQcowCompat(QcowCompat.forQcowHeaderVersion(qcow2Version)); } else { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNRECOGNIZED_IMAGE_FORMAT, "Unable to recognize QCOW2 format"); } }</code><technical_language>Instead of this duplicated logic, call QcowCompat.forQcowHeaderVersion(qcow2Version) check null Undefined. - need check QCow version matches DC version</technical_language>

Target:
private void setCowVirtualSizeAndQcowCompat(DiskImage diskImage, Image glanceImage) { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(glanceImage.getId()).execute(); try (InputStream inputStream = downloadImage.getInputStream()) { int bytesRead = inputStream.read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to read image header: " + bytesRead); } } catch (IOException e) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to download image"); } ByteBuffer b = ByteBuffer.wrap(imgContent); int qcow2Signature = b.getInt(); int qcow2Version = b.getInt(); QcowCompat qcowCompat = QcowCompat.forQcowHeaderVersion(qcow2Version); if (qcow2Signature == QCOW2_SIGNATURE && (qcowCompat != null || qcowCompat != QcowCompat.Undefined)) { b.position(QCOW2_SIZE_OFFSET); diskImage.setSize(b.getLong()); diskImage.setQcowCompat(qcowCompat); } else { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNRECOGNIZED_IMAGE_FORMAT, "Unable to recognize QCOW2 format"); } }
Source:
<code>public void setup() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); addInlinedPropertiesToEnvironment( context, AAD_PROPERTY_PREFIX + "user-group.allowed-groups = group1", AAD_PROPERTY_PREFIX + "tenant-id = fake-tenant-id", AAD_PROPERTY_PREFIX + "client-id = fake-client-id", AAD_PROPERTY_PREFIX + "client-secret = fake-client-secret", <START> AAD_PROPERTY_PREFIX + "webApiClients.fake-graph.scopes = <LINK_0>" <END> ); context.register(AADResourceServerOboConfiguration.class); context.refresh(); clientRegistrationsRepo = context.getBean(AADOboClientRegistrationRepository.class); }</code><technical_language>This is correct</technical_language>

Target:
public void setup() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); addInlinedPropertiesToEnvironment( context, AAD_PROPERTY_PREFIX + "tenant-id = fake-tenant-id", AAD_PROPERTY_PREFIX + "client-id = fake-client-id", AAD_PROPERTY_PREFIX + "client-secret = fake-client-secret", AAD_PROPERTY_PREFIX + "authorization.fake-graph.scopes = <LINK_0>" ); context.register(AADResourceServerOboConfiguration.class); context.refresh(); clientRegistrationsRepo = context.getBean(InMemoryClientRegistrationRepository.class); }
Source:
<code><START> private LineString interpolateToLineString(Coordinate[] arcCoordinates, Coordinate center, <END> double radius) { List<Coordinate> generatedCoordinates = new ArrayList<Coordinate>(); generatedCoordinates.add(pointToGrid(arcCoordinates[0])); double angle = getAngleBetweenTwoPoints(arcCoordinates[0], arcCoordinates[1], radius); generatedCoordinates.addAll(generateLineStringCoordinates(arcCoordinates[0], arcCoordinates[1], center, radius, angle, NEXT_COORDINATE_DISTANCE)); generatedCoordinates.add(pointToGrid(arcCoordinates[1])); angle = getAngleBetweenTwoPoints(arcCoordinates[1], arcCoordinates[2], radius); generatedCoordinates.addAll(generateLineStringCoordinates(arcCoordinates[1], arcCoordinates[2], center, radius, angle, NEXT_COORDINATE_DISTANCE)); generatedCoordinates.add(pointToGrid(arcCoordinates[2])); LineString lineString = null; try { lineString = new GeometryFactory() .createLineString(generatedCoordinates.toArray(new Coordinate[0])); } catch (Exception ex) { log.error("Error in interpolation of arc", ex); } return lineString; }</code><technical_language>this work ArcByCenterPoint representation? sense expose method a similar method easier support kind of representation. I this method relies points, work points (or a point calculated)</technical_language>

Target:
private LineString interpolateToLineString(Coordinate[] arcCoordinates, Coordinate center, double radius) { List<Coordinate> generatedCoordinates = new ArrayList<Coordinate>(); generatedCoordinates.add(pointToGrid(arcCoordinates[0])); double angle = getAngleBetweenTwoPoints(arcCoordinates[0], arcCoordinates[1], radius); generatedCoordinates.addAll(generateLineStringCoordinates(arcCoordinates[0], arcCoordinates[1], center, radius, angle, NEXT_COORDINATE_DISTANCE)); if (!isSameAsLastGridCoordinate(arcCoordinates[1])) generatedCoordinates.add(lastGridCoordinateOfArc); angle = getAngleBetweenTwoPoints(arcCoordinates[1], arcCoordinates[2], radius); generatedCoordinates.addAll(generateLineStringCoordinates(arcCoordinates[1], arcCoordinates[2], center, radius, angle, NEXT_COORDINATE_DISTANCE)); if (!isSameAsLastGridCoordinate(arcCoordinates[2])) generatedCoordinates.add(lastGridCoordinateOfArc); LineString lineString = null; try { lineString = new GeometryFactory() .createLineString(generatedCoordinates.toArray(new Coordinate[0])); } catch (Exception ex) { log.error("Error in interpolation of arc", ex); } return lineString; }
Source:
<code>public Response activate(Action action) { <START> VdsActionParameters params = new VdsActionParameters(guid); int timeout = Config.<Integer> getValue(ConfigValues.SetupNetworksWaitTimeoutSeconds); params.setLockProperties(LockProperties.create(Execution).withWaitTimeout(SECONDS.toMillis(timeout))); <END> return doAction(ActionType.ActivateVds, params, action); }</code><technical_language>I accessing configuration API layer avoided possible. In this case, Engine check of SetupNetworksWaitTimeoutSeconds; need receive API. option this logic in ActivateVdsCommand, I understand wrote require complicated regression analysis. I suggest adding 'withWaitTimeout' a boolean parameter host.activate() in ovirt-engine-api-model. This boolean set 'true' in BackendHostResource.activate() provided VdsActionParmameters. withWaitTimeout=true in VdsActionParmameters ActivateVdsCommand get configuration item database it</technical_language>

Target:
public Response activate(Action action) { return doAction(ActionType.ActivateVds, new VdsTimedWaitActionParameters(guid), action); }
Source:
<code>protected TupleBatch fetchNextReady() throws DbException { while (!getChild().eos()) { TupleBatch tb = getChild().nextReady(); if (tb == null) { if (getChild().eos()) { <START> break; <END> } return null; } extractWorkerInfo(tb); } if (isPercentageSample) { sampleSize = Math.round(totalTupleCount * (samplePercentage / 100)); } Preconditions.checkState(sampleSize >= 0 && sampleSize <= totalTupleCount, "Cannot extract %s samples from a population of size %s", sampleSize, totalTupleCount); if (sampleType == SamplingType.WithReplacement) { withReplacementDistribution(workerInfo, totalTupleCount, sampleSize); } else if (sampleType == SamplingType.WithoutReplacement) { withoutReplacementDistribution(workerInfo, totalTupleCount, sampleSize); } else { throw new DbException("Invalid sampleType: " + sampleType); } IntColumnBuilder wIDs = new IntColumnBuilder(); IntColumnBuilder actualSizes = new IntColumnBuilder(); IntColumnBuilder sampSizes = new IntColumnBuilder(); StringColumnBuilder sampTypes = new StringColumnBuilder(); for (Map.Entry<Integer, WorkerInfo> iWorker : workerInfo.entrySet()) { wIDs.appendInt(iWorker.getKey()); actualSizes.appendInt(iWorker.getValue().actualTupleCount); sampSizes.appendInt(iWorker.getValue().sampleSize); sampTypes.appendString(sampleType.name()); } ImmutableList.Builder<Column<?>> columns = ImmutableList.builder(); columns.add(wIDs.build(), actualSizes.build(), sampSizes.build(), sampTypes.build()); setEOS(); return new TupleBatch(SCHEMA, columns.build()); }</code><technical_language>eagerly close child here</technical_language>

Target:
protected TupleBatch fetchNextReady() throws DbException { while (!getChild().eos()) { TupleBatch tb = getChild().nextReady(); if (tb == null) { if (getChild().eos()) { break; } return null; } extractWorkerInfo(tb); } getChild().close(); if (isPercentageSample) { sampleSize = Math.round(totalTupleCount * (samplePercentage / 100)); } Preconditions.checkState(sampleSize >= 0 && sampleSize <= totalTupleCount, "Cannot extract %s samples from a population of size %s", sampleSize, totalTupleCount); if (sampleType == SamplingType.WithReplacement) { withReplacementDistribution(workerInfo, totalTupleCount, sampleSize); } else if (sampleType == SamplingType.WithoutReplacement) { withoutReplacementDistribution(workerInfo, totalTupleCount, sampleSize); } else { throw new DbException("Invalid sampleType: " + sampleType); } List<ColumnBuilder<?>> colBuilders = ColumnFactory.allocateColumns(SCHEMA); for (Map.Entry<Integer, WorkerInfo> iWorker : workerInfo.entrySet()) { colBuilders.get(0).appendInt(iWorker.getKey()); colBuilders.get(1).appendInt(iWorker.getValue().actualTupleCount); colBuilders.get(2).appendInt(iWorker.getValue().sampleSize); colBuilders.get(3).appendString(sampleType.name()); } ImmutableList.Builder<Column<?>> columns = ImmutableList.builder(); for (ColumnBuilder<?> cb : colBuilders) { columns.add(cb.build()); } setEOS(); return new TupleBatch(SCHEMA, columns.build()); }
Source:
<code>public Object eval(String expression, Entity entity) { Stopwatch stopwatch = null; if (LOG.isTraceEnabled()) { stopwatch = Stopwatch.createStarted(); } <START> Object scriptEngineValueMap = toScriptEngineValueMap(entity, 3); <END> Object value; try { value = jsScriptEngine.invokeFunction("evalScript", expression, scriptEngineValueMap); } catch (Throwable t) { return new ScriptException(t); } if (stopwatch != null) { stopwatch.stop(); LOG.trace("Script evaluation took µs", stopwatch.elapsed(MICROSECONDS)); } return value; }</code><technical_language>magic number ?</technical_language>

Target:
public Object eval(String expression, Entity entity) { Stopwatch stopwatch = null; if (LOG.isTraceEnabled()) { stopwatch = Stopwatch.createStarted(); } Object scriptEngineValueMap = toScriptEngineValueMap(entity, ENTITY_REFERENCE_FETCHING_DEPTH); Object value; try { value = jsScriptEngine.invokeFunction("evalScript", expression, scriptEngineValueMap); } catch (Throwable t) { return new ScriptException(t); } if (stopwatch != null) { stopwatch.stop(); LOG.trace("Script evaluation took µs", stopwatch.elapsed(MICROSECONDS)); } return value; }
Source:
<code>public RegisteredObservers load(CuratorFramework curator) throws Exception { ImmutableMap<Column, ObserverSpecification> observers; ImmutableMap<Column, ObserverSpecification> weakObservers; ByteArrayInputStream bais; try { bais = new ByteArrayInputStream(curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_OBSERVERS1)); } catch (NoNodeException nne) { return null; } DataInputStream dis = new DataInputStream(bais); observers = readObservers(dis); weakObservers = readObservers(dis); return new RegisteredObservers() { @Override public Observers getObservers(Environment env) { return new ObserversV1(env, observers, weakObservers); } @Override <START> public ImmutableSet<Column> getObservedColumns(NotificationType nt) { <END> switch (nt) { case STRONG: return observers.keySet(); case WEAK: return weakObservers.keySet(); default: throw new IllegalArgumentException("Unknown notification type " + nt); } } }; }</code><technical_language>Personally I leave this type Set ImmutableSet internally implementation. I useful advertise immutable</technical_language>

Target:
public RegisteredObservers load(CuratorFramework curator) throws Exception { Map<Column, ObserverSpecification> observers; Map<Column, ObserverSpecification> weakObservers; ByteArrayInputStream bais; try { bais = new ByteArrayInputStream(curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_OBSERVERS1)); } catch (NoNodeException nne) { return null; } DataInputStream dis = new DataInputStream(bais); observers = readObservers(dis); weakObservers = readObservers(dis); return new RegisteredObservers() { @Override public Observers getObservers(Environment env) { return new ObserversV1(env, observers, weakObservers); } @Override public Set<Column> getObservedColumns(NotificationType nt) { switch (nt) { case STRONG: return observers.keySet(); case WEAK: return weakObservers.keySet(); default: throw new IllegalArgumentException("Unknown notification type " + nt); } } }; }
Source:
<code>public static List<Object> mapDataRow(Entity entity) { List<Object> dataRow = newArrayList(); for (Attribute attribute : entity.getEntityType().getAttributes()) { if (attribute.getDataType() != AttributeType.COMPOUND) { if (isSingleReferenceType(attribute)) { Entity value = entity.getEntity(attribute.getName()); dataRow.add(value != null ? value.getIdValue() : null); } else if (isMultipleReferenceType(attribute)) { Iterable<Entity> values = entity.getEntities(attribute.getName()); List<Object> ids = <START> StreamSupport.stream(values.spliterator(), false) <END> .map(Entity::getIdValue) .collect(Collectors.toList()); dataRow.add(org.apache.logging.log4j.util.Strings.join(ids, ',')); } else { Object value = entity.get(attribute.getName()); dataRow.add(value); } } } return dataRow; }</code><technical_language>Guava Streams.stream(myStream) instead of StreamSupport.stream(myStream.spliterator(), false)</technical_language>

Target:
public static List<Object> mapDataRow(Entity entity) { List<Object> dataRow = new ArrayList<>(); for (Attribute attribute : entity.getEntityType().getAttributes()) { if (attribute.getDataType() != AttributeType.COMPOUND) { if (isSingleReferenceType(attribute)) { Entity value = entity.getEntity(attribute.getName()); dataRow.add(value != null ? value.getIdValue() : null); } else if (isMultipleReferenceType(attribute)) { Iterable<Entity> values = entity.getEntities(attribute.getName()); String ids = Streams.stream(values) .map(Entity::getIdValue) .map(Object::toString) .collect(joining(",")); dataRow.add(ids); } else { Object value = entity.get(attribute.getName()); dataRow.add(value); } } } return dataRow; }
Source:
<code>private void decodePosition(JsonObject object, Position position) { position.setProtocol(protocolName); position.setTime(new Date((long) object.getJsonNumber("timestamp").doubleValue() * 1000)); JsonNumber lat = object.getJsonNumber("position.latitude"); JsonNumber lon = object.getJsonNumber("position.longitude"); position.setLatitude(lat != null ? lat.doubleValue() : 0); position.setLongitude(lon != null ? lon.doubleValue() : 0); JsonNumber speed = object.getJsonNumber("position.speed"); position.setSpeed(speed != null ? speed.doubleValue() : 0); JsonNumber course = object.getJsonNumber("position.direction"); position.setCourse(course != null ? course.doubleValue() : 0); JsonNumber altitude = object.getJsonNumber("position.altitude"); position.setAltitude(altitude != null ? altitude.doubleValue() : 0); <START> int satellites = object.getInt("position.satellites", 0); <END> position.setValid(object.getBoolean("position.valid", true)); position.set(Position.KEY_SATELLITES, satellites); if (object.getBoolean("alarm.event.trigger", false)) { position.set(Position.KEY_ALARM, Position.ALARM_GENERAL); } }</code><technical_language>do need a separate variable here</technical_language>

Target:
private void decodePosition(JsonObject object, Position position) { position.setProtocol(getProtocolName()); Date deviceTime = new Date((long) object.getJsonNumber("timestamp").doubleValue() * 1000); position.setTime(deviceTime); JsonNumber lat = object.getJsonNumber("position.latitude"); JsonNumber lon = object.getJsonNumber("position.longitude"); if (lat != null && lon != null) { position.setLatitude(lat.doubleValue()); position.setLongitude(lon.doubleValue()); } else { getLastLocation(position, deviceTime); } JsonNumber speed = object.getJsonNumber("position.speed"); if (speed != null) { position.setSpeed(speed.doubleValue()); } JsonNumber course = object.getJsonNumber("position.direction"); if (course != null) { position.setCourse(course.doubleValue()); } JsonNumber altitude = object.getJsonNumber("position.altitude"); if (altitude != null) { position.setAltitude(altitude.doubleValue()); } position.setValid(object.getBoolean("position.valid", true)); position.set(Position.KEY_SATELLITES, object.getInt("position.satellites", 0)); if (object.getBoolean("alarm.event.trigger", false)) { position.set(Position.KEY_ALARM, Position.ALARM_GENERAL); } }
Source:
<code>private List<String> getUnixGroups(String user) throws IOException { ShellCommandExecutor executor = createGroupExecutor(user); List<String> groups; try { executor.execute(); groups = resolveFullGroupNames(executor.getOutput()); } catch (ExitCodeException e) { try { groups = resolvePartialGroupNames(user, e.getMessage(), executor.getOutput()); } catch (PartialGroupNameException pge) { LOG.warn("unable to return groups for user {}", user, pge); <START> return new LinkedList<>(); <END> } } catch (IOException ioe) { if (executor.isTimedOut()) { LOG.warn( "Unable to return groups for user '{}' as shell group lookup " + "command '{}' ran longer than the configured timeout limit of " + "{} seconds.", user, Arrays.asList(executor.getExecString()), timeout ); return new LinkedList<>(); } else { throw ioe; } } if (!Shell.WINDOWS) { for (int i = 1; i < groups.size(); i++) { if (groups.get(i).equals(groups.get(0))) { groups.remove(i); break; } } } return groups; }</code><technical_language>flyweight pattern minimize memory usage for empty LinkList</technical_language>

Target:
private List<String> getUnixGroups(String user) throws IOException { ShellCommandExecutor executor = createGroupExecutor(user); List<String> groups; try { executor.execute(); groups = resolveFullGroupNames(executor.getOutput()); } catch (ExitCodeException e) { try { groups = resolvePartialGroupNames(user, e.getMessage(), executor.getOutput()); } catch (PartialGroupNameException pge) { LOG.warn("unable to return groups for user {}", user, pge); return EMPTY_GROUPS; } } catch (IOException ioe) { if (executor.isTimedOut()) { LOG.warn( "Unable to return groups for user '{}' as shell group lookup " + "command '{}' ran longer than the configured timeout limit of " + "{} seconds.", user, Joiner.on(' ').join(executor.getExecString()), timeout ); return EMPTY_GROUPS; } else { throw ioe; } } if (!Shell.WINDOWS) { for (int i = 1; i < groups.size(); i++) { if (groups.get(i).equals(groups.get(0))) { groups.remove(i); break; } } } return groups; }
Source:
<code>public void onGitStatusChanged(String endpointId, StatusChangedEventDto statusChangedEventDto) { Status status = statusChangedEventDto.getStatus(); editorAgentProvider .get() .getOpenedEditors() .stream() .filter( editor -> editor instanceof HasVcsChangeMarkerRender && statusChangedEventDto .getProjectName() <START> .equals(editor.getEditorInput().getFile().getLocation().segment(0))) <END> .forEach( editor -> { EditorTab tab = multiPartStackProvider.get().getTabByPart(editor); String nodeLocation = tab.getFile().getLocation().removeFirstSegments(1).toString(); if (status.getUntracked().contains(nodeLocation)) { tab.setTitleColor(UNTRACKED.getColor()); } else if (status.getModified().contains(nodeLocation) || status.getChanged().contains(nodeLocation)) { tab.setTitleColor(MODIFIED.getColor()); } else if (status.getAdded().contains(nodeLocation)) { tab.setTitleColor(ADDED.getColor()); } else { tab.setTitleColor(NOT_MODIFIED.getColor()); } }); }</code><technical_language>treat segment a project name. is error prone</technical_language>

Target:
public void onGitStatusChanged(String endpointId, StatusChangedEventDto statusChangedEventDto) { Status status = statusChangedEventDto.getStatus(); editorAgentProvider .get() .getOpenedEditors() .stream() .filter( editor -> editor instanceof HasVcsChangeMarkerRender && statusChangedEventDto .getProjectName() .equals(getRootPath(editor.getEditorInput().getFile().getLocation()))) .forEach( editor -> { EditorTab tab = multiPartStackProvider.get().getTabByPart(editor); String nodeLocation = tab.getFile().getLocation().removeFirstSegments(1).toString(); if (status.getUntracked().contains(nodeLocation)) { tab.setTitleColor(UNTRACKED.getColor()); } else if (status.getModified().contains(nodeLocation) || status.getChanged().contains(nodeLocation)) { tab.setTitleColor(MODIFIED.getColor()); } else if (status.getAdded().contains(nodeLocation)) { tab.setTitleColor(ADDED.getColor()); } else { tab.setTitleColor(NOT_MODIFIED.getColor()); } }); }
Source:
<code>public boolean isServiceDetected(InetAddress address, URI agentConfig) { LOG.debug("isServiceDetected(address=[{}], agentConfig=[{}])", address, agentConfig); try { m_connectionFactory.setBrokerURL(agentConfig.toString()); connection = m_connectionFactory.createConnection(m_user, m_password); LOG.info("connection created"); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); LOG.info("session created"); connection.start(); LOG.info("connection started"); <START> session.close(); <END> connection.close(); return true; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } }</code><technical_language>closed properly</technical_language>

Target:
public boolean isServiceDetected(InetAddress address, URI agentConfig) { LOG.debug("isServiceDetected(address=[{}], agentConfig=[{}])", address, agentConfig); try { m_connectionFactory.setBrokerURL(agentConfig.toString()); m_connection = m_connectionFactory.createConnection(m_user, m_password); LOG.info("connection created"); m_session = m_connection.createSession(false, Session.AUTO_ACKNOWLEDGE); LOG.info("session created"); m_connection.start(); LOG.info("connection started"); return true; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } }
Source:
<code>public ItemIngot() { <START> super(Form.INGOT, true, true, CollectionTools.createIndexedLookupTable(STEEL, COPPER, TIN, BRONZE, LEAD, SILVER)); <END> setSmeltingExperience(1); }</code><technical_language>Add bronze end instead of in middle</technical_language>

Target:
public ItemIngot() { super(Form.INGOT, true, true, CollectionTools.createIndexedLookupTable(STEEL, COPPER, TIN, LEAD, SILVER, BRONZE)); setSmeltingExperience(1); }
Source:
<code>public String getServerAuthenticationToken() { if (serverAuthenticationToken != null) { <START> return serverAuthenticationToken.trim(); <END> } return serverAuthenticationToken; }</code><technical_language>Please simplify this method return StringUtils.trimToNull(serverAuthenticationToken);</technical_language>

Target:
public String getServerAuthenticationToken() { return StringUtils.trimToNull(serverAuthenticationToken); }
Source:
<code>public final void testGetLogicalProcessorInformation() { WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION informationArray = Kernel32Util.getLogicalProcessorInformation(); <START> assertTrue(informationArray >= 1); END> for (WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION information : informationArray) { } }</code><technical_language>this compile? I expecting informationArray.length >= 1</technical_language>

Target:
public final void testGetLogicalProcessorInformation() { WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION[] informationArray = Kernel32Util.getLogicalProcessorInformation(); assertTrue(informationArray.length >= 1); for (WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION information : informationArray) { } }
Source:
<code>public Map<String, Region> getAllSecondLevelCacheRegions() { final Map<String, Region> allCacheRegions = new HashMap<String, Region>(); if ( settings.isQueryCacheEnabled() ) { allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() ); allCacheRegions.put( queryCache.getRegion().getName(), queryCache.getRegion() ); } if ( settings.isQueryCacheEnabled() ) { for ( QueryCache queryCacheValue : queryCaches.values() ) { allCacheRegions.put( queryCacheValue.getRegion().getName(), queryCacheValue.getRegion() ); } <START> } <END> allCacheRegions.putAll( otherRegionMap ); allCacheRegions.putAll( naturalIdRegionMap ); allCacheRegions.putAll( collectionRegionMap ); allCacheRegions.putAll( entityRegionMap ); return allCacheRegions; }</code><technical_language>2 if ( settings.isQueryCacheEnabled() ) { statements combined</technical_language>

Target:
public Map<String, Region> getAllSecondLevelCacheRegions() { final Map<String, Region> allCacheRegions = new HashMap<String, Region>(); if ( settings.isQueryCacheEnabled() ) { allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() ); allCacheRegions.put( queryCache.getRegion().getName(), queryCache.getRegion() ); for ( QueryCache queryCacheValue : queryCaches.values() ) { allCacheRegions.put( queryCacheValue.getRegion().getName(), queryCacheValue.getRegion() ); } } allCacheRegions.putAll( otherRegionMap ); allCacheRegions.putAll( naturalIdRegionMap ); allCacheRegions.putAll( collectionRegionMap ); allCacheRegions.putAll( entityRegionMap ); return allCacheRegions; }
Source:
<code>private Revision getRevision(RevCommit commit, String filePath) throws GitAPIException, IOException { List<String> commitParentsList = Stream.of(commit.getParents()) .map(RevCommit::getName) .collect(Collectors.toList()); List<Branch> commitBranchesList = getBranchesOfCommit(commit, ListMode.ALL); List<DiffCommitFile> diffCommitFilesList = getCommitDiffFiles(commit, filePath); GitUser author = getCommitAuthor(commit); GitUser committer = getCommitCommitter(commit); return newDto(Revision.class).withId(commit.getId() .getName()) .withMessage(commit.getFullMessage()) .withCommitTime((long) commit.getCommitTime() * 1000) .withCommitter(committer) .withAuthor(author) .withBranches(commitBranchesList) .withCommitParent(commitParentsList) <START> .withDiffCommitFile(diffCommitFilesList); <END> }</code><technical_language>formatting (<LINK_0></technical_language>

Target:
private Revision getRevision(RevCommit commit, String filePath) throws GitAPIException, IOException { List<String> commitParentsList = Stream.of(commit.getParents()) .map(RevCommit::getName) .collect(Collectors.toList()); return newDto(Revision.class).withId(commit.getId().getName()) .withMessage(commit.getFullMessage()) .withCommitTime((long) commit.getCommitTime() * 1000) .withCommitter(getCommitCommitter(commit)) .withAuthor(getCommitAuthor(commit)) .withBranches(getBranchesOfCommit(commit, ListMode.ALL)) .withCommitParent(commitParentsList) .withDiffCommitFile(getCommitDiffFiles(commit, filePath)); }
Source:
<code>public void init() { OreDictionary.registerOre("materialRope", rope.getItem()); OreDictionary.registerOre("materialSalt", salt.getItem()); OreDictionary.registerOre("foodSalt", salt.getItem()); OreDictionary.registerOre("dustSalt", salt.getItem()); <START> OreDictionary.registerOre("powderSalt", salt.getItem()); <END> OreDictionary.registerOre("lumpSalt", salt.getItem()); OreDictionary.registerOre("bottleSalt", saltBottle.getItem()); OreDictionary.registerOre("bucketSalt", saltBucket.getItem()); }</code><technical_language>in right mind..</technical_language>

Target:
public void init() { OreDictionary.registerOre("materialRope", rope.getItem()); OreDictionary.registerOre("materialSalt", salt.getItem()); OreDictionary.registerOre("foodSalt", salt.getItem()); OreDictionary.registerOre("dustSalt", salt.getItem()); OreDictionary.registerOre("lumpSalt", salt.getItem()); OreDictionary.registerOre("bottleSalt", saltBottle.getItem()); OreDictionary.registerOre("bucketSalt", saltBucket.getItem()); }
Source:
<code>public static void onPostUploadedSnackbarHandler(final Activity activity, View snackbarAttachView, PostStore.OnPostUploaded event, final SiteModel site, final Dispatcher dispatcher) { final PostModel post = event.post; if (event.isError()) { UploadUtils.showSnackbar(snackbarAttachView, R.string.editor_draft_saved_locally); } else { boolean isDraft = PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { UploadUtils.publishPost(activity, post, site, dispatcher); } }; UploadUtils.showSnackbarSuccessAction(snackbarAttachView, R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } else { int messageRes = post.isPage() ? R.string.page_published : R.string.post_published; UploadUtils.showSnackbar(snackbarAttachView, messageRes); UploadUtils.showSnackbarSuccessAction(snackbarAttachView, messageRes, R.string.button_view, new View.OnClickListener() { @Override public void onClick(View view) { <START> ActivityLauncher.viewPostPreviewForResult(activity, site, post); <END> } }); } } }</code><technical_language>This is inconsistent view button in post list, ActivityLauncher.browsePostOrPage() show page in a WebView</technical_language>

Target:
public static void onPostUploadedSnackbarHandler(final Activity activity, View snackbarAttachView, PostStore.OnPostUploaded event, final SiteModel site, final Dispatcher dispatcher) { final PostModel post = event.post; if (event.isError()) { UploadUtils.showSnackbar(snackbarAttachView, R.string.editor_draft_saved_locally); } else { boolean isDraft = PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { UploadUtils.publishPost(activity, post, site, dispatcher); } }; UploadUtils.showSnackbarSuccessAction(snackbarAttachView, R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } else { int messageRes = post.isPage() ? R.string.page_published : R.string.post_published; UploadUtils.showSnackbar(snackbarAttachView, messageRes); UploadUtils.showSnackbarSuccessAction(snackbarAttachView, messageRes, R.string.button_view, new View.OnClickListener() { @Override public void onClick(View view) { ActivityLauncher.browsePostOrPage(activity, site, post); } }); } } }
Source:
<code>public void shouldNotBeAllowedToAttachTwoRules() { RetentionRule rr = createManualImmediateRuleMillis(100L); file = service.attachRule(file, rr, session); try { service.attachRule(file, rr, session); <START> fail("Sould not be abe to attach rule twice"); <END> } catch (NuxeoException e) { } }</code><technical_language>small typos: able</technical_language>

Target:
public void shouldNotBeAllowedToAttachTwoRules() { RetentionRule rr = createManualImmediateRuleMillis(100L); file = service.attachRule(file, rr, session); try { service.attachRule(file, rr, session); fail("Should not be abe to attach rule twice"); } catch (NuxeoException e) { } }
Source:
<code>public void run() { aclService.assertHasAccess("Insufficient privileges to restore object " + pid.getUUID(), pid, agent.getGroups(), markForDeletion); RepositoryObject repoObj = repositoryObjectLoader.getRepositoryObject(pid); if (repoObj instanceof AdminUnit) { <START> aclService.assertHasAccess("Insufficient privileges to delete/restore admin unit " + pid.getUUID(), <END> pid, agent.getPrincipals(), markForDeletionUnit); } if (!(repoObj instanceof ContentObject)) { throw new InvalidOperationForObjectType("Cannot perform restore on object " + pid.getUUID() + ", objects of type " + repoObj.getClass().getName() + " are not eligible."); } String updateString = createSparqlDelete(pid.getRepositoryPath(), markedForDeletion, null); sparqlUpdateService.executeUpdate(repoObj.getMetadataUri().toString(), updateString); repoObj.getPremisLog().buildEvent(Premis.Deletion) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Item restored from deletion") .write(); }</code><technical_language>This "restore"</technical_language>

Target:
public void run() { aclService.assertHasAccess("Insufficient privileges to restore object " + pid.getUUID(), pid, agent.getGroups(), markForDeletion); RepositoryObject repoObj = repositoryObjectLoader.getRepositoryObject(pid); if (repoObj instanceof AdminUnit) { aclService.assertHasAccess("Insufficient privileges to restore admin unit " + pid.getUUID(), pid, agent.getPrincipals(), markForDeletionUnit); } if (!(repoObj instanceof ContentObject)) { throw new InvalidOperationForObjectType("Cannot perform restore on object " + pid.getUUID() + ", objects of type " + repoObj.getClass().getName() + " are not eligible."); } String updateString = createSparqlDelete(pid.getRepositoryPath(), markedForDeletion, null); sparqlUpdateService.executeUpdate(repoObj.getMetadataUri().toString(), updateString); repoObj.getPremisLog().buildEvent(Premis.Deletion) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Item restored from deletion") .write(); }
Source:
<code>public DoubleMatrix2D matrixTransposeMultiplyMatrix(DoubleMatrix2D a) { ArgumentChecker.notNull(a, "a"); final int n = a.getNumberOfRows(); final int m = a.getNumberOfColumns(); DoubleMatrix2D res = new DoubleMatrix2D(m, m); double[][] data = res.getData(); double[][] aData = a.getData(); for (int i = 0; i < m; i++) { double sum = 0.0; for (int k = 0; k < n; k++) { <START> sum += FunctionUtils.square(aData[k][i]); <END> } data[i][i] = sum; for (int j = i + 1; j < m; j++) { sum = 0.0; for (int k = 0; k < n; k++) { sum += aData[k][i] * aData[k][j]; } data[i][j] = sum; data[j][i] = sum; } } return res; }</code><technical_language>Need this a function call</technical_language>

Target:
public DoubleMatrix2D matrixTransposeMultiplyMatrix(DoubleMatrix2D a) { ArgumentChecker.notNull(a, "a"); final int n = a.getNumberOfRows(); final int m = a.getNumberOfColumns(); DoubleMatrix2D res = new DoubleMatrix2D(m, m); double[][] data = res.getData(); double[][] aData = a.getData(); for (int i = 0; i < m; i++) { double sum = 0.0; for (int k = 0; k < n; k++) { sum += aData[k][i] * aData[k][i]; } data[i][i] = sum; for (int j = i + 1; j < m; j++) { sum = 0.0; for (int k = 0; k < n; k++) { sum += aData[k][i] * aData[k][j]; } data[i][j] = sum; data[j][i] = sum; } } return res; }