auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public final Object invoke(Object object, Object[] arguments) { try { AccessPermissionChecker.checkAccessPermission(cachedMethod); } catch (AccessControlException ex) { throw new InvokerInvocationException(new IllegalArgumentException("Illegal access to method" + cachedMethod.getName())); } try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException e) { throw new InvokerInvocationException(e); } catch (IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw (cause instanceof RuntimeException && !(cause instanceof MissingMethodException)) ? (RuntimeException) cause : new InvokerInvocationException(e); } }

Target:
public final Object invoke(Object object, Object[] arguments) { try { AccessPermissionChecker.checkAccessPermission(cachedMethod); } catch (CacheAccessControlException ex) { throw new InvokerInvocationException(ex); } try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException e) { throw new InvokerInvocationException(e); } catch (IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw (cause instanceof RuntimeException && !(cause instanceof MissingMethodException)) ? (RuntimeException) cause : new InvokerInvocationException(e); } }
Source:
void close() { webSocketConnection.getWebSocketListener().onOpen(webSocket); requiresCloseAction(); webSocketConnection.close(); verify(webSocket) .sendClose(WebSocket.NORMAL_CLOSURE, WebSocketConnection.CLIENT_DISCONNECT_MESSAGE); assertThat(webSocketConnection.getPingSender().isRunning(), is(false)); }

Target:
void close() { webSocketConnection.getInternalListener().onOpen(webSocket); when(webSocket.sendClose(anyInt(), any())) .thenReturn(CompletableFuture.completedFuture(null)); webSocketConnection.close(); verify(webSocket).sendClose(eq(WebSocket.NORMAL_CLOSURE), any()); assertThat(webSocketConnection.getPingSender().isRunning(), is(false)); }
Source:
protected void executeCommand() { if (maxServerFound() && StringUtils.isEmpty(getCluster().getCpuName())) { updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); } if (maxServerFound() && !architecturesMatch() ) { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (!cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }

Target:
protected void executeCommand() { updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); if (maxServerFound() && !architecturesMatch() ) { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (vdsContainsFlags() && !cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(MediaType.APPLICATION_JSON); resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); List<AssetFilter> filters = new ArrayList<>(); filters.add(new AssetFilter("state", Arrays.asList(new Condition[] { new Condition(Operation.EQUALS, "published") }))); int assetCount = serviceLayer.countAllAssets(filters, null); JsonObjectBuilder frontPageJsonBuilder = getJsonObjectBuilder(); frontPageJsonBuilder.add("serverName", "LARS"); frontPageJsonBuilder.add("assetCount", assetCount); JsonObject frontPageJsonObject = frontPageJsonBuilder.build(); PrintWriter out = resp.getWriter(); out.print(frontPageJsonObject); }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(MediaType.APPLICATION_JSON); resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); PrintWriter printWriter = resp.getWriter(); List<AssetFilter> filters = new ArrayList<>(); filters.add(new AssetFilter("state", Arrays.asList(new Condition[] { new Condition(Operation.EQUALS, "published") }))); int assetCount = serviceLayer.countAllAssets(filters, null); JsonGenerator frontPageJsonGenerator = new JsonFactory().createGenerator(printWriter); frontPageJsonGenerator.setPrettyPrinter(new DefaultPrettyPrinter()); frontPageJsonGenerator.writeStartObject(); frontPageJsonGenerator.writeStringField("serverName", "LARS"); frontPageJsonGenerator.writeNumberField("assetCount", assetCount); frontPageJsonGenerator.writeEndObject(); frontPageJsonGenerator.flush(); frontPageJsonGenerator.close(); }
Source:
public StartIdentifiedAtlasDbTransactionResponse startIdentifiedAtlasDbTransaction() { LockImmutableTimestampResponse immutableTimestamp = lockImmutableTimestamp(); try { return StartIdentifiedAtlasDbTransactionResponse.of( immutableTimestamp, TimestampAndPartition.of(getFreshTimestamp(), 0)); } catch (Throwable throwable) { unlock(ImmutableSet.of(immutableTimestamp.getLock())); throw Throwables.throwUncheckedException(throwable); } }

Target:
public StartIdentifiedAtlasDbTransactionResponse startIdentifiedAtlasDbTransaction() { LockImmutableTimestampResponse immutableTimestamp = lockImmutableTimestamp(); try { return StartIdentifiedAtlasDbTransactionResponse.of( immutableTimestamp, TimestampAndPartition.of(getFreshTimestamp(), 0)); } catch (RuntimeException | Error throwable) { try { unlock(ImmutableSet.of(immutableTimestamp.getLock())); } catch (Throwable unlockThrowable) { throwable.addSuppressed(unlockThrowable); } throw throwable; } }
Source:
public EventResult onDamage(DamageEvent event, EntityRef entity) { if (event.getDamage() <= 0) { return EventResult.CONTINUE; } if (entity.getComponent(Health.class).isPresent()) { Health health = entity.getComponent(Health.class).get(); int newHealthAmount = health.currentHealth - event.getDamage(); if (newHealthAmount < 0) { newHealthAmount = 0; } health.currentHealth = newHealthAmount; entity.setComponent(health); if (health.currentHealth <= 0) { entitySystemManager.sendEvent(new DestroyEvent(), entity); } } return EventResult.CONTINUE; }

Target:
public EventResult onDamage(DamageEvent event, EntityRef entity) { if (event.getDamage() <= 0) { return EventResult.CONTINUE; } if (entity.getComponent(Health.class).isPresent()) { Health health = entity.getComponent(Health.class).get(); health.currentHealth -= event.getDamage(); if (health.currentHealth <= 0) { health.currentHealth = 0; entity.setComponent(health); entitySystemManager.sendEvent(new ZeroHealthEvent(), entity); } else { entity.setComponent(health); } } return EventResult.CONTINUE; }
Source:
public void testClearBlockCacheFromAsyncAdmin() throws Exception { AsyncConnection conn = ConnectionFactory.createAsyncConnection(HTU.getConfiguration()).get(); AsyncAdmin admin = conn.getAdmin(); BlockCache blockCache1 = rs1.getBlockCache().get(); BlockCache blockCache2 = rs2.getBlockCache().get(); long initialBlockCount1 = blockCache1.getBlockCount(); long initialBlockCount2 = blockCache2.getBlockCount(); scanAllRegionsForRS(rs1); assertEquals(blockCache1.getBlockCount() - initialBlockCount1, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache2.getBlockCount() - initialBlockCount2, HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME).get(); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU .getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount1, blockCache1.getBlockCount()); assertEquals(initialBlockCount2, blockCache2.getBlockCount()); conn.close(); }

Target:
public void testClearBlockCacheFromAsyncAdmin() throws Exception { try (AsyncConnection conn = ConnectionFactory.createAsyncConnection(HTU.getConfiguration()) .get()) { AsyncAdmin admin = conn.getAdmin(); BlockCache blockCache1 = rs1.getBlockCache().get(); BlockCache blockCache2 = rs2.getBlockCache().get(); long initialBlockCount1 = blockCache1.getBlockCount(); long initialBlockCount2 = blockCache2.getBlockCount(); scanAllRegionsForRS(rs1); assertEquals(blockCache1.getBlockCount() - initialBlockCount1, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache2.getBlockCount() - initialBlockCount2, HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME).get(); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU .getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount1, blockCache1.getBlockCount()); assertEquals(initialBlockCount2, blockCache2.getBlockCount()); } }
Source:
public BigtableSession(BigtableOptions options) throws IOException { this (options, null); }

Target:
public BigtableSession(BigtableOptions options) throws IOException { this (options, null, null, null); }
Source:
private static AllergyIntolerance.AllergyIntoleranceCriticality buildCriticality(Allergy allergy) { if (allergy.getSeverity() != null) { if (allergy.getSeverity().equals(AllergySeverity.MILD)) { return AllergyIntolerance.AllergyIntoleranceCriticality.LOW; } else if (allergy.getSeverity().equals(AllergySeverity.MODERATE)) { return AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; } else if (allergy.getSeverity().equals(AllergySeverity.SEVERE)) { return AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; } else { return AllergyIntolerance.AllergyIntoleranceCriticality.NULL; } } return null; }

Target:
private static AllergyIntolerance.AllergyIntoleranceCriticality buildCriticality(Allergy allergy) { if (allergy.getSeverity() != null) { switch (allergy.getSeverity()) { case MILD: return AllergyIntolerance.AllergyIntoleranceCriticality.LOW; case MODERATE: return AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; case SEVERE: return AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; default: return AllergyIntolerance.AllergyIntoleranceCriticality.NULL; } } return null; }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((scope == null) ? 0 : scope.hashCode()); result = prime * result + ((doneAt == null) ? 0 : doneAt.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(scope, doneAt); }
Source:
public Long getUuid() { return new Long(456); }

Target:
public Long getUuid() { return Long.valueOf(456); }
Source:
public List<Tuple> getTuples() { ArrayList<Tuple> tuples = new ArrayList<Tuple>(); if ( rows.size() > 0 ) { for ( Row row : rows ) { tuples.add( new Tuple( new CouchDBTupleSnapshot( row.getValue().getProperties() ) ) ); } } return tuples; }

Target:
public List<Tuple> getTuples() { List<Tuple> tuples = new ArrayList<Tuple>( rows.size() ); if ( rows.size() > 0 ) { for ( Row row : rows ) { tuples.add( new Tuple( new CouchDBTupleSnapshot( row.getValue().getProperties() ) ) ); } } return tuples; }
Source:
String generateNewAnonID() { String uuid = UUID.randomUUID().toString(); String[] uuidSplitted = uuid.split("-"); StringBuilder builder = new StringBuilder(); for (String currentPart : uuidSplitted) { builder.append(currentPart); } uuid = builder.toString(); AppLog.d(AppLog.T.STATS, "New anonID generated in " + this.getClass().getSimpleName() + ": " + uuid); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); final SharedPreferences.Editor editor = preferences.edit(); editor.putString(getAnonIdPrefKey(), uuid); editor.commit(); mAnonID = uuid; return uuid; }

Target:
String generateNewAnonID() { String uuid = UUID.randomUUID().toString().replace("-", ""); AppLog.d(AppLog.T.STATS, "New anonID generated in " + this.getClass().getSimpleName() + ": " + uuid); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); final SharedPreferences.Editor editor = preferences.edit(); editor.putString(getAnonIdPrefKey(), uuid); editor.commit(); mAnonID = uuid; return uuid; }
Source:
public JoypadHandler(int index) { controller = Controllers.getController(index); buttonCount = controller.getButtonCount(); axisCount = controller.getAxisCount(); itemCount = controller.getButtonCount() + controller.getAxisCount() + 2; for (int i=0;i<controller.getButtonCount();i++) { addButton(new Button(controller.getButtonName(i), controller, i)); } for (int i=buttonCount;i<buttonCount+controller.getAxisCount();i++) { addAxis(new Axis(controller.getAxisName(i-buttonCount), controller, i)); } int i = itemCount - 2; addAxis(new Axis("POV X", controller, i)); i = itemCount - 1; addAxis(new Axis("POV Y", controller, i)); }

Target:
public JoypadHandler(int index) { controller = Controllers.getController(index); buttonCount = controller.getButtonCount(); buttons = new Button[buttonCount]; axisCount = controller.getAxisCount(); axes = new Axis[axisCount + 2]; itemCount = controller.getButtonCount() + controller.getAxisCount() + 2; for (int i=0;i<buttonCount;i++) { buttons[i] = new Button(controller.getButtonName(i), controller, i); } for (int i=0;i<axisCount;i++) { axes[i] = new Axis(controller.getAxisName(i), controller, i + buttonCount); } axes[axisCount] = new Axis("POV X", controller, axisCount + buttonCount); axes[axisCount+1] = new Axis("POV Y", controller, axisCount + 1 + buttonCount); }
Source:
private void loadPage(String data) { mWebViewOnUiThread.loadDataWithBaseURLAndWaitForCompletion( BASE_URI, data, "text/html", "UTF-8", null); }

Target:
private void loadPage(String data) { mWebViewOnUiThread.loadDataWithBaseURLAndWaitForCompletion( BASE_URI, data, "text/html", null, null); }
Source:
public void testClusterCacheTest() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); Cache<Object, Object> cache = manager(0).administration().createCache("a", configuration); waitForClusterToForm("a"); assertEquals(cacheManagers.size(), cache.getAdvancedCache().getRpcManager().getMembers().size()); checkConsistencyAcrossCluster("a", configuration); addClusterEnabledCacheManager(); checkConsistencyAcrossCluster("a", configuration); try { manager(0).administration().createCache("b", "nonExistingTemplate"); fail("Should not succed in creating a cache with a non-existing template"); } catch (CacheConfigurationException e) { } try { manager(0).administration().createCache("a", configuration); fail("Should not have allowed creation of existing cache"); } catch (CacheConfigurationException e) { } manager(0).administration().getOrCreateCache("a", configuration); manager(1).administration().removeCache("a"); checkCacheExistenceAcrossCluster("a", false); addClusterEnabledCacheManager(); checkCacheExistenceAcrossCluster("a", false); }

Target:
public void testClusterCacheTest() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); Cache<Object, Object> cache = manager(0).administration().createCache("a", configuration); waitForClusterToForm("a"); assertEquals(cacheManagers.size(), cache.getAdvancedCache().getRpcManager().getMembers().size()); checkConsistencyAcrossCluster("a", configuration); addClusterEnabledCacheManager(); checkConsistencyAcrossCluster("a", configuration); Exceptions.expectException(CacheConfigurationException.class, "ISPN000374: No such template 'b' when declaring 'nonExistingTemplate'", () -> manager(0).administration().createCache("b", "nonExistingTemplate")); Exceptions.expectException(CacheConfigurationException.class, "ISPN000507: Cache a already exists", () -> manager(0).administration().createCache("a", configuration)); manager(0).administration().getOrCreateCache("a", configuration); manager(1).administration().removeCache("a"); checkCacheExistenceAcrossCluster("a", false); addClusterEnabledCacheManager(); checkCacheExistenceAcrossCluster("a", false); }
Source:
protected <K> LocalStreamManager<K> waitUntilSendingResponse(final Cache<?, ?> cache, final CheckPoint checkPoint) { return Mocks.blockingMock(checkPoint, LocalStreamManager.class, cache, (stub, m) -> stub.when(m).startIterator(any(), any(), any(), any(), any(), anyBoolean(), any(), anyLong())); }

Target:
protected <K> void waitUntilSendingResponse(final Cache<?, ?> cache, final CheckPoint checkPoint) { Mocks.blockingMock(checkPoint, LocalStreamManager.class, cache, (stub, m) -> stub.when(m).startIterator(any(), any(), any(), any(), any(), anyBoolean(), any(), anyLong())); }
Source:
public ContractInput toContractInput() { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); contractInput.setName(field.getName()); contractInput.setType(toContractInputType()); contractInput.setMultiple(field.isCollection()); contractInput.setMandatory(!field.isNullable()); return contractInput; }

Target:
public ContractInput toContractInput() { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); contractInput.setName(field.getName()); contractInput.setType(toContractInputType()); setMultiple(contractInput); setMandatory(contractInput); return contractInput; }
Source:
private void handleNewFile(final String fileName) { mHandler.postDelayed( new Runnable() { @Override public void run() { mInstantUploadsHandler.handleNewFile(fileName, mConfiguration, mContext); } }, HANDLE_DELAY_IN_MS ); }

Target:
private void handleNewFile(final String fileName) { mInstantUploadsHandler.handleNewFile(fileName, mConfiguration, mContext); }
Source:
protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) { ArrayList<String> pathStrings = new ArrayList<>(); for (Path path : srcs) { pathStrings.add(path.toString()); } if (pathStrings.size() > 0) { ImmutableList.Builder<String> commandBuilder = ImmutableList.<String>builder() .addAll(compilerCommandPrefix) .add("-p", packageName.toString()) .add("-pack") .add("-trimpath", workingDirectory.toString()) .add("-nolocalimports") .addAll(flags) .add("-o", output.toString()); for (Path dir : includeDirectories) { commandBuilder.add("-I", dir.toString()); } for (Map.Entry<Path, Path> importMap : importPathMap.entrySet()) { commandBuilder.add("-importmap", importMap.getKey() + "=" + importMap.getValue()); } if (asmHeaderPath.isPresent()) { commandBuilder.add("-asmhdr", asmHeaderPath.get().toString()); } if (!allowExternalReferences) { commandBuilder.add("-complete"); } commandBuilder.addAll(pathStrings); return commandBuilder.build(); } else { return ImmutableList.of("echo", "No source files found in " + workingDirectory); } }

Target:
protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) { ArrayList<String> pathStrings = new ArrayList<>(); for (Path path : srcs) { pathStrings.add(path.toString()); } if (pathStrings.size() > 0) { ImmutableList.Builder<String> commandBuilder = ImmutableList.<String>builder() .addAll(compilerCommandPrefix) .add("-p", packageName.toString()) .add("-pack") .add("-trimpath", workingDirectory.toString()) .add("-nolocalimports") .addAll(flags) .add("-o", output.toString()); for (Path dir : includeDirectories) { commandBuilder.add("-I", dir.toString()); } for (Map.Entry<Path, Path> entry : importPathMap.entrySet()) { commandBuilder.add("-importmap", entry.getKey() + "=" + entry.getValue()); } if (asmHeaderPath.isPresent()) { commandBuilder.add("-asmhdr", asmHeaderPath.get().toString()); } if (!allowExternalReferences) { commandBuilder.add("-complete"); } commandBuilder.addAll(pathStrings); return commandBuilder.build(); } else { LOG.warn("No source files found in " + workingDirectory); return ImmutableList.of(); } }
Source:
public void store(String key, Object value) { LOGGER.trace("Entering: store - key: {}", key); try (OutputStream file = new FileOutputStream(getMapStoreFilePath(key).toFile()); OutputStream buffer = new BufferedOutputStream(file); ObjectOutput output = new ObjectOutputStream(buffer)) { LOGGER.debug("file name: {}/{}{}", persistencePath, key, SER); output.writeObject(value); } catch (IOException e) { LOGGER.debug("IOException storing value in cache with key = " + key, e); } LOGGER.trace("Exiting: store"); }

Target:
public void store(String key, Object value) { LOGGER.trace("Entering: store - key: {}", key); try (ObjectOutput output = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(getMapStoreFile(key))))) { LOGGER.debug("file name: {}/{}{}", persistencePath, key, EXT); output.writeObject(value); } catch (IOException e) { LOGGER.debug("IOException storing value in cache with key = " + key, e); } LOGGER.trace("Exiting: store"); }
Source:
public void activateHoverHelp(final Control control) { control.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseHover(MouseEvent event) { if (Display.getDefault().getFocusControl() == null || (event.stateMask & SWT.BUTTON_MASK) != 0 || (event.stateMask & SWT.KEY_MASK) != 0) { return; } Point pt = new Point(event.x, event.y); Control timeGraphControl = (Control) event.widget; Point ptInDisplay = control.toDisplay(event.x, event.y); fInitialDeadzone = new Rectangle(ptInDisplay.x - MOUSE_DEADZONE, ptInDisplay.y - MOUSE_DEADZONE, 2 * MOUSE_DEADZONE, 2 * MOUSE_DEADZONE); createTooltipShell(timeGraphControl.getShell()); for (Control child : fTipViewer.getChildren()) { child.dispose(); } fToolTipContent.append("<body><table>"); fill(control, event, pt); fToolTipContent.append("</table></body>"); String html = fToolTipContent.toString(); if (elementCount == 0) { return; } fTipViewer.setText(html); fTipShell.setLayout(new FillLayout()); fTipShell.setSize(Math.min(longestString * 12, 440), Math.min(500, elementCount * 22 + 24)); Point tipPosition = control.toDisplay(pt); setHoverLocation(fTipShell, tipPosition); fTipShell.setVisible(true); Display display = Display.getDefault(); display.addFilter(SWT.MouseMove, fListener); display.addFilter(SWT.FocusOut, fFocusLostListener); } }); }

Target:
public void activateHoverHelp(final Control control) { control.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseHover(MouseEvent event) { if (Display.getDefault().getFocusControl() == null || (event.stateMask & SWT.BUTTON_MASK) != 0 || (event.stateMask & SWT.KEY_MASK) != 0) { return; } Point pt = new Point(event.x, event.y); Control timeGraphControl = (Control) event.widget; Point ptInDisplay = control.toDisplay(event.x, event.y); fInitialDeadzone = new Rectangle(ptInDisplay.x - MOUSE_DEADZONE, ptInDisplay.y - MOUSE_DEADZONE, 2 * MOUSE_DEADZONE, 2 * MOUSE_DEADZONE); createTooltipShell(timeGraphControl.getShell()); fToolTipContent.append("<body><table>"); fill(control, event, pt); fToolTipContent.append("</table></body>"); String html = fToolTipContent.toString(); if (fElementCount == 0) { return; } fTipViewer.setText(html); fTipShell.setLayout(new FillLayout()); int w = fLongestString * 12 + 12; int h = fElementCount * 23 + 24; fTipShell.setSize(Math.min(w, 440), Math.min(700, h)); Point tipPosition = control.toDisplay(pt); setHoverLocation(fTipShell, tipPosition); fTipShell.setVisible(true); Display display = Display.getDefault(); display.addFilter(SWT.MouseMove, fListener); display.addFilter(SWT.FocusOut, fFocusLostListener); } }); }
Source:
private Vm bestFitCloudletToVmMapper(final Cloudlet cloudlet) { if (cloudlet.isBindToVm()) { if(broker0.getVmExecList().contains(cloudlet.getVm())) { return cloudlet.getVm(); } return Vm.NULL; } return cloudlet .getBroker() .getVmCreatedList() .stream() .filter(vm -> vm.getNumberOfPes() >= cloudlet.getNumberOfPes()) .min(Comparator.comparingLong(Vm::getNumberOfPes)) .orElse(broker0.getDefaultVmMapper().apply(cloudlet)); }

Target:
private Vm bestFitCloudletToVmMapper(final Cloudlet cloudlet) { if (cloudlet.isBindToVm()) { if(broker0.equals(cloudlet.getVm().getBroker()) && cloudlet.getVm().isCreated()) { return cloudlet.getVm(); } } return cloudlet .getBroker() .getVmCreatedList() .stream() .filter(vm -> vm.getNumberOfPes() >= cloudlet.getNumberOfPes()) .min(Comparator.comparingLong(Vm::getNumberOfPes)) .orElse(broker0.defaultVmMapper(cloudlet)); }
Source:
public void testCustomDeliveryOverride() { Context context = ApplicationProvider.getApplicationContext(); config = generateConfiguration(); Delivery customDelivery = new Delivery() { @NotNull @Override public DeliveryStatus deliver(@NotNull EventPayload report, @NotNull DeliveryParams deliveryParams) { return DeliveryStatus.DELIVERED; } @NotNull @Override public DeliveryStatus deliver(@NotNull SessionPayload payload, @NotNull DeliveryParams deliveryParams) { return DeliveryStatus.DELIVERED; } }; config.setDelivery(customDelivery); client = new Client(context, config); assertEquals(customDelivery, client.getConfig().getDelivery()); }

Target:
public void testCustomDeliveryOverride() { Context context = ApplicationProvider.getApplicationContext(); config = generateConfiguration(); Delivery customDelivery = new Delivery() { @NotNull @Override public DeliveryStatus deliver(@NotNull EventPayload payload, @NotNull DeliveryParams deliveryParams) { return DeliveryStatus.DELIVERED; } @NotNull @Override public DeliveryStatus deliver(@NotNull SessionPayload payload, @NotNull DeliveryParams deliveryParams) { return DeliveryStatus.DELIVERED; } }; config.setDelivery(customDelivery); client = new Client(context, config); assertEquals(customDelivery, client.getConfig().getDelivery()); }
Source:
public int compare(AbstractComponent o1, AbstractComponent o2) { if(o1.getComponentId() == null) { if(o2.getComponentId() == null) return 0; else return -1; } else { if(o2.getComponentId() == null) return 1; else return o1.getComponentId().compareTo(o2.getComponentId()); } }

Target:
public int compare(AbstractComponent o1, AbstractComponent o2) { if (o1.getComponentId() == null) { if (o2.getComponentId() == null) { return 0; } else { return -1; } } else { if (o2.getComponentId() == null) { return 1; } else { return o1.getComponentId().compareTo(o2.getComponentId()); } } }
Source:
public Blob getBlobFromJSON(ObjectNode jsonObject) { Blob blob = null; if (!jsonObject.has("upload-batch")) { return null; } final String batchId = jsonObject.get("upload-batch").textValue(); String fileId = null; if (jsonObject.has("upload-fileId")) { fileId = jsonObject.get("upload-fileId").textValue(); } if (fileId != null) { BatchManager bm = Framework.getService(BatchManager.class); Batch batch = bm.getBatch(batchId); if (batchId == null) { return null; } blob = batch.getBlob(fileId); if (RequestContext.getActiveContext() != null) { final boolean drop = !Boolean.parseBoolean( RequestContext.getActiveContext().getRequest().getHeader(BatchManagerConstants.NO_DROP_FLAG)); if (drop) { RequestContext.getActiveContext().addRequestCleanupHandler(new RequestCleanupHandler() { @Override public void cleanup(HttpServletRequest request) { BatchManager bm = Framework.getService(BatchManager.class); bm.clean(batchId); } }); } } } return blob; }

Target:
public Blob getBlobFromJSON(ObjectNode jsonObject) { Blob blob = null; if (!jsonObject.has("upload-batch")) { return null; } final String batchId = jsonObject.get("upload-batch").textValue(); String fileId = null; if (jsonObject.has("upload-fileId")) { fileId = jsonObject.get("upload-fileId").textValue(); } if (fileId != null) { BatchManager bm = Framework.getService(BatchManager.class); Batch batch = bm.getBatch(batchId); if (batch == null) { return null; } blob = batch.getBlob(fileId); if (RequestContext.getActiveContext() != null) { final boolean drop = !Boolean.parseBoolean( RequestContext.getActiveContext().getRequest().getHeader(BatchManagerConstants.NO_DROP_FLAG)); if (drop) { RequestContext.getActiveContext().addRequestCleanupHandler(new RequestCleanupHandler() { @Override public void cleanup(HttpServletRequest request) { BatchManager bm = Framework.getService(BatchManager.class); bm.clean(batchId); } }); } } } return blob; }
Source:
Server(String id) { this.id = id; EnumSet<Language> languagesDisabledByDefault = EnumSet.of(Language.TS, Language.JAVA, Language.CPP); EnumSet<Language> enabledLanguages = EnumSet.complementOf(languagesDisabledByDefault); Collection<IAnalysisConfigurator> configurators = SonarLintCorePlugin.getExtensionTracker().getAnalysisConfigurators(); for (IAnalysisConfigurator configurator : configurators) { enabledLanguages.addAll(configurator.whitelistedLanguages()); } ConnectedGlobalConfiguration globalConfig = ConnectedGlobalConfiguration.builder() .setServerId(getId()) .setWorkDir(StoragePathManager.getServerWorkDir(getId())) .setStorageRoot(StoragePathManager.getServerStorageRoot()) .setLogOutput(new SonarLintAnalyzerLogOutput()) .addEnabledLanguages(enabledLanguages.toArray(new Language[0])) .build(); this.client = new ConnectedSonarLintEngineImpl(globalConfig); this.client.addStateListener(this); this.updateStatus = client.getGlobalStorageStatus(); if (client.getState().equals(State.UPDATED)) { reloadProjects(); } }

Target:
Server(String id) { this.id = id; EnumSet<Language> languagesDisabledByDefault = EnumSet.of(Language.TS, Language.JAVA, Language.CPP, Language.C, Language.OBJC, Language.SWIFT); EnumSet<Language> enabledLanguages = EnumSet.complementOf(languagesDisabledByDefault); Collection<IAnalysisConfigurator> configurators = SonarLintExtensionTracker.getInstance().getAnalysisConfigurators(); for (IAnalysisConfigurator configurator : configurators) { enabledLanguages.addAll(configurator.whitelistedLanguages()); } ConnectedGlobalConfiguration globalConfig = ConnectedGlobalConfiguration.builder() .setServerId(getId()) .setWorkDir(StoragePathManager.getServerWorkDir(getId())) .setStorageRoot(StoragePathManager.getServerStorageRoot()) .setLogOutput(new SonarLintAnalyzerLogOutput()) .addEnabledLanguages(enabledLanguages.toArray(new Language[0])) .build(); this.client = new ConnectedSonarLintEngineImpl(globalConfig); this.client.addStateListener(this); this.updateStatus = client.getGlobalStorageStatus(); if (client.getState().equals(State.UPDATED)) { reloadProjects(); } }
Source:
private static final void loadIcons() { vehicle_type_icons.put(ObaRoute.TYPE_BUS, createBusIcons()); vehicle_type_icons.put(ObaRoute.TYPE_FERRY, createFerryIcons()); vehicle_type_icons.put(ObaRoute.TYPE_TRAM, createTramIcons()); vehicle_type_icons.put(ObaRoute.TYPE_SUBWAY, createSubwayIcons()); vehicle_type_icons.put(ObaRoute.TYPE_RAIL, createRailIcons()); final int MAX_CACHE_SIZE = 15; if (mVehicleColoredIconCache == null) { mVehicleColoredIconCache = new LruCache<>(MAX_CACHE_SIZE); } }

Target:
private static final void loadIcons() { if (vehicle_type_icons.isEmpty()) { vehicle_type_icons.put(ObaRoute.TYPE_BUS, createBusIcons()); vehicle_type_icons.put(ObaRoute.TYPE_FERRY, createFerryIcons()); vehicle_type_icons.put(ObaRoute.TYPE_TRAM, createTramIcons()); vehicle_type_icons.put(ObaRoute.TYPE_SUBWAY, createSubwayIcons()); vehicle_type_icons.put(ObaRoute.TYPE_RAIL, createRailIcons()); } final int MAX_CACHE_SIZE = 15; if (mVehicleColoredIconCache == null) { mVehicleColoredIconCache = new LruCache<>(MAX_CACHE_SIZE); } }
Source:
public static MassRepairOption parseFromXML(Node mroNode) { MassRepairOption mro = new MassRepairOption(-1); NodeList mroItemList = mroNode.getChildNodes(); for (int mroItemIdx = 0; mroItemIdx < mroItemList.getLength(); mroItemIdx++) { Node mroItemNode = mroItemList.item(mroItemIdx); if (mroItemNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if (mroItemNode.getNodeName().equalsIgnoreCase("type")) { mro.setType(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("active")) { mro.setActive(Integer.parseInt(mroItemNode.getTextContent().trim()) == 1); } else if (mroItemNode.getNodeName().equalsIgnoreCase("skillMin")) { mro.setSkillMin(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("skillMax")) { mro.setSkillMax(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("btnMin")) { mro.setBthMin(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("btnMax")) { mro.setBthMax(Integer.parseInt(mroItemNode.getTextContent().trim())); } MekHQ.getLogger().info(String.format("massRepairOption %d.%s\n\t%s", mro.getType(), mroItemNode.getNodeName(), mroItemNode.getTextContent())); } return mro; }

Target:
public static MassRepairOption parseFromXML(Node mroNode) { MassRepairOption mro = new MassRepairOption(-1); NodeList mroItemList = mroNode.getChildNodes(); for (int mroItemIdx = 0; mroItemIdx < mroItemList.getLength(); mroItemIdx++) { Node mroItemNode = mroItemList.item(mroItemIdx); if (mroItemNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if (mroItemNode.getNodeName().equalsIgnoreCase("type")) { mro.setType(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("active")) { mro.setActive(Integer.parseInt(mroItemNode.getTextContent().trim()) == 1); } else if (mroItemNode.getNodeName().equalsIgnoreCase("skillMin")) { mro.setSkillMin(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("skillMax")) { mro.setSkillMax(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("btnMin")) { mro.setBthMin(Integer.parseInt(mroItemNode.getTextContent().trim())); } else if (mroItemNode.getNodeName().equalsIgnoreCase("btnMax")) { mro.setBthMax(Integer.parseInt(mroItemNode.getTextContent().trim())); } MekHQ.getLogger().debug(String.format("massRepairOption %d.%s\n\t%s", mro.getType(), mroItemNode.getNodeName(), mroItemNode.getTextContent())); } return mro; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); String url = ((HttpServletRequest) request).getRequestURI(); if (isBackupFinishJsonUrl(url)) { response.setContentType("application/json"); JsonObject json = new JsonObject(); json.addProperty("is_backup_finished", backupService.isBackingUp()); response.getWriter().print(json); return; } if (backupService.isBackingUp()) { ((HttpServletResponse) response).setHeader("Cache-Control", "private, max-age=0, no-cache"); ((HttpServletResponse) response).setDateHeader("Expires", 0); if (isAPIUrl(url) && !isMessagesJson(url)) { generateAPIResponse(request, response); } else { try { generateHTMLResponse(response); } catch (Exception e) { e.printStackTrace(); } } return; } else { chain.doFilter(request, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (backupService == null) { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); } String url = ((HttpServletRequest) request).getRequestURI(); if (isBackupFinishJsonUrl(url)) { ((HttpServletResponse) response).setHeader("Cache-Control", "private, max-age=0, no-cache"); ((HttpServletResponse) response).setDateHeader("Expires", 0); generateResponseForIsBackupFinishedAPI(response); return; } if (backupService.isBackingUp()) { ((HttpServletResponse) response).setHeader("Cache-Control", "private, max-age=0, no-cache"); ((HttpServletResponse) response).setDateHeader("Expires", 0); if (isAPIUrl(url) && !isMessagesJson(url)) { generateAPIResponse(request, response); } else { generateHTMLResponse(response); } } else { chain.doFilter(request, response); } }
Source:
public static SegmentLoader makeDefaultQueryableLoader( final ConfigurationObjectFactory configFactory, final Properties props ) throws S3ServiceException { SegmentLoaderConfig config = configFactory.build(SegmentLoaderConfig.class); DelegatingSegmentLoader delegateLoader = new DelegatingSegmentLoader(); final QueryableIndexFactory factory = new MMappedQueryableIndexFactory(); SingleSegmentLoader s3segmentLoader= null; try { final RestS3Service s3Client = new RestS3Service( new AWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey") ) ); final S3DataSegmentPuller segmentGetter = new S3DataSegmentPuller(s3Client); s3segmentLoader = new SingleSegmentLoader(segmentGetter, factory, config); } catch (com.metamx.common.ISE ise){ log.warn("Could not create s3Client.", ise); } Map<String, SegmentLoader> loaderTypes = new HashMap<String, SegmentLoader>(); loaderTypes.put("local", new SingleSegmentLoader(new LocalDataSegmentPuller(), factory, config)); loaderTypes.put("hdfs", new SingleSegmentLoader(new HdfsDataSegmentPuller(new Configuration()), factory, config)); loaderTypes.put("c*", new SingleSegmentLoader(new CassandraDataSegmentPuller(configFactory.build(CassandraDataSegmentConfig.class)), factory, config)); if (s3segmentLoader != null){ loaderTypes.put("s3", s3segmentLoader); loaderTypes.put("s3_zip", s3segmentLoader); } delegateLoader.setLoaderTypes( ImmutableMap.<String, SegmentLoader>copyOf(loaderTypes) ); return delegateLoader; }

Target:
public static SegmentLoader makeDefaultQueryableLoader( final ConfigurationObjectFactory configFactory, final Properties props ) throws S3ServiceException { SegmentLoaderConfig config = configFactory.build(SegmentLoaderConfig.class); DelegatingSegmentLoader delegateLoader = new DelegatingSegmentLoader(); final QueryableIndexFactory factory = new MMappedQueryableIndexFactory(); final RestS3Service s3Client = new RestS3Service( new AWSCredentials( props.getProperty("com.metamx.aws.accessKey", ""), props.getProperty("com.metamx.aws.secretKey", "") ) ); final S3DataSegmentPuller segmentGetter = new S3DataSegmentPuller(s3Client); final SingleSegmentLoader s3segmentLoader = new SingleSegmentLoader(segmentGetter, factory, config); delegateLoader.setLoaderTypes( ImmutableMap.<String, SegmentLoader>builder() .put("local", new SingleSegmentLoader(new LocalDataSegmentPuller(), factory, config)) .put("hdfs", new SingleSegmentLoader(new HdfsDataSegmentPuller(new Configuration()), factory, config)) .put("s3", s3segmentLoader) .put("s3_zip", s3segmentLoader) .put("c*",new SingleSegmentLoader(new CassandraDataSegmentPuller(configFactory.build(CassandraDataSegmentConfig.class)), factory, config)) .build() ); return delegateLoader; }
Source:
public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + successCount1.hashCode(); result = 31 * result + sample1Size.hashCode(); result = 31 * result + successCount2.hashCode(); result = 31 * result + sample2Size.hashCode(); return result; }

Target:
public int hashCode() { int result = name.hashCode(); result = 31 * result + successCount1.hashCode(); result = 31 * result + sample1Size.hashCode(); result = 31 * result + successCount2.hashCode(); result = 31 * result + sample2Size.hashCode(); return result; }
Source:
protected void initBinder(WebDataBinder binder) { binder.setValidator(appointmentValidator); }

Target:
private void initBinder(WebDataBinder binder) { binder.setValidator(validator); }
Source:
public void testCouldUseFlatGlob() throws IOException, URISyntaxException { Configuration lazyConf = new Configuration(); lazyConf.set(GCS_LAZY_INITIALIZATION_ENABLE.getKey(), "true"); GoogleHadoopFileSystem lazyFs = new GoogleHadoopFileSystem(); assertThat(lazyFs.couldUseFlatGlob(new Path(new URI("gs:/ test/")))).isFalse(); lazyFs.close(); }

Target:
public void testCouldUseFlatGlob() throws IOException, URISyntaxException { Configuration lazyConf = new Configuration(); lazyConf.setBoolean(GCS_LAZY_INITIALIZATION_ENABLE.getKey(), true); GoogleHadoopFileSystem lazyFs = new GoogleHadoopFileSystem(); assertThat(lazyFs.couldUseFlatGlob(new Path(new URI("gs:/ test/")))).isFalse(); lazyFs.close(); }
Source:
public void getLanguageId_existing_base_expected_non_negative_lang_Test() throws DotSecurityException, DotDataException, SystemException { final Language baseLanguage = new LanguageDataGen().languageCode("fr").countryCode(null).nextPersisted(); final Language frLanguage = new LanguageDataGen().languageCode("fr").countryCode("FR").nextPersisted(); final long expectedBaseId = baseLanguage.getId(); final long expectedFrId = frLanguage.getId(); Logger.info(this, "Testing fr_CR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr_CR")); Logger.info(this, "Testing fr-CR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr-CR")); Logger.info(this, "Testing fr_FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("fr_FR")); Logger.info(this, "Testing FR_CR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("FR_FR")); Logger.info(this, "Testing fr-FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("fr-FR")); Logger.info(this, "Testing FR-FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("FR-FR")); Logger.info(this, "Testing fr"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr")); Logger.info(this, "Testing FR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("FR")); APILocator.getLanguageAPI().deleteLanguage(baseLanguage); APILocator.getLanguageAPI().deleteLanguage(frLanguage); }

Target:
public void getLanguageId_existing_base_expected_non_negative_lang_Test() throws DotSecurityException, DotDataException, SystemException { final Language baseLanguage = new LanguageDataGen().languageCode("fr").countryCode(null).nextPersisted(); final Language frLanguage = new LanguageDataGen().languageCode("fr").countryCode("FR").nextPersisted(); final long expectedBaseId = baseLanguage.getId(); final long expectedFrId = frLanguage.getId(); Logger.info(this, "Testing fr_CR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr_CR")); Logger.info(this, "Testing fr-CR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr-CR")); Logger.info(this, "Testing fr_FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("fr_FR")); Logger.info(this, "Testing FR_FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("FR_FR")); Logger.info(this, "Testing fr-FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("fr-FR")); Logger.info(this, "Testing FR-FR"); Assert.assertEquals(expectedFrId, LanguageUtil.getLanguageId("FR-FR")); Logger.info(this, "Testing fr"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("fr")); Logger.info(this, "Testing FR"); Assert.assertEquals(expectedBaseId, LanguageUtil.getLanguageId("FR")); APILocator.getLanguageAPI().deleteLanguage(baseLanguage); APILocator.getLanguageAPI().deleteLanguage(frLanguage); }
Source:
private File getSvnPath(File workingDirectory, String label) { File svnPath = new File(workingDirectory, label); if(!svnPath.exists()) { svnPath = new File(workingDirectory, "branches" + File.separator + label); } if(!svnPath.exists()) { svnPath = new File(workingDirectory, "tags" + File.separator + label); } return svnPath; }

Target:
private File getSvnPath(File workingDirectory, String label) { File svnPath = new File(workingDirectory, label); if(!svnPath.exists()) { svnPath = new File(workingDirectory, "branches" + File.separator + label); if(!svnPath.exists()) { svnPath = new File(workingDirectory, "tags" + File.separator + label); if(!svnPath.exists()) { throw new NoSuchLabelException("No label found for: " + label); } } } return svnPath; }
Source:
private Money(Currency currency, BigDecimal amount) { this.currency = currency; this.amount = amount; }

Target:
private Money(Currency currency, BigDecimal amount) { ArgChecker.notNull(currency, "currency"); ArgChecker.notNull(amount, "amount"); this.currency = currency; this.amount = amount; }
Source:
public static void DELETE_SNAPSHOT(String snapshotName) throws Exception { ensureSnapshot(snapshotName, true); LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC(); TransactionController tc = lcc.getTransactionExecute(); DataDictionary dd = lcc.getDataDictionary(); dd.startWriting(lcc); PartitionAdmin admin=SIDriver.driver().getTableFactory().getAdmin(); String sql = String.format( "select conglomeratenumber from sys.syssnapshots where snapshotname='%s'", snapshotName); Connection connection = getDefaultConn(); PreparedStatement ps = connection.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs.next()) { long conglomerateNumber = rs.getLong(1); String sname = snapshotName + "_" + conglomerateNumber; admin.deleteSnapshot(sname); dd.deleteSnapshot(snapshotName, conglomerateNumber, tc); } }

Target:
public static void DELETE_SNAPSHOT(String snapshotName) throws Exception { ensureSnapshot(snapshotName, true); LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC(); TransactionController tc = lcc.getTransactionExecute(); DataDictionary dd = lcc.getDataDictionary(); dd.startWriting(lcc); PartitionAdmin admin=SIDriver.driver().getTableFactory().getAdmin(); String sql = "select conglomeratenumber from sys.syssnapshots where snapshotname=?"; Connection connection = getDefaultConn(); PreparedStatement ps = connection.prepareStatement(sql); ps.setString(1, snapshotName); ResultSet rs = ps.executeQuery(); while (rs.next()) { long conglomerateNumber = rs.getLong(1); String sname = snapshotName + "_" + conglomerateNumber; if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "deleting snapshot %s for table %d", sname, conglomerateNumber); } admin.deleteSnapshot(sname); dd.deleteSnapshot(snapshotName, conglomerateNumber, tc); if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "deleted snapshot %s for table %d", sname, conglomerateNumber); } } }
Source:
public <T> T retryTransaction(final TransactionCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().inTransaction(callback); } }; final Predicate<Throwable> shouldRetry = new Predicate<Throwable>() { @Override public boolean apply(Throwable e) { return isTransientException(e); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public <T> T retryTransaction(final TransactionCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().inTransaction(callback); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }