auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response getDeviceOrganizationParent(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } String result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationParent(deviceId); if (result == null) { String msg = "Device with ID: " + deviceId + " not found."; log.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }

Target:
public Response getDeviceOrganizationParent(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } String result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationParent(deviceId); if (result == null) { String msg = "Device with ID: " + deviceId + " not found."; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device " + "Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }
Source:
MappedStopTimes mapToStopTimes( JourneyPattern journeyPattern, Trip trip, List<TimetabledPassingTime> passingTimes ) { MappedStopTimes result = new MappedStopTimes(); for (int i = 0; i < passingTimes.size(); i++) { TimetabledPassingTime currentPassingTime = passingTimes.get(i); String pointInJourneyPattern = currentPassingTime.getPointInJourneyPatternRef().getValue().getRef(); StopPointInJourneyPattern stopPoint = findStopPoint(pointInJourneyPattern, journeyPattern); Stop stop = lookupStop(stopPoint, quayIdByStopPointRef, stopsById); if (stop == null) { LOG.warn("Stop not found for {}. Trip will not be mapped.", stopPoint != null ? stopPoint.getId() : "null", trip.getId()); return null; } StopTime stopTime = mapToStopTime(trip, stopPoint, stop, currentPassingTime, i); result.add(currentPassingTime.getId(), stopTime); } return result; }

Target:
MappedStopTimes mapToStopTimes( JourneyPattern journeyPattern, Trip trip, List<TimetabledPassingTime> passingTimes ) { MappedStopTimes result = new MappedStopTimes(); for (int i = 0; i < passingTimes.size(); i++) { TimetabledPassingTime currentPassingTime = passingTimes.get(i); String pointInJourneyPattern = currentPassingTime.getPointInJourneyPatternRef().getValue().getRef(); StopPointInJourneyPattern stopPoint = findStopPoint(pointInJourneyPattern, journeyPattern); Stop stop = lookupStop(stopPoint, quayIdByStopPointRef, stopsById); if (stop == null) { LOG.warn("Stop with id not found for StopPoint in JourneyPattern {}. " + "Trip will not be mapped.", stopPoint != null && stopPoint.getScheduledStopPointRef() != null ? stopPoint.getScheduledStopPointRef().getValue().getRef() : "null" , stopPoint != null ? stopPoint.getId() : "null" , journeyPattern.getId() , trip.getId()); return null; } StopTime stopTime = mapToStopTime(trip, stopPoint, stop, currentPassingTime, i); result.add(currentPassingTime.getId(), stopTime); } return result; }
Source:
public void write(String str, int off, int len) throws IOException { if (!transactionActive()) { if (len > 8192) { BufferedOutputStream bos = new BufferedOutputStream(outputStream); OutputStreamWriter writer = new OutputStreamWriter(bos, this.encoding); writer.write(str, off, len); writer.flush(); } else { byte[] bytes = str.substring(off, len).getBytes(encoding); outputStream.write(bytes); } return; } Buffer buffer = getCurrentBuffer(); buffer.append(str, off, len); }

Target:
public void write(String str, int off, int len) throws IOException { if (!transactionActive()) { byte[] bytes = str.substring(off, off + len).getBytes(encoding); int length = bytes.length; ByteBuffer bb = ByteBuffer.wrap(bytes); int bytesWritten = channel.write(bb); if(bytesWritten != length) { throw new IOException("Unable to write all data. Bytes to write: " + len + ". Bytes written: " + bytesWritten); } return; } StringBuilder buffer = getCurrentBuffer(); buffer.append(str, off, len); }
Source:
public String toString() { return "primary=[" + primaryMatcher.pattern() + "] secondary=[" + secondaryMatcher.pattern() + "]"; }

Target:
public String toString() { return String.format("primary=[%s] secondary=[%s]", primaryMatcher.pattern(), secondaryMatcher.pattern()); }
Source:
public void testOpenNewApplicationWizardFromOpenShiftExplorerWithNoProjectsAndCancelNewProject() { LogView logView = new LogView(); logView.open(); logView.deleteLog(); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.reopen(); OpenShift3Connection connection = explorer.getOpenShift3Connection(); connection.select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_OS3_APPLICATION).select();; try { new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); } catch (WaitTimeoutExpiredException ex) { fail("Shell to create a new OpenShift application was supposed to be opened. But it's not."); } new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT); new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName); new CancelButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); checkErrorLog(); logView = new LogView(); logView.open(); logView.deleteLog(); }

Target:
public void testOpenNewApplicationWizardFromOpenShiftExplorerWithNoProjectsAndCancelNewProject() { clearLog(); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.reopen(); OpenShift3Connection connection = explorer.getOpenShift3Connection(); connection.select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_OS3_APPLICATION).select();; try { new WaitUntil(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); } catch (WaitTimeoutExpiredException ex) { fail("Shell to create a new OpenShift application was supposed to be opened. But it's not."); } new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT); new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName); new CancelButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); checkErrorLog(); clearLog(); }
Source:
private long[] generateValuesLong(int bitWidth) { long[] values = new long[32]; for (int j = 0; j < values.length; j++) { values[j] = ((long)(Math.random() * (1l<<32)) * (long)(Math.random() * (1l<<32))) & ((1l << bitWidth) - 1l); } LOG.debug("Input: " + TestBitPacking.toString(values)); return values; }

Target:
private long[] generateValuesLong(int bitWidth) { long[] values = new long[32]; Random random = new Random(0); for (int j = 0; j < values.length; j++) { values[j] = random.nextLong() & ((1l << bitWidth) - 1l); } LOG.debug("Input: " + TestBitPacking.toString(values)); return values; }
Source:
public void onReceive(Context context, Intent intent) { Log.d(TAG, "Unpairing bluetooth devices"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) { @SuppressLint("WrongConstant") Set<BluetoothDevice> bondedBluetoothDevices = ((BluetoothManager) context.getSystemService("bluetooth")).getAdapter().getBondedDevices(); if (bondedBluetoothDevices.size() > 0) { unpairBluetoothDevices(bondedBluetoothDevices); setResultCode(!isFailed ? -1 : 0); } else { Log.d(TAG, "No paired devices found"); setResultCode(-1); setResultData("No paired devices found"); } } else { setResultCode(0); setResultData("Unpair bluetooth works from Android 4.3 - API Level 18"); } }

Target:
public void onReceive(Context context, Intent intent) { Log.d(TAG, "Unpairing bluetooth devices"); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter == null) { String message = "No Bluetooth adapter found"; Log.e(TAG, message); setResultCode(Activity.RESULT_CANCELED); setResultData(message); return; } Set<BluetoothDevice> bondedBluetoothDevices = bluetoothAdapter.getBondedDevices(); if (bondedBluetoothDevices.isEmpty()) { setResultCode(Activity.RESULT_OK); setResultData("No paired devices found"); return; } unpairBluetoothDevices(bondedBluetoothDevices); }
Source:
public List<ExecutableFlow> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final List<ExecutableFlow> execFlows = new ArrayList<>(); do { final int id = rs.getInt(1); final int encodingType = rs.getInt(2); final byte[] data = rs.getBytes(3); if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); try { final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlowFromObject( GZIPUtils.transformBytesToObject(data, encType)); Status status = Status.fromInteger(rs.getInt(4)); exFlow.setStatus(status); execFlows.add(exFlow); } catch (final IOException e) { throw new SQLException("Error retrieving flow data " + id, e); } } } while (rs.next()); return execFlows; }

Target:
public List<ExecutableFlow> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final List<ExecutableFlow> execFlows = new ArrayList<>(); do { final int id = rs.getInt(1); final int encodingType = rs.getInt(2); final byte[] data = rs.getBytes(3); if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); final Status status = Status.fromInteger(rs.getInt(4)); try { final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlow( GZIPUtils.transformBytesToObject(data, encType), status); execFlows.add(exFlow); } catch (final IOException e) { throw new SQLException("Error retrieving flow data " + id, e); } } } while (rs.next()); return execFlows; }
Source:
public Connection shutdown() { log.info("Stopping PubSub connection"); if (subscriber != null) subscriber.stopAsync().awaitTerminated(); subscriber = null; return this; }

Target:
public Connection shutdown() { log.info("Stopping PubSub connection"); if (subscriber != null) { log.debug("Waiting for subscriber to terminate"); subscriber.stopAsync().awaitTerminated(); } subscriber = null; return this; }
Source:
private static String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim("sub", APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim("jti", UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim("iss", issuerIdentifier); jwtClaimsSetBuilder.claim("iat", currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim("exp", expireIn); } jwtClaimsSetBuilder.claim("subscribedAPIs", jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim("tierInfo", jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim("application", jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim("keytype", jwtTokenInfoDTO.getKeyType()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_IP, jwtTokenInfoDTO.getPermittedIP()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_REFERER, jwtTokenInfoDTO.getPermittedReferer()); return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }

Target:
private static String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim("sub", APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim("jti", UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim("iss", issuerIdentifier); jwtClaimsSetBuilder.claim("iat", currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim("exp", expireIn); } jwtClaimsSetBuilder.claim("subscribedAPIs", jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim("tierInfo", jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim("application", jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim("keytype", jwtTokenInfoDTO.getKeyType()); if (jwtTokenInfoDTO.getPermittedIP() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_IP, jwtTokenInfoDTO.getPermittedIP()); } if (jwtTokenInfoDTO.getPermittedReferer() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_REFERER, jwtTokenInfoDTO.getPermittedReferer()); } return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }
Source:
public void sweepDeletesTombstonesWhenWriteHasHigherTimestamp() { sweepQueue.enqueue(tombstoneToDefaultCell(TABLE_CONSERVATIVE, TS), TS); sweepQueue.enqueue(writeToDefaultCell(TABLE_CONSERVATIVE, TS2), TS2); assertTombstone(TABLE_CONSERVATIVE, TS + 1, TS); assertValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertSentinel(TABLE_CONSERVATIVE, TS + 1); assertValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); }

Target:
public void sweepDeletesTombstonesWhenWriteHasHigherTimestamp() { enqueueTombstone(TABLE_CONSERVATIVE, TS); enqueueWrite(TABLE_CONSERVATIVE, TS2); assertReadAtTimestampReturnsTombstoneAtTimestamp(TABLE_CONSERVATIVE, TS + 1, TS); assertReadAtTimestampReturnsValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertReadAtTimestampReturnsSentinel(TABLE_CONSERVATIVE, TS + 1); assertReadAtTimestampReturnsValue(TABLE_CONSERVATIVE, TS2 + 1, TS2); }
Source:
private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); if (branchName.length() == 0) { setErrorMessage(MessageFormat.format( UIText.PushBranchPage_ChooseBranchNameError, remoteConfig.getName())); return; } if (!Repository.isValidRefName(Constants.R_HEADS + branchName)) { setErrorMessage(UIText.PushBranchPage_InvalidBranchNameError); return; } if (isConfigureUpstreamSelected() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PushBranchPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }

Target:
private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); String branchNameMessage = null; if (branchName.length() == 0) { branchNameMessage = MessageFormat.format( UIText.PullWizardPage_ChooseReference, remoteConfig.getName()); } else if (!Repository .isValidRefName(Constants.R_HEADS + branchName)) { branchNameMessage = UIText.PushBranchPage_InvalidBranchNameError; return; } if (branchNameMessage != null) { setErrorMessage(branchNameMessage); if (this.missingBranchDecorator == null) { this.missingBranchDecorator = new ControlDecoration(this.remoteBranchNameText, SWT.TOP | SWT.LEFT); this.missingBranchDecorator .setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_ERROR) .getImage()); } this.missingBranchDecorator .setDescriptionText(branchNameMessage); this.missingBranchDecorator.show(); return; } else if (this.missingBranchDecorator != null) { this.missingBranchDecorator.hide(); } if (overrideUpstreamConfiguration() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PullWizardPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }
Source:
private boolean validateClusterExistsForArchitecture(ArchitectureType architecture, StoragePool dataCenter) { if (!clusterArchitecturesInDataCenters.get(dataCenter.getId()).contains(architecture)) { showErrorPopup(constants.noClusterSupportingArchitectureInDC()); return false; } return true; }

Target:
private boolean validateClusterExistsForArchitecture(ArchitectureType architecture, StoragePool dataCenter) { if (clusterArchitecturesInDataCenters == null || clusterArchitecturesInDataCenters.get(dataCenter.getId()) == null) { return true; } if (!clusterArchitecturesInDataCenters.get(dataCenter.getId()).contains(architecture)) { showErrorPopup(constants.noClusterSupportingArchitectureInDC()); return false; } return true; }
Source:
public static Socket openCommandSession(final String ip, final int port, final String passwd) throws IOException { Socket sk = new Socket(ip, port); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketCommand); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { throw new IOException(); } } return sk; }

Target:
public static Socket openCommandSession(final String ip, final int port, final String passwd) throws IOException { Socket sk = new Socket(ip, port); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketCommand); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { throw new IOException("Invalid gateway password"); } } return sk; }
Source:
public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("[MessageInfo:") .append("Key-") .append(key) .append(",") .append("Size-") .append(size) .append(",") .append("ExpirationTimeInMs-") .append(expirationTimeInMs) .append(",") .append("IsDeleted-") .append(isDeleted) .append("]"); return stringBuilder.toString(); }

Target:
public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("[MessageInfo:") .append("Key-") .append(key) .append(",") .append("Size-") .append(size) .append(",") .append("ExpirationTimeInMs-") .append(expirationTimeInMs) .append(",") .append("IsDeleted-") .append(isDeleted) .append(",") .append("Crc-") .append(crc) .append("]"); return stringBuilder.toString(); }
Source:
public void testObjectInsideCommand() { Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(CustomPerson.class); Marshaller marshaller = MarshallerFactory.getMarshaller(extraClasses, MarshallingFormat.JSON, this.getClass().getClassLoader()); CustomPerson john = new CustomPerson("John", 20); InsertObjectCommand command = new InsertObjectCommand(john); String marshall = marshaller.marshall(command); assertTrue("marshalled string should contain a customized value", marshall.contains("John is CustomPerson")); InsertObjectCommand unmarshall = marshaller.unmarshall(marshall, InsertObjectCommand.class); CustomPerson result = (CustomPerson) unmarshall.getObject(); assertEquals(50, result.getAge()); }

Target:
public void testObjectInsideCommand() { Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(CustomPerson.class); Marshaller marshaller = MarshallerFactory.getMarshaller(extraClasses, MarshallingFormat.JSON, this.getClass().getClassLoader()); CustomPerson john = new CustomPerson("John", 20); InsertObjectCommand command = new InsertObjectCommand(john); String marshall = marshaller.marshall(command); Assertions.assertThat(marshall).contains("John is CustomPerson"); InsertObjectCommand unmarshall = marshaller.unmarshall(marshall, InsertObjectCommand.class); CustomPerson result = (CustomPerson) unmarshall.getObject(); assertEquals(50, result.getAge()); }
Source:
public void createResults(PointType location) { ThingUID localWeatherThing = new ThingUID(THING_TYPE_WEATHER, LOCAL); ThingUID bridgeUID = weatherUndergroundBridgeHandler.getThing().getUID(); Map<String, Object> properties = new HashMap<>(3); properties.put(LOCATION, String.format("%s,%s", location.getLatitude(), location.getLongitude())); thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withLabel("Local Weather") .withProperties(properties).withBridge(bridgeUID).build()); }

Target:
public void createResults(PointType location) { ThingUID localWeatherThing = new ThingUID(THING_TYPE_WEATHER, LOCAL); Map<String, Object> properties = new HashMap<>(3); properties.put(LOCATION, String.format("%s,%s", location.getLatitude(), location.getLongitude())); thingDiscovered(DiscoveryResultBuilder.create(localWeatherThing).withLabel("Local Weather") .withProperties(properties).withBridge(bridgeUID).build()); }
Source:
public void clickAndWaitToBecomeStale(Duration timeout) { WebElement webElement = resolve(); webElement.submit(); waitFor(webElement).withTimeout(timeout).until(Control::isStale); }

Target:
public void clickAndWaitToBecomeStale(Duration timeout) { WebElement webElement = resolve(); webElement.click(); waitFor(webElement).withTimeout(timeout).until(Control::isStale); }
Source:
private void writeMetacardToZip(ZipOutputStream zipOutputStream, Metacard metacard) { try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream)) { ZipEntry zipEntry = new ZipEntry(METACARD_PATH + metacard.getId()); zipOutputStream.putNextEntry(zipEntry); objectOutputStream.writeObject(new MetacardImpl(metacard)); InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); IOUtils.copy(inputStream, zipOutputStream); inputStream.close(); } catch (IOException e) { LOGGER.debug("Failed to add metacard with id {}.", metacard.getId(), e); } }

Target:
private void writeMetacardToZip(ZipOutputStream zipOutputStream, Metacard metacard) { InputStream inputStream = null; try (FileBackedOutputStream fileBackedOutputStream = new FileBackedOutputStream(BUFFER_SIZE); ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileBackedOutputStream)) { ZipEntry zipEntry = new ZipEntry(METACARD_PATH + metacard.getId()); zipOutputStream.putNextEntry(zipEntry); objectOutputStream.writeObject(new MetacardImpl(metacard)); inputStream = fileBackedOutputStream.asByteSource().openStream(); IOUtils.copy(inputStream, zipOutputStream); } catch (IOException e) { LOGGER.debug("Failed to add metacard with id {}.", metacard.getId(), e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { LOGGER.debug("Failed to close input stream", e); } } }
Source:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/serialization/BlindSerialVersionUidCheck.java", new BlindSerialVersionUidCheck()); }

Target:
public void test() { String fixtureFileName = "src/test/files/checks/serialization/BlindSerialVersionUidCheck.java"; BlindSerialVersionUidCheck check = new BlindSerialVersionUidCheck(); JavaCheckVerifier.verify(fixtureFileName, check); JavaCheckVerifier.verifyNoIssueWithoutSemantic(fixtureFileName, check); }
Source:
public void testCreateNewUserVariableAndDeletion() { String userVariableName = "testVariable1"; String secondUserVariableName = "testVariable2"; onBrickAtPosition(0).checkShowsText(R.string.brick_when_started); onBrickAtPosition(1).checkShowsText(R.string.brick_set_variable); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner) .performNewVariableInitial(userVariableName); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner) .performNewVariable(secondUserVariableName); onBrickAtPosition(1).onFormulaTextField(R.id.brick_set_variable_edit_text) .perform(click()); deleteItemWithTextFromFormulaEditorDataList(userVariableName, BrickTestUtils.UserVariableUsage.IN_USE); pressBack(); onView(withText(userVariableName)) .check(doesNotExist()); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner).onChildView(withText(userVariableName)) .check(doesNotExist()); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner).onChildView(withText(secondUserVariableName)) .check(matches(isDisplayed())); }

Target:
public void testCreateNewUserVariableAndDeletion() { String userVariableName = "testVariable1"; String secondUserVariableName = "testVariable2"; onBrickAtPosition(0) .checkShowsText(R.string.brick_when_started); onBrickAtPosition(1) .checkShowsText(R.string.brick_set_variable); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner) .performNewVariableInitial(userVariableName); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner) .performNewVariable(secondUserVariableName); onBrickAtPosition(1).onFormulaTextField(R.id.brick_set_variable_edit_text) .perform(click()); onFormulaEditor() .performOpenDataFragment(); onDataList().onVariableAtPosition(0) .performDelete(); onDataList() .performClose(); pressBack(); onView(withText(userVariableName)) .check(doesNotExist()); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner).onChildView(withText(userVariableName)) .check(doesNotExist()); onBrickAtPosition(1).onVariableSpinner(R.id.set_variable_spinner).onChildView(withText(secondUserVariableName)) .check(matches(isDisplayed())); }
Source:
public void mouseDown(@Nullable MouseEvent event) { if (event == null || event.button != SWT.BUTTON1) { return; } int xMouseLocation = event.x; int yMouseLocation = event.y; boolean ctrlMode = false; ISeries[] series = getChart().getSeriesSet().getSeries(); Set<Integer> selections = getSelection(); if ((event.stateMask & SWT.CTRL) != 0) { selections = getSelection(); ctrlMode = true; } else { unsetSelection(); selections = new HashSet<>(); } for (ISeries oneSeries : series) { ILineSeries lineSerie = (ILineSeries) oneSeries; int closest = -1; double closestDistance = -1; for (int i = 0; i < lineSerie.getXSeries().length; i++) { Point dataPoint = lineSerie.getPixelCoordinates(i); double distance = Math.hypot(dataPoint.x - xMouseLocation, dataPoint.y - yMouseLocation); int snapRangeRadius = lineSerie.getSymbolSize() * SELECTION_SNAP_RANGE_MULTIPLIER; if (distance < snapRangeRadius) { if (closestDistance == -1 || distance < closestDistance) { closest = i; closestDistance = distance; } } } if (closest != -1) { int tableEntryIndex = getTableEntryIndexFromGraphIndex(checkNotNull(oneSeries), closest); if (tableEntryIndex < 0) { continue; } LamiTableEntry entry = getResultTable().getEntries().get(tableEntryIndex); int index = getResultTable().getEntries().indexOf(entry); if (!ctrlMode || !selections.remove(index)) { selections.add(index); } break; } } setSelection(selections); LamiSelectionUpdateSignal signal = new LamiSelectionUpdateSignal(this, selections, checkNotNull(getResultTable().hashCode())); TmfSignalManager.dispatchSignal(signal); refresh(); }

Target:
public void mouseDown(@Nullable MouseEvent event) { if (event == null || event.button != 1) { return; } int xMouseLocation = event.x; int yMouseLocation = event.y; boolean ctrlMode = false; ISeries[] series = getChart().getSeriesSet().getSeries(); Set<Integer> selections = getSelection(); if ((event.stateMask & SWT.CTRL) != 0) { selections = getSelection(); ctrlMode = true; } else { unsetSelection(); selections = new HashSet<>(); } for (ISeries oneSeries : series) { ILineSeries lineSerie = (ILineSeries) oneSeries; int closest = -1; double closestDistance = -1; for (int i = 0; i < lineSerie.getXSeries().length; i++) { Point dataPoint = lineSerie.getPixelCoordinates(i); double distance = Math.hypot(dataPoint.x - xMouseLocation, dataPoint.y - yMouseLocation); int snapRangeRadius = lineSerie.getSymbolSize() * SELECTION_SNAP_RANGE_MULTIPLIER; if (distance < snapRangeRadius) { if (closestDistance == -1 || distance < closestDistance) { closest = i; closestDistance = distance; } } } if (closest != -1) { int tableEntryIndex = getTableEntryIndexFromGraphIndex(checkNotNull(oneSeries), closest); if (tableEntryIndex < 0) { continue; } LamiTableEntry entry = getResultTable().getEntries().get(tableEntryIndex); int index = getResultTable().getEntries().indexOf(entry); if (!ctrlMode || !selections.remove(index)) { selections.add(index); } break; } } setSelection(selections); LamiSelectionUpdateSignal signal = new LamiSelectionUpdateSignal(this, selections, checkNotNull(getResultTable().hashCode())); TmfSignalManager.dispatchSignal(signal); refresh(); }
Source:
public V getIfPresent(K key) { V value = cache.get(key); if (value == null) { missCount.incrementAndGet(); } else { hitCount.getAndIncrement(); } return value; }

Target:
public V getIfPresent(K key) { V value = cache.get(key); if (value == null) { missCount.getAndIncrement(); } else { hitCount.getAndIncrement(); } return value; }
Source:
public void handleMessage(Message message) throws Fault { String method = (String) message.get(Message.HTTP_REQUEST_METHOD); String query = (String) message.get(Message.QUERY_STRING); if (!"GET".equals(method) || StringUtils.isEmpty(query)) { return; } String baseUri = (String) message.get(Message.REQUEST_URL); String ctx = (String) message.get(Message.PATH_INFO); Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery( map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) { Document doc = getDocument(message, baseUri, map, ctx); if (map.containsKey("wsdl") && doc != null) { doc = addPolicyToWSDL(doc, loader.getPolicy()); doc = configureAddress(doc); } Endpoint e = message.getExchange().get(Endpoint.class); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); mout = e.getBinding().createMessage(mout); mout.setInterceptorChain( OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange())); message.getExchange().setOutMessage(mout); mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc); mout.put(Message.CONTENT_TYPE, "text/xml"); cleanUpOutInterceptors(mout); mout.getInterceptorChain().add(WSDLGetOutInterceptor.INSTANCE); message.getExchange().put("transform.skip", Boolean.TRUE); message .getInterceptorChain() .doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); } }

Target:
public void handleMessage(Message message) throws Fault { String method = (String) message.get(Message.HTTP_REQUEST_METHOD); String query = (String) message.get(Message.QUERY_STRING); if (!"GET".equals(method) || StringUtils.isEmpty(query)) { return; } String baseUri = (String) message.get(Message.REQUEST_URL); String ctx = (String) message.get(Message.PATH_INFO); Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery( map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) { Document doc = getDocument(message, baseUri, map, ctx); if (doc != null && map.containsKey("wsdl")) { doc = addPolicyToWSDL(doc, loader.getPolicy()); doc = configureAddress(doc); } Endpoint e = message.getExchange().get(Endpoint.class); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); mout = e.getBinding().createMessage(mout); mout.setInterceptorChain( OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange())); message.getExchange().setOutMessage(mout); mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc); mout.put(Message.CONTENT_TYPE, "text/xml"); cleanUpOutInterceptors(mout); mout.getInterceptorChain().add(WSDLGetOutInterceptor.INSTANCE); message.getExchange().put("transform.skip", Boolean.TRUE); message .getInterceptorChain() .doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName()); } }
Source:
public void addSpanSubstitutionNullSpanType() { thrown.expect(NullPointerException.class); thrown.expectMessage("Must provide a spanType for substitution"); builder.addSubstitution((SpanType) null, "bold"); }

Target:
public void addSpanSubstitutionNullSpanType() { thrown.expect(NullPointerException.class); thrown.expectMessage("Must provide a spanType"); builder.addSubstitution((SpanType) null, "bold"); }
Source:
public double calculateAUC() { double auc = 0.0; double aup; Point pointA; Point pointB = points.get(0); for (int i = 1; i < points.size(); i++) { pointA = pointB; pointB = points.get(i); if (pointB.x != pointA.x) { if (pointB.y == pointA.y) { aup = pointA.y * (pointB.x - pointA.x); } else { aup = pointB.y * (pointB.x - pointA.x); aup += 0.5 * (pointA.y - pointB.y) * (pointB.x - pointA.x); } auc += aup; } } return auc; }

Target:
public double calculateAUC() { double auc = 0.0; double aup; Point pointA; Point pointB = points.get(0); for (int i = 1; i < points.size(); i++) { pointA = pointB; pointB = points.get(i); if (pointB.x != pointA.x) { if (pointB.y == pointA.y) { aup = pointA.y * (pointB.x - pointA.x); } else { aup = pointA.y * (pointB.x - pointA.x); aup += 0.5 * (pointB.y - pointA.y) * (pointB.x - pointA.x); } auc += aup; } } return auc; }
Source:
private void createNormalConnector() { Map<String, String> props = new HashMap<>(); props.put(CONNECTOR_CLASS_CONFIG, MonitorableSinkConnector.class.getName()); props.put(TASKS_MAX_CONFIG, "1"); props.put(TOPICS_CONFIG, "normal-topic"); log.info("Creating normal connector"); try { connect.configureConnector(NORMAL_CONNECTOR_NAME, props); } catch (RuntimeException e) { log.info("Failed to create connector", e); throw e; } }

Target:
private void createNormalConnector() { connect.kafka().createTopic(TEST_TOPIC, 3); normalConnectorHandle = RuntimeHandles.get().connectorHandle(NORMAL_CONNECTOR_NAME); normalConnectorHandle.expectedRecords(NUM_RECORDS_PRODUCED); normalConnectorHandle.expectedCommits(NUM_RECORDS_PRODUCED); Map<String, String> props = new HashMap<>(); props.put(CONNECTOR_CLASS_CONFIG, MonitorableSourceConnector.class.getName()); props.put(TASKS_MAX_CONFIG, "1"); props.put(MonitorableSourceConnector.TOPIC_CONFIG, TEST_TOPIC); log.info("Creating normal connector"); try { connect.configureConnector(NORMAL_CONNECTOR_NAME, props); } catch (RuntimeException e) { log.info("Failed to create connector", e); throw e; } }
Source:
public Necromentia(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); this.getSpellAbility().addEffect( new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NONBASIC_LAND_NAME).setText("Choose a card name other than a basic land card name") ); this.getSpellAbility().addEffect(new NecromentiaEffect()); this.getSpellAbility().addTarget(new TargetOpponent()); }

Target:
public Necromentia(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); this.getSpellAbility().addEffect( new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NOT_BASIC_LAND_NAME) ); this.getSpellAbility().addEffect(new NecromentiaEffect()); this.getSpellAbility().addTarget(new TargetOpponent()); }
Source:
public Field(InputField inputField, String label, boolean embeded, int layout) { this(inputField, label, embeded, DynamicForm.LAYOUT_VERTICAL, ""); }

Target:
public Field(InputField inputField, String label, boolean embeded, int layout) { this(inputField, label, embeded, layout, ""); }
Source:
protected Message merge(Message storedMessage, Message newMessage) { List<Field> fields = new ArrayList(storedMessage.getFields()); newMessage.getFields().forEach(field -> { if (!containsField(fields, field) && !containsField(new ArrayList<>(storedMessage.getFields()), field)) { fields.add(field); } }); Set<Field> reorderedFields = reorderFields(fields); return new Message(storedMessage.getName(), reorderedFields); }

Target:
protected Message merge(Message storedMessage, Message newMessage) { List<Field> fields = new ArrayList<>(storedMessage.getFields()); newMessage.getFields().forEach(field -> { if (!containsField(fields, field) && !containsField(new ArrayList<>(storedMessage.getFields()), field)) { fields.add(field); } }); Set<Field> reorderedFields = reorderFields(fields); return new Message(storedMessage.getName(), reorderedFields); }
Source:
public LookupExtractor get() { final Lock readLock = startStopSync.readLock(); try { readLock.lockInterruptibly(); } catch (InterruptedException e) { throw Throwables.propagate(e); } try { if (entry == null) { throw new ISE("Factory [%s] not started", extractorID); } CacheScheduler.CacheState cacheState = entry.getCacheState(); if (cacheState == CacheScheduler.NoCache.CACHE_NOT_INITIALIZED) { throw new ISE("%s not yet initialized cache, extractorID = %s", entry, extractorID); } if (cacheState == CacheScheduler.NoCache.ENTRY_CLOSED) { throw new ISE("%s disposed, extractorID = %s", entry, extractorID); } CacheScheduler.VersionedCache versionedCache = (CacheScheduler.VersionedCache) cacheState; Map<String, String> map = versionedCache.getCache(); final byte[] v = StringUtils.toUtf8(versionedCache.getVersion()); final byte[] id = StringUtils.toUtf8(extractorID); return new MapLookupExtractor(map, isInjective()) { @Override public byte[] getCacheKey() { return ByteBuffer .allocate(CLASS_CACHE_KEY.length + id.length + 1 + v.length + 1 + 1) .put(CLASS_CACHE_KEY) .put(id).put((byte) 0xFF) .put(v).put((byte) 0xFF) .put(isOneToOne() ? (byte) 1 : (byte) 0) .array(); } }; } finally { readLock.unlock(); } }

Target:
public LookupExtractor get() { final Lock readLock = startStopSync.readLock(); try { readLock.lockInterruptibly(); } catch (InterruptedException e) { throw Throwables.propagate(e); } try { if (entry == null) { throw new ISE("Factory [%s] not started", extractorID); } final CacheScheduler.CacheState cacheState = entry.getCacheState(); if (cacheState instanceof CacheScheduler.NoCache) { final String noCacheReason = ((CacheScheduler.NoCache) cacheState).name(); throw new ISE("%s: %s, extractorID = %s", entry, noCacheReason, extractorID); } CacheScheduler.VersionedCache versionedCache = (CacheScheduler.VersionedCache) cacheState; Map<String, String> map = versionedCache.getCache(); final byte[] v = StringUtils.toUtf8(versionedCache.getVersion()); final byte[] id = StringUtils.toUtf8(extractorID); return new MapLookupExtractor(map, isInjective()) { @Override public byte[] getCacheKey() { return ByteBuffer .allocate(CLASS_CACHE_KEY.length + id.length + 1 + v.length + 1 + 1) .put(CLASS_CACHE_KEY) .put(id).put((byte) 0xFF) .put(v).put((byte) 0xFF) .put(isOneToOne() ? (byte) 1 : (byte) 0) .array(); } }; } finally { readLock.unlock(); } }
Source:
public SeleniumWDateFieldWebElement(final WebElement element, final WebDriver driver) { super(element, driver); final String tagName = element.getTagName(); if (!tagName.equals(TOP_LEVEL_TAG)) { throw new IllegalArgumentException("Element is not the expected wrapper. tag=[" + tagName + "]."); } }

Target:
public SeleniumWDateFieldWebElement(final WebElement element, final WebDriver driver) { super(element, driver); final String tagName = element.getTagName(); String elementClass = element.getAttribute("class"); if (!tagName.equals(TOP_STANDARD_LEVEL_TAG) && !tagName.equals(TOP_READONLY_LEVEL_TAG)) { throw new IllegalArgumentException("Element is not the expected wrapper. tag=[" + tagName + "]."); } else if (!elementClass.contains("wc-datefield")) { throw new IllegalArgumentException("Element is not the expected ctyle class. class=[" + elementClass + "]."); } }
Source:
protected void execLoad() throws ProcessingException { getResultTableField().getTable().setDefaultIconId(getContentAssistField().getBrowseIconId()); getActiveStateRadioButtonGroup().setVisible(getContentAssistField().isActiveFilterEnabled()); getActiveStateRadioButtonGroup().setValue((TriState) getContentAssistField().getActiveFilter()); getNewButton().setEnabled(getContentAssistField().getBrowseNewText() != null); getNewButton().setLabel(getContentAssistField().getBrowseNewText()); }

Target:
protected void execLoad() throws ProcessingException { getResultTableField().getTable().setDefaultIconId(getContentAssistField().getBrowseIconId()); getActiveStateRadioButtonGroup().setVisible(getContentAssistField().isActiveFilterEnabled()); getActiveStateRadioButtonGroup().setValue(getContentAssistField().getActiveFilter()); getNewButton().setEnabled(getContentAssistField().getBrowseNewText() != null); getNewButton().setLabel(getContentAssistField().getBrowseNewText()); }
Source:
private void validateInput(final String input, int maxLength) { checkNotNull(input); checkState(input.length() <= maxLength, String.format("input must be <= %d chars", maxLength)); checkState(Iterables.any(FORBIDDEN_PREFIX, new Predicate<String>() { @Override public boolean apply(@Nullable String input) { return input.startsWith(input); } }), "Cannot starts with " + Iterables.toString(FORBIDDEN_PREFIX)); }

Target:
private void validateInput(final String input, int maxLength) { checkNotNull(input); checkState(input.length() <= maxLength, String.format("input must be <= %d chars", maxLength)); checkState(!Iterables.any(FORBIDDEN_PREFIX, new Predicate<String>() { @Override public boolean apply(@Nullable String input) { return input.startsWith(input); } }), "Cannot starts with " + Iterables.toString(FORBIDDEN_PREFIX)); }
Source:
public boolean waitForYellowStatus(String[] indexNames, int timeoutSecond) { boolean ret = true; String timeout = timeoutSecond + "s"; log.debug("Waiting for cluster yellow health status, indexes: " + Arrays.toString(indexNames)); String errorMessage = null; try { ClusterHealthResponse response = client.admin() .cluster() .prepareHealth(indexNames) .setTimeout(timeout) .setWaitForYellowStatus() .get(); if (response.isTimedOut()) { ret = false; errorMessage = "ES Cluster health status not Yellow after " + timeout + " give up: " + response; } else { if ((indexNames.length > 0) && response.getStatus() != ClusterHealthStatus.GREEN) { log.warn("Es Cluster ready but not GREEN: " + response); } else { log.info("ES Cluster ready: " + response); } } } catch (NoNodeAvailableException e) { errorMessage = "Failed to connect to elasticsearch, check addressList and clusterName: " + e.getMessage(); } if (errorMessage != null) { log.error(errorMessage); throw new RuntimeException(errorMessage); } return ret; }

Target:
public boolean waitForYellowStatus(String[] indexNames, int timeoutSecond) { String timeout = timeoutSecond + "s"; log.debug("Waiting for cluster yellow health status, indexes: " + Arrays.toString(indexNames)); try { ClusterHealthResponse response = client.admin() .cluster() .prepareHealth(indexNames) .setTimeout(timeout) .setWaitForYellowStatus() .get(); if (response.isTimedOut()) { throw new NuxeoException("Elasticsearch Cluster health status not Yellow after " + timeout + " give up: " + response); } if (response.getStatus() != ClusterHealthStatus.GREEN) { log.warn("Elasticsearch Cluster ready but not GREEN: " + response); return false; } log.info("Elasticsearch Cluster ready: " + response); } catch (NoNodeAvailableException e) { throw new NuxeoException("Failed to connect to elasticsearch, check addressList and clusterName: " + e.getMessage()); } return true; }
Source:
public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull(repository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH)); }

Target:
public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull(repository.getRef(Constants.R_HEADS + DEVELOP_BRANCH)); }
Source:
public Token<OzoneTokenIdentifier> getDelegationToken(String renewer) throws IOException { if (!securityEnabled || renewer == null) { return null; } else { Token<OzoneTokenIdentifier> token = ozoneClient.getObjectStore().getDelegationToken(new Text(renewer)); token.setKind(OzoneTokenIdentifier.KIND_NAME); return token; } }

Target:
public Token<OzoneTokenIdentifier> getDelegationToken(String renewer) throws IOException { if (!securityEnabled) { return null; } Token<OzoneTokenIdentifier> token = ozoneClient.getObjectStore() .getDelegationToken(renewer == null ? null : new Text(renewer)); token.setKind(OzoneTokenIdentifier.KIND_NAME); return token; }
Source:
public static void deleteDir(File file) throws IOException { if (file.isFile()) { if (!file.delete()) throw new IOException("Fail to delete File(" + file.getAbsolutePath() + ")"); return; } File[] children = file.listFiles(); for (File children1 : children) { deleteDir(children1); } if (!file.delete()) throw new IOException("Fail to delete Dir(" + file.getAbsolutePath() + ")"); return; }

Target:
public static void deleteDir(File file) throws IOException { if (file.isFile()) { if (!file.delete()) throw new IOException("Fail to delete File(" + file.getAbsolutePath() + ")"); return; } File[] children = file.listFiles(); for (File child : children) { deleteDir(child); } if (!file.delete()) throw new IOException("Fail to delete Dir(" + file.getAbsolutePath() + ")"); return; }