auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean next(List<Cell> results) throws IOException { Cell lastCell = null; int rowCount = 0; region.startRegionOperation(); try { synchronized (innerScanner) { do { List<Cell> row = new ArrayList<>(); hasMore = innerScanner.nextRaw(row); if (!row.isEmpty()) { lastCell = row.get(0); Put put = null; Delete del = null; for (Cell cell : row) { if (KeyValue.Type.codeToType(cell.getTypeByte()) == KeyValue.Type.Put) { if (put == null) { put = new Put(CellUtil.cloneRow(cell)); mutations.add(put); } put.add(cell); } else { if (del == null) { del = new Delete(CellUtil.cloneRow(cell)); mutations.add(del); } del.addDeleteMarker(cell); } } rowCount++; } } while (hasMore && rowCount < pageSizeInRows); verifyIndex(); } } catch (IOException e) { LOGGER.error(String.format("IOException during rebuilding: %s", Throwables.getStackTraceAsString(e))); throw e; } finally { region.closeRegionOperation(); mutations.clear(); indexKeyToDataPutMap.clear(); dataKeyToDataPutMap.clear(); } byte[] rowCountBytes = PLong.INSTANCE.toBytes(Long.valueOf(rowCount)); final Cell aggKeyValue; if (lastCell == null) { aggKeyValue = KeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, rowCountBytes,0, rowCountBytes.length); } else { aggKeyValue = KeyValueUtil.newKeyValue(CellUtil.cloneRow(lastCell), SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, rowCountBytes, 0, rowCountBytes.length); } results.add(aggKeyValue); return hasMore; }

Target:
public boolean next(List<Cell> results) throws IOException { Cell lastCell = null; int rowCount = 0; region.startRegionOperation(); try { synchronized (innerScanner) { do { List<Cell> row = new ArrayList<>(); hasMore = innerScanner.nextRaw(row); if (!row.isEmpty()) { lastCell = row.get(0); Put put = null; for (Cell cell : row) { if (KeyValue.Type.codeToType(cell.getTypeByte()) == KeyValue.Type.Put) { if (put == null) { put = new Put(CellUtil.cloneRow(cell)); } put.add(cell); } else { throw new DoNotRetryIOException("Scan without raw found a deleted cell"); } } rowCount++; indexKeyToDataPutMap .put(getIndexRowKey(indexMaintainer, put), put); } } while (hasMore && rowCount < pageSizeInRows); verifyIndex(); } } catch (IOException e) { LOGGER.error(String.format("IOException during rebuilding: %s", Throwables.getStackTraceAsString(e))); throw e; } finally { region.closeRegionOperation(); indexKeyToDataPutMap.clear(); } byte[] rowCountBytes = PLong.INSTANCE.toBytes(Long.valueOf(rowCount)); final Cell aggKeyValue; if (lastCell == null) { aggKeyValue = KeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, rowCountBytes,0, rowCountBytes.length); } else { aggKeyValue = KeyValueUtil.newKeyValue(CellUtil.cloneRow(lastCell), SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, rowCountBytes, 0, rowCountBytes.length); } results.add(aggKeyValue); return hasMore; }
Source:
private static Pair<Long, Long> readMemInfo() { long memFree = 0L; long activeFile = 0L; long inactiveFile = 0L; long sReclaimable = 0L; long memTotal = 0L; long memAvailable; List<String> procMemInfo = FileUtil.readFile(ProcPath.MEMINFO); for (String checkLine : procMemInfo) { String[] memorySplit = ParseUtil.whitespaces.split(checkLine); if (memorySplit.length > 1) { switch (memorySplit[0]) { case "MemTotal:": memTotal = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); break; case "MemAvailable:": memAvailable = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); return new Pair<>(memAvailable, memTotal); case "MemFree:": memFree = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); break; case "Active(file):": activeFile = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); break; case "Inactive(file):": inactiveFile = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); break; case "SReclaimable:": sReclaimable = ParseUtil.parseDecimalMemorySizeToBinary(checkLine.substring(memorySplit[0].length()).trim()); break; default: break; } } } return new Pair<>(memFree + activeFile + inactiveFile + sReclaimable, memTotal); }

Target:
private static Pair<Long, Long> readMemInfo() { long memFree = 0L; long activeFile = 0L; long inactiveFile = 0L; long sReclaimable = 0L; long memTotal = 0L; long memAvailable; List<String> procMemInfo = FileUtil.readFile(ProcPath.MEMINFO); for (String checkLine : procMemInfo) { String[] memorySplit = ParseUtil.whitespaces.split(checkLine, 2); if (memorySplit.length > 1) { switch (memorySplit[0]) { case "MemTotal:": memTotal = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); break; case "MemAvailable:": memAvailable = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); return new Pair<>(memAvailable, memTotal); case "MemFree:": memFree = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); break; case "Active(file):": activeFile = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); break; case "Inactive(file):": inactiveFile = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); break; case "SReclaimable:": sReclaimable = ParseUtil.parseDecimalMemorySizeToBinary(memorySplit[1]); break; default: break; } } } return new Pair<>(memFree + activeFile + inactiveFile + sReclaimable, memTotal); }
Source:
public int compare(T o1, T o2) { Pair<Integer,Integer> result = this.getReult(o1,o2); return result.getFirst() == result.getSecond() ? 0 : result.getFirst() > result.getSecond() ? 1 : -1; }

Target:
public int compare(T o1, T o2) { Pair<Integer,Integer> result = this.getComparisonScore(o1,o2); return result.getFirst() == result.getSecond() ? 0 : result.getFirst() > result.getSecond() ? 1 : -1; }
Source:
private EnumSchema.Builder buildEnumSchema() { EnumSchema.Builder builder = EnumSchema.builder(); Set<Object> possibleValues = new HashSet<>(); ls.schemaJson().require("enum").requireArray().forEach((i, item) -> possibleValues.add(item.unwrap())); builder.possibleValues(possibleValues); if (config.useDefaults) ls.schemaJson().maybe("default").map(JsonValue::deepToOrgJson).ifPresent(builder::defaultValue); return builder; }

Target:
private EnumSchema.Builder buildEnumSchema() { EnumSchema.Builder builder = EnumSchema.builder(); Set<Object> possibleValues = new HashSet<>(); ls.schemaJson().require("enum").requireArray().forEach((i, item) -> possibleValues.add(item.unwrap())); builder.possibleValues(possibleValues); return builder; }
Source:
private static final SerializationFilterAdapter serializationFilterAdapter = isJava6To8() ? createOnJava6To8Adapter() : new OnJavaAfter8(); private static boolean isJava6To8() { List<String> olderVersions = Arrays.asList("1.6", "1.7", "1.8"); return olderVersions.contains(System.getProperty("java.specification.version")); }

Target:
private static final SerializationFilterAdapter serializationFilterAdapter = isJava6To8() ? createOnJava6To8Adapter() : createOnJavaAfter8Adapter(); private static boolean isJava6To8() { List<String> olderVersions = Arrays.asList("1.6", "1.7", "1.8"); return olderVersions.contains(System.getProperty("java.specification.version")); }
Source:
public IndexReader newReader() { Map<CoordinateReferenceSystem,IndexReader> indexReaders = new HashMap<>(); for ( Map.Entry<CoordinateReferenceSystem,SpatialKnownIndex> index : indexMap.entrySet() ) { try { indexReaders.put( index.getKey(), index.getValue().getOnlineAccessor(descriptor, samplingConfig).newReader() ); } catch ( IOException e ) { e.printStackTrace(); } } return new SpatialFusionIndexReader( indexReaders, descriptor ); }

Target:
public IndexReader newReader() { Map<CoordinateReferenceSystem,IndexReader> indexReaders = new HashMap<>(); for ( Map.Entry<CoordinateReferenceSystem,SpatialKnownIndex> index : indexMap.entrySet() ) { indexReaders.put( index.getKey(), index.getValue().newReader( samplingConfig, descriptor ) ); } return new SpatialFusionIndexReader( indexReaders, descriptor ); }
Source:
public boolean hasUnsyncedNotes() { Simplenote application = (Simplenote) getActivity().getApplication(); Bucket<Note> notesBucket = application.getNotesBucket(); Bucket.ObjectCursor<Note> notesCursor = notesBucket.allObjects(); while (notesCursor.moveToNext()) { Note note = notesCursor.getObject(); if (note.getVersion() == 0) { return true; } } return false; }

Target:
private boolean hasUnsyncedNotes() { Simplenote application = (Simplenote) getActivity().getApplication(); Bucket<Note> notesBucket = application.getNotesBucket(); Bucket.ObjectCursor<Note> notesCursor = notesBucket.allObjects(); while (notesCursor.moveToNext()) { Note note = notesCursor.getObject(); if (note.isNew() || note.isModified()) { return true; } } return false; }
Source:
public String[] decorateListing( final Transfer transfer, final String[] listing, final EventMetadata metadata ) throws IOException { String[] result = listing; for ( TransferDecorator decorator : decorators ) { String[] decorated = decorator.decorateListing( transfer, listing, metadata ); if(!Arrays.equals( listing, decorated )){ result = decorated; } } return result; }

Target:
public String[] decorateListing( final Transfer transfer, final String[] listing, final EventMetadata metadata ) throws IOException { String[] result = listing; for ( TransferDecorator decorator : decorators ) { result = decorator.decorateListing( transfer, result, metadata ); } return result; }
Source:
private void doRenderRobot(float factor, TextureManager texManager) { box.render(factor); GL11.glPushMatrix(); texManager.bindTexture(overlay); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDepthMask(true); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680 % 65536, 61680 / 65536); box.render(factor); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }

Target:
private void doRenderRobot(float factor, TextureManager texManager) { box.render(factor); GL11.glPushMatrix(); texManager.bindTexture(overlay); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDepthMask(true); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680 % 65536, 61680 / 65536); box.render(factor); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
Source:
public InfinispanRemoteQueryBuilder getQuery() { InfinispanRemoteQueryBuilder builder = new InfinispanRemoteQueryBuilder(); int counter = 1; builder.append( "(" ); for ( Predicate<InfinispanRemoteQueryBuilder> child : children ) { builder.append( child.getQuery() ); builder.append( ")" ); if ( counter++ < children.size() ) { builder.append( " and (" ); } } return builder; }

Target:
public InfinispanRemoteQueryBuilder getQuery() { return new InfinispanRemoteQueryBuilder( "and", false, children ); }
Source:
public void testRemoveValueNoStoreEntryNoCacheWriter() throws Exception { final MockStore realStore = new MockStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); final Ehcache<String, String> ehcache = this.getEhcache(null); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getMap().containsKey("key"), is(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueNoStoreEntryNoCacheWriter() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(null); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().containsKey("key"), is(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() != Sensor.TYPE_PROXIMITY) { return; } if (AudioPlayer.player == null || !AudioPlayer.player.isPlaying()) { return; } int streamType; if (event.values[0] < 5f && event.values[0] != proximitySensor.getMaximumRange()) { streamType = AudioManager.STREAM_VOICE_CALL; } else { streamType = AudioManager.STREAM_MUSIC; } double position = AudioPlayer.player.getCurrentPosition(); double duration = AudioPlayer.player.getDuration(); double progress = position / duration; if (streamType == AudioManager.STREAM_VOICE_CALL && AudioPlayer.player.getAudioStreamType() != streamType) { synchronized (AudioPlayer.LOCK) { stopCurrent(); try { ViewHolder currentViewHolder = getCurrentViewHolder(); if (currentViewHolder != null) { play(currentViewHolder, currentlyPlayingMessage, true, progress); } } catch (Exception e) { Log.w(Config.LOGTAG, e); } } } else if (streamType == AudioManager.STREAM_MUSIC && AudioPlayer.player.getAudioStreamType() != streamType) { synchronized (AudioPlayer.LOCK) { stopCurrent(); try { ViewHolder currentViewHolder = getCurrentViewHolder(); if (currentViewHolder != null) { play(currentViewHolder, currentlyPlayingMessage, false, progress); } } catch (Exception e) { Log.w(Config.LOGTAG, e); } } } }

Target:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() != Sensor.TYPE_PROXIMITY) { return; } if (AudioPlayer.player == null || !AudioPlayer.player.isPlaying()) { return; } int streamType; if (event.values[0] < 5f && event.values[0] != proximitySensor.getMaximumRange()) { streamType = AudioManager.STREAM_VOICE_CALL; } else { streamType = AudioManager.STREAM_MUSIC; } double position = AudioPlayer.player.getCurrentPosition(); double duration = AudioPlayer.player.getDuration(); double progress = position / duration; if (AudioPlayer.player.getAudioStreamType() != streamType) { synchronized (AudioPlayer.LOCK) { AudioPlayer.player.stop(); AudioPlayer.player.release(); AudioPlayer.player = null; try { ViewHolder currentViewHolder = getCurrentViewHolder(); if (currentViewHolder != null) { play(currentViewHolder, currentlyPlayingMessage, streamType == AudioManager.STREAM_VOICE_CALL, progress); } } catch (Exception e) { Log.w(Config.LOGTAG, e); } } } }
Source:
public void disableUser(ByteBuffer username) { if(credentials.containsValue(ByteBuffers.encodeAsHex(username))) { disabledUsers.add(username); } }

Target:
public void disableUser(ByteBuffer username) { long stamp = lock.writeLock(); try { short uid = getUidByUsername0(username); String hex = ByteBuffers.encodeAsHex(username); credentials.put(uid, ENABLED, false); tokenManager.deleteAllUserTokens(hex); } finally { lock.unlockWrite(stamp); } }
Source:
public TasksModel(Context context) { this.mContext = context; File path = this.mContext.getApplicationContext().getDir( DATASTORE_MANGER_DIR, Context.MODE_PRIVATE ); DatastoreManager manager = DatastoreManager.getInstance(path.getAbsolutePath()); try { this.mCloudantSync = manager.openDatastore(TASKS_DATASTORE_NAME); } catch (DatastoreNotCreatedException dnce) { Log.e(LOG_TAG, "Unable to open Datastore", dnce); } Log.d(LOG_TAG, "Set up database at " + path.getAbsolutePath()); try { this.reloadReplicationSettings(); } catch (URISyntaxException e) { Log.e(LOG_TAG, "Unable to construct remote URI from configuration", e); } this.mHandler = new Handler(Looper.getMainLooper()); Log.d(LOG_TAG, "TasksModel set up " + path.getAbsolutePath()); }

Target:
public TasksModel(Context context) { this.mContext = context; File path = this.mContext.getApplicationContext().getDir( DATASTORE_MANGER_DIR, Context.MODE_PRIVATE ); DatastoreManager manager = DatastoreManager.getInstance(path.getAbsolutePath()); try { this.mDatastore = manager.openDatastore(TASKS_DATASTORE_NAME); } catch (DatastoreNotCreatedException dnce) { Log.e(LOG_TAG, "Unable to open Datastore", dnce); } Log.d(LOG_TAG, "Set up database at " + path.getAbsolutePath()); try { this.reloadReplicationSettings(); } catch (URISyntaxException e) { Log.e(LOG_TAG, "Unable to construct remote URI from configuration", e); } this.mHandler = new Handler(Looper.getMainLooper()); Log.d(LOG_TAG, "TasksModel set up " + path.getAbsolutePath()); }
Source:
public void testWaitUntilJobInitializationFinished_throwsInitializationException() throws Exception { final JobVertex testVertex = new DispatcherTest.FailingInitializationJobVertex("testVertex"); testVertex.setInvokableClass(NoOpInvokable.class); JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex); Dispatcher dispatcher = createAndStartDispatcher(); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); dispatcherGateway.submitJob(jobGraph, TIMEOUT).get(); CommonTestUtils.assertThrows("Could not instantiate JobManager", JobInitializationException.class, () -> { ClientUtils.waitUntilJobInitializationFinished(jobGraph.getJobID(), () -> dispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get(), () -> dispatcherGateway.requestJobResult(jobGraph.getJobID(), TIMEOUT).get(), ClassLoader.getSystemClassLoader()); return null; }); CommonTestUtils.assertThrows("Could not instantiate JobManager", ExecutionException.class, () -> { dispatcher.closeAsync().get(); return null; }); }

Target:
public void testWaitUntilJobInitializationFinished_throwsInitializationException() { Iterator<JobStatus> statusSequenceIterator = Arrays.asList( JobStatus.INITIALIZING, JobStatus.INITIALIZING, JobStatus.FAILED).iterator(); CommonTestUtils.assertThrows("Something is wrong", JobInitializationException.class, () -> { ClientUtils.waitUntilJobInitializationFinished( statusSequenceIterator::next, () -> { Throwable throwable = new JobInitializationException( TESTING_JOB_ID, "Something is wrong", new RuntimeException("Err")); return buildJobResult(throwable); }, ClassLoader.getSystemClassLoader()); return null; }); }
Source:
public static void main(String[] args) throws Exception { Crypto crypto = Crypto.initJava(); NetworkAccess network = NetworkAccess.buildJava(new URL("<LINK_0>")).get(); String username = args[0]; LocalDate expiry = LocalDate.parse(args[1]); Console console = System.console(); String password = new String(console.readPassword("Enter password for " + username + ":")); UserContext context = UserContext.signIn(username, password, network, crypto).get(); context.renewUsernameClaim(expiry).get(); LOG.info("Logged in " + username + " successfully!"); }

Target:
public static void main(String[] args) throws Exception { Crypto crypto = Crypto.initJava(); NetworkAccess network = NetworkAccess.buildJava(new URL("<LINK_0>")).get(); String username = args[0]; LocalDate expiry = LocalDate.parse(args[1]); Console console = System.console(); String password = new String(console.readPassword("Enter password for " + username + ":")); UserContext context = UserContext.signIn(username, password, network, crypto).get(); context.renewUsernameClaim(expiry).get(); System.out.println("Logged in " + username + " successfully!"); }
Source:
public void read( PropertyRecord record, PageCursor cursor, RecordLoad mode, int recordSize ) throws IOException { int offset = cursor.getOffset(); byte headerByte = cursor.getByte(); boolean inUse = isInUse( headerByte ); boolean useFixedReferences = has( headerByte, HEADER_BIT_FIXED_REFERENCE ); if ( mode.shouldLoad( inUse ) ) { int blockCount = headerByte >>> 4; long recordId = record.getId(); if ( useFixedReferences ) { readFixedReferencesRecord( record, cursor ); } else { record.initialize( inUse, toAbsolute( Reference.decode( cursor ), recordId ), toAbsolute( Reference.decode( cursor ), recordId ) ); } record.setUseFixedReferences( useFixedReferences ); if ( (blockCount > record.getBlockCapacity()) || (RECORD_SIZE - (cursor.getOffset() - offset) < blockCount * Long.BYTES) ) { cursor.setCursorException( "PropertyRecord claims to contain more blocks than can fit in a record" ); return; } while ( blockCount-- > 0 ) { record.addLoadedBlock( cursor.getLong() ); } } }

Target:
public void read( PropertyRecord record, PageCursor cursor, RecordLoad mode, int recordSize ) { int offset = cursor.getOffset(); byte headerByte = cursor.getByte(); boolean inUse = isInUse( headerByte ); boolean useFixedReferences = has( headerByte, HEADER_BIT_FIXED_REFERENCE ); if ( mode.shouldLoad( inUse ) ) { int blockCount = headerByte >>> 4; long recordId = record.getId(); if ( useFixedReferences ) { readFixedReferencesRecord( record, cursor ); } else { record.initialize( inUse, toAbsolute( Reference.decode( cursor ), recordId ), toAbsolute( Reference.decode( cursor ), recordId ) ); } record.setUseFixedReferences( useFixedReferences ); if ( (blockCount > record.getBlockCapacity()) | (RECORD_SIZE - (cursor.getOffset() - offset) < blockCount * Long.BYTES) ) { cursor.setCursorException( "PropertyRecord claims to contain more blocks than can fit in a record" ); return; } while ( blockCount-- > 0 ) { record.addLoadedBlock( cursor.getLong() ); } } }
Source:
public Table<String, String, Set<String>> getPageMultiTrees(final IHTMLPage page, final boolean liveMode) throws DotDataException, DotSecurityException { Table<String, String, Set<String>> pageContents = HashBasedTable.create(); List<MultiTree> multis = MultiTreeFactory.getMultiTrees(page.getIdentifier()); for (MultiTree t : multis) { Container container = (liveMode) ? (Container) vers.findLiveVersion(t.getContainer(), sys, false) : (Container) vers.findWorkingVersion(t.getContainer(), sys, false); if(container==null && ! liveMode) { continue; } Contentlet contentlet = null; try { contentlet = conAPI.findContentletByIdentifier(t.getContentlet(), liveMode, -1, sys, false); }catch(Exception e){ Logger.warn(this.getClass(), "invalid contentlet on multitree:" + t); } if(contentlet==null ) { continue; }; Set<String> myContents = pageContents.contains(t.getContainer(), t.getRelationType()) ? pageContents.get(t.getContainer(), t.getRelationType()) : new LinkedHashSet<>(); if(myContents.size()< container.getMaxContentlets()) { myContents.add(t.getContentlet()); } else { } pageContents.put(t.getContainer(), t.getRelationType(), myContents); } return pageContents; }

Target:
public Table<String, String, Set<String>> getPageMultiTrees(final IHTMLPage page, final boolean liveMode) throws DotDataException, DotSecurityException { final Table<String, String, Set<String>> pageContents = HashBasedTable.create(); final List<MultiTree> multiTres = MultiTreeFactory.getMultiTrees(page.getIdentifier()); for (final MultiTree multiTree : multiTres) { final Container container = (liveMode) ? (Container) versionableAPI.findLiveVersion(multiTree.getContainer(), systemUser, false) : (Container) versionableAPI.findWorkingVersion(multiTree.getContainer(), systemUser, false); if(container==null && ! liveMode) { continue; } Contentlet contentlet = null; try { contentlet = contentletAPI.findContentletByIdentifier(multiTree.getContentlet(), liveMode, -1, systemUser, false); }catch(DotDataException | DotSecurityException | DotContentletStateException e){ Logger.warn(this.getClass(), "invalid contentlet on multitree:" + multiTree); } if(contentlet!=null ) { final Set<String> myContents = pageContents.contains(multiTree.getContainer(), multiTree.getRelationType()) ? pageContents.get(multiTree.getContainer(), multiTree.getRelationType()) : new LinkedHashSet<>(); if(container != null && myContents.size() < container.getMaxContentlets()) { myContents.add(multiTree.getContentlet()); } pageContents.put(multiTree.getContainer(), multiTree.getRelationType(), myContents); }; } return pageContents; }
Source:
public void testGetOpenEngSBModelEntries_shouldWork() { TestModel model = service.createEmptyModelObject(TestModel.class); String id = "testId"; Date date = new Date(); model.setDate(date); model.setId(id); List<OpenEngSBModelEntry> entries = model.getOpenEngSBModelEntries(); boolean idExisting = false; boolean dateExisting = false; boolean nameExisting = false; String tempId = null; Date tempDate = null; String tempName = null; for (OpenEngSBModelEntry entry : entries) { if (entry.getKey().equals("id")) { idExisting = true; tempId = (String) entry.getValue(); } else if (entry.getKey().equals("date")) { dateExisting = true; tempDate = (Date) entry.getValue(); } else if (entry.getKey().equals("name")) { nameExisting = true; tempName = (String) entry.getValue(); } } assertThat(idExisting, is(true)); assertThat(dateExisting, is(true)); assertThat(nameExisting, is(true)); assertThat(tempId, is(id)); assertThat(tempDate, is(date)); assertThat(tempName, nullValue()); }

Target:
public void testGetOpenEngSBModelEntries_shouldWork() { TestModel model = service.createEmptyModelObject(TestModel.class); String id = "testId"; model.setId(id); List<OpenEngSBModelEntry> entries = model.getOpenEngSBModelEntries(); boolean idExisting = false; String tempId = null; for (OpenEngSBModelEntry entry : entries) { if (entry.getKey().equals("id")) { idExisting = true; tempId = (String) entry.getValue(); } } assertThat(idExisting, is(true)); assertThat(tempId, is(id)); }
Source:
private void testEditSessionAction() throws Exception { ______TS("typical success case"); feedbackEditPage.clickManualPublishTimeButton(); feedbackEditPage.clickDefaultVisibleTimeButton(); feedbackEditPage.editFeedbackSession(editedSession.startTime, editedSession.endTime, editedSession.instructions, editedSession.gracePeriod); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_EDITED); FeedbackSessionAttributes savedSession = BackDoor.getFeedbackSession( editedSession.courseId, editedSession.feedbackSessionName); assertEquals(editedSession.toString(), savedSession.toString()); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackEditSuccess.html"); ______TS("test edit page session visibility period settings after manual publish"); editedSession.resultsVisibleFromTime = Const.TIME_REPRESENTS_NOW; String status = BackDoor.editFeedbackSession(editedSession); assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status); feedbackEditPage = getFeedbackEditPage(); assertFalse(feedbackEditPage.isElementSelected(Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON + "_atvisible")); feedbackEditPage.clickEditSessionButton(); feedbackEditPage.clickEditUncommonSettingsButton(); feedbackEditPage.clickDefaultPublishTimeButton(); feedbackEditPage.clickSaveSessionButton(); }

Target:
private void testEditSessionAction() throws Exception { ______TS("typical success case"); feedbackEditPage.clickManualPublishTimeButton(); feedbackEditPage.clickDefaultVisibleTimeButton(); feedbackEditPage.editFeedbackSession(editedSession.startTime, editedSession.endTime, editedSession.instructions, editedSession.gracePeriod); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_EDITED); FeedbackSessionAttributes savedSession = BackDoor.getFeedbackSession( editedSession.courseId, editedSession.feedbackSessionName); assertEquals(editedSession.toString(), savedSession.toString()); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackEditSuccess.html"); ______TS("test edit page not changed after manual publish"); editedSession.resultsVisibleFromTime = Const.TIME_REPRESENTS_NOW; String status = BackDoor.editFeedbackSession(editedSession); assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status); feedbackEditPage = getFeedbackEditPage(); feedbackEditPage.verifyHtml("/instructorFeedbackEditManuallyPublished.html"); feedbackEditPage.clickEditSessionButton(); feedbackEditPage.clickEditUncommonSettingsButton(); feedbackEditPage.clickDefaultPublishTimeButton(); feedbackEditPage.clickSaveSessionButton(); }
Source:
StatsDProcessor(final int queueSize, final StatsDClientErrorHandler handler, final int maxPacketSizeBytes, final int poolSize, final int workers) throws Exception { this.handler = handler; this.workers = workers; this.executor = Executors.newFixedThreadPool(workers); this.bufferPool = new BufferPool(poolSize, maxPacketSizeBytes, true); this.outboundQueue = new ArrayBlockingQueue<ByteBuffer>(poolSize); this.endSignal = new CountDownLatch(workers); this.builders = new ArrayList<>(workers); this.charBuffers = new ArrayList<>(workers); for (int i = 0 ; i < workers ; i++) { StringBuilder builder = new StringBuilder(); CharBuffer buffer = CharBuffer.wrap(builder); builders.add(builder); charBuffers.add(buffer); } }

Target:
StatsDProcessor(final int queueSize, final StatsDClientErrorHandler handler, final int maxPacketSizeBytes, final int poolSize, final int workers) throws Exception { this.handler = handler; this.workers = workers; this.executor = Executors.newFixedThreadPool(workers); this.bufferPool = new BufferPool(poolSize, maxPacketSizeBytes, true); this.outboundQueue = new ArrayBlockingQueue<ByteBuffer>(poolSize); this.endSignal = new CountDownLatch(workers); }
Source:
public void add(String item, long count) { item = item.trim(); String sql = "insert into counts (item, value) values(?,?)"; try { Connection c = getConnection(dbFile); PreparedStatement stmt = c.prepareStatement(sql); stmt.setString(1, item); stmt.setLong(2, count); stmt.executeUpdate(); } catch (Exception ex) { logger.info("Cannot add (" + item + ", " + count + ")"); throw new RuntimeException(ex); } }

Target:
public void add(String item, long count) { item = item.trim(); String sql = "insert into counts (item, value) values(?,?)"; try { Connection c = getConnection(dbFile); PreparedStatement stmt = c.prepareStatement(sql); stmt.setString(1, item); stmt.setLong(2, count); stmt.executeUpdate(); } catch (Exception ex) { System.err.println("Cannot add (" + item + ", " + count + ")"); throw new RuntimeException(ex); } }
Source:
public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException { ArrayList<Record> records = new ArrayList<>(); records.add(new Record(0, 0)); records.add(new Record(1, 0)); records.add(new Record(2, 0)); records.add(new Record(3, 0)); TreeNode root = new BuildTree().buildTree(records); assertNodeIsBranch(root, 0, 3); assertNodeIsLeaf(root.children.get(0), 1); assertNodeIsLeaf(root.children.get(1), 2); assertNodeIsLeaf(root.children.get(2), 3); }

Target:
public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException { ArrayList<Record> records = new ArrayList<>(); records.add(new Record(0, 0)); records.add(new Record(1, 0)); records.add(new Record(2, 0)); records.add(new Record(3, 0)); TreeNode root = new BuildTree().buildTree(records); assertNodeIsBranchWithNNumberOfChildren(root, 3); assertNodeIsLeaf(root.getChildren().get(0)); assertNodeIsLeaf(root.getChildren().get(1)); assertNodeIsLeaf(root.getChildren().get(2)); assertEquals(root.getNodeId(), 0); assertEquals(root.getChildren().get(0).getNodeId(), 1); assertEquals(root.getChildren().get(1).getNodeId(), 2); assertEquals(root.getChildren().get(2).getNodeId(), 3); }
Source:
public void testRegexpFunctionExtension3() throws InterruptedException { log.info("RegexpFunctionExtension TestCase with invalid datatype"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "define stream inputStream (symbol int, price long, regex string);"; String query = ("@info(name = 'query1') from inputStream select symbol , str:regexp(symbol, regex) as beginsWithWSO2 " + "insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }

Target:
public void testRegexpFunctionExtension3() throws InterruptedException { log.info("RegexpFunctionExtension TestCase"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "define stream inputStream (symbol string, price long, regex string);"; String query = ("@info(name = 'query1') from inputStream select symbol , " + "str:regexp(symbol) as beginsWithWSO2 " + "insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime (inStreamDefinition + query); executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }
Source:
private static <S extends OafEntity, T extends SpecificRecord>JavaRDD<T> parseToAvro(JavaRDD<S> source, OafEntityToAvroConverter<S, T> entityConverter) { return source.map(x -> entityConverter.convert(x)).filter(x -> x != null); }

Target:
private static <S extends OafEntity, T extends SpecificRecord>JavaRDD<T> parseToAvro(JavaRDD<S> source, OafEntityToAvroConverter<S, T> entityConverter) { return source.map(entityConverter::convert).filter(Objects::nonNull); }
Source:
public void startExport(Process process) throws IOException, DAOException { User user = ServiceManager.getUserService().getAuthenticatedUser(); URI userHome = ServiceManager.getUserService().getHomeDirectory(user); boolean exported = process.isExported(); process.setExported(true); boolean exportSucessfull = startExport(process, userHome); if (exportSucessfull) { if (Objects.nonNull(process.getParent())) { startExport(process.getParent()); } } else { process.setExported(exported); } }

Target:
public void startExport(Process process) throws DAOException, DataException, IOException { User user = ServiceManager.getUserService().getAuthenticatedUser(); URI userHome = ServiceManager.getUserService().getHomeDirectory(user); boolean exportSucessfull = startExport(process, userHome); if (exportSucessfull) { if (Objects.nonNull(process.getParent())) { startExport(process.getParent()); } } }
Source:
protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE && getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.CINDER) { addCanDoActionMessageVariable("diskId", getParameters().getDiskImage().getId()); addCanDoActionMessageVariable("storageType", getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExist())) { addCanDoActionMessageVariable("diskId", getParameters().getDiskImage().getId()); addCanDoActionMessageVariable("domainId", getStorageDomainId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_UNAVAILABLE); return false; } if (!getStorageDomain().getStorageDomainType().isDataDomain() && !(getStorageDomain().getStorageDomainType() == StorageDomainType.Volume)) { addCanDoActionMessageVariable("domainId", getParameters().getStorageDomainId()); addCanDoActionMessageVariable("domainType", getStorageDomain().getStorageDomainType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED); return false; } if (getParameters().getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE && !setAndValidateDiskProfiles()) { return false; } return true; }

Target:
protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE) { addCanDoActionMessageVariable("diskId", getParameters().getDiskImage().getId()); addCanDoActionMessageVariable("storageType", getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExist())) { addCanDoActionMessageVariable("diskId", getParameters().getDiskImage().getId()); addCanDoActionMessageVariable("domainId", getStorageDomainId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_UNAVAILABLE); return false; } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { addCanDoActionMessageVariable("domainId", getParameters().getStorageDomainId()); addCanDoActionMessageVariable("domainType", getStorageDomain().getStorageDomainType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED); return false; } if (!setAndValidateDiskProfiles()) { return false; } return true; }
Source:
public void testWithValidTestNamesFromMultiChildSuites() throws MalformedURLException { JarFileUtils utils = newJarFileUtils(Arrays.asList("testng-tests-child2", "testng-tests-child4", "testng-tests-child5")); String[] expectedTestNames = new String[]{"testng-tests-child2", "testng-tests-child4", "testng-tests-child5"}; String[] expectedClassNames = new String[]{"" + "org.testng.jarfileutils.org.testng.SampleTest2", "org.testng.jarfileutils.org.testng.SampleTest4", "org.testng.jarfileutils.org.testng.SampleTest5"}; List<XmlSuite> suites = utils.extractSuitesFrom(jar); assertThat(suites).hasSize(3); XmlSuite suite = suites.get(0); assertThat(suite.getName()).isEqualTo("testng-tests-suite"); List<String> testNames = new LinkedList<>(); List<String> classNames = new LinkedList<>(); for(XmlSuite xmlSuite : suites){ extractClassNames(xmlSuite, testNames, classNames); } assertThat(testNames).containsExactly(expectedTestNames); assertThat(classNames).contains(expectedClassNames); }

Target:
public void testWithValidTestNamesFromMultiChildSuites() throws MalformedURLException { JarFileUtils utils = newJarFileUtils(Arrays.asList("testng-tests-child2", "testng-tests-child4", "testng-tests-child5")); String[] expectedTestNames = new String[]{"testng-tests-child2", "testng-tests-child4", "testng-tests-child5"}; String[] expectedClassNames = new String[]{ "org.testng.jarfileutils.org.testng.SampleTest2", "org.testng.jarfileutils.org.testng.SampleTest4", "org.testng.jarfileutils.org.testng.SampleTest5"}; List<XmlSuite> suites = utils.extractSuitesFrom(jar); assertThat(suites).hasSize(3); XmlSuite suite = suites.get(0); assertThat(suite.getName()).isEqualTo("testng-tests-suite"); List<String> testNames = new LinkedList<>(); List<String> classNames = new LinkedList<>(); for(XmlSuite xmlSuite : suites){ extractClassNames(xmlSuite, testNames, classNames); } assertThat(testNames).containsExactly(expectedTestNames); assertThat(classNames).contains(expectedClassNames); }
Source:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp = args[0]; abvs.reset(); sb.reset(abvs); try { if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(sp); int size1 = sp.getEntryCount(); for (int i = 0; i < size1; i++) { sp.getEntry(i, tempTvp); if (tempTvp.getTag() == ValueTag.ARRAY_TAG) { tempTvp.getValue(ap); ap.appendSequence(sb); } else { XDMConstants.setEmptySequence(result); } } } else if (tvp.getTag() == ValueTag.ARRAY_TAG) { tvp.getValue(ap); ap.appendSequence(sb); } else { XDMConstants.setEmptySequence(result); } sb.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } }

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp = args[0]; try { abvs.reset(); sb.reset(abvs); if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(sp); int size1 = sp.getEntryCount(); for (int i = 0; i < size1; i++) { sp.getEntry(i, tempTvp); if (tempTvp.getTag() == ValueTag.ARRAY_TAG) { tempTvp.getValue(ap); ap.appendItems(sb); } } } else if (tvp.getTag() == ValueTag.ARRAY_TAG) { tvp.getValue(ap); ap.appendItems(sb); } sb.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } }
Source:
public void tenantUpdate(WebContext ctx, JSONStructuredOutput out, String tenantId) { T tenant = find(getTenantClass(), tenantId); assertNotNew(tenant); load(ctx, tenant); if (ctx.hasParameter(Tenant.TENANT_DATA.inner(TenantData.CONFIG_STRING).getName())) { tenant.getTenantData().getConfig(); } tenant.getTenantData().getPackageData().getAdditionalPermissions().clear(); for (String permission : ctx.getParameters("permissions")) { if (getPermissions().contains(permission)) { tenant.getTenantData().getPackageData().getAdditionalPermissions().add(permission); } } tenant.getMapper().update(tenant); }

Target:
public void tenantUpdate(WebContext ctx, JSONStructuredOutput out, String tenantId) { T tenant = find(getTenantClass(), tenantId); assertNotNew(tenant); load(ctx, tenant); if (ctx.hasParameter(Tenant.TENANT_DATA.inner(TenantData.CONFIG_STRING).getName())) { tenant.getTenantData().getConfig(); } tenant.getMapper().update(tenant); }
Source:
private String getDefaultFilename() throws UnknownHostException { String hostName = InetAddress.getLocalHost().getHostName(); String safeFilename = hostName.replaceAll( "[^a-zA-Z0-9._]+", "_" ); SimpleDateFormat dumpFormat = new SimpleDateFormat( "yyyy-MM-dd_HHmmss" ); return safeFilename + "-" + dumpFormat.format( new Date() ) + ".zip"; }

Target:
private String getDefaultFilename() throws UnknownHostException { String hostName = InetAddress.getLocalHost().getHostName(); String safeFilename = hostName.replaceAll( "[^a-zA-Z0-9._]+", "_" ); return safeFilename + "-" + LocalDateTime.now().format( filenameDateTimeFormatter ) + ".zip"; }
Source:
private List<String> parseJournals(Site site, List<String> journalParams, String unformattedQuery) { if (!Strings.isNullOrEmpty(unformattedQuery) && (journalParams == null || journalParams.isEmpty())) { return new ArrayList(siteSet.getJournalKeys()); } else { if (journalParams == null || journalParams.isEmpty()) { return Collections.singletonList(site.getJournalKey()); } else { if (journalParams.get(0).toLowerCase().equals("all")) { return new ArrayList(siteSet.getJournalKeys()); } return journalParams; } } }

Target:
private List<String> parseJournals(Site site, List<String> journalParams, String unformattedQuery) { boolean journalParamsEmpty = journalParams == null || journalParams.isEmpty(); if ((!Strings.isNullOrEmpty(unformattedQuery) && journalParamsEmpty) || (journalParams != null && journalParams.get(0).equalsIgnoreCase("all"))) { return new ArrayList(siteSet.getJournalKeys()); } else { if (journalParamsEmpty) { return Collections.singletonList(site.getJournalKey()); } else { return journalParams; } } }
Source:
public FileformatInterface readMetadataFile(Process process) throws ReadException, IOException, PreferencesException { URI metadataFileUri = serviceManager.getFileService().getMetadataFilePath(process); if (!checkForMetadataFile(process)) { throw new IOException(Helper.getTranslation("metadataFileNotFound") + " " + metadataFileUri); } String type = MetadatenHelper.getMetaFileType(metadataFileUri); logger.debug("current meta.xml file type for id {}: {}", process.getId(), type); FileformatInterface ff = determineFileFormat(type, process); try { ff.read(serviceManager.getFileService().getFile(metadataFileUri).toString()); } catch (ReadException e) { if (e.getMessage().startsWith("Parse error at line -1")) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("metadataCorrupt"); } else { throw e; } } return ff; }

Target:
public FileformatInterface readMetadataFile(Process process) throws ReadException, IOException, PreferencesException { URI metadataFileUri = serviceManager.getFileService().getMetadataFilePath(process); if (!checkForMetadataFile(process)) { throw new IOException(Helper.getTranslation("metadataFileNotFound") + " " + metadataFileUri); } String type = MetadatenHelper.getMetaFileType(metadataFileUri); logger.debug("current meta.xml file type for id {}: {}", process.getId(), type); FileformatInterface ff = determineFileFormat(type, process); try { ff.read(serviceManager.getFileService().getFile(metadataFileUri).toString()); } catch (ReadException e) { if (e.getMessage().startsWith("Parse error at line -1")) { Helper.setErrorMessage("metadataCorrupt", logger, e); } else { throw e; } } return ff; }
Source:
public static void bootstrap() throws IOException { String profile = System.getProperty(PROPERTY_PROFILE, PROFILE_MEMORY); LOGGER.info(String.format("Bootstrap OrientDB connection properties with profile [%s].", profile)); try (InputStream is = ConnectionConfigOrientDB.class.getResourceAsStream(String.format("/%s.properties", profile))) { Properties properties = new Properties(); properties.load(is); properties.keySet() .stream() .forEach(p -> { if (System.getProperty((String) p) != null) { return; } LOGGER.info(String.format("Use default value for OrientDB connection property [%s].", p)); System.setProperty((String) p, properties.getProperty((String) p)); }); } }

Target:
public static void bootstrap() throws IOException { String profile = System.getProperty(PROPERTY_PROFILE, PROFILE_MEMORY); logger.info(String.format("Bootstrap OrientDB connection properties with profile [%s].", profile)); try (InputStream is = ConnectionConfigOrientDB.class.getResourceAsStream(String.format("/%s.properties", profile))) { Properties properties = new Properties(); properties.load(is); properties.keySet() .stream() .forEach(p -> { if (System.getProperty((String) p) != null) { return; } logger.info(String.format("Use default value for OrientDB connection property [%s].", p)); System.setProperty((String) p, properties.getProperty((String) p)); }); } }
Source:
public ResponseEntity removeRepository(@ApiParam(value = "The storageId", required = true) @PathVariable final String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable final String repositoryId, @ApiParam(value = "Whether to force delete the repository from the file system") @RequestParam(name = "force", defaultValue = "false") final boolean force) { final Repository repository = configurationManagementService.getStorage(storageId) .getRepository(repositoryId); if (repository != null) { try { logger.debug(storageId); logger.debug(repositoryId); repositoryIndexManager.closeIndexer(storageId + ":" + repositoryId); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists() && force) { repositoryManagementService.removeRepository(storageId, repository.getId()); } Configuration configuration = getConfiguration(); Storage storage = configuration.getStorage(storageId); storage.removeRepository(repositoryId); configurationManagementService.saveStorage(storage); logger.debug("Removed repository " + storageId + ":" + repositoryId + "."); return ResponseEntity.ok().build(); } catch (IOException | ConfigurationException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body("Failed to remove repository " + repositoryId + "!"); } } else { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("Repository " + storageId + ":" + repositoryId + " was not found."); } }

Target:
public ResponseEntity removeRepository(@ApiParam(value = "The storageId", required = true) @PathVariable final String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable final String repositoryId, @ApiParam(value = "Whether to force delete the repository from the file system") @RequestParam(name = "force", defaultValue = "false") final boolean force) { final Repository repository = configurationManagementService.getStorage(storageId) .getRepository(repositoryId); if (repository != null) { try { repositoryIndexManager.closeIndexer(storageId + ":" + repositoryId); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists() && force) { repositoryManagementService.removeRepository(storageId, repository.getId()); } Configuration configuration = getConfiguration(); Storage storage = configuration.getStorage(storageId); storage.removeRepository(repositoryId); configurationManagementService.saveStorage(storage); logger.debug("Removed repository " + storageId + ":" + repositoryId + "."); return ResponseEntity.ok().build(); } catch (IOException | ConfigurationException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body("Failed to remove repository " + repositoryId + "!"); } } else { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("Repository " + storageId + ":" + repositoryId + " was not found."); } }
Source:
public String toString() { return String.format("JobId : %s, StepId : %s, Execution Method : %s", jobId, stepId, executionMethod); }

Target:
public String toString() { return ToStringBuilder.forInstance(this) .append("JobId", jobId) .append("StepId", stepId) .append("Execution Method", executionMethod).build(); }