auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkLog(Log log, long expectedSegmentCapacity, List<String> expectedSegmentNames) throws IOException { LogSegment nextSegment = log.getFirstSegment(); assertNull("Prev segment should be null", log.getPrevSegment(nextSegment)); for (String segmentName : expectedSegmentNames) { assertEquals("Next segment is not as expected", segmentName, nextSegment.getName()); LogSegment segment = log.getSegment(segmentName); assertEquals("Segment name is not as expected", segmentName, segment.getName()); assertEquals("Segment capacity not as expected", expectedSegmentCapacity, segment.getCapacityInBytes()); assertEquals("Segment returned by getSegment() is incorrect", segment, log.getSegment(segment.getName())); nextSegment = log.getNextSegment(segment); if (nextSegment != null) { assertEquals("Prev segment not as expected", segment, log.getPrevSegment(nextSegment)); } } assertNull("Next segment should be null", nextSegment); assertEquals("Unexpected result for isLogSegment", log.getCapacityInBytes() != expectedSegmentCapacity, log.isLogSegmented()); long expectedSegmentsNeeded = (log.getCapacityInBytes() / expectedSegmentCapacity) - expectedSegmentNames.size(); assertEquals("DiskSpaceRequirements has wrong number of unallocated segments", expectedSegmentsNeeded, log.getRemainingUnallocatedSegments()); }

Target:
private void checkLog(Log log, long expectedSegmentCapacity, List<String> expectedSegmentNames) throws IOException { LogSegment nextSegment = log.getFirstSegment(); assertNull("Prev segment should be null", log.getPrevSegment(nextSegment)); for (String segmentName : expectedSegmentNames) { assertEquals("Next segment is not as expected - expectedSegmentNames=" + expectedSegmentNames, segmentName, nextSegment.getName()); LogSegment segment = log.getSegment(segmentName); assertEquals("Segment name is not as expected - expectedSegmentNames=" + expectedSegmentNames, segmentName, segment.getName()); assertEquals("Segment capacity not as expected", expectedSegmentCapacity, segment.getCapacityInBytes()); assertEquals("Segment returned by getSegment() is incorrect", segment, log.getSegment(segment.getName())); nextSegment = log.getNextSegment(segment); if (nextSegment != null) { assertEquals("Prev segment not as expected - expectedSegmentNames=" + expectedSegmentNames, segment, log.getPrevSegment(nextSegment)); } } assertNull( "Next segment should be null - expectedSegmentNames=" + expectedSegmentNames + ", nextSegment=" + nextSegment, nextSegment); assertEquals("Unexpected result for isLogSegmented()", log.getCapacityInBytes() != expectedSegmentCapacity, log.isLogSegmented()); long expectedUnallocatedSegments = (log.getCapacityInBytes() / expectedSegmentCapacity) - expectedSegmentNames.size(); assertEquals("DiskSpaceRequirements has wrong number of unallocated segments", expectedUnallocatedSegments, log.getRemainingUnallocatedSegments()); }
Source:
private void getMapObject(String parentName, MapObjectInspector mapObjectInspector, Object mapObject, Map<String, Object> parsedMap) { if (mapObjectInspector.getMapSize(mapObject) < 0) { return; } String prefix = parentName + "_"; Map objectMap = mapObjectInspector.getMap(mapObject); PrimitiveObjectInspector key = (PrimitiveObjectInspector) mapObjectInspector.getMapKeyObjectInspector(); PrimitiveObjectInspector value = (PrimitiveObjectInspector) mapObjectInspector.getMapValueObjectInspector(); for (Iterator itr = objectMap.entrySet().iterator(); itr.hasNext(); ) { Map.Entry it = (Map.Entry) itr.next(); parsedMap.put(prefix + key.getPrimitiveJavaObject(it.getKey()).toString(), value.getPrimitiveJavaObject(it.getValue())); } }

Target:
private void getMapObject(String parentName, MapObjectInspector mapObjectInspector, Object mapObject, Map<String, Object> parsedMap) { if (mapObjectInspector.getMapSize(mapObject) < 0) { return; } String mapChildFieldNameFormat = StringUtils.format(mapParentFieldNameFormat, parentName).replace(MAP_CHILD_TAG, "%s"); Map objectMap = mapObjectInspector.getMap(mapObject); PrimitiveObjectInspector key = (PrimitiveObjectInspector) mapObjectInspector.getMapKeyObjectInspector(); PrimitiveObjectInspector value = (PrimitiveObjectInspector) mapObjectInspector.getMapValueObjectInspector(); objectMap.forEach((k, v) -> { String resolvedFieldName = StringUtils.format(mapChildFieldNameFormat, key.getPrimitiveJavaObject(k).toString()); parsedMap.put(resolvedFieldName, value.getPrimitiveJavaObject(v)); }); }
Source:
private synchronized void replaceIfNecessary(Throwable thrown) { if (shouldReplace.test(thrown)) { log.info("Replacing underlying proxy due to thrown exception", thrown); delegate = delegateFactory.get(); } }

Target:
private void replaceIfNecessary(Throwable thrown) { if (shouldReplace.test(thrown)) { synchronized (this) { T replacement = delegateFactory.get(); if (delegate != replacement) { log.info("Replacing underlying proxy due to thrown exception", thrown); delegate = delegateFactory.get(); } } } }
Source:
protected void acquire(TransactionLocks locks) throws IOException { if (locks.containsLock(Type.NameNodeLease)) { NameNodeLeaseLock nameNodeLeaseLock = (NameNodeLeaseLock) locks.getLock(Type.NameNodeLease); if (nameNodeLeaseLock.getNameNodeLease() != null) { acquireLeasePaths(nameNodeLeaseLock.getNameNodeLease()); } } LeaseLock leaseLock = (LeaseLock) locks.getLock(Type.Lease); for (Lease lease : leaseLock.getLeases()) { acquireLeasePaths(lease); } Lease singleFileLease = leaseLock.getSingleFileLease(); if (singleFileLease != null){ setLockMode(lockType); LeasePath leasePath = acquireLock(lockType, LeasePath.Finder.ByPath, leaseLock.getSingleFileLock()); if(leasePath != null){ leasePaths.add(leasePath); } } if(src != null && !src.equals("")){ acquireAllLeasePathsForDir(src); } if (leasePaths.size() > expectedCount) { } }

Target:
protected void acquire(TransactionLocks locks) throws IOException { if (locks.containsLock(Type.NameNodeLease)) { NameNodeLeaseLock nameNodeLeaseLock = (NameNodeLeaseLock) locks.getLock(Type.NameNodeLease); if (nameNodeLeaseLock.getNameNodeLease() != null) { acquireLeasePaths(nameNodeLeaseLock.getNameNodeLease()); } } LeaseLock leaseLock = (LeaseLock) locks.getLock(Type.Lease); LeaseHolderResolveType resolveType = leaseLock.getResolveType(); for (Lease lease : leaseLock.getLeases()) { if(resolveType == LeaseHolderResolveType.SINGLE_PATH ) { acquireLeasePath(lease, leaseLock.getSingleFileLock()); } else { assert resolveType == LeaseHolderResolveType.ALL_PATHS; acquireLeasePaths(lease); } } if(src != null && !src.equals("")){ acquireAllLeasePathsForDir(src); } if (leasePaths.size() > expectedCount) { } }
Source:
public Mono<Void> updateCheckpointAsync(EventData eventData) { Objects.requireNonNull(eventData, "'eventData' cannot be null"); Checkpoint checkpoint = new Checkpoint() .setConsumerGroup(partitionContext.getConsumerGroup()) .setEventHubName(partitionContext.getEventHubName()) .setPartitionId(partitionContext.getPartitionId()) .setSequenceNumber(eventData.getSequenceNumber()) .setOffset(eventData.getOffset()); return this.checkpointStore.updateCheckpoint(checkpoint); }

Target:
public Mono<Void> updateCheckpointAsync(EventData eventData) { if (eventData == null) { return monoError(logger, new NullPointerException("'eventData' cannot be null")); } Checkpoint checkpoint = new Checkpoint() .setConsumerGroup(partitionContext.getConsumerGroup()) .setEventHubName(partitionContext.getEventHubName()) .setPartitionId(partitionContext.getPartitionId()) .setSequenceNumber(eventData.getSequenceNumber()) .setOffset(eventData.getOffset()); return this.checkpointStore.updateCheckpoint(checkpoint); }
Source:
public void reportEvents() { if ( pins > 0 ) { pageCacheTracer.pins( pins ); } if ( unpins > 0 ) { pageCacheTracer.unpins( unpins ); } if ( hits > 0 ) { pageCacheTracer.hits( hits ); historicalHits = Math.addExact( historicalHits, hits ); } if ( faults > 0 ) { pageCacheTracer.faults( faults ); historicalFaults = Math.addExact( historicalFaults, faults ); } if ( bytesRead > 0 ) { pageCacheTracer.bytesRead( bytesRead ); } if ( evictions > 0 ) { pageCacheTracer.evictions( evictions ); } if ( evictionExceptions > 0 ) { pageCacheTracer.evictionExceptions( evictionExceptions ); } if ( bytesWritten > 0 ) { pageCacheTracer.bytesWritten( bytesWritten ); } if ( flushes > 0 ) { pageCacheTracer.flushes( flushes ); } reset(); }

Target:
public void reportEvents() { if ( pins > 0 ) { pageCacheTracer.pins( pins ); } if ( unpins > 0 ) { pageCacheTracer.unpins( unpins ); } if ( hits > 0 ) { pageCacheTracer.hits( hits ); historicalHits = historicalHits + hits; } if ( faults > 0 ) { pageCacheTracer.faults( faults ); historicalFaults = historicalFaults + faults; } if ( bytesRead > 0 ) { pageCacheTracer.bytesRead( bytesRead ); } if ( evictions > 0 ) { pageCacheTracer.evictions( evictions ); } if ( evictionExceptions > 0 ) { pageCacheTracer.evictionExceptions( evictionExceptions ); } if ( bytesWritten > 0 ) { pageCacheTracer.bytesWritten( bytesWritten ); } if ( flushes > 0 ) { pageCacheTracer.flushes( flushes ); } reset(); }
Source:
private boolean isPrimaryKey(RelationInfo relationInfo) { return relationInfo != null && (relationInfo.primaryKey().size() > 1 || (relationInfo.primaryKey().size() == 1 && !relationInfo.primaryKey().get(0).name().equals("_id"))); }

Target:
private boolean isPrimaryKey(RelationInfo relationInfo) { return (relationInfo.primaryKey().size() > 1 || (relationInfo.primaryKey().size() == 1 && !relationInfo.primaryKey().get(0).name().equals("_id"))); }
Source:
public MemoryInfo getMemoryInfo() { taskManager.updateMemoryPoolAssignments(new MemoryPoolAssignmentsRequest("", 0, new ArrayList<>())); return memoryManager.getInfo(); }

Target:
public MemoryInfo getMemoryInfo() { return memoryManager.getInfo(); }
Source:
public String getOvnCentralByClusterId(Guid clusterId) { List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { ProviderNetwork providerNetwork = network.getProvidedBy(); if ((providerNetwork != null) && (providerNetwork.getProviderId().equals(provider.getId()))) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }

Target:
public String getOvnCentralByClusterId(Guid clusterId) { List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { ProviderNetwork providerNetwork = network.getProvidedBy(); if (providerNetwork != null && (providerNetwork.getProviderId().equals(provider.getId()))) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }
Source:
public Connection getConnection() throws SQLException { if (getDataSource() == null) { return createDataSource().getConnection(); } Connection connection = null; int retryAttempt = 0; this.dataSource = null; while (connection == null && retryAttempt < ServerInternals.MAX_DB_RETRY_COUNT) { try { connection = createDataSource().getConnection(); if(connection != null) return connection; } catch (Exception ex) { logger.error("Failed to find DB connection", ex); this.dataSource = null; logger.info("waits 10 seconds and retry. No.Attempt = " + retryAttempt); } finally { retryAttempt ++; } } return connection; }

Target:
public synchronized Connection getConnection() throws SQLException { if (getDataSource() == null) { return createDataSource().getConnection(); } Connection connection = null; int retryAttempt = 0; while (connection == null && retryAttempt < ServerInternals.MAX_DB_RETRY_COUNT) { try { connection = createDataSource().getConnection(); if(connection != null) return connection; } catch (SQLException ex) { this.dataSource = null; logger.error("Failed to find DB connection. waits 1 minutes and retry. No.Attempt = " + retryAttempt, ex); } catch (Exception ex) { logger.error("Exception other than SQLException is thrown", ex); return null; } finally { retryAttempt ++; } } return connection; }
Source:
public void shouldReencrypt() throws Exception { final Encryption source = new Encryption(KeySources.fixedKey("DataPrepIsSoCool"), CipherSources.aes()); final Encryption target = new Encryption(KeySources.random(16), CipherSources.getDefault()); final EncryptionMigration migration = EncryptionMigration.build(source, target); final String originalEncrypted = "JP6lC6hVeu3wRZA1Tzigyg=="; final String reencrypt = migration.migrate(originalEncrypted); final String decrypted = target.decrypt(reencrypt); assertEquals("5ecr3t", decrypted); assertNotEquals(originalEncrypted, reencrypt); }

Target:
public void shouldReencrypt() throws Exception { final String plainText = "5ecr3t"; final Encryption source = new Encryption(KeySources.fixedKey("DataPrepIsSoCool"), CipherSources.aes()); final Encryption target = new Encryption(KeySources.random(16), CipherSources.getDefault()); final EncryptionMigration migration = EncryptionMigration.build(source, target); final String originalEncrypted = source.encrypt(plainText); final String reencrypt = migration.migrate(originalEncrypted); final String decrypted = target.decrypt(reencrypt); assertEquals(plainText, decrypted); assertNotEquals(originalEncrypted, reencrypt); }
Source:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); HostPageData pageData = new HostPageData(); pageData.version = Version.getVersion(); pageData.isNoteDbEnabled = isNoteDbEnabled; pageData.pluginsLoadTimeout = pluginsLoadTimeout; StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.removeAttribute("id"); nocache.setAttribute("src", noCacheName); opt = new Content(hostDoc); nocache.setAttribute("src", "gerrit_ui/dbg_gerrit_ui.nocache.js"); debug = new Content(hostDoc); }

Target:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); HostPageData pageData = new HostPageData(); pageData.version = Version.getVersion(); pageData.isNoteDbEnabled = isNoteDbEnabled; pageData.pluginsLoadTimeout = pluginsLoadTimeout; pageData.canLoadInIFrame = canLoadInIFrame; StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.removeAttribute("id"); nocache.setAttribute("src", noCacheName); opt = new Content(hostDoc); nocache.setAttribute("src", "gerrit_ui/dbg_gerrit_ui.nocache.js"); debug = new Content(hostDoc); }
Source:
protected String getCorporateBilledCorporatePaidDocumentParameter(String parameterName){ String parameterValue = parameterService.getParameterValueAsString("KFS-FP", CuFPParameterConstants.CorporateBilledCorporatePaidDocument.COMPONENT_NAME, parameterName); if (LOG.isDebugEnabled()) { LOG.debug("getCorporateBilledCorporatePaidDocumentParameter, param name: " + parameterName + " param value: " + parameterValue); } return parameterValue; }

Target:
public String getCorporateBilledCorporatePaidDocumentParameter(String parameterName) { String parameterValue = parameterService.getParameterValueAsString(KFSConstants.ParameterNamespaces.FINANCIAL, CuFPParameterConstants.CorporateBilledCorporatePaidDocument.CBCP_COMPONENT_NAME, parameterName); if (LOG.isDebugEnabled()) { LOG.debug("getCorporateBilledCorporatePaidDocumentParameter, param name: " + parameterName + " param value: " + parameterValue); } return parameterValue; }
Source:
public boolean pollSocketsInfo() { if (!isTcpInfoSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (final int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); while (enoughBytesRemainForValidNlMsg(bytes)) { StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + StructInetDiagMsg.STRUCT_SIZE - 7 * Integer.BYTES); final long cookie = ((long) bytes.getInt() << 32) | (long) bytes.getInt(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; } } cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }

Target:
public boolean pollSocketsInfo() { if (!isTcpInfoSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (final int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); while (enoughBytesRemainForValidNlMsg(bytes)) { final StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + StructInetDiagMsg.STRUCT_SIZE - 7 * Integer.BYTES); final long cookie = bytes.getLong(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; } } cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }
Source:
public static void setSubscriptionsFilter(SubscriptionsFilter value) { prefs.edit() .putString(PREF_FILTER_FEED, TextUtils.join(",", value.getValues())) .apply(); }

Target:
public static void setSubscriptionsFilter(SubscriptionsFilter value) { prefs.edit() .putString(PREF_FILTER_FEED, value.serialize()) .apply(); }
Source:
public void forceMemoizationTest() { final List<Integer> res = new ArrayList<>(); final PackageStats toplevel = Metrics.getTopLevelPackageStats(); ASTCompilationUnit acu = parseAndVisitForClass15(MetricsVisitorTestData.class); acu.jjtAccept(new JavaParserVisitorReducedAdapter() { @Override public Object visit(ASTMethodOrConstructorDeclaration node, Object data) { res.add((int) toplevel.compute(opMetricKey, node, true, Version.STANDARD)); return super.visit(node, data); } @Override public Object visit(ASTAnyTypeDeclaration node, Object data) { res.add((int) toplevel.compute(classMetricKey, node, true, Version.STANDARD)); return super.visit(node, data); } }, null); System.out.println(); final List<Integer> cmp = new ArrayList<>(); acu.jjtAccept(new JavaParserVisitorReducedAdapter() { @Override public Object visit(ASTMethodOrConstructorDeclaration node, Object data) { cmp.add((int) toplevel.compute(opMetricKey, node, true, Version.STANDARD)); return super.visit(node, data); } @Override public Object visit(ASTAnyTypeDeclaration node, Object data) { cmp.add((int) toplevel.compute(classMetricKey, node, true, Version.STANDARD)); return super.visit(node, data); } }, null); for (int i = 0; i < res.size(); i++) { assertNotEquals(res.get(i), cmp.get(i)); } }

Target:
public void forceMemoizationTest() { ASTCompilationUnit acu = parseAndVisitForClass15(MetricsVisitorTestData.class); List<Integer> reference = visitWith(acu, true); List<Integer> real = visitWith(acu, true); assertEquals(reference.size(), real.size()); for (int i = 0; i < reference.size(); i++) { assertNotEquals(reference.get(i), real.get(i)); } }
Source:
protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); saveInterval.loadDefault(); stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE)); openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER); openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); singleClickButton.setSelection(openOnSingleClick); doubleClickButton.setSelection(!openOnSingleClick); selectOnHoverButton.setSelection(selectOnHover); openAfterDelayButton.setSelection(openAfterDelay); selectOnHoverButton.setEnabled(openOnSingleClick); openAfterDelayButton.setEnabled(openOnSingleClick); stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE)); showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND)); showHeapStatusButton.setSelection( PrefUtil.getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR)); readRenameModeFromPreferences(); renameModeInlineButton.setSelection(renameModeInline); renameModeDialogButton.setSelection(!renameModeInline); super.performDefaults(); }

Target:
protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); saveInterval.loadDefault(); stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE)); openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER); openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); singleClickButton.setSelection(openOnSingleClick); doubleClickButton.setSelection(!openOnSingleClick); selectOnHoverButton.setSelection(selectOnHover); openAfterDelayButton.setSelection(openAfterDelay); selectOnHoverButton.setEnabled(openOnSingleClick); openAfterDelayButton.setEnabled(openOnSingleClick); stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE)); showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND)); showHeapStatusButton.setSelection( PrefUtil.getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR)); renameModeInline = true; renameModeInlineButton.setSelection(renameModeInline); renameModeDialogButton.setSelection(!renameModeInline); super.performDefaults(); }
Source:
public static TableMetadata getMetadataOrDefaultToGeneric(byte[] metadata) { if (metadata == null || Arrays.equals(metadata, AtlasDbConstants.EMPTY_TABLE_METADATA)) { return TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(AtlasDbConstants.GENERIC_TABLE_METADATA); } else { return TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(metadata); } }

Target:
static TableMetadata getMetadataOrDefaultToGeneric(byte[] metadata) { if (metadata == null || Arrays.equals(metadata, AtlasDbConstants.EMPTY_TABLE_METADATA)) { return TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(AtlasDbConstants.GENERIC_TABLE_METADATA); } return TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(metadata); }
Source:
private static String name(Tree tree) { if (tree.is(Tree.Kind.NEW_CLASS)) { return ((NewClassTree) tree).symbolType().name(); } MethodInvocationTree mit = (MethodInvocationTree) tree; if (mit.symbolType().is("void")) { Type type = mit.methodSelect().symbolType(); if (type.isUnknown()) { return SyntaxTreeNameFinder.getName(mit.methodSelect()); } return type.name(); } return mit.symbolType().name(); }

Target:
private static String name(Tree tree) { if (tree.is(Tree.Kind.NEW_CLASS)) { return ((NewClassTree) tree).symbolType().name(); } MethodInvocationTree mit = (MethodInvocationTree) tree; if (mit.symbolType().isVoid()) { return mit.symbol().owner().name(); } return mit.symbolType().name(); }
Source:
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Log.i("onEditorAction", "view=" + v + " actionId=" + actionId + " event=" + event); if ((event != null && event.getAction() == KeyEvent.ACTION_UP) || event == null) { String pc = entry.getText().toString(); if (pc.length() > 0 && pc.length() < getMinPasscodeLength()) { error.setText(getMinLengthInstructions(getMinPasscodeLength())); return false; } return pc.length() > 0 ? onSubmit(pc) : false; } else { return true; } }

Target:
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Log.i("onEditorAction", "view=" + v + " actionId=" + actionId + " event=" + event); if (event != null && event.getAction() == KeyEvent.ACTION_UP) { String pc = entry.getText().toString(); if (pc.length() > 0 && pc.length() < getMinPasscodeLength()) { error.setText(getMinLengthInstructions(getMinPasscodeLength())); return false; } return pc.length() > 0 ? onSubmit(pc) : false; } else { return true; } }
Source:
private void synchronizeMembersAndSaveResult(PerunSession sess, Group group) { String exceptionMessage = null; String skippedMembersMessage = null; boolean failedDueToException = false; try { List<String> skippedMembers = perunBl.getGroupsManagerBl().synchronizeGroup(sess, group); skippedMembersMessage = prepareSkippedObjectsMessage(skippedMembers, "members"); exceptionMessage = skippedMembersMessage; } catch (WrongAttributeValueException | WrongReferenceAttributeValueException | InternalErrorException | WrongAttributeAssignmentException | GroupNotExistsException | AttributeNotExistsException | ExtSourceNotExistsException e) { failedDueToException = true; exceptionMessage = "Cannot synchronize group "; log.error(exceptionMessage + group, e); exceptionMessage += "due to exception: " + e.getName() + " => " + e.getMessage(); } catch (Exception e) { failedDueToException = true; exceptionMessage = "Cannot synchronize group "; log.error(exceptionMessage + group, e); exceptionMessage += "due to unexpected exception: " + e.getClass().getName() + " => " + e.getMessage(); } finally { try { perunBl.getGroupsManagerBl().saveInformationAboutGroupSynchronizationInNestedTransaction(sess, group, failedDueToException, exceptionMessage); } catch (Exception ex) { log.error("When synchronization group " + group + ", exception was thrown.", ex); log.info("Info about exception from synchronization: " + skippedMembersMessage); } } }

Target:
private void synchronizeMembersAndSaveResult(PerunSession sess, Group group) { String exceptionMessage = null; String skippedMembersMessage = null; boolean failedDueToException = false; try { List<String> skippedMembers = perunBl.getGroupsManagerBl().synchronizeGroup(sess, group); skippedMembersMessage = prepareSkippedObjectsMessage(skippedMembers, "members"); exceptionMessage = skippedMembersMessage; } catch (Exception e) { failedDueToException = true; exceptionMessage = "Cannot synchronize group "; log.error(exceptionMessage + group, e); exceptionMessage += "due to exception: " + e.getClass().getName() + " => " + e.getMessage(); } finally { try { perunBl.getGroupsManagerBl().saveInformationAboutGroupSynchronizationInNestedTransaction(sess, group, failedDueToException, exceptionMessage); } catch (Exception ex) { log.error("When synchronization group " + group + ", exception was thrown.", ex); log.info("Info about exception from synchronization: " + skippedMembersMessage); } } }
Source:
public void setup() { noName = Invocation.create(method(VersionedApi.class, "noName"), ImmutableList.of()); named = Invocation.create(method(VersionedApi.class, "named"), ImmutableList.of()); config = createMock(InvocationConfig.class); expect(config.getCommandName(noName)).andReturn("VersionedApi.noName"); expect(config.getCommandName(named)).andReturn("named:getVault"); replay(config); }

Target:
public void setup() { noName = Invocation.create(method(VersionedApi.class, "noName"), ImmutableList.of()); named = Invocation.create(method(VersionedApi.class, "named"), ImmutableList.of()); config = createMock(InvocationConfig.class); expect(config.getCommandName(noName)).andReturn("VersionedApi.noName"); expect(config.getCommandName(named)).andReturn("named:get"); replay(config); }
Source:
public void appendUpdateRecord(final long id, final byte recordType, final EncodingSupport record, final boolean sync, final IOCompletion callback) throws Exception { checkJournalIsLoaded(); lineUpContext(callback); checkKnownRecordID(id); Future<?> result = appendExecutor.submit(new Runnable() { @Override public void run() { journalLock.readLock().lock(); try { JournalRecord jrnRecord = records.get(id); JournalInternalRecord updateRecord = new JournalAddRecord(false, id, recordType, record); JournalFile usedFile = appendRecord(updateRecord, false, sync, null, callback); if (logger.isTraceEnabled()) { logger.trace("appendUpdateRecord::id=" + id + ", userRecordType=" + recordType + ", usedFile = " + usedFile); } if (jrnRecord == null) { compactor.addCommandUpdate(id, usedFile, updateRecord.getEncodeSize()); } else { jrnRecord.addUpdateFile(usedFile, updateRecord.getEncodeSize()); } } catch (Exception e) { ActiveMQJournalLogger.LOGGER.error(e.getMessage(), e); } finally { journalLock.readLock().unlock(); } } }); if (sync && callback == null) { result.get(); } }

Target:
public void appendUpdateRecord(final long id, final byte recordType, final EncodingSupport record, final boolean sync, final IOCompletion callback) throws Exception { checkJournalIsLoaded(); lineUpContext(callback); checkKnownRecordID(id); final SimpleFuture<Boolean> result = newSyncAndCallbackResult(sync, callback); appendExecutor.execute(new Runnable() { @Override public void run() { journalLock.readLock().lock(); try { JournalRecord jrnRecord = records.get(id); JournalInternalRecord updateRecord = new JournalAddRecord(false, id, recordType, record); JournalFile usedFile = appendRecord(updateRecord, false, sync, null, callback); if (logger.isTraceEnabled()) { logger.trace("appendUpdateRecord::id=" + id + ", userRecordType=" + recordType + ", usedFile = " + usedFile); } if (jrnRecord == null) { compactor.addCommandUpdate(id, usedFile, updateRecord.getEncodeSize()); } else { jrnRecord.addUpdateFile(usedFile, updateRecord.getEncodeSize()); } if (result != null) { result.set(true); } } catch (Exception e) { if (result != null) { result.fail(e); } logger.error("appendUpdateRecord:" + e, e); } finally { journalLock.readLock().unlock(); } } }); if (result != null) { result.get(); } }
Source:
public void testGetCookies() throws Exception { TestMultiClientSessionCookieStore cookieStore = new TestMultiClientSessionCookieStore(); cookieStore.setTestClientSession(Mockito.mock(IClientSession.class)); createCookies(cookieStore); List<HttpCookie> cookies = cookieStore.getCookies(); assertNotNull(cookies); assertEquals(2, cookies.size()); if (COOKIE1.equals(CollectionUtility.firstElement(cookies))) { checkCookieDeepEquality(COOKIE1, CollectionUtility.firstElement(cookies)); checkCookieDeepEquality(COOKIE2, cookies.get(1)); } else if (COOKIE2.equals(CollectionUtility.firstElement(cookies))) { checkCookieDeepEquality(COOKIE2, CollectionUtility.firstElement(cookies)); checkCookieDeepEquality(COOKIE1, cookies.get(1)); } else { fail("No created cookie matches retrieved element " + CollectionUtility.firstElement(cookies)); } }

Target:
public void testGetCookies() throws Exception { TestMultiClientSessionCookieStore cookieStore = new TestMultiClientSessionCookieStore(); cookieStore.setTestClientSession(SESSION1); createCookies(cookieStore); List<HttpCookie> cookies = cookieStore.getCookies(); assertNotNull(cookies); assertEquals(2, cookies.size()); assertContainsCookies(Arrays.asList(COOKIE1, COOKIE2), cookies); }
Source:
public void setEnablePII(final boolean enablePII) { LoggerSettings.setAllowPii(enablePII); }

Target:
public void setEnablePII(final boolean enablePII) { com.microsoft.identity.common.internal.logging.Logger.setAllowPii(enablePII); }
Source:
public void testDdlWrongColumnName() throws SQLException { checkSqlErrorMessage("create index idx1 on test (wrong)", "42000", "Column doesn't exist: WRONG"); checkSqlErrorMessage("alter table test drop column wrong", "42000", "Failed to parse query. Column \"WRONG\" not found"); checkSqlErrorMessage("create table test(id integer primary key, AgE integer, AGe integer)", "42000", "Duplicate column name: AGE"); checkSqlErrorMessage("create table test(\"id\" integer primary key, \"age\" integer, \"age\" integer)", "42000", "Duplicate column name: age"); }

Target:
public void testDdlWrongColumnName() throws SQLException { checkSqlErrorMessage("create index idx1 on test (wrong)", "42000", "Column doesn't exist: WRONG"); checkSqlErrorMessage("alter table test drop column wrong", "42000", "Failed to parse query. Column \"WRONG\" not found"); checkSqlErrorMessage("create table test(id integer primary key, AgE integer, AGe integer)", "42000", "Duplicate column name: AGE"); checkSqlErrorMessage("create table test(\"id\" integer primary key, \"age\" integer, \"age\" integer)", "42000", "Duplicate column name: age"); checkSqlErrorMessage("create table test(id integer primary key, age integer, age varchar)", "42000", "Duplicate column name: AGE"); }
Source:
protected static void addWorkflowJobUserContent(final HelixManager manager, String workflowJobResource, final String key, final String value) { final String path = Joiner.on("/") .join(TaskConstants.REBALANCER_CONTEXT_ROOT, workflowJobResource, USER_CONTENT_NODE); manager.getHelixPropertyStore().update(path, new DataUpdater<ZNRecord>() { @Override public ZNRecord update(ZNRecord znRecord) { ZNRecord r = manager.getHelixPropertyStore().get(path, null, AccessOption.PERSISTENT); r.setSimpleField(key, value); return r; } }, AccessOption.PERSISTENT); }

Target:
protected static void addWorkflowJobUserContent(final HelixManager manager, String workflowJobResource, final String key, final String value) { String path = Joiner.on("/") .join(TaskConstants.REBALANCER_CONTEXT_ROOT, workflowJobResource, USER_CONTENT_NODE); manager.getHelixPropertyStore().update(path, new DataUpdater<ZNRecord>() { @Override public ZNRecord update(ZNRecord znRecord) { znRecord.setSimpleField(key, value); return znRecord; } }, AccessOption.PERSISTENT); }
Source:
public FormValidation doCheckName( @QueryParameter final String value, @QueryParameter final String id) { if (Util.fixEmpty(value) == null) { return FormValidation.error("You must provide a name for the failure cause!"); } if (CauseManagement.NEW_CAUSE_NAME.equalsIgnoreCase(value)) { return FormValidation.error("Reserved name!"); } try { Jenkins.checkGoodName(value); } catch (Failure failure) { return FormValidation.error(failure, failure.getMessage()); } try { for (FailureCause other : PluginImpl.getInstance().getKnowledgeBase().getCauses()) { if ((id == null || !id.equals(other.getId())) && value.equals(other.getName())) { return FormValidation.error("There is another cause with that name."); } } } catch (Exception e) { logger.log(Level.SEVERE, "Failed to get causes list to evaluate name! ", e); } return FormValidation.ok(); }

Target:
public FormValidation doCheckName( @QueryParameter final String value, @QueryParameter final String id) { Jenkins.getInstance().checkPermission(PluginImpl.UPDATE_PERMISSION); if (Util.fixEmpty(value) == null) { return FormValidation.error("You must provide a name for the failure cause!"); } if (CauseManagement.NEW_CAUSE_NAME.equalsIgnoreCase(value)) { return FormValidation.error("Reserved name!"); } try { Jenkins.checkGoodName(value); } catch (Failure failure) { return FormValidation.error(failure, failure.getMessage()); } try { for (FailureCause other : PluginImpl.getInstance().getKnowledgeBase().getCauses()) { if ((id == null || !id.equals(other.getId())) && value.equals(other.getName())) { return FormValidation.error("There is another cause with that name."); } } } catch (Exception e) { logger.log(Level.SEVERE, "Failed to get causes list to evaluate name! ", e); } return FormValidation.ok(); }
Source:
public void getLastColumnTest() { assertArrayEquals(matrix.getColumn(matrix.getColumnsCount() - 1), lastColumn); }

Target:
public void getLastColumnTest() { assertArrayEquals(lastColumn, matrix.getColumn(matrix.getColumnsCount() - 1)); }
Source:
private void emitRefundEvent(PayoutReconcileMessage payoutReconcileMessage, BalanceTransaction balanceTransaction) { var sourceTransfer = (Transfer) balanceTransaction.getSourceObject(); var metadata = StripeTransferMetadata.from(sourceTransfer.getMetadata()); var refundExternalId = metadata.getGovukPayTransactionExternalId(); if (connectorConfiguration.getEmitPayoutEvents()) { var refundEvent = new RefundIncludedInPayout(refundExternalId, payoutReconcileMessage.getGatewayPayoutId(), payoutReconcileMessage.getCreatedDate()); try { eventService.emitEvent(refundEvent, false); } catch (QueueException e) { throw new RuntimeException(format("Error sending event for refund [%s] included in payout [%s] to event queue: %s", refundExternalId, payoutReconcileMessage.getGatewayPayoutId(), e.getMessage()), e); } } LOGGER.info("Emitted event for refund included in payout [{}]", refundExternalId, payoutReconcileMessage.getGatewayPayoutId()); }

Target:
private void emitRefundEvent(PayoutReconcileMessage payoutReconcileMessage, BalanceTransaction balanceTransaction) { var sourceTransfer = (Transfer) balanceTransaction.getSourceObject(); String refundExternalId = resolveTransactionExternalId(payoutReconcileMessage, balanceTransaction, sourceTransfer); var refundEvent = new RefundIncludedInPayout(refundExternalId, payoutReconcileMessage.getGatewayPayoutId(), payoutReconcileMessage.getCreatedDate()); emitEvent(refundEvent, payoutReconcileMessage, refundExternalId); LOGGER.info("Emitted event for refund included in payout [{}]", refundExternalId, payoutReconcileMessage.getGatewayPayoutId()); }
Source:
private void setAccount() throws OrmException, IOException, UnloggedFailure { user = genericUserFactory.create(id); rsrc = new AccountResource(user); try { for (String email : addEmails) { addEmail(email); } for (String email : deleteEmails) { deleteEmail(email); } if (preferredEmail != null && !preferredEmail.isEmpty()) { putPreferred(preferredEmail); } if (fullName != null) { PutName.Input in = new PutName.Input(); in.name = fullName; putName.apply(rsrc, in); } if (httpPassword != null || clearHttpPassword) { PutHttpPassword.Input in = new PutHttpPassword.Input(); in.httpPassword = httpPassword; putHttpPassword.apply(rsrc, in); } if (active) { putActive.apply(rsrc, null); } else if (inactive) { try { deleteActive.apply(rsrc, null); } catch (ResourceNotFoundException e) { } } addSshKeys = readSshKey(addSshKeys); if (!addSshKeys.isEmpty()) { addSshKeys(addSshKeys); } deleteSshKeys = readSshKey(deleteSshKeys); if (!deleteSshKeys.isEmpty()) { deleteSshKeys(deleteSshKeys); } } catch (RestApiException e) { throw die(e.getMessage()); } }

Target:
private void setAccount() throws OrmException, IOException, UnloggedFailure { user = genericUserFactory.create(id); rsrc = new AccountResource(user); try { for (String email : addEmails) { addEmail(email); } for (String email : deleteEmails) { deleteEmail(email); } if (preferredEmail != null) { putPreferred(preferredEmail); } if (fullName != null) { PutName.Input in = new PutName.Input(); in.name = fullName; putName.apply(rsrc, in); } if (httpPassword != null || clearHttpPassword) { PutHttpPassword.Input in = new PutHttpPassword.Input(); in.httpPassword = httpPassword; putHttpPassword.apply(rsrc, in); } if (active) { putActive.apply(rsrc, null); } else if (inactive) { try { deleteActive.apply(rsrc, null); } catch (ResourceNotFoundException e) { } } addSshKeys = readSshKey(addSshKeys); if (!addSshKeys.isEmpty()) { addSshKeys(addSshKeys); } deleteSshKeys = readSshKey(deleteSshKeys); if (!deleteSshKeys.isEmpty()) { deleteSshKeys(deleteSshKeys); } } catch (RestApiException e) { throw die(e.getMessage()); } }
Source:
public void run() { registerReceivers(); running = true; try { while (running) { clearOldLoadedFiles(); while (!loadQueue.isEmpty() && loadQueue.peek().getFileSize() < (maxBytesToLoad - bytesRequested)) { PlaylistEntry entry = loadQueue.poll(); if (entry.isLocalFile()) { loadLocal(entry); } else { loadRemote(entry); bytesRequested += entry.getFileSize(); remotelyLoaded.add(entry); } } try { Thread.sleep(1000); } catch (InterruptedException e) { } } } finally { unregisterReceivers(); if (this.stoppingThread != null) { synchronized(this.stoppingThread) { this.stoppingThread.notify(); } } } }

Target:
public void run() { registerReceivers(); running = true; try { while (running) { clearOldLoadedFiles(); while (!loadQueue.isEmpty() && loadQueue.peek().getFileSize() < (maxBytesToLoad - bytesRequested)) { PlaylistEntry entry = loadQueue.poll(); if (entry.isLocalFile()) { loadLocal(entry); } else { loadRemote(entry); bytesRequested += entry.getFileSize(); remotelyLoaded.add(entry); } } pauseForNextRun(); } } finally { unregisterReceivers(); if (this.stoppingThread != null) { synchronized(this.stoppingThread) { this.stoppingThread.notify(); } } } }
Source:
public String render(final PutBulkResult result) { if (result.getIgnoredFiles() == null || result.getIgnoredFiles().isEmpty()) { return result.getResult(); } return String.format("%s\n%s", result.getResult(), ASCIITable.getInstance().getTable(getHeaders(), formatIgnoreFileList(result.getIgnoredFiles()))); }

Target:
public String render(final PutBulkResult result) { if (Guard.isNullOrEmpty(result.getIgnoredFiles())) { return result.getResult(); } return String.format("%s\n%s", result.getResult(), ASCIITable.getInstance().getTable(getHeaders(), formatIgnoreFileList(result.getIgnoredFiles()))); }
Source:
private long generateCidaFromFilepaths(String[] fileNames) { long pidls = new long [fileNames.length]; int[] pidlSizes = new int[fileNames.length]; int pidlSizeSum = 2; int n = 0; for (int i = 0; i < fileNames.length; i++) { long ppv = new long [1]; int hr = OS.PathToPIDL(fileNames[i].toCharArray(), ppv); if (hr != OS.S_OK) continue; pidls[n] = ppv[0]; pidlSizes[n] = OS.ILGetSize(pidls[n]); pidlSizeSum += pidlSizes[n]; n++; } CIDA cida = new CIDA(); cida.cidl = n; int cidaSize = CIDA.sizeof + 4 * cida.cidl; cida.aoffset = cidaSize; long newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, cidaSize + pidlSizeSum); if (newPtr != 0) { OS.MoveMemory(newPtr, cida, CIDA.sizeof); int[] pidlOffsets = new int[n]; if (n > 0) pidlOffsets[0] = cidaSize + 2; for (int i = 1; i < n; i++) { pidlOffsets[i] = pidlOffsets[i - 1] + pidlSizes[i - 1]; } OS.MoveMemory(newPtr + CIDA.sizeof, pidlOffsets, 4 * cida.cidl); for (int i = 0; i < n; i++) { OS.MoveMemory(newPtr + pidlOffsets[i], pidls[i], pidlSizes[i]); } } for (int i = 0; i < n; i++) { OS.CoTaskMemFree(pidls[i]); } return newPtr; }

Target:
private long generateCidaFromFilepaths(String[] fileNames) { final int n = fileNames.length; long pidls = new long [n]; try { CIDA cida = new CIDA(); cida.cidl = n; int cidaSize = CIDA.sizeof + 4 * n; cida.aoffset = cidaSize; int[] pidlOffsets = new int[n]; int[] pidlSizes = new int[n]; int pidlSizeSum = 2; for (int i = 0; i < n; i++) { TCHAR szfileName = new TCHAR(0, fileNames[i], true); long ppv = new long [1]; int hr = COM.PathToPIDL(szfileName.chars, ppv); if (hr != OS.S_OK) { DND.error(DND.ERROR_INVALID_DATA); } pidls[i] = ppv[0]; pidlSizes[i] = OS.ILGetSize(pidls[i]); pidlSizeSum += pidlSizes[i]; if (i == 0) { pidlOffsets[0] = cidaSize + 2; } else { pidlOffsets[i] = pidlOffsets[i - 1] + pidlSizes[i - 1]; } } long newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, cidaSize + pidlSizeSum); if (newPtr != 0) { OS.MoveMemory(newPtr, cida, CIDA.sizeof); OS.MoveMemory(newPtr + CIDA.sizeof, pidlOffsets, 4 * cida.cidl); for (int i = 0; i < n; i++) { OS.MoveMemory(newPtr + pidlOffsets[i], pidls[i], pidlSizes[i]); } } return newPtr; } finally { for (int i = 0; i < n; i++) { if (pidls[i] != 0) { OS.CoTaskMemFree(pidls[i]); } } } }
Source:
public SwtConfirmBox( Element self, XulComponent parent, XulDomContainer domContainer, String tagName ) { super( tagName ); if ( parent instanceof SwtWindow ) { SwtWindow swtWindow = (SwtWindow) parent; setModalParent( swtWindow.shell ); } }

Target:
public SwtConfirmBox( Element self, XulComponent parent, XulDomContainer domContainer, String tagName ) { super( tagName ); if ( parent instanceof SwtWindow ) { SwtWindow swtWindow = (SwtWindow) parent; setModalParent( swtWindow.getShell() ); } }
Source:
private void recvWants() throws IOException { HashSet<ObjectId> wantIds = new HashSet<ObjectId>(); boolean isFirst = true; for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (isFirst) break; throw eof; } if (line == PacketLineIn.END) break; if (line.startsWith("deepen ")) { depth = Integer.parseInt(line.substring(7)); continue; } if (line.startsWith("shallow ")) { final ObjectId id = ObjectId.fromString(line.substring(8)); clientShallowCommits.add(walk.parseCommit(id)); continue; } if (!line.startsWith("want ") || line.length() < 45) throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); if (isFirst && line.length() > 45) { String opt = line.substring(45); if (opt.startsWith(" ")) opt = opt.substring(1); for (String c : opt.split(" ")) options.add(c); line = line.substring(0, 45); } wantIds.add(ObjectId.fromString(line.substring(5))); isFirst = false; } if (wantIds.isEmpty()) return; AsyncRevObjectQueue q = walk.parseAny(wantIds, true); try { for (;;) { RevObject o; try { o = q.next(); } catch (IOException error) { throw new PackProtocolException(MessageFormat.format( JGitText.get().notValid, error.getMessage()), error); } if (o == null) break; if (o.has(WANT)) { } else if (o.has(ADVERTISED)) { o.add(WANT); wantAll.add(o); if (o instanceof RevTag) { o = walk.peel(o); if (o instanceof RevCommit) { if (!o.has(WANT)) { o.add(WANT); wantAll.add(o); } } } } else { throw new PackProtocolException(MessageFormat.format( JGitText.get().notValid, o.name())); } } } finally { q.release(); } }

Target:
private void recvWants() throws IOException { HashSet<ObjectId> wantIds = new HashSet<ObjectId>(); boolean isFirst = true; for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (isFirst) break; throw eof; } if (line == PacketLineIn.END) break; if (line.startsWith("deepen ")) { depth = Integer.parseInt(line.substring(7)); continue; } if (line.startsWith("shallow ")) { final ObjectId id = ObjectId.fromString(line.substring(8)); clientShallowCommits.add(id); continue; } if (!line.startsWith("want ") || line.length() < 45) throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); if (isFirst && line.length() > 45) { String opt = line.substring(45); if (opt.startsWith(" ")) opt = opt.substring(1); for (String c : opt.split(" ")) options.add(c); line = line.substring(0, 45); } wantIds.add(ObjectId.fromString(line.substring(5))); isFirst = false; } if (wantIds.isEmpty()) return; AsyncRevObjectQueue q = walk.parseAny(wantIds, true); try { for (;;) { RevObject o; try { o = q.next(); } catch (IOException error) { throw new PackProtocolException(MessageFormat.format( JGitText.get().notValid, error.getMessage()), error); } if (o == null) break; if (o.has(WANT)) { } else if (o.has(ADVERTISED)) { o.add(WANT); wantAll.add(o); if (o instanceof RevTag) { o = walk.peel(o); if (o instanceof RevCommit) { if (!o.has(WANT)) { o.add(WANT); wantAll.add(o); } } } } else { throw new PackProtocolException(MessageFormat.format( JGitText.get().notValid, o.name())); } } } finally { q.release(); } }